예제 #1
0
 protected function BeforeInit()
 {
     $this->layout = Layout::Schema()->ByID(Request::GetData('layout'));
     if (!$this->layout) {
         //TODO: Message
         Response::Redirect($this->BackLink());
     }
     $this->file = PathUtil::LayoutTemplate($this->layout);
     if (!File::Exists($this->file)) {
         //TODO: Message
         Response::Redirect($this->BackLink());
     }
     $this->contents = File::GetContents($this->file);
     return parent::BeforeInit();
 }
예제 #2
0
 /**
  * Gets the layout that is requested to be removed
  * @return Layout The removal layout
  */
 protected function RemovalObject()
 {
     $id = Request::PostData('delete');
     return $id ? Layout::Schema()->ByID($id) : null;
 }
예제 #3
0
 /**
  * Adds the layout field to the form
  */
 private function AddLayoutField()
 {
     $name = 'Layout';
     $select = new Select($name);
     if ($this->page->Exists()) {
         $select->SetValue($this->page->GetLayout()->GetID());
     }
     $select->AddOption('', Trans('Core.PleaseSelect'));
     $sql = Access::SqlBuilder();
     $tbl = Layout::Schema()->Table();
     $order = $sql->OrderList($sql->OrderAsc($tbl->Field('Name')));
     $layouts = Layout::Schema()->Fetch(false, null, $order);
     foreach ($layouts as $layout) {
         $select->AddOption($layout->GetID(), $layout->GetName());
     }
     $this->AddField($select);
     $this->SetRequired($name);
 }