Example #1
0
 protected function addCatOption(rex_media_category $mediacat)
 {
     if (!$this->check_perms || $this->check_perms && rex::getUser()->getComplexPerm('media')->hasCategoryPerm($mediacat->getId())) {
         $mid = $mediacat->getId();
         $mname = $mediacat->getName() . ' [' . $mid . ']';
         $this->addOption($mname, $mid, $mid, $mediacat->getParentId());
         $childs = $mediacat->getChildren();
         if (is_array($childs)) {
             foreach ($childs as $child) {
                 $this->addCatOption($child);
             }
         }
     }
 }
Example #2
0
 /**
  * @return rex_media_category
  */
 public function getCategory()
 {
     return rex_media_category::get($this->getCategoryId());
 }
Example #3
0
     $fragment->setVar('title', rex_i18n::msg('pool_file_edit') . $opener_link, false);
     $fragment->setVar('options', $toolbar, false);
     $fragment->setVar('body', $panel, false);
     $fragment->setVar('buttons', $buttons, false);
     $content = $fragment->parse('core/page/section.php');
     $content = '
         <form action="' . rex_url::currentBackendPage() . '" method="post" enctype="multipart/form-data">
             <input type="hidden" name="file_id" value="' . $file_id . '" />
             ' . $arg_fields . '
             ' . $content . '
         </form>';
     echo $content;
 } else {
     $panel = '';
     $catname = rex_i18n::msg('pool_kats_no');
     $Cat = rex_media_category::get($rex_file_category);
     if ($Cat) {
         $catname = $Cat->getName();
     }
     $ftitle .= ' [' . $file_id . ']';
     $catname .= ' [' . $rex_file_category . ']';
     $formElements = [];
     $e = [];
     $e['label'] = '<label>' . rex_i18n::msg('pool_file_title') . '</label>';
     $e['field'] = '<p class="form-control-static">' . htmlspecialchars($ftitle) . '</p>';
     $formElements[] = $e;
     $e = [];
     $e['label'] = '<label>' . rex_i18n::msg('pool_file_category') . '</label>';
     $e['field'] = '<p class="form-control-static">' . htmlspecialchars($catname) . '</p>';
     $formElements[] = $e;
     $e = [];
Example #4
0
 protected function buildFilterCondition(array $params)
 {
     $restrictionsCondition = '';
     $catId = rex_session('media[rex_file_category]', 'int');
     if (isset($params['activeItem'])) {
         $catId = $params['activeItem']->getValue('category_id');
     }
     if ($catId !== '') {
         $s = '';
         if ($catId != 0) {
             $OOCat = rex_media_category::get($catId);
             // Alle Metafelder des Pfades sind erlaubt
             foreach ($OOCat->getPathAsArray() as $pathElement) {
                 if ($pathElement != '') {
                     $s .= ' OR `p`.`restrictions` LIKE "%|' . $pathElement . '|%"';
                 }
             }
         }
         // Auch die Kategorie selbst kann Metafelder haben
         $s .= ' OR `p`.`restrictions` LIKE "%|' . $catId . '|%"';
         $restrictionsCondition = 'AND (`p`.`restrictions` = "" OR `p`.`restrictions` IS NULL ' . $s . ')';
     }
     return $restrictionsCondition;
 }
Example #5
0
 /**
  * Löscht die gecachte Media-Kategorien-Liste.
  *
  * @param int $category_id Id der Media-Kategorie
  */
 public static function deleteCategoryList($category_id)
 {
     rex_file::delete(rex_path::addonCache('mediapool', $category_id . '.mclist'));
     rex_media_category::clearInstanceList([$category_id, 'children']);
 }
Example #6
0
 /**
  * @param self $mediaCat
  *
  * @return bool
  */
 public function isParent(self $mediaCat)
 {
     return $this->getParentId() == $mediaCat->getId();
 }
Example #7
0
 $n = [];
 $n['title'] = rex_i18n::msg('pool_kat_start');
 $n['href'] = $link . '0';
 $breadcrumb[] = $n;
 $cat_id = rex_request('cat_id', 'int');
 if ($cat_id == 0 || !($OOCat = rex_media_category::get($cat_id))) {
     $OOCats = rex_media_category::getRootCategories();
     $cat_id = 0;
     $catpath = '|';
 } else {
     $OOCats = $OOCat->getChildren();
     $paths = explode('|', $OOCat->getPath());
     for ($i = 1; $i < count($paths); ++$i) {
         $iid = current($paths);
         if ($iid != '') {
             $icat = rex_media_category::get($iid);
             $n = [];
             $n['title'] = $icat->getName();
             $n['href'] = $link . $iid;
             $breadcrumb[] = $n;
         }
         next($paths);
     }
     $n = [];
     $n['title'] = $OOCat->getName();
     $n['href'] = $link . $cat_id;
     $breadcrumb[] = $n;
     $catpath = $OOCat->getPath() . "{$cat_id}|";
 }
 $fragment = new rex_fragment();
 $fragment->setVar('title', rex_i18n::msg('pool_kat_path'), false);