Class CMS_tree

Description

Class CMS_tree

Manages the tree structure and the collection of pages.

Located in /automne/classes/tree/tree.php (line 31)

CMS_grandFather
   |
   --CMS_tree
Method Summary
 static CMS_page analyseURL (string $pageUrl, [boolean $useDomain = true])
 static boolean attachPageToTree (mixed $page, mixed $ancestor, [boolean $publicTree = false])
 static boolean changePagesOrder (array $newSiblingOrder,  &$user, CMS_profile_user $user)
 static boolean changeSiblingOrder ( &$sibling, integer $moveOffset,  &$user, CMS_page $sibling, CMS_profile_user $user)
 static boolean compactSiblingOrder ( &$page, [ $publicTree = false], CMS_page $page)
 static boolean detachPageFromTree ( &$page, [boolean $publicTree = false], CMS_page $page)
 static array(id) getAllSiblings (integer $pageID, [boolean $publicTree = false], [boolean $stopAtWebsites = false])
 static CMS_page getAncestor ( &$page, integer $offset, [boolean $stopAtWebsites = false], [ $publicTree = false], CMS_page $page)
 static array(string=>string) getArchivedPagesData ()
 static CMS_page getBrother ( &$page, integer $offset, [boolean $publicTree = false], CMS_page $page)
 static mixed, getFather (mixed $page, [boolean $outputObject = false], [boolean $publicTree = false])
 static array(CMS_page) getLineage (CMS_page $ancestor, CMS_page $page, [boolean $IO_CMS_page = true], [ $publicTree = false])
 static mixed getPageByCodename ($page $codename, $website $website, [boolean $public = false], [$returnObject $returnObject = true])
 static CMS_page getPageByID (integer $id, [ $reset = false])
 static CMS_page getPageCodenameValue (string $codename,  $referencePageId, string $type, integer $id)
 static mixed getPagesByCodename ($page $codename, [boolean $public = false], [$returnObject $returnObject = true])
 static CMS_page getPageValue (mixed $id, string $type, [boolean $public = true], [integer $currentPageId = null])
 static CMS_website getPageWebsite (mixed $page)
 static CMS_page getRoot ()
 static array(CMS_page) getSiblings ( &$page, [boolean $publicTree = false], [boolean $getPages = true], CMS_page $page)
 static string getTreeString ( &$user,  $pageID, string $separator,  &$treeString)
 static boolean hasAncestor (integer $pageId, [boolean $publicTree = false])
 static boolean hasSiblings ( &$page, [boolean $publicTree = false], CMS_page $page)
 static boolean isAncestor ( &$ancestor,  &$page, [boolean $publicTree = false], CMS_page $ancestor, CMS_page $sibling)
 static boolean isInPublicTree (mixed $page)
 static string movePage ( &$page,  &$newFather, array $newSiblingOrder,  &$user, CMS_page $page, CMS_page $newFather, CMS_profile_user $user)
 static boolean pageExistsForUser ($pageID $pageID, $user 1)
 static mixed pagesExistsInUserSpace ($pagesID $pagesID)
 static boolean publishPageMove ( &$page, CMS_page $page)
 static boolean publishSiblingsOrder ( &$page, CMS_page $page)
 static void regenerateAllPages ([boolean $fromScratch = false])
 static boolean revertPageMove (CMS_page $page)
 static boolean revertSiblingsOrder (CMS_page $page)
 static void submitToRegenerator (mixed $pages, integer $fromScratch, [boolean $dontLaunchRegenerator = false])
Methods
static analyseURL (line 1731)

Return a valid page for a given URL

  • return: if page founded, false otherwise
  • access: public
static CMS_page analyseURL (string $pageUrl, [boolean $useDomain = true])
  • string $pageUrl: the page URL
  • boolean $useDomain: : use queried domain to found root page associated (default : true)
static attachPageToTree (line 1452)

Attach a page to the tree (references it in the linx_tree tables) Static function.

  • return: true on success, false on failure
  • access: private
static boolean attachPageToTree (mixed $page, mixed $ancestor, [boolean $publicTree = false])
  • mixed $page: The page to attach
  • mixed $ancestor: The father to attach to
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
static changePagesOrder (line 738)

Change pages order. Add the RESOURCE_EDITION_SIBLINGSORDER edition to the father.

Static function.

  • return: true on success, false on failure
  • access: public
static boolean changePagesOrder (array $newSiblingOrder,  &$user, CMS_profile_user $user)
  • CMS_profile_user $user: The user operating the change.
  • array $newSiblingOrder: of CMS_page id $newSiblingOrder The sibling pages to move in the good order
  • &$user
static changeSiblingOrder (line 1130)

Change a sibling order. Add the RESOURCE_EDITION_SIBLINGSORDER edition to the father.

Static function.

  • return: true on success, false on failure
  • access: public
static boolean changeSiblingOrder ( &$sibling, integer $moveOffset,  &$user, CMS_page $sibling, CMS_profile_user $user)
  • CMS_page $sibling: The sibling page to move
  • integer $moveOffset: The move offset : 1 to move it to the right, -1 to the left. No other values permitted.
  • CMS_profile_user $user: The user operating the change.
  • &$sibling
  • &$user
static compactSiblingOrder (line 1209)

Compact ordered list of siblings, prevent from blank intervals in the list of integers representing order. All orders must increase one by one to avoir bugs in reordering then.

Static function.

  • return: true on succes, false if error
  • access: public
static boolean compactSiblingOrder ( &$page, [ $publicTree = false], CMS_page $page)
  • CMS_page $page: The sibling page order list of siblings
  • &$page
  • $publicTree
static detachPageFromTree (line 1533)

Deletes a page from the tree (it will not be deleted, only detached).

Static function.

  • return: true on success, false on failure
  • access: public
static boolean detachPageFromTree ( &$page, [boolean $publicTree = false], CMS_page $page)
  • CMS_page $page: The page to delete
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
  • &$page
static getAllSiblings (line 455)

Returns all the siblings pages recursively.

Static function.

  • return: All siblings page id
  • access: public
static array(id) getAllSiblings (integer $pageID, [boolean $publicTree = false], [boolean $stopAtWebsites = false])
  • integer $pageID: The page we want he siblings of
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
  • boolean $stopAtWebsites: Do we want to fetch the tree of all websites or only the current one (default : false)
static getAncestor (line 677)

Returns the ancestor of the given page, at the given offset.

Offset : positive : 1 is for father, 2 for grand-father, and so on. negative : -1 for the root sibling, -2 for the root grand-son (which are ancestors of $page) Static function.

  • return: The ancestor, or false if not found
  • access: public
