Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
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)];
 }