/** * Affichage d'un élément. * */ public function galleriesItem($aMatches) { # récupération de l'élément en fonction du slug if (!empty($aMatches[0])) { $slug = $aMatches[0]; } else { $this->serve404(); } # récupération de l'élément $rsItem = $this->okt->galleries->items->getItems(array('slug' => $slug, 'active' => 1, 'language' => $this->okt->user->language)); if ($rsItem->isEmpty()) { $this->serve404(); } # module actuel $this->okt->page->module = 'galleries'; $this->okt->page->action = 'item'; //$rsItem->image = $rsItem->getImagesInfo(); if ($this->okt->galleries->config->enable_rte == '' && $rsItem->legend != '') { $rsItem->legend = util::nlToP($rsItem->legend); } # title tag $this->okt->page->addTitleTag($this->okt->galleries->getTitle()); if ($rsItem->title_tag == '') { $rsItem->title_tag = $rsItem->title; } $this->okt->page->addTitleTag($rsItem->title_tag); # meta description if ($rsItem->meta_description != '') { $this->okt->page->meta_description = $rsItem->meta_description; } else { if ($this->okt->galleries->config->meta_description[$this->okt->user->language] != '') { $this->okt->page->meta_description = $this->okt->galleries->config->meta_description[$this->okt->user->language]; } else { $this->okt->page->meta_description = util::getSiteMetaDesc(); } } # meta keywords if ($rsItem->meta_keywords != '') { $this->okt->page->meta_keywords = $rsItem->meta_keywords; } else { if ($this->okt->galleries->config->meta_keywords[$this->okt->user->language] != '') { $this->okt->page->meta_keywords = $this->okt->galleries->config->meta_keywords[$this->okt->user->language]; } else { $this->okt->page->meta_keywords = util::getSiteMetaKeywords(); } } # fil d'ariane if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__, $slug)) { $this->okt->page->breadcrumb->add($this->okt->galleries->getName(), $this->okt->galleries->config->url); $rsPath = $this->okt->galleries->tree->getPath($rsItem->gallery_id, true, $this->okt->user->language); while ($rsPath->fetch()) { $this->okt->page->addTitleTag($rsPath->title); $this->okt->page->breadcrumb->add($rsPath->title, galleriesHelpers::getGalleryUrl($rsPath->slug)); } $this->okt->page->breadcrumb->add($rsItem->title, $rsItem->getItemUrl()); } # titre de la page $this->okt->page->setTitle($rsItem->title); # titre SEO de la page $this->okt->page->setTitleSeo(!empty($rsItem->title_seo) ? $rsItem->title_seo : $rsItem->title); # affichage du template echo $this->okt->tpl->render('galleries/item/' . $this->okt->galleries->config->templates['item']['default'] . '/template', array('rsItem' => $rsItem)); }
} catch (Exception $e) { $okt->error->set($e->getMessage()); } } /* Affichage ----------------------------------------------------------*/ # Titre de la page $okt->page->addGlobalTitle(html::escapeHTML($rsGallery->title)); # Boutons $okt->page->addButton('galleriesBtSt', array('permission' => true, 'title' => __('c_c_action_Go_back'), 'url' => 'module.php?m=galleries&action=index', 'ui-icon' => 'arrowreturnthick-1-w')); $okt->page->addButton('galleriesBtSt', array('permission' => $okt->page->action !== 'add' && $okt->checkPerm('galleries_add'), 'title' => __('m_galleries_menu_add_item'), 'url' => 'module.php?m=galleries&action=add' . ($gallery_id ? '&gallery_id=' . $gallery_id : ''), 'ui-icon' => 'image')); # bouton ajout de plusieurs éléments $okt->page->addButton('galleriesBtSt', array('permission' => $okt->page->action !== 'add' && $okt->galleries->config->enable_multiple_upload && $okt->checkPerm('galleries_add'), 'title' => __('m_galleries_menu_add_items'), 'url' => 'module.php?m=galleries&action=add_multiples' . ($gallery_id ? '&gallery_id=' . $gallery_id : ''), 'ui-icon' => 'folder-collapsed')); # bouton ajout depuis un fichier ZIP $okt->page->addButton('galleriesBtSt', array('permission' => $okt->page->action !== 'add' && $okt->galleries->config->enable_zip_upload && $okt->checkPerm('galleries_add'), 'title' => __('m_galleries_menu_add_zip'), 'url' => 'module.php?m=galleries&action=add_zip' . ($gallery_id ? '&gallery_id=' . $gallery_id : ''), 'ui-icon' => 'script')); $okt->page->addButton('galleriesBtSt', array('permission' => $rsGallery->active ? true : false, 'title' => __('c_c_action_show'), 'url' => html::escapeHTML(galleriesHelpers::getGalleryUrl($rsGallery->slug)), 'ui-icon' => 'extlink')); # Récupération des éléments $rsItems = $okt->galleries->items->getItems(array('language' => $okt->user->language, 'gallery_id' => $gallery_id, 'active' => 2)); # Confirmations $okt->page->messages->success('switched', __('m_galleries_items_item_switched')); $okt->page->messages->success('deleted', __('m_galleries_items_item_deleted')); # Smart columns $okt->page->smartColumns(); # Modal $okt->page->applyLbl($okt->galleries->config->lightbox_type); # Sortables smart columns $okt->page->js->addReady(' $(".smartColumns").sortable({ revert: true, handle: "h3", update: function(event, ui) {
/** * Retourne l'URL publique d'une galerie * * @param string $sLanguage * @return string */ public function getGalleryUrl($sLanguage = null) { return galleriesHelpers::getGalleryUrl($this->slug, $sLanguage); }
$okt->page->setButtonset('galleriesGaleryBtSt', array('id' => 'galleries-buttonset', 'type' => '', 'buttons' => array(array('permission' => true, 'title' => __('c_c_action_Go_back'), 'url' => 'module.php?m=galleries&action=index', 'ui-icon' => 'arrowreturnthick-1-w')))); if ($iGalleryId) { # bouton add cat $okt->page->addButton('galleriesGaleryBtSt', array('permission' => true, 'title' => __('m_galleries_menu_add_gallery'), 'url' => 'module.php?m=galleries&action=gallery', 'ui-icon' => 'plusthick')); # bouton ajout d'élément $okt->page->addButton('galleriesGaleryBtSt', array('permission' => $okt->checkPerm('galleries_add'), 'title' => __('m_galleries_menu_add_item'), 'url' => 'module.php?m=galleries&action=add', 'ui-icon' => 'image')); # bouton ajout de plusieurs éléments $okt->page->addButton('galleriesGaleryBtSt', array('permission' => $okt->galleries->config->enable_multiple_upload && $okt->checkPerm('galleries_add'), 'title' => __('m_galleries_menu_add_items'), 'url' => 'module.php?m=galleries&action=add_multiples', 'ui-icon' => 'folder-collapsed')); # bouton ajout depuis un fichier ZIP $okt->page->addButton('galleriesGaleryBtSt', array('permission' => $okt->galleries->config->enable_zip_upload && $okt->checkPerm('galleries_add'), 'title' => __('m_galleries_menu_add_zip'), 'url' => 'module.php?m=galleries&action=add_zip', 'ui-icon' => 'script')); # bouton switch statut $okt->page->addButton('galleriesGaleryBtSt', array('permission' => true, 'title' => $aGalleryData['db']['active'] ? __('c_c_status_Online') : __('c_c_status_Offline'), 'url' => 'module.php?m=galleries&action=gallery&switch_status=1&gallery_id=' . $iGalleryId, 'ui-icon' => $aGalleryData['db']['active'] ? 'volume-on' : 'volume-off', 'active' => $aGalleryData['db']['active'])); # bouton de suppression $okt->page->addButton('galleriesGaleryBtSt', array('permission' => $aGalleryData['num_items'] == 0, 'title' => __('c_c_action_Delete'), 'url' => 'module.php?m=galleries&delete=' . $iGalleryId, 'ui-icon' => 'closethick', 'onclick' => 'return window.confirm(\'' . html::escapeJS(__('m_galleries_gallery_confirm_del_gallery')) . '\')')); # bouton vers la galerie côté public $okt->page->addButton('galleriesGaleryBtSt', array('permission' => $aGalleryData['db']['active'] ? true : false, 'title' => __('c_c_action_Show'), 'url' => galleriesHelpers::getGalleryUrl($aGalleryData['locales'][$okt->user->language]['slug']), 'ui-icon' => 'extlink')); } # Titre de la page if ($iGalleryId) { $path = $okt->galleries->tree->getPath($iGalleryId, true, $okt->user->language); while ($path->fetch()) { $okt->page->addGlobalTitle($path->title, 'module.php?m=galleries&action=gallery&gallery_id=' . $path->id); } } else { $okt->page->addGlobalTitle(__('m_galleries_gallery_add_gallery')); } # Lockable $okt->page->lockable(); # Tabs $okt->page->tabs(); # RTE