$nameTools = get_lang('Modules'); // Javascript confirm pop up declaration for header JavascriptLanguage::getInstance()->addLangVar('Are you sure you want to uninstall the module %name ?'); JavascriptLoader::getInstance()->load('admin'); //CONFIG and DEVMOD vars : //TODO remove pagination $modulePerPage = 1000; $typeLabel[''] = get_lang('No name'); $typeLabel['tool'] = get_lang('Tools'); $typeLabel['applet'] = get_lang('Applets'); $typeLabel['crsmanage'] = get_lang('Course management tools'); $typeLabel['admin'] = get_lang('Administration tools'); //$typeLabel['lang'] = get_lang('Language packs'); //$typeLabel['theme'] = get_lang('Themes'); //$typeLabel['extauth'] = get_lang('External authentication drivers'); $moduleTypeList = get_available_module_types(); $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; $module_id = isset($_REQUEST['module_id']) ? $_REQUEST['module_id'] : null; $courseToolId = isset($_REQUEST['courseToolId']) ? $_REQUEST['courseToolId'] : null; $typeReq = isset($_REQUEST['typeReq']) ? $_REQUEST['typeReq'] : 'tool'; $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $_cleanInput['selectInput'] = isset($_REQUEST['selectInput']) ? $_REQUEST['selectInput'] : null; $notAutoActivateInCourses = array_key_exists('notAutoActivateInCourses', $_REQUEST) && $_REQUEST['notAutoActivateInCourses'] == 'on' ? true : false; $activableOnlyByPlatformAdmin = array_key_exists('activableOnlyByPlatformAdmin', $_REQUEST) && $_REQUEST['activableOnlyByPlatformAdmin'] == 'on' ? true : false; $activateOnInstall = array_key_exists('activateOnInstall', $_REQUEST) && $_REQUEST['activateOnInstall'] == 'on' ? true : false; $visibleOnInstall = array_key_exists('visibleOnInstall', $_REQUEST) && $_REQUEST['visibleOnInstall'] == 'on' ? true : false; $deleteModuleDatabase = array_key_exists('deleteModuleDatabase', $_REQUEST) && $_REQUEST['deleteModuleDatabase'] == 'on' ? true : false; //---------------------------------- // EXECUTE COMMAND //---------------------------------- // TODO improve status message and backlog display
/** * Get the count of modules by type. * @param bool $onlyActivated set to true to count only activated module * (default) * @return array [type => count] * @since Claroline 1.9.10, 1.10.7, 1.11 */ function count_modules_by_type($onlyActivated = true) { $cnt = array(); foreach (get_available_module_types() as $moduleType) { $cnt[$moduleType] = 0; } $tbl = claro_sql_get_main_tbl(); if ($onlyActivated) { $activation = "WHERE `activation` = 'activated'"; } else { $activation = "WHERE 1 = 1"; } $rs = Claroline::getDatabase()->query("\n SELECT \n `type`,\n COUNT(*) AS `count`\n FROM \n `{$tbl['module']}`\n {$activation}\n GROUP BY `type`"); foreach ($rs as $moduleTypeCount) { $cnt[$moduleTypeCount['type']] = $moduleTypeCount['count']; } return $cnt; }