group_space.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script shows the group space for one specific group, possibly displaying
  5. * a list of users in the group, subscribe or unsubscribe option, tutors...
  6. *
  7. * @package chamilo.group
  8. * @todo Display error message if no group ID specified
  9. */
  10. // Name of the language file that needs to be included
  11. $language_file = 'group';
  12. require_once '../inc/global.inc.php';
  13. $current_course_tool = TOOL_GROUP;
  14. // Notice for unauthorized people.
  15. api_protect_course_script(true);
  16. /* Libraries & config files */
  17. require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
  18. require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php';
  19. /* MAIN CODE */
  20. $group_id = api_get_group_id();
  21. $user_id = api_get_user_id();
  22. $current_group = GroupManager::get_group_properties($group_id);
  23. if (empty($current_group)) {
  24. api_not_allowed(true);
  25. }
  26. $this_section = SECTION_COURSES;
  27. $nameTools = get_lang('GroupSpace');
  28. $interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups'));
  29. /* Ensure all private groups // Juan Carlos Raña Trabado */
  30. $forums_of_groups = get_forums_of_group($current_group['id']);
  31. /*$forum_state_public = 0;
  32. if (is_array($forums_of_groups)) {
  33. foreach ($forums_of_groups as $key => $value) {
  34. if ($value['forum_group_public_private'] == 'public') {
  35. $forum_state_public = 1;
  36. }
  37. }
  38. }
  39. if ($current_group['doc_state'] != 1 &&
  40. $current_group['calendar_state'] != 1 &&
  41. $current_group['work_state'] != 1 &&
  42. $current_group['announcements_state'] != 1 &&
  43. $current_group['wiki_state'] != 1 &&
  44. $current_group['chat_state'] != 1 &&
  45. $forum_state_public != 1
  46. ) {
  47. }*/
  48. if (!api_is_allowed_to_edit(null, true) &&
  49. (!GroupManager::is_user_in_group($user_id, $group_id) ||
  50. $current_group['status'] == 0
  51. )
  52. ) {
  53. api_not_allowed(true);
  54. }
  55. /* Header */
  56. Display::display_header($nameTools.' '.Security::remove_XSS($current_group['name']), 'Group');
  57. /* Introduction section (editable by course admin) */
  58. Display::display_introduction_section(TOOL_GROUP);
  59. /* Actions and Action links */
  60. /*
  61. * User wants to register in this group
  62. */
  63. if (!empty($_GET['selfReg']) &&
  64. GroupManager :: is_self_registration_allowed($user_id, $current_group['id'])
  65. ) {
  66. GroupManager :: subscribe_users($user_id, $current_group['id']);
  67. Display :: display_normal_message(get_lang('GroupNowMember'));
  68. }
  69. /*
  70. * User wants to unregister from this group
  71. */
  72. if (!empty($_GET['selfUnReg']) &&
  73. GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])
  74. ) {
  75. GroupManager :: unsubscribe_users($user_id, $current_group['id']);
  76. Display::display_normal_message(get_lang('StudentDeletesHimself'));
  77. }
  78. echo '<div class="actions">';
  79. echo '<a href="group.php">'.
  80. Display::return_icon('back.png',get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM).
  81. '</a>';
  82. /*
  83. * Register to group
  84. */
  85. $subscribe_group = '';
  86. if (GroupManager :: is_self_registration_allowed($user_id, $current_group['id'])) {
  87. $subscribe_group = '<a class="btn" href="'.api_get_self().'?selfReg=1&group_id='.$current_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'.
  88. get_lang("RegIntoGroup").'</a>';
  89. }
  90. /*
  91. * Unregister from group
  92. */
  93. $unsubscribe_group = '';
  94. if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) {
  95. $unsubscribe_group = '<a class="btn" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."'".')) return false;">'.
  96. get_lang("StudentUnsubscribe").'</a>';
  97. }
  98. echo '&nbsp;</div>';
  99. if (isset($_GET['action'])) {
  100. switch ($_GET['action']) {
  101. case 'show_msg':
  102. Display::display_normal_message(Security::remove_XSS($_GET['msg']));
  103. break;
  104. }
  105. }
  106. /* Main Display Area */
  107. $course_code = api_get_course_id();
  108. $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course(
  109. api_get_user_id(),
  110. $course_code
  111. );
  112. // Edit the group.
  113. $edit_url = '';
  114. if (api_is_allowed_to_edit(false, true) or
  115. GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())
  116. ) {
  117. $my_origin = isset($origin) ? $origin : '';
  118. $edit_url = '<a href="'.api_get_path(WEB_CODE_PATH).'group/settings.php?cidReq='.api_get_course_id().'&origin='.$my_origin.'&gidReq='.api_get_group_id().'">'.
  119. Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>';
  120. }
  121. echo Display::page_header(
  122. Security::remove_XSS($current_group['name']).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group
  123. );
  124. if (!empty($current_group['description'])) {
  125. echo '<p>'.Security::remove_XSS($current_group['description']).'</p>';
  126. }
  127. /*
  128. * Group Tools
  129. */
  130. // If the user is subscribed to the group or the user is a tutor of the group then
  131. if (api_is_allowed_to_edit(false, true) OR
  132. GroupManager::is_user_in_group(api_get_user_id(), $current_group['id'])
  133. ) {
  134. $actions_array = array();
  135. // Link to the forum of this group
  136. $forums_of_groups = get_forums_of_group($current_group['id']);
  137. if (is_array($forums_of_groups)) {
  138. if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE ) {
  139. foreach ($forums_of_groups as $key => $value) {
  140. //*!empty($user_subscribe_to_current_group) && */
  141. if ($value['forum_group_public_private'] == 'public' ||
  142. ($value['forum_group_public_private'] == 'private') ||
  143. !empty($user_is_tutor) ||
  144. api_is_allowed_to_edit(false, true)
  145. ) {
  146. $actions_array[] = array(
  147. 'url' => '../forum/viewforum.php?forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&origin=group',
  148. 'content' => Display::return_icon('forum.png', get_lang('Forum').': '.$value['forum_title'] , array(), 32)
  149. );
  150. }
  151. }
  152. }
  153. }
  154. if ($current_group['doc_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
  155. // Link to the documents area of this group
  156. $actions_array[] = array(
  157. 'url' => '../document/document.php?'.api_get_cidreq(),
  158. 'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32)
  159. );
  160. }
  161. if ($current_group['calendar_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
  162. $groupFilter = null;
  163. if (!empty($group_id)) {
  164. $groupFilter = "&type=course&user_id=GROUP:$group_id";
  165. }
  166. // Link to a group-specific part of agenda
  167. $actions_array[] = array(
  168. 'url' => '../calendar/agenda_js.php?'.api_get_cidreq().$groupFilter,
  169. 'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32)
  170. );
  171. }
  172. if ($current_group['work_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
  173. // Link to the works area of this group
  174. $actions_array[] = array(
  175. 'url' => '../work/work.php?'.api_get_cidreq(),
  176. 'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), 32)
  177. );
  178. }
  179. if ($current_group['announcements_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
  180. // Link to a group-specific part of announcements
  181. $actions_array[] = array(
  182. 'url' => '../announcements/announcements.php?'.api_get_cidreq(),
  183. 'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32)
  184. );
  185. }
  186. if ($current_group['wiki_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
  187. // Link to the wiki area of this group
  188. $actions_array[] = array(
  189. 'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
  190. 'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
  191. );
  192. }
  193. if ($current_group['chat_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
  194. // Link to the chat area of this group
  195. if (api_get_course_setting('allow_open_chat_window')) {
  196. $actions_array[] = array(
  197. 'url' => "javascript: void(0);",
  198. 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32),
  199. 'url_attributes' => array(
  200. 'onclick' => " window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".api_get_course_id()."_".api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')"
  201. )
  202. );
  203. } else {
  204. $actions_array[] = array(
  205. 'url' => "../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
  206. 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
  207. );
  208. }
  209. }
  210. if (!empty($actions_array)) {
  211. echo Display::actions($actions_array);
  212. }
  213. } else {
  214. $actions_array = array();
  215. // Link to the forum of this group
  216. $forums_of_groups = get_forums_of_group($current_group['id']);
  217. if (is_array($forums_of_groups)) {
  218. if ( $current_group['forum_state'] == GroupManager::TOOL_PUBLIC ) {
  219. foreach ($forums_of_groups as $key => $value) {
  220. if ($value['forum_group_public_private'] == 'public' ) {
  221. $actions_array[] = array(
  222. 'url' => '../forum/viewforum.php?cidReq='.api_get_course_id().'&forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&origin=group',
  223. 'content' => Display::return_icon('forum.png', get_lang('GroupForum'), array(), ICON_SIZE_MEDIUM)
  224. );
  225. }
  226. }
  227. }
  228. }
  229. if ($current_group['doc_state'] == GroupManager::TOOL_PUBLIC) {
  230. // Link to the documents area of this group
  231. $actions_array[] = array(
  232. 'url' => '../document/document.php?'.api_get_cidreq().'&origin='.$origin,
  233. 'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM)
  234. );
  235. }
  236. if ($current_group['calendar_state'] == GroupManager::TOOL_PUBLIC) {
  237. // Link to a group-specific part of agenda
  238. $actions_array[] = array(
  239. 'url' => '../calendar/agenda.php?'.api_get_cidreq(),
  240. 'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), ICON_SIZE_MEDIUM)
  241. );
  242. }
  243. if ($current_group['work_state'] == GroupManager::TOOL_PUBLIC) {
  244. // Link to the works area of this group
  245. $actions_array[] = array(
  246. 'url' => '../work/work.php?'.api_get_cidreq(),
  247. 'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_MEDIUM)
  248. );
  249. }
  250. if ($current_group['announcements_state'] == GroupManager::TOOL_PUBLIC) {
  251. // Link to a group-specific part of announcements
  252. $actions_array[] = array(
  253. 'url' => '../announcements/announcements.php?'.api_get_cidreq(),
  254. 'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_MEDIUM)
  255. );
  256. }
  257. if ($current_group['wiki_state'] == GroupManager::TOOL_PUBLIC) {
  258. // Link to the wiki area of this group
  259. $actions_array[] = array(
  260. 'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
  261. 'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
  262. );
  263. }
  264. if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC ) {
  265. // Link to the chat area of this group
  266. if (api_get_course_setting('allow_open_chat_window')) {
  267. $actions_array[] = array(
  268. 'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
  269. 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
  270. );
  271. } else {
  272. $actions_array[] = array(
  273. 'url' => "../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
  274. 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
  275. );
  276. }
  277. }
  278. if (!empty($actions_array)) {
  279. echo Display::actions($actions_array);
  280. }
  281. }
  282. /*
  283. * List all the tutors of the current group
  284. */
  285. $tutors = GroupManager::get_subscribed_tutors($current_group['id']);
  286. $tutor_info = '';
  287. if (count($tutors) == 0) {
  288. $tutor_info = get_lang('GroupNoneMasc');
  289. } else {
  290. isset($origin) ? $my_origin = $origin:$my_origin='';
  291. $tutor_info .= '<ul class="thumbnails">';
  292. foreach ($tutors as $index => $tutor) {
  293. $tab_user_info = api_get_user_info($tutor['user_id']);
  294. $username = api_htmlentities(sprintf(get_lang('LoginX'), $tab_user_info['username']), ENT_QUOTES);
  295. $image_path = UserManager::get_user_picture_path_by_id($tutor['user_id'], 'web', false, true);
  296. $image_repository = $image_path['dir'];
  297. $existing_image = $image_path['file'];
  298. $completeName = api_get_person_name($tutor['firstname'], $tutor['lastname']);
  299. $photo = '<img src="'.$image_repository.$existing_image.'" alt="'.$completeName.'" width="32" height="32" title="'.$completeName.'" />';
  300. $tutor_info .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'user/userInfo.php?origin='.$my_origin.'&uInfo='.$tutor['user_id'].'">'.
  301. $photo.'&nbsp;'.$completeName.'</a></li>';
  302. }
  303. $tutor_info .= '</ul>';
  304. }
  305. echo Display::page_subheader(get_lang('GroupTutors'));
  306. if (!empty($tutor_info)) {
  307. echo $tutor_info;
  308. }
  309. echo '<br />';
  310. /*
  311. * List all the members of the current group
  312. */
  313. echo Display::page_subheader(get_lang('GroupMembers'));
  314. $table = new SortableTable('group_users', 'get_number_of_group_users', 'get_group_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
  315. $my_cidreq = isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : '';
  316. $my_origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
  317. $my_gidreq = isset($_GET['gidReq']) ? Security::remove_XSS($_GET['gidReq']) : '';
  318. $parameters = array('cidReq' => $my_cidreq, 'origin'=> $my_origin, 'gidReq' => $my_gidreq);
  319. $table->set_additional_parameters($parameters);
  320. $table->set_header(0, '');
  321. if (api_is_western_name_order()) {
  322. $table->set_header(1, get_lang('FirstName'));
  323. $table->set_header(2, get_lang('LastName'));
  324. } else {
  325. $table->set_header(1, get_lang('LastName'));
  326. $table->set_header(2, get_lang('FirstName'));
  327. }
  328. if (api_get_setting('show_email_addresses') == 'true') {
  329. $table->set_header(3, get_lang('Email'));
  330. $table->set_column_filter(3, 'email_filter');
  331. } else {
  332. if (api_is_allowed_to_edit() == 'true') {
  333. $table->set_header(3, get_lang('Email'));
  334. $table->set_column_filter(3, 'email_filter');
  335. }
  336. }
  337. //the order of these calls is important
  338. $table->set_column_filter(1, 'user_name_filter');
  339. $table->set_column_filter(2, 'user_name_filter');
  340. $table->set_column_filter(0, 'user_icon_filter');
  341. $table->display();
  342. /**
  343. * Get the number of subscribed users to the group
  344. *
  345. * @return integer
  346. *
  347. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  348. * @version April 2008
  349. */
  350. function get_number_of_group_users()
  351. {
  352. global $current_group;
  353. $course_id = api_get_course_int_id();
  354. // Database table definition
  355. $table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
  356. // Query
  357. $sql = "SELECT count(id) AS number_of_users
  358. FROM ".$table_group_user."
  359. WHERE c_id = $course_id AND group_id='".Database::escape_string($current_group['id'])."'";
  360. $result = Database::query($sql);
  361. $return = Database::fetch_array($result,'ASSOC');
  362. return $return['number_of_users'];
  363. }
  364. /**
  365. * Get the details of the users in a group
  366. *
  367. * @param integer $from starting row
  368. * @param integer $number_of_items number of items to be displayed
  369. * @param integer $column sorting colum
  370. * @param integer $direction sorting direction
  371. * @return array
  372. *
  373. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  374. * @version April 2008
  375. */
  376. function get_group_user_data($from, $number_of_items, $column, $direction)
  377. {
  378. global $current_group;
  379. // Database table definition
  380. $table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
  381. $table_user = Database :: get_main_table(TABLE_MAIN_USER);
  382. $course_id = api_get_course_int_id();
  383. // Query
  384. if (api_get_setting('show_email_addresses') == 'true') {
  385. $sql = "SELECT user.user_id AS col0,
  386. ".(api_is_western_name_order() ?
  387. "user.firstname AS col1,
  388. user.lastname AS col2,"
  389. :
  390. "user.lastname AS col1,
  391. user.firstname AS col2,"
  392. )."
  393. user.email AS col3
  394. FROM ".$table_user." user, ".$table_group_user." group_rel_user
  395. WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.user_id
  396. AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
  397. $sql .= " ORDER BY col$column $direction ";
  398. $sql .= " LIMIT $from,$number_of_items";
  399. } else {
  400. if (api_is_allowed_to_edit()) {
  401. $sql = "SELECT DISTINCT
  402. u.user_id AS col0,
  403. ".(api_is_western_name_order() ?
  404. "u.firstname AS col1,
  405. u.lastname AS col2,"
  406. :
  407. "u.lastname AS col1,
  408. u.firstname AS col2,"
  409. )."
  410. u.email AS col3
  411. FROM ".$table_user." u INNER JOIN ".$table_group_user." gu ON (gu.user_id = u.user_id) AND gu.c_id = $course_id
  412. WHERE gu.group_id = '".Database::escape_string($current_group['id'])."'";
  413. $sql .= " ORDER BY col$column $direction ";
  414. $sql .= " LIMIT $from,$number_of_items";
  415. } else {
  416. $sql = "SELECT DISTINCT
  417. user.user_id AS col0,
  418. ". (api_is_western_name_order() ?
  419. "user.firstname AS col1,
  420. user.lastname AS col2 "
  421. :
  422. "user.lastname AS col1,
  423. user.firstname AS col2 "
  424. )."
  425. FROM ".$table_user." user, ".$table_group_user." group_rel_user
  426. WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.user_id
  427. AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
  428. $sql .= " ORDER BY col$column $direction ";
  429. $sql .= " LIMIT $from,$number_of_items";
  430. }
  431. }
  432. $return = array();
  433. $result = Database::query($sql);
  434. while ($row = Database::fetch_row($result)) {
  435. $return[] = $row;
  436. }
  437. return $return;
  438. }
  439. /**
  440. * Returns a mailto-link
  441. * @param string $email An email-address
  442. * @return string HTML-code with a mailto-link
  443. */
  444. function email_filter($email)
  445. {
  446. return Display :: encrypted_mailto_link($email, $email);
  447. }
  448. /**
  449. * Display a user icon that links to the user page
  450. *
  451. * @param integer $user_id the id of the user
  452. * @return html code
  453. *
  454. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  455. * @version April 2008
  456. */
  457. function user_icon_filter($user_id)
  458. {
  459. global $origin;
  460. $userinfo = api_get_user_info($user_id);
  461. $image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
  462. $image_repository = $image_path['dir'];
  463. $existing_image = $image_path['file'];
  464. $photo = '<center><img src="'.$image_repository.$existing_image.'" alt="'.$userinfo['complete_name'].'" width="22" height="22" title="'.$userinfo['complete_name'].'" /></center>';
  465. return '<a href="../user/userInfo.php?origin='.$origin.'&uInfo='.$user_id.'">'.$photo;
  466. }
  467. /**
  468. * Return user profile link around the given user name.
  469. *
  470. * The parameters use a trick of the sorteable table, where the first param is
  471. * the original value of the column
  472. * @param string User name (value of the column at the time of calling)
  473. * @param string URL parameters
  474. * @param array Row of the "sortable table" as it is at the time of function call - we extract the user ID from there
  475. * @return string HTML link
  476. */
  477. function user_name_filter($name, $url_params, $row)
  478. {
  479. $tab_user_info = api_get_user_info($row[0]);
  480. $username = api_htmlentities(sprintf(get_lang('LoginX'), $tab_user_info['username']), ENT_QUOTES);
  481. return '<a href="../user/userInfo.php?uInfo='.$row[0].'&'.$url_params.'" title="'.$username.'">'.$name.'</a>';
  482. }
  483. // Footer
  484. $orig = isset($origin) ? $origin : '';
  485. if ($orig != 'learnpath') {
  486. Display::display_footer();
  487. }