/** * @SWG\Api( * path="/websitesettings/editmultiple", * @SWG\Operation( * method="GET, POST", * summary="Updates website settings", * notes="Update website settings section and return the new website settings.", * type="WebsiteSettingsEdit", * nickname="edit") * )) */ public function editmultipleAction() { /** @var $validatedRequest \Cms\Request\WebsiteSettings\EditMultiple */ $validatedRequest = $this->getValidatedRequest('WebsiteSettings', 'EditMultiple'); $this->getBusiness()->checkUserRights('edit', array('websiteId' => $validatedRequest->getWebsiteId())); $allNewWebsiteSettings = $validatedRequest->getAllWebsiteSettings(); foreach ($allNewWebsiteSettings as $id => $websiteSettings) { try { $attributes = get_object_vars($websiteSettings); $this->getBusiness()->update($validatedRequest->getWebsiteId(), $id, $attributes); } catch (\Exception $e) { CmsExceptionStack::addException($e); } } $allWebsiteSettings = $this->getBusiness()->getAll($validatedRequest->getWebsiteId()); $responseData = new Response\GetAll($allWebsiteSettings); if (CmsExceptionStack::hasErrors()) { CmsExceptionStack::throwErrors($responseData); } $this->responseData->setData($responseData); }
/** * deletes the modules given by $ids * * @param ModuleSource $moduleSource * @param string[] $ids */ public function deleteByIds(ModuleSource $moduleSource, array $ids) { $allModuleInfo = $this->getAllBaseInfo($moduleSource); foreach ($ids as $id) { if (!isset($allModuleInfo[$id]) || empty($allModuleInfo[$id])) { continue; } try { $this->checkIfModuleIsWritable($allModuleInfo[$id]); FS::rmdir($allModuleInfo[$id]->getDirectory()); } catch (\Exception $e) { CmsExceptionStack::addException($e); } } $this->resetCache(); if (CmsExceptionStack::hasErrors()) { CmsExceptionStack::throwErrors(); } }
/** * Empty all theme files */ public function resetTheme() { $this->createTargetDirectory(); // empty theme files CmsExceptionStack::reset(); foreach ($this->themeFileNames as $file => $target) { try { FS::rmFile(FS::joinPath($this->targetPath, $target)); } catch (\Exception $e) { CmsExceptionStack::addException($e); } } if (CmsExceptionStack::hasErrors()) { CmsExceptionStack::throwErrors(); } }
/** * @param string $websiteId * @param string $importDirectory * @param string|null $allowedImportMode * @param string|null $websiteName * * @return array|null * @throws CmsException * @throws ConflictException * @throws \Cms\ExceptionStackException * @throws \Exception */ public function importFromDirectory($websiteId, $importDirectory, $allowedImportMode, $websiteName) { if (!file_exists($importDirectory)) { throw new CmsException(24, __METHOD__, __LINE__, array('file' => $importDirectory)); } $this->currentImportFile = null; $this->currentImportUnzipDirectory = $importDirectory; $this->prepareImport($websiteId, $allowedImportMode); $this->handleConflicts($websiteId, $importDirectory); $importData = $this->_import($websiteId, $websiteName); if (CmsExceptionStack::hasErrors()) { CmsExceptionStack::throwErrors(); } return $importData; }
/** * Reparse von Pages * * @param $websiteId * @param array $pageIds * * @return array */ private function reparsePages($websiteId, array $pageIds) { if (count($pageIds) == 0) { return array(); } $idsOfReparsedPages = array(); $pageBusiness = $this->getPageBusiness(); foreach ($pageIds as $pageId) { try { $page = $pageBusiness->getById($pageId, $websiteId); if ($this->reparsePage($page)) { $idsOfReparsedPages[] = $page->getId(); } } catch (\Exception $e) { \Cms\ExceptionStack::addException($e); } } if (\Cms\ExceptionStack::hasErrors()) { \Cms\ExceptionStack::throwErrors(); } return $idsOfReparsedPages; }
/** * @param string $id * @param string $websiteId * @param array $groupIds * * @return boolean */ public function removeGroups($id, $websiteId, array $groupIds) { /** @var $groupService \Cms\Service\Group */ $groupService = $this->getService('Group'); foreach ($groupIds as $groupId) { try { $groupService->removeUsers($groupId, $websiteId, array($id)); } catch (\Exception $e) { CmsExceptionStack::addException($e); } } if (CmsExceptionStack::hasErrors()) { CmsExceptionStack::throwErrors(); } return true; }