This class encapsulates teacher groups (goups of Users).

TeacherGroups define a name and a description:

The ident is an internal datatype (a number). It never changes.

The name is a nonempty, unique ISO-8859-1 string of 2 to 50 character length. It is used as a title and as an identification for surfers.

TeacherGroups objects have a description, which is a nonempty HTML string of 2 to 1 MB characters length. The description is of no importance, just a memo field.


 use TeacherGroups;
 $teacher = TeacherGroups->find(-id=>$id);
 $string = $teacher->description();
 $string = $teacher->name();
 $teacher->update(-name=>$new_name, -description=>$new_string);


Object Constructor

$teacher = TeacherGroups->find( -id=>Ident );
$teacher = TeacherGroups->find( -name=>Name );
Object constructor. TeacherGroups are identified by an Ident, which is unique and will never change. They also have a Name, which may be any ISO-8859-1 string, is unique but can be changed. If the desired teacher group is not found, an empty object is returned.

$teacher = TeacherGroups->create( );
Creates an object in memory but not on the VIP database. Its content should be set with the $teacher->update()-method, which will update the VIP database as well if the input checks pass. The first update should set both, the -name and -description, attributes.

$aref = TeacherGroups->get_object_list( );
Returns a reference to a list of teacher group objects. All teacher groups are returned, they are orderd by upper(name).

$aref = TeacherGroups->get_object_list( -user_id=> ID);
Returns only teacher groups where user ID is a member.

$aref = TeacherGroups->get_id_list( ... );
Returns a reference to a list of teachergroup idents, not blessed objects. All teacher groups are returned, not sorted.

$aref = TeacherGroups->get_id_list( -user_id=> ID);
Returns only idents of teacher groups where user ID is a member.

Object Accessor Methods

The following methods return the current state of a teachergroup object:

$string = $teacher->description;
$string = $teacher->id;
$string = $teacher->name;

Object Modifier Method

($field, $errmsg) = $teacher->update( ... )
Updates the teacher group (object state and data base permanent storage). Before any data is changed, all values are checked. If a check fails, the update will not change any data but return a list of two values: the name of the field and an error message. If all checks are ok, the update method will change the objects state in memory and on the VIP database and return undef. What will be updated is determinated by arguments as follows:
ISO-8859-1 string. 2 to 50 characters long. Must be unique.

HTML string. 2 to 1 MB characters long. HTML syntax is not checked.

Deletes the object, both in memory and on the VIP database.


Teachergroups are used with CourseEvents; a CourseEvent combines a Course with a date, a Location and a TeacherGroup and adds informations like max_participants, closed and visible flag.

The TeacherGroup defines the teacher groups name and a teacher group description. The description is HTML encoded, it is of no importance.

A teacher group has members, which are Users objects. The Class Users.pm contains method set_teacher_group which is used to assign a user to TeacherGroups.


Copyright 2005-2014 Thedi gerber@id.ethz.ch