/** * Execute delete hooks */ protected function BeforeDelete() { foreach (self::$deleteHooks as $hook) { $hook->BeforeDelete($this->item); } $logger = new Logger(BackendModule::Guard()->GetUser()); $logger->ReportAreaAction($this->item, Action::Delete()); }
/** * 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)); } }
/** * Remove htaccess page commands before page is deleted */ protected function BeforeDelete() { foreach (self::$deleteHooks as $hook) { $hook->BeforeDelete($this->item); } $logger = new Logger(BackendModule::Guard()->GetUser()); $logger->ReportPageAction($this->item, Action::Delete()); $file = Path::Combine(PHINE_PATH, 'Public/.htaccess'); if (!File::Exists($file)) { return; } $this->UpdateHtaccess($file); }
/** * The modules for the backend navigation * @return Returns an array with bundle names as keys and backend modules as list */ static function BackendNavModules() { $result = array(); $allBundles = PathUtil::Bundles(); //force Core to appear first $coreKey = array_search('Core', $allBundles); unset($allBundles[$coreKey]); array_unshift($allBundles, 'Core'); $bundles = array_values($allBundles); foreach ($bundles as $bundle) { $modules = PathUtil::BackendModules($bundle); foreach ($modules as $module) { $type = self::CalcModuleType($bundle, $module); $instance = self::CreateBackendModule($type); if (!$instance instanceof BackendModule) { continue; } if ($instance->SideNavIndex() >= 0 && BackendModule::Guard()->Allow(BackendAction::Read(), $instance)) { self::AddBackendNavModule($result, $instance); } } } return self::SortByNavIndex($result); }
/** * Loads backend translations of the bundle */ private function LoadBackendTranslations() { $backendUser = BackendModule::Guard()->GetUser(); if ($backendUser) { $backendLanguage = $backendUser->GetLanguage()->GetCode(); $backendTranslations = PathUtil::BackendBundleTranslationFile($this->BundleName(), $backendLanguage); if (File::Exists($backendTranslations)) { require_once $backendTranslations; } } }
/** * Grant creation in root level * @return GrantResult */ protected function GrantCreateInRoot() { return BackendModule::Guard()->GrantAddContentToContainer($this->container); }
protected function GrantCreateInRoot() { return BackendModule::Guard()->GrantAddContentToPageArea($this->page, $this->area); }
protected function BeforeDelete() { $logger = new Logger(BackendModule::Guard()->GetUser()); $logger->ReportContentAction($this->TreeProvider()->ContentByItem($this->item), Action::Delete()); }
/** * True if the area is locked * @param Area $area * @return bool */ protected function IsLocked(Area $area) { return !BackendModule::Guard()->Allow(BackendAction::Read(), $area); }
/** * True if there can be content created after * @return boolean */ protected final function CanCreateAfter() { $parentItem = $this->tree->ParentOf($this->item); if ($parentItem) { $parent = $this->tree->ContentByItem($parentItem); return BackendModule::Guard()->Allow(BackendAction::Create(), $parent); } return $this->GrantCreateInRoot()->ToBool(); }