Example #1
0
 /**
  * @param string $action
  *
  * @return array|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($action = '')
 {
     return $this->actionHelper->handleDeleteAction($action, function (array $items) {
         $result = $this->categoriesModel->delete($items);
         $this->categoriesCache->getCacheDriver()->deleteAll();
         return $result;
     });
 }
Example #2
0
 /**
  * Listet alle Kategorien eines Moduls auf
  *
  * @param string $module
  * @param string $categoryId
  * @param boolean $categoryCreate
  * @param string $formFieldName
  * @param string $customText
  *
  * @return array
  */
 public function categoriesList($module, $categoryId = '', $categoryCreate = false, $formFieldName = 'cat', $customText = '')
 {
     $categories = [];
     $categories['custom_text'] = !empty($customText) ? $customText : $this->translator->t('system', 'pls_select');
     $categories['name'] = $formFieldName;
     $categories['categories'] = $this->categoriesCache->getCache($module);
     $cData = count($categories['categories']);
     for ($i = 0; $i < $cData; ++$i) {
         $categories['categories'][$i]['selected'] = $this->formsHelper->selectEntry($formFieldName, $categories['categories'][$i]['id'], $categoryId);
     }
     if ($categoryCreate === true && $this->acl->hasPermission('admin/categories/index/create') === true) {
         $categories['create']['name'] = $formFieldName . '_create';
         $categories['create']['value'] = $this->request->getPost()->get('create', ['name' => ''])['name'];
     }
     return $categories;
 }
Example #3
0
 /**
  * @return array
  */
 public function execute()
 {
     $this->setCacheResponseCacheable($this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME)['cache_lifetime']);
     return ['categories' => $this->categoriesCache->getCache(Schema::MODULE_NAME)];
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     $this->cache->saveCache($this->categoryRepository->getModuleNameFromCategoryId($event->getEntryId()));
 }