public function detailsAction() { $numberOfImagesPerPage = 5; $numberOfImagesPerColumn = 4; $gallery = new GalleryObject(); $blockID = $this->_getParam('BlockID'); $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $regularDetailsShow = true; if (isset($blockParameters[1]['P_Value'])) { if ($blockParameters[1]['P_Number'] != 999) { if ($blockParameters[1]['P_Value'] != 0) { $regularDetailsShow = false; } } } /*if(!empty($_SERVER['HTTP_REFERER'])){ $this->view->assign('pagePrecedente', $_SERVER['HTTP_REFERER']); } else{ $this->view->assign('pagePrecedente',''); }*/ //$this->view->assign('pagePrecedente',''); $listall_page = Cible_FunctionsCategories::getPagePerCategoryView(9001, 'list'); $this->view->assign('listall_page_gallery', $listall_page); if ($regularDetailsShow == false) { $id = 0; $idGallery = $blockParameters[1]['P_Value']; $titleUrl = Cible_FunctionsGeneral::getTitleFromPath($this->_request->getPathInfo(), true); $baseDir = $this->view->baseUrl(); $config = Zend_Registry::get('config')->toArray(); $imageId = $idGallery; // $this->view->headLink()->appendStylesheet($baseDir . '/themes/default/css/prettyPhoto.css', 'screen'); $galleryID = $idGallery; $db = Zend_Registry::get('db'); $gallerySelect = new GalleriesIndex(); $select = $db->select()->distinct()->from('GalleriesIndex')->joinRight('Galleries', 'GI_GalleryID = G_ID AND GI_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID); $galleryData = $db->fetchRow($select); //var_dump($galleryData); if (count($galleryData) > 0) { $this->view->headTitle($galleryData['GI_Title']); $originalMaxHeight = $config['gallery']['image']['original']['maxHeight']; $originalMaxWidth = $config['gallery']['image']['original']['maxWidth']; $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight']; $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth']; $imagesSelect = new GalleriesImages(); $select = $imagesSelect->select()->setIntegrityCheck(false)->from('Galleries_Images')->join('Images', 'I_ID = GI_ImageID')->joinLeft('ImagesIndex', 'II_ImageID = I_ID AND II_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID)->where('GI_Online = 1')->order('GI_Position'); $imagesData = $imagesSelect->fetchAll($select)->toArray(); $i = 0; foreach ($imagesData as $image) { $imagesData[$i]['thumbName'] = str_replace($image['I_OriginalLink'], $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $imagesData[$i]['originalName'] = str_replace($image['I_OriginalLink'], $originalMaxWidth . 'x' . $originalMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $i++; } $this->view->assign('galleryData', $galleryData); $this->view->assign('imagesData', $imagesData); $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($imagesData)); $paginator->setItemCountPerPage($numberOfImagesPerPage); $pageNum = $this->_request->getParam('page'); if ($pageNum == "") { $pageNum = Cible_FunctionsGeneral::getPageNumberWithoutParamOrder($this->_request->getPathInfo()); } //var_dump($paginator); $paginator->setCurrentPageNumber($pageNum); $this->view->assign('paginator', $paginator); $this->view->assign('numberItemPerColumn', $numberOfImagesPerColumn); } } else { $id = 0; $idGallery = 0; $titleUrl = Cible_FunctionsGeneral::getTitleFromPath($this->_request->getPathInfo(), true); if ($titleUrl != "") { $idGallery = $gallery->getIdByName($titleUrl); } $baseDir = $this->view->baseUrl(); $config = Zend_Registry::get('config')->toArray(); $imageId = $idGallery; // $this->view->headLink()->appendStylesheet($baseDir . '/themes/default/css/prettyPhoto.css', 'screen'); $galleryID = $idGallery; $db = Zend_Registry::get('db'); $gallerySelect = new GalleriesIndex(); $select = $db->select()->distinct()->from('GalleriesIndex')->joinRight('Galleries', 'GI_GalleryID = G_ID AND GI_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID); $galleryData = $db->fetchRow($select); //echo $select; //var_dump($galleryData); if (count($galleryData) > 0) { $this->view->headTitle($galleryData['GI_Title']); $originalMaxHeight = $config['gallery']['image']['original']['maxHeight']; $originalMaxWidth = $config['gallery']['image']['original']['maxWidth']; $thumbMaxHeight = $config['gallery']['image']['thumb']['maxHeight']; $thumbMaxWidth = $config['gallery']['image']['thumb']['maxWidth']; $imagesSelect = new GalleriesImages(); $select = $imagesSelect->select()->setIntegrityCheck(false)->from('Galleries_Images')->join('Images', 'I_ID = GI_ImageID')->joinLeft('ImagesIndex', 'II_ImageID = I_ID AND II_LanguageID = ' . Zend_Registry::get("languageID"))->where('GI_GalleryID = ?', $galleryID)->where('GI_Online = 1')->order('GI_Position'); $imagesData = $imagesSelect->fetchAll($select)->toArray(); $i = 0; foreach ($imagesData as $image) { $imagesData[$i]['thumbName'] = str_replace($image['I_OriginalLink'], $thumbMaxWidth . 'x' . $thumbMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $imagesData[$i]['originalName'] = str_replace($image['I_OriginalLink'], $originalMaxWidth . 'x' . $originalMaxHeight . '_' . $image['I_OriginalLink'], $image['I_OriginalLink']); $i++; } $this->view->assign('galleryData', $galleryData); $this->view->assign('imagesData', $imagesData); $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($imagesData)); $paginator->setItemCountPerPage($numberOfImagesPerPage); $pageNum = $this->_request->getParam('page'); if ($pageNum == "") { $pageNum = Cible_FunctionsGeneral::getPageNumberWithoutParamOrder($this->_request->getPathInfo()); } //var_dump($paginator); $paginator->setCurrentPageNumber($pageNum); $this->view->assign('paginator', $paginator); $this->view->assign('numberItemPerColumn', $numberOfImagesPerColumn); } } }