[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/group/ -> lib.php (summary)

Extra library for groups and groupings.

Author: J.White AT open.ac.uk, Petr Skoda (skodak)
Copyright: © 2006 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 728 lines (23 kb)
Included or required: 6 times
Referenced: 3 times
Includes or requires: 0 files

Defines 20 functions

  groups_add_member()
  groups_remove_member()
  groups_create_group()
  groups_create_grouping()
  groups_update_group()
  groups_update_grouping()
  groups_delete_group()
  groups_delete_grouping()
  groups_delete_group_members()
  groups_delete_groupings_groups()
  groups_delete_groups()
  groups_delete_groupings()
  groups_get_users_not_in_group_by_role()
  groups_get_possible_roles()
  groups_get_potential_members()
  groups_parse_name()
  groups_assign_grouping()
  groups_unassign_grouping()
  groups_get_members_by_role()
  groups_calculate_role_people()

Functions
Functions that are not part of a class:

groups_add_member($groupid, $userid)   X-Ref
Adds a specified user to a group

param: int $userid   The user id
param: int $groupid  The group id
return: boolean True if user added successfully or the user is already a

groups_remove_member($groupid, $userid)   X-Ref
Deletes the link between the specified user and group.

param: int $groupid The group to delete the user from
param: int $userid The user to delete
return: boolean True if deletion was successful, false otherwise

groups_create_group($data, $um=false)   X-Ref
Add a new group

param: object $data group properties (with magic quotes)
param: object $um upload manager with group picture
return: id of group or false if error

groups_create_grouping($data)   X-Ref
Add a new grouping

param: object $data grouping properties (with magic quotes)
return: id of grouping or false if error

groups_update_group($data, $um=false)   X-Ref
Update group

param: object $data group properties (with magic quotes)
param: object $um upload manager with group picture
return: boolean success

groups_update_grouping($data)   X-Ref
Update grouping

param: object $data grouping properties (with magic quotes)
return: boolean success

groups_delete_group($grouporid)   X-Ref
Delete a group best effort, first removing members and links with courses and groupings.
Removes group avatar too.

param: mixed $grouporid The id of group to delete or full group object
return: boolean True if deletion was successful, false otherwise

groups_delete_grouping($groupingorid)   X-Ref
Delete grouping

param: int $groupingid
return: bool success

groups_delete_group_members($courseid, $userid=0, $showfeedback=false)   X-Ref
Remove all users (or one user) from all groups in course

param: int $courseid
param: int $userid 0 means all users
param: bool $showfeedback
return: bool success

groups_delete_groupings_groups($courseid, $showfeedback=false)   X-Ref
Remove all groups from all groupings in course

param: int $courseid
param: bool $showfeedback
return: bool success

groups_delete_groups($courseid, $showfeedback=false)   X-Ref
Delete all groups from course

param: int $courseid
param: bool $showfeedback
return: bool success

groups_delete_groupings($courseid, $showfeedback=false)   X-Ref
Delete all groupings from course

param: int $courseid
param: bool $showfeedback
return: bool success

groups_get_users_not_in_group_by_role($courseid, $groupid, $searchtext='', $sort = 'u.lastname ASC')   X-Ref
Gets the users for a course who are not in a specified group, and returns
them in an array organised by role. For the array format, see
groups_get_members_by_role.

param: int $groupid The id of the group
param: string searchtext similar to searchtext in role assign, search
return: array An array of role id or '*' => information about that role

groups_get_possible_roles($context)   X-Ref
Obtains a list of the possible roles that group members might come from,
on a course. Generally this includes all the roles who would have
course:view on that course, except the doanything roles.

param: object $context Context of course
return: Array of role ID integers, or false if error/none.

groups_get_potential_members($courseid, $roleid = null, $orderby = 'lastname,firstname')   X-Ref
Gets potential group members for grouping

param: int $courseid The id of the course
param: int $roleid The role to select users from
param: string $orderby The colum to sort users by
return: array An array of the users

groups_parse_name($format, $groupnumber)   X-Ref
Parse a group name for characters to replace

param: string $format The format a group name will follow
param: int $groupnumber The number of the group to be used in the parsed format string
return: string the parsed format string

groups_assign_grouping($groupingid, $groupid)   X-Ref
Assigns group into grouping

param: int groupingid
param: int groupid
return: bool success

groups_unassign_grouping($groupingid, $groupid)   X-Ref
Unassigns group grom grouping

param: int groupingid
param: int groupid
return: bool success

groups_get_members_by_role($groupid, $courseid, $fields='u.*', $sort='u.lastname ASC')   X-Ref
Lists users in a group based on their role on the course.
Returns false if there's an error or there are no users in the group.
Otherwise returns an array of role ID => role data, where role data includes:
(role) $id, $shortname, $name
$users: array of objects for each user which include the specified fields
Users who do not have a role are stored in the returned array with key '-'
and pseudo-role details (including a name, 'No role'). Users with multiple
roles, same deal with key '*' and name 'Multiple roles'. You can find out
which roles each has by looking in the $roles array of the user object.

param: int $groupid
param: int $courseid Course ID (should match the group's course)
param: string $fields List of fields from user table prefixed with u, default 'u.*'
param: string $sort SQL ORDER BY clause, default 'u.lastname ASC'
return: array Complex array as described above

groups_calculate_role_people($rs,$context)   X-Ref
Internal function used by groups_get_members_by_role to handle the
results of a database query that includes a list of users and possible
roles on a course.

param: object $rs The record set (may be false)
param: object $context of course
return: array As described in groups_get_members_by_role



Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7