infocours.php 21 KB

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