]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 10 Apr 2012 17:04:43 +0000 (17:04 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 10 Apr 2012 17:04:43 +0000 (17:04 +0000)
inc/ws/Controlleur/class.ws.flash.php

index efa70e4c31ebc217389e4bb927315ac021f5bf43..f67005b5eba8b844b4f3cae40438c56f6c65c398 100644 (file)
@@ -473,23 +473,44 @@ class wsFlash extends cubeFlashGateway {
 \r
                set_time_limit(0);\r
 \r
+               fb(time(), 'get links init');\r
                $dao = new wsDAOBook($core->con);\r
                $book = $dao->selectById($this->args['book_id']);\r
 \r
+\r
                $pages = $dao->getPagesOfBook($this->args['book_id']);\r
                $nb_pages = count($pages);\r
-               $this->xml->addChild('pages', $nb_pages);\r
-               $this->xml->addChild('numerotation', $book->numerotation);\r
+\r
+\r
+\r
+\r
 \r
                $daoDoc = new wsDAODocument($core->con);\r
                $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
                $size = $firstDoc->generalInfos['size'];\r
                $daoDoc->getLinksAndRulers($this->args['book_id'], $links, $rulers);\r
 \r
-               $this->xml->addChild('width', $size[0]);\r
-               $this->xml->addChild('height', $size[1]);\r
-               $this->xml->addChild('links', html::escapeHTML(json_encode($links)));\r
-               $this->xml->addChild('rulers', json_encode($rulers));\r
+\r
+               $this->json = false;\r
+               $this->json = true;\r
+\r
+               if ($this->json) {\r
+                       $this->jsonDatas['pages'] = $nb_pages;\r
+                       $this->jsonDatas['numerotation'] = $book->numerotation;\r
+                       $this->jsonDatas['width'] = $size[0];\r
+                       $this->jsonDatas['height'] = $size[1];\r
+                       $this->jsonDatas['links'] = $links;\r
+                       $this->jsonDatas['rulers'] = $rulers;\r
+               } else {\r
+                       $l = json_encode($links);\r
+                       $l = html::escapeHTML($l);\r
+                       $this->xml->addChild('width', $size[0]);\r
+                       $this->xml->addChild('height', $size[1]);\r
+                       $this->xml->addChild('pages', $nb_pages);\r
+                       $this->xml->addChild('numerotation', $book->numerotation);\r
+                       $this->xml->addChild('links', $l);\r
+                       $this->xml->addChild('rulers', json_encode($rulers));\r
+               }\r
 \r
                $daoTheme = new wsDAOTheme($this->con);\r
                $theme = $daoTheme->getThemeOfBook($this->args['book_id'], true);\r
@@ -505,10 +526,17 @@ class wsFlash extends cubeFlashGateway {
                if ($theme->parametres->$param != '') {\r
                        $themeRoot = WS_THEMES . '/' . $theme->theme_id . '/';\r
                        $dim = getimagesize($themeRoot . $theme->parametres->$param);\r
-                       $b = $this->xml->addChild($specialName);\r
-                       $b->addChild('width', $dim[0]);\r
-                       $b->addChild('height', $dim[1]);\r
-                       $b->addChild('url', 'http://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/themes/' . $theme->theme_id . '/' . $theme->parametres->$param);\r
+                       $url = 'http://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/themes/' . $theme->theme_id . '/' . $theme->parametres->$param;\r
+\r
+                       if ($this->json) {\r
+                               $p = array('width' => $dim[0], 'height' => $dim[1], 'url' => $url);\r
+                               $this->jsonDatas[$specialName] = $p;\r
+                       } else {\r
+                               $b = $this->xml->addChild($specialName);\r
+                               $b->addChild('width', $dim[0]);\r
+                               $b->addChild('height', $dim[1]);\r
+                               $b->addChild('url', $url);\r
+                       }\r
                }\r
        }\r
 \r
@@ -616,8 +644,7 @@ class wsFlash extends cubeFlashGateway {
                        $book->traductions = wsLang::checkTranslations($book->traductions);\r
                        if ($book->traductions != array()) {\r
                                //$bookLang = $this->xml->addChild('book_lang', json_encode($book->traductions));\r
-                               $bookLang =(array) $book->traductions;\r
-                               fb($bookLang);\r
+                               $bookLang = (array) $book->traductions;\r
                        }\r
                }\r
 \r