user.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * This script displays a list of the users of the current course.
  22. * Course admins can change user perimssions, subscribe and unsubscribe users...
  23. *
  24. * EXPERIMENTAL: support for virtual courses
  25. * - show users registered in virtual and real courses;
  26. * - only show the users of a virtual course if the current user;
  27. * is registered in that virtual course.
  28. *
  29. * Exceptions: platform admin and the course admin will see all virtual courses.
  30. * This is a new feature, there may be bugs.
  31. *
  32. * @todo possibility to edit user-course rights and view statistics for users in virtual courses
  33. * @todo convert normal table display to display function (refactor virtual course display function)
  34. * @todo display table functions need support for align and valign (e.g. to center text in cells) (this is now possible)
  35. * @author Roan Embrechts, refactoring + virtual courses support
  36. * @package dokeos.user
  37. ==============================================================================
  38. */
  39. /*
  40. ==============================================================================
  41. INIT SECTION
  42. ==============================================================================
  43. */
  44. $langFile = array('registration','admin');
  45. require_once ("../inc/global.inc.php");
  46. $this_section = SECTION_COURSES;
  47. /*
  48. -----------------------------------------------------------
  49. Libraries
  50. -----------------------------------------------------------
  51. */
  52. require_once (api_get_path(LIBRARY_PATH)."debug.lib.inc.php");
  53. require_once (api_get_path(LIBRARY_PATH)."events.lib.inc.php");
  54. require_once (api_get_path(LIBRARY_PATH)."export.lib.inc.php");
  55. require_once (api_get_path(LIBRARY_PATH)."course.lib.php");
  56. require_once (api_get_path(LIBRARY_PATH).'sortabletable.class.php');
  57. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  58. //CHECK KEYS
  59. if( !isset ($_cid))
  60. {
  61. header("location: ".$rootWeb);
  62. }
  63. /*
  64. -----------------------------------------------------------
  65. Constants and variables
  66. -----------------------------------------------------------
  67. */
  68. $currentCourseID = $_course['sysCode'];
  69. /*
  70. ==============================================================================
  71. FUNCTIONS
  72. ==============================================================================
  73. */
  74. function display_user_search_form()
  75. {
  76. echo '<form method="get" action="user.php">';
  77. echo get_lang("SearchForUser") . "&nbsp;&nbsp;";
  78. echo '<input type="text" name="keyword" value="'.$_GET['keyword'].'"/>';
  79. echo '<input type="submit" value="'.get_lang('SearchButton').'"/>';
  80. echo '</form>';
  81. }
  82. /**
  83. * This function displays a list if users for each virtual course linked to the current
  84. * real course.
  85. *
  86. * defines globals
  87. *
  88. * @version 1.0
  89. * @author Roan Embrechts
  90. * @todo users from virtual courses always show "-" for the group related output. Edit and statistics columns are disabled * for these users, for now.
  91. */
  92. function show_users_in_virtual_courses()
  93. {
  94. global $_course, $_uid;
  95. $real_course_code = $_course['sysCode'];
  96. $real_course_info = Database::get_course_info($real_course_code);
  97. $user_subscribed_virtual_course_list = CourseManager::get_list_of_virtual_courses_for_specific_user_and_real_course($_uid, $real_course_code);
  98. $number_of_virtual_courses = count($user_subscribed_virtual_course_list);
  99. $row = 0;
  100. $column_header[$row ++] = "ID";
  101. $column_header[$row ++] = get_lang("FullUserName");
  102. $column_header[$row ++] = get_lang("Role");
  103. $column_header[$row ++] = get_lang("Group");
  104. if( api_is_allowed_to_edit())
  105. {
  106. $column_header[$row ++] = get_lang("Tutor");
  107. }
  108. if( api_is_allowed_to_edit())
  109. {
  110. $column_header[$row ++] = get_lang("CourseManager");
  111. }
  112. //$column_header[$row++] = get_lang("Edit");
  113. //$column_header[$row++] = get_lang("Unreg");
  114. //$column_header[$row++] = get_lang("Tracking");
  115. if( !is_array($user_subscribed_virtual_course_list))
  116. return;
  117. foreach ($user_subscribed_virtual_course_list as $virtual_course)
  118. {
  119. $virtual_course_code = $virtual_course["code"];
  120. $virtual_course_user_list = CourseManager::get_user_list_from_course_code($virtual_course_code);
  121. $message = get_lang("RegisteredInVirtualCourse")." ".$virtual_course["title"]."&nbsp;&nbsp;(".$virtual_course["code"].")";
  122. echo "<br/>";
  123. echo "<h4>".$message."</h4>";
  124. $properties["width"] = "100%";
  125. $properties["cellspacing"] = "1";
  126. Display::display_complex_table_header($properties, $column_header);
  127. foreach ($virtual_course_user_list as $this_user)
  128. {
  129. $user_id = $this_user["user_id"];
  130. $loginname = $this_user["username"];
  131. $lastname = $this_user["lastname"];
  132. $firstname = $this_user["firstname"];
  133. $status = $this_user["status"];
  134. $role = $this_user["role"];
  135. if( $status == "1")
  136. $status = get_lang("CourseManager");
  137. else
  138. $status = " - ";
  139. //if(xxx['tutor'] == '0') $tutor = " - ";
  140. //else $tutor = get_lang("Tutor");
  141. $full_name = $lastname.", ".$firstname;
  142. if( $lastname == "" || $firstname == '')
  143. $full_name = $loginname;
  144. $user_info_hyperlink = "<a href=\"userInfo.php?".api_get_cidreq()."&origin=".$origin."&uInfo=".$user_id."&virtual_course=".$virtual_course["code"]."\">".$full_name."</a>";
  145. $row = 0;
  146. $table_row[$row ++] = $user_id;
  147. $table_row[$row ++] = $user_info_hyperlink; //Full name
  148. $table_row[$row ++] = $role; //Description
  149. $table_row[$row ++] = " - "; //Group, for the moment groups don't work for students in virtual courses
  150. if( api_is_allowed_to_edit())
  151. $table_row[$row ++] = " - "; //Tutor column
  152. if( api_is_allowed_to_edit())
  153. $table_row[$row ++] = $status; //Course Manager column
  154. Display::display_table_row($bgcolor, $table_row, true);
  155. }
  156. Display::display_table_footer();
  157. }
  158. }
  159. /*
  160. ==============================================================================
  161. MAIN CODE
  162. ==============================================================================
  163. */
  164. if(!$is_allowed_in_course)
  165. api_not_allowed();
  166. //statistics
  167. event_access_tool(TOOL_USER);
  168. /*
  169. --------------------------------------
  170. Setting the permissions for this page
  171. --------------------------------------
  172. */
  173. $is_allowed_to_track = $is_courseAdmin && $is_trackingEnabled;
  174. /*
  175. --------------------------------------
  176. Unregistering a user section
  177. --------------------------------------
  178. */
  179. if(api_is_allowed_to_edit())
  180. {
  181. if(isset($_POST['action']))
  182. {
  183. switch($_POST['action'])
  184. {
  185. case 'unsubscribe' :
  186. // Make sure we don't unsubscribe current user from the course
  187. $user_ids = array_diff($_POST['user'],array($_uid));
  188. if(count($user_ids) > 0)
  189. {
  190. CourseManager::unsubscribe_user($user_ids, $_SESSION['_course']['sysCode']);
  191. $message = get_lang('UsersUnsubscribed');
  192. }
  193. break;
  194. }
  195. }
  196. }
  197. if(api_is_allowed_to_edit())
  198. {
  199. if( isset ($_GET['action']))
  200. {
  201. switch ($_GET['action'])
  202. {
  203. case 'export' :
  204. if(api_get_setting('use_session_mode')!="true"){
  205. $table_user = Database::get_main_table(MAIN_USER_TABLE);
  206. $table_course_user = Database::get_main_table(MAIN_COURSE_USER_TABLE);
  207. $course = api_get_course_info();
  208. $sql = "SELECT official_code,firstname,lastname,email FROM $table_user u, $table_course_user cu WHERE cu.user_id = u.user_id AND cu.course_code = '".$course['sysCode']."' ORDER BY lastname ASC";
  209. }
  210. else {
  211. $sql = "SELECT `user`.`user_id`, `user`.`lastname`, `user`.`firstname`,
  212. `user`.`email`, `user`.`official_code`, session.name
  213. FROM ".Database::get_main_table(MAIN_USER_TABLE)." `user`, ".Database::get_main_table(MAIN_SESSION_COURSE_USER_TABLE)." cu, ".Database::get_main_table(MAIN_SESSION_TABLE)." session
  214. WHERE `user`.`user_id`= cu.`id_user`
  215. AND cu.`course_code`='".$currentCourseID."'
  216. AND session.id=cu.id_session
  217. AND session.id='".$_SESSION['id_session']."'";
  218. }
  219. $users = api_sql_query($sql, __FILE__, __LINE__);
  220. while ($user = mysql_fetch_array($users, MYSQL_ASSOC))
  221. {
  222. $data[] = $user;
  223. }
  224. switch ($_GET['type'])
  225. {
  226. case 'csv' :
  227. Export::export_table_csv($data);
  228. case 'xls' :
  229. Export::export_table_xls($data);
  230. }
  231. }
  232. }
  233. } // end if allowed to edit
  234. if(api_is_allowed_to_edit())
  235. {
  236. // Unregister user from course
  237. if($_GET['unregister'])
  238. {
  239. if(isset($_GET['user_id']) && is_numeric($_GET['user_id']) && $_GET['user_id'] != $_uid)
  240. {
  241. CourseManager::unsubscribe_user($_GET['user_id'],$_SESSION['_course']['sysCode']);
  242. $message = get_lang('UserUnsubscribed');
  243. }
  244. }
  245. } // end if allowed to edit
  246. /*
  247. -----------------------------------------------------------
  248. Header
  249. -----------------------------------------------------------
  250. */
  251. if( $origin != 'learnpath')
  252. {
  253. //so we are not in learnpath tool
  254. $nameTools = get_lang("Users");
  255. Display::display_header($nameTools, "User");
  256. }
  257. else
  258. {
  259. ?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH); ?>css/default.css" /> <?php
  260. }
  261. if( isset($message))
  262. {
  263. Display::display_normal_message($message);
  264. }
  265. /*
  266. -----------------------------------------------------------
  267. Introduction section
  268. (editable by course admins)
  269. -----------------------------------------------------------
  270. */
  271. Display::display_introduction_section(TOOL_USER, $is_allowed);
  272. if( api_is_allowed_to_edit())
  273. {
  274. echo "<div align=\"right\">";
  275. echo '<a href="user.php?action=export&type=csv">'.get_lang('ExportAsCSV').'</a> | ';
  276. echo '<a href="user.php?action=export&type=xls">'.get_lang('ExportAsXLS').'</a> | ';
  277. echo "<a href=\"subscribe_user.php\">".get_lang("SubscribeUserToCourse")."</a> | ";
  278. echo "<a href=\"../group/group.php?".api_get_cidreq()."\">".get_lang("GroupUserManagement")."</a>";
  279. if(api_get_setting('use_session_mode')=='false')
  280. {
  281. echo ' | <a href="class.php">'.get_lang('Classes').'</a>';
  282. }
  283. echo "</div>";
  284. }
  285. /*
  286. --------------------------------------
  287. DISPLAY USERS LIST
  288. --------------------------------------
  289. Also shows a "next page" button if there are
  290. more than 50 users.
  291. There's a bug in here somewhere - some users count as more than one if they are in more than one group
  292. --> code for > 50 users should take this into account
  293. (Roan, Feb 2004)
  294. */
  295. if( CourseManager::has_virtual_courses_from_code($course_id, $user_id))
  296. {
  297. $real_course_code = $_course['sysCode'];
  298. $real_course_info = Database::get_course_info($real_course_code);
  299. $message = get_lang("RegisteredInRealCourse")." ".$real_course_info["title"]."&nbsp;&nbsp;(".$real_course_info["official_code"].")";
  300. echo "<h4>".$message."</h4>";
  301. }
  302. /*
  303. ==============================================================================
  304. DISPLAY LIST OF USERS
  305. ==============================================================================
  306. */
  307. /**
  308. * * Get the users to display on the current page.
  309. */
  310. function get_number_of_users()
  311. {
  312. $user_table = Database::get_main_table(MAIN_USER_TABLE);
  313. $course_user_table = Database::get_main_table(MAIN_COURSE_USER_TABLE);
  314. if(api_get_setting('use_session_mode')!="true"){
  315. $sql = "SELECT COUNT(u.user_id) AS number_of_users FROM $user_table u,$course_user_table cu WHERE u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
  316. }
  317. else{
  318. $sql = "SELECT COUNT(id_user)+1 AS number_of_users
  319. FROM ".Database::get_main_table(MAIN_SESSION_COURSE_USER_TABLE)."
  320. WHERE course_code= '".$_SESSION['_course']['id']."'
  321. AND id_session='".$_SESSION['id_session']."'";
  322. }
  323. if( isset ($_GET['keyword']))
  324. {
  325. $keyword = mysql_real_escape_string($_GET['keyword']);
  326. $sql .= " AND (firstname LIKE '%".$keyword."%' OR lastname LIKE '%".$keyword."%' OR username LIKE '%".$keyword."%' OR official_code LIKE '%".$keyword."%')";
  327. }
  328. $res = api_sql_query($sql, __FILE__, __LINE__);
  329. $result = mysql_fetch_object($res);
  330. return $result->number_of_users;
  331. }
  332. /**
  333. * Get the users to display on the current page.
  334. */
  335. function get_user_data($from, $number_of_items, $column, $direction)
  336. {
  337. global $is_allowed_to_track;
  338. if(api_get_setting('use_session_mode')!='true')
  339. {
  340. $user_table = Database::get_main_table(MAIN_USER_TABLE);
  341. $course_user_table = Database::get_main_table(MAIN_COURSE_USER_TABLE);
  342. if(api_is_allowed_to_edit())
  343. $columns[] = 'u.user_id';
  344. $columns[] = 'u.official_code';
  345. $columns[] = 'u.lastname';
  346. $columns[] = 'u.firstname';
  347. $columns[] = 'cu.role';
  348. $columns[] = "''"; //placeholder for group-data
  349. if(api_is_allowed_to_edit())
  350. {
  351. $columns[] = "IF(cu.tutor_id = 1,'".get_lang('Tutor')."','')";
  352. $columns[] = "IF(cu.status = 1,'".get_lang('CourseManager')."','')";
  353. }
  354. $columns[] = 'u.user_id';
  355. $sql = "SELECT ";
  356. foreach( $columns as $index => $sqlcolumn)
  357. $columns[$index] = ' '.$sqlcolumn.' AS col'.$index.' ';
  358. $sql .= implode(" , ", $columns);
  359. $sql .= "FROM $user_table u,$course_user_table cu WHERE u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
  360. if( isset ($_GET['keyword']))
  361. {
  362. $keyword = mysql_real_escape_string($_GET['keyword']);
  363. $sql .= " AND (firstname LIKE '%".$keyword."%' OR lastname LIKE '%".$keyword."%' OR username LIKE '%".$keyword."%' OR official_code LIKE '%".$keyword."%')";
  364. }
  365. $sql .= " ORDER BY col$column $direction ";
  366. $sql .= " LIMIT $from, $number_of_items";
  367. $res = api_sql_query($sql, __FILE__, __LINE__);
  368. $users = array();
  369. $user_ids = array();
  370. while($user = mysql_fetch_row($res))
  371. {
  372. $users[''.$user[0]] = $user;
  373. $user_ids[] = $user[0];
  374. }
  375. $sql = "
  376. SELECT
  377. ug.user_id,
  378. ug.group_id group_id,
  379. sg.name
  380. FROM " . Database::get_course_table(GROUP_USER_TABLE) . " ug
  381. LEFT JOIN " . Database::get_course_table(GROUP_TABLE) . " sg ON ug.group_id = sg.id
  382. WHERE ug.user_id IN ('".implode("','", $user_ids)."')";
  383. $res = api_sql_query($sql,__FILE__,__LINE__);
  384. while($group = mysql_fetch_object($res))
  385. $users[''.$group->user_id][5] .= $group->name.'<br />';
  386. }
  387. else {
  388. $columns = array();
  389. if(api_is_allowed_to_edit())
  390. {
  391. $columns[] = 'u.user_id';
  392. }
  393. $columns[] = 'u.official_code';
  394. $columns[] = 'u.lastname';
  395. $columns[] = 'u.firstname';
  396. $columns[] = '"Professor"';
  397. $columns[] = "''"; //placeholder for group-data
  398. if(api_is_allowed_to_edit())
  399. {
  400. $columns[] = "'".get_lang('Tutor')."'";
  401. $columns[] = "'".get_lang('CourseManager')."'";
  402. }
  403. $columns[] = 'u.user_id';
  404. $sql = "SELECT ".implode(',',$columns)."
  405. FROM ".Database::get_main_table(MAIN_USER_TABLE)." `u`, ".Database::get_main_table(MAIN_SESSION_COURSE_TABLE)." c
  406. WHERE `u`.`user_id`= c.`id_coach`
  407. AND c.`course_code`='".$_SESSION['_course']['id']."'
  408. AND c.id_session='".$_SESSION['id_session']."'";
  409. $res = api_sql_query($sql, __FILE__, __LINE__);
  410. $users = array ();
  411. while ($user = mysql_fetch_row($res))
  412. {
  413. $users[''.$user[0]] = $user;
  414. $user_ids[] = $user[0];
  415. }
  416. $columns = array();
  417. if(api_is_allowed_to_edit())
  418. {
  419. $columns[] = 'u.user_id';
  420. }
  421. $columns[] = 'u.official_code';
  422. $columns[] = 'u.lastname';
  423. $columns[] = 'u.firstname';
  424. $columns[] = '"Professor"';
  425. $columns[] = "''"; //placeholder for group-data
  426. if(api_is_allowed_to_edit())
  427. {
  428. $columns[] = "''";
  429. $columns[] = "''";
  430. }
  431. $columns[] = 'u.user_id';
  432. $sql = "SELECT ".implode(',',$columns)."
  433. FROM ".Database::get_main_table(MAIN_USER_TABLE)." `u`, ".Database::get_main_table(MAIN_SESSION_COURSE_USER_TABLE)." c
  434. WHERE `u`.`user_id`= c.`id_user`
  435. AND c.`course_code`='".$_SESSION['_course']['id']."'
  436. AND c.id_session='".$_SESSION['id_session']."'";
  437. $res = api_sql_query($sql, __FILE__, __LINE__);
  438. while ($user = mysql_fetch_row($res))
  439. {
  440. $users[''.$user[0]] = $user;
  441. $user_ids[] = $user[0];
  442. }
  443. $sql = "SELECT ug.user_id, ug.group_id group_id, sg.name
  444. FROM ".Database::get_course_table(GROUP_USER_TABLE)." ug
  445. LEFT JOIN ".Database::get_course_table(GROUP_TABLE)." sg
  446. ON ug.group_id = sg.id
  447. WHERE ug.user_id IN ('".implode("','", $user_ids)."')";
  448. $res = api_sql_query($sql,__FILE__,__LINE__);
  449. while($group = mysql_fetch_object($res))
  450. {
  451. $users[''.$group->user_id][5] .= $group->name.'<br />';
  452. }
  453. }
  454. return $users;
  455. }
  456. /**
  457. * Build the modify-column of the table
  458. * @param int $user_id The user id
  459. * @return string Some HTML-code
  460. */
  461. function modify_filter($user_id)
  462. {
  463. global $origin,$_uid,$is_allowed_to_track;
  464. // info
  465. $result = '<a href="userInfo.php?origin='.$origin.'&amp;uInfo='.$user_id.'"><img border="0" alt="'.get_lang('Info').'" src="../img/info_small.gif" /></a>';
  466. if(api_is_allowed_to_edit())
  467. {
  468. if($is_allowed_to_track)
  469. {
  470. $result .= '<a href="../tracking/userLog.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;uInfo='.$user_id.'"><img border="0" alt="'.get_lang('Tracking').'" src="../img/statistics.gif" /></a>';
  471. }
  472. // edit
  473. $result .= '<a href="userInfo.php?origin='.$origin.'&amp;editMainUserInfo='.$user_id.'"><img border="0" alt="'.get_lang('Edit').'" src="../img/edit.gif" /></a>';
  474. // unregister
  475. if( $user_id != $_uid)
  476. {
  477. $result .= '<a href="'.$_SERVER['PHP_SELF'].'?unregister=yes&amp;user_id='.$user_id.'&amp;'.$sort_params.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang('ConfirmYourChoice'))).'\')) return false;"><img border="0" alt="'.get_lang("Unreg").'" src="../img/delete.gif"/></a>';
  478. }
  479. }
  480. return $result;
  481. }
  482. $default_column = api_is_allowed_to_edit() ? 2 : 1;
  483. $table = new SortableTable('users', 'get_number_of_users', 'get_user_data',$default_column);
  484. $parameters['keyword'] = $_GET['keyword'];
  485. $table->set_additional_parameters($parameters);
  486. $header_nr = 0;
  487. if( api_is_allowed_to_edit())
  488. {
  489. $table->set_header($header_nr++, '', false);
  490. }
  491. $table->set_header($header_nr++, get_lang('OfficialCode'));
  492. $table->set_header($header_nr++, get_lang('Lastname'));
  493. $table->set_header($header_nr++, get_lang('Firstname'));
  494. $table->set_header($header_nr++, get_lang('Role'));
  495. $table->set_header($header_nr++, get_lang('Group'),false);
  496. if( api_is_allowed_to_edit())
  497. {
  498. $table->set_header($header_nr++, get_lang('Tutor'));
  499. $table->set_header($header_nr++, get_lang('CourseManager'));
  500. }
  501. //actions column
  502. $table->set_header($header_nr++, '', false);
  503. $table->set_column_filter($header_nr-1,'modify_filter');
  504. if( api_is_allowed_to_edit())
  505. {
  506. $table->set_form_actions(array ('unsubscribe' => get_lang('Unreg')), 'user');
  507. }
  508. // Build search-form
  509. $form = new FormValidator('search_user', 'get','','',null,false);
  510. $renderer = & $form->defaultRenderer();
  511. $renderer->setElementTemplate('<span>{element}</span> ');
  512. $form->add_textfield('keyword', '', false);
  513. $form->addElement('submit', 'submit', get_lang('SearchButton'));
  514. $form->display();
  515. echo '<br />';
  516. $table->display();
  517. if( get_setting('allow_user_headings') == 'true' && $is_courseAdmin && api_is_allowed_to_edit() && $origin != 'learnpath') // only course administrators see this line
  518. {
  519. echo "<div align=\"right\">", "<form method=\"post\" action=\"userInfo.php\">", get_lang("CourseAdministratorOnly"), " : ", "<input type=\"submit\" name=\"viewDefList\" value=\"".get_lang("DefineHeadings")."\" />", "</form>", "</div>\n";
  520. }
  521. //User list of the virtual courses linked to this course.
  522. //show_users_in_virtual_courses($is_allowed_to_track);
  523. /*
  524. ==============================================================================
  525. FOOTER
  526. ==============================================================================
  527. */
  528. if( $origin != 'learnpath')
  529. {
  530. Display::display_footer();
  531. }
  532. ?>