ABSTRACT

This class encapsulates locations (course rooms).

Locations define a name and a description:

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
Locations objects have a description, which is a nonempty HTML string of 2 to 1 MB characters length. It should probably contain a HTML-reference to a map.


SYNOPSIS

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


DESCRIPTION

Object Constructor

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

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

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

Object Accessor Methods

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

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

Object Modifier Method

($field, $errmsg) = $location->update( ... )
Updates the location (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.

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


SEE ALSO

Locations 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 Location defines the location name and a location description. The description is HTML encoded, it should direct a surfer to a class room.


COPYRIGHT

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