/** * Accepts array('info' => [page info array], all options accepted by getPagesInfo except where) * @param mixed $options * @return mixed */ public static function getPeerInfo($options) { $id = $options['info']['id']; if (!isset(aPageTable::$peersInfo[$id])) { // Even if the parent is archived we need to know our true peers $parentInfo = aPageTable::getParentInfo(array_merge($options, array('ignore_permissions' => true))); if (!$parentInfo) { // It's the home page. Return a stub: the home page is its only peer aPageTable::$peersInfo[$id] = array(aPageTable::getInfo($options)); } else { $lft = $parentInfo['lft']; $rgt = $parentInfo['rgt']; $level = $parentInfo['level'] + 1; aPageTable::$peersInfo[$id] = aPageTable::getPagesInfo(array_merge($options, array('where' => '(( p.lft > ' . $lft . ' AND p.rgt < ' . $rgt . ' ) AND (level = ' . $level . '))'))); } } return aPageTable::$peersInfo[$id]; }
/** * DOCUMENT ME * @return mixed */ public function getParentInfo() { return aPageTable::getParentInfo(array('info' => $this->getInfo())); }