From: vincent@cubedesigners.com Date: Thu, 1 Jul 2010 08:36:57 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=18686aacb4e0c929d8845c9b3171061c2cbe309c;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index e238a5354..37a0f95d8 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -88,6 +88,7 @@ class wsFlash extends cubeFlashGateway { $pages = $dao->getPagesOfBook($this->args['book_id']); $p = $this->xml->addChild('pages'); $docs = array(); + $defaultNum = array(); foreach($pages as $page => $info) { $file = ROOT . '/docs/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg'; $dim = getimagesize($file); @@ -98,10 +99,15 @@ class wsFlash extends cubeFlashGateway { $pa->addAttribute('width', $dim[0]); $pa->addAttribute('height', $dim[1]); $docs[] = $info['document_id']; + $defaultNum[] = $info['defaultNum']; } $docs = array_unique($docs); $p->addAttribute('documents', implode(',', $docs)); - $this->xml->addChild('numerotation', $book->numerotation); + if (is_null($book->numerotation) || !$book->numerotation || $book->numerotation=='null') { + $this->xml->addChild('numerotation', implode(',', $defaultNum)); + } else { + $this->xml->addChild('numerotation', $book->numerotation); + } } public function processConversionSession() @@ -335,7 +341,7 @@ class wsFlash extends cubeFlashGateway { $pages = $dao->getPagesOfBook($this->args['book_id']); $nb_pages = count($pages); $this->xml->addChild('pages', $nb_pages); - $this->xml->addChild('numerotation',$book->numerotation); + $this->xml->addChild('numerotation', $book->numerotation); $daoDoc = new wsDAODocument($core->con); $firstDoc = $daoDoc->selectById($pages[1]['document_id']); diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 960a5e294..e60e61cd4 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -155,10 +155,12 @@ class wsDAOBook extends extranetDAO { public function getPagesOfBook($book_id) { $pages = array(); - $r = $this->con->select('SELECT * FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page'); + $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'); while ($r->fetch()) { - $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page); + $n = explode(',',$r->num); + $pages[$r->book_page] = array('document_id' => $r->document_id, 'document_page' => $r->document_page, 'defaultNum' => $n[$r->document_page-1]); } + fb($pages); return $pages; }