Ejemplo n.º 1
0
 private function prepareAssignSubPage($documentId, $collectionId)
 {
     $collection = new Opus_Collection($collectionId);
     $children = $collection->getChildren();
     if (count($children) === 0) {
         // zurück zur Ausgangsansicht
         $this->_redirectToAndExit('assign', array('failure' => 'specified collection does not have any subcollections'), 'collection', 'admin', array('document' => $documentId));
         return;
     }
     $this->view->collections = array();
     foreach ($children as $child) {
         array_push($this->view->collections, array('id' => $child->getId(), 'name' => $child->getNumberAndName(), 'hasChildren' => $child->hasChildren(), 'visible' => $child->getVisible()));
     }
     $this->view->documentId = $documentId;
     $this->view->breadcrumb = array_reverse($collection->getParents());
     $this->view->role_name = $collection->getRole()->getDisplayName();
 }
Ejemplo n.º 2
0
 protected function _addCollection($colId)
 {
     $collection = new Opus_Collection($colId);
     $collectionRole = $collection->getRole();
     $roleName = $collectionRole->getName();
     $roleForm = $this->_getRoleForm($roleName);
     $collectionForm = new Admin_Form_Document_Collection();
     $collectionForm->populateFromModel($collection);
     $position = count($roleForm->getSubForms());
     $roleForm->addSubForm($collectionForm, 'collection' . $position);
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 /**
  * Display documents (all or filtered by state)
  *
  * @return void
  */
 public function indexAction()
 {
     $this->view->title = 'admin_documents_index';
     $this->prepareDocStateLinks();
     $url_call_id = array('module' => 'admin', 'controller' => 'document', 'action' => 'index');
     $this->view->url_call_id = $this->view->url($url_call_id, 'default', true);
     $this->prepareSortingLinks();
     $data = $this->_request->getParams();
     $filter = $this->_getParam("filter");
     $this->view->filter = $filter;
     $data = $this->_request->getParams();
     $page = 1;
     if (array_key_exists('page', $data)) {
         // set page if requested
         $page = $data['page'];
     }
     $collectionId = null;
     if (array_key_exists('collectionid', $data)) {
         $collectionId = $data['collectionid'];
     }
     $seriesId = null;
     if (array_key_exists('seriesid', $data)) {
         $seriesId = $data['seriesid'];
     }
     $sort_reverse = $this->getSortingDirection($data);
     $this->view->sort_reverse = $sort_reverse;
     $this->view->sortDirection = $sort_reverse ? 'descending' : 'ascending';
     $state = $this->getStateOption($data);
     $this->view->state = $state;
     $sort_order = $this->getSortingOption($data);
     $this->view->sort_order = $sort_order;
     if (!empty($collectionId)) {
         $collection = new Opus_Collection($collectionId);
         $result = $collection->getDocumentIds();
         $this->view->collection = $collection;
         if ($collection->isRoot()) {
             $collectionRoleName = 'default_collection_role_' . $collection->getRole()->getDisplayName();
             $this->view->collectionName = $this->view->translate($collectionRoleName);
             if ($this->view->collectionName == $collectionRoleName) {
                 $this->view->collectionName = $collection->getRole()->getDisplayName();
             }
         } else {
             $this->view->collectionName = $collection->getNumberAndName();
         }
     } else {
         if (!empty($seriesId)) {
             $series = new Opus_Series($seriesId);
             $this->view->series = $series;
             $result = $series->getDocumentIdsSortedBySortKey();
         } else {
             $result = $this->_helper->documents($sort_order, $sort_reverse, $state);
         }
     }
     $paginator = Zend_Paginator::factory($result);
     $page = 1;
     if (array_key_exists('page', $data)) {
         // paginator
         $page = $data['page'];
     }
     $this->view->maxHitsPerPage = $this->getItemCountPerPage($data);
     $paginator->setItemCountPerPage($this->view->maxHitsPerPage);
     $paginator->setCurrentPageNumber($page);
     $this->view->paginator = $paginator;
     $this->prepareItemCountLinks();
 }