NAME

Bric::Biz::Category - A module to group assets into categories.

VERSION

$Revision: 1.2.2.2 $

DATE

$Date: 2001/11/06 23:18:32 $

SYNOPSIS

# Return a new category object.
my $cat = new Bric::Biz::Category($init);

my $cat = lookup Bric::Biz::Category({'id' => $cat_id});

my $cat = list Bric::Biz::Category($crit);

$cat->get_name;
$cat->get_description;

# Return a list of keywords associated with this category.
@keys   = $cat->keywords();
# Return a list of assets asscociated with this category.
@assets = $cat->assets();
# Return a list of child categories of this category.
@cats   = $cat->children();
# Return the parent of this category.
$parent = $cat->parent();

# Attribute methods.
$val = $element->set_attr($name, $value);
$val = $element->get_attr($name);
$val = $element->set_meta($name, $field, $value);
$val = $element->get_meta($name, $field);

# Ad string methods
$txt = $element->get_ad_string;
$element->set_ad_string($value);
$txt = $element->get_ad_string2;
$element->set_ad_string2($value);

# Add/Delete child categories for this category.
$cat->add_child([$cat || $cat_id]);
$cat->del_child([$cat || $cat_id]);

# Add/Delete keywords associated with this category.
$cat->add_keyword([$kw_id]);
$cat->del_keyword([$kw_id]);

# Add/Delete assets associated with this category.
$cat->add_asset([$asset || $asset_id]);
$cat->del_asset([$asset || $asset_id]);

# Save information for this category to the database.
$cat->save;

DESCRIPTION

Allows assets to be grouped into categories. In addition to assets a category can contain other categories, allowing a hierarchical layout of categories and assets.

INTERFACE

Constructors

$obj = new Bric::Biz::Category($init);

Create a new object of type Bric::Biz::Category

Keys for $init are:

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@objs = lookup Bric::Biz::Category($cat_id);

Return an object given an ID.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@objs = list Bric::Biz::Category($crit);

Return a list of category objects based on certain criteria

Criteria keys:

'children of'

Given a category object returns its children.

'keyword'

Given a keyword, list all category objects containing that keyword.

Throws:

"Method not implemented"

Side Effects:

NONE

Notes:

This is the default list constructor which should be overrided in all derived classes even if it just calls 'die'.

Destructors

$cat->DESTROY()

Deletes the object.

Throws:

NONE

Side Effects:

NONE

Notes:

This method should be here even if its empty so that we don't waste time making Bricolage's autoload method try to find it.

Public Class Methods

NONE

my $meths = Bric::Util::Grp->my_meths
my (@meths || $meths_aref) = Bric::Util::Grp->my_meths(TRUE)

Returns an anonymous hash of instrospection data for this object. If called with a true argument, it will return an ordered list or anonymous array of intrspection data. The format for each introspection item introspection is as follows:

Each hash key is the name of a property or attribute of the object. The value for a hash key is another anonymous hash containing the following keys:

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Instance Methods

$name = $cat->get_name;

Return the name of this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$self = $cat->set_name($name);

Sets the name of this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@objs = $cat->ancestry();

Return all the parent category of this category

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

my $path = $cat->ancestry_path();

Returns the list of ancestors for this category formatted into a URI.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

my $path = $cat->ancestry_dir();

Returns the list of ancestors for this category formatted into a localized directory structure.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

my $uri = $cat->get_uri();

An alias for ancestry_path().

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$name = $cat->get_description;

Returns the description of this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$val = $element->set_ad_string($value);
$self = $element->get_ad_string;
$val = $element->set_ad_string2($value);
$self = $element->get_ad_string2;

Get/Set ad strings on this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$self = $cat->set_description($desc);

Sets the description of this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$val = $element->set_attr($name, $value);
$val = $element->get_attr($name);

Get/Set attributes on this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$val = $element->set_meta($name, $field, $value);
$val = $element->get_meta($name, $field);

Get/Set attribute metadata on this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@keys = $cat->keywords();

Returns a list of keywords associated with this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@assets = $cat->assets();

Returns a list of assets associated with this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@cats = $cat->children();

Returns the children of this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$parent = $cat->parent():

Returns the parent of this category or undef if it is a top level category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->add_child([$cat || $cat_id]);

Addes a category as a child of this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->del_child([$cat]);

Delete a child of this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->add_keyword($kw || $kw_id]);

Associates a keyword with this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->del_keyword($kw || [$kw]);

Removes a keyword association from this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$asset = $cat->add_asset($asset || [$asset]);

Add an asset to this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->del_asset($asset || [$asset]);

Removes an asset from this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$att = $att->is_active;
$att = $att->activate;
$att = $att->deactivate;

Get/Set the active flag.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->save

Save this category

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

Private Methods

Private Class Methods

NONE

Private Instance Methods

NONE

NOTES

This class is implimented on the backend using the group structure. The class Bric::Util::Grp::Category handles all the database interactions.

AUTHOR

"Garth Webb" <garth@perijove.com> Bricolage Engineering

SEE ALSO

perl, Bric::Util::Grp::Category, Bric, Bric::Biz::Keyword, Bric::Biz::Asset

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 374:

You forgot a '=back' before '=head2'

Around line 380:

'=item' outside of any '=over'

Around line 406:

You forgot a '=back' before '=head2'

Around line 414:

'=item' outside of any '=over'

Around line 496:

Expected '=item *'

Around line 498:

Expected '=item *'

Around line 500:

Expected '=item *'

Around line 502:

Expected '=item *'

Around line 504:

Expected '=item *'

Around line 506:

Expected '=item *'

Around line 508:

Expected '=item *'

Around line 644:

You forgot a '=back' before '=head2'

Around line 650:

'=item' outside of any '=over'

Around line 1562:

You forgot a '=back' before '=head2'

Around line 1704:

=back without =over