public function fetchOrganisation() {
return $this->isDescendantOf($this);
}
public function MyParentPage($rec){
return $rec->Parent();
}
/**
* Determine if page record is a descendant of the given page ID
* @param $rec page instance
* @param $parentID page (parent) ID
* @return boolean
**/
public function isDescendantOf($rec) {
$rec = $rec;
if($rec->ParentID == 0) return $rec;
while( $rec->ParentID > 0 ){
$rec = $this->MyParentPage( $rec );
if($rec->ParentID == 0) return $rec;
}
}
public function MyParentPage($rec){
return $rec->Parent();
}
/**
* Determine if page record is a descendant of the given page ID
* @param $rec page instance
* @param $parentID page (parent) ID
* @return boolean
**/
public function isDescendantOf($rec, $parentID) {
$rec = $rec;
if($rec->ParentID == $parentID) return true;
while( $rec->ParentID > 0 ){
$rec = $this->MyParentPage( $rec );
if($rec->ParentID == $parentID) return true;
}
}