]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 18 Dec 2012 09:11:30 +0000 (09:11 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 18 Dec 2012 09:11:30 +0000 (09:11 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Metier/class.ws.lang.php

index c3ddced6392b46b653000efedcd1bedb927983c0..5b7fba8218db03f867ad38fde5bc069431cda042 100644 (file)
@@ -359,9 +359,9 @@ class wsFlash extends cubeFlashGateway {
                        } else {\r
                                $right = 'r';\r
                        }\r
-                       \r
-                       \r
-                       \r
+\r
+\r
+\r
                        $t->addAttribute('right', $right);\r
                        $t->addAttribute('proprietaire', $theme->proprietaire_nom);\r
                        $t->addAttribute('books', max(($theme->nbBooks) - ($mine ? 1 : 0), 0));\r
@@ -635,6 +635,12 @@ class wsFlash extends cubeFlashGateway {
                        }\r
                }\r
 \r
+               if (isset($bookLang)) {\r
+                       if (wsLang::compare($bookLang, $book->lang)) {\r
+                               unset($bookLang);\r
+                       }\r
+               }\r
+\r
                $dao = new wsDAOLang($core->con);\r
                $langs = $dao->selectAll();\r
                foreach ($langs as $lang) {\r
index 52c91b7abbf7ba272927486325f59e8912e1e520..52a7377ddd71194b0bfc147f4ee6ea3cd41fe957 100644 (file)
@@ -97,6 +97,34 @@ class wsLang extends cubeMetier {
                return $res;\r
        }\r
 \r
+       public static function compare(&$traductions, $lang) {\r
+               global $core;\r
+               $daoLang = new wsDAOLang($core->con);\r
+               $lang = $daoLang->selectById($lang);\r
+\r
+               foreach ($lang->traductions as $k => $v) {\r
+                       if (!isset($traductions[$k]) || $traductions[$k] == '') {\r
+                               $traductions[$k] = $v;\r
+                               continue;\r
+                       }\r
+                       if (self::cleanstr($traductions[$k]) != self::cleanstr($v)) {\r
+                               fb(self::cleanstr($traductions[$k]));\r
+                               fb(self::cleanstr($v));\r
+                               return false;\r
+                       }\r
+               }\r
+\r
+               return true;\r
+       }\r
+\r
+       protected static function cleanstr($str) {\r
+               $str = trim($str);\r
+               $str = str_replace("\r\n", "\n", $str);\r
+               $str = str_replace("\r", "\n", $str);\r
+\r
+               return trim($str);\r
+       }\r
+\r
        public static function checkTranslations($traductions) {\r
                foreach ($traductions as $k => $v) {\r
                        if (is_int($k) || intval($k) > 0) {\r
@@ -104,6 +132,9 @@ class wsLang extends cubeMetier {
                        }\r
                        break;\r
                }\r
+               if (isset($traductions->{"0"})) {\r
+                       unset($traductions->{"0"});\r
+               }\r
                return $traductions;\r
        }\r
 \r