group_space.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <?php //$Id: group_space.php 21933 2009-07-09 06:08:22Z ivantcholakov $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  9. Copyright (c) Bart Mollet
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * This script shows the group space for one specific group, possibly displaying
  23. * a list of users in the group, subscribe or unsubscribe option, tutors...
  24. *
  25. * @package dokeos.group
  26. * @todo Display error message if no group ID specified
  27. ==============================================================================
  28. */
  29. /*
  30. ==============================================================================
  31. INIT SECTION
  32. ==============================================================================
  33. */
  34. // name of the language file that needs to be included
  35. $language_file = "group";
  36. require_once '../inc/global.inc.php';
  37. /*
  38. -----------------------------------------------------------
  39. Libraries & config files
  40. -----------------------------------------------------------
  41. */
  42. require_once api_get_path(LIBRARY_PATH).'course.lib.php';
  43. require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
  44. require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
  45. require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
  46. require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php';
  47. /*
  48. ==============================================================================
  49. MAIN CODE
  50. ==============================================================================
  51. */
  52. $current_group = GroupManager :: get_group_properties($_SESSION['_gid']);
  53. if (!is_array($current_group) ) {
  54. //display some error message
  55. }
  56. $this_section=SECTION_COURSES;
  57. $nameTools = get_lang("GroupSpace");
  58. $interbreadcrumb[] = array ("url" => "group.php", "name" => get_lang("Groups"));
  59. /*
  60. -----------------------------------------------------------
  61. Ensure all private groups // Juan Carlos Ra�a Trabado
  62. -----------------------------------------------------------
  63. */
  64. $forums_of_groups = get_forums_of_group($current_group['id']);
  65. $forum_state_public=0;
  66. if (is_array($forums_of_groups)) {
  67. foreach ($forums_of_groups as $key => $value) {
  68. if($value['forum_group_public_private'] == 'public') {
  69. $forum_state_public=1;
  70. }
  71. }
  72. }
  73. if ($current_group['doc_state']!=1 and $current_group['calendar_state']!=1 and $current_group['work_state']!=1 and $current_group['announcements_state']!=1 and $current_group['wiki_state']!=1 and $current_group['chat_state']!=1 and $forum_state_public!=1) {
  74. if (!api_is_allowed_to_edit(null,true) and !GroupManager :: is_user_in_group($_user['user_id'], $current_group['id'])) {
  75. echo api_not_allowed($print_headers);
  76. }
  77. }
  78. /*
  79. -----------------------------------------------------------
  80. Header
  81. -----------------------------------------------------------
  82. */
  83. Display::display_header($nameTools.' '.stripslashes($current_group['name']),"Group");
  84. /*
  85. -----------------------------------------------------------
  86. Introduction section
  87. (editable by course admin)
  88. -----------------------------------------------------------
  89. */
  90. Display::display_introduction_section(group_space_.$_SESSION['_gid']);
  91. /*
  92. -----------------------------------------------------------
  93. Actions and Action links
  94. -----------------------------------------------------------
  95. */
  96. /*
  97. * User wants to register in this group
  98. */
  99. if (!empty($_GET['selfReg']) && GroupManager :: is_self_registration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) {
  100. GroupManager :: subscribe_users($_SESSION['_user']['user_id'], $current_group['id']);
  101. Display :: display_normal_message(get_lang('GroupNowMember'));
  102. }
  103. /*
  104. * User wants to unregister from this group
  105. */
  106. if (!empty($_GET['selfUnReg']) && GroupManager :: is_self_unregistration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) {
  107. GroupManager :: unsubscribe_users($_SESSION['_user']['user_id'], $current_group['id']);
  108. Display::display_normal_message(get_lang('StudentDeletesHimself'));
  109. }
  110. echo '<div class="actions">';
  111. echo '<a href="group.php">'.Display::return_icon('back.png',get_lang('BackToGroupList')).get_lang('BackToGroupList').'</a>';
  112. /*
  113. * Edit the group
  114. */
  115. if (api_is_allowed_to_edit(false,true) or GroupManager :: is_tutor($_user['user_id'])) {
  116. isset($origin)?$my_origin = $origin:$my_origin='';
  117. echo Display::return_icon('edit.gif', get_lang("EditGroup"))."<a href=\"group_edit.php?origin=$my_origin\">".get_lang("EditGroup")."</a>";
  118. }
  119. /*
  120. * Register to group
  121. */
  122. if (GroupManager :: is_self_registration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) {
  123. echo '<a href="'.api_get_self().'?selfReg=1&amp;group_id='.$current_group['id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('groupadd.gif').get_lang("RegIntoGroup").'</a>';
  124. }
  125. /*
  126. * Unregister from group
  127. */
  128. if (GroupManager :: is_self_unregistration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) {
  129. echo '<a href="'.api_get_self().'?selfUnReg=1" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('group_delete.gif').get_lang("StudentUnsubscribe").'</a>';
  130. }
  131. echo '&nbsp;</div>';
  132. if( isset($_GET['action'])) {
  133. switch( $_GET['action']) {
  134. case 'show_msg':
  135. Display::display_normal_message(Security::remove_XSS($_GET['msg']));
  136. break;
  137. }
  138. }
  139. /*
  140. -----------------------------------------------------------
  141. Main Display Area
  142. -----------------------------------------------------------
  143. */
  144. $course_code = $_course['sysCode'];
  145. $is_course_member = CourseManager :: is_user_subscribed_in_real_or_linked_course($_SESSION['_user']['user_id'], $course_code);
  146. /*
  147. * Group title and comment
  148. */
  149. //api_display_tool_title($nameTools.' '.stripslashes($current_group['name']));
  150. if (!empty($current_group['description'])) {
  151. echo '<blockquote>'.stripslashes($current_group['description']).'</blockquote>';
  152. }
  153. /*
  154. * Group Tools
  155. */
  156. // If the user is subscribed to the group or the user is a tutor of the group then
  157. if (api_is_allowed_to_edit(false,true) OR GroupManager :: is_user_in_group($_SESSION['_user']['user_id'], $current_group['id'])) {
  158. $tools = '';
  159. // link to the forum of this group
  160. $forums_of_groups = get_forums_of_group($current_group['id']);
  161. if (is_array($forums_of_groups)) {
  162. if ( $current_group['forum_state'] != TOOL_NOT_AVAILABLE ) {
  163. foreach ($forums_of_groups as $key => $value) {
  164. 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)) {
  165. $tools.= Display::return_icon('forum.gif', get_lang("GroupForum")) . ' <a href="../forum/viewforum.php?forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'">'.get_lang("Forum").': '.$value['forum_title'].'</a><br />';
  166. //$tools.= Display::return_icon('forum.gif', get_lang("Forum")) . ' <a href="../forum/viewforum.php?forum='.$value['forum_id'].'">'.get_lang("Forum").': '.$value['forum_title'].'</a><br />';
  167. }
  168. }
  169. }
  170. }
  171. if( $current_group['doc_state'] != TOOL_NOT_AVAILABLE )
  172. {
  173. // link to the documents area of this group
  174. $tools .= "<div style='margin-bottom: 5px;'><a href=\"../document/document.php?".api_get_cidreq()."&amp;gidReq=".$current_group['id']."\">".Display::return_icon('folder_document.gif', get_lang("GroupDocument"))."&nbsp;".get_lang("GroupDocument")."</a></div>";
  175. }
  176. if ( $current_group['calendar_state'] != TOOL_NOT_AVAILABLE)
  177. {
  178. //link to a group-specific part of agenda
  179. $tools .= "<div style='margin-bottom: 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.gif', get_lang("GroupCalendar"))."&nbsp;".get_lang("GroupCalendar")."</a></div>";
  180. }
  181. if ( $current_group['work_state'] != TOOL_NOT_AVAILABLE)
  182. {
  183. //link to the works area of this group
  184. $tools .= "<div style='margin-bottom: 5px;'><a href=\"../work/work.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('works.gif', get_lang("GroupWork"))."&nbsp;".get_lang("GroupWork")."</a></div>";
  185. }
  186. if ( $current_group['announcements_state'] != TOOL_NOT_AVAILABLE)
  187. {
  188. //link to a group-specific part of announcements
  189. $tools .= "<div style='margin-bottom: 5px;'><a href=\"../announcements/announcements.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('valves.gif', get_lang("GroupAnnouncements"))."&nbsp;".get_lang("GroupAnnouncements")."</a></div>";
  190. }
  191. if ( $current_group['wiki_state'] != TOOL_NOT_AVAILABLE)
  192. {
  193. //link to the wiki area of this group
  194. $tools .= "<div style='margin-bottom: 5px;'><a href=\"../wiki/index.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('wiki.gif', get_lang("GroupWiki"))."&nbsp;".get_lang("GroupWiki")."</a></div>";
  195. }
  196. if ( $current_group['chat_state'] != TOOL_NOT_AVAILABLE)
  197. {
  198. //link to the chat area of this group
  199. if(api_get_course_setting('allow_open_chat_window')==true)
  200. {
  201. $tools .= "<div style='margin-bottom: 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.gif', get_lang("Chat"))."&nbsp;".get_lang("Chat")."</a></div>";
  202. }
  203. else
  204. {
  205. $tools .= "<div style='margin-bottom: 5px;'><a href=\"../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('chat.gif', get_lang("Chat"))."&nbsp;".get_lang("Chat")."</a></div>";
  206. }
  207. }
  208. echo '<div class="actions-message" style="margin-bottom:4px;"><b>'.get_lang("Tools").':</b></div>';
  209. if (!empty($tools))
  210. {
  211. echo '<div style="margin-left:5px;">'.$tools.'</div>';
  212. }
  213. } else {
  214. $tools = '';
  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'] == TOOL_PUBLIC ) {
  219. foreach ($forums_of_groups as $key => $value) {
  220. if ($value['forum_group_public_private'] == 'public' ) {
  221. $tools.= Display::return_icon('forum.gif', get_lang("GroupForum")) . ' <a href="../forum/viewforum.php?forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'">'.$value['forum_title'].'</a><br />';
  222. //$tools.= Display::return_icon('forum.gif', get_lang("Forum")) . ' <a href="../forum/viewforum.php?forum='.$value['forum_id'].'">'.get_lang("Forum").': '.$value['forum_title'].'</a><br />';
  223. }
  224. }
  225. }
  226. }
  227. if( $current_group['doc_state'] == TOOL_PUBLIC )
  228. {
  229. // link to the documents area of this group
  230. $tools .= "<a href=\"../document/document.php?".api_get_cidreq()."&amp;gidReq=".$current_group['id']."&amp;origin=$origin\">".Display::return_icon('folder_document.gif', get_lang("GroupDocument"))."&nbsp;".get_lang("GroupDocument")."</a><br/>";
  231. }
  232. if ( $current_group['calendar_state'] == TOOL_PUBLIC )
  233. {
  234. //link to a group-specific part of agenda
  235. $tools .= "<a href=\"../calendar/agenda.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."&amp;group=".$current_group['id']."\">".Display::return_icon('agenda.gif', get_lang("GroupCalendar"))."&nbsp;".get_lang("GroupCalendar")."</a><br/>";
  236. }
  237. if ( $current_group['work_state'] == TOOL_PUBLIC )
  238. {
  239. //link to the works area of this group
  240. $tools .= "<a href=\"../work/work.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('works.gif', get_lang("GroupWork"))."&nbsp;".get_lang("GroupWork")."</a><br/>";
  241. }
  242. if ( $current_group['announcements_state'] == TOOL_PUBLIC)
  243. {
  244. //link to a group-specific part of announcements
  245. $tools .= "<a href=\"../announcements/announcements.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."&amp;group=".$current_group['id']."\">".Display::return_icon('valves.gif', get_lang("GroupAnnouncements"))."&nbsp;".get_lang("GroupAnnouncements")."</a><br/>";
  246. }
  247. if ( $current_group['wiki_state'] == TOOL_PUBLIC )
  248. {
  249. //link to the wiki area of this group
  250. $tools .= "<a href=\"../wiki/index.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('wiki.gif', get_lang('GroupWiki'))."&nbsp;".get_lang('GroupWiki')."</a><br/>";
  251. }
  252. if ( $current_group['chat_state'] == TOOL_PUBLIC )
  253. {
  254. //link to the chat area of this group
  255. if(api_get_course_setting('allow_open_chat_window')==true)
  256. {
  257. $tools .= "<div style='margin-bottom: 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.gif', get_lang("Chat"))."&nbsp;".get_lang("Chat")."</a></div>";
  258. }
  259. else
  260. {
  261. $tools .= "<div style='margin-bottom: 5px;'><a href=\"../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."\">".Display::return_icon('chat.gif', get_lang("Chat"))."&nbsp;".get_lang("Chat")."</a></div>";
  262. }
  263. }
  264. echo '<br/>';
  265. echo '<div class="actions-message" style="margin-bottom:4px;"><b>'.get_lang("Tools").':</b></div>';
  266. if (!empty($tools)) {
  267. echo '<div style="margin-left:5px;">'.$tools.'</div>';
  268. }
  269. }
  270. /*
  271. * list all the tutors of the current group
  272. */
  273. $tutors = GroupManager::get_subscribed_tutors($current_group['id']);
  274. $tutor_info = '';
  275. if (count($tutors) == 0)
  276. {
  277. $tutor_info = get_lang("GroupNoneMasc");
  278. }
  279. else
  280. {
  281. isset($origin)?$my_origin = $origin:$my_origin='';
  282. foreach($tutors as $index => $tutor)
  283. {
  284. $image_path = UserManager::get_user_picture_path_by_id($tutor['user_id'],'web',false, true);
  285. $image_repository = $image_path['dir'];
  286. $existing_image = $image_path['file'];
  287. $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']).'" />';
  288. $tutor_info .= "<div style='margin-bottom: 5px;'><a href='../user/userInfo.php?origin=".$my_origin."&amp;uInfo=".$tutor['user_id']."'>".$photo."&nbsp;".api_get_person_name($tutor['firstname'], $tutor['lastname'])."</a></div>";
  289. }
  290. }
  291. echo '<div class="actions-message" style="margin-bottom:4px;"><b>'.get_lang("GroupTutors").':</b></div>';
  292. if (!empty($tutor_info)) {
  293. echo '<div style="margin-left:5px;">'.$tutor_info.'</div>';
  294. }
  295. echo '<br/>';
  296. /*
  297. * list all the members of the current group
  298. */
  299. echo '<b>'.get_lang("GroupMembers").':</b>';
  300. $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);
  301. $my_cidreq=isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : '';
  302. $my_origin=isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
  303. $my_gidreq=isset($_GET['gidReq']) ? Security::remove_XSS($_GET['gidReq']) : '';
  304. $parameters = array('cidReq' => $my_cidreq, 'origin'=> $my_origin, 'gidReq' => $my_gidreq);
  305. $table->set_additional_parameters($parameters);
  306. $table->set_header(0, '');
  307. if (api_is_western_name_order()) {
  308. $table->set_header(1, get_lang('FirstName'));
  309. $table->set_header(2, get_lang('LastName'));
  310. } else {
  311. $table->set_header(1, get_lang('LastName'));
  312. $table->set_header(2, get_lang('FirstName'));
  313. }
  314. if (api_get_setting("show_email_addresses") == "true")
  315. {
  316. $table->set_header(3, get_lang('Email'));
  317. $table->set_column_filter(3, 'email_filter');
  318. }
  319. else
  320. {
  321. if (api_is_allowed_to_edit()=="true")
  322. {
  323. $table->set_header(3, get_lang('Email'));
  324. $table->set_column_filter(3, 'email_filter');
  325. }
  326. }
  327. $table->set_column_filter(0, 'user_icon_filter');
  328. $table->display();
  329. /**
  330. * Get the number of subscribed users to the group
  331. *
  332. * @return integer
  333. *
  334. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  335. * @version April 2008
  336. */
  337. function get_number_of_group_users()
  338. {
  339. global $current_group;
  340. // Database table definition
  341. $table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
  342. // query
  343. $sql = "SELECT count(id) AS number_of_users
  344. FROM ".$table_group_user."
  345. WHERE group_id='".Database::escape_string($current_group['id'])."'";
  346. $result = Database::query($sql,__FILE__,__LINE__);
  347. $return = Database::fetch_array($result,'ASSOC');
  348. return $return['number_of_users'];
  349. }
  350. /**
  351. * Get the details of the users in a group
  352. *
  353. * @param integer $from starting row
  354. * @param integer $number_of_items number of items to be displayed
  355. * @param integer $column sorting colum
  356. * @param integer $direction sorting direction
  357. * @return array
  358. *
  359. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  360. * @version April 2008
  361. */
  362. function get_group_user_data($from, $number_of_items, $column, $direction)
  363. {
  364. global $current_group;
  365. // Database table definition
  366. $table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
  367. $table_user = Database :: get_main_table(TABLE_MAIN_USER);
  368. // query
  369. if (api_get_setting("show_email_addresses") == "true") {
  370. $sql = "SELECT
  371. user.user_id AS col0,
  372. ".(api_is_western_name_order() ?
  373. "user.firstname AS col1,
  374. user.lastname AS col2,"
  375. :
  376. "user.lastname AS col1,
  377. user.firstname AS col2,"
  378. )."
  379. user.email AS col3
  380. FROM ".$table_user." user, ".$table_group_user." group_rel_user
  381. WHERE group_rel_user.user_id = user.user_id
  382. AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
  383. $sql .= " ORDER BY col$column $direction ";
  384. $sql .= " LIMIT $from,$number_of_items";
  385. }
  386. else
  387. {
  388. if (api_is_allowed_to_edit()=="true")
  389. {
  390. $sql = "SELECT
  391. user.user_id AS col0,
  392. ".(api_is_western_name_order() ?
  393. "user.firstname AS col1,
  394. user.lastname AS col2,"
  395. :
  396. "user.lastname AS col1,
  397. user.firstname AS col2,"
  398. )."
  399. user.email AS col3
  400. FROM ".$table_user." user, ".$table_group_user." group_rel_user
  401. WHERE group_rel_user.user_id = user.user_id
  402. AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
  403. $sql .= " ORDER BY col$column $direction ";
  404. $sql .= " LIMIT $from,$number_of_items";
  405. }
  406. else
  407. {
  408. $sql = "SELECT
  409. user.user_id AS col0,
  410. ". (api_is_western_name_order() ?
  411. "user.firstname AS col1,
  412. user.lastname AS col2 "
  413. :
  414. "user.lastname AS col1,
  415. user.firstname AS col2 "
  416. )."
  417. FROM ".$table_user." user, ".$table_group_user." group_rel_user
  418. WHERE group_rel_user.user_id = user.user_id
  419. AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
  420. $sql .= " ORDER BY col$column $direction ";
  421. $sql .= " LIMIT $from,$number_of_items";
  422. }
  423. }
  424. $return = array ();
  425. $result = Database::query($sql,__FILE__,__LINE__);
  426. while ($row = Database::fetch_row($result))
  427. {
  428. $return[] = $row;
  429. }
  430. return $return;
  431. }
  432. /**
  433. * Returns a mailto-link
  434. * @param string $email An email-address
  435. * @return string HTML-code with a mailto-link
  436. */
  437. function email_filter($email)
  438. {
  439. return Display :: encrypted_mailto_link($email, $email);
  440. }
  441. /**
  442. * Display a user icon that links to the user page
  443. *
  444. * @param integer $user_id the id of the user
  445. * @return html code
  446. *
  447. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
  448. * @version April 2008
  449. */
  450. function user_icon_filter($user_id)
  451. {
  452. global $origin;
  453. $userinfo=Database::get_user_info_from_id($user_id);
  454. $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true);
  455. $image_repository = $image_path['dir'];
  456. $existing_image = $image_path['file'];
  457. $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>';
  458. return "<a href='../user/userInfo.php?origin=".$origin."&amp;uInfo=".$user_id."'>".$photo;
  459. }
  460. // footer
  461. isset($origin)?$orig=$origin:$orig='';
  462. if ($orig != 'learnpath')
  463. {
  464. Display::display_footer();
  465. }
  466. ?>