public function __construct($collectionId)
 {
     if (is_null($collectionId)) {
         throw new Solrsearch_Model_Exception('Could not browse collection due to missing id parameter.');
     }
     $collection = null;
     try {
         $collection = new Opus_Collection((int) $collectionId);
     } catch (Opus_Model_NotFoundException $e) {
         throw new Solrsearch_Model_Exception("Collection with id '" . $collectionId . "' does not exist.");
     }
     // check if an unvisible collection exists along the path to the root collection
     foreach ($collection->getParents() as $parent) {
         if (!$parent->isRoot() && $parent->getVisible() !== '1') {
             throw new Solrsearch_Model_Exception("Collection with id '" . $collectionId . "' is not visible.");
         }
     }
     $collectionRole = null;
     try {
         $collectionRole = new Opus_CollectionRole($collection->getRoleId());
     } catch (Opus_Model_NotFoundException $e) {
         throw new Solrsearch_Model_Exception("Collection role with id '" . $collection->getRoleId() . "' does not exist.");
     }
     if (!($collectionRole->getVisible() === '1' && $collectionRole->getVisibleBrowsingStart() === '1')) {
         throw new Solrsearch_Model_Exception("Collection role with id '" . $collectionRole->getId() . "' is not visible.");
     }
     // additional root collection check
     $rootCollection = $collectionRole->getRootCollection();
     if (!is_null($rootCollection)) {
         // check if at least one visible child exists or current collection has at least one associated document
         if (!$rootCollection->hasVisibleChildren() && count($rootCollection->getPublishedDocumentIds()) == 0) {
             throw new Solrsearch_Model_Exception("Collection role with id '" . $collectionRole->getId() . "' is not clickable and therefore not displayed.");
         }
     }
     $this->_collectionRole = $collectionRole;
     $this->_collection = $collection;
 }
 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();
 }