NAME

Liz::CategorySet::Category - module for Category objects of the CategorySet


SYNOPSIS

 use Liz::CategorySet;
 $categoryset = new Liz::CategorySet;

 $category = $categoryset->Category;
 $category = $categoryset->Category( $categoryID );

 $category->update;


EXAMPLES


DESCRIPTION

Provide object oriented access to categories in a CategorySet. Usually not accessed directly, but rather through the Liz::CategorySet object and its Category method.


BASIC METHODS


new

Create a new Category object from a CategorySet object.

Input Parameters

 1 Liz::CategorySet object
 2 ID/name to created Category object with
   (default: none = new category)
 3 ID of parent category
   (default: 0 = top)
 4 sortname of category (name of which category should be sorted)
   (default: same as name if 2nd parameter is name)
Output Parameters

 1 instantiated object
Note

It is not intended to call this method directly, but rather indirectly through the Liz::CategorySet module.

Example

 $categoryset = new Liz::CategorySet;
 $category = $categoryset->Category( 'Toilet Seats',$accessoriesID );
 $category = $categoryset->Category( $categoryID );


update

Update a Category object in the Liz::CategorySet database.

Output Parameters

 1 ID with which the object was updated (undef = error)
Example

 $category->update;


delete

Delete a Liz::CategorySet::Category object from the database.

Output Parameters

 1 flag: whether action was successful
Example

 $category->delete;


reset

Reset all category information in the categoryset.

Example

 $categoryset->reset;
 print "All categories have been removed\n";


CONTENT METHODS

The following methods allow you to inspect and/or change certain fields of the Liz::CategorySet::Category object.


Depth

Returns the Depth of the Category (top level = 0). The Depth of a Category is automatically maintained by the module and can not be changed.

Output Parameters

 1 depth of category
   (0 = top level category)


Name

Set/Return the name of the Category.

Input Parameters

 1 new name
   (default: no change)
Output Parameters

 1 current/previous name
Example

 $category->Name( $name );
 $name = $category->Name;


ParentID

Return the direct parentID of the Category object.

Input Parameters

 1 new parentID
   (default: no change)
Output Parameters

 1 previous/current parent ID
Example

 $category->ParentID( $parentID );
 $parentID = $category->ParentID;


ParentIDs

Returns all parentIDs of the current category object

Output Parameters

 1..N ID's of all parents
      (empty list of no parents found)


Other AUTOLOADed methods

The following methods are AUTOLOADed: they can be used to change fields in the object or add values to already existing fields. Prefix values with ``+='' to append to existing values.

These methods do not exist in this module but are allowed to be executed on the object:

 Created
 Data
 ForeignKey
 ID
 Name
 Options
 SortName
 Status
 Updated


AUTHOR

Elizabeth Mattijsen ( lizperl@INC.nl )

Contributions by:

- Ronald Lens ( ronald@xxLINK.nl )


COPYRIGHT

(C) 1998-1999 International Network Consultants


HISTORY

Version 0.84, 14 October 1999

Reverted changes of 4 October: problem with sortname now properly being set by update if empty.

Added own method ParentID, as the inherited method was not correct.

Version 0.83, 4 October 1999

Fiddled with new method to make sure a new object doesn't overwrite and existing one.

Version 0.82, 23 September 1999

Now has own method Name to bypass the Name method of Liz::CategorySet.

Now inherits from Liz::Categoryset.pm instead of Liz::SQL.pm.

Now no longer puts Exporter in ISA: wasn't needed.

Version 0.81, 22 September 1999

Fixed problem with unescaped sortname in update.

Version 0.8, 14 September 1999

Method update now limits the size of the sortname field to 255 characters.

Version 0.7, 12 May 1999

Updated methods new and update so that this module can be sub-classed with extra fields.

Changed method new so that the global variable $ERROR is set if the obtaining of an existing record failed.

Updated typography of the source to the new indented format.

Version 0.6, 27 April 1999

Fixed problem in method update which would not return the ID of the object if the object was not changed.

Version 0.5, 22 April 1999

Support for Data added.

Version 0.4, 7 April 1999

Support for ForeignKey added.

Version 0.3, 27 October 1998

Support for Alternates added.

Version 0.22, 6 October 1998

Reduced memory footprint by fully qualifying global variables.

Version 0.21, 17 September 1998

Method update now returns the ID with which the object was created.

Version 0.2, 4 September 1998

Support for Status added.

Version 0.1, 20 August 1998

First version of this true Perl module.