infocours.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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 = '".mysql_real_escape_string($_course['categoryCode'])."' ORDER BY tree_pos";
  98. $res = api_sql_query($sql, __FILE__, __LINE__);
  99. $s_select_course_tutor_name="SELECT tutor_name FROM $tbl_course WHERE code='$course_code'";
  100. $q_tutor=api_sql_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=api_sql_query($s_sql_course_titular, __FILE__, __LINE__);
  104. if(mysql_num_rows($q_result_titulars)==0){
  105. $sql="SELECT username, lastname, firstname FROM $tbl_user as user, $tbl_admin as admin WHERE admin.user_id=user.user_id ORDER BY lastname ASC";
  106. $q_result_titulars=api_sql_query($sql, __FILE__, __LINE__);
  107. }
  108. $a_profs[0] = '-- '.get_lang('NoManager').' --';
  109. while($a_titulars=mysql_fetch_array($q_result_titulars)){
  110. $s_username=$a_titulars["username"];
  111. $s_lastname=$a_titulars["lastname"];
  112. $s_firstname=$a_titulars["firstname"];
  113. if($s_firstname.' '.$s_lastname==$s_tutor){
  114. $s_selected_tutor=$s_firstname.' '.$s_lastname;
  115. }
  116. $s_disabled_select_titular="";
  117. if(!$is_courseAdmin){
  118. $s_disabled_select_titular="disabled=disabled";
  119. }
  120. $a_profs[$s_firstname.' '.$s_lastname]="$s_lastname $s_firstname ($s_username)";
  121. }
  122. while ($cat = mysql_fetch_array($res))
  123. {
  124. $categories[$cat['code']] = '('.$cat['code'].') '.$cat['name'];
  125. ksort($categories);
  126. }
  127. $linebreak = '<div class="row"><div class="label"></div><div class="formw" style="border-bottom:1px dashed grey"></div></div>';
  128. // Build the form
  129. $form = new FormValidator('update_course');
  130. // COURSE SETTINGS
  131. $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>');
  132. $visual_code=$form->addElement('text','visual_code', get_lang('Code'));
  133. $visual_code->freeze();
  134. $form->applyFilter('visual_code', 'strtoupper');
  135. //$form->add_textfield('tutor_name', get_lang('Professors'), true, array ('size' => '60'));
  136. $prof = &$form->addElement('select', 'tutor_name', get_lang('Professors'), $a_profs);
  137. $form->applyFilter('tutor_name','html_filter');
  138. $prof -> setSelected($s_selected_tutor);
  139. $form->add_textfield('title', get_lang('Title'), true, array ('size' => '60'));
  140. //$form->applyFilter('title','html_filter');
  141. $form->applyFilter('title','trim');
  142. $form->addElement('select', 'category_code', get_lang('Fac'), $categories);
  143. $form->add_textfield('department_name', get_lang('Department'), false, array ('size' => '60'));
  144. //$form->applyFilter('department_name','html_filter');
  145. $form->applyFilter('department_name','trim');
  146. $form->add_textfield('department_url', get_lang('DepartmentUrl'), false, array ('size' => '60'));
  147. //$form->applyFilter('department_url','html_filter');
  148. $form->addRule('tutor_name', get_lang('ThisFieldIsRequired'), 'required');
  149. $form->addElement('select_language', 'course_language', get_lang('Ln'));
  150. $form->addElement('static', null, '&nbsp;', get_lang('TipLang'));
  151. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  152. // COURSE ACCESS
  153. $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>');
  154. $form->addElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
  155. $form->addElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
  156. $form->addElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
  157. $form->addElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
  158. $form->addElement('static', null, null, get_lang("CourseAccessConfigTip"));
  159. $form -> addElement('html',$linebreak);
  160. $form->addElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
  161. $form->addElement('radio', 'subscribe', null, get_lang('Denied'), 0);
  162. $form -> addElement('html',$linebreak);
  163. $form->addElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
  164. $form->addElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
  165. $form -> addElement('html',$linebreak);
  166. $form->add_textfield('course_registration_password', get_lang('CourseRegistrationPassword'), false, array ('size' => '60'));
  167. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  168. // EMAIL NOTIFICATIONS
  169. $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>');
  170. $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1);
  171. $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null,get_lang('NewUserEmailAlertToTeacharAndTutor'),2);
  172. $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0);
  173. $form -> addElement('html',$linebreak);
  174. $form->addElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
  175. $form->addElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0);
  176. $form -> addElement('html',$linebreak);
  177. $form->addElement('radio', 'email_alert_on_new_doc_dropbox', get_lang('DropboxEmailAlert'), get_lang('DropboxEmailAlertActivate'), 1);
  178. $form->addElement('radio', 'email_alert_on_new_doc_dropbox', null, get_lang('DropboxEmailAlertDeactivate'), 0);
  179. $form -> addElement('html',$linebreak);
  180. $form->addElement('radio', 'email_alert_manager_on_new_quiz', get_lang('QuizEmailAlert'), get_lang('QuizEmailAlertActivate'), 1);
  181. $form->addElement('radio', 'email_alert_manager_on_new_quiz', null, get_lang('QuizEmailAlertDeactivate'), 0);
  182. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  183. // USER RIGHTS
  184. $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>');
  185. $form->addElement('radio', 'allow_user_edit_agenda', get_lang('AllowUserEditAgenda'), get_lang('AllowUserEditAgendaActivate'), 1);
  186. $form->addElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0);
  187. $form -> addElement('html',$linebreak);
  188. $form->addElement('radio', 'allow_user_edit_announcement', get_lang('AllowUserEditAnnouncement'), get_lang('AllowUserEditAnnouncementActivate'), 1);
  189. $form->addElement('radio', 'allow_user_edit_announcement', null, get_lang('AllowUserEditAnnouncementDeactivate'), 0);
  190. $form -> addElement('html',$linebreak);
  191. $form->addElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageForum'), get_lang('AllowUserImageForumActivate'), 1);
  192. $form->addElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0);
  193. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  194. // CHAT SETTINGS
  195. $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>');
  196. $form->addElement('radio', 'allow_open_chat_window', get_lang('AllowOpenchatWindow'), get_lang('AllowOpenChatWindowActivate'), 1);
  197. $form->addElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0);
  198. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  199. // COURSE THEME PICKER
  200. if (api_get_setting('allow_course_theme') == 'true')
  201. {
  202. $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>');
  203. //Allow Learning path
  204. $form->addElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1);
  205. $form->addElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
  206. $form -> addElement('html',$linebreak);
  207. $form->addElement('select_theme', 'course_theme', get_lang('Theme'));
  208. $form->applyFilter('course_theme', 'trim');
  209. $form -> addElement('html',$linebreak);
  210. }
  211. if (is_settings_editable())
  212. {
  213. $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
  214. }
  215. else
  216. {
  217. // is it allowed to edit the course settings?
  218. if (!is_settings_editable())
  219. $disabled_output = "disabled";
  220. $form->freeze();
  221. }
  222. // get all the course information
  223. $all_course_information = CourseManager::get_course_information($_course['sysCode']);
  224. // Set the default values of the form
  225. $values['title'] = $_course['name'];
  226. $values['visual_code'] = $_course['official_code'];
  227. $values['category_code'] = $_course['categoryCode'];
  228. //$values['tutor_name'] = $_course['titular'];
  229. $values['course_language'] = $_course['language'];
  230. $values['department_name'] = $_course['extLink']['name'];
  231. $values['department_url'] = $_course['extLink']['url'];
  232. $values['visibility'] = $_course['visibility'];
  233. $values['subscribe'] = $course_access_settings['subscribe'];
  234. $values['unsubscribe'] = $course_access_settings['unsubscribe'];
  235. $values['course_registration_password'] = $all_course_information['registration_code'];
  236. // get send_mail_setting (auth)from table
  237. $values['email_alert_to_teacher_on_new_user_in_course'] = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course');
  238. // get send_mail_setting (work)from table
  239. $values['email_alert_manager_on_new_doc'] = api_get_course_setting('email_alert_manager_on_new_doc');
  240. // get send_mail_setting (dropbox) from table
  241. $values['email_alert_on_new_doc_dropbox'] = api_get_course_setting('email_alert_on_new_doc_dropbox');
  242. // get send_mail_setting (work)from table
  243. $values['email_alert_manager_on_new_quiz'] = api_get_course_setting('email_alert_manager_on_new_quiz');
  244. // get allow_user_edit_agenda from table
  245. $values['allow_user_edit_agenda'] = api_get_course_setting('allow_user_edit_agenda');
  246. // get allow_user_edit_announcement from table
  247. $values['allow_user_edit_announcement'] = api_get_course_setting('allow_user_edit_announcement');
  248. // get allow_user_image_forum from table
  249. $values['allow_user_image_forum'] = api_get_course_setting('allow_user_image_forum');
  250. // get allow_open_chat_window from table
  251. $values['allow_open_chat_window'] = api_get_course_setting('allow_open_chat_window');
  252. // get course_theme from table
  253. $values['course_theme'] = api_get_course_setting('course_theme');
  254. // get allow_learning_path_theme from table
  255. $values['allow_learning_path_theme'] = api_get_course_setting('allow_learning_path_theme');
  256. $form->setDefaults($values);
  257. // Validate form
  258. if ($form->validate() && is_settings_editable()) {
  259. $update_values = $form->exportValues();
  260. foreach ($update_values as $index => $value) {
  261. $update_values[$index] = Database::escape_string($value);
  262. }
  263. $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  264. $sql = "UPDATE $table_course SET title = '".Security::remove_XSS($update_values['title'])."',
  265. visual_code = '".$update_values['visual_code']."',
  266. course_language = '".$update_values['course_language']."',
  267. category_code = '".$update_values['category_code']."',
  268. department_name = '".Security::remove_XSS($update_values['department_name'])."',
  269. department_url = '".Security::remove_XSS($update_values['department_url'])."',
  270. visibility = '".$update_values['visibility']."',
  271. subscribe = '".$update_values['subscribe']."',
  272. unsubscribe = '".$update_values['unsubscribe']."',
  273. tutor_name = '".$update_values['tutor_name']."',
  274. registration_code = '".$update_values['course_registration_password']."'
  275. WHERE code = '".$course_code."'";
  276. api_sql_query($sql, __FILE__, __LINE__);
  277. //update course_settings table - this assumes those records exist, otherwise triggers an error
  278. $table_course_setting = Database::get_course_table(TABLE_COURSE_SETTING);
  279. if($update_values['email_alert_to_teacher_on_new_user_in_course'] != $values['email_alert_to_teacher_on_new_user_in_course']){
  280. $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' ";
  281. api_sql_query($sql,__FILE__,__LINE__);
  282. }
  283. if($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']){
  284. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_doc']." WHERE variable = 'email_alert_manager_on_new_doc' ";
  285. api_sql_query($sql,__FILE__,__LINE__);
  286. }
  287. if($update_values['email_alert_on_new_doc_dropbox'] != $values['email_alert_on_new_doc_dropbox']){
  288. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_on_new_doc_dropbox']." WHERE variable = 'email_alert_on_new_doc_dropbox' ";
  289. api_sql_query($sql,__FILE__,__LINE__);
  290. }
  291. if($update_values['email_alert_manager_on_new_quiz'] != $values['email_alert_manager_on_new_quiz']){
  292. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_quiz']." WHERE variable = 'email_alert_manager_on_new_quiz' ";
  293. api_sql_query($sql,__FILE__,__LINE__);
  294. }
  295. if($update_values['allow_user_edit_agenda'] != $values['allow_user_edit_agenda']){
  296. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_agenda']." WHERE variable = 'allow_user_edit_agenda' ";
  297. api_sql_query($sql,__FILE__,__LINE__);
  298. }
  299. if($update_values['allow_user_edit_announcement'] != $values['allow_user_edit_announcement']){
  300. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_announcement']." WHERE variable = 'allow_user_edit_announcement' ";
  301. api_sql_query($sql,__FILE__,__LINE__);
  302. }
  303. if($update_values['allow_user_image_forum'] != $values['allow_user_image_forum']){
  304. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_image_forum']." WHERE variable = 'allow_user_image_forum' ";
  305. api_sql_query($sql,__FILE__,__LINE__);
  306. }
  307. if($update_values['allow_open_chat_window'] != $values['allow_open_chat_window']){
  308. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_open_chat_window']." WHERE variable = 'allow_open_chat_window' ";
  309. api_sql_query($sql,__FILE__,__LINE__);
  310. }
  311. if($update_values['course_theme'] != $values['course_theme']){
  312. $sql = "UPDATE $table_course_setting SET value = '".$update_values['course_theme']."' WHERE variable = 'course_theme' ";
  313. api_sql_query($sql,__FILE__,__LINE__);
  314. }
  315. if($update_values['allow_learningpath_theme'] != $values['allow_learning_path_theme']){
  316. $sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_learning_path_theme']." WHERE variable = 'allow_learning_path_theme' ";
  317. api_sql_query($sql,__FILE__,__LINE__);
  318. }
  319. $cidReset = true;
  320. $cidReq = $course_code;
  321. include ('../inc/local.inc.php');
  322. header('Location: infocours.php?action=show_message&amp;cidReq='.$course_code);
  323. exit;
  324. }
  325. /*
  326. -----------------------------------------------------------
  327. Header
  328. -----------------------------------------------------------
  329. */
  330. Display :: display_header($nameTools, MODULE_HELP_NAME);
  331. //api_display_tool_title($nameTools);
  332. if (isset ($_GET['action']) && $_GET['action'] == 'show_message')
  333. {
  334. Display :: display_normal_message(get_lang('ModifDone'));
  335. }
  336. // actions bar
  337. echo '<div class="actions">';
  338. echo '<a href="#coursesettings">'.Display::return_icon('settings.gif',get_lang('CourseSettings')).' '.get_lang('CourseSettings').'</a>';
  339. echo '<a href="#coursesaccess">'.Display::return_icon('course.gif',get_lang('CourseAccess')).' '.get_lang('CourseAccess').'</a>';
  340. echo '<a href="#emailnotifications">'.Display::return_icon('mail.png',get_lang('EmailNotifications')).' '.get_lang('EmailNotifications').'</a>';
  341. echo '<a href="#userrights">'.Display::return_icon('members.gif',get_lang('UserRights')).' '.get_lang('UserRights').'</a>';
  342. echo '<a href="#chatsettings">'.Display::return_icon('chat.gif',get_lang('ConfigChat')).' '.get_lang('ConfigChat').'</a>';
  343. if (api_get_setting('allow_course_theme') == 'true')
  344. {
  345. echo '<a href="#theme">'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</a>';
  346. }
  347. echo '</div>';
  348. // Display the form
  349. $form->display();
  350. if ($showDiskQuota && $currentCourseDiskQuota != "")
  351. {
  352. ?>
  353. <table>
  354. <tr>
  355. <td><?php echo get_lang("DiskQuota"); ?>&nbsp;:</td>
  356. <td><?php echo $currentCourseDiskQuota; ?> <?php echo $byteUnits[0] ?></td>
  357. </tr>
  358. <?php
  359. }
  360. if ($showLastEdit && $currentCourseLastEdit != "" && $currentCourseLastEdit != "0000-00-00 00:00:00")
  361. {
  362. ?>
  363. <tr>
  364. <td><?php echo get_lang('LastEdit'); ?>&nbsp;:</td>
  365. <td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseLastEdit)); ?></td>
  366. </tr>
  367. <?php
  368. }
  369. if ($showLastVisit && $currentCourseLastVisit != "" && $currentCourseLastVisit != "0000-00-00 00:00:00")
  370. {
  371. ?>
  372. <tr>
  373. <td><?php echo get_lang('LastVisit'); ?>&nbsp;:</td>
  374. <td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseLastVisit)); ?></td>
  375. </tr>
  376. <?php
  377. }
  378. if ($showCreationDate && $currentCourseCreationDate != "" && $currentCourseCreationDate != "0000-00-00 00:00:00")
  379. {
  380. ?>
  381. <tr>
  382. <td><?php echo get_lang('CreationDate'); ?>&nbsp;:</td>
  383. <td><?php echo format_locale_date($dateTimeFormatLong,strtotime($currentCourseCreationDate)); ?></td>
  384. </tr>
  385. <?php
  386. }
  387. if ($showExpirationDate && $currentCourseExpirationDate != "" && $currentCourseExpirationDate != "0000-00-00 00:00:00")
  388. {
  389. ?>
  390. <tr>
  391. <td><?php echo get_lang('ExpirationDate'); ?>&nbsp;:</td>
  392. <td>
  393. <?php
  394. echo format_locale_date($dateTimeFormatLong, strtotime($currentCourseExpirationDate));
  395. echo "<br />".get_lang('OrInTime')." : ";
  396. $nbJour = (strtotime($currentCourseExpirationDate) - time()) / (60 * 60 * 24);
  397. $nbAnnees = round($nbJour / 365);
  398. $nbJour = round($nbJour - $nbAnnees * 365);
  399. switch ($nbAnnees)
  400. {
  401. case "1" :
  402. echo $nbAnnees, " an ";
  403. break;
  404. case "0" :
  405. break;
  406. default :
  407. echo $nbAnnees, " ans ";
  408. };
  409. switch ($nbJour)
  410. {
  411. case "1" :
  412. echo $nbJour, " jour ";
  413. break;
  414. case "0" :
  415. break;
  416. default :
  417. echo $nbJour, " jours ";
  418. }
  419. if ($canReportExpirationDate)
  420. {
  421. echo " -&gt; <a href=\"".$urlScriptToReportExpirationDate."\">".get_lang('PostPone')."</a>";
  422. }
  423. ?>
  424. </td>
  425. </tr>
  426. </table>
  427. <?php
  428. }
  429. /*
  430. ==============================================================================
  431. FOOTER
  432. ==============================================================================
  433. */
  434. Display::display_footer();
  435. ?>