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