/** * Initializes the list * @return boolean */ protected function Init() { $this->layout = new Layout(Request::GetData('layout')); if (!$this->layout->Exists()) { Response::Redirect(BackendRouter::ModuleUrl(new LayoutList())); return true; } $this->listProvider = new AreaListProvider($this->layout); $this->area = $this->listProvider->TopMost(); $this->hasAreas = (bool) $this->area; return parent::Init(); }
/** * Saves the layout */ protected function OnSuccess() { $action = Action::Update(); $isNew = !$this->layout->Exists(); if ($isNew) { $action = Action::Create(); $this->layout->SetUser(self::Guard()->GetUser()); } $oldFile = $isNew ? '' : PathUtil::LayoutTemplate($this->layout); $this->layout->SetName($this->Value('Name')); $this->layout->Save(); $logger = new Logger(self::Guard()->GetUser()); $logger->ReportLayoutAction($this->layout, $action); if ($this->CanAssignGroup()) { $this->SaveRights(); } if ($isNew) { $this->SaveAreas(); } $this->UpdateFiles($oldFile); $args = array('layout' => $this->layout->GetID()); Response::Redirect(BackendRouter::ModuleUrl(new AreaList(), $args)); }