Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/group/lib.php File Reference

Go to the source code of this file.

Namespaces

namespace  groups

Functions

 groups_add_member ($grouporid, $userorid)
 groups_remove_member ($grouporid, $userorid)
 groups_create_group ($data, $editform=false, $editoroptions=false)
 groups_create_grouping ($data, $editoroptions=null)
 groups_update_group_icon ($group, $data, $editform)
 groups_update_group ($data, $editform=false, $editoroptions=false)
 groups_update_grouping ($data, $editoroptions=null)
 groups_delete_group ($grouporid)
 groups_delete_grouping ($groupingorid)
 groups_delete_group_members ($courseid, $userid=0, $showfeedback=false)
 groups_delete_groupings_groups ($courseid, $showfeedback=false)
 groups_delete_groups ($courseid, $showfeedback=false)
 groups_delete_groupings ($courseid, $showfeedback=false)
 groups_get_possible_roles ($context)
 groups_get_potential_members ($courseid, $roleid=null, $cohortid=null, $orderby= 'lastname ASC, firstname ASC')
 groups_parse_name ($format, $groupnumber)
 groups_assign_grouping ($groupingid, $groupid)
 groups_unassign_grouping ($groupingid, $groupid)
 groups_get_members_by_role ($groupid, $courseid, $fields='u.*', $sort='u.lastname ASC', $extrawheretest='', $whereparams=array())
 groups_calculate_role_people ($rs, $context)

Function Documentation

groups_add_member ( grouporid,
userorid 
)

Adds a specified user to a group

Parameters:
mixed$groupidThe group id or group object
mixed$useridThe user id or user object
Returns:
boolean True if user added successfully or the user is already a member of the group, false otherwise.

Definition at line 23 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_assign_grouping ( groupingid,
groupid 
)

Assigns group into grouping

Parameters:
intgroupingid
intgroupid
Returns:
bool true or exception

Definition at line 579 of file lib.php.

groups_calculate_role_people ( rs,
context 
)

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.

Parameters:
object$rsThe record set (may be false)
int$contextidID of course context
Returns:
array As described in groups_get_members_by_role

Definition at line 661 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_create_group ( data,
editform = false,
editoroptions = false 
)

Add a new group

Parameters:
object$datagroup properties
object$umupload manager with group picture
Returns:
id of group or false if error

Definition at line 119 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_create_grouping ( data,
editoroptions = null 
)

Add a new grouping

Parameters:
object$datagrouping properties
Returns:
id of grouping or false if error

Definition at line 164 of file lib.php.

Here is the call graph for this function:

groups_delete_group ( grouporid)

Delete a group best effort, first removing members and links with courses and groupings. Removes group avatar too.

Parameters:
mixed$grouporidThe id of group to delete or full group object
Returns:
boolean True if deletion was successful, false otherwise

Definition at line 281 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_delete_group_members ( courseid,
userid = 0,
showfeedback = false 
)

Remove all users (or one user) from all groups in course

Parameters:
int$courseid
int$userid0 means all users
bool$showfeedback
Returns:
bool success

Definition at line 365 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_delete_grouping ( groupingorid)

Delete grouping

Parameters:
int$groupingorid
Returns:
bool success

Definition at line 322 of file lib.php.

Here is the call graph for this function:

groups_delete_groupings ( courseid,
showfeedback = false 
)

Delete all groupings from course

Parameters:
int$courseid
bool$showfeedback
Returns:
bool success

Definition at line 463 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_delete_groupings_groups ( courseid,
showfeedback = false 
)

Remove all groups from all groupings in course

Parameters:
int$courseid
bool$showfeedback
Returns:
bool success

Definition at line 404 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_delete_groups ( courseid,
showfeedback = false 
)

Delete all groups from course

Parameters:
int$courseid
bool$showfeedback
Returns:
bool success

Definition at line 424 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_get_members_by_role ( groupid,
courseid,
fields = 'u.*',
sort = 'u.lastname ASC',
extrawheretest = '',
whereparams = array() 
)

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.

Parameters:
int$groupid
int$courseidCourse ID (should match the group's course)
string$fieldsList of fields from user table prefixed with u, default 'u.*'
string$sortSQL ORDER BY clause, default 'u.lastname ASC'
string$extrawheretestextra SQL conditions ANDed with the existing where clause.
array$whereparamsany parameters required by $extrawheretest (named parameters).
Returns:
array Complex array as described above

Definition at line 625 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_get_possible_roles ( context)

Obtains a list of the possible roles that group members might come from, on a course. Generally this includes only profile roles.

Parameters:
object$contextContext of course
Returns:
Array of role ID integers, or false if error/none.

Definition at line 503 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_get_potential_members ( courseid,
roleid = null,
cohortid = null,
orderby = 'lastname ASC,
firstname ASC'   
)

Gets potential group members for grouping

Parameters:
int$courseidThe id of the course
int$roleidThe role to select users from
int$cohortidrestrict to cohort id
string$orderbyThe column to sort users by
Returns:
array An array of the users

Definition at line 517 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_parse_name ( format,
groupnumber 
)

Parse a group name for characters to replace

Parameters:
string$formatThe format a group name will follow
int$groupnumberThe number of the group to be used in the parsed format string
Returns:
string the parsed format string

Definition at line 560 of file lib.php.

Here is the caller graph for this function:

groups_remove_member ( grouporid,
userorid 
)

Deletes the link between the specified user and group.

Parameters:
mixed$groupidThe group id or group object
mixed$useridThe user id or user object
Returns:
boolean True if deletion was successful, false otherwise

Definition at line 76 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_unassign_grouping ( groupingid,
groupid 
)

Unassigns group grom grouping

Parameters:
intgroupingid
intgroupid
Returns:
bool success

Definition at line 600 of file lib.php.

groups_update_group ( data,
editform = false,
editoroptions = false 
)

Update group

Parameters:
object$datagroup properties (with magic quotes)
object$editform
array$editoroptions
Returns:
boolean true or exception

Definition at line 229 of file lib.php.

Here is the call graph for this function:

groups_update_group_icon ( group,
data,
editform 
)

Update the group icon from form data

Parameters:
$group
$data
$editform

Definition at line 200 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_update_grouping ( data,
editoroptions = null 
)

Update grouping

Parameters:
object$datagrouping properties (with magic quotes)
Returns:
boolean true or exception

Definition at line 261 of file lib.php.

Here is the call graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations