infocours.php 22 KB

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