return array('url' => $destURL, 'file' => $destFile);
}
- public function getPDFComplexBaseDocument($book)
+ public function getPDFComplexBaseDocument($book, $force = false)
{
global $core;
- switch ($book->parametres->bookmarkUsePDF) {
+ $mode = $force ? $force : $book->parametres->bookmarkUsePDF;
+ switch ($mode) {
case 'download':
- return WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfReplace;
+ $res = WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfReplace;
break;
case 'thumbnails':
- return WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfThumbnails;
+ $res = WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfThumbnails;
break;
case 'pages':
default:
$pages = $daoBook->getPagesOfBook($book->book_id);
$daoBook->compilePDF($book, $pages);
}
- return $normal;
+ $res = $normal;
break;
}
+ if (!file_exists($res) || is_dir($res)) {
+ return $this->getPDFComplexBaseDocument($book, 'pages');
+ }
return $res;
}