/** * Method returns an array with one or two buttons for browsing the collections during publication. * The buttons have been added to the current Zend_Form. * * Wird nur für Collection Roles aufgerufen. * * @return <Array> of button names */ private function browseButtons() { $displayGroup = array(); //show browseDown button only for the last select field $level = (int) count($this->collectionIds); try { $collection = new Opus_Collection($this->collectionIds[$level - 1]); } catch (Exception $e) { // TODO improve exception handling return null; } if ($collection->hasVisiblePublishChildren()) { $downButton = $this->addDownButtontoGroup(); $this->form->addElement($downButton); $displayGroup[] = $downButton->getName(); } $isRoot = $collection->isRoot(); if (!$isRoot && !is_null($this->collectionIds[0])) { // collection has parents -> make button to browse up $upButton = $this->addUpButtontoGroup(); $this->form->addElement($upButton); $displayGroup[] = $upButton->getName(); } return $displayGroup; }
/** * 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(); }