root/devel/mod/groups/lib/get_groups.php

Revision 1539, 1.3 kB (checked in by renato, 1 year ago)

Setting prop svn:eol-style in LOTS of files.

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 <?php
2
3 global $CFG;
4
5 // Gets all the groups owned by a particular user, as specified in $parameter[0],
6 // and return it in a data structure with the idents of all the users in each group
7
8 $ident = (int) $parameter[0];
9
10 //if (!isset($_SESSION['groups_cache']) || (time() - $_SESSION['groups_cache']->created > 60)) {
11
12 $tempdata = "";
13 $groupslist = array();
14
15 if ($ident) {
16     if ($groups = get_records('groups','owner',$ident)) {
17         foreach($groups as $group) {
18            
19             $tempdata = "";
20            
21             // @unset($data);
22             $tempdata->name = stripslashes($group->name);
23             $tempdata->ident = $group->ident;
24             $tempdata->access = $group->access;
25             $members = get_records_sql("SELECT gm.user_id,
26                                         u.name FROM ".$CFG->prefix."group_membership gm
27                                         JOIN ".$CFG->prefix."users u ON u.ident = gm.user_id
28                                         WHERE gm.group_id = ? ORDER BY u.name", array($tempdata->ident));
29             $tempdata->members = $members;
30            
31             $groupslist[] = $tempdata;
32            
33         }
34     }
35 }
36 $_SESSION['groups_cache']->created = time();
37 $_SESSION['groups_cache']->data = $groupslist;
38
39 //}
40
41 $run_result = $_SESSION['groups_cache']->data;
42
43 ?>
Note: See TracBrowser for help on using the browser.