index.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Index page of the admin tools
  5. * @package chamilo.admin
  6. */
  7. /**
  8. * Code
  9. */
  10. // Language files that need to be included.
  11. $language_file = array('admin', 'tracking','coursebackup');
  12. // Resetting the course id.
  13. $cidReset = true;
  14. // Including some necessary chamilo files.
  15. require_once '../inc/global.inc.php';
  16. require_once api_get_path(SYS_CODE_PATH).'admin/statistics/statistics.lib.php';
  17. // Setting the section (for the tabs).
  18. $this_section = SECTION_PLATFORM_ADMIN;
  19. // Access restrictions.
  20. api_protect_admin_script(true);
  21. $nameTools = get_lang('PlatformAdmin');
  22. // Displaying the header
  23. $message = '';
  24. if (api_is_platform_admin()) {
  25. if (is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php')) {
  26. $message = Display::return_message(get_lang('InstallDirAccessibleSecurityThreat'),'warning');
  27. }
  28. if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
  29. $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning');
  30. }
  31. /* ACTION HANDLING */
  32. if (!empty($_POST['Register'])) {
  33. register_site();
  34. $message = Display :: return_message(get_lang('VersionCheckEnabled'),'confirmation');
  35. }
  36. $keyword_url = Security::remove_XSS((empty($_GET['keyword']) ? '' : $_GET['keyword']));
  37. }
  38. if (isset($_GET['msg']) && isset($_GET['type'])) {
  39. if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed')))
  40. switch($_GET['type']) {
  41. case 'error':
  42. $message = Display::return_message(get_lang($_GET['msg']), 'error');
  43. break;
  44. case 'confirmation':
  45. $message = Display::return_message(get_lang($_GET['msg']), 'confirm');
  46. }
  47. }
  48. $blocks = array();
  49. /* Users */
  50. $blocks['users']['icon'] = Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
  51. $blocks['users']['label'] = api_ucfirst(get_lang('Users'));
  52. if (api_is_platform_admin()) {
  53. $search_form = ' <form method="get" class="form-search" action="user_list.php">
  54. <input class="span3" type="text" name="keyword" value="">
  55. <button class="btn" type="submit">'.get_lang('Search').'</button>
  56. </form>';
  57. $blocks['users']['search_form'] = $search_form;
  58. $items = array(
  59. array('url'=>'user_list.php', 'label' => get_lang('UserList')),
  60. array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
  61. array('url'=>'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')),
  62. array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
  63. );
  64. if (api_get_setting('allow_social_tool') == 'true') {
  65. $items[] = array('url'=>'group_add.php', 'label' => get_lang('AddGroups'));
  66. $items[] = array('url'=>'group_list.php', 'label' => get_lang('GroupList'));
  67. }
  68. if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
  69. $items[] = array('url'=>'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
  70. }
  71. $items[] = array('url'=>'user_fields.php', 'label' => get_lang('ManageUserFields'));
  72. } else {
  73. $items = array(
  74. array('url'=>'user_list.php', 'label' => get_lang('UserList')),
  75. array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
  76. array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
  77. );
  78. }
  79. $blocks['users']['items'] = $items;
  80. $blocks['users']['extra'] = null;
  81. if (api_is_platform_admin()) {
  82. /* Courses */
  83. $blocks['courses']['icon'] = Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
  84. $blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
  85. $search_form = ' <form method="get" class="form-search" action="course_list.php">
  86. <input class="span3" type="text" name="keyword" value="">
  87. <button class="btn" type="submit">'.get_lang('Search').'</button>
  88. </form>';
  89. $blocks['courses']['search_form'] = $search_form;
  90. $items = array();
  91. $items[] = array('url'=>'course_list.php', 'label' => get_lang('CourseList'));
  92. $items[] = array('url'=>'course_add.php', 'label' => get_lang('AddCourse'));
  93. if (api_get_setting('course_validation') == 'true') {
  94. $items[] = array('url'=>'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
  95. $items[] = array('url'=>'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
  96. $items[] = array('url'=>'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
  97. }
  98. $items[] = array('url'=>'course_export.php', 'label' => get_lang('ExportCourses'));
  99. $items[] = array('url'=>'course_import.php', 'label' => get_lang('ImportCourses'));
  100. $items[] = array('url'=>'course_category.php', 'label' => get_lang('AdminCategories'));
  101. $items[] = array('url'=>'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
  102. $items[] = array('url'=>'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
  103. //$items[] = array('url'=>'course_intro_pdf_import.php', 'label' => get_lang('ImportPDFIntroToCourses'));
  104. if (api_get_setting('gradebook_enable_grade_model') == 'true') {
  105. $items[] = array('url'=>'grade_models.php', 'label' => get_lang('GradeModel'));
  106. }
  107. if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
  108. $items[] = array('url'=>'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
  109. }
  110. $blocks['courses']['items'] = $items;
  111. $blocks['courses']['extra'] = null;
  112. /* Platform */
  113. $blocks['platform']['icon'] = Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
  114. $blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
  115. $search_form = ' <form method="get" action="settings.php" class="form-search">
  116. <input class="span3" type="text" name="search_field" value="" >
  117. <input type="hidden" value="search_setting" name="category">
  118. <button class="btn" type="submit">'.get_lang('Search').'</button>
  119. </form>';
  120. $blocks['platform']['search_form'] = $search_form;
  121. $items = array();
  122. $items[] = array('url'=>'settings.php', 'label' => get_lang('PlatformConfigSettings'));
  123. $items[] = array('url'=>'settings.php?category=Plugins','label' => get_lang('Plugins'));
  124. $items[] = array('url'=>'settings.php?category=Regions','label' => get_lang('Regions'));
  125. $items[] = array('url'=>'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
  126. $items[] = array('url'=> api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda'));
  127. $items[] = array('url'=>'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
  128. $items[] = array('url'=>'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
  129. $items[] = array('url'=>'statistics/index.php', 'label' => get_lang('Statistics'));
  130. $items[] = array('url'=> api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php', 'label' => get_lang('Reports'));
  131. /* Event settings */
  132. if (api_get_setting('activate_email_template') == 'true') {
  133. $items[] = array('url'=>'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
  134. }
  135. if (!empty($_configuration['multiple_access_urls'])) {
  136. if (api_is_global_platform_admin()) {
  137. $items[] = array('url'=>'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
  138. }
  139. }
  140. if (api_get_setting('allow_reservation') == 'true') {
  141. $items[] = array('url'=>'../reservation/m_category.php', 'label' => get_lang('BookingSystem'));
  142. }
  143. if (api_get_setting('allow_terms_conditions') == 'true') {
  144. $items[] = array('url'=>'legal_add.php', 'label' => get_lang('TermsAndConditions'));
  145. }
  146. $blocks['platform']['items'] = $items;
  147. $blocks['platform']['extra'] = null;
  148. }
  149. /* Sessions */
  150. $blocks['sessions']['icon'] = Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
  151. $blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
  152. $search_form = ' <form method="GET" class="form-search" action="session_list.php">
  153. <input class="span3" type="text" name="keyword" value="">
  154. <button class="btn" type="submit">'.get_lang('Search').'</button>
  155. </form>';
  156. $blocks['sessions']['search_form'] = $search_form;
  157. $items = array();
  158. $items[] = array('url'=>'session_list.php', 'label' => get_lang('ListSession'));
  159. $items[] = array('url'=>'session_add.php', 'label' => get_lang('AddSession'));
  160. $items[] = array('url'=>'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
  161. $items[] = array('url'=>'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
  162. if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
  163. $items[] = array('url'=>'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession'));
  164. }
  165. $items[] = array('url'=>'session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
  166. $items[] = array('url'=>'../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
  167. if (api_is_platform_admin()) {
  168. if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) { // option only visible in development mode. Enable through code if required
  169. $items[] = array('url'=>'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
  170. }
  171. $items[] = array('url'=>'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
  172. }
  173. $items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
  174. $blocks['sessions']['items'] = $items;
  175. $blocks['sessions']['extra'] = null;
  176. /* Settings */
  177. if (api_is_platform_admin()) {
  178. $blocks['settings']['icon'] = Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_SMALL, false);
  179. $blocks['settings']['label'] = api_ucfirst(get_lang('System'));
  180. $items = array();
  181. $items[] = array('url'=>'special_exports.php', 'label' => get_lang('SpecialExports'));
  182. if (!empty($_configuration['db_admin_path'])) {
  183. $items[] = array('url'=>$_configuration['db_admin_path'], 'label' => get_lang('AdminDatabases').' ('.get_lang('DBManagementOnlyForServerAdmin').') ');
  184. }
  185. $items[] = array('url'=>'system_status.php', 'label' => get_lang('SystemStatus'));
  186. if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
  187. $items[] = array('url'=>'filler.php', 'label' => get_lang('DataFiller'));
  188. }
  189. $items[] = array('url'=>'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
  190. if (api_get_setting('server_type') === 'test') {
  191. $items[] = array('url'=>'system_management.php', 'label' => get_lang('SystemManagement'));
  192. }
  193. $blocks['settings']['items'] = $items;
  194. $blocks['settings']['extra'] = null;
  195. $blocks['settings']['search_form'] = null;
  196. /* Extensions */
  197. /*
  198. $blocks['extensions']['icon'] = Display::return_icon('visio_meeting.gif', get_lang('ConfigureExtensions'), array(), ICON_SIZE_SMALL, false);
  199. $blocks['extensions']['label'] = api_ucfirst(get_lang('ConfigureExtensions'));
  200. $items = array();
  201. $items[] = array('url'=>'configure_extensions.php?display=visio', 'label' => get_lang('Visioconf'));
  202. $items[] = array('url'=>'configure_extensions.php?display=ppt2lp', 'label' => get_lang('Ppt2lp'));
  203. //$items[] = array('url'=>'configure_extensions.php?display=ephorus', 'label' => get_lang('EphorusPlagiarismPrevention'));
  204. $items[] = array('url'=>'configure_extensions.php?display=search', 'label' => get_lang('SearchEngine'));
  205. $items[] = array('url'=>'configure_extensions.php?display=serverstats', 'label' => get_lang('ServerStatistics'));
  206. $items[] = array('url'=>'configure_extensions.php?display=bandwidthstats', 'label' => get_lang('BandWidthStatistics'));
  207. $blocks['extensions']['items'] = $items;
  208. */
  209. //Skills
  210. if (api_get_setting('allow_skills_tool') == 'true') {
  211. $blocks['skills']['icon'] = Display::return_icon('logo.png', get_lang('Skills'), array(), ICON_SIZE_SMALL, false);
  212. $blocks['skills']['label'] = get_lang('Skills');
  213. $items = array();
  214. //$items[] = array('url'=>'skills.php', 'label' => get_lang('SkillsTree'));
  215. $items[] = array('url'=>'skills_wheel.php', 'label' => get_lang('SkillsWheel'));
  216. $items[] = array('url'=>'skills_import.php', 'label' => get_lang('SkillsImport'));
  217. //$items[] = array('url'=>'skills_profile.php', 'label' => get_lang('SkillsProfile'));
  218. $items[] = array('url'=>api_get_path(WEB_CODE_PATH).'social/skills_ranking.php', 'label' => get_lang('SkillsRanking'));
  219. $items[] = array('url'=>'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks'));
  220. $blocks['skills']['items'] = $items;
  221. $blocks['skills']['extra'] = null;
  222. $blocks['skills']['search_form'] = null;
  223. }
  224. /* Chamilo.org */
  225. $blocks['chamilo']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
  226. $blocks['chamilo']['label'] = 'Chamilo.org';
  227. $items = array();
  228. $items[] = array('url'=>'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage'));
  229. $items[] = array('url'=>'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum'));
  230. $items[] = array('url'=>'../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide'));
  231. $items[] = array('url'=>'../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion'));
  232. $items[] = array('url'=>'../../documentation/credits.html', 'label' => get_lang('ContributorsList'));
  233. $items[] = array('url'=>'../../documentation/security.html', 'label' => get_lang('SecurityGuide'));
  234. $items[] = array('url'=>'../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide'));
  235. $items[] = array('url'=>'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions'));
  236. $items[] = array('url'=>'http://www.chamilo.org/en/providers', 'label' => get_lang('ChamiloOfficialServicesProviders'));
  237. $blocks['chamilo']['items'] = $items;
  238. $blocks['chamilo']['extra'] = null;
  239. $blocks['chamilo']['search_form'] = null;
  240. // Try to display a maximum before we check the chamilo version and all that.
  241. //session_write_close(); //close session to avoid blocking concurrent access
  242. //flush(); //send data to client as much as allowed by the web server
  243. //ob_flush();
  244. //Version check
  245. $blocks['version_check']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
  246. $blocks['version_check']['label'] = get_lang('VersionCheck');
  247. $blocks['version_check']['extra'] = '<div class="admin-block-version"></div>';
  248. $blocks['version_check']['search_form'] = null;
  249. $blocks['version_check']['items'] = null;
  250. //$blocks['version_check']['class'] = '';
  251. }
  252. $admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
  253. $tpl = new Template();
  254. $tpl->assign('web_admin_ajax_url', $admin_ajax_url);
  255. $tpl->assign('blocks', $blocks);
  256. // The template contains the call to the AJAX version checker
  257. $admin_template = $tpl->get_template('admin/settings_index.tpl');
  258. $content = $tpl->fetch($admin_template);
  259. $tpl->assign('content', $content);
  260. $tpl->assign('message', $message);
  261. $tpl->display_one_col_template();
  262. /**
  263. * This setting changes the registration status for the campus
  264. *
  265. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  266. * @version August 2006
  267. *
  268. * @todo the $_settings should be reloaded here. => write api function for this and use this in global.inc.php also.
  269. */
  270. function register_site() {
  271. $tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  272. $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='registered'";
  273. Database::query($sql);
  274. if ($_POST['donotlistcampus']) {
  275. $sql = "UPDATE $tbl_settings SET selected_value='true' WHERE variable='donotlistcampus'";
  276. Database::query($sql);
  277. }
  278. // Reload the settings.
  279. }
  280. // Note: version checking mechanism has now been moved to main/inc/ajax/admin.ajax.php