]> _ Git - fluidbook-v3.git/commitdiff
done #577 @0:40
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 26 Jul 2016 15:05:26 +0000 (15:05 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 26 Jul 2016 15:05:26 +0000 (15:05 +0000)
framework/application/Bootstrap.php

index 4fc6368181dbdbc23030448dd183bcec21b89358..083e8899692b0418d0c4f7f99b1d70ab07e1526b 100644 (file)
@@ -16,7 +16,6 @@ class Bootstrap extends CubeIT_Bootstrap {
        public function getCMSTemplates() {
 
 
-
                $templates['texte'] = 'Texte';
                $templates['fonctionnalites'] = 'Fonctionnalites';
                $templates['exemples'] = 'Exemples';
@@ -28,6 +27,85 @@ class Bootstrap extends CubeIT_Bootstrap {
                return $templates;
        }
 
+       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' => 'faq',
+                       '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' => 'faq',
+                       '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 = 'http://' . $domain . '/';
+               }
+
+               if (isset($url)) {
+                       return $url;
+               }
+
+               return false;
+       }
+
+
        function __destroy() {
                endProfile();
        }