示例#1
0
 protected function initializeSiteTemplate()
 {
     $siteTemplateId = null;
     $request = $this->getRequest();
     $previewSiteTemplate = $request->get("bitrix_preview_site_template");
     if (!empty($previewSiteTemplate) && $GLOBALS["USER"]->canDoOperation('view_other_settings')) {
         $recordset = SiteTemplateTable::getById($previewSiteTemplate);
         if ($record = $recordset->Fetch()) {
             $siteTemplateId = (int) $record["ID"];
         }
     }
     if ($siteTemplateId === null) {
         if ($this->site == null) {
             throw new NotSupportedException("Site must be initialized first");
         }
         $siteTemplateId = SiteTemplateTable::getCurrentTemplateId($this->site->getId());
     }
     // deprecated
     define("SITE_TEMPLATE_ID", $siteTemplateId);
     define("SITE_TEMPLATE_PATH", BX_PERSONAL_ROOT . '/templates/' . SITE_TEMPLATE_ID);
     $this->siteTemplate = new SiteTemplate($siteTemplateId);
 }
示例#2
0
 protected function initializeCulture()
 {
     $context = $this->getContext();
     $context->setCulture($this->site->getCulture());
     $context->setLanguage($this->site->getLanguage());
 }