public function onBeforeRender() { $user = JFactory::getUser(); if (!$user->authorise('core.manage', 'com_modules')) { return; } $input = new JInput(); if ($input->get('option') == 'com_templateck' && $input->get('view') == 'template') { return; } // to not show in the template creator preview if ($input->get('template') == 'templatecreatorck' && $input->get('tmpl') == 'preview') { return; } if ($input->get('option', '', 'string') == 'com_modulesmanagerck' && $input->get('ck', 0, 'int') != 1) { // $this->cleanCss(); $this->isedit = true; } if ($input->get('option', '', 'string') == 'com_modulesmanagerck' || $input->get('option', '', 'string') == 'com_media' || $input->get('format', '', 'string') == 'raw') { return; } $this->showbutton = true; $this->addManagerButtonCss(); if ($input->get('ck', 0, 'int') == 1) { $doc = JFactory::getDocument(); JHtml::_('stylesheet', 'components/com_modulesmanagerck/assets/modulesmanagerck.css'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.combobox'); $positions = $this->getPositions($doc->template); include_once JPATH_ROOT . '/components/com_modulesmanagerck/helpers/modulesmanager.php'; $ckmodulesmanager = new CKModulesManager(); // JFactory::getCache()->clean('com_modules', ''); foreach ($positions as $position) { $html = $ckmodulesmanager->createPosition($position); $doc->setBuffer($html, "modules", $position); } } }
public function addModuleAjax() { // Get the input $input = JFactory::getApplication()->input; $extensionid = $input->get('extensionid', 0, 'int'); $position = $input->get('position', '', 'string'); $ordering = $input->get('ordering', 0, 'int'); $type = $input->get('type', '', 'string'); // Get the model $model = $this->getModel('Module'); // Save the ordering $return = $model->addmodule($extensionid, $position, $ordering, $type); if ($return) { if (!class_exists('CKModulesManager')) { include_once JPATH_ROOT . '/components/com_modulesmanagerck/helpers/modulesmanager.php'; } $ckmodulesmanager = new CKModulesManager(); echo $ckmodulesmanager->createModule($return); return $ckmodulesmanager->createModule($return); } return false; // Close the application JFactory::getApplication()->close(); }
<?php /** * @name Modules Manager CK * @package com_modulesmanagerck * @copyright Copyright (C) 2013. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr */ // no direct access defined('_JEXEC') or die; $document = JFactory::getDocument(); $ckmodulesmanager = new CKModulesManager(); $input = new JInput(); $id = $input->get('id', 0, 'int'); $position = $input->get('position', '', 'string'); $title = $input->get('title', '', 'string'); $type = $input->get('type', '', 'string'); $ckmodulesmanager->createModule($id, $position, $title, $type);