protected function Init() { $this->container = new Container(Request::GetData('container')); $selectedID = Request::GetData('selected'); $this->selected = $selectedID ? ContainerContent::Schema()->ByID($selectedID) : null; if (!$this->container->Exists()) { //TODO: error Response::Redirect(BackendRouter::ModuleUrl(new ContainerList())); return true; } $this->tree = new ContainerContentTreeProvider($this->container); $this->containerContent = $this->tree->TopMost(); $this->hasContents = (bool) $this->containerContent; return parent::Init(); }
/** * Saves the container */ protected function OnSuccess() { $action = Action::Update(); if (!$this->container->Exists()) { $action = Action::Create(); $this->container->SetUser(self::Guard()->GetUser()); } $this->container->SetName($this->Value('Name')); $this->container->Save(); $logger = new Logger(self::Guard()->GetUser()); $logger->ReportContainerAction($this->container, $action); if ($this->CanAssignGroup()) { $this->SaveRights(); } Response::Redirect(BackendRouter::ModuleUrl(new ContainerList())); }