Ejemplo n.º 1
0
 /**
  * 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;
 }