function enterObject() { $multiple = $this->getElement('multiple') == 1; $options = array(); if ($this->getElement('homepage')) { $options[0] = 'Homepage'; } $ignoreOfflines = $this->getElement('ignore_offlines'); $checkPerms = $this->getElement('check_perms'); $clang = (int) $this->getElement('clang'); $add = function (rex_category $cat, $level = 0) use(&$add, &$options, $ignoreOfflines, $checkPerms, $clang) { if (!$checkPerms || rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($cat->getId())) { $cid = $cat->getId(); $cname = $cat->getName(); if (rex::getUser()->hasPerm('advancedMode[]')) { $cname .= ' [' . $cid . ']'; } $options[$cid] = str_repeat(' ', $level) . $cname; $childs = $cat->getChildren($ignoreOfflines, $clang); if (is_array($childs)) { foreach ($childs as $child) { $add($child, $level + 1); } } } }; if ($rootId = $this->getElement('category')) { if ($rootCat = rex_category::getCategoryById($rootId, $clang)) { $add($rootCat); } } else { if (!$checkPerms || rex::getUser()->isAdmin() || rex::getUser()->hasPerm('csw[0]')) { if ($rootCats = rex_category::getRootCategories($ignoreOfflines, $clang)) { foreach ($rootCats as $rootCat) { $add($rootCat); } } } elseif (rex::getUser()->getComplexPerm('structure')->hasMountpoints()) { $mountpoints = rex::getUser()->getComplexPerm('structure')->getMountpoints(); foreach ($mountpoints as $id) { $cat = rex_category::getCategoryById($id, $clang); if ($cat && !rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($cat->getParentId())) { $add($cat); } } } } if ($multiple) { $size = (int) $this->getElement('size'); if ($size < 2) { $size = count($options); } } else { $size = 1; } if (!is_array($this->getValue())) { $this->setValue(explode(',', $this->getValue())); } $this->params['form_output'][$this->getId()] = $this->parse('value.select.tpl.php', compact('options', 'multiple', 'size')); $this->setValue(implode(',', $this->getValue())); $this->params['value_pool']['email'][$this->getName()] = $this->getValue(); if ($this->getElement(4) != 'no_db') { $this->params['value_pool']['sql'][$this->getName()] = $this->getValue(); } }