category_tree::get_tree (public)
category_tree::get_tree [ -all ] [ -subtree_id subtree_id ] tree_id \ [ locale ]
Defined in packages/categories/tcl/category-trees-procs.tcl
Get all categories of a category tree from the cache.
- Switches:
- -all (optional, boolean)
- -subtree_id (optional)
- Parameters:
- Options:
- tree_id (required)
- category tree to get the categories of.
- locale (optional)
- language in which to get the categories. [ad_conn locale] used by default.
- -all
- Indicates that phased_out categories should be included.
- -subtree_id
- Return only categories of the given subtree.
- Returns:
- Tcl list of lists: category_id category_name deprecated_p level
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud
Source code: if {[nsv_names category_trees] eq "" || ![nsv_exists category_trees $tree_id]} { return [list] } set tree [nsv_get category_trees $tree_id] set result [list] if {$subtree_id eq ""} { foreach category $tree { lassign $category category_id deprecated_p level if {$all_p || $deprecated_p == "f"} { lappend result [list $category_id [category::get_name $category_id $locale] $deprecated_p $level] } } } else { set in_subtree_p 0 set subtree_level 0 foreach category $tree { lassign $category category_id deprecated_p level if {$level <= $subtree_level} { set in_subtree_p 0 } if {$in_subtree_p && $deprecated_p == "f"} { lappend result [list $category_id [category::get_name $category_id $locale] $deprecated_p [expr {$level - $subtree_level}]] } if {$category_id == $subtree_id} { set in_subtree_p 1 set subtree_level $level } } } return $resultXQL Not present: Generic PostgreSQL XQL file: packages/categories/tcl/category-trees-procs-postgresql.xql
Oracle XQL file: packages/categories/tcl/category-trees-procs-oracle.xql