/**
  * 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));
     }
 }
Beispiel #2
0
 /**
  * Finds the content rigths by searching in element tree
  * @param Content $content The content
  * @return BackendContentRights The rights of the contents
  */
 static function FindContentRights(Content $content)
 {
     $result = null;
     $currContent = $content;
     do {
         $result = $currContent->GetUserGroupRights();
         $currContent = ContentTreeUtil::ParentOf($currContent);
     } while (!$result && $currContent);
     if ($result) {
         return $result;
     }
     return self::GetUpperContentRights($content);
 }
Beispiel #3
0
 /**
  *  Finds the parent rights
  *  @return BackendContentRights
  */
 private function FindParentRights()
 {
     $parentRights = null;
     $parentContent = $this->Content()->Exists() ? ContentTreeUtil::ParentOf($this->Content()) : null;
     if ($parentContent) {
         $parentRights = RightsFinder::FindContentRights($parentContent);
     }
     if (!$parentRights) {
         switch ($this->Location()) {
             case Enums\ContentLocation::Page():
                 $pageRights = RightsFinder::FindPageRights($this->Page());
                 $parentRights = $pageRights ? $pageRights->GetContentRights() : null;
                 break;
             case Enums\ContentLocation::Layout():
                 $layoutRights = $this->Area()->GetLayout()->GetUserGroupRights();
                 $parentRights = $layoutRights ? $layoutRights->GetContentRights() : null;
                 break;
             case Enums\ContentLocation::Container():
                 $containerRights = $this->Container()->GetUserGroupRights();
                 $parentRights = $containerRights ? $containerRights->GetContentRights() : null;
                 break;
         }
     }
     return $parentRights;
 }