Packageindex Classtrees Modulegroups Elementlist Report XML Files

SectionNavigator

SectionNavigator

private class SectionNavigator

 
Direct known subclasses: SectionNavigatorOptimized

Public Method Summary

boolean SectionNavigator([ object pxdb_record $section ])
Constructor. Can optionally take an initializing section object
object SectionNavigator &singleton([ object pxdb_record $section ])
Instantiate one copy of this object.
mixed setSection(mixed $section)
Set the section to be used, resets internal vars
boolean hasChildren([ object pxdb_record $section ])
Returns a boolean, tests whether the current Section has children.
object pxdb_collection &getChildren([ object pxdb_record $section ])
Returns the collection object with the children of the current node
object pxdb_record &getHomeSection()
Gets the home node section and returns it
boolean isHomeSection([ object pxdb_record $section ])
Returns boolean whether the current (or passed) section is the home section
string getNavPath([ object pxdb_record $section, string $url_root ])
Generates the URL to access the section.
object pxdb_record &getParent([ object pxdb_record $section ])
Returns the parent to the current or passed section
boolean setDescend(boolean $descend)
Sets whether or not to descend into children of the current section.
object pxdb_record &getNextSection([ object pxdb_record $section ])
Iterator for moving through the nodes. Use getDepth() to determine the current
integer getDepth()
Gets the current value of depth when using the getNextSection() method
integer countChildren()
Returns the number of children at the current depth.
void setShowHiddenSections([ boolean $show ])
Controls wether we return hidden children sections
void &getAncestorCollection([ object Section $section ])
Returns a pxdb_collection containing all sections that are ancestors of the current section.
array getDescendantIds()
Returns an array of all children ids from the current section

Private Method Summary

boolean _setChildren(object pxdb_collection &$children)
Sets the pxdb_collection of children of the current section
object Reference &_getChildrenCollection([ string $url_path ])
Generates the pxdb_collection for the getChildren method,
object pxdb_record &_getHomeSection()
Abstraction method for implementaion of getHomeSection method, although
object pxdb_record &_getSectionByUrlPath(string $url_path)
Abstraction method. Gets a Section by its URL Path
object pxdb_collection &_getParentCollection([ string $url_path ])
Abstraction method for implementation of getting the collection with a Parent in it.
boolean _descend()
returns the value of descend, whether to descend into children or not
boolean _addToStacks(object pxdb_record $section, object pxdb_collection $children)
Add a pxdb_record of section type and pxdb_collection of children
array _removeFromStacks()
Remove a pxdb_record object of type section and a pxdb_collection from the stacks.
array _getFromStacks()
Get a pxdb_record object of type section and a pxdb_collection from the stacks.
bool is_authorized()
Tests if the current section is readable

Private Field Summary

object pxdb_record $section

boolean $hasChildren

object pxdb_collection $children

object pxdb_record $homeSection

array $sectionStack

array $childrenStack

boolean $descend

integer $depth

boolean $_showHiddenSections

Public Method Details

SectionNavigator

public boolean SectionNavigator([ object pxdb_record $section ])

 

Parameter
object pxdb_record $section = >>null<<
- optional
Returns boolean

success


&singleton

public object SectionNavigator &singleton([ object pxdb_record $section ])

 

Parameter
object pxdb_record $section = >>null<<
Returns object SectionNavigator


setSection

public mixed setSection(mixed $section)

 

Parameter
mixed $section
Either URL PATH* string or object pxdb_record *this is changed
Returns mixed

object pxdb_record if URL Path was passed or boolean success or failure


hasChildren

public boolean hasChildren([ object pxdb_record $section ])

  Can be used as a static method

Parameter
object pxdb_record $section = >>null<<
(optional) The Section to be tested
Returns boolean


&getChildren

public object pxdb_collection &getChildren([ object pxdb_record $section ])

 

Parameter
object pxdb_record $section = >>null<<
section to be tested (optional)
Returns object pxdb_collection

Collection of children


&getHomeSection

public object pxdb_record &getHomeSection()

  TODO: oam, make this callable statically?

Returns object pxdb_record

the home section


isHomeSection

public boolean isHomeSection([ object pxdb_record $section ])

 

Parameter
object pxdb_record $section = >>null<<
Returns boolean


getNavPath

public string getNavPath([ object pxdb_record $section, string $url_root ])

 

Parameter
object pxdb_record $section = >>null<<
string $url_root = >>'section'<<
root to prepend to section path (defaults to section)
Returns string


&getParent

public object pxdb_record &getParent([ object pxdb_record $section ])

 

Parameter
object pxdb_record $section = >>null<<
of type section
Returns object pxdb_record

of type section or bool false


setDescend

public boolean setDescend(boolean $descend)

 

Parameter
boolean $descend
Whether or not to descend.
Returns boolean

success


&getNextSection

public object pxdb_record &getNextSection([ object pxdb_record $section ])

  depth in the tree (with home and its children being OR the section you pass in being depth 0). Use setDescend(bool) to tell the class whether or not to descend into children of a given section. If left to its own devices, it will get all sections, hidden or not, in the current request path or not. Returns false when there are no more sections to get.

Parameter
object pxdb_record $section = >>null<<
of type section from which to start tree walk
Returns object pxdb_record

of type section or false


getDepth

public integer getDepth()

 

Returns integer


countChildren

public integer countChildren()

 

Returns integer


setShowHiddenSections

public void setShowHiddenSections([ boolean $show ])

 

Parameter
boolean $show = >>true<<
=return hidden sections (default)
Returns void


&getAncestorCollection

public void &getAncestorCollection([ object Section $section ])

  Obeys showHiddenSections

Parameter
object Section $section = >>null<<
-- optional, section to start at
Returns void


getDescendantIds

public array getDescendantIds()

  Note, this method moves the children pointer so if you are using it inside a loop you should use a new instance of SectionNavigator and not reuse an existing instance.

Returns array


Private Method Details

_setChildren

private boolean _setChildren(object pxdb_collection &$children)

 

Parameter
object pxdb_collection &$children
The collection of children of the current section
Returns boolean

false if children isn't a pxdb_collection


&_getChildrenCollection

private object Reference &_getChildrenCollection([ string $url_path ])

  used to abstract it for overloading.

Parameter
string $url_path = >>null<<
The URL PATH* of the section *Change
Returns object Reference

to the pxdb_collection class containing the children


&_getHomeSection

private object pxdb_record &_getHomeSection()

  it's far more efficient to override the _getSectionByUrlPath method.

Returns object pxdb_record

Reference to a pxdb_record object


&_getSectionByUrlPath

private object pxdb_record &_getSectionByUrlPath(string $url_path)

 

Parameter
string $url_path
The URL ID of the section you're trying to get
Returns object pxdb_record

Reference to a pxdb_record object or false on failure


&_getParentCollection

private object pxdb_collection &_getParentCollection([ string $url_path ])

 

Parameter
string $url_path = >>null<<
The URL PATH* of the section that is a child of the parent you want. *Changed
Returns object pxdb_collection

Reference to the PxDB collection containing the parent


_descend

private boolean _descend()

 

Returns boolean

Whether to descend into children of current section


_addToStacks

private boolean _addToStacks(object pxdb_record $section, object pxdb_collection $children)

  to the section and children stacks, respectively

Parameter
object pxdb_record $section
A pxdb_record of type section
object pxdb_collection $children
A collection of children sections
Returns boolean

success


_removeFromStacks

private array _removeFromStacks()

  Should be simultaneous, so both in one function. Returns the removed objects.

Returns array

An array of two objects, first being the pxdb_record section and the second the pxdb_collection of children


_getFromStacks

private array _getFromStacks()

  Should be simultaneous, so both in one function.

Returns array

An array of two objects, first being the pxdb_record section and the second the pxdb_collection of children


is_authorized

private bool is_authorized()

 

Returns bool


Private Field Details

$section

private object pxdb_record $section

>><<


$hasChildren

private boolean $hasChildren

>><<


$children

private object pxdb_collection $children

>><<


$homeSection

private object pxdb_record $homeSection

>><<


$sectionStack

private array $sectionStack

>>array()<<


$childrenStack

private array $childrenStack

>>array()<<


$descend

private boolean $descend

>>true<<


$depth

private integer $depth

>><<


$_showHiddenSections

private boolean $_showHiddenSections

>>TRUE<<



Packageindex Classtrees Modulegroups Elementlist Report XML Files
Generated on Fri, 28 Apr 2006 19:06:12 -0400 by PHPDoc v1.5 www.phpdoc.de