Application->isModuleEnabled($params['name']); } function _hasPrivileges() { return $this->Application->RecallVar('user_id') == USER_ROOT; } function AlreadyInstalled($params) { if (!$this->_hasPrivileges()) { // don't show licenses status for non-privileged users return true; } $object =& $this->getObject($params); /* @var $object kDBList */ $modules_helper =& $this->Application->recallObject('ModulesHelper'); /* @var $modules_helper kModulesHelper */ return $modules_helper->moduleInstalled( $object->GetDBField('Name') ); } function ModuleLicensed($params) { if (!$this->_hasPrivileges()) { // don't show licenses status for non-privileged users return true; } $object =& $this->getObject($params); /* @var $object kDBList */ $modules_helper =& $this->Application->recallObject('ModulesHelper'); /* @var $modules_helper kModulesHelper */ $licensed_modules = array_map('strtolower', $modules_helper->_GetModules()); return in_array(strtolower($object->GetDBField('Name')), $licensed_modules); } function PrerequisitesMet($params) { return !$this->_getPrerequisitesErrors($params); } function _getPrerequisitesErrors($params) { static $errors = Array (); $object =& $this->getObject($params); /* @var $object kDBList */ $module_path = $object->GetDBField('Path'); if (!array_key_exists($module_path, $errors)) { require_once FULL_PATH . '/core/install/install_toolkit.php'; $toolkit = new kInstallToolkit(); $module_version = $toolkit->GetMaxModuleVersion($module_path); $errors[$module_path] = $toolkit->CheckPrerequisites($module_path, Array ($module_version), 'standalone'); } return $errors[$module_path]; } function ListPrerequisites($params) { $errors = $this->_getPrerequisitesErrors($params); $ret = ''; $block_params = $this->prepareTagParams($params); $block_params['name'] = $params['render_as']; foreach ($errors as $error) { $block_params['error'] = $error; $ret .= $this->Application->ParseBlock($block_params); } return $ret; } function InstallLink($params) { $object =& $this->getObject($params); /* @var $object kDBList */ $module_path = strtolower( $object->GetDBField('Path') ); $url_params = Array ('redirect' => 1, 'admin' => 1); return $this->Application->HREF('dummy', '_FRONT_END_', $url_params, $module_path . 'install.php'); } }