From: vincent@cubedesigners.com Date: Tue, 10 Apr 2012 17:04:43 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=93967e65435b9c34c376fda3b697ae88f67c357b;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index efa70e4c3..f67005b5e 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -473,23 +473,44 @@ class wsFlash extends cubeFlashGateway { set_time_limit(0); + fb(time(), 'get links init'); $dao = new wsDAOBook($core->con); $book = $dao->selectById($this->args['book_id']); + $pages = $dao->getPagesOfBook($this->args['book_id']); $nb_pages = count($pages); - $this->xml->addChild('pages', $nb_pages); - $this->xml->addChild('numerotation', $book->numerotation); + + + + $daoDoc = new wsDAODocument($core->con); $firstDoc = $daoDoc->selectById($pages[1]['document_id']); $size = $firstDoc->generalInfos['size']; $daoDoc->getLinksAndRulers($this->args['book_id'], $links, $rulers); - $this->xml->addChild('width', $size[0]); - $this->xml->addChild('height', $size[1]); - $this->xml->addChild('links', html::escapeHTML(json_encode($links))); - $this->xml->addChild('rulers', json_encode($rulers)); + + $this->json = false; + $this->json = true; + + if ($this->json) { + $this->jsonDatas['pages'] = $nb_pages; + $this->jsonDatas['numerotation'] = $book->numerotation; + $this->jsonDatas['width'] = $size[0]; + $this->jsonDatas['height'] = $size[1]; + $this->jsonDatas['links'] = $links; + $this->jsonDatas['rulers'] = $rulers; + } else { + $l = json_encode($links); + $l = html::escapeHTML($l); + $this->xml->addChild('width', $size[0]); + $this->xml->addChild('height', $size[1]); + $this->xml->addChild('pages', $nb_pages); + $this->xml->addChild('numerotation', $book->numerotation); + $this->xml->addChild('links', $l); + $this->xml->addChild('rulers', json_encode($rulers)); + } $daoTheme = new wsDAOTheme($this->con); $theme = $daoTheme->getThemeOfBook($this->args['book_id'], true); @@ -505,10 +526,17 @@ class wsFlash extends cubeFlashGateway { if ($theme->parametres->$param != '') { $themeRoot = WS_THEMES . '/' . $theme->theme_id . '/'; $dim = getimagesize($themeRoot . $theme->parametres->$param); - $b = $this->xml->addChild($specialName); - $b->addChild('width', $dim[0]); - $b->addChild('height', $dim[1]); - $b->addChild('url', 'http://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/themes/' . $theme->theme_id . '/' . $theme->parametres->$param); + $url = 'http://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/themes/' . $theme->theme_id . '/' . $theme->parametres->$param; + + if ($this->json) { + $p = array('width' => $dim[0], 'height' => $dim[1], 'url' => $url); + $this->jsonDatas[$specialName] = $p; + } else { + $b = $this->xml->addChild($specialName); + $b->addChild('width', $dim[0]); + $b->addChild('height', $dim[1]); + $b->addChild('url', $url); + } } } @@ -616,8 +644,7 @@ class wsFlash extends cubeFlashGateway { $book->traductions = wsLang::checkTranslations($book->traductions); if ($book->traductions != array()) { //$bookLang = $this->xml->addChild('book_lang', json_encode($book->traductions)); - $bookLang =(array) $book->traductions; - fb($bookLang); + $bookLang = (array) $book->traductions; } }