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

Go to the source code of this file.

Namespaces

namespace  core

Enumerations

enum  NOGROUPS
enum  SEPARATEGROUPS
enum  VISIBLEGROUPS

Functions

 groups_group_exists ($groupid)
 groups_get_group_name ($groupid)
 groups_get_grouping_name ($groupingid)
 groups_get_group_by_name ($courseid, $name)
 groups_get_grouping_by_name ($courseid, $name)
 groups_get_group ($groupid, $fields='*', $strictness=IGNORE_MISSING)
 groups_get_grouping ($groupingid, $fields='*', $strictness=IGNORE_MISSING)
 groups_get_all_groups ($courseid, $userid=0, $groupingid=0, $fields='g.*')
 groups_get_user_groups ($courseid, $userid=0)
 groups_get_all_groupings ($courseid)
 groups_is_member ($groupid, $userid=null)
 groups_has_membership ($cm, $userid=null)
 groups_get_members ($groupid, $fields='u.*', $sort='lastname ASC')
 groups_get_grouping_members ($groupingid, $fields='u.*', $sort='lastname ASC')
 groups_get_course_groupmode ($course)
 groups_get_activity_groupmode ($cm, $course=null)
 groups_print_course_menu ($course, $urlroot, $return=false)
 groups_print_activity_menu ($cm, $urlroot, $return=false, $hideallparticipants=false)
 groups_get_course_group ($course, $update=false, $allowedgroups=null)
 groups_get_activity_group ($cm, $update=false, $allowedgroups=null)
 groups_get_activity_allowed_groups ($cm, $userid=0)
 groups_course_module_visible ($cm, $userid=null)

Enumeration Type Documentation

enum NOGROUPS

Groups not used in course or activity

Definition at line 30 of file grouplib.php.

Groups used, users do not see other groups

Definition at line 35 of file grouplib.php.

Groups used, students see other groups

Definition at line 40 of file grouplib.php.


Function Documentation

groups_course_module_visible ( cm,
userid = null 
)

Determine if a course module is currently visible to a user

$USER If $userid is null, use the global object.

Parameters:
int$cmThe course module
int$useridThe user to check against the group.
Returns:
boolean True if the user can view the course module, false otherwise.

Definition at line 691 of file grouplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_get_activity_allowed_groups ( cm,
userid = 0 
)

Gets a list of groups that the user is allowed to access within the specified activity.

Parameters:
object$cmCourse-module
int$useridUser ID (defaults to current user)
Returns:
array An array of group objects, or false if none

Definition at line 661 of file grouplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_get_activity_group ( cm,
update = false,
allowedgroups = null 
)

Returns group active in activity, changes the group by default if 'group' page param present

Parameters:
stdClass$cmcourse module object
boolean$updatechange active group if group param submitted
array$allowedgroupslist of groups user may access (INTERNAL, to be used only from groups_print_activity_menu())
Returns:
mixed false if groups not used, int if groups used, 0 means all groups (access must be verified in SEPARATE mode)

Definition at line 610 of file grouplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_get_activity_groupmode ( cm,
course = null 
)

Returns effective groupmode used in activity, course setting overrides activity setting if groupmodeforce enabled.

object object

Parameters:
object$cmthe course module object. Only the ->course and ->groupmode need to be set.
object$courseobject optional course object to improve perf
Returns:
integer group mode

Definition at line 371 of file grouplib.php.

Here is the call graph for this function:

groups_get_all_groupings ( courseid)

Gets array of all groupings in a specified course.

object object

Parameters:
int$courseidreturn only groupings in this with this courseid
Returns:
array|bool Returns an array of the grouping objects or false if no records or an error occurred.

Definition at line 234 of file grouplib.php.

Here is the caller graph for this function:

groups_get_all_groups ( courseid,
userid = 0,
groupingid = 0,
fields = 'g.*' 
)

Gets array of all groups in a specified course.

Parameters:
int$courseidThe id of the course.
mixed$useridoptional user id or array of ids, returns only groups of the user.
int$groupingidoptional returns only groups in the specified grouping.
string$fields
Returns:
array Returns an array of the group objects (userid field returned if array in $userid)

Definition at line 146 of file grouplib.php.

Here is the caller graph for this function:

groups_get_course_group ( course,
update = false,
allowedgroups = null 
)

Returns group active in course, changes the group by default if 'group' page param present

Parameters:
stdClass$coursecourse bject
boolean$updatechange active group if group param submitted
array$allowedgroupslist of groups user may access (INTERNAL, to be used only from groups_print_course_menu())
Returns:
mixed false if groups not used, int if groups used, 0 means all groups (access must be verified in SEPARATE mode)

Definition at line 559 of file grouplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns effective groupmode used in course

Returns:
integer group mode

Definition at line 357 of file grouplib.php.

Here is the caller graph for this function:

