]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 1 Jul 2010 08:36:57 +0000 (08:36 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 1 Jul 2010 08:36:57 +0000 (08:36 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/DAO/class.ws.dao.book.php

index e238a53547613c473fcc226ae19d623bbe291833..37a0f95d845f577828810d993b55d18a56da59f4 100644 (file)
@@ -88,6 +88,7 @@ class wsFlash extends cubeFlashGateway {
                $pages = $dao->getPagesOfBook($this->args['book_id']);\r
                $p = $this->xml->addChild('pages');\r
                $docs = array();\r
+               $defaultNum = array();\r
                foreach($pages as $page => $info) {\r
                        $file = ROOT . '/docs/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';\r
                        $dim = getimagesize($file);\r
@@ -98,10 +99,15 @@ class wsFlash extends cubeFlashGateway {
                        $pa->addAttribute('width', $dim[0]);\r
                        $pa->addAttribute('height', $dim[1]);\r
                        $docs[] = $info['document_id'];\r
+                       $defaultNum[] = $info['defaultNum'];\r
                }\r
                $docs = array_unique($docs);\r
                $p->addAttribute('documents', implode(',', $docs));\r
-               $this->xml->addChild('numerotation', $book->numerotation);\r
+               if (is_null($book->numerotation) || !$book->numerotation || $book->numerotation=='null') {\r
+                       $this->xml->addChild('numerotation', implode(',', $defaultNum));\r
+               } else {\r
+                       $this->xml->addChild('numerotation', $book->numerotation);\r
+               }\r
        }\r
 \r
        public function processConversionSession()\r
@@ -335,7 +341,7 @@ class wsFlash extends cubeFlashGateway {
                $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
+               $this->xml->addChild('numerotation', $book->numerotation);\r
 \r
                $daoDoc = new wsDAODocument($core->con);\r
                $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
index 960a5e2940d58ba4589c42bff012e11511fce942..e60e61cd49e238ffbc5f772f44d53dfb3cd55e0e 100644 (file)
@@ -155,10 +155,12 @@ class wsDAOBook extends extranetDAO {
        public function getPagesOfBook($book_id)\r
        {\r
                $pages = array();\r
-               $r = $this->con->select('SELECT * FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page');\r
+               $r = $this->con->select('SELECT b.*,d.numberSections AS num FROM book_pages b LEFT JOIN documents d ON d.document_id=b.document_id WHERE b.book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page');\r
                while ($r->fetch()) {\r
-                       $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page);\r
+                       $n = explode(',',$r->num);\r
+                       $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page, 'defaultNum' => $n[$r->document_page-1]);\r
                }\r
+               fb($pages);\r
                return $pages;\r
        }\r
 \r