public function getModuleSupportLink(Aitoc_Aitsys_Model_Module $module, $onlyUrl = true) { $url = $this->tool()->getAitocUrl() . 'contacts.html?'; if ($serial = $module->getInfo()->getSerial()) { $url .= $serial . '&'; } if ($moduleId = $module->getInfo()->getProductId()) { $url .= $moduleId . '&'; } $url .= 'support'; if ($onlyUrl) { return $url; } return '<a target="_blank" href="' . $url . '">' . $this->__('Create support ticket') . '</a>'; }
/** * @param Aitoc_Aitsys_Model_Module $module * @param Varien_Data_Form_Element_Fieldset $fieldset */ protected function _addModule(Aitoc_Aitsys_Model_Module $module, Varien_Data_Form_Element_Fieldset $fieldset) { if ($module->isIgnore()) { return false; } $aModule = $module; $label = $module->getInfo()->getLabel() . ($module->getInfo()->getVersion() ? ' v' . $module->getInfo()->getVersion() : ''); $message = ''; $messageType = 'notice-msg'; $isDemo = false; if ($this->tool()->platform()->hasDemoMode()) { $xml = simplexml_load_file(Mage::getBaseDir() . "/aitmodules.xml"); $link = (string) $xml->modules->{$aModule}['key']; if ($link == '') { $link = $this->tool()->getAitocUrl(); } $message = Mage::helper('aitsys')->__("The extension is already enabled on this Demo Magento installation and can't be disabled for security reasons. Please proceed to the next step outlined in the extension's <a href='%s' target='_blank'>User Manual</a> to see how it works.", $link); $isDemo = true; } elseif (defined('COMPILER_INCLUDE_PATH')) { $compilerUrl = version_compare(Mage::getVersion(), '1.5.0.0', '>=') ? Mage::helper('adminhtml')->getUrl('adminhtml/compiler_process/index/') : Mage::helper('adminhtml')->getUrl('compiler/process/index/'); $message = Mage::helper('aitsys')->__('Before activating or deactivating the extension please turn off the compiler at <br /><a href="%s">System > Tools > Compilation</a>', $compilerUrl); $messageType = 'warning-msg'; } elseif (!$module->getInfo()->isMagentoCompatible()) { $message = Mage::helper('aitsys/strings')->getString('ER_ENT_HASH'); } elseif (!$module->getAccess()) { $message = Mage::helper('aitsys')->__('File does not have write permissions: %s', $aModule['file']); $messageType = 'error-msg'; } if ($module->getInfo()->getSerial()) { $info = 'S/N: ' . $module->getInfo()->getSerial(); } if ($aModule['key'] == 'Aitoc_Common') { $info = 'Used by other AITOC\'s modules. Do not disable.'; } if ($message && $messageType != 'notice-msg' || $isDemo) { $field = $fieldset->addField('ignore_' . $aModule['key'], 'note', array('name' => 'ignore[' . $aModule['key'] . ']', 'label' => $label, 'info' => empty($info) ? '' : $info, 'note' => '<ul class="messages"><li class="' . $messageType . '"><ul><li>' . $message . '</li></ul></li></ul>', 'module' => $module)); if (!$isDemo) { $field->setRenderer($this->_elementRenderer); } return; } $fieldset->addField('hidden_enable_' . $aModule['key'], 'hidden', array('name' => 'enable[' . $aModule['key'] . ']', 'value' => 0)); $fieldset->addField('enable_' . $aModule['key'], 'checkbox', array('name' => ($module->getAccess() ? 'enable' : 'ignore') . '[' . $aModule['key'] . ']', 'label' => $label, 'value' => 1, 'checked' => $aModule['value'], 'note' => $message ? '<ul class="messages"><li class="' . $messageType . '"><ul><li>' . $message . '</li></ul></li></ul>' : '', 'info' => empty($info) ? '' : $info, 'module' => $module))->setRenderer($this->_elementRenderer); }
protected function _makeKey(Aitoc_Aitsys_Model_Module $module) { return self::CONFIG_ENTITY_PREFIX . strtolower($module->getKey()); }
protected function _rememberAitsysNotification(Aitoc_Aitsys_Model_Module $module, $type) { Mage::register('aitsys_notification', array('module' => $module->getKey(), 'type' => $type), true); }
/** * * @param $path * @return Aitoc_Aitsys_Model_Module */ protected function _makeModuleByModuleFile($path) { $moduleFile = new SplFileInfo($path); $file = $moduleFile->getFilename(); list($key) = explode('.', $file); $this->tool()->testMsg('Check: ' . $key . ' -- ' . $file); if ($module = isset($this->_modules[$key]) ? $this->_modules[$key] : null) { return $module; } $this->tool()->testMsg('Create: ' . $key); $module = new Aitoc_Aitsys_Model_Module(); $module->loadByModuleFile($path, $key); return $this->_modules[$key] = $module; }
/** * Load certain module by using its main config file * * @param string $moduleKey * @param string $moduleFile * * @return Aitoc_Aitsys_Model_Module */ protected function _makeModuleByModuleFile($moduleKey, $moduleFile) { $this->tool()->testMsg('Check: ' . $moduleKey . ' -- ' . $moduleFile); // check if module was already loaded during licensed modules load if ($module = isset($this->_modules[$moduleKey]) ? $this->_modules[$moduleKey] : null) { return $module; } $this->tool()->testMsg('Create: ' . $moduleKey); $module = new Aitoc_Aitsys_Model_Module(); $module->loadByModuleFile($moduleFile, $moduleKey); if ($this->isIgnoredModule($moduleKey)) { $module->setErrorMessageType($this->_moduleIgnoreList[$moduleKey]); } return $this->_modules[$moduleKey] = $module; }
/** * Load certain module by using its main config file * * @param string $moduleKey * @param string $moduleFile * * @return Aitoc_Aitsys_Model_Module */ protected function _makeModuleByModuleFile($moduleKey, $moduleFile, $ignore = false) { $this->tool()->testMsg('Load module: ' . $moduleKey); $module = new Aitoc_Aitsys_Model_Module(); $module->loadByModuleFile($moduleFile, $moduleKey); $module->setIgnore($ignore); return $this->_modules[$moduleKey] = $module; }