groups_get_group ( groupid,
fields = '*',
strictness = IGNORE_MISSING 
)

Get the group object

Parameters:
int$groupidID of the group.
Returns:
object group object

Definition at line 120 of file grouplib.php.

Here is the caller graph for this function:

groups_get_group_by_name ( courseid,
name 
)

Returns the groupid of a group with the name specified for the course. Group names should be unique in course

object

Parameters:
int$courseidThe id of the course
string$namename of group (without magic quotes)
Returns:
int $groupid

Definition at line 89 of file grouplib.php.

Here is the caller graph for this function:

groups_get_group_name ( groupid)

Gets the name of a group with a specified id

object

Parameters:
int$groupidThe id of the group
Returns:
string The name of the group

Definition at line 63 of file grouplib.php.

Here is the caller graph for this function:

groups_get_grouping ( groupingid,
fields = '*',
strictness = IGNORE_MISSING 
)

Get the grouping object

Parameters:
int$groupingidID of the group.
string$fields
Returns:
object group object

Definition at line 132 of file grouplib.php.

Here is the caller graph for this function:

groups_get_grouping_by_name ( courseid,
name 
)

Returns the groupingid of a grouping with the name specified for the course. Grouping names should be unique in course

object

Parameters:
int$courseidThe id of the course
string$namename of group (without magic quotes)
Returns:
int $groupid

Definition at line 106 of file grouplib.php.

Here is the caller graph for this function:

groups_get_grouping_members ( groupingid,
fields = 'u.*',
sort = 'lastname ASC' 
)

Returns the users in the specified grouping.

object

Parameters:
int$groupingidThe groupingid to get the users for
int$fieldsThe fields to return
int$sortoptional sorting of returned users
Returns:
array|bool Returns an array of the users for the specified group or false if no users or an error returned.

Definition at line 341 of file grouplib.php.

Here is the caller graph for this function:

groups_get_grouping_name ( groupingid)

Gets the name of a grouping with a specified id

object

Parameters:
int$groupingidThe id of the grouping
Returns:
string The name of the grouping

Definition at line 75 of file grouplib.php.

groups_get_members ( groupid,
fields = 'u.*',
sort = 'lastname ASC' 
)

Returns the users in the specified group.

object

Parameters:
int$groupidThe groupid to get the users for
int$fieldsThe fields to return
int$sortoptional sorting of returned users
Returns:
array|bool Returns an array of the users for the specified group or false if no users or an error returned.

Definition at line 321 of file grouplib.php.

Here is the caller graph for this function:

groups_get_user_groups ( courseid,
userid = 0 
)

Returns info about user's groups in course.

Parameters:
int$courseid
int$userid$USER if not specified
Returns:
array Array[groupingid][groupid] including grouping id 0 which means all groups

Definition at line 184 of file grouplib.php.

Here is the caller graph for this function:

groups_group_exists ( groupid)

Determines if a group with a given groupid exists.

object

Parameters:
int$groupidThe groupid to check for
Returns:
boolean True if the group exists, false otherwise or if an error occurred.

Definition at line 51 of file grouplib.php.

Here is the caller graph for this function:

groups_has_membership ( cm,
userid = null 
)

Determines if current or specified is member of any active group in activity

object object object array $cache

Parameters:
object$cmcoruse module object
int$useridid of user, null menas $USER->id
Returns:
booelan true if user member of at least one group used in activity

Definition at line 277 of file grouplib.php.

Here is the caller graph for this function:

groups_is_member ( groupid,
userid = null 
)

Determines if the user is a member of the given group.

If $userid is null, use the global object.

object object

Parameters:
int$groupidThe group to check for membership.
int$useridThe user to check against the group.
Returns:
boolean True if the user is a member, false otherwise.

Definition at line 256 of file grouplib.php.

Here is the caller graph for this function:

groups_print_activity_menu ( cm,
urlroot,
return = false,
hideallparticipants = false 
)

Print group menu selector for activity.

Parameters:
stdClass$cmcourse module object
string | moodle_url$urlrootreturn address that users get to if they choose an option; should include any parameters needed, e.g. "$CFG->wwwroot/mod/forum/view.php?id=34"
boolean$returnreturn as string instead of printing
boolean$hideallparticipantsIf true, this prevents the 'All participants' option from appearing in cases where it normally would. This is intended for use only by activities that cannot display all groups together. (Note that selecting this option does not prevent groups_get_activity_group from returning 0; it will still do that if the user has chosen 'all participants' in another activity, or not chosen anything.)
Returns:
mixed void or string depending on $return param

Definition at line 474 of file grouplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

groups_print_course_menu ( course,
urlroot,
return = false 
)

Print group menu selector for course level.

Parameters:
stdClass$coursecourse object
string | moodle_url$urlrootreturn address
boolean$returnreturn as string instead of printing
Returns:
mixed void or string depending on $return param

Definition at line 396 of file grouplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations