ABSTRACT

This class encapsulates courses.

Courses define a name, a description and a memo:

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

Name
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 users.

Description
Courses objects have a description, which is a nonempty HTML string of 2 to 1 MB characters length.

Memo
This field may be used for administrativ persons for memos, like what kind of a room is required, or which documentation is needed etc. May be empty or up to 1 MB of iso-8859-1 characters.


SYNOPSIS

 use Courses;
 ...
 $course = Courses->find(-id=>$id);
 $string = $course->description();
 $string = $course->name();
 $course->update(-name=>$new_name, -description=>$new_string);


DESCRIPTION

Object Constructor

$course = Courses->find( -id=>Ident );
$course = Courses->find( -name=>Name );
Object constructor. Courses 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 course is not found, an empty object is returned.

$course = Courses->create( );
Creates an object in memory but not on the VIP database. Its content should be set with the $course->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 = Courses->get_object_list( );
Returns a reference to a list of course objects. All courses are returned, they are orderd by upper(name).

$aref = Courses->get_id_list( ... );
Returns a reference to a list of course idents, not blessed objects. All courses are returned, not sorted.

Object Accessor Methods

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

$string = $course->description;
$string = $course->id;
$string = $course->memo;
$string = $course->name;

Object Modifier Method

($field, $errmsg) = $course->update( ... )
Updates the course (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:
-name=>$string
ISO-8859-1 string. 2 to 50 characters long. Must be unique.

-description=>$string
HTML string. 2 to 1 MB characters long. HTML syntax is not checked.

-memo=>$string
ISO-8859-1 string, empty or up to 1 MB.

$course->delete;
Deletes the object, both in memory and on the VIP database.


SEE ALSO

Courses 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 Course defines the course title name and a course description.


COPYRIGHT

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