API:getAllChildren
From MODx Wiki
API Function Definition:
getAllChildren
- Versions
- > ?
- Return Values
- Success:
- Fail:
- Data Type
- array
- Object Hierarchy
- DocumentParser
array getAllChildren(mixed $id[, string $sort[, string $dir[, string $fields]]]);
$modx->getAllChildren($id= 0, $sort= 'menuindex', $dir= 'ASC', $fields= 'id, pagetitle, description, parent, alias, menutitle')
Gets all child documents of the specified document, including those which are unpublished or deleted.
To get only published document, see getActiveChildren.
Examples
Function Source
| File: | manager/includes/document.parser.inc.php |
|---|---|
| Line: | 1312 |
function getAllChildren($id= 0, $sort= 'menuindex', $dir= 'ASC', $fields= 'id, pagetitle, description, parent, alias, menutitle') { $tblsc= $this->getFullTableName("site_content"); $tbldg= $this->getFullTableName("document_groups"); // modify field names to use sc. table reference // get document groups for current user if ($docgrp= $this->getUserDocGroups()) // build query $access= ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); $sql= "SELECT DISTINCT $fields FROM $tblsc sc LEFT JOIN $tbldg dg on dg.document = sc.id WHERE sc.parent = '$id' AND ($access) GROUP BY sc.id ORDER BY $sort $dir;"; $result= $this->dbQuery($sql); for ($i= 0; $i < @ $this->recordCount($result); $i++) { } return $resourceArray; }