getAllChildren

API Quick reference
Variable name: getAllChildren
CMS versions: Evo
Variable type: array
Object parent:

API:getAllChildren

Description

array getAllChildren(mixed $id[, string $sort[, string $dir[, string $fields]]]);

Gets all child documents of the specified document, including those which are unpublished or deleted.

Related

Function Source

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
$fields= 'sc.' . implode(',sc.', preg_replace("/^\s/i", "", explode(',', $fields)));
$sort= 'sc.' . implode(',sc.', preg_replace("/^\s/i", "", explode(',', $sort)));
// get document groups for current user
if ($docgrp= $this->getUserDocGroups())
$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->db->query($sql);
$resourceArray= array ();
for ($i= 0; $i < @ $this->db->getRecordCount($result); $i++) {
array_push($resourceArray, @ $this->db->getRow($result));
}
return $resourceArray;
}

Suggest an edit to this page.