/** * wird nur für Collection Roles aufgerufen * @param int $id ID einer Collection * @param int $step aktuelle Stufe innerhalb der Gruppe (>= 1) * @param int $fieldset aktuelle Gruppe (>= 1) */ private function collectionEntries($id, $step, $fieldset) { try { $collection = new Opus_Collection($id); } catch (Exception $e) { // TODO: improve exception handling! return null; } $children = array(); if ($collection->hasChildren()) { $selectField = $this->form->createElement('select', 'collId' . $step . $this->elementName . '_' . $fieldset); $selectField->setDisableTranslator(true); $selectField->setLabel('choose_collection_subcollection'); $role = $collection->getRole(); $collsVisiblePublish = $collection->getVisiblePublishChildren(); $collsVisible = $collection->getVisibleChildren(); $colls = array_intersect($collsVisible, $collsVisiblePublish); foreach ($colls as $coll) { $children[] = array('key' => strval($coll->getId()), 'value' => $coll->getDisplayNameForBrowsingContext($role)); } $selectField->setMultiOptions($children); } //show no field? if (empty($children)) { $selectField = $this->form->createElement('text', 'collId' . $step . $this->elementName . '_' . $fieldset); $selectField->setDisableTranslator(true); $selectField->setLabel('endOfCollectionTree'); $selectField->setAttrib('disabled', true); $selectField->setAttrib('isLeaf', true); } return $selectField; }
private function _collectionSelect() { $collectionRole = Opus_CollectionRole::fetchByName($this->collectionRole); if (is_null($collectionRole) || is_null($collectionRole->getRootCollection())) { return null; } if ($collectionRole->getVisible() == '1' && $collectionRole->getRootCollection()->getVisiblePublish() == '1' && $this->hasVisiblePublishChildren($collectionRole)) { $children = array(); $collectionId = $collectionRole->getRootCollection()->getId(); $collection = new Opus_Collection($collectionId); $colls = $collection->getVisiblePublishChildren(); foreach ($colls as $coll) { $children[$coll->getId()] = $coll->getDisplayNameForBrowsingContext($collectionRole); } return $children; } return null; }