- Publicity: Public Only All
categories-procs.tcl
Procs for the site-wide categorization package.
- Location:
- packages/categories/tcl/categories-procs.tcl
- Created:
- 16 April 2003
- Author:
- Timo Hentschel <timo@timohentschel.de>
- CVS Identification:
$Id: categories-procs.tcl,v 1.38.2.14 2022/09/08 15:56:46 antoniop Exp $
Procedures in this file
- category::add (public)
- category::change_parent (public)
- category::count_children (public)
- category::delete (public)
- category::flush_translation_cache (public)
- category::get (public)
- category::get_children (public)
- category::get_data (public)
- category::get_id (public)
- category::get_id_by_object_title (public)
- category::get_mapped_categories (public)
- category::get_mapped_categories_multirow (public)
- category::get_name (public)
- category::get_names (public)
- category::get_object_context (public)
- category::get_objects (public)
- category::get_parent (public)
- category::get_tree (public)
- category::indent_html (public, deprecated)
- category::map_object (public)
- category::phase_in (public)
- category::phase_out (public)
- category::reset_translation_cache (public)
- category::update (public)
Detailed information
category::add (public)
category::add [ -category_id category_id ] -tree_id tree_id \ -parent_id parent_id -name name [ -locale locale ] \ [ -description description ] [ -deprecated_p deprecated_p ] \ [ -user_id user_id ] [ -creation_ip creation_ip ] [ -noflush ]
Insert a new category. The same translation will be added in the default language if it's in a different language.
- Switches:
- Options:
- -category_id (optional)
- -tree_id (required)
- -parent_id (required)
- -name (required)
- -locale (optional)
- -description (optional)
- -deprecated_p (optional, defaults to
"f"
)- -user_id (optional)
- -creation_ip (optional)
- -noflush (optional, boolean)
- -category_id
- category_id of the category to be inserted.
- -locale
- locale of the language. [ad_conn locale] used by default.
- -name
- category name.
- -description
- description of the category.
- -deprecated_p
- is category deprecated?
- -tree_id
- tree_id of the category the category should be added.
- -parent_id
- id of the parent category. "" if top level category.
- -user_id
- user that adds the category. [ad_conn user_id] used by default.
- -creation_ip
- ip-address of the user that adds the category. [ad_conn peeraddr] used by default.
- -noflush
- defer calling category_tree::flush_cache (which if adding multiple categories to a large tree can be very expensive). note that if you set this flag you must call category_tree::flush_cache once the adds are complete.
- Returns:
- category_id
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_synonyms, category_link, category_crud, category_get_procs, category_tree_procs
category::change_parent (public)
category::change_parent -category_id category_id -tree_id tree_id \ [ -parent_id parent_id ]
Changes parent category of a category.
- Switches:
- Options:
- -category_id (required)
- -tree_id (required)
- -parent_id (optional)
- -category_id
- category_id whose parent should change.
- -tree_id
- tree_id of the category tree.
- -parent_id
- new parent category_id.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_tree_procs
category::count_children (public)
category::count_children -category_id category_id
counts all direct sub categories
- Switches:
- -category_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_tree_procs
category::delete (public)
category::delete [ -batch_mode ] category_id
Deletes a category. category_tree::flush_cache should be used afterwards.
- Switches:
- -batch_mode (optional, boolean)
- Parameters:
- Options:
- category_id (required)
- category_id of the category to be deleted.
- -batch_mode
- Indicates that the cache for category translations should not be flushed. Useful when deleting several categories at once. Don't forget to call reset_translation_cache
- Author:
- Timo Hentschel <timo@timohentschel.de>
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud
category::flush_translation_cache (public)
category::flush_translation_cache category_id
Flushes category translation cache of one category.
- Parameters:
- category_id (required)
- category to be flushed.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud
category::get (public)
category::get -category_id category_id [ -locale locale ]
Get name and description for a category_id in the given or connection's locale. If for the combination of category and locale no entry in category_translations exists, then empty is returned.
- Switches:
- Options:
- -category_id (required)
- -locale (optional)
- -category_id
- category_id of the category to be queried.
- -locale
- locale of the language. [ad_conn locale] used by default.
- Returns:
- list of attribute value pairs containing name and description
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud, category_get_procs
category::get_children (public)
category::get_children -category_id category_id
Returns the category ids of the direct children of the given category
- Switches:
- -category_id (required)
- category_id
- Returns:
- list of category ids of the children of the supplied category_id
- Author:
- Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud, category_get_procs, category_tree_procs
category::get_data (public)
category::get_data category_id [ locale ]
Gets the category name and the tree name in the specified language, if available. Use default language otherwise.
- Parameters:
- category_id (required)
- category_id to get the names.
- locale (optional)
- language in which to get the names. [ad_conn locale] used by default.
- Returns:
- list of category_id, category_name, tree_id and tree_name.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_get_procs
category::get_id (public)
category::get_id name [ locale ]
Gets the id of a category given a name.
- Parameters:
- name (required)
- the name of the category to retrieve
- locale (optional, defaults to
"en_US"
)- the locale in which the name is supplied
- Returns:
- the category id or empty string if no category was found
- Author:
- Lee Denison <lee@xarg.co.uk>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_get_procs
category::get_id_by_object_title (public)
category::get_id_by_object_title title
Gets the id of a category given an object title (object_type=category). This is highly useful as the category object title will not change if you change the name (label) of the category, so you can access the category even if the label has changed
- Parameters:
- title (required)
- object title of the category to retrieve
- Returns:
- the category id or empty string if no category was found
- Author:
- Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_get_procs
category::get_mapped_categories (public)
category::get_mapped_categories [ -tree_id tree_id ] object_id
Gets the list of categories mapped to an object. If tree_id is provided return only the categories mapped from the given tree.
- Switches:
- -tree_id (optional)
- Parameters:
- object_id (required)
- object of which we want to know the mapped categories.
- Returns:
- tcl-list of category_ids
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_object_mapping
category::get_mapped_categories_multirow (public)
category::get_mapped_categories_multirow [ -locale locale ] \ [ -multirow multirow ] object_id
Returns multirow with: tree_id, tree_name, category_id, category_name
- Switches:
- -locale (optional)
- -multirow (optional, defaults to
"mapped_categories"
)- Parameters:
- object_id (required)
- object of which we want to know the mapped categories.
- Returns:
- multirow with tree and category information
- Author:
- Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_object_mapping
category::get_name (public)
category::get_name category_id [ locale ]
Gets the category name in the specified language, if available. Use default language otherwise.
- Parameters:
- category_id (required)
- category_id or list of category_id's for which to get the name.
- locale (optional)
- language in which to get the name. [ad_conn locale] used by default.
- Returns:
- list of names corresponding to the supplied category_id.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud, category_get_procs, category_tree_procs
category::get_names (public)
category::get_names category_ids [ locale ]
Gets the category name in the specified language, if available. Use default language otherwise.
- Parameters:
- category_ids (required)
- category_ids for which to get the name.
- locale (optional)
- language in which to get the name. [ad_conn locale] used by default.
- Returns:
- list of names corresponding to the list of category_id's supplied.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_get_procs, category_tree_procs
category::get_object_context (public)
category::get_object_context object_id
Returns the object name and url to be used in a context bar.
- Parameters:
- object_id (required)
- object_id to get the name of.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_object_mapping
category::get_objects (public)
category::get_objects -category_id category_id \ [ -object_type object_type ] [ -content_type content_type ] \ [ -include_children ]
Returns a list of objects which are mapped to this category_id
- Switches:
- -category_id (required)
- CategoryID of the category we want to get the objects for
- -object_type (optional)
- Limit the search for objects of this object type
- -content_type (optional)
- Limit the search for objects of this content_type
- -include_children (optional, boolean)
- Include child categories' objects as well. Not yet implemented
- Author:
- malte ()
- Created:
- Wed May 30 06:28:25 CEST 2007
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_object_mapping
category::get_parent (public)
category::get_parent -category_id category_id
Returns the category id of the parent category
- Switches:
- -category_id (required)
- category_id
- Returns:
- category id of the parent category
- Author:
- Peter Kreuzinger <peter.kreuzinger@wu-wien.ac.at>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_get_procs
category::get_tree (public)
category::get_tree category_id
Gets the tree_id of the given category.
- Parameters:
- category_id (required)
- category_id or list of category_id's for which to get the tree_id.
- Returns:
- tree_id of the tree the category belongs to.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_get_procs
category::indent_html (public, deprecated)
category::indent_html indent_width
Deprecated. Invoking this procedure generates a warning.
Creates a series of to indent subcatories in html output.
- Parameters:
- indent_width (required)
- width of the html indent.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- See Also:
- string repeat " " $i
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
category::map_object (public)
category::map_object [ -remove_old ] -object_id object_id \ category_id_list
Map an object to several categories.
- Switches:
- -remove_old (optional, boolean)
- -object_id (required)
- Parameters:
- Options:
- category_id_list (required)
- tcl-list of category_ids to be mapped to the object.
- -remove_old
- Modifier to be used when categorizing existing objects. Will make sure to delete all old categorizations.
- -object_id
- object to be categorized.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_object_mapping
category::phase_in (public)
category::phase_in category_id
Marks a category to be visible for categorizing new objects / update existing objects. Make sure to use category_tree::flush_cache afterwards.
- Parameters:
- category_id (required)
- category_id of the category to be phased in
- Author:
- Timo Hentschel <timo@timohentschel.de>
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud
category::phase_out (public)
category::phase_out category_id
Marks a category to be phasing out. That means this category and all its subcategories will no longer appear in the categorization widget to categorize new objects / update existing objects, but all existing categorizations will still remain valid. Make sure to use category_tree::flush_cache afterwards.
- Parameters:
- category_id (required)
- category_id of the category to be phased out
- Author:
- Timo Hentschel <timo@timohentschel.de>
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud
category::reset_translation_cache (public)
category::reset_translation_cache
Reloads all category translations in the cache.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_init_procs
category::update (public)
category::update -category_id category_id -name name \ [ -locale locale ] [ -description description ] \ [ -user_id user_id ] [ -modifying_ip modifying_ip ]
Updates/inserts a category translation.
- Switches:
- Options:
- -category_id (required)
- -name (required)
- -locale (optional)
- -description (optional)
- -user_id (optional)
- -modifying_ip (optional)
- -category_id
- category_id of the category to be updated.
- -locale
- locale of the language. [ad_conn locale] used by default.
- -name
- category name.
- -description
- description of the category.
- -user_id
- user that updates the category. [ad_conn user_id] used by default.
- -modifying_ip
- ip-address of the user that updates the category. [ad_conn peeraddr] used by default.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud