]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Jun 2010 17:07:11 +0000 (17:07 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Jun 2010 17:07:11 +0000 (17:07 +0000)
inc/extranet/Controlleur/class.extranet.core.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Metier/class.ws.book.php
inc/ws/Metier/class.ws.parametres.php

index b69102b130931799c59da7babd5b7b6422d29eb3..4ed8c29dc3b95012726961d347e2ddee9b3ff78d 100644 (file)
@@ -342,7 +342,8 @@ class extranetCore extends cubeCore {
                $db->books->chapters('text', 0, false);\r
                $db->books->links('text', 0, false);\r
                $db->books->rulers('text', 0, false);\r
-               $db->books->extras('text',0,false);\r
+               $db->books->extras('text', 0, false);\r
+               $db->books->traductions('text', 0, false);\r
                $db->books->date('integer', 0, false);\r
                // Clés\r
                $db->books->primary('pk_books', 'book_id');\r
@@ -460,7 +461,7 @@ class extranetCore extends cubeCore {
                         . 'FROM themes t '\r
                         . 'LEFT JOIN books b ON t.theme_id=b.theme '\r
                         . 'GROUP BY t.theme_id');\r
-               //cubeDb::mysqlConvert($this->con);\r
+               // cubeDb::mysqlConvert($this->con);\r
                touch($cache);\r
        }\r
 \r
index 4b44ce9c9502b278c85c7149753ca86d19856a87..5ad56eb5815274aa73f5dc9b0c0e53289c90d55f 100644 (file)
@@ -302,6 +302,13 @@ class wsFlash extends cubeFlashGateway {
                }\r
        }\r
 \r
+       public function saveSettings()\r
+       {\r
+               global $core;\r
+               $dao = new wsDAOBook($core->con);\r
+               $dao->setSettings($this->args['book_id'], $this->args['settings']);\r
+       }\r
+\r
        public function setChapters()\r
        {\r
                global $core;\r
@@ -413,13 +420,16 @@ class wsFlash extends cubeFlashGateway {
                $this->xml->addChild('infos', $res);\r
        }\r
 \r
-       public function getLangs($book_id = null)\r
+       public function getLangs()\r
        {\r
                global $core;\r
 \r
                if (isset($this->args['book_id'])) {\r
                        $dao = new wsDAOBook($core->con);\r
                        $book = $dao->selectById($this->args['book_id']);\r
+                       if ($book->traductions != array()) {\r
+                               $bookLang = $this->xml->addChild('book_lang', json_encode($book->traductions));\r
+                       }\r
                }\r
 \r
                $dao = new wsDAOLang($core->con);\r
@@ -431,9 +441,22 @@ class wsFlash extends cubeFlashGateway {
                        $l->addAttribute('nom', $lang->nom);\r
                        $l->addAttribute('embeded', $lang->embeded);\r
                        $l->addAttribute('public', $lang->public);\r
-                       $l->addAttribute('selected', (isset($book) && $book->lang == $lang->lang_id)?'1':'0');\r
+                       if ((isset($book) && $book->lang == $lang->lang_id)) {\r
+                               $l->addAttribute('selected', '1');\r
+                               $bookLang->addAttribute('id', $lang->lang_id);\r
+                               $bookLang->addAttribute('nom', $lang->nom . ' (' . __('modifié') . ')');\r
+                               $bookLang->addAttribute('embeded', $lang->embeded);\r
+                               $bookLang->addAttribute('public', $lang->public);\r
+                       }\r
                }\r
        }\r
+\r
+       public function saveLang()\r
+       {\r
+               global $core;\r
+               $dao = new wsDAOBook($core->con);\r
+               $dao->setLang($this->args['book_id'], $this->args['lang_id'], $this->args['traductions']);\r
+       }\r
 }\r
 \r
 ?>
\ No newline at end of file
index 78b8c987b3f192e2fd9e206030b37ec8a4d5c112..3225d6a55430fbaa6e8906cd89f188c390899610 100644 (file)
@@ -37,6 +37,12 @@ class wsDAOBook extends extranetDAO {
                        $book->rulers = json_decode($r->rulers, false);\r
                }\r
 \r
