\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
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
$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