Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement