]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 26 Jan 2012 16:03:46 +0000 (16:03 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 26 Jan 2012 16:03:46 +0000 (16:03 +0000)
inc/ws/Metier/class.ws.lang.php
inc/ws/Util/packager/class.ws.packager.v1.php

index b291a51a660c6dd8d4d6a2689453bd2ebdd01c54..effdf1fba20973396c60cc478d7c321aea02201a 100644 (file)
@@ -1,5 +1,7 @@
 <?php\r
+\r
 class wsLang extends cubeMetier {\r
+\r
        public static $idtonew = array('overview' => 1,\r
                'normal view' => 2,\r
                'zoom in' => 3,\r
@@ -64,32 +66,55 @@ class wsLang extends cubeMetier {
                'no bookmarks added' => 62,\r
                'functionality dont work when in fullscreen mode' => 63,\r
                "you don't have any bookmark" => 64);\r
-\r
        protected $lang_id;\r
        protected $font;\r
        protected $charset;\r
        protected $traductions;\r
        protected $nsis;\r
 \r
-       public static function getTraductionWithId($traductions)\r
-       {\r
+       public static function getTraductionWithId($traductions) {\r
                $res = array();\r
-               foreach($traductions as $k => $v) {\r
+               foreach ($traductions as $k => $v) {\r
                        $res[array_search($k, self::$idtonew)] = $v;\r
                }\r
                return $res;\r
        }\r
 \r
-       public static function checkTranslations($traductions)\r
-       {\r
-               foreach($traductions as $k => $v) {\r
-                       if (is_int($k) || intval($k)>0) {\r
+       public static function getTraductionsForV1($traductions) {\r
+               $res = array();\r
+               $new = 100;\r
+               foreach ($traductions as $k => $v) {\r
+                       if (isset(self::$idtonew[$k])) {\r
+                               $res[self::$idtonew[$k]] = $v;\r
+                       } else {\r
+                               $res[$new] = $v;\r
+                               $new++;\r
+                       }\r
+               }\r
+               ksort($res);\r
+               return $res;\r
+       }\r
+\r
+       public static function checkTranslations($traductions) {\r
+               foreach ($traductions as $k => $v) {\r
+                       if (is_int($k) || intval($k) > 0) {\r
                                $traductions = wsLang::getTraductionWithId($traductions);\r
                        }\r
                        break;\r
                }\r
                return $traductions;\r
        }\r
+\r
+       public function getV1XML() {\r
+               $xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?><movie />');\r
+\r
+               $traductions = self::getTraductionsForV1($this->traductions);\r
+               foreach ($traductions as $text) {\r
+                       $xml->addChild('tradText', htmlspecialchars($text));\r
+               }\r
+               return $xml;\r
+       }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index bcdbb1eb6c1324b4d19140b00bc5954292437ce1..90d8d4e36e2304f3cd55d3ec37e635f54add5f1b 100644 (file)
@@ -25,6 +25,7 @@ class wsPackagerV1 extends wsPackagerHTML {
                $this->copyLinks();
                $this->copyConfig();
                $this->copyTheme();
+               $this->copyLang();
        }
 
        protected function copyThumbnails() {
@@ -198,6 +199,17 @@ class wsPackagerV1 extends wsPackagerHTML {
                
        }
 
+       protected function copyLang() {
+               global $core;
+               $mapping = wsLang::$idtonew;
+
+               $daoLang = new wsDAOLang($core->con);
+               $lang = $daoLang->selectById($this->book->lang);
+
+               $xml = $lang->getV1XML();
+               file_put_contents($this->vdir . '/data/lang.xml', $xml->asXML());
+       }
+
        protected function _copyWorkingFile($file) {
                $src = $this->workingDir . '/' . $file;
                if (file_exists($src) && is_file($src)) {