foreach ($items as $key => $value) { echo '<li><a href="index.php?' . $key . '">' . $value . '</a></li>'; } echo '</ul>'; echo '</td>'; } echo '</tr></table>'; $course_categories = Statistics::get_course_categories(); echo '<br/><br/>'; //@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation $report = isset($_GET['report']) ? $_GET['report'] : null; switch ($report) { case 'courses': // total amount of courses foreach ($course_categories as $code => $name) { $courses[$name] = Statistics::count_courses($code); } // courses for each course category Statistics::print_stats(get_lang('CountCours'), $courses); break; case 'tools': Statistics::print_tool_stats(); break; case 'coursebylanguage': Statistics::print_course_by_language_stats(); break; case 'courselastvisit': Statistics::print_course_last_visit(); break; case 'users': // total amount of users
/** * Get global information data * @return array */ function get_global_information_data() { // Two-dimensional array with data about the system $path = api_get_path(WEB_CODE_PATH); // Check total number of users $global_info = array(array(get_lang('CountUsers'), '<a href="' . $path . 'admin/user_list.php">' . Statistics::count_users() . '</a>'), array(get_lang('NumberOfUsersActive'), '<a href="' . $path . 'admin/user_list.php?keyword_firstname=&keyword_lastname=&keyword_username=&keyword_email=&keyword_officialcode=&keyword_status=%25&keyword_active=1&submit=&_qf__advanced_search=">' . Statistics::count_users(null, null, null, true) . '</a>'), array(get_lang('NumberOfCoursesTotal'), '<a href="' . $path . 'admin/course_list.php">' . Statistics::count_courses() . '</a>'), array(get_lang('NumberOfCoursesPublic'), '<a href="' . $path . 'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility=' . COURSE_VISIBILITY_OPEN_WORLD . '&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">' . Statistics::count_courses_by_visibility(COURSE_VISIBILITY_OPEN_WORLD) . '</a>'), array(get_lang('NumberOfCoursesOpen'), '<a href="' . $path . 'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility=' . COURSE_VISIBILITY_OPEN_PLATFORM . '&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">' . Statistics::count_courses_by_visibility(COURSE_VISIBILITY_OPEN_PLATFORM) . '</a>'), array(get_lang('NumberOfCoursesPrivate'), '<a href="' . $path . 'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility=' . COURSE_VISIBILITY_REGISTERED . '&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">' . Statistics::count_courses_by_visibility(COURSE_VISIBILITY_REGISTERED) . '</a>'), array(get_lang('NumberOfCoursesClosed'), '<a href="' . $path . 'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility=' . COURSE_VISIBILITY_CLOSED . '&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">' . Statistics::count_courses_by_visibility(COURSE_VISIBILITY_CLOSED) . '</a>'), array(get_lang('NumberOfCoursesHidden'), '<a href="' . $path . 'admin/course_list.php?keyword_code=&keyword_title=&keyword_language=%25&keyword_category=&keyword_visibility=' . COURSE_VISIBILITY_HIDDEN . '&keyword_subscribe=%25&keyword_unsubscribe=%25&submit=&_qf__advanced_course_search=">' . Statistics::count_courses_by_visibility(COURSE_VISIBILITY_HIDDEN) . '</a>')); return $global_info; }
/** * Check if the current installation is up to date * The code is borrowed from phpBB and slighlty modified * @author The phpBB Group <*****@*****.**> (the code) * @author Patrick Cool <*****@*****.**>, Ghent University (the modifications) * @author Yannick Warnier <*****@*****.**> for the move to HTTP request * @copyright (C) 2001 The phpBB Group * @return string language string with some layout (color) */ function check_system_version() { global $_configuration; $system_version = trim($_configuration['system_version']); // the chamilo version of your installation if (ini_get('allow_url_fopen') == 1) { // The number of courses $number_of_courses = Statistics::count_courses(); // The number of users $number_of_users = Statistics::count_users(); $number_of_active_users = Statistics::count_users(null, null, null, true); $data = array('url' => api_get_path(WEB_PATH), 'campus' => api_get_setting('siteName'), 'contact' => api_get_setting('emailAdministrator'), 'version' => $system_version, 'numberofcourses' => $number_of_courses, 'numberofusers' => $number_of_users, 'numberofactiveusers' => $number_of_active_users, 'donotlistcampus' => api_get_setting('donotlistcampus'), 'organisation' => api_get_setting('Institution'), 'language' => api_get_setting('platformLanguage'), 'adminname' => api_get_setting('administratorName') . ' ' . api_get_setting('administratorSurname')); $res = api_http_request('version.chamilo.org', 80, '/version.php', $data); if ($res != 0) { $version_info = $res; if ($system_version != $version_info) { $output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. ' . get_lang('LatestVersionIs') . ' <b>Chamilo ' . $version_info . '</b>. ' . get_lang('YourVersionIs') . ' <b>Chamilo ' . $system_version . '</b>. ' . str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')) . '</span>'; } else { $output = '<br /><span style="color:green">' . get_lang('VersionUpToDate') . ': Chamilo ' . $version_info . '</span>'; } } else { $output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>'; } } else { $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>'; } return $output; }
/** * Check if the current installation is up to date * The code is borrowed from phpBB and slighlty modified * @author The phpBB Group <*****@*****.**> (the code) * @author Patrick Cool <*****@*****.**>, Ghent University (the modifications) * @author Yannick Warnier <*****@*****.**> for the move to HTTP request * @copyright (C) 2001 The phpBB Group * @return string language string with some layout (color) */ function check_system_version() { global $_configuration; $system_version = trim($_configuration['system_version']); // the chamilo version of your installation if (ini_get('allow_url_fopen') == 1) { // The number of courses $number_of_courses = Statistics::count_courses(); // The number of users $number_of_users = Statistics::count_users(); $number_of_active_users = Statistics::count_users(null, null, null, true); // The number of sessions $number_of_sessions = Statistics::count_sessions(); $data = array('url' => api_get_path(WEB_PATH), 'campus' => api_get_setting('siteName'), 'contact' => api_get_setting('emailAdministrator'), 'version' => $system_version, 'numberofcourses' => $number_of_courses, 'numberofusers' => $number_of_users, 'numberofactiveusers' => $number_of_active_users, 'numberofsessions' => $number_of_sessions, 'donotlistcampus' => api_get_setting('donotlistcampus'), 'organisation' => api_get_setting('Institution'), 'language' => api_get_setting('platformLanguage'), 'adminname' => api_get_setting('administratorName') . ' ' . api_get_setting('administratorSurname')); $version = null; // version.php has been updated to include the version in an HTTP header // called "X-Chamilo-Version", so that we don't have to worry about // issues with the content not being returned by fread for some reason $res = _http_request('version.chamilo.org', 80, '/version.php', $data, 5, null, true); $lines = preg_split('/\\r\\n/', $res); foreach ($lines as $line) { $elements = preg_split('/:/', $line); // extract the X-Chamilo-Version header from the version.php response if (strcmp(trim($elements[0]), 'X-Chamilo-Version') === 0) { $version = trim($elements[1]); } } if (substr($res, 0, 5) != 'Error') { if (empty($version)) { $version_info = $res; } else { $version_info = $version; } if ($system_version != $version_info) { $output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. ' . get_lang('LatestVersionIs') . ' <b>Chamilo ' . $version_info . '</b>. ' . get_lang('YourVersionIs') . ' <b>Chamilo ' . $system_version . '</b>. ' . str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')) . '</span>'; } else { $output = '<br /><span style="color:green">' . get_lang('VersionUpToDate') . ': Chamilo ' . $version_info . '</span>'; } } else { $output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>'; } } else { $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>'; } return $output; }