+               if ($r->traductions == '') {\r
+                       $book->traductions = array();\r
+               } else {\r
+                       $book->traductions = json_decode($r->traductions);\r
+               }\r
+\r
                $p = unserialize($r->parametres);\r
                if (!$p || $p->isEmpty()) {\r
                        $p = new wsBookParametres($book);\r
@@ -52,7 +58,7 @@ class wsDAOBook extends extranetDAO {
                $book = new wsBook();\r
                $book->book_id = 'new';\r
                $book->nom = '';\r
-               $book->lang ='fr';\r
+               $book->lang = 'fr';\r
                $book->theme = 1;\r
                $book->proprietaire = '';\r
                $book->proprietaire_id = 0;\r
@@ -124,7 +130,7 @@ class wsDAOBook extends extranetDAO {
                return $this->selectById($book_id);\r
        }\r
 \r
-       public function creeEmpty($createur,$lang)\r
+       public function creeEmpty($createur, $lang)\r
        {\r
                $c = $this->con->openCursor('books');\r
                $c->proprietaire = $createur;\r
@@ -278,6 +284,29 @@ class wsDAOBook extends extranetDAO {
                $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
        }\r
 \r
+       public function setLang($book_id, $base, $traductions)\r
+       {\r
+               $c = $this->con->openCursor('books');\r
+               $c->lang = $base;\r
+               $c->traductions = json_encode(json_decode($traductions, false));\r
+               $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
+       }\r
+\r
+       public function setSettings($book_id, $settings)\r
+       {\r
+               $book = $this->selectById($book_id);\r
+               $parametres = $book->parametres;\r
+               $new = json_decode($settings, false);\r
+               fb($new);\r
+               foreach($new as $k => $v) {\r
+                       $parametres->$k = $v;\r
+               }\r
+               $c = $this->con->openCursor('books');\r
+               $c->parametres = serialize($parametres);\r
+               $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
+               fb($parametres);\r
+       }\r
+\r
        public function getLinksFromCSV($book_id)\r
        {\r
                $booleans = array('video_loop', 'video_auto_start', 'video_controls', 'video_sound_on');\r
index de4b232481ed7eb53248bb685079e4cfaec42283..45620231ad199418e1c351b4a4f711d503ebe6d3 100644 (file)
@@ -29,6 +29,7 @@ class wsBook extends cubeMetier {
        protected $links;\r
        protected $rulers;\r
        protected $extras;\r
+       protected $traductions;\r
 }\r
 \r
 ?>
\ No newline at end of file
index dfd93309b00e01c0c77e9d4de2c4acd39acbc837..eca957eb5bfe27631d52fb1543ff39d9741e6312 100644 (file)
@@ -12,8 +12,9 @@ class wsParametres extends cubeMetier implements Iterator {
                $this->datas = array();\r
        }\r
 \r
-       public function isEmpty(){\r
-               return count($this->datas)==0;\r
+       public function isEmpty()\r
+       {\r
+               return count($this->datas) == 0;\r
        }\r
 \r
        public function setParent($parent)\r
@@ -96,13 +97,19 @@ class wsParametres extends cubeMetier implements Iterator {
 \r
                switch ($this->fields[$varname]['type']) {\r
                        case 'integer':\r
-                               $value = intval($value);\r
+                               if (!is_int($value)) {\r
+                                       $value = intval($value);\r
+                               }\r
                                break;\r
                        case 'float':\r
-                               $value = floatval($value);\r
+                               if (!is_float($value)) {\r
+                                       $value = floatval($value);\r
+                               }\r
                                break;\r
                        case 'boolean':\r
-                               $value = ($value == '' || $value == '0' || $value == 'false')?false:true;\r
+                               if (!is_bool($value)) {\r
+                                       $value = ($value == '' || $value == '0' || $value == 'false')?false:true;\r
+                               }\r
                                break;\r
                        case 'color':\r
                        case 'couleur':\r
@@ -113,7 +120,9 @@ class wsParametres extends cubeMetier implements Iterator {
                                $value = cubeMath::fill($value, 6);\r
                                break;\r
                        case 'date':\r
-                               $value = intval($value);\r
+                               if (!is_int($value)) {\r
+                                       $value = intval($value);\r
+                               }\r
                                break;\r
                        default:\r
                                $value = (string)$value;\r