{\r
global $core;\r
$dao = new wsDAOBook($core->con);\r
- $book=$dao->selectById($this->args['book_id']);\r
+ $book = $dao->selectById($this->args['book_id']);\r
$pages = $dao->getPagesOfBook($this->args['book_id']);\r
$p = $this->xml->addChild('pages');\r
$docs = array();\r
}\r
$docs = array_unique($docs);\r
$p->addAttribute('documents', implode(',', $docs));\r
- $this->xml->addChild('numerotation',json_encode($book->numerotation));\r
+ $this->xml->addChild('numerotation', $book->numerotation);\r
}\r
\r
public function processConversionSession()\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
$daoDoc = new wsDAODocument($core->con);\r
$firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
$dao = new wsDAOBook($core->con);\r
$dao->setLang($this->args['book_id'], $this->args['lang_id'], $this->args['traductions']);\r
}\r
+\r
+ public function saveComposition()\r
+ {\r
+ global $core;\r
+ $dao = new wsDAOBook($core->con);\r
+ $dao->setComposition($this->args['book_id'], json_decode($this->args['pages']));\r
+ }\r
}\r
\r
?>
\ No newline at end of file
$c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
}\r
\r
+ public function setComposition($book_id, $pages)\r
+ {\r
+ $numerotation = array();\r
+ $nb_pages = 0;\r
+ foreach($pages as $p) {\r
+ $numerotation[] = $p->virtual;\r
+ $nb_pages++;\r
+ }\r
+\r
+ $book = $this->selectById($book_id);\r
+ $parametres = $book->parametres;\r
+ $parametres->pages = $nb_pages;\r
+\r
+ $c = $this->con->openCursor('books');\r
+ $c->parametres = serialize($parametres);\r
+ $c->numerotation = implode(',', $numerotation);\r
+ $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
+\r
+ $this->con->execute('DELETE FROM book_pages WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
+\r
+ $c = $this->con->openCursor('book_pages');\r
+ $c->book_id = $book_id;\r
+ $i = 1;\r
+ foreach($pages as $p) {\r
+ $c->document_id = $p->document_id;\r
+ $c->document_page = $p->document_page;\r
+ $c->book_page = $i;\r
+ $c->insert();\r
+ $i++;\r
+ }\r
+ }\r
+\r
public function getLinksFromCSV($book_id)\r
{\r
$booleans = array('video_loop', 'video_auto_start', 'video_controls', 'video_sound_on');\r
continue;\r
}\r
$link = array();\r
- $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' => '');\r
+ $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');\r
$k = 0;\r
foreach($cols as $col => $default) {\r
if (isset($line[$k])) {\r
return $res;\r
}\r
\r
- public function getNumerotationFromDocs()\r
+ public function getNumerotationFromDocs($book_id)\r
{\r
$pages = $this->getPagesOfBook($book_id);\r
}\r
throw new Exception($msg);\r
}\r
\r
- $classic = array('chapters', 'links', 'rulers', 'traductions', 'numerotation');\r
+ $classic = array('chapters', 'links', 'rulers', 'traductions');\r
\r
if (in_array($varname, $classic)) {\r
if (is_array($this->$varname)) {\r