예제 #1
0
 /**
  * Initializes the html frontend module
  * @return boolean
  */
 protected function Init()
 {
     $htmlWrap = ContentHtmlWrap::Schema()->ByContent($this->content);
     $this->html = $htmlWrap->GetHtml();
     $this->currentChild = $this->tree->FirstChildOf($this->item);
     return parent::Init();
 }
예제 #2
0
 /**
  * Initializes the repeater frontend module
  * @return boolean Returns tru
  */
 protected function Init()
 {
     $this->repeater = ContentRepeater::Schema()->ByContent($this->content);
     $this->current = $this->tree->FirstChildOf($this->item);
     $this->isEmpty = !$this->current;
     return parent::Init();
 }
예제 #3
0
 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);
 }
예제 #4
0
 /**
  * Initializes the html frontend module
  * @return boolean
  */
 protected function Init()
 {
     $contentContainer = ContentContainer::Schema()->ByContent($this->content);
     $tree = new ContainerContentTreeProvider($contentContainer->GetContainer());
     $renderer = new ContentsRenderer($tree->TopMost(), $tree);
     $this->contents = $renderer->Render();
     return parent::Init();
 }
예제 #5
0
 protected function Init()
 {
     $this->navi = ContentNavigation::Schema()->ByContent($this->content);
     $this->naviTree = new NavigationTreeProvider($this->navi);
     $this->level = 0;
     $this->naviItem = $this->naviTree->FirstChildOf($this->naviParent);
     $this->isEmpty = $this->naviItem == null;
     $this->CalcLevel();
     return parent::Init();
 }
예제 #6
0
 protected function Init()
 {
     if (self::Guard()->Accessor()->IsUndefined()) {
         return true;
     }
     $this->logout = ContentLogout::Schema()->ByContent($this->Content());
     $this->triggerName = 'Logout-' . $this->Content()->GetID();
     $this->HandlePost();
     return parent::Init();
 }
예제 #7
0
 /**
  * Initializes the confirm element
  * @return boolean Returns true if redirect happens
  */
 protected function Init()
 {
     $this->confirm = ContentRegisterConfirm::Schema()->ByContent($this->Content());
     $this->confirmer = new Confirmer();
     $this->isValid = $this->confirmer->Check(Request::GetArray());
     if ($this->isValid) {
         $this->OnSuccess();
     } else {
         if ($this->confirm->GetErrorUrl()) {
             Response::Redirect(FrontendRouter::Url($this->confirm->GetErrorUrl()));
             return true;
         }
     }
     return parent::Init();
 }
예제 #8
0
 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);
 }
예제 #9
0
 protected function BeforeGather()
 {
     \header('Content-Type: application\\json');
     return parent::BeforeGather();
 }
예제 #10
0
 /**
  * Initializes the html code frontend module
  * @return boolean
  */
 protected function Init()
 {
     $htmlCode = ContentHtmlCode::Schema()->ByContent($this->content);
     $this->code = $htmlCode->GetCode();
     return parent::Init();
 }
예제 #11
0
 /**
  * Initializes the html frontend module
  * @return boolean
  */
 protected function Init()
 {
     $html = ContentHtml::Schema()->ByContent($this->content);
     $this->html = $html->GetHtml();
     return parent::Init();
 }
예제 #12
0
 /**
  * True if the the content can be edited
  * @return Boolean
  */
 protected final function CanEdit()
 {
     $form = $this->module->ContentForm();
     return BackendModule::Guard()->Allow(BackendAction::Edit(), $this->content) && BackendModule::Guard()->Allow(BackendAction::Read(), $form);
 }
예제 #13
0
 /**
  * The name of the cache file
  * @param FrontendModule $module
  * @return string The name of the cache file, it needn't exist yet
  * @throws \Exception Raises an error in case the cache key is not alphanumeric
  */
 static function ContentCacheFile(FrontendModule $module)
 {
     $file = $module->Content()->GetID();
     $cacheKey = $module->CacheKey();
     if ($cacheKey) {
         if (!ctype_alnum($cacheKey)) {
             throw new \Exception(Trans('Core.CacheKey.Error.NotAlphaNumeric'));
         }
         $file .= '-' . $cacheKey;
     }
     $cacheFolder = Path::Combine(PHINE_PATH, 'Cache/Content');
     return Path::AddExtension(Path::Combine($cacheFolder, $file), 'phtml');
 }
예제 #14
0
 /**
  * Initializes the html frontend module
  * @return boolean
  */
 protected function Init()
 {
     $block = ContentBlock::Schema()->ByContent($this->content);
     $this->tag = $block->GetTagName();
     return parent::Init();
 }