infocours.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <?php // $Id: infocours.php 21873 2009-07-08 08:35:57Z herodoto $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2009 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Hugues Peeters
  9. Copyright (c) Roan Embrechts (Vrije Universiteit Brussel)
  10. Copyright (c) Olivier Brouckaert
  11. Copyright (c) Bart Mollet, Hogeschool Gent
  12. For a full list of contributors, see "credits.txt".
  13. The full license can be read in "license.txt".
  14. This program is free software; you can redistribute it and/or
  15. modify it under the terms of the GNU General Public License
  16. as published by the Free Software Foundation; either version 2
  17. of the License, or (at your option) any later version.
  18. See the GNU General Public License for more details.
  19. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  20. ==============================================================================
  21. */
  22. /**
  23. ==============================================================================
  24. * Code to display the course settings form (for the course admin)
  25. * and activate the changes.
  26. *
  27. * See ./inc/conf/course_info.conf.php for settings
  28. * @todo: Move $canBeEmpty from course_info.conf.php to config-settings
  29. * @todo: Take those config settings into account in this script
  30. * @author Patrick Cool <patrick.cool@UGent.be>
  31. * @author Roan Embrechts, refactoring
  32. * and improved course visibility|subscribe|unsubscribe options
  33. * @package dokeos.course_info
  34. ==============================================================================
  35. */
  36. /*
  37. ==============================================================================
  38. INIT SECTION
  39. ==============================================================================
  40. */
  41. // name of the language file that needs to be included
  42. $language_file = array ('create_course', 'course_info');
  43. include ('../inc/global.inc.php');
  44. $this_section = SECTION_COURSES;
  45. $nameTools = get_lang("ModifInfo");
  46. /*
  47. -----------------------------------------------------------
  48. Libraries
  49. -----------------------------------------------------------
  50. */
  51. require_once (api_get_path(LIBRARY_PATH).'course.lib.php');
  52. require_once (api_get_path(INCLUDE_PATH)."conf/course_info.conf.php");
  53. require_once (api_get_path(INCLUDE_PATH)."lib/debug.lib.inc.php");
  54. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  55. /*
  56. -----------------------------------------------------------
  57. Constants and variables
  58. -----------------------------------------------------------
  59. */
  60. define("MODULE_HELP_NAME", "Settings");
  61. define("COURSE_CHANGE_PROPERTIES", "COURSE_CHANGE_PROPERTIES");
  62. $TABLECOURSE = Database :: get_main_table(TABLE_MAIN_COURSE);
  63. $TABLEFACULTY = Database :: get_main_table(TABLE_MAIN_CATEGORY);
  64. $TABLECOURSEHOME = Database :: get_course_table(TABLE_TOOL_LIST);
  65. $TABLELANGUAGES = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
  66. $TABLEBBCONFIG = Database :: get_course_table(TOOL_FORUM_CONFIG_TABLE);
  67. $currentCourseID = $_course['sysCode'];
  68. $currentCourseRepository = $_course["path"];
  69. $is_allowedToEdit = $is_courseAdmin || $is_platformAdmin;
  70. $course_setting_table = Database::get_course_table(TABLE_COURSE_SETTING);
  71. /*
  72. ==============================================================================
  73. LOGIC FUNCTIONS
  74. ==============================================================================
  75. */
  76. function is_settings_editable()
  77. {
  78. return $GLOBALS["course_info_is_editable"];
  79. }
  80. $course_code = $_course["sysCode"];
  81. $course_access_settings = CourseManager :: get_access_settings($course_code);
  82. /*
  83. ==============================================================================
  84. MAIN CODE
  85. ==============================================================================
  86. */
  87. if (!$is_allowedToEdit)
  88. {
  89. api_not_allowed(true);
  90. }
  91. $table_course_category = Database :: get_main_table(TABLE_MAIN_CATEGORY);
  92. $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
  93. $tbl_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
  94. $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  95. $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  96. // Get all course categories
  97. $sql = "SELECT code,name FROM ".$table_course_category." WHERE auth_course_child ='TRUE' OR code = '".Database::escape_string($_course['categoryCode'])."' ORDER BY tree_pos";
  98. $res = Database::query($sql, __FILE__, __LINE__);
  99. $s_select_course_tutor_name="SELECT tutor_name FROM $tbl_course WHERE code='$course_code'";
  100. $q_tutor=Database::query($s_select_course_tutor_name, __FILE__, __LINE__);
  101. $s_tutor=mysql_result($q_tutor,0,"tutor_name");
  102. $s_sql_course_titular="SELECT DISTINCT username, lastname, firstname FROM $tbl_user as user, $tbl_course_user as course_rel_user WHERE (course_rel_user.status='1') AND user.user_id=course_rel_user.user_id AND course_code='".$course_code."'";
  103. $q_result_titulars=Database::query($s_sql_course_titular, __FILE__, __LINE__);
  104. $target_name = api_sort_by_first_name() ? 'firstname' : 'lastname';
  105. if(mysql_num_rows($q_result_titulars)==0){
  106. $sql="SELECT username, lastname, firstname FROM $tbl_user as user, $tbl_admin as admin WHERE admin.user_id=user.user_id ORDER BY ".$target_name." ASC";
  107. $q_result_titulars=Database::query($sql, __FILE__, __LINE__);
  108. }
  109. $a_profs[0] = '-- '.get_lang('NoManager').' --';
  110. while ($a_titulars = Database::fetch_array($q_result_titulars)) {
  111. $s_username = $a_titulars['username'];
  112. $s_lastname = $a_titulars['lastname'];
  113. $s_firstname = $a_titulars['firstname'];
  114. if (api_get_person_name($s_firstname, $s_lastname) == $s_tutor) {
  115. $s_selected_tutor = api_get_person_name($s_firstname, $s_lastname);
  116. }
  117. $s_disabled_select_titular = '';
  118. if (!$is_courseAdmin) {
  119. $s_disabled_select_titular = 'disabled=disabled';
  120. }
  121. $a_profs[api_get_person_name($s_firstname, $s_lastname)] = api_get_person_name($s_lastname, $s_firstname).' ('.$s_username.')';
  122. }
  123. while ($cat = Database::fetch_array($res))
  124. {
  125. $categories[$cat['code']] = '('.$cat['code'].') '.$cat['name'];
  126. ksort($categories);
  127. }
  128. $linebreak = '<div class="row"><div class="label"></div><div class="formw" style="border-bottom:1px dashed grey"></div></div>';
  129. // Build the form
  130. $form = new FormValidator('update_course');
  131. // COURSE SETTINGS
  132. $form->addElement('html','<div class="sectiontitle"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="coursesettings" id="coursesettings"></a>'.Display::return_icon('settings.gif',get_lang('CourseSettings')).' '.get_lang('CourseSettings').'</div>');
  133. $visual_code=$form->addElement('text','visual_code', get_lang('Code'));
  134. $visual_code->freeze();
  135. $form->applyFilter('visual_code', 'strtoupper');
  136. //$form->add_textfield('tutor_name', get_lang('Professors'), true, array ('size' => '60'));
  137. $prof = &$form->addElement('select', 'tutor_name', get_lang('Professors'), $a_profs);
  138. $form->applyFilter('tutor_name','html_filter');
  139. $prof -> setSelected($s_selected_tutor);
  140. $form->add_textfield('title', get_lang('Title'), true, array ('size' => '60'));
  141. //$form->applyFilter('title','html_filter');
  142. $form->applyFilter('title','trim');
  143. $form->addElement('select', 'category_code', get_lang('Fac'), $categories);
  144. $form->add_textfield('department_name', get_lang('Department'), false, array ('size' => '60'));
  145. //$form->applyFilter('department_name','html_filter');
  146. $form->applyFilter('department_name','trim');
  147. $form->add_textfield('department_url', get_lang('DepartmentUrl'), false, array ('size' => '60'));
  148. //$form->applyFilter('department_url','html_filter');
  149. $form->addRule('tutor_name', get_lang('ThisFieldIsRequired'), 'required');
  150. $form->addElement('select_language', 'course_language', get_lang('Ln'));
  151. $form->addElement('static', null, '&nbsp;', get_lang('TipLang'));
  152. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  153. // COURSE ACCESS
  154. $form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="coursesaccess" id="coursesaccess"></a>'.Display::return_icon('course.gif',get_lang('CourseAccess')).' '.get_lang('CourseAccess').'</div>');
  155. $form->addElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
  156. $form->addElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
  157. $form->addElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
  158. $form->addElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
  159. $form->addElement('static', null, null, get_lang("CourseAccessConfigTip"));
  160. $form -> addElement('html',$linebreak);
  161. $form->addElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
  162. $form->addElement('radio', 'subscribe', null, get_lang('Denied'), 0);
  163. $form -> addElement('html',$linebreak);
  164. $form->addElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
  165. $form->addElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
  166. $form -> addElement('html',$linebreak);
  167. $form->add_textfield('course_registration_password', get_lang('CourseRegistrationPassword'), false, array ('size' => '60'));
  168. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  169. // EMAIL NOTIFICATIONS
  170. $form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="emailnotifications" id="emailnotifications"></a>'.Display::return_icon('mail.png',get_lang('EmailNotifications')).' '.get_lang('EmailNotifications').'</div>');
  171. $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1);
  172. $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null,get_lang('NewUserEmailAlertToTeacharAndTutor'),2);
  173. $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0);
  174. $form -> addElement('html',$linebreak);
  175. $form->addElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
  176. $form->addElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0);
  177. $form -> addElement('html',$linebreak);
  178. $form->addElement('radio', 'email_alert_on_new_doc_dropbox', get_lang('DropboxEmailAlert'), get_lang('DropboxEmailAlertActivate'), 1);
  179. $form->addElement('radio', 'email_alert_on_new_doc_dropbox', null, get_lang('DropboxEmailAlertDeactivate'), 0);
  180. $form -> addElement('html',$linebreak);
  181. $form->addElement('radio', 'email_alert_manager_on_new_quiz', get_lang('QuizEmailAlert'), get_lang('QuizEmailAlertActivate'), 1);
  182. $form->addElement('radio', 'email_alert_manager_on_new_quiz', null, get_lang('QuizEmailAlertDeactivate'), 0);
  183. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  184. // USER RIGHTS
  185. $form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="userrights" id="userrights"></a>'.Display::return_icon('members.gif',get_lang('UserRights')).' '.get_lang('UserRights').'</div>');
  186. $form->addElement('radio', 'allow_user_edit_agenda', get_lang('AllowUserEditAgenda'), get_lang('AllowUserEditAgendaActivate'), 1);
  187. $form->addElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0);
  188. $form -> addElement('html',$linebreak);
  189. $form->addElement('radio', 'allow_user_edit_announcement', get_lang('AllowUserEditAnnouncement'), get_lang('AllowUserEditAnnouncementActivate'), 1);
  190. $form->addElement('radio', 'allow_user_edit_announcement', null, get_lang('AllowUserEditAnnouncementDeactivate'), 0);
  191. $form -> addElement('html',$linebreak);
  192. $form->addElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageForum'), get_lang('AllowUserImageForumActivate'), 1);
  193. $form->addElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0);
  194. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  195. // CHAT SETTINGS
  196. $form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="chatsettings" id="chatsettings"></a>'.Display::return_icon('chat.gif',get_lang('ConfigChat')).' '.get_lang('ConfigChat').'</div>');
  197. $form->addElement('radio', 'allow_open_chat_window', get_lang('AllowOpenchatWindow'), get_lang('AllowOpenChatWindowActivate'), 1);
  198. $form->addElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0);
  199. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  200. // COURSE THEME PICKER
  201. if (api_get_setting('allow_course_theme') == 'true')
  202. {
  203. $form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="theme" id="theme"></a>'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</div><div style="clear:both;"></div>');
  204. //Allow Learning path
  205. $form->addElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1);
  206. $form->addElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
  207. $form -> addElement('html',$linebreak);
  208. $form->addElement('select_theme', 'course_theme', get_lang('Theme'));
  209. $form->applyFilter('course_theme', 'trim');
  210. $form -> addElement('html',$linebreak);
  211. }
  212. if (is_settings_editable())
  213. {
  214. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  215. }
  216. else
  217. {
  218. // is it allowed to edit the course settings?
  219. if (!is_settings_editable())
  220. $disabled_output = "disabled";
  221. $form->freeze();
  222. }
  223. // get all the course information
  224. $all_course_information = CourseManager::get_course_information($_course['sysCode']);
  225. // Set the default values of the form
  226. $values['title'] = $_course['name'];
  227. $values['visual_code'] = $_course['official_code'];
  228. $values['category_code'] = $_course['categoryCode'];
  229. //$values['tutor_name'] = $_course['titular'];
  230. $values['course_language'] = $_course['language'];
  231. $values['department_name'] = $_course['extLink']['name'];
  232. $values['department_url'] = $_course['extLink']['url'];
  233. $values['visibility'] = $_course['visibility'];
  234. $values['subscribe'] = $course_access_settings['subscribe'];
  235. $values['unsubscribe'] = $course_access_settings['unsubscribe'];
  236. $values['course_registration_password'] = $all_course_information['registration_code'];
  237. // get send_mail_setting (auth)from table
  238. $values['email_alert_to_teacher_on_new_user_in_course'] = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course');
  239. // get send_mail_setting (work)from table
  240. $values['email_alert_manager_on_new_doc'] = api_get_course_setting('email_alert_manager_on_new_doc');
  241. // get send_mail_setting (dropbox) from table
  242. $values['email_alert_on_new_doc_dropbox'] = api_get_course_setting('email_alert_on_new_doc_dropbox');
  243. // get send_mail_setting (work)from table
  244. $values['email_alert_manager_on_new_quiz'] = api_get_course_setting('email_alert_manager_on_new_quiz');
  245. // get allow_user_edit_agenda from table
  246. $values['allow_user_edit_agenda'] = api_get_course_setting('allow_user_edit_agenda');
  247. // get allow_user_edit_announcement from table
  248. $values['allow_user_edit_announcement'] = api_get_course_setting('allow_user_edit_announcement');
  249. // get allow_user_image_forum from table
  250. $values['allow_user_image_forum'] = api_get_course_setting('allow_user_image_forum');
  251. // get allow_open_chat_window from table
  252. $values['allow_open_chat_window'] = api_get_course_setting('allow_open_chat_window');
  253. // get course_theme from table
  254. $values['course_theme'] = api_get_course_setting('course_theme');
  255. // get allow_learning_path_theme from table
  256. $values['allow_learning_path_theme'] = api_get_course_setting('allow_learning_path_theme');
  257. $form->setDefaults($values);
  258. // Validate form
  259. if ($form->validate() && is_settings_editable()) {
  260. $update_values = $form->exportValues();
  261. foreach ($update_values as $index => $value) {
  262. $update_values[$index] = Database::escape_string($value);
  263. }
  264. $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  265. $sql = "UPDATE $table_course SET title = '".Security::remove_XSS($update_values['title'])."',
  266. visual_code = '".$update_values['visual_code']."',
  267. course_language = '".$update_values['course_language']."',
  268. category_code = '".$update_values['category_code']."',
  269. department_name = '".Security::remove_XSS($update_values['department_name'])."',
  270. department_url = '".Security::remove_XSS($update_values['department_url'])."',
  271. visibility = '".$update_values['visibility']."',
  272. subscribe = '".$update_values['subscribe']."',
  273. unsubscribe = '".$update_values['unsubscribe']."',
  274. tutor_name = '".$update_values['tutor_name']."',
  275. registration_code = '".$update_values['course_registration_password']."'
  276. WHERE code = '".$course_code."'";
  277. Database::query($sql, __FILE__, __LINE__);
  278. //update course_settings table - this assumes those records exist, otherwise triggers an error
  279. $table_course_setting = Database::get_course_table(TABLE_COURSE_SETTING);
  280. if($update_values['email_alert_to_teacher_on_new_user_in_course'] != $values['email_alert_to_teacher_on_new_user_in_course']){
  281. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_to_teacher_on_new_user_in_course']." WHERE variable = 'email_alert_to_teacher_on_new_user_in_course' ";
  282. Database::query($sql,__FILE__,__LINE__);
  283. }
  284. if($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']){
  285. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_doc']." WHERE variable = 'email_alert_manager_on_new_doc' ";
  286. Database::query($sql,__FILE__,__LINE__);
  287. }
  288. if($update_values['email_alert_on_new_doc_dropbox'] != $values['email_alert_on_new_doc_dropbox']){
  289. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_on_new_doc_dropbox']." WHERE variable = 'email_alert_on_new_doc_dropbox' ";
  290. Database::query($sql,__FILE__,__LINE__);
  291. }
  292. if($update_values['email_alert_manager_on_new_quiz'] != $values['email_alert_manager_on_new_quiz']){
  293. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_quiz']." WHERE variable = 'email_alert_manager_on_new_quiz' ";
  294. Database::query($sql,__FILE__,__LINE__);
  295. }
  296. if($update_values['allow_user_edit_agenda'] != $values['allow_user_edit_agenda']){
  297. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_agenda']." WHERE variable = 'allow_user_edit_agenda' ";
  298. Database::query($sql,__FILE__,__LINE__);
  299. }
  300. if($update_values['allow_user_edit_announcement'] != $values['allow_user_edit_announcement']){
  301. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_announcement']." WHERE variable = 'allow_user_edit_announcement' ";
  302. Database::query($sql,__FILE__,__LINE__);
  303. }
  304. if($update_values['allow_user_image_forum'] != $values['allow_user_image_forum']){
  305. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_image_forum']." WHERE variable = 'allow_user_image_forum' ";
  306. Database::query($sql,__FILE__,__LINE__);
  307. }
  308. if($update_values['allow_open_chat_window'] != $values['allow_open_chat_window']){
  309. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_open_chat_window']." WHERE variable = 'allow_open_chat_window' ";
  310. Database::query($sql,__FILE__,__LINE__);
  311. }
  312. if($update_values['course_theme'] != $values['course_theme']){
  313. $sql = "UPDATE $table_course_setting SET value = '".$update_values['course_theme']."' WHERE variable = 'course_theme' ";
  314. Database::query($sql,__FILE__,__LINE__);
  315. }
  316. if($update_values['allow_learningpath_theme'] != $values['allow_learning_path_theme']){
  317. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_learning_path_theme']." WHERE variable = 'allow_learning_path_theme' ";
  318. Database::query($sql,__FILE__,__LINE__);
  319. }
  320. $cidReset = true;
  321. $cidReq = $course_code;
  322. include ('../inc/local.inc.php');
  323. header('Location: infocours.php?action=show_message&amp;cidReq='.$course_code);
  324. exit;
  325. }
  326. /*
  327. -----------------------------------------------------------
  328. Header
  329. -----------------------------------------------------------
  330. */
  331. Display :: display_header($nameTools, MODULE_HELP_NAME);
  332. //api_display_tool_title($nameTools);
  333. if (isset ($_GET['action']) && $_GET['action'] == 'show_message')
  334. {
  335. Display :: display_normal_message(get_lang('ModifDone'));
  336. }
  337. // actions bar
  338. echo '<div class="actions">';
  339. echo '<a href="#coursesettings">'.Display::return_icon('settings.gif',get_lang('CourseSettings')).' '.get_lang('CourseSettings').'</a>';
  340. echo '<a href="#coursesaccess">'.Display::return_icon('course.gif',get_lang('CourseAccess')).' '.get_lang('CourseAccess').'</a>';
  341. echo '<a href="#emailnotifications">'.Display::return_icon('mail.png',get_lang('EmailNotifications')).' '.get_lang('EmailNotifications').'</a>';
  342. echo '<a href="#userrights">'.Display::return_icon('members.gif',get_lang('UserRights')).' '.get_lang('UserRights').'</a>';
  343. echo '<a href="#chatsettings">'.Display::return_icon('chat.gif',get_lang('ConfigChat')).' '.get_lang('ConfigChat').'</a>';
  344. if (api_get_setting('allow_course_theme') == 'true')
  345. {
  346. echo '<a href="#theme">'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</a>';
  347. }
  348. echo '</div>';
  349. // Display the form
  350. $form->display();
  351. if ($showDiskQuota && $currentCourseDiskQuota != "")
  352. {
  353. ?>
  354. <table>
  355. <tr>
  356. <td><?php echo get_lang("DiskQuota"); ?>&nbsp;:</td>
  357. <td><?php echo $currentCourseDiskQuota; ?> <?php echo $byteUnits[0] ?></td>
  358. </tr>
  359. <?php
  360. }
  361. if ($showLastEdit && $currentCourseLastEdit != "" && $currentCourseLastEdit != "0000-00-00 00:00:00")
  362. {
  363. ?>
  364. <tr>
  365. <td><?php echo get_lang('LastEdit'); ?>&nbsp;:</td>
  366. <td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseLastEdit)); ?></td>
  367. </tr>
  368. <?php
  369. }
  370. if ($showLastVisit && $currentCourseLastVisit != "" && $currentCourseLastVisit != "0000-00-00 00:00:00")
  371. {
  372. ?>
  373. <tr>
  374. <td><?php echo get_lang('LastVisit'); ?>&nbsp;:</td>
  375. <td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseLastVisit)); ?></td>
  376. </tr>
  377. <?php
  378. }
  379. if ($showCreationDate && $currentCourseCreationDate != "" && $currentCourseCreationDate != "0000-00-00 00:00:00")
  380. {
  381. ?>
  382. <tr>
  383. <td><?php echo get_lang('CreationDate'); ?>&nbsp;:</td>
  384. <td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseCreationDate)); ?></td>
  385. </tr>
  386. <?php
  387. }
  388. if ($showExpirationDate && $currentCourseExpirationDate != "" && $currentCourseExpirationDate != "0000-00-00 00:00:00")
  389. {
  390. ?>
  391. <tr>
  392. <td><?php echo get_lang('ExpirationDate'); ?>&nbsp;:</td>
  393. <td>
  394. <?php
  395. echo format_locale_date($dateTimeFormatLong, strtotime($currentCourseExpirationDate));
  396. echo "<br />".get_lang('OrInTime')." : ";
  397. $nbJour = (strtotime($currentCourseExpirationDate) - time()) / (60 * 60 * 24);
  398. $nbAnnees = round($nbJour / 365);
  399. $nbJour = round($nbJour - $nbAnnees * 365);
  400. switch ($nbAnnees)
  401. {
  402. case "1" :
  403. echo $nbAnnees, " an ";
  404. break;
  405. case "0" :
  406. break;
  407. default :
  408. echo $nbAnnees, " ans ";
  409. };
  410. switch ($nbJour)
  411. {
  412. case "1" :
  413. echo $nbJour, " jour ";
  414. break;
  415. case "0" :
  416. break;
  417. default :
  418. echo $nbJour, " jours ";
  419. }
  420. if ($canReportExpirationDate)
  421. {
  422. echo " -&gt; <a href=\"".$urlScriptToReportExpirationDate."\">".get_lang('PostPone')."</a>";
  423. }
  424. ?>
  425. </td>
  426. </tr>
  427. </table>
  428. <?php
  429. }
  430. /*
  431. ==============================================================================
  432. FOOTER
  433. ==============================================================================
  434. */
  435. Display::display_footer();
  436. ?>