<?php
-class Bootstrap extends CubeIT_Bootstrap {
-
- // protected $_cacheNavigation = false;
-
- protected function _initMinimum() {
- parent::_initMinimum();
- // If a project with html display (don't activate by default for web services apps
- $this->bootstrap('doctype');
- $this->bootstrap('scripts');
- }
-
- protected function _initRouter($initCms = true, $standard = true) {
- $router = parent::_initRouter($initCms, $standard);
- $router->addStandardRoute('rss');
- return $router;
- }
-
- protected function _initAcl() {
- $acl = parent::_initAcl();
- return $acl;
- }
-
- protected function _makeNavigationOnePage(&$navigation, $r, $t, $isAdmin, $locale = false) {
- $page = parent::_makeNavigationOnePage($navigation, $r, $t, $isAdmin, $locale);
-
- if (!$page) {
- return;
- }
-
- if ($page->getTemplate() == 'casestudies') {
- $this->addStudiesPages($page, $locale, $isAdmin);
- }
-
- if ($page->getTemplate() == 'realisations') {
- $this->addRealisationsPages($page, $locale, $isAdmin);
- }
- }
-
- /**
- *
- * @param CubeIT_Navigation_Page_Locale $page
- */
- protected function addRealisationsPages($page, $locale, $isAdmin) {
-
- $datas = $this->getCMSDatasOfNavigationPage($page);
- $db = Zend_Db_Table::getDefaultAdapter();
- $s = $db->select()->from('realisations')
- ->order('id ASC');
- $q = $s->query();
-
- while ($r = $q->fetch()) {
- $r = CubeIT_Util_Cms::unserialize($r, $locale);
- 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($online);
- $p->setEditable(false);
- $p->setOnline($online);
- $p->setDomain($page->getDomain());
- $p->setLabel($r->titre);
- $p->setTitle($r->titre);
- $p->setParams(array('realisation_id' => $r->id));
- $page->addPage($p);
- }
- }
-
- /**
- *
- * @param CubeIT_Navigation_Page_Locale $page
- */
- protected function addStudiesPages($page, $locale, $isAdmin) {
- $datas = $this->getCMSDatasOfNavigationPage($page);
- $db = Zend_Db_Table::getDefaultAdapter();
- $s = $db->select()->from('casestudies')
- ->order('id ASC');
- $q = $s->query();
-
- while ($r = $q->fetch()) {
- $r = CubeIT_Util_Cms::unserialize($r, $locale);
- 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($online);
- $p->setTitle($r->titre);
- $p->setEditable(false);
- $p->setParams(array('casestudy_id' => $r->id));
- $p->setOnline($online);
- $p->setDomain($page->getDomain());
- $p->setLabel($r->titre);
- $page->addPage($p);
- }
- }
-
- /**
- *
- * @return array
- */
- public function getCMSTemplates() {
-
- $templates = parent::getCMSTemplates();
-
- $templates['text'] = 'Text page';
- $templates['agence'] = "About us";
- $templates['realisations'] = 'Réalisations';
- $templates['Etudes de cas'] = array('casestudies' => 'Accueil des études de cas', 'casestudies_detail' => 'Détail d\'étude de cas');
- $templates['Expertises'] = array('expertises' => 'Accueil de la rubrique Expertises',
- 'expertise' => 'Page de détail d\'expertise');
- $templates['news'] = 'News';
- $templates['contact'] = 'Contact';
-
- return $templates;
- }
-
- /**
- *
- * @param Zend_Controller_Request_Http $req
- * @return boolean|string
- */
- public function handleRedirections($req) {
- $res = parent::handleRedirections($req);
- if ($res !== false) {
-
- return $res;
- }
-
- $path = trim($req->getPathInfo(), '/ ');
- $e = explode('/', $path);
- $locale = array_shift($e);
- fb($locale);
-
- $res = '/';
-
-
- if (!count($e)) {
- return $res;
- }
-
- if ($locale == 'references_web') {
- $res .= 'Portfolio';
- return $res;
- }
-
- if ($locale != 'fr' && $locale != 'en') {
- return false;
- }
-
- if ($locale == 'fr' && $_SERVER['HTTP_HOST'] == 'www.cubedesigners.com') {
- return 'http://www.cubedesigners.fr/' . $_SERVER['REQUEST_URI'];
- }
- if ($locale == 'en' && $_SERVER['HTTP_HOST'] == 'www.cubedesigners.fr') {
- return 'http://www.cubedesigners.com/' . $_SERVER['REQUEST_URI'];
- }
-
- if (count($e) == 1) {
- $u = $e[0];
- if ($u == 'en') {
- return $res;
- }
- if ($u == '1-Sites-internet') {
- $res .= 'Projets-Web';
- } elseif ($u == '2-Design-graphique') {
- $res .= 'Graphisme';
- } elseif ($u == '3-Design-industriel') {
- $res .= 'Design-industriel';
- } elseif ($u == '4-Multimedia-Jeux') {
- $res .= 'Multimedia';
- } elseif ($u == '5-Films-Animation') {
- $res .= 'Multimedia';
- } elseif ($u == '6-Applications-mobiles') {
- $res .= 'Projets-Web';
- } elseif ($u == '7-En-attente') {
- $res .= 'Graphisme';
- } elseif ($u == '1-Websites') {
- $res .= 'Web-projects';
- } elseif ($u == '2-Graphic-design') {
- $res .= 'Graphical-design';
- } elseif ($u == '3-Industrial-design') {
- $res .= 'Industrial-design';
- } elseif ($u == '4-Multimedia-Games') {
- $res .= 'Multimedia';
- } elseif ($u == '5-Motion-Graphics') {
- $res .= 'Multimedia';
- } elseif ($u == '6-Mobile-applications') {
- $res .= 'Web-projects';
- } elseif ($u == '7-Waiting') {
- $res .= 'Graphical-design';
- }
-
- return $res;
- }
-
- if (count($e) == 3) {
- if ($e[0] == 'Sites-internet') {
- $e[0] = 'Site-Web';
- } elseif ($e[0] == 'Multimedia-Jeux' || $e[0] == 'Multimedia-Games') {
- $e[0] = 'Multimedia';
- } elseif ($e[0] == 'Motion-Graphics') {
- $e[0] = 'Motion-graphics';
- } elseif ($e[0] == 'Graphic-design') {
- $e[0] = 'Graphic-Design';
- } elseif ($e[0] == 'Mobile-applications') {
- $e[0] = 'Websites';
- }
-
- // Projects
- /// Mobile-applications/Heredis/114-Heredis-App => Applications-mobiles/Heredis-Heredis-App
- $ee = explode('-', $e[2], 2);
- $id = array_shift($ee);
- /*$p=$this->getNavigation()->findOneBy('id',$locale.'/3/'.$id);
- if(null!==$p){
- //return $p->getHref();
- }*/
-
- $res .= $e[0] . '/' . $e[1] . '-' . implode('-', $ee);
- return $res;
- }
-
- return false;
- }
-
- public function run() {
- // run have to be the last call of bootstrap
- parent::run();
- }
-
- function __destroy() {
- endProfile();
- }
+class Bootstrap extends CubeIT_Bootstrap
+{
+
+ // protected $_cacheNavigation = false;
+
+ protected function _initMinimum()
+ {
+ parent::_initMinimum();
+ // If a project with html display (don't activate by default for web services apps
+ $this->bootstrap('doctype');
+ $this->bootstrap('scripts');
+ }
+
+ protected function _initRouter($initCms = true, $standard = true)
+ {
+ $router = parent::_initRouter($initCms, $standard);
+ $router->addStandardRoute('rss');
+ return $router;
+ }
+
+ protected function _initAcl()
+ {
+ $acl = parent::_initAcl();
+ return $acl;
+ }
+
+ protected function _makeNavigationOnePage(&$navigation, $r, $t, $isAdmin, $locale = false)
+ {
+ $page = parent::_makeNavigationOnePage($navigation, $r, $t, $isAdmin, $locale);
+
+ if (!$page) {
+ return;
+ }
+
+ if ($page->getTemplate() == 'casestudies') {
+ $this->addStudiesPages($page, $locale, $isAdmin);
+ }
+
+ if ($page->getTemplate() == 'realisations') {
+ $this->addRealisationsPages($page, $locale, $isAdmin);
+ }
+ }
+
+ /**
+ *
+ * @param CubeIT_Navigation_Page_Locale $page
+ */
+ protected function addRealisationsPages($page, $locale, $isAdmin)
+ {
+
+ $datas = $this->getCMSDatasOfNavigationPage($page);
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $s = $db->select()->from('realisations')
+ ->order('id ASC');
+ $q = $s->query();
+
+ while ($r = $q->fetch()) {
+ $r = CubeIT_Util_Cms::unserialize($r, $locale);
+ 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($online);
+ $p->setEditable(false);
+ $p->setOnline($online);
+ $p->setDomain($page->getDomain());
+ $p->setLabel($r->titre);
+ $p->setTitle($r->titre);
+ $p->setParams(array('realisation_id' => $r->id));
+ $page->addPage($p);
+ }
+ }
+
+ /**
+ *
+ * @param CubeIT_Navigation_Page_Locale $page
+ */
+ protected function addStudiesPages($page, $locale, $isAdmin)
+ {
+ $datas = $this->getCMSDatasOfNavigationPage($page);
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $s = $db->select()->from('casestudies')
+ ->order('id ASC');
+ $q = $s->query();
+
+ while ($r = $q->fetch()) {
+ $r = CubeIT_Util_Cms::unserialize($r, $locale);
+ 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($online);
+ $p->setTitle($r->titre);
+ $p->setEditable(false);
+ $p->setParams(array('casestudy_id' => $r->id));
+ $p->setOnline($online);
+ $p->setDomain($page->getDomain());
+ $p->setLabel($r->titre);
+ $page->addPage($p);
+ }
+ }
+
+ /**
+ *
+ * @return array
+ */
+ public function getCMSTemplates()
+ {
+
+ $templates = parent::getCMSTemplates();
+
+ $templates['text'] = 'Text page';
+ $templates['agence'] = "About us";
+ $templates['realisations'] = 'Réalisations';
+ $templates['Etudes de cas'] = array('casestudies' => 'Accueil des études de cas', 'casestudies_detail' => 'Détail d\'étude de cas');
+ $templates['services'] = 'Services';
+ $templates['news'] = 'News';
+ $templates['contact'] = 'Contact';
+
+ return $templates;
+ }
+
+ /**
+ *
+ * @param Zend_Controller_Request_Http $req
+ * @return boolean|string
+ */
+ public function handleRedirections($req)
+ {
+ $res = parent::handleRedirections($req);
+ if ($res !== false) {
+
+ return $res;
+ }
+
+ $path = trim($req->getPathInfo(), '/ ');
+ $e = explode('/', $path);
+ $locale = array_shift($e);
+ fb($locale);
+
+ $res = '/';
+
+
+ if (!count($e)) {
+ return $res;
+ }
+
+ if ($locale == 'references_web') {
+ $res .= 'Portfolio';
+ return $res;
+ }
+
+ if ($locale != 'fr' && $locale != 'en') {
+ return false;
+ }
+
+ if ($locale == 'fr' && $_SERVER['HTTP_HOST'] == 'www.cubedesigners.com') {
+ return 'http://www.cubedesigners.fr/' . $_SERVER['REQUEST_URI'];
+ }
+ if ($locale == 'en' && $_SERVER['HTTP_HOST'] == 'www.cubedesigners.fr') {
+ return 'http://www.cubedesigners.com/' . $_SERVER['REQUEST_URI'];
+ }
+
+ if (count($e) == 1) {
+ $u = $e[0];
+ if ($u == 'en') {
+ return $res;
+ }
+ if ($u == '1-Sites-internet') {
+ $res .= 'Projets-Web';
+ } elseif ($u == '2-Design-graphique') {
+ $res .= 'Graphisme';
+ } elseif ($u == '3-Design-industriel') {
+ $res .= 'Design-industriel';
+ } elseif ($u == '4-Multimedia-Jeux') {
+ $res .= 'Multimedia';
+ } elseif ($u == '5-Films-Animation') {
+ $res .= 'Multimedia';
+ } elseif ($u == '6-Applications-mobiles') {
+ $res .= 'Projets-Web';
+ } elseif ($u == '7-En-attente') {
+ $res .= 'Graphisme';
+ } elseif ($u == '1-Websites') {
+ $res .= 'Web-projects';
+ } elseif ($u == '2-Graphic-design') {
+ $res .= 'Graphical-design';
+ } elseif ($u == '3-Industrial-design') {
+ $res .= 'Industrial-design';
+ } elseif ($u == '4-Multimedia-Games') {
+ $res .= 'Multimedia';
+ } elseif ($u == '5-Motion-Graphics') {
+ $res .= 'Multimedia';
+ } elseif ($u == '6-Mobile-applications') {
+ $res .= 'Web-projects';
+ } elseif ($u == '7-Waiting') {
+ $res .= 'Graphical-design';
+ }
+
+ return $res;
+ }
+
+ if (count($e) == 3) {
+ if ($e[0] == 'Sites-internet') {
+ $e[0] = 'Site-Web';
+ } elseif ($e[0] == 'Multimedia-Jeux' || $e[0] == 'Multimedia-Games') {
+ $e[0] = 'Multimedia';
+ } elseif ($e[0] == 'Motion-Graphics') {
+ $e[0] = 'Motion-graphics';
+ } elseif ($e[0] == 'Graphic-design') {
+ $e[0] = 'Graphic-Design';
+ } elseif ($e[0] == 'Mobile-applications') {
+ $e[0] = 'Websites';
+ }
+
+ // Projects
+ /// Mobile-applications/Heredis/114-Heredis-App => Applications-mobiles/Heredis-Heredis-App
+ $ee = explode('-', $e[2], 2);
+ $id = array_shift($ee);
+ /*$p=$this->getNavigation()->findOneBy('id',$locale.'/3/'.$id);
+ if(null!==$p){
+ //return $p->getHref();
+ }*/
+
+ $res .= $e[0] . '/' . $e[1] . '-' . implode('-', $ee);
+ return $res;
+ }
+
+ return false;
+ }
+
+ public function run()
+ {
+ // run have to be the last call of bootstrap
+ parent::run();
+ }
+
+ function __destroy()
+ {
+ endProfile();
+ }
}