user_list.php 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. <?php // $Id: user_list.php 22292 2009-07-22 18:32:32Z herodoto $
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. @author Bart Mollet
  5. * @package chamilo.admin
  6. */
  7. // name of the language file that needs to be included
  8. $language_file = array ('registration','admin');
  9. $cidReset = true;
  10. require_once '../inc/global.inc.php';
  11. require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
  12. require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
  13. require_once api_get_path(LIBRARY_PATH).'security.lib.php';
  14. require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
  15. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  16. global $_configuration;
  17. // Blocks the possibility to delete a user
  18. $delete_user_available = true;
  19. if (isset($_configuration['deny_delete_users']) && $_configuration['deny_delete_users']) {
  20. $delete_user_available = false;
  21. }
  22. $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>';
  23. $htmlHeadXtra[] = '<script type="text/javascript">
  24. function load_course_list (div_course,my_user_id) {
  25. $.ajax({
  26. contentType: "application/x-www-form-urlencoded",
  27. beforeSend: function(objeto) {
  28. $("div#"+div_course).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  29. type: "POST",
  30. url: "course_user_list.php",
  31. data: "user_id="+my_user_id,
  32. success: function(datos) {
  33. $("div#"+div_course).html(datos);
  34. $("div#div_"+my_user_id).attr("class","blackboard_show");
  35. $("div#div_"+my_user_id).attr("style","");
  36. }
  37. });
  38. }
  39. function active_user(element_div) {
  40. id_image=$(element_div).attr("id");
  41. image_clicked=$(element_div).attr("src");
  42. image_clicked_info = image_clicked.split("/");
  43. image_real_clicked = image_clicked_info[image_clicked_info.length-1];
  44. var status = 1;
  45. if (image_real_clicked == "right.gif") {
  46. status = 0;
  47. }
  48. user_id=id_image.split("_");
  49. ident="#img_"+user_id[1];
  50. if (confirm("'.get_lang('AreYouSureToEditTheUserStatus', '').'")) {
  51. $.ajax({
  52. contentType: "application/x-www-form-urlencoded",
  53. beforeSend: function(objeto) {
  54. $(ident).attr("src","'.api_get_path(WEB_IMG_PATH).'loading1.gif'.'"); }, //candy eye stuff
  55. type: "GET",
  56. url: "'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=active_user",
  57. data: "user_id="+user_id[1]+"&status="+status,
  58. success: function(datos) {
  59. if (status == 1) {
  60. $(ident).attr("src","'.api_get_path(WEB_IMG_PATH).'right.gif'.'");
  61. $(ident).attr("title","'.get_lang('Lock').'");
  62. } else {
  63. $(ident).attr("src","'.api_get_path(WEB_IMG_PATH).'wrong.gif'.'");
  64. $(ident).attr("title","'.get_lang('Unlock').'");
  65. }
  66. }
  67. });
  68. }
  69. }
  70. function clear_course_list (div_course) {
  71. $("div#"+div_course).html("&nbsp;");
  72. $("div#"+div_course).hide("");
  73. }
  74. function display_advanced_search_form () {
  75. if ($("#advanced_search_form").css("display") == "none") {
  76. $("#advanced_search_form").css("display","block");
  77. $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
  78. } else {
  79. $("#advanced_search_form").css("display","none");
  80. $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
  81. }
  82. }
  83. $(document).ready(function() {
  84. var select_val = $("#input_select_extra_data").val();
  85. if (select_val != 0) {
  86. document.getElementById(\'extra_data_text\').style.display="block";
  87. document.getElementById(\'input_extra_text\').value = "";
  88. } else {
  89. document.getElementById(\'extra_data_text\').style.display="none";
  90. }
  91. });
  92. </script>';
  93. $htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
  94. .blackboard_show {
  95. float:left;
  96. position:absolute;
  97. border:1px solid black;
  98. width: 200px;
  99. background-color:white;
  100. z-index:99; padding: 3px;
  101. display: inline;
  102. }
  103. .blackboard_hide {
  104. display: none;
  105. }
  106. ';
  107. // xajax
  108. $xajax = new xajax();
  109. $xajax->registerFunction('courses_of_user');
  110. //$xajax->registerFunction('empty_courses_of_user');
  111. $xajax->processRequests();
  112. /**
  113. * Get a formatted list of courses for given user
  114. * @param int User ID
  115. * @return resource XAJAX response
  116. */
  117. function courses_of_user($arg) {
  118. // do some stuff based on $arg like query data from a database and
  119. // put it into a variable like $newContent
  120. //$newContent = 'werkt het? en met een beetje meer text, wordt dat goed opgelost? ';
  121. $personal_course_list = UserManager::get_personal_session_course_list($arg);
  122. $newContent = '';
  123. if(count($personal_course_list)>0)
  124. {
  125. foreach ($personal_course_list as $key=>$course)
  126. {
  127. $newContent .= $course['i'].'<br />';
  128. }
  129. }
  130. else
  131. {
  132. $newContent .= '- '.get_lang('None').' -<br />';
  133. }
  134. $newContent = api_convert_encoding($newContent,'utf-8',api_get_system_encoding());
  135. // Instantiate the xajaxResponse object
  136. $objResponse = new xajaxResponse();
  137. // add a command to the response to assign the innerHTML attribute of
  138. // the element with id="SomeElementId" to whatever the new content is
  139. $objResponse->addAssign("user".$arg,"innerHTML", $newContent);
  140. $objResponse->addReplace("coursesofuser".$arg,"alt", $newContent);
  141. $objResponse->addReplace("coursesofuser".$arg,"title", $newContent);
  142. $objResponse->addAssign("user".$arg,"style.display", "block");
  143. //return the xajaxResponse object
  144. return $objResponse;
  145. }
  146. /**
  147. * Empties the XAJAX object representing the courses list
  148. * @param int User ID
  149. * @return resource XAJAX object
  150. */
  151. function empty_courses_of_user($arg)
  152. {
  153. // do some stuff based on $arg like query data from a database and
  154. // put it into a variable like $newContent
  155. $newContent = '';
  156. // Instantiate the xajaxResponse object
  157. $objResponse = new xajaxResponse();
  158. // add a command to the response to assign the innerHTML attribute of
  159. // the element with id="SomeElementId" to whatever the new content is
  160. $objResponse->addAssign("user".$arg,"innerHTML", $newContent);
  161. //return the xajaxResponse object
  162. return $objResponse;
  163. }
  164. $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
  165. $htmlHeadXtra[] = '<style>
  166. .tooltipLinkInner {
  167. position:relative;
  168. float:left;
  169. color:blue;
  170. text-decoration:none;
  171. }
  172. </style>';
  173. $this_section = SECTION_PLATFORM_ADMIN;
  174. api_protect_admin_script(true);
  175. /**
  176. * Make sure this function is protected because it does NOT check password!
  177. *
  178. * This function defines globals.
  179. * @param int User ID
  180. * @return bool False on failure, redirection on success
  181. * @author Evie Embrechts
  182. * @author Yannick Warnier <yannick.warnier@dokeos.com>
  183. */
  184. function login_user($user_id) {
  185. //init ---------------------------------------------------------------------
  186. //Load $_user to be sure we clean it before logging in
  187. global $uidReset, $loginFailed, $_configuration, $_user;
  188. $main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
  189. $main_admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
  190. $track_e_login_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
  191. //logic --------------------------------------------------------------------
  192. unset($_user['user_id']); // uid not in session ? prevent any hacking
  193. if (!isset ($user_id)) {
  194. $uidReset = true;
  195. return;
  196. }
  197. if ($user_id != strval(intval($user_id))) {
  198. return false;
  199. }
  200. $sql_query = "SELECT * FROM $main_user_table WHERE user_id='$user_id'";
  201. $sql_result = Database::query($sql_query);
  202. $result = Database :: fetch_array($sql_result);
  203. // check if the user is allowed to 'login_as'
  204. $can_login_as = (api_is_platform_admin() OR (api_is_session_admin() && $result['status'] == 5 ));
  205. if (!$can_login_as) { return false; }
  206. $firstname = $result['firstname'];
  207. $lastname = $result['lastname'];
  208. $user_id = $result['user_id'];
  209. //$message = "Attempting to login as ".api_get_person_name($firstname, $lastname)." (id ".$user_id.")";
  210. if (api_is_western_name_order()) {
  211. $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname,$user_id);
  212. } else {
  213. $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $user_id);
  214. }
  215. $loginFailed = false;
  216. $uidReset = false;
  217. if ($user_id) { // a uid is given (log in succeeded)
  218. if ($_configuration['tracking_enabled']) {
  219. $sql_query = "SELECT user.*, a.user_id is_admin,
  220. UNIX_TIMESTAMP(login.login_date) login_date
  221. FROM $main_user_table
  222. LEFT JOIN $main_admin_table a
  223. ON user.user_id = a.user_id
  224. LEFT JOIN $track_e_login_table login
  225. ON user.user_id = login.login_user_id
  226. WHERE user.user_id = '".$user_id."'
  227. ORDER BY login.login_date DESC LIMIT 1";
  228. } else {
  229. $sql_query = "SELECT user.*, a.user_id is_admin
  230. FROM $main_user_table
  231. LEFT JOIN $main_admin_table a
  232. ON user.user_id = a.user_id
  233. WHERE user.user_id = '".$user_id."'";
  234. }
  235. $sql_result = Database::query($sql_query);
  236. if (Database::num_rows($sql_result) > 0) {
  237. // Extracting the user data
  238. $user_data = Database::fetch_array($sql_result);
  239. //Delog the current user
  240. LoginDelete($_SESSION["_user"]["user_id"]);
  241. // Cleaning session variables
  242. unset($_SESSION['_user']);
  243. unset($_SESSION['is_platformAdmin']);
  244. unset($_SESSION['is_allowedCreateCourse']);
  245. unset($_SESSION['_uid']);
  246. $_user['firstName'] = $user_data['firstname'];
  247. $_user['lastName'] = $user_data['lastname'];
  248. $_user['mail'] = $user_data['email'];
  249. $_user['lastLogin'] = $user_data['login_date'];
  250. $_user['official_code'] = $user_data['official_code'];
  251. $_user['picture_uri'] = $user_data['picture_uri'];
  252. $_user['user_id'] = $user_data['user_id'];
  253. $_user['status'] = $user_data['status'];
  254. $is_platformAdmin = (bool) (!is_null($user_data['is_admin']));
  255. $is_allowedCreateCourse = (bool) ($user_data['status'] == 1);
  256. // Filling session variables with new data
  257. $_SESSION['_uid'] = $user_id;
  258. $_SESSION['_user'] = $_user;
  259. $_SESSION['is_platformAdmin'] = $is_platformAdmin;
  260. $_SESSION['is_allowedCreateCourse'] = $is_allowedCreateCourse;
  261. $_SESSION['login_as'] = true; // will be usefull later to know if the user is actually an admin or not (example reporting)s
  262. $target_url = api_get_path(WEB_PATH)."user_portal.php";
  263. //$message .= "<br/>Login successful. Go to <a href=\"$target_url\">$target_url</a>";
  264. $message .= '<br />'.sprintf(get_lang('LoginSuccessfulGoToX'),'<a href="'.$target_url.'">'.$target_url.'</a>');
  265. Display :: display_header(get_lang('UserList'));
  266. Display :: display_normal_message($message,false);
  267. Display :: display_footer();
  268. exit;
  269. } else {
  270. exit ("<br />WARNING UNDEFINED UID !! ");
  271. }
  272. }
  273. }
  274. /**
  275. * Get the total number of users on the platform
  276. * @see SortableTable#get_total_number_of_items()
  277. */
  278. function get_number_of_users()
  279. {
  280. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  281. $sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u";
  282. // adding the filter to see the user's only of the current access_url
  283. global $_configuration;
  284. if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
  285. $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
  286. $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
  287. }
  288. if (isset($_GET['keyword_extra_data'])) {
  289. $keyword_extra_data = Database::escape_string($_GET['keyword_extra_data']);
  290. if (!empty($keyword_extra_data)) {
  291. $extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data);
  292. $field_id = $extra_info['id'];
  293. $sql.= " INNER JOIN user_field_values ufv ON u.user_id=ufv.user_id AND ufv.field_id=$field_id ";
  294. }
  295. }
  296. if ( isset ($_GET['keyword'])) {
  297. $keyword = Database::escape_string(trim($_GET['keyword']));
  298. $sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR concat(u.firstname,' ',u.lastname) LIKE '%".$keyword."%' OR concat(u.lastname,' ',u.firstname) LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' OR u.official_code LIKE '%".$keyword."%') ";
  299. } elseif (isset ($_GET['keyword_firstname'])) {
  300. $admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
  301. $keyword_firstname = Database::escape_string($_GET['keyword_firstname']);
  302. $keyword_lastname = Database::escape_string($_GET['keyword_lastname']);
  303. $keyword_email = Database::escape_string($_GET['keyword_email']);
  304. $keyword_officialcode = Database::escape_string($_GET['keyword_officialcode']);
  305. $keyword_username = Database::escape_string($_GET['keyword_username']);
  306. $keyword_status = Database::escape_string($_GET['keyword_status']);
  307. $query_admin_table = '';
  308. $keyword_admin = '';
  309. if ($keyword_status == SESSIONADMIN) {
  310. $keyword_status = '%';
  311. $query_admin_table = " , $admin_table a ";
  312. $keyword_admin = ' AND a.user_id = u.user_id ';
  313. }
  314. $keyword_extra_value = '';
  315. if (isset($_GET['keyword_extra_data'])) {
  316. if (!empty($_GET['keyword_extra_data']) && !empty($_GET['keyword_extra_data_text'])) {
  317. $keyword_extra_data_text = Database::escape_string($_GET['keyword_extra_data_text']);
  318. $keyword_extra_value = " AND ufv.field_value LIKE '%".trim($keyword_extra_data_text)."%' ";
  319. }
  320. }
  321. $keyword_active = isset($_GET['keyword_active']);
  322. $keyword_inactive = isset($_GET['keyword_inactive']);
  323. $sql .= $query_admin_table .
  324. " WHERE (u.firstname LIKE '%".$keyword_firstname."%' " .
  325. "AND u.lastname LIKE '%".$keyword_lastname."%' " .
  326. "AND u.username LIKE '%".$keyword_username."%' " .
  327. "AND u.email LIKE '%".$keyword_email."%' " .
  328. "AND u.official_code LIKE '%".$keyword_officialcode."%'" .
  329. "AND u.status LIKE '".$keyword_status."'" .
  330. $keyword_admin.$keyword_extra_value;
  331. if($keyword_active && !$keyword_inactive) {
  332. $sql .= " AND u.active='1'";
  333. } elseif($keyword_inactive && !$keyword_active) {
  334. $sql .= " AND u.active='0'";
  335. }
  336. $sql .= " ) ";
  337. }
  338. // adding the filter to see the user's only of the current access_url
  339. if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
  340. $sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
  341. }
  342. $res = Database::query($sql);
  343. $obj = Database::fetch_object($res);
  344. return $obj->total_number_of_items;
  345. }
  346. /**
  347. * Get the users to display on the current page (fill the sortable-table)
  348. * @param int offset of first user to recover
  349. * @param int Number of users to get
  350. * @param int Column to sort on
  351. * @param string Order (ASC,DESC)
  352. * @see SortableTable#get_table_data($from)
  353. */
  354. function get_user_data($from, $number_of_items, $column, $direction)
  355. {
  356. global $_configuration,$origin;
  357. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  358. $admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
  359. $sql = "SELECT
  360. u.user_id AS col0,
  361. u.official_code AS col2,
  362. ".(api_is_western_name_order()
  363. ? "u.firstname AS col3,
  364. u.lastname AS col4,"
  365. : "u.lastname AS col3,
  366. u.firstname AS col4,")."
  367. u.username AS col5,
  368. u.email AS col6,
  369. u.status AS col7,
  370. u.active AS col8,
  371. u.user_id AS col9 ".
  372. ", u.expiration_date AS exp ".
  373. " FROM $user_table u ";
  374. // adding the filter to see the user's only of the current access_url
  375. if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
  376. $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
  377. $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
  378. }
  379. if (isset($_GET['keyword_extra_data'])) {
  380. $keyword_extra_data = Database::escape_string($_GET['keyword_extra_data']);
  381. if (!empty($keyword_extra_data)) {
  382. $extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data);
  383. $field_id = $extra_info['id'];
  384. $sql.= " INNER JOIN user_field_values ufv ON u.user_id=ufv.user_id AND ufv.field_id=$field_id ";
  385. }
  386. }
  387. if (isset ($_GET['keyword'])) {
  388. $keyword = Database::escape_string(trim($_GET['keyword']));
  389. $sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR concat(u.firstname,' ',u.lastname) LIKE '%".$keyword."%' OR concat(u.lastname,' ',u.firstname) LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.official_code LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' )";
  390. } elseif (isset ($_GET['keyword_firstname'])) {
  391. $keyword_firstname = Database::escape_string($_GET['keyword_firstname']);
  392. $keyword_lastname = Database::escape_string($_GET['keyword_lastname']);
  393. $keyword_email = Database::escape_string($_GET['keyword_email']);
  394. $keyword_officialcode = Database::escape_string($_GET['keyword_officialcode']);
  395. $keyword_username = Database::escape_string($_GET['keyword_username']);
  396. $keyword_status = Database::escape_string($_GET['keyword_status']);
  397. $query_admin_table = '';
  398. $keyword_admin = '';
  399. if ($keyword_status == SESSIONADMIN) {
  400. $keyword_status = '%';
  401. $query_admin_table = " , $admin_table a ";
  402. $keyword_admin = ' AND a.user_id = u.user_id ';
  403. }
  404. $keyword_extra_value = '';
  405. if (isset($_GET['keyword_extra_data'])) {
  406. if (!empty($_GET['keyword_extra_data']) && !empty($_GET['keyword_extra_data_text'])) {
  407. $keyword_extra_data_text = Database::escape_string($_GET['keyword_extra_data_text']);
  408. $keyword_extra_value = " AND ufv.field_value LIKE '%".trim($keyword_extra_data_text)."%' ";
  409. }
  410. }
  411. $keyword_active = isset($_GET['keyword_active']);
  412. $keyword_inactive = isset($_GET['keyword_inactive']);
  413. $sql .= $query_admin_table." WHERE (u.firstname LIKE '%".$keyword_firstname."%' " .
  414. "AND u.lastname LIKE '%".$keyword_lastname."%' " .
  415. "AND u.username LIKE '%".$keyword_username."%' " .
  416. "AND u.email LIKE '%".$keyword_email."%' " .
  417. "AND u.official_code LIKE '%".$keyword_officialcode."%' " .
  418. "AND u.status LIKE '".$keyword_status."'" .
  419. $keyword_admin.$keyword_extra_value;
  420. if ($keyword_active && !$keyword_inactive) {
  421. $sql .= " AND u.active='1'";
  422. } elseif($keyword_inactive && !$keyword_active) {
  423. $sql .= " AND u.active='0'";
  424. }
  425. $sql .= " ) ";
  426. }
  427. // adding the filter to see the user's only of the current access_url
  428. if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
  429. $sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
  430. }
  431. if (!in_array($direction, array('ASC','DESC'))) {
  432. $direction = 'ASC';
  433. }
  434. $column = intval($column);
  435. $from = intval($from);
  436. $number_of_items = intval($number_of_items);
  437. $sql .= " ORDER BY col$column $direction ";
  438. $sql .= " LIMIT $from,$number_of_items";
  439. $res = Database::query($sql);
  440. $users = array ();
  441. $t = time();
  442. while ($user = Database::fetch_row($res)) {
  443. $image_path = UserManager::get_user_picture_path_by_id($user[0], 'web', false, true);
  444. $user_profile = UserManager::get_picture_user($user[0], $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
  445. if (!api_is_anonymous()) {
  446. $photo = '<center><a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$user[0].'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user[2],$user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" /></a></center>';
  447. } else {
  448. $photo = '<center><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" /></center>';
  449. }
  450. if ($user[7] == 1 && $user[9] != '0000-00-00 00:00:00') {
  451. // check expiration date
  452. $expiration_time = convert_mysql_date($user[9]);
  453. // if expiration date is passed, store a special value for active field
  454. if ($expiration_time < $t) {
  455. $user[7] = '-1';
  456. }
  457. }
  458. // forget about the expiration date field
  459. $users[] = array($user[0],$photo,$user[1],$user[2],$user[3],$user[4],$user[5],$user[6],$user[7],$user[8]);
  460. }
  461. return $users;
  462. }
  463. /**
  464. * Returns a mailto-link
  465. * @param string $email An email-address
  466. * @return string HTML-code with a mailto-link
  467. */
  468. function email_filter($email)
  469. {
  470. return Display :: encrypted_mailto_link($email, $email);
  471. }
  472. /**
  473. * Returns a mailto-link
  474. * @param string $email An email-address
  475. * @return string HTML-code with a mailto-link
  476. */
  477. function user_filter($name, $params, $row) {
  478. return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>';
  479. }
  480. /**
  481. * Build the modify-column of the table
  482. * @param int The user id
  483. * @param string URL params to add to table links
  484. * @param array Row of elements to alter
  485. * @return string Some HTML-code with modify-buttons
  486. */
  487. function modify_filter($user_id,$url_params,$row) {
  488. global $charset, $_user, $_admins_list, $delete_user_available;
  489. $is_admin = in_array($user_id,$_admins_list);
  490. $statusname = api_get_status_langvars();
  491. $user_is_anonymous = false;
  492. if ($row['7'] == $statusname[ANONYMOUS]) {
  493. $user_is_anonymous =true;
  494. }
  495. if (!$user_is_anonymous) {
  496. $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')">
  497. <img onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" onmouseout="clear_course_list (\'div_'.$user_id.'\')" src="../img/course.gif" title="'.get_lang('Courses').'" alt="'.get_lang('Courses').'"/>
  498. <div class="blackboard_hide" id="div_'.$user_id.'">&nbsp;&nbsp;</div>
  499. </a>&nbsp;&nbsp;';
  500. } else {
  501. $result .= Display::return_icon('course_na.gif',get_lang('Courses')).'&nbsp;&nbsp;';
  502. }
  503. if (api_is_platform_admin()) {
  504. if (!$user_is_anonymous) {
  505. $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;&nbsp;';
  506. } else {
  507. $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).'&nbsp;&nbsp;';
  508. }
  509. }
  510. //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins)
  511. if (api_is_platform_admin() || (api_is_session_admin() && $row['7'] == $statusname[STUDENT])) {
  512. if (!$user_is_anonymous) {
  513. $result .= '<a href="user_list.php?action=login_as&amp;user_id='.$user_id.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon('login_as.gif', get_lang('LoginAs')).'</a>&nbsp;&nbsp;';
  514. } else {
  515. $result .= Display::return_icon('login_as_na.gif', get_lang('LoginAs')).'&nbsp;&nbsp;';
  516. }
  517. } else {
  518. $result .= Display::return_icon('login_as_na.gif', get_lang('LoginAs')).'&nbsp;&nbsp;';
  519. }
  520. if ($row['7'] != $statusname[STUDENT]) {
  521. $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).'&nbsp;&nbsp;';
  522. } else {
  523. $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;&nbsp;';
  524. }
  525. if (api_is_platform_admin()) {
  526. if (!$user_is_anonymous) {
  527. $result .= '<a href="user_edit.php?user_id='.$user_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>&nbsp;&nbsp;';
  528. } else {
  529. $result .= Display::return_icon('edit_na.gif', get_lang('Edit')).'</a>&nbsp;&nbsp;';
  530. }
  531. if ($delete_user_available) {
  532. if ($row[0] != $_user['user_id'] && !$user_is_anonymous) {
  533. // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
  534. $result .= '<a href="user_list.php?action=delete_user&amp;user_id='.$user_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
  535. } else {
  536. $result .= Display::return_icon('delete_na.gif', get_lang('Delete'));
  537. }
  538. }
  539. }
  540. if ($is_admin) {
  541. $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> 22, 'heigth'=> 22));
  542. } else {
  543. $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
  544. }
  545. // actions for assigning sessions, courses or users
  546. if (api_is_session_admin()) {
  547. /*if ($row[0] == api_get_user_id()) {
  548. $result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
  549. }*/
  550. } else {
  551. if ($row['7'] == $statusname[DRH] || UserManager::is_admin($row[0])) {
  552. $result .= '<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.Display::return_icon('add_user_big.gif', get_lang('AssignUsers')).'</a>&nbsp;&nbsp;';
  553. $result .= '<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.Display::return_icon('course_add.gif', get_lang('AssignCourses')).'</a>&nbsp;&nbsp;';
  554. $result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
  555. } else if ($row['7'] == $statusname[SESSIONADMIN]) {
  556. $result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
  557. }
  558. }
  559. return $result;
  560. }
  561. /**
  562. * Build the active-column of the table to lock or unlock a certain user
  563. * lock = the user can no longer use this account
  564. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  565. * @param int $active the current state of the account
  566. * @param int $user_id The user id
  567. * @param string $url_params
  568. * @return string Some HTML-code with the lock/unlock button
  569. */
  570. function active_filter($active, $url_params, $row) {
  571. global $_user;
  572. if ($active=='1') {
  573. $action='Lock';
  574. $image='right';
  575. } elseif ($active=='-1') {
  576. $action='edit';
  577. $image='expired';
  578. } elseif ($active=='0') {
  579. $action='Unlock';
  580. $image='wrong';
  581. }
  582. if ($action=='edit') {
  583. $result = Display::return_icon($image.'.gif', get_lang('AccountExpired'));
  584. } elseif ($row['0']<>$_user['user_id']) {
  585. // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
  586. //$result = '<a href="user_list.php?action='.$action.'&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'</a>';
  587. //$result = '<a href="'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?action=active_user&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">';
  588. $result .=Display::return_icon($image.'.gif', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0'])).'</a>';
  589. //$result .= '<div>';
  590. }
  591. return $result;
  592. }
  593. /**
  594. * Lock or unlock a user
  595. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  596. * @param int $status, do we want to lock the user ($status=lock) or unlock it ($status=unlock)
  597. * @param int $user_id The user id
  598. * @return language variable
  599. */
  600. function lock_unlock_user($status,$user_id)
  601. {
  602. $user_table = Database :: get_main_table(TABLE_MAIN_USER);
  603. if ($status=='lock')
  604. {
  605. $status_db='0';
  606. $return_message=get_lang('UserLocked');
  607. }
  608. if ($status=='unlock')
  609. {
  610. $status_db='1';
  611. $return_message=get_lang('UserUnlocked');
  612. }
  613. if(($status_db=='1' OR $status_db=='0') AND is_numeric($user_id))
  614. {
  615. $sql="UPDATE $user_table SET active='".Database::escape_string($status_db)."' WHERE user_id='".Database::escape_string($user_id)."'";
  616. $result = Database::query($sql);
  617. }
  618. if ($result)
  619. {
  620. return $return_message;
  621. }
  622. }
  623. /**
  624. * Instead of displaying the integer of the status, we give a translation for the status
  625. *
  626. * @param integer $status
  627. * @return string translation
  628. *
  629. * @version march 2008
  630. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  631. */
  632. function status_filter($status)
  633. {
  634. $statusname = api_get_status_langvars();
  635. return $statusname[$status];
  636. }
  637. /**
  638. ==============================================================================
  639. INIT SECTION
  640. ==============================================================================
  641. */
  642. $action = $_GET["action"];
  643. $login_as_user_id = $_GET["user_id"];
  644. // Login as ...
  645. if ($_GET['action'] == "login_as" && isset ($login_as_user_id))
  646. {
  647. login_user($login_as_user_id);
  648. }
  649. //if (isset ($_GET['search']) && $_GET['search'] == 'advanced')
  650. //{}
  651. //else
  652. //{
  653. if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
  654. $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
  655. $interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList'));
  656. $tool_name = get_lang('SearchUsers');
  657. } else {
  658. $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
  659. $tool_name = get_lang('UserList');
  660. }
  661. Display :: display_header($tool_name, "");
  662. //api_display_tool_title($tool_name);
  663. if (isset ($_GET['action'])) {
  664. $check = Security::check_token('get');
  665. if($check) {
  666. switch ($_GET['action']) {
  667. case 'show_message' :
  668. if (!empty($_GET['warn'])) {
  669. // to prevent too long messages
  670. if ($_GET['warn'] == 'session_message'){
  671. $_GET['warn'] = $_SESSION['session_message_import_users'];
  672. }
  673. Display::display_warning_message(urldecode($_GET['warn']),false);
  674. }
  675. if (!empty($_GET['message'])) {
  676. Display :: display_confirmation_message(stripslashes($_GET['message']));
  677. }
  678. break;
  679. case 'delete_user' :
  680. if (api_is_platform_admin()) {
  681. if ($delete_user_available) {
  682. if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) {
  683. Display :: display_confirmation_message(get_lang('UserDeleted'));
  684. } else {
  685. Display :: display_error_message(get_lang('CannotDeleteUserBecauseOwnsCourse'));
  686. }
  687. } else {
  688. Display :: display_error_message(get_lang('CannotDeleteUser'));
  689. }
  690. }
  691. break;
  692. case 'lock' :
  693. $message=lock_unlock_user('lock',$_GET['user_id']);
  694. Display :: display_normal_message($message);
  695. break;
  696. case 'unlock';
  697. $message=lock_unlock_user('unlock',$_GET['user_id']);
  698. Display :: display_normal_message($message);
  699. break;
  700. }
  701. Security::clear_token();
  702. }
  703. }
  704. if (isset ($_POST['action']))
  705. {
  706. $check = Security::check_token('get');
  707. if($check)
  708. {
  709. switch ($_POST['action'])
  710. {
  711. case 'delete' :
  712. if (api_is_platform_admin()) {
  713. $number_of_selected_users = count($_POST['id']);
  714. $number_of_deleted_users = 0;
  715. if (is_array($_POST['id'])) {
  716. foreach ($_POST['id'] as $index => $user_id)
  717. {
  718. if($user_id != $_user['user_id'])
  719. {
  720. if(UserManager :: delete_user($user_id))
  721. {
  722. $number_of_deleted_users++;
  723. }
  724. }
  725. }
  726. }
  727. if($number_of_selected_users == $number_of_deleted_users)
  728. {
  729. Display :: display_confirmation_message(get_lang('SelectedUsersDeleted'));
  730. }
  731. else
  732. {
  733. Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
  734. }
  735. }
  736. break;
  737. }
  738. Security::clear_token();
  739. }
  740. }
  741. // Create a search-box
  742. $form = new FormValidator('search_simple','get','','',null,false);
  743. $renderer =& $form->defaultRenderer();
  744. $renderer->setElementTemplate('<span>{element}</span> ');
  745. $form->addElement('text','keyword',get_lang('keyword'));
  746. $form->addElement('style_submit_button', 'submit',get_lang('Search'),'class="search"');
  747. //$form->addElement('static','search_advanced_link',null,'<a href="user_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>');
  748. $form->addElement('static','search_advanced_link',null,'<a href="javascript://" class = "advanced_parameters" onclick="display_advanced_search_form();"><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>');
  749. echo '<div class="actions" style="width:100%;">';
  750. if (api_is_platform_admin()) {
  751. echo '<span style="float:right; padding-top:7px;">'.
  752. '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'.Display::return_icon('add_user_big.gif',get_lang('AddUsers')).get_lang('AddUsers').'</a>'.
  753. '</span>';
  754. }
  755. $form->display();
  756. echo '</div>';
  757. if (isset ($_GET['keyword'])) {
  758. $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
  759. } elseif (isset ($_GET['keyword_firstname'])) {
  760. $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']);
  761. $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']);
  762. $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']);
  763. $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
  764. $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']);
  765. $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']);
  766. $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']);
  767. }
  768. // Create a sortable table with user-data
  769. $parameters['sec_token'] = Security::get_token();
  770. // get the list of all admins to mark them in the users list
  771. $admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
  772. $sql_admin = "SELECT user_id FROM $admin_table";
  773. $res_admin = Database::query($sql_admin);
  774. $_admins_list = array();
  775. while ($row_admin = Database::fetch_row($res_admin)) {
  776. $_admins_list[] = $row_admin[0];
  777. }
  778. $image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
  779. $user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
  780. if (!api_is_anonymous()) {
  781. $photo = '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>';
  782. } else {
  783. $photo = '<center><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></center>';
  784. }
  785. // display advaced search form
  786. $form = new FormValidator('advanced_search','get');
  787. $form->addElement('html','<div id="advanced_search_form" style="display:none;">');
  788. $form->addElement('header', '', get_lang('AdvancedSearch'));
  789. //$form->addElement('html', '<strong>'.get_lang('SearchAUser').'</strong>');
  790. $form->addElement('html', '<table>');
  791. $form->addElement('html', '<tr><td>');
  792. $form->add_textfield('keyword_firstname',get_lang('FirstName'),false,array('style'=>'margin-left:17px'));
  793. $form->addElement('html', '</td><td width="200px;">');
  794. $form->add_textfield('keyword_lastname',get_lang('LastName'),false,array('style'=>'margin-left:17px'));
  795. $form->addElement('html', '</td></tr>');
  796. $form->addElement('html', '<tr><td>');
  797. $form->add_textfield('keyword_username',get_lang('LoginName'),false,array('style'=>'margin-left:17px'));
  798. $form->addElement('html', '</td>');
  799. $form->addElement('html', '<td>');
  800. $form->add_textfield('keyword_email',get_lang('Email'),false,array('style'=>'margin-left:17px'));
  801. $form->addElement('html', '</td></tr>');
  802. $form->addElement('html', '<tr><td>');
  803. $form->add_textfield('keyword_officialcode',get_lang('OfficialCode'),false,array('style'=>'margin-left:17px'));
  804. $form->addElement('html', '</td><td>');
  805. $status_options = array();
  806. $status_options['%'] = get_lang('All');
  807. $status_options[STUDENT] = get_lang('Student');
  808. $status_options[COURSEMANAGER] = get_lang('Teacher');
  809. $status_options[DRH] = get_lang('Drh');
  810. $status_options[SESSIONADMIN] = get_lang('Administrator');
  811. $form->addElement('select','keyword_status',get_lang('Status'),$status_options, array('style'=>'margin-left:17px'));
  812. $form->addElement('html', '</td></tr>');
  813. $form->addElement('html', '<tr><td>');
  814. $active_group = array();
  815. $active_group[] = $form->createElement('checkbox','keyword_active','',get_lang('Active'), array('style'=>'margin-left:17px'));
  816. $active_group[] = $form->createElement('checkbox','keyword_inactive','',get_lang('Inactive'),array('style'=>'margin-left:17px'));
  817. $form->addGroup($active_group,'',get_lang('ActiveAccount'),'<br/>',false);
  818. $form->addElement('html', '</td><td>');
  819. $extra_data = UserManager::get_extra_user_data($user_id, false, true, false, 1);
  820. $extra_options = array();
  821. if (!empty($extra_data)) {
  822. $extra_options[0] = get_lang('All');
  823. // get information about extra data for adding to input select
  824. foreach ($extra_data as $field_variable => $field_value) {
  825. $extra = UserManager::get_extra_field_information_by_name($field_variable);
  826. $extra_options[$field_variable] = $extra['field_display_text'];
  827. }
  828. $form->addElement('select', 'keyword_extra_data', get_lang('ExtraData'), $extra_options, array('id'=>'input_select_extra_data', 'style'=>'margin-left:17px', 'onchange'=>'if(this.value!=0){document.getElementById(\'extra_data_text\').style.display=\'block\';document.getElementById(\'input_extra_text\').value = "";}else{document.getElementById(\'extra_data_text\').style.display=\'none\';}'));
  829. $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
  830. $form->add_textfield('keyword_extra_data_text', '', false, array('style'=>'margin-left:17px', 'id'=>'input_extra_text'));
  831. $form->addElement('html', '</div>');
  832. } else {
  833. $form->addElement('html', '<div id="extra_data_text" style="display:none;">');
  834. }
  835. $form->addElement('html', '</td></tr>');
  836. $form->addElement('html', '<tr><td>');
  837. $form->addElement('style_submit_button', 'submit',get_lang('SearchUsers'),'class="search"');
  838. $form->addElement('html', '</td></tr>');
  839. $form->addElement('html', '</table>');
  840. $defaults['keyword_active'] = 1;
  841. $defaults['keyword_inactive'] = 1;
  842. $form->setDefaults($defaults);
  843. $form -> addElement('html','</div>');
  844. $form->display();
  845. $table = new SortableTable('users', 'get_number_of_users', 'get_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
  846. $table->set_additional_parameters($parameters);
  847. $table->set_header(0, '', false, 'width="18px"');
  848. $table->set_header(1, get_lang('Photo'), false);
  849. $table->set_header(2, get_lang('OfficialCode'));
  850. if (api_is_western_name_order()) {
  851. $table->set_header(3, get_lang('FirstName'));
  852. $table->set_header(4, get_lang('LastName'));
  853. } else {
  854. $table->set_header(3, get_lang('LastName'));
  855. $table->set_header(4, get_lang('FirstName'));
  856. }
  857. $table->set_header(5, get_lang('LoginName'));
  858. $table->set_header(6, get_lang('Email'));
  859. $table->set_header(7, get_lang('Status'));
  860. $table->set_header(8, get_lang('Active'),true, 'width="15px"');
  861. $table->set_header(9, get_lang('Action'), false,'width="220px"');
  862. $table->set_column_filter(3, 'user_filter');
  863. $table->set_column_filter(4, 'user_filter');
  864. $table->set_column_filter(6, 'email_filter');
  865. $table->set_column_filter(7, 'status_filter');
  866. $table->set_column_filter(8, 'active_filter');
  867. $table->set_column_filter(9, 'modify_filter');
  868. if (api_is_platform_admin())
  869. $table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
  870. $table->display();
  871. //}
  872. /*
  873. ==============================================================================
  874. FOOTER
  875. ==============================================================================
  876. */
  877. Display :: display_footer();
  878. ?>