Ejemplo n.º 1
0
 /**
  * Gets the content rights of the upper, containing element (page, layout, container) 
  * @param Content $content The content
  * @return BackendContentRights Returns the assigned content rights
  */
 private function GetUpperContentRights(Content $content)
 {
     if ($content->GetPageContent()) {
         $area = $content->GetPageContent()->GetArea();
         if ($area->GetLocked()) {
             return null;
         }
         $pageRights = self::FindPageRights($content->GetPageContent()->GetPage());
         if ($pageRights) {
             return $pageRights->GetContentRights();
         }
     } else {
         if ($content->GetLayoutContent()) {
             $area = $content->GetLayoutContent()->GetArea();
             if ($area->GetLocked()) {
                 return null;
             }
             $layoutRights = $content->GetLayoutContent()->GetArea()->GetLayout()->GetUserGroupRights();
             if ($layoutRights) {
                 return $layoutRights->GetContentRights();
             }
         } else {
             if ($content->GetContainerContent()) {
                 $containerRights = $content->GetContainerContent()->GetContainer()->GetUserGroupRights();
                 if ($containerRights) {
                     return $containerRights->GetContentRights();
                 }
             }
         }
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * 
  * Chooses the right provider for the content
  * @return IContentTreeProvider
  */
 static function GetTreeProvider(Content $content)
 {
     if ($content->GetPageContent()) {
         return new PageContentTreeProvider($content->GetPageContent()->GetPage(), $content->GetPageContent()->GetArea());
     }
     if ($content->GetLayoutContent()) {
         return new LayoutContentTreeProvider($content->GetLayoutContent()->GetArea());
     }
     if ($content->GetContainerContent()) {
         return new ContainerContentTreeProvider($content->GetContainerContent()->GetContainer());
     }
     return null;
 }
Ejemplo n.º 3
0
 /**
  * Gets the upper countent user group
  * @param Content $content The content
  * @return Usergroup Gets the content rights of the upper, containing element (layout, page, container)
  */
 private static function GetUpperContentGroup(Content $content)
 {
     if ($content->GetPageContent()) {
         return self::FindPageGroup($content->GetPageContent()->GetPage());
     } else {
         if ($content->GetLayoutContent()) {
             return $content->GetLayoutContent()->GetArea()->GetLayout()->GetUserGroup();
         } else {
             if ($content->GetContainerContent()) {
                 return $content->GetContainerContent()->GetContainer()->GetUserGroup();
             }
         }
     }
     return null;
 }
Ejemplo n.º 4
0
 private function RenderPageChildren()
 {
     $pageContent = $this->content->GetPageContent();
     $provider = new PageContentTreeProvider($pageContent->GetPage(), $pageContent->GetArea());
     $renderer = new ContentsRenderer($provider->FirstChildOf($pageContent), $provider);
     return $renderer->Render();
 }
Ejemplo n.º 5
0
 /**
  * Gets the url of the content tree for a content element
  * @param Content $content
  * @return string
  */
 static function ContentTreeUrl(Content $content)
 {
     $args = array();
     $pageContent = $content->GetPageContent();
     if ($pageContent) {
         $args['page'] = $pageContent->GetPage()->GetID();
         $args['area'] = $pageContent->GetArea()->GetID();
         return self::ModuleUrl(new \Phine\Bundles\Core\Modules\Backend\PageContentTree(), $args);
     }
     $layoutContent = $content->GetLayoutContent();
     if ($layoutContent) {
         $args['area'] = $layoutContent->GetArea()->GetID();
         return self::ModuleUrl(new \Phine\Bundles\Core\Modules\Backend\LayoutContentTree(), $args);
     }
     $containerContent = $content->GetContainerContent();
     if ($containerContent) {
         $args['container'] = $containerContent->GetContainer()->GetID();
         return self::ModuleUrl(new \Phine\Bundles\Core\Modules\Backend\ContainerContentTree(), $args);
     }
 }
 /**
  * Gets the associated page content by content
  * @param Content $content
  * @return PageContent Returns the page content
  */
 public function ItemByContent(Content $content)
 {
     return $content->GetPageContent();
 }