/**
  * Deletes the navi items related to the page
  * @param Page $item The page to be deleted
  */
 public function BeforeDelete($item)
 {
     $navPages = NavigationPage::Schema()->FetchByPage(false, $item);
     foreach ($navPages as $navPage) {
         $item = $navPage->GetItem();
         $tree = new TreeBuilder(new NavigationTreeProvider($item->GetNavigation()));
         $tree->Remove($item);
     }
 }
 /**
  * Deletes the container contents related to the container
  * @param Container $item The container to be deleted
  */
 public function BeforeDelete($item)
 {
     $contContainers = ContentContainer::Schema()->FetchByContainer(true, $item);
     $logger = new Logger(BackendModule::Guard()->GetUser());
     foreach ($contContainers as $contContainer) {
         $content = $contContainer->GetContent();
         $provider = ContentTreeUtil::GetTreeProvider($content);
         $tree = new TreeBuilder($provider);
         $logger->ReportContentAction($content, Action::Delete());
         $tree->Remove($provider->ItemByContent($content));
     }
 }
 protected function OnSuccess()
 {
     //$isNew = !$this->naviItem->Exists();
     $this->naviItem->SetName($this->Value('Name'));
     $this->naviItem->SetNavigation($this->navi);
     if (!$this->naviItem->Exists()) {
         $this->tree->Insert($this->naviItem, $this->parent, $this->previous);
     } else {
         $this->naviItem->Save();
     }
     if ($this->Value('Type') == 'PageItem') {
         $this->naviItem->SetPageItem($this->selector->Save($this->naviItem->GetPageItem()));
         $this->naviItem->Save();
         //$pageItem = $this->SavePageItem();
         //$this->SavePageParams($pageItem);
     } else {
         $this->SaveUrlItem();
     }
     $this->Redirect();
 }
Example #4
0
 /**
  * Attaches the content to the container
  * @param boolean $isNew
  */
 private function AttachContainerContent($isNew)
 {
     $provider = new ContainerContentTreeProvider($this->Container());
     $tree = new TreeBuilder($provider);
     $containerContent = $this->Content()->GetContainerContent();
     if (!$containerContent) {
         $containerContent = new ContainerContent();
         $containerContent->SetContainer($this->Container());
         $provider->AttachContent($containerContent, $this->Content());
     }
     if ($isNew) {
         $tree->Insert($containerContent, $this->ParentItem(), $this->PreviousItem());
     }
 }
Example #5
0
 /**
  * Takes care of page tree insertion important for a fresh page
  */
 private function SaveNew()
 {
     $treeBuilder = new TreeBuilder(new PageTreeProvider($this->site));
     $treeBuilder->Insert($this->page, $this->parent, $this->previous);
 }
Example #6
0
 protected function Delete()
 {
     $this->tree->Remove($this->item);
 }