From: vincent@cubedesigners.com Date: Tue, 26 Jul 2016 15:05:26 +0000 (+0000) Subject: done #577 @0:40 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=eaf2731fe755163ab6101a2473269cfa7993c79b;p=fluidbook-v3.git done #577 @0:40 --- diff --git a/framework/application/Bootstrap.php b/framework/application/Bootstrap.php index 4fc6368..083e889 100644 --- a/framework/application/Bootstrap.php +++ b/framework/application/Bootstrap.php @@ -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(); }