/** * Validate a Registrar Module * * Verifies that the Registrar Module exists and is enabled * * @param string $data Field data * @return ModuleDBO Module DBO for this Registrar * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $moduleDBO = load_ModuleDBO($data); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("RegistrarModule"); } return $moduleDBO; }
/** * Update the Modules Enabled/Disabled flag */ function updateModules() { if (!isset($this->post['modules'])) { $this->post['modules'] = array(); } // Enable all the Modules with checks, disable the ones without $modules = ModuleRegistry::getModuleRegistry()->getAllModules(); foreach ($modules as $module) { if (!$module->isEnabled() && in_array($module, $this->post['modules'])) { // Enable this module $moduleDBO = load_ModuleDBO($module->getName()); $moduleDBO->setEnabled("Yes"); update_ModuleDBO($moduleDBO); } elseif ($module->isEnabled() && !in_array($module, $this->post['modules'])) { // Disable this module $moduleDBO = load_ModuleDBO($module->getName()); $moduleDBO->setEnabled("No"); update_ModuleDBO($moduleDBO); } } $this->setMessage(array("type" => "[MODULES_UPDATED]")); $this->reload(); }
/** * Initialize Module * * This method is called by the configuration script when the module is * loaded. * * @return boolean True for success */ public function init() { // Check if this module is installed try { $this->moduleDBO = load_ModuleDBO($this->getName()); } catch (DBNoRowsFoundException $e) { // Install this module $this->install(); } if (class_exists("SolidStateMenu", false)) { // Add this module to the menu $menu = SolidStateMenu::getSolidStateMenu(); $menu->addItem(new SolidStateMenuItem($this->getName(), $this->getName(), null, "manager_content.php?page=" . $this->getConfigPage()), "modules"); } return true; }