Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
TreeAbstract Class Reference
Inheritance diagram for TreeAbstract:
Inheritance graph
Collaboration diagram for TreeAbstract:
Collaboration graph

Public Member Functions

 TreeAbstract ()
 init ()
 storeItem ($item_id, $parent_id, $name, $priority)
 buildIndex ($item_id=false)
 getKids ($item_id)
 getNumKids ($item_id)
 getKidsKids ($item_id, $in_recursion=false)
 getNumKidsKids ($item_id, $in_recursion=false)
 isLastKid ($item_id)
 isFirstKid ($item_id)
 isChildOf ($ancestor_id, $item_id)
 hasKids ($item_id)
 getItemPath ($item_id)
 getParents ($item_id)
 getShortPath ($item_id, $depth=false, $delimeter=">")
 getMaxPriority ($parent_id)
 getNumEntries ($item_id, $num_entries_from_kids=false)
 getNumEntriesKids ($item_id, $in_recursion=false)
 getValue ($item_id, $field)

Static Public Member Functions

 GetInstance ($class_name, $args=null, $invalidate_cache=false)

Data Fields

 $root_name
 $view
 $tree_data = array()
 $tree_childs = array()
 $tree_num_childs = array()
 $index_offset = 0

Member Function Documentation

buildIndex (   $item_id = false)

build an index for sorting purpose

build an index for sorting purpose

public

Parameters
string$item_id

Here is the call graph for this function:

Here is the caller graph for this function:

GetInstance (   $class_name,
  $args = null,
  $invalidate_cache = false 
)
static

static method used to ensure that only one instance exists

use this method if you need a reference to the tree object
usage:

$my_tree = StudipRangeTree::GetInstance("name_of_tree_class")

public

Parameters
string$class_namethe name of the used tree_class
mixed$argsargumentlist passed to the constructor in the tree_class (if needed)
Returns
mixed always an object, type is one of AbstractTree s childclasses

Here is the caller graph for this function:

getItemPath (   $item_id)

Returns tree path

returns a string with the item and all parents separated with a slash public

Parameters
string$item_id
Returns
string
getKids (   $item_id)

returns all direct kids

public

Parameters
string$item_id
Returns
array

Here is the caller graph for this function:

getKidsKids (   $item_id,
  $in_recursion = false 
)

returns all direct kids and kids of kids and so on...

public

Parameters
string$item_id
bool$in_recursiononly used in recursion
Returns
array

Here is the call graph for this function:

Here is the caller graph for this function:

getMaxPriority (   $parent_id)

Returns the maximum priority value from a parents child

public

Parameters
string$parent_id
Returns
int

Here is the call graph for this function:

Here is the caller graph for this function:

getNumEntries (   $item_id,
  $num_entries_from_kids = false 
)

Reimplemented in StudipRangeTree, and StudipSemTree.

Here is the call graph for this function:

Here is the caller graph for this function:

getNumEntriesKids (   $item_id,
  $in_recursion = false 
)

Here is the call graph for this function:

Here is the caller graph for this function:

getNumKids (   $item_id)

returns the number of all direct kids

public

Parameters
string$item_id
bool$in_recursion
Returns
int

Here is the caller graph for this function:

getNumKidsKids (   $item_id,
  $in_recursion = false 
)

returns the number of all kids and kidskids...

public

Parameters
string$item_id
bool$in_recursion
Returns
int

Here is the call graph for this function:

getParents (   $item_id)

Returns tree path as array of item_id s

returns an array containing all parents of given item public

Parameters
string$item_id
Returns
array

Here is the caller graph for this function:

getShortPath (   $item_id,
  $depth = false,
  $delimeter = ">" 
)

Here is the call graph for this function:

getValue (   $item_id,
  $field 
)

Here is the caller graph for this function:

hasKids (   $item_id)

checks if item has one or more kids

public

Parameters
string$item_id
Returns
boolean

Here is the call graph for this function:

Here is the caller graph for this function:

init ( )

initializes the tree

stores all tree items in array $tree_data must be overriden public

Reimplemented in EvaluationTree, StudipSemTree, StudipDocumentTree, StudipLitList, StudipRangeTree, StudipStmInstancesTree, and ResourcesExternTree.

Here is the caller graph for this function:

isChildOf (   $ancestor_id,
  $item_id 
)

checks if given item is a kid or kidkid...of given ancestor

checks if given item is a kid or kidkid...of given ancestor public

Parameters
string$ancestor_id
string$item_id
Returns
boolean

Here is the call graph for this function:

isFirstKid (   $item_id)

checks if item is the first kid

public

Parameters
string$item_id
Returns
boolean

Here is the call graph for this function:

isLastKid (   $item_id)

checks if item is the last kid

public

Parameters
string$item_id
Returns
boolean

Here is the call graph for this function:

storeItem (   $item_id,
  $parent_id,
  $name,
  $priority 
)

store one item in tree_data array

store one item in tree_data array public

Parameters
string$item_id
string$parent_id
string$name
integer$priority

Reimplemented in StudipStmInstancesTree.

Here is the caller graph for this function:

constructor

do not use directly, call &GetInstance() private

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$index_offset = 0
string $root_name

the name of the root element

private

array $tree_childs = array()

array containing the direct childs of all items

assoc. array, key is one from $tree_data, value is numeric array with keys from childs private

array $tree_data = array()

array containing all tree items

associative array, key is an unique identifier (eg primary key from DB table) value is another assoc. array containing the other fieldname/fieldvalue pairs these fieldnames must be used : parent_id, name, priority public

array $tree_num_childs = array()

array containing the number of direct childs of all items

assoc. array, key is one from $tree_data private

object DbView $view

object to handle database queries

private


The documentation for this class was generated from the following file: