model_name = inflector::singular($this->table_name); } /** * Return the parent of this node * * @return ORM */ function parent() { if( user_chroot::album() && user_chroot::album()->id == $this->id ) { return null; } else { return parent::parent(); } } /** * Return all the parents of this node, in order from root to this node's immediate parent. * * @return array ORM */ function parents() { $select = $this ->where('left_ptr', '<=', $this->left_ptr) ->where('right_ptr', '>=', $this->right_ptr) ->where('id', '<>', $this->id) ->order_by('left_ptr', 'ASC'); if( user_chroot::album() ) { $select->where('left_ptr', '>=', user_chroot::album()->left_ptr); $select->where('right_ptr', '<=', user_chroot::album()->right_ptr); } return $select->find_all(); } }