blueshoes php application framework and cms            applications_cms
[ class tree: applications_cms ] [ index: applications_cms ] [ all elements ]

Class: Bs_Navigation

Source Location: /applications/cms/Bs_Navigation.class.php

Class Overview

Bs_Object
   |
   --Bs_Navigation

Navigation Class


Author(s):

Version:

  • 4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:22:34 $

Copyright:

  • blueshoes.org

Variables

Methods


Inherited Variables

Inherited Methods

Class: Bs_Object

Bs_Object::Bs_Object()
Bs_Object::getErrors()
Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack.
Bs_Object::getLastError()
Basic error handling: Get last error string from the global Bs_Error-error stack.
Bs_Object::getLastErrors()
Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors().
Bs_Object::persist()
Persists this object by serializing it and saving it to a file with unique name.
Bs_Object::setError()
Basic error handling: Push an error string on the global Bs_Error-error stack.
Bs_Object::toHtml()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::toString()
Dumps the content of this object to a string using PHP's var_dump().
Bs_Object::unpersist()
Fetches an object that was persisted with persist()

Class Details

[line 22]
Navigation Class

dependencies:




Tags:

copyright:  blueshoes.org
pattern:  singleton: (pseudostatic)
access:  public
version:  4.3.$Revision: 1.2 $ $Date: 2003/08/09 15:22:34 $
author:  andrej arn <at blueshoes dot org>


[ Top ]


Class Variables

$_Bs_String =

[line 31]

a reference to the pseudostatic object Bs_String.


Type:   object


[ Top ]



Class Methods


constructor Bs_Navigation [line 62]

Bs_Navigation Bs_Navigation( )

Constructor.



[ Top ]

method getBreadcrumbData [line 263]

array getBreadcrumbData( int $knodID, string $separator, string $comeLinkCaption, string $target, string $highlightCurrent)

returns the data of the parent, grand parent etc for the given knod.

if it cannot be resolved until the level 1 navigation (knod with parent = 0) then the knods that were resolved will be returned. you won't be able to tell if this happened from the returned value.

we return after 20 parent lookups. this breaks out of an endless loop, which could occur if for example 2 knods are pointing to each other (both think they're the parents of each other).




Tags:

return:  a vector holding hashes, got hashes from getParentData().
see:  Bs_Navigation::getBreadcrumbIDs()
throws:  bs_exception


Parameters:

int   $knodID  
string   $separator   default is ', '
string   $comeLinkCaption   default is 'Home'
string   $target   default is ''
string   $highlightCurrent   default is NULL

[ Top ]

method getBreadcrumbIDs [line 298]

array getBreadcrumbIDs( int $knodID)

returns the parent, grand parent etc for the given knod.

if it cannot be resolved until the level 1 navigation (knod with parent = 0) then the knods that were resolved will be returned. you won't be able to tell if this happened from the returned value.

we return after 20 parent lookups. this breaks out of an endless loop, which could occur if for example 2 knods are pointing to each other (both think they're the parents of each other).




Tags:

return:  (vector, first element = level 1, $knodID is the last element.)
see:  Bs_Navigation::getBreadcrumbData()
throws:  bs_exception


Parameters:

int   $knodID  

[ Top ]

method getBreadcrumbNavigation [line 218]

void getBreadcrumbNavigation( mixed $knodID, [mixed $separator = ', '], [mixed $homeLinkCaption = 'Home'], [mixed $pageTarget = ''], [mixed $homeTarget = ''], [mixed $highlightCurrent = NULL])



Tags:

todo:  add the language code to each fucking url. 3rd level domains would be easier like fr.domain.com/ so you could just link to /someshit/ instead of /fr/someshit/ ...
todo:  implement language dependency somehow
todo:  make use of the $highlightCurrent param


[ Top ]

method getLevel [line 378]

int getLevel( int $knodID, [bool $useCache = TRUE], [mixed $levelOffset = 1], int $offset)

returns the level in which the given page is in.

levels start at 1, not 0. calls itself recursively.




Tags:

return:  the level
throws:  mixed bool FALSE if unknown or invalid knodID or if looped more than 20 times (if 2 knods think they're both parents of each other, or someshit), bs_exception on a db error.


Parameters:

int   $knodID  
bool   $useCache   default is TRUE
int   $offset   default is 1. *used internally* to count the levels.

[ Top ]

method getNavigationData [line 79]

void getNavigationData( )

returns the data you need to build a navigation tree or something to show to the user.



[ Top ]

method getNavigationData_old [line 160]

array getNavigationData_old( [int $forKnod = 0], [int $fromLevel = 1], [int $numLevels = -1], [bool $onlyPublished = TRUE], [bool $useCache = TRUE], [mixed $ret = array()], array &$ret)

returns the data you need to build a navigation tree or something to show to the user.

a navigation may have different "levels". level 1 is the top level, the knods that have no parent. the level 2 knods are the children of the top leven ones, and so on. -1 means 'until the end is reached'.

E X A M P L E S example 1: you're somewhere in the middle, looking at the knod with id 123, you may wish to just get its children, not careing about what level you're in. what you do then is getNavigationData(123, 1, 1, TRUE); example 2: now you wish to know the brothers of knod 123. your call now is getNavigationData(123, 0, 1, TRUE); example 3: and to get the full navigation data, you'd do getNavigationData();

calls itself recursively.




Tags:

return:  a vector holding vectors holding hash key/val pairs.
todo:  finish code
todo:  implement cache (make use of $useCache param)
throws:  bs_exception


Parameters:

int   $forKnod   default is 0
int   $fromLevel   default is 1. is relative to $forKnod if $forKnod != 0. can be negative.
int   $numLevels   default is -1 which means all //@param bool $levelRelative default is FALSE
bool   $onlyPublished   default is TRUE, if set to TRUE only published knods will be returned.
bool   $useCache   default is TRUE.
array   &$ret   used internally only for recursive loops.

[ Top ]

method getParentData [line 348]

array getParentData( int $knodID)

returns the data from the parent knod.



Tags:

return:  a hash
throws:  mixed bool FALSE if unknown or invalid knodID, , bs_exception on a db error.


Parameters:

int   $knodID  

[ Top ]

method getParentId [line 322]

int getParentId( int $knodID)

returns the knodID from the parent.



Tags:

return:  the parent knod id (0 is valid, which means it has no parent, it is a top level knod.)
throws:  mixed bool FALSE if unknown or invalid knodID, bs_exception on a db error.


Parameters:

int   $knodID  

[ Top ]

method _getNavigationDataHelper [line 110]

void _getNavigationDataHelper( mixed $list, [mixed $parentPath = '/'])

gets called recursively.



[ Top ]


Documentation generated on Mon, 29 Dec 2003 21:12:04 +0100 by phpDocumentor 1.2.3