group_space.php 20 KB

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