Exemplo n.º 1
0
 public function getNextTo(PageInterface $page, $direction)
 {
     $params = $this->params;
     if (isset($params['parent'])) {
         unset($params['parent']);
     }
     $params['parentid'] = $page->getParentId();
     $params['nextto'] = [$page, $direction];
     $finder = $this->addFilters(new Finder\Finder(), $params);
     return $finder->find();
 }
Exemplo n.º 2
0
 public function lookupPagePermission(Person $person, $role, Page $page)
 {
     // Page permissions are prefixed with p_ so add the prefix if it's not present.
     if (substr($role, 0, 2) !== 'p_') {
         $role = 'p_' . $role;
     }
     do {
         $result = $this->doLookup($person, $role, $page->getId());
         if ($page->getParentId() === null) {
             break;
         }
         if ($result === null) {
             $page = $page->getParent();
         }
     } while ($result === null && $page !== null);
     return (bool) $result;
 }
Exemplo n.º 3
0
 /**
  * @param PageInterface $parent
  *
  * @return $this
  */
 public function setParent(PageInterface $parent)
 {
     if (!$parent->is($this) && $parent->getParentId() !== $this->getId()) {
         $this->{self::ATTR_PARENT} = $parent->getId();
     }
     return $this;
 }