dokeos-library
[ class tree: dokeos-library ] [ index: dokeos-library ] [ all elements ]

Class: GroupManager

Source Location: /main/inc/lib/groupmanager.lib.php

Class Overview


This library contains some functions for group-management.


Author(s):

  • Bart Mollet

Methods



Class Details

[line 86]
This library contains some functions for group-management.



Tags:

author:  Bart Mollet
todo:  Add $course_code parameter to all functions. So this GroupManager can be used outside a session.


[ Top ]


Class Methods


method can_user_subscribe [line 883]

bool can_user_subscribe( int $user_id, int $group_id)

Can a user subscribe to a specified group in a course



Tags:

return:  TRUE if given user can be subscribed in given group


Parameters:

int   $user_id  
int   $group_id  

[ Top ]

method can_user_unsubscribe [line 906]

bool can_user_unsubscribe( int $user_id, int $group_id)

Can a user unsubscribe to a specified group in a course



Tags:

return:  TRUE if given user can be unsubscribed from given group
internal:  for now, same as GroupManager::is_subscribed($user_id,$group_id)


Parameters:

int   $user_id  
int   $group_id  

[ Top ]

method create_category [line 542]

void create_category( string $title, string $description, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state, bool $self_registration_allowed, bool $self_unregistration_allowed, $maximum_number_of_students, int $groups_per_user, int $max_number_of_students)

Create group category



Parameters:

string   $title   The title of the new category
string   $description   The description of the new category
bool   $self_registration_allowed  
bool   $self_unregistration_allowed  
int   $max_number_of_students  
int   $groups_per_user  
   $doc_state  
   $work_state  
   $calendar_state  
   $announcements_state  
   $forum_state  
   $maximum_number_of_students  

[ Top ]

method create_class_groups [line 284]

void create_class_groups( int $category_id)

Create a group for every class subscribed to the current course



Parameters:

int   $category_id   The category in which the groups should be created

[ Top ]

method create_group [line 149]

void create_group( string $name, $category_id, int $tutor, int $places)

Create a group



Parameters:

string   $name   The name for this group
int   $tutor   The user-id of the group's tutor
int   $places   How many people can subscribe to the new group
   $category_id  

[ Top ]

method create_groups_from_virtual_courses [line 248]

void create_groups_from_virtual_courses( )

Create groups from all virtual courses in the given course.



[ Top ]

method create_subgroups [line 223]

void create_subgroups( int $group_id, int $number_of_groups)

Create subgroups.

This function creates new groups based on an existing group. It will create the specified number of groups and fill those groups with users from the base group




Parameters:

int   $group_id   The group from which subgroups have to be created.
int   $number_of_groups   The number of groups that have to be created

[ Top ]

method delete_category [line 509]

void delete_category( int $cat_id, [string $course_code = null])

Delete a group category



Parameters:

int   $cat_id   The id of the category to delete
string   $course_code   The code in which the category should be deleted (default = current course)

[ Top ]

method delete_groups [line 314]

integer delete_groups( $group_ids, [string $course_code = null], mixed $groupIdList)

deletes groups and their data.



Tags:

return:  - number of groups deleted.
author:  Christophe Gesche <christophe.gesche@claroline.net>
author:  Hugues Peeters <hugues.peeters@claroline.net>
author:  Bart Mollet


Parameters:

mixed   $groupIdList   - group(s) to delete. It can be a single id (int) or a list of id (array).
string   $course_code   Default is current course
   $group_ids  

[ Top ]

method fill_groups [line 693]

void fill_groups( $group_ids)

Fill the groups with students.

The algorithm takes care to first fill the groups with the least # of users. Analysis There was a problem with the "ALL" setting. When max # of groups is set to all, the value is sometimes NULL and sometimes ALL and in both cased the query does not work as expected. Stupid solution (currently implemented: set ALL to a big number (INFINITE) and things are solved :) Better solution: that's up to you.

Note Throughout Dokeos there is some confusion about "course id" and "course code" The code is e.g. TEST101, but sometimes a variable that is called courseID also contains a course code string. However, there is also a integer course_id that uniquely identifies the course. ywarnier:> Now the course_id has been removed (25/1/2005) The databases are als very inconsistent in this.




Tags:

author:  Chrisptophe Gesche <christophe.geshe@claroline.net>, Hugues Peeters <hugues.peeters@claroline.net> - original version
author:  Roan Embrechts - virtual course support, code cleaning
author:  Bart Mollet - code cleaning, use other GroupManager-functions


Parameters:

   $group_ids  

[ Top ]

method filter_duplicates [line 1271]

void filter_duplicates( $user_array_in $user_array_in, $compare_field, string $compare_field,)

Filter out duplicates in a multidimensional array by comparing field $compare_field.



Parameters:

string   $compare_field,   the field to be compared
$user_array_in   $user_array_in   list of users (must be sorted).
   $compare_field  

[ Top ]

method filter_only_students [line 1304]

void filter_only_students( $user_array_in)

Remove all users that are not students and all users who have tutor status from the list.



Parameters:

   $user_array_in  

[ Top ]

method filter_users_already_in_group [line 1289]

void filter_users_already_in_group( $user_array_in, $group_id)

Filters from the array $user_array_in the users already in the group $group_id.



Parameters:

   $user_array_in  
   $group_id  

[ Top ]

method get_all_tutors [line 1119]

array get_all_tutors( )

Get all tutors for the current course.



Tags:

return:  An array with firstname, lastname and user_id for all tutors in the current course.
deprecated:  this function uses the old tutor implementation


[ Top ]

method get_categories [line 445]

void get_categories( [string $course_code = null])

Get all categories



Parameters:

string   $course_code   The cours (default = current course)

[ Top ]

method get_category [line 468]

void get_category( int $id, [string $course_code = null])

Get a group category



Parameters:

int   $id   The category id
string   $course_code   The course (default = current course)

[ Top ]

method get_category_from_group [line 488]

array get_category_from_group( int $group_id, [string $course_code = null])

Get the category of a given group



Tags:

return:  The category


Parameters:

int   $group_id   The id of the group
string   $course_code   The course in which the group is (default = current course)

[ Top ]

method get_complete_list_of_users_that_can_be_added_to_group [line 1207]

void get_complete_list_of_users_that_can_be_added_to_group( $course_code, $group_id)

Get a combined list of all users of the real course $course_code

and all users in virtual courses linked to this course $course_code Filter user list: remove duplicate users; plus remove users that

  • are already in the current group $group_id;
  • do not have student status in these courses;
  • are not appointed as tutor (group assistent) for this group;
  • have already reached their maximum # of groups in this course.
Originally to get the correct list of users a big SQL statement was used, but this has become more complicated now there is not just one real course but many virtual courses. Still, that could have worked as well.




Tags:

author:  Roan Embrechts
version:  1.1.3


Parameters:

   $course_code  
   $group_id  

[ Top ]

method get_current_max_groups_per_user [line 610]

void get_current_max_groups_per_user( [ $category_id = null], [ $course_code = null])

Returns the number of groups of the user with the greatest number of

subscribtions in the given category




Parameters:

   $category_id  
   $course_code  

[ Top ]

method get_group_ids [line 1165]

void get_group_ids( $course_db, $user_id, string $course_db:, integer $user_id:)

Get all group's from a given course in which a given user is ubscribed



Tags:

author:  Patrick Cool


Parameters:

string   $course_db:   the database of the course you want to retrieve the groups for
integer   $user_id:   the ID of the user you want to know all its group memberships
   $course_db  
   $user_id  

[ Top ]

method get_group_list [line 98]

array get_group_list( [int $category = null], [string $course_code = null])

Get list of groups for current course.



Tags:

return:  An array with all information about the groups.


Parameters:

