示例#1
0
 public function showAction()
 {
     parent::showAction();
     $hierarchyTable = $this->_helper->db->getTable('Hierarchy1418');
     $record = $this->_helper->db->findById();
     $this->view->breadcrumb = $hierarchyTable->getBreadCrumb($record->id);
     $this->view->items = $hierarchyTable->getLeftMenuItems($record->id);
     foreach ($images = $record->Files as $key => $file) {
         if (strtolower($file->getExtension()) == 'pdf') {
             $files[] = $file;
             unset($images[$key]);
         }
     }
     if (isset($files)) {
         $this->view->files = $files;
     }
     $this->view->images = $images;
     $type = $record->Hierarchy->type;
     if ($this->getParam('result') && $this->getParam('result') == 1) {
         $_SESSION['RESULTS_URL'] = $_SERVER["HTTP_REFERER"];
         $this->view->result = $this->getParam('result');
     } elseif ($this->getParam('result') != 2) {
         unset($_SESSION['RESULTS_URL']);
     }
     // Récupération des notices de même niveau (pour le bouton "afficher les notices voisines")
     $hierarchyTable = $this->_helper->db->getTable('Hierarchy1418');
     $sibblings = $hierarchyTable->getSibblings($record);
     if (strpos($_SERVER["HTTP_REFERER"], "items/browse") || $this->getParam('browse_results') == 1) {
         $searchResults = $_SESSION['SEARCH_RESULTS'];
         $currentKey = array_search($record->id, $searchResults);
         $nextResult = $searchResults[$currentKey + 1];
         $previousResult = $searchResults[$currentKey - 1];
         //echo $currentKey.' '.$previousResult.' '.$nextResult;
         //Zend_Debug::dump($searchResults);
         $this->view->total_results = count($searchResults);
         $this->view->current = $currentKey + 1;
         $this->view->previous_result = $previousResult;
         $this->view->next_result = $nextResult;
     } else {
         if ($type == Item::VOLET) {
             $this->view->previous_notice = null;
         } else {
             $this->view->previous_notice = $hierarchyTable->getPreviousItemInHierarchy($record->id);
         }
         $nextNotice = $hierarchyTable->getNextItemInHierarchy($record->id);
         $nextNoticeRecord = get_record_by_id("Item", $nextNotice);
         if ($nextNoticeRecord->Hierarchy->type == Item::VOLET) {
             $this->view->next_notice = null;
         } else {
             $this->view->next_notice = $hierarchyTable->getNextItemInHierarchy($record->id);
         }
     }
     $sibblingsRange = '';
     foreach ($sibblings as $sibbling) {
         $sibblingsRange .= $sibbling['id'] . ',';
     }
     $this->view->searchRange = $sibblingsRange;
     $this->view->sibblingsUrl = getenv("INSTANCE_URL") . '/items/browse?range=' . rtrim($sibblingsRange, ',');
     $output = $this->getParam("output");
     $this->_helper->viewRenderer->setNoRender();
     if (is_admin_theme() || isset($output)) {
         $this->render('show');
     } else {
         if ($type == Item::VOLET) {
             // Récupération des enfants et petits enfants (pour l'affichage des images en dur)
             $children = $hierarchyTable->getDescendants($record->id, 3, false);
             foreach ($children as $child) {
                 if ($child['level'] == 2) {
                     $partieId = $child['id'];
                 } else {
                     $res[$partieId][] = $child['id'];
                 }
             }
             $this->view->pictures = $res;
             $this->render('show-parent-volet');
         } elseif ($type == Item::PARTIE) {
             // Mise en sessions de la hiérarchie de cette partie (pour la recherche)
             foreach ($hierarchyTable->getDescendants($record->id) as $child) {
                 $range .= $child['id'] . ',';
             }
             $_SESSION['RANGE'] = $range;
             // Récupération des enfants et petits enfants (pour l'affichage des images en dur)
             $children = $hierarchyTable->getDescendants($record->id, 3, false);
             foreach ($children as $child) {
                 if ($child['level'] == 3) {
                     $partieId = $child['id'];
                 } else {
                     $res[$partieId][] = $child['id'];
                 }
             }
             $this->view->pictures = $res;
             $this->render('show-parent-volet');
         } elseif ($type == Item::CHAPITRE) {
             $this->view->planExtract = $hierarchyTable->getDescendants($record->id, 3, false);
             $this->render('show-parent-chapitre');
         } elseif ($type == Item::SOUS_CHAPITRE) {
             $this->view->planExtract = $hierarchyTable->getDescendants($record->id, 3, false);
             $this->render('show-parent-chapitre');
         } elseif ($type == Item::ENSEMBLE) {
             $this->view->planExtract = $hierarchyTable->getDescendants($record->id, 3, false);
             $this->render('show-parent-ensemble');
         } elseif ($type == Item::SOUS_ENSEMBLE) {
             $this->view->planExtract = $hierarchyTable->getDescendants($record->id, 3, false);
             $this->render('show-parent-ensemble');
         } else {
             $this->render('show-item');
         }
     }
 }
 public function showAction()
 {
     parent::showAction();
     $this->view->corpus = $this->view->ngram_corpu;
     // correct poor inflection
 }
示例#3
0
 /**
  * The show collection action
  * 
  */
 public function showAction()
 {
     parent::showAction();
     $this->view->items = $this->_helper->db->getTable('Item')->findBy(array('collection' => $this->view->collection->id), is_admin_theme() ? 10 : 5);
 }