From 223021baf0805fe7e87b7592080cc6b45cff0e3c Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 23 Jun 2017 09:24:47 +0000 Subject: [PATCH] fix #1492 @0:20 --- framework/application/Bootstrap.php | 34 ++++++++++--------- .../controllers/RealisationsController.php | 1 + 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/framework/application/Bootstrap.php b/framework/application/Bootstrap.php index 04a5017..631f0cf 100644 --- a/framework/application/Bootstrap.php +++ b/framework/application/Bootstrap.php @@ -30,11 +30,11 @@ class Bootstrap extends CubeIT_Bootstrap { } if ($page->getTemplate() == 'casestudies') { - $this->addStudiesPages($page, $locale); + $this->addStudiesPages($page, $locale, $isAdmin); } if ($page->getTemplate() == 'realisations') { - $this->addRealisationsPages($page, $locale); + $this->addRealisationsPages($page, $locale, $isAdmin); } } @@ -42,7 +42,7 @@ class Bootstrap extends CubeIT_Bootstrap { * * @param CubeIT_Navigation_Page_Locale $page */ - protected function addRealisationsPages($page, $locale) { + protected function addRealisationsPages($page, $locale, $isAdmin) { $datas = $this->getCMSDatasOfNavigationPage($page); $db = Zend_Db_Table::getDefaultAdapter(); @@ -55,17 +55,18 @@ class Bootstrap extends CubeIT_Bootstrap { if ($r->titre == '') { continue; } + $online = boolval($r->online); + if (!$online && !$isAdmin) { + continue; + } + $p = new CubeIT_Navigation_Page_Locale(); $p->setController('Realisations'); $p->setId($page->getId() . '/' . $r->id); $p->setUri(Cubedesigners_Util::generateAutoUri($r, $datas['seourl_rea'], $page->getLocale())); - $p->setSitemap(true); + $p->setSitemap($online); $p->setEditable(false); - - if ($r->online != 1) { - $p->setOnline(false); - } - + $p->setOnline($online); $p->setDomain($page->getDomain()); $p->setLabel($r->titre); $p->setTitle($r->titre); @@ -78,7 +79,7 @@ class Bootstrap extends CubeIT_Bootstrap { * * @param CubeIT_Navigation_Page_Locale $page */ - protected function addStudiesPages($page, $locale) { + protected function addStudiesPages($page, $locale, $isAdmin) { $datas = $this->getCMSDatasOfNavigationPage($page); $db = Zend_Db_Table::getDefaultAdapter(); $s = $db->select()->from('casestudies') @@ -90,19 +91,20 @@ class Bootstrap extends CubeIT_Bootstrap { if ($r->titre == '') { continue; } + $online = boolval($r->online); + if (!$online && !$isAdmin) { + continue; + } + $p = new CubeIT_Navigation_Page_Locale(); $p->setController('Studies'); $p->setId($page->getId() . '/' . $r->id); $p->setAutoUri($r, $datas['seourl_stu'], $page->getLocale()); - $p->setSitemap(true); + $p->setSitemap($online); $p->setTitle($r->titre); $p->setEditable(false); $p->setParams(array('casestudy_id' => $r->id)); - - if ($r->online != 1) { - $p->setOnline(false); - } - + $p->setOnline($online); $p->setDomain($page->getDomain()); $p->setLabel($r->titre); $page->addPage($p); diff --git a/framework/application/controllers/RealisationsController.php b/framework/application/controllers/RealisationsController.php index d5da89d..51539bd 100644 --- a/framework/application/controllers/RealisationsController.php +++ b/framework/application/controllers/RealisationsController.php @@ -8,6 +8,7 @@ class RealisationsController extends CubeIT_Controller_PageController { $datas = $this->getBootstrap()->getCMSDatasOfNavigationPage($parent); $this->view->datas = $datas; + $r = new Cubedesigners_Model_Realisation(); $r->selectById($this->getParam('realisation_id')); $r = $r->toObject(); -- 2.39.5