function onAfterRender() { if ($this->_pass) { if (JFactory::getApplication()->input->get('option') == 'com_modules') { $config = plgSystemAdvancedModulesConfig(); if (!$config->show_switch) { return; } $body = JResponse::getBody(); if (JFactory::getApplication()->input->get('view') == 'module') { $url = JRoute::_('index.php?option=com_advancedmodules&task=module.edit&id=' . (int) JFactory::getApplication()->input->get('id')); } else { $url = JRoute::_('index.php?option=com_advancedmodules'); } $link = '<a style="float:right;" href="' . $url . '">' . JText::_('AMM_SWITCH_TO_ADVANCED_MODULES_MANAGER') . '</a><div style="clear:both;"></div>'; $body = preg_replace('#(</script>\\s*)(<form)#', '\\1' . $link . '\\2', $body); $body = preg_replace('#(</form>\\s*)((<\\!--.*?-->\\s*)*</div>)#', '\\1' . $link . '\\2', $body); JResponse::setBody($body); } else { $body = JResponse::getBody(); $body = preg_replace('#(option=com_)(modules[^a-z-_])#', '\\1advanced\\2', $body); $body = str_replace(array('option=com_advancedmodules&force=1', 'option=com_advancedmodules&force=1'), 'option=com_modules', $body); JResponse::setBody($body); } } }
/** * Draws the menu for Editing an existing module */ function _EDIT($client) { $config = plgSystemAdvancedModulesConfig(); $moduleType = JRequest::getCmd('module'); $cid = JRequest::getVar('cid', array(0), '', 'array'); JArrayHelper::toInteger($cid, array(0)); JToolBarHelper::title(JText::_('AMM_MODULE') . ': <small><small>[ ' . JText::_('Edit') . ' ]</small></small>', 'module.png'); if ($moduleType == 'custom') { JToolBarHelper::Preview('index.php?option=com_advancedmodules&tmpl=component&client=' . $client->id . '&pollid=' . $cid['0']); } JToolBarHelper::save(); JToolBarHelper::apply(); if ($cid['0']) { // for existing items the button is renamed `close` JToolBarHelper::cancel('cancel', 'Close'); } else { JToolBarHelper::cancel(); } if ($config->show_config_in_item) { JToolBarHelper::preferences('com_advancedmodules', '500'); } JToolBarHelper::help('screen.modules.edit'); }
function onAfterRoute() { $this->_pass = 0; $mainframe =& JFactory::getApplication(); if ($mainframe->isSite()) { return; } $document =& JFactory::getDocument(); $docType = $document->getType(); // only in html if ($docType != 'html') { return; } // load the admin language file $lang =& JFactory::getLanguage(); $lang->load('com_advancedmodules', JPATH_ADMINISTRATOR); // load English language file as fallback (for undefined stuff in other language file) $lang->_load(JPATH_ADMINISTRATOR . DS . 'language' . DS . 'en-GB' . DS . 'en-GB.com_advancedmodules.ini', 'plg_' . $this->_type . '_' . $this->_name, 0); // return if NoNumber! Elements plugin is not installed jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements.php')) { if ($mainframe->isAdmin() && JRequest::getCmd('option') !== 'com_login') { $mainframe->enqueueMessage('', 'error'); $msg = JText::_('AMM_NONUMBER_ELEMENTS_PLUGIN_NOT_INSTALLED'); foreach ($mainframe->_messageQueue as $m) { if ($m['message'] == $msg) { $msg = ''; break; } } $mainframe->enqueueMessage($msg, 'error'); } return; } if (JRequest::getCmd('option') == 'com_modules') { return; } if (!JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_advancedmodules' . DS . 'admin.advancedmodules.php')) { return; } $this->_pass = 1; // Include the Helper require_once JPATH_PLUGINS . DS . $this->_type . DS . $this->_name . DS . 'helper.php'; $class = get_class($this) . 'Helper'; $this->helper = new $class(); // Load component config $this->helper->config = plgSystemAdvancedModulesConfig(); }