static CMS_page getAncestor ( &$page, integer $offset, [boolean $stopAtWebsites = false], [ $publicTree = false], CMS_page $page)
  • CMS_page $page: The page we want the brother of
  • integer $offset: The ancestor offset (negative, will be sibling from root
  • boolean $stopAtWebsites: Should the lineage stop at websites roots (other than the main website) ?
  • &$page
  • $publicTree
static getArchivedPagesData (line 1589)

Get all the archived pages data : title, reference (ID), lastFileCreation date Static function.

  • return: The basic attribute indexed by "title", "id", "lastFileCreation"
  • access: public
static array(string=>string) getArchivedPagesData ()
static getBrother (line 486)

Returns the brother of the given page, at the given brotherhood position.

Offset : positive for right-hand brothers, negative for left-hand brother. Static function.

  • return: The brother, or false if not found
  • access: public
static CMS_page getBrother ( &$page, integer $offset, [boolean $publicTree = false], CMS_page $page)
  • CMS_page $page: The page we want the brother of
  • integer $offset: The brotherhood offset
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
  • &$page
static getFather (line 642)

Returns page father Static function.

  • return: cms_page or page id
  • access: public
static mixed, getFather (mixed $page, [boolean $outputObject = false], [boolean $publicTree = false])
  • mixed $page: : the page id or the cms_page object to get father of
  • boolean $outputObject: : if true, return father as a cms_page object, otherwise, return father page Id (default false)
  • boolean $publicTree: : if true, return public father page, else, return edited father (default false : edited)
static getLineage (line 579)

Returns the ancestors of the given page to root, including root and the page.

Static function.

  • return: The ancestors, from root to the page. Minimum is array(rootpage) if lineage of root wanted. Return false if break in lineage or page is archived or deleted.
  • access: public
static array(CMS_page) getLineage (CMS_page $ancestor, CMS_page $page, [boolean $IO_CMS_page = true], [ $publicTree = false])
  • CMS_page $ancestor: The oldest ancestor we want
  • CMS_page $page: The page we want the lineage of
  • boolean $IO_CMS_page: if it false, then the Input arguments aren't CMS_page but only page ID and function return an array(pageID). (this is realy fastest)
  • $publicTree
static getPageByCodename (line 213)

Get a page by it's codename relative to a given website Static function.

  • return: integer / CMS_page : the page using the given codename
  • access: public
static mixed getPageByCodename ($page $codename, $website $website, [boolean $public = false], [$returnObject $returnObject = true])
  • boolean $public: Do we want to fetch the public tree or the edited one (default) ?
  • $page $codename: string : the page codename to get
  • $website $website: mixed integer / CMS_website : the website which codename is relative to
  • $returnObject $returnObject: boolean : does the method return a CMS_page (default) or the page Id
static getPageByID (line 63)

Returns a CMS_page when given an ID Static function.

  • return: or false on failure to find it
  • access: public
static CMS_page getPageByID (integer $id, [ $reset = false])
  • integer $id: The DB ID of the wanted CMS_page
  • $reset
static getPageCodenameValue (line 176)

Returns a queried CMS_page value identified by it's codename and a reference page to identify the requested website Static function.

  • return: or false on failure to find it
  • access: public
static CMS_page getPageCodenameValue (string $codename,  $referencePageId, string $type, integer $id)
  • string $codename: The codename of the wanted CMS_page
  • integer $id: The DB ID of the reference CMS_page. This id is used to get the website of reference
  • string $type: The value type to get
  • $referencePageId
static getPagesByCodename (line 258)

Get all pages for a given codename Static function.

  • return: integer / CMS_page : the page using the given codename
  • access: public
static mixed getPagesByCodename ($page $codename, [boolean $public = false], [$returnObject $returnObject = true])
  • boolean $public: Do we want to fetch the public tree or the edited one (default) ?
  • $page $codename: string : the page codename to get
  • $returnObject $returnObject: boolean : does the method return a CMS_page (default) or the page Id
static getPageValue (line 90)

Returns a queried CMS_page value Static function.

  • return: value or false on failure to find it
  • access: public
static CMS_page getPageValue (mixed $id, string $type, [boolean $public = true], [integer $currentPageId = null])
  • mixed $id: The DB ID of the wanted CMS_page or or "self" or the page codename ($currentPageId is mandatory in this case)
  • string $type: The value type to get
  • boolean $public: : public value or edited value (default : public)
  • integer $currentPageId: : the page reference (required if first parameter is not a page Id)
static getPageWebsite (line 1272)

Returns the website of a page Static function

  • return: or false on failure
  • access: public
static CMS_website getPageWebsite (mixed $page)
  • mixed $page: CMS_page or pageID $page : The page we want the website of
static getRoot (line 40)

Returns the CMS_page of the root. It MUST exists or else everything fails.

Static function.

  • return: The root page instance
  • access: public
static CMS_page getRoot ()
static getSiblings (line 379)

Returns all the siblings pages, sorted by sibling order.

Static function.

  • return: The siblings ordered
  • access: public
static array(CMS_page) getSiblings ( &$page, [boolean $publicTree = false], [boolean $getPages = true], CMS_page $page)
  • CMS_page $page: The page we want he siblings of (can accept the page ID instead of CMS_page)
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
  • boolean $getPages: if false, return only an array of sibling ID, else, return an array of sibling CMS_pages
  • &$page
static getTreeString (line 1631)

Get the tree string needed by the text edition applet

format is : pageID/roottitle/subroottitle/pagetitle:::[SAME AS BEFORE...] where ::: is the separator passed as argument Static function. Recursive function

  • return: the tree string
  • access: public
static string getTreeString ( &$user,  $pageID, string $separator,  &$treeString)
  • string $separator: The pages separator.
  • &$user
  • $pageID
  • &$treeString
static hasAncestor (line 1424)

Does the page has an ancestor ? Static function.

  • return: true or false
  • access: public
static boolean hasAncestor (integer $pageId, [boolean $publicTree = false])
  • integer $pageId: The page to check for ancestor
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
static hasSiblings (line 425)

Does given page has sibling ? Static function.

  • access: public
static boolean hasSiblings ( &$page, [boolean $publicTree = false], CMS_page $page)
  • CMS_page $page: The page we want he siblings of (can accept the page ID instead of CMS_page)
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
  • &$page
static isAncestor (line 715)

Is the page an ancetor of the other ? Static function.

  • return: true is there's a lineage beetween the two
  • access: public
static boolean isAncestor ( &$ancestor,  &$page, [boolean $publicTree = false], CMS_page $ancestor, CMS_page $sibling)
  • CMS_page $ancestor: The contested ancestor page
  • CMS_page $sibling: The sibling page
  • boolean $publicTree: Do we want to fetch the public tree or the edited one ?
  • &$ancestor
  • &$page
static isInPublicTree (line 544)

Returns true if the page is in the public tree Static function.

  • return: true on success, false if the page is not in the public tree
  • access: public
static boolean isInPublicTree (mixed $page)
  • mixed $page: The CMS_page to check or the page Id
static movePage (line 1314)

Move a page in the tree structure Static function.

  • return: The error string (abbreviated) or false if no error
  • access: public
static string movePage ( &$page,  &$newFather, array $newSiblingOrder,  &$user, CMS_page $page, CMS_page $newFather, CMS_profile_user $user)
  • CMS_page $page: The page to move
  • CMS_page $newFather: The new father of the page
  • CMS_profile_user $user: The user operating the change.
  • array $newSiblingOrder: of CMS_page id $newSiblingOrder The sibling pages to move in the good order
  • &$page
  • &$newFather
  • &$user
static pageExistsForUser (line 359)

Check if public page exists for given user Static function.

  • access: public
static boolean pageExistsForUser ($pageID $pageID, $user 1)
  • $user 1: CMS_profile_user : the user to check
  • $pageID $pageID: integer : the page id to check
static pagesExistsInUserSpace (line 307)

Check if page(s) exists and is(are) in userspace.

Static function.

  • return: boolean / array of page(s) id(s) in userspace
  • access: public
static mixed pagesExistsInUserSpace ($pagesID $pagesID)
  • $pagesID $pagesID: mixed integer / array of page(s) id(s) : the page(s) id(s) to check
static publishPageMove (line 1025)

Publish the move of a page : page new position pass from edited to public Static function.

  • return: true on success, false on failure
  • access: public
static boolean publishPageMove ( &$page, CMS_page $page)
  • CMS_page $page: The page which move
  • &$page
static publishSiblingsOrder (line 969)

Publish the siblings order of a page : all its siblings order will go from _edited to _public Static function.

  • return: true on success, false on failure
  • access: public
static boolean publishSiblingsOrder ( &$page, CMS_page $page)
  • CMS_page $page: The page whose siblings are well ordered
  • &$page
static regenerateAllPages (line 1375)

Regenerates all the pages AND make all re-register their links Static function.

  • access: public
static void regenerateAllPages ([boolean $fromScratch = false])
  • boolean $fromScratch: If set to true, all pages will rebuild their content and not only their linxes
static revertPageMove (line 873)

Revert page move from public state (used when a move is not validated).

This function must only be used on page which was already validated once Static function.

  • return: true on success, false on failure
  • access: public
static boolean revertPageMove (CMS_page $page)
  • CMS_page $page: The page to revert move
static revertSiblingsOrder (line 784)

Revert siblings order from public state (used when a reordering is not validated).

Take care to set never validated pages to the end of public order Static function.

  • return: true on success, false on failure
  • access: public
static boolean revertSiblingsOrder (CMS_page $page)
  • CMS_page $page: The pages to revert siblings order
static submitToRegenerator (line 1680)

Submit pages to the regenerator. The first argument can either be a single page ID or an array of those.

  • access: public
static void submitToRegenerator (mixed $pages, integer $fromScratch, [boolean $dontLaunchRegenerator = false])
  • mixed $pages: If it's a scalar, it's a page ID, else an array of pages IDs
  • integer $fromScratch: Is the submission concerning a full from scratch regeneration (true) or a regeneration from linx files (false) ?
  • boolean $dontLaunchRegenerator: to avoid multiple launch of the regenerator during multiple validation only the last page validation launch the script

Inherited Methods

Inherited From CMS_grandFather

 CMS_grandFather::autoload()
 CMS_grandFather::hasError()
 CMS_grandFather::log()
 CMS_grandFather::PHPErrorHandler()
 CMS_grandFather::raiseError()
 CMS_grandFather::setDebug()
 CMS_grandFather::setLog()
 CMS_grandFather::_raiseError()
 CMS_grandFather::__call()
Class Constants

Documentation generated on Wed, 15 Feb 2012 15:40:25 +0100 by phpDocumentor 1.4.3