示例#1
0
 /**
  * Inserts the item
  * @param mixed $item
  * @param mixed $parent
  * @param mixed $previous
  */
 function Insert($item, $parent = null, $previous = null)
 {
     if ($previous) {
         $parent = $this->provider->ParentOf($previous);
     }
     $oldNext = $this->provider->NextOf($item);
     $oldPrev = $this->provider->PreviousOf($item);
     $oldFirst = $this->provider->FirstChildOf($parent);
     if (!($oldPrev && $previous && $this->provider->Equals($oldPrev, $previous))) {
         $this->CloseCutGap($oldPrev, $oldNext, $item);
     }
     $this->UpdateInsertItem($item, $parent, $previous);
     if (!$previous) {
         $this->AssureFirstChild($item, $oldFirst);
     }
 }
示例#2
0
 /**
  * True if there can be content created after
  * @return boolean
  */
 protected final function CanCreateAfter()
 {
     $parentItem = $this->tree->ParentOf($this->item);
     if ($parentItem) {
         $parent = $this->tree->ContentByItem($parentItem);
         return BackendModule::Guard()->Allow(BackendAction::Create(), $parent);
     }
     return $this->GrantCreateInRoot()->ToBool();
 }