/** * Deletes the container contents related to the container * @param Container $item The container to be deleted */ public function BeforeDelete($item) { $contContainers = ContentContainer::Schema()->FetchByContainer(true, $item); $logger = new Logger(BackendModule::Guard()->GetUser()); foreach ($contContainers as $contContainer) { $content = $contContainer->GetContent(); $provider = ContentTreeUtil::GetTreeProvider($content); $tree = new TreeBuilder($provider); $logger->ReportContentAction($content, Action::Delete()); $tree->Remove($provider->ItemByContent($content)); } }
protected function BeforeDelete() { $logger = new Logger(BackendModule::Guard()->GetUser()); $logger->ReportContentAction($this->TreeProvider()->ContentByItem($this->item), Action::Delete()); }
/** * Saves content base properties */ private function SaveContent() { $this->Content()->SetType($this->FrontendModule()->MyType()); $this->Content()->SetCssClass($this->Value('CssClass')); $this->Content()->SetCssID($this->Value('CssID')); $this->Content()->SetTemplate($this->Value('Template')); $this->Content()->SetCacheLifetime((int) $this->Value('CacheLifetime')); $this->Content()->SetGuestsOnly((bool) $this->Value('GuestsOnly')); if ($this->AutoPublish()) { $this->Content()->SetPublish(true); } else { $this->Content()->SetPublish((bool) $this->Value('Publish')); } $this->Content()->SetPublishFrom($this->PublishDate('PublishFrom')); $this->Content()->SetPublishTo($this->PublishDate('PublishTo')); $action = Action::Update(); if (!$this->Content()->Exists()) { $action = Action::Create(); $this->Content()->SetUser(self::Guard()->GetUser()); } $this->Content()->Save(); $logger = new Logger(self::Guard()->GetUser()); $logger->ReportContentAction($this->Content(), $action); if ($this->CanAssignGroup()) { $this->SaveRights(); } $this->SaveMemberGroups(); $this->SaveWordings(); }