/** * Renders the content * @return string Returns the rendered content */ function Render() { if (!self::Guard()->Allow(Action::Read(), $this->content)) { return ''; } ContentTranslator::Singleton()->SetContent($this->content); $module = ClassFinder::CreateFrontendModule($this->content->GetType()); $module->SetTreeItem($this->tree, $this->item); return $module->Render(); }
/** * 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; }
/** * * 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; }
/** * 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); } }
protected final function EditUrl() { if ($this->editUrl === null) { $contentForm = $this->module->ContentForm(); if (!$contentForm) { $this->editUrl = ''; } else { $args = array('content' => $this->content->GetID()); $args += $this->EditParams(); $this->editUrl = BackendRouter::ModuleUrl($contentForm, $args); } } return $this->editUrl; }
/** * 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; }
protected function UpdateUsages($newTemplate) { $sql = Access::SqlBuilder(); $tblContent = Content::Schema()->Table(); $where = $sql->Equals($tblContent->Field('Template'), $sql->Value($this->template))->And_($sql->Equals($tblContent->Field('Type'), $sql->Value($this->module->MyType()))); $setList = $sql->SetList('Template', $sql->Value($newTemplate)); Content::Schema()->Update($setList, $where); }
private function DeleteUsages(FrontendModule $module, $templateName) { $sql = Access::SqlBuilder(); $tblContent = Content::Schema()->Table(); $where = $sql->Equals($tblContent->Field('Type'), $sql->Value($module->MyType()))->And_($sql->Equals($tblContent->Field('Template'), $sql->Value($templateName))); $setList = $sql->SetList('Template', $sql->Value('')); Content::Schema()->Update($setList, $where); }
/** * * @param Content $content * @return type */ public function ItemByContent(Content $content) { return $content->GetContainerContent(); }
public function ItemByContent(Content $content) { return $content->GetLayoutContent(); }
/** * Gets the associated page content by content * @param Content $content * @return PageContent Returns the page content */ public function ItemByContent(Content $content) { return $content->GetPageContent(); }
/** * Grant evaluation for adding content on top of a container * @param Container $container The container * @return GrantResult Returns the grant result telling if creation is allowed */ function GrantAddContentToContainer(Container $container) { //dummy content for evaluation $content = new Content(); $content->SetUserGroup($container->GetUserGroup()); $containerRights = $container->GetUserGroupRights(); if ($containerRights) { $content->SetUserGroupRights($containerRights->GetContentRights()); } return $this->Grant(BackendAction::Create(), $content); }
/** * Gets the content's member groups * @param Content $content * @return Membergroup[] Returns the member groups assigned to the content */ static function ContentMembergroups(Content $content) { if (!$content->Exists()) { return array(); } $sql = Access::SqlBuilder(); $tblCmg = ContentMembergroup::Schema()->Table(); $tblMg = Membergroup::Schema()->Table(); $join = $sql->Join($tblCmg); $joinCondition = $sql->Equals($tblCmg->Field('MemberGroup'), $tblMg->Field('ID')); $where = $sql->Equals($tblCmg->Field('Content'), $sql->Value($content->GetID())); $orderBy = $sql->OrderList($sql->OrderAsc($tblMg->Field('Name'))); return Membergroup::Schema()->Fetch(false, $where, $orderBy, null, 0, null, $join, JoinType::Inner(), $joinCondition); }
private function MustStoreToCache() { return $this->content->GetCacheLifetime() > 0; }
/** * The last log item that is directly related to the content * @param Content $content The content * @return LogItem Returns the log item */ static function LastContentLog(Content $content) { $tblLogContent = LogContent::Schema()->Table(); $tblLogItem = LogItem::Schema()->Table(); $sql = Access::SqlBuilder(); $orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed'))); $joinCond = $sql->Equals($tblLogContent->Field('LogItem'), $tblLogItem->Field('ID')); $where = $sql->Equals($tblLogContent->Field('Content'), $sql->Value($content->GetID())); return LogItem::Schema()->First($where, $orderBy, null, $sql->Join($tblLogContent), JoinType::Inner(), $joinCond); }