]> _ Git - fluidbook-v3.git/commitdiff
wip #3726 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Jun 2020 10:07:58 +0000 (10:07 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Jun 2020 10:07:58 +0000 (10:07 +0000)
framework/application/Bootstrap.php

index 7215eae22fdd7e832df846e2ca8c80f4f9369a2b..77f797bd953deb61ff96315191df2c9d4a9551f4 100644 (file)
@@ -1,34 +1,38 @@
 <?php
 
-class Bootstrap extends CubeIT_Bootstrap {
-
-       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');
-       }
-
-       /**
-        *
-        * @return array
-        */
-       public function getCMSTemplates() {
-               $templates['texte'] = 'Texte';
-               $templates['fonctionnalites'] = 'Fonctionnalités générales';
-               $templates['fonctionnalitessub'] = 'Détail fonctionnalité';
-               $templates['exemples'] = 'Exemples';
-               $templates['exemplessub'] = 'Exemples (niveau 2)';
-               $templates['contact'] = 'Contact';
-               $templates['landingcampaign'] = 'Landing Campagne (Intro + formulaire)';
-               $templates['agences'] = 'Agences';
-               $templates['faq'] = 'FAQ';
-               $templates['blog'] = 'Blog';
-               $templates = array_merge($templates, parent::getCMSTemplates());
-               return $templates;
-       }
-
-    protected function _makeNavigationOnePage(&$navigation, $r, $t, $isAdmin, $locale = false) {
+class Bootstrap extends CubeIT_Bootstrap
+{
+
+    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');
+    }
+
+    /**
+     *
+     * @return array
+     */
+    public function getCMSTemplates()
+    {
+        $templates['texte'] = 'Texte';
+        $templates['fonctionnalites'] = 'Fonctionnalités générales';
+        $templates['fonctionnalitessub'] = 'Détail fonctionnalité';
+        $templates['exemples'] = 'Exemples';
+        $templates['exemplessub'] = 'Exemples (niveau 2)';
+        $templates['contact'] = 'Contact';
+        $templates['landingcampaign'] = 'Landing Campagne (Intro + formulaire)';
+        $templates['agences'] = 'Agences';
+        $templates['faq'] = 'FAQ';
+        $templates['blog'] = 'Blog';
+        $templates = array_merge($templates, parent::getCMSTemplates());
+        return $templates;
+    }
+
+    protected function _makeNavigationOnePage(&$navigation, $r, $t, $isAdmin, $locale = false)
+    {
         $page = parent::_makeNavigationOnePage($navigation, $r, $t, $isAdmin, $locale);
 
         if (!$page) return;
@@ -39,12 +43,14 @@ class Bootstrap extends CubeIT_Bootstrap {
     }
 
     // URL template used for blog pages
-    public static function getBlogPostURLTemplate() {
+    public static function getBlogPostURLTemplate()
+    {
         return 'blog/%title%';
     }
 
     /* @param CubeIT_Navigation_Page_Locale $page */
-    protected function addBlogPages($page, $locale, $isAdmin) {
+    protected function addBlogPages($page, $locale, $isAdmin)
+    {
         //$datas = $this->getCMSDatasOfNavigationPage($page);
 
         // How the URLs should be formed for the news articles
@@ -67,7 +73,7 @@ class Bootstrap extends CubeIT_Bootstrap {
 
             $p = new CubeIT_Navigation_Page_Locale();
             $p->setController('Blogpost');
-            $p->setId($locale .'/blog/'. $r->id);
+            $p->setId($page->getId() . '/' . $r->id);
             $p->setAutoUri($r, $URL_template, $locale);
             $p->setSitemap($online);
             $p->setTitle($pageTitle);
@@ -76,97 +82,101 @@ class Bootstrap extends CubeIT_Bootstrap {
             $p->setOnline($online);
             $p->setDomain($page->getDomain());
             $p->setLabel($pageTitle);
+            $p->setVisible(false);
             $page->addPage($p);
         }
     }
 
 
-    public function _initRouter($initCms = true, $standard = true) {
-               profile(__FILE__, __LINE__, 'Init Router');
-               $router = parent::_initRouter($initCms, $standard);
-               $router->addStaticRoute('15000', 'landing', 'quinzemille');
-
-               return $router;
-       }
-
-       public function handleRedirections($req) {
-               profile(__FILE__, __LINE__, 'Handle redirection');
-
-               $path = explode('/', trim($req->getParam('page', '/'), '/'));
-
-               if ($path[0] == 'fr' || $path[0] == 'en') {
-                       $locale = $path[0];
-                       $domain = $this->getOpt('locales.' . $path[0]);
-               } else {
-                       return false;
-               }
-               array_shift($path);
-
-               $path = implode('/', $path);
-
-               // Si un des cas ci-dessus
-               if (isset($name)) {
-                       $nav = $this->getNavigation()->getLocaleContainer($locale);
-                       $page = $nav->findOneBy('name', $name);
-                       if ($page !== null) {
-                               return $page->getHref();
-                       }
-               }
-               // Autres redirections
-
-               $map = array();
-               $map['fr'] = array(
-                       'Questions-reponses' => 'fonctionnalites',
-                       'Presentation-fonctionnalites-services' => 'fonctionnalites',
-                       'Demande-de-devis' => 'contact',
-                       'Revendeurs' => 'agences',
-                       'References' => 'exemples',
-                       'References/catalogues' => 'catalogue-interactif',
-                       'References/rapports' => 'rapport-annuel',
-                       'References/magazines' => 'magazine',
-                       'References/brochures' => 'brochure',
-               );
-
-               $map['en'] = array(
-                       'Faq' => 'fonctionnalites',
-                       'Overview' => 'fonctionnalites',
-                       'Quote-request' => 'contact',
-                       'Resellers' => 'agences',
-                       'Clients' => 'exemples',
-                       'Clients/catalogues' => 'catalogue-interactif',
-                       'Clients/rapports' => 'rapport-annuel',
-                       'Clients/magazines' => 'magazine',
-                       'Clients/brochures' => 'brochure',
-               );
-
-               if (!isset($map[$locale][$path]) && (strpos($path, 'References') === 0 || strpos($path, 'Clients') === 0)) {
-                       $nav = $this->getNavigation()->getLocaleContainer($locale);
-                       $page = $nav->findOneBy('name', 'exemples');
-                       if ($page != null) {
-                               return $page->getHref();
-                       }
-               }
-
-               if (isset($map[$locale][$path])) {
-                       $nav = $this->getNavigation()->getLocaleContainer($locale);
-                       $page = $nav->findOneBy('name', $map[$locale][$path]);
-                       if ($page != null) {
-                               return $page->getHref();
-                       }
-               } else {
-                       $url = SITE_PROTOCOL . $domain . '/';
-               }
-
-               if (isset($url)) {
-                       return $url;
-               }
-
-               return false;
-       }
-
-
-       function __destroy() {
-               endProfile();
-       }
+    public function _initRouter($initCms = true, $standard = true)
+    {
+        profile(__FILE__, __LINE__, 'Init Router');
+        $router = parent::_initRouter($initCms, $standard);
+        $router->addStaticRoute('15000', 'landing', 'quinzemille');
+
+        return $router;
+    }
+
+    public function handleRedirections($req)
+    {
+        profile(__FILE__, __LINE__, 'Handle redirection');
+
+        $path = explode('/', trim($req->getParam('page', '/'), '/'));
+
+        if ($path[0] == 'fr' || $path[0] == 'en') {
+            $locale = $path[0];
+            $domain = $this->getOpt('locales.' . $path[0]);
+        } else {
+            return false;
+        }
+        array_shift($path);
+
+        $path = implode('/', $path);
+
+        // Si un des cas ci-dessus
+        if (isset($name)) {
+            $nav = $this->getNavigation()->getLocaleContainer($locale);
+            $page = $nav->findOneBy('name', $name);
+            if ($page !== null) {
+                return $page->getHref();
+            }
+        }
+        // Autres redirections
+
+        $map = array();
+        $map['fr'] = array(
+            'Questions-reponses' => 'fonctionnalites',
+            'Presentation-fonctionnalites-services' => 'fonctionnalites',
+            'Demande-de-devis' => 'contact',
+            'Revendeurs' => 'agences',
+            'References' => 'exemples',
+            'References/catalogues' => 'catalogue-interactif',
+            'References/rapports' => 'rapport-annuel',
+            'References/magazines' => 'magazine',
+            'References/brochures' => 'brochure',
+        );
+
+        $map['en'] = array(
+            'Faq' => 'fonctionnalites',
+            'Overview' => 'fonctionnalites',
+            'Quote-request' => 'contact',
+            'Resellers' => 'agences',
+            'Clients' => 'exemples',
+            'Clients/catalogues' => 'catalogue-interactif',
+            'Clients/rapports' => 'rapport-annuel',
+            'Clients/magazines' => 'magazine',
+            'Clients/brochures' => 'brochure',
+        );
+
+        if (!isset($map[$locale][$path]) && (strpos($path, 'References') === 0 || strpos($path, 'Clients') === 0)) {
+            $nav = $this->getNavigation()->getLocaleContainer($locale);
+            $page = $nav->findOneBy('name', 'exemples');
+            if ($page != null) {
+                return $page->getHref();
+            }
+        }
+
+        if (isset($map[$locale][$path])) {
+            $nav = $this->getNavigation()->getLocaleContainer($locale);
+            $page = $nav->findOneBy('name', $map[$locale][$path]);
+            if ($page != null) {
+                return $page->getHref();
+            }
+        } else {
+            $url = SITE_PROTOCOL . $domain . '/';
+        }
+
+        if (isset($url)) {
+            return $url;
+        }
+
+        return false;
+    }
+
+
+    function __destroy()
+    {
+        endProfile();
+    }
 
 }