/** * AdminConfig@index */ public function index() { global $WT_TREE; HookProvider::getInstance()->updateHooks(); $action = Filter::post('action'); if ($action == 'update' && Filter::checkCsrf()) { $this->update(); } Theme::theme(new AdministrationTheme())->init($WT_TREE); $ctrl = new PageController(); $ctrl->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle()); $table_id = 'table-installedhooks-' . Uuid::uuid4(); $view_bag = new ViewBag(); $view_bag->set('title', $ctrl->getPageTitle()); $view_bag->set('table_id', $table_id); $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks()); $ctrl->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript(' jQuery(document).ready(function() { jQuery("#' . $table_id . '").dataTable( { ' . I18N::datatablesI18N() . ', sorting: [[ 2, "asc" ], [ 3, "asc" ]], displayLength: 10, pagingType: "full_numbers", columns: [ /* 0 Enabled */ { dataSort: 1, class: "center" }, /* 1 Enabled sort */ { visible: false}, /* 2 Hook function */ null, /* 3 Hook context */ null, /* 4 Module name */ null, /* 5 Priority */ { dataSort: 6, class: "center" }, /* 6 Priority sort */ { type: "num", visible: false} ] }); }); '); ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); }
/** * Returns the number of active modules linked to a hook * * @return int Number of active modules */ public function getNumberActiveModules() { if (HookProvider::getInstance()->isModuleOperational()) { $sqlquery = ''; $sqlparams = array($this->hook_function); if ($this->hook_context != 'all') { $sqlparams = array($this->hook_function, $this->hook_context); $sqlquery = " OR majh_hook_context=?"; } $module_names = fw\Database::prepare("SELECT majh_module_name AS modules FROM `##maj_hooks`" . " WHERE majh_hook_function = ? AND (majh_hook_context='all'" . $sqlquery . ") AND majh_status='enabled'")->execute($sqlparams)->fetchOneColumn(); return count($module_names); } return 0; }