From cc6d8c740ec6fd72333ea7839b3ea8cc598858d7 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 30 Jun 2010 11:23:11 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.flash.php | 12 +++++++-- inc/ws/DAO/class.ws.dao.book.php | 36 +++++++++++++++++++++++++-- inc/ws/Metier/class.ws.book.php | 2 +- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index 058116499..77ca90cec 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -84,7 +84,7 @@ class wsFlash extends cubeFlashGateway { { global $core; $dao = new wsDAOBook($core->con); - $book=$dao->selectById($this->args['book_id']); + $book = $dao->selectById($this->args['book_id']); $pages = $dao->getPagesOfBook($this->args['book_id']); $p = $this->xml->addChild('pages'); $docs = array(); @@ -101,7 +101,7 @@ class wsFlash extends cubeFlashGateway { } $docs = array_unique($docs); $p->addAttribute('documents', implode(',', $docs)); - $this->xml->addChild('numerotation',json_encode($book->numerotation)); + $this->xml->addChild('numerotation', $book->numerotation); } public function processConversionSession() @@ -335,6 +335,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); $daoDoc = new wsDAODocument($core->con); $firstDoc = $daoDoc->selectById($pages[1]['document_id']); @@ -459,6 +460,13 @@ class wsFlash extends cubeFlashGateway { $dao = new wsDAOBook($core->con); $dao->setLang($this->args['book_id'], $this->args['lang_id'], $this->args['traductions']); } + + public function saveComposition() + { + global $core; + $dao = new wsDAOBook($core->con); + $dao->setComposition($this->args['book_id'], json_decode($this->args['pages'])); + } } ?> \ No newline at end of file diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 4e891f317..960a5e294 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -311,6 +311,38 @@ class wsDAOBook extends extranetDAO { $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } + public function setComposition($book_id, $pages) + { + $numerotation = array(); + $nb_pages = 0; + foreach($pages as $p) { + $numerotation[] = $p->virtual; + $nb_pages++; + } + + $book = $this->selectById($book_id); + $parametres = $book->parametres; + $parametres->pages = $nb_pages; + + $c = $this->con->openCursor('books'); + $c->parametres = serialize($parametres); + $c->numerotation = implode(',', $numerotation); + $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); + + $this->con->execute('DELETE FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\''); + + $c = $this->con->openCursor('book_pages'); + $c->book_id = $book_id; + $i = 1; + foreach($pages as $p) { + $c->document_id = $p->document_id; + $c->document_page = $p->document_page; + $c->book_page = $i; + $c->insert(); + $i++; + } + } + public function getLinksFromCSV($book_id) { $booleans = array('video_loop', 'video_auto_start', 'video_controls', 'video_sound_on'); @@ -331,7 +363,7 @@ class wsDAOBook extends extranetDAO { continue; } $link = array(); - $cols = array('page' => '', 'type' => '', 'to' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'infobulle' => ''); + $cols = array('page' => '', 'type' => '', 'to' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'infobulle' => '', 'numerotation' => 'physical'); $k = 0; foreach($cols as $col => $default) { if (isset($line[$k])) { @@ -352,7 +384,7 @@ class wsDAOBook extends extranetDAO { return $res; } - public function getNumerotationFromDocs() + public function getNumerotationFromDocs($book_id) { $pages = $this->getPagesOfBook($book_id); } diff --git a/inc/ws/Metier/class.ws.book.php b/inc/ws/Metier/class.ws.book.php index e028b805d..5bd6ac9f8 100644 --- a/inc/ws/Metier/class.ws.book.php +++ b/inc/ws/Metier/class.ws.book.php @@ -40,7 +40,7 @@ class wsBook extends cubeMetier { throw new Exception($msg); } - $classic = array('chapters', 'links', 'rulers', 'traductions', 'numerotation'); + $classic = array('chapters', 'links', 'rulers', 'traductions'); if (in_array($varname, $classic)) { if (is_array($this->$varname)) { -- 2.39.5