public function getCMSTemplates() {
-
$templates['texte'] = 'Texte';
$templates['fonctionnalites'] = 'Fonctionnalites';
$templates['exemples'] = 'Exemples';
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();
}