int   $category   The id of the category from which the groups are requested
string   $course_code   Default is current course

[ Top ]

method get_group_properties [line 370]

array get_group_properties( int $group_id)

Get group properties



Tags:

return:  All properties. Array-keys are name, tutor_id, description, maximum_number_of_students, directory


Parameters:

int   $group_id   The group from which properties are requested.

[ Top ]

method get_number_of_groups [line 429]

int get_number_of_groups( )

Get the total number of groups for the current course.



Tags:

return:  The number of groups for the current course.


[ Top ]

method get_subscribed_tutors [line 946]

array get_subscribed_tutors( int $group_id, [ $id_only = false])



Tags:

return:  An array with information of all users from the given group. (user_id, firstname, lastname, email)
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University Get all subscribed tutors of a group


Parameters:

int   $group_id  
   $id_only  

[ Top ]

method get_subscribed_users [line 917]

array get_subscribed_users( int $group_id)

Get all subscribed users from a group



Tags:

return:  An array with information of all users from the given group. (user_id, firstname, lastname, email)


Parameters:

int   $group_id  

[ Top ]

method get_users [line 657]

void get_users( int $group_id)

Get all users from a given group



Parameters:

int   $group_id   The group

[ Top ]

method get_user_group_name [line 1369]

void get_user_group_name( $user_id)

Get all groups where a specific user is subscribed



Parameters:

   $user_id  

[ Top ]

method is_self_registration_allowed [line 838]

bool is_self_registration_allowed( int $user_id, int $group_id)

Is sef-registration allowed?



Tags:

return:  TRUE if self-registration is allowed in the given group.


Parameters:

int   $user_id  
int   $group_id  

[ Top ]

method is_self_unregistration_allowed [line 854]

bool is_self_unregistration_allowed( int $user_id, int $group_id)

Is sef-unregistration allowed?



Tags:

return:  TRUE if self-unregistration is allowed in the given group.


Parameters:

int   $user_id  
int   $group_id  

[ Top ]

method is_subscribed [line 869]

bool is_subscribed( int $user_id, int $group_id)

Is user subscribed in group?



Tags:

return:  TRUE if given user is subscribed in given group


Parameters:

int   $user_id  
int   $group_id  

[ Top ]

method is_tutor [line 1145]

bool is_tutor( int $user_id)

Is user a tutor in current course



Tags:

return:  TRUE if given user is a tutor in the current course.
deprecated:  this function uses the old tutor implementation


Parameters:

int   $user_id  

[ Top ]

method is_tutor_of_group [line 1070]

boolean is_tutor_of_group( $user_id $user_id, $group_id $group_id)

Is the user a tutor of this group?



Tags:

return:  true/false
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University


Parameters:

$user_id   $user_id   the id of the user
$group_id   $group_id   the id of the group

[ Top ]

method is_user_in_group [line 1096]

boolean is_user_in_group( $user_id $user_id, $group_id $group_id)

Is the user part of this group? This can be a tutor or a normal member

you should use this function if the access to a tool or functionality is restricted to the people who are actually in the group before you had to check if the user was 1. a member of the group OR 2. a tutor of the group. This function combines both




Tags:

return:  true/false
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University


Parameters:

$user_id   $user_id   the id of the user
$group_id   $group_id   the id of the group

[ Top ]

method maximum_number_of_students [line 807]

int maximum_number_of_students( int $group_id)

Maximum number of students in a group



Tags:

return:  Maximum number of students in the given group.


Parameters:

int   $group_id  

[ Top ]

method number_of_students [line 795]

int number_of_students( int $group_id)

Get the number of students in a group.



Tags:

return:  Number of students in the given group.


Parameters:

int   $group_id  

[ Top ]

method set_group_properties [line 405]

bool set_group_properties( int $group_id, string $name, string $description, int $maximum_number_of_students, $doc_state, $work_state, $calendar_state, $announcements_state, bool $self_registration_allowed, bool $self_unregistration_allowed, int $tutor_id)

Set group properties Changes the group's properties.



Tags:

return:  TRUE if properties are successfully changed.


Parameters:

int   $group_id  
string   $name  
string   $description  
int   $tutor_id  
int   $maximum_number_of_students  
bool   $self_registration_allowed  
bool   $self_unregistration_allowed  
   $doc_state  
   $work_state  
   $calendar_state  
   $announcements_state  

[ Top ]

method subscribe_tutors [line 1001]

bool subscribe_tutors( mixed $user_ids, int $group_id)

Subscribe tutor(s) to a specified group in current course



Tags:

return:  TRUE if successfull
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University
see:  subscribe_users. This function is almost an exact copy of that function.


Parameters:

mixed   $user_ids   Can be an array with user-id's or a single user-id
int   $group_id  

[ Top ]

method subscribe_users [line 980]

bool subscribe_users( mixed $user_ids, int $group_id)

Subscribe user(s) to a specified group in current course



Tags:

return:  TRUE if successfull


Parameters:

mixed   $user_ids   Can be an array with user-id's or a single user-id
int   $group_id  

[ Top ]

method swap_category_order [line 633]

void swap_category_order( int $id1, int $id2)

Swaps the display-order of two categories



Parameters:

int   $id1   The id of the first category
int   $id2   The id of the second category

[ Top ]

method unsubscribe_all_tutors [line 1050]

bool unsubscribe_all_tutors( $group_ids, mixed $group_id)

Unsubscribe all tutors from one or more groups



Tags:

return:  TRUE if successfull
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University
see:  unsubscribe_all_users. This function is almost an exact copy of that function.


Parameters:

mixed   $group_id   Can be an array with group-id's or a single group-id
   $group_ids  

[ Top ]

method unsubscribe_all_users [line 1031]

bool unsubscribe_all_users( $group_ids, mixed $group_id)

Unsubscribe all users from one or more groups



Tags:

return:  TRUE if successfull


Parameters:

mixed   $group_id   Can be an array with group-id's or a single group-id
   $group_ids  

[ Top ]

method unsubscribe_users [line 1020]

bool unsubscribe_users( mixed $user_ids, int $group_id)

Unsubscribe user(s) from a specified group in current course



Tags:

return:  TRUE if successfull


Parameters:

mixed   $user_ids   Can be an array with user-id's or a single user-id
int   $group_id  

[ Top ]

method update_category [line 586]

void update_category( int $id, string $title, string $description, $doc_state, $work_state, $calendar_state, $announcements_state, $forum_state, bool $self_registration_allowed, bool $self_unregistration_allowed, $maximum_number_of_students, int $groups_per_user, int $max_number_of_students)

Update group category



Parameters:

int   $id   The id of the category
string   $title   The title of the new category
string   $description   The description of the new category
bool   $self_registration_allowed  
bool   $self_unregistration_allowed  
int   $max_number_of_students  
int   $groups_per_user  
   $doc_state  
   $work_state  
   $calendar_state  
   $announcements_state  
   $forum_state  
   $maximum_number_of_students  

[ Top ]

method user_has_access [line 1325]

bool user_has_access( int $user_id, int $group_id, constant $tool)

Check if a user has access to a certain group tool



Tags:

return:  True if the given user has access to the given tool in the given course.


Parameters:

int   $user_id   The user id
int   $group_id   The group id
constant   $tool   The tool to check the access rights. This should be one of constants: GROUP_TOOL_DOCUMENTS

[ Top ]

method user_in_number_of_groups [line 823]

int user_in_number_of_groups( int $user_id, $cat_id)

Number of groups of a user



Tags:

return:  The number of groups the user is subscribed in.


Parameters:

int   $user_id  
   $cat_id  

[ Top ]


Documentation generated on Thu, 12 Jun 2008 13:36:57 -0500 by phpDocumentor 1.4.1