/** * Gets the first and root page of the site * @return Page */ public function TopMost() { $sql = Access::SqlBuilder(); $tbl = Page::Schema()->Table(); $where = $sql->Equals($tbl->Field('Site'), $sql->Value($this->site->GetID()))->And_($sql->IsNull($tbl->Field('Parent')))->And_($sql->IsNull($tbl->Field('Previous'))); return Page::Schema()->First($where); }
protected function OpenUrl() { $args = array('pageOnly' => '1'); if (count($this->disabledPageIDs) > 0) { $args['disabled'] = $this->disabledPageIDs; } if ($this->site) { $args['site'] = $this->site->GetID(); } return BackendRouter::AjaxUrl(new AjaxSelectPage(), $args); }
private function InitSites() { $siteID = Request::GetData('site'); if ($siteID) { $this->sites = array(Site::Schema()->ByID($siteID)); return; } $sql = Access::SqlBuilder(); $tblSite = Site::Schema()->Table(); $orderBy = $sql->OrderList($sql->OrderAsc($tblSite->Field('Name'))); $this->sites = Site::Schema()->Fetch(false, null, $orderBy); }
/** * The link for the back button * @return string Returns the url to the page tree */ protected function BackLink() { $params = array('site' => $this->site->GetID()); if ($this->page->Exists()) { $params['selected'] = $this->page->GetID(); } else { if ($this->previous) { $params['selected'] = $this->previous->GetID(); } else { if ($this->parent) { $params['selected'] = $this->parent->GetID(); } } } return BackendRouter::ModuleUrl(new PageTree(), $params); }
private function SaveRights() { $groupID = $this->Value('UserGroup'); $userGroup = Usergroup::Schema()->ByID($groupID); $this->site->SetUserGroup($userGroup); if (!$userGroup) { $oldRights = $this->site->GetUserGroupRights(); if ($oldRights) { $oldRights->GetPageRights()->GetContentRights()->Delete(); } $this->site->SetUserGroupRights(null); } else { $this->siteRights->Save(); $this->site->SetUserGroupRights($this->siteRights->Rights()); } $this->site->Save(); }
/** * Finds the 404 page for a site * @param Site $site The site whise 404 page is searched for * @return Page The 404 page */ static function Page404(Site $site) { $sql = Access::SqlBuilder(); $tblPage = Page::Schema()->Table(); $where = $sql->Equals($tblPage->Field('Type'), $sql->Value((string) PageType::NotFound()))->And_($sql->Equals($tblPage->Field('Site'), $sql->Value($site->GetID()))); return Page::Schema()->First($where); }
/** * Loads backend translations of the bundle */ private function LoadFrontendTranslations(Site $site) { $language = $site->GetLanguage()->GetCode(); $frontendTranslations = PathUtil::FrontendBundleTranslationFile($this->BundleName(), $language); if (File::Exists($frontendTranslations)) { require_once $frontendTranslations; } }
/** * Returns the page tree url of a site * @param Site $site The site * @return string The url of the page tree */ protected function PageTreeUrl(Site $site) { $args = array('site' => $site->GetID()); return BackendRouter::ModuleUrl(new PageTree(), $args); }
/** * Grant evaluation for adding a page on top of the site * @param Site $site The site * @return GrantResult The result */ function GrantAddPageToSite(Site $site) { //Dummy page for evaluation $page = new Page(); $page->SetUserGroup($site->GetUserGroup()); $siteRights = $site->GetUserGroupRights(); if ($siteRights) { $page->SetUserGroupRights($siteRights->GetPageRights()); } return $this->Grant(BackendAction::Create(), $page); }
protected function CreateFormUrl() { $module = new PageForm(); $args = array('site' => $this->site->GetID()); return BackendRouter::ModuleUrl($module, $args); }
/** * The name of the cache file of the * @param Site $site The site * @return string Returns the full file path of the sitemap cache file */ static function SitemapCacheFile(Site $site) { $cacheFolder = Path::Combine(PHINE_PATH, 'Cache/Sitemap'); $filename = Path::AddExtension($site->GetID(), 'xml'); return Path::Combine($cacheFolder, $filename); }
/** * Gets the rewrite condition for the site specific folder; if present * @param Site $site * @return RewriteCondition */ private function SiteFolderCondition(Site $site) { $siteUrl = $site->GetUrl(); $siteFolder = parse_url($siteUrl, PHP_URL_PATH); if ($siteFolder != '' && $siteFolder != '/') { return new RewriteCondition(new Variable(ServerVariable::RequestUri()), '^' . $siteFolder); } return null; }