return $r->book_id + 1;\r
}\r
\r
- public function selectById($book_id = null) {\r
+ public function selectById($book_id = null, $simple = false) {\r
if (is_null($book_id)) {\r
return $this->cree();\r
}\r
- $sql = 'SELECT * FROM books_vue WHERE book_id=\'' . $this->con->escape($book_id) . '\' LIMIT 1';\r
+ if ($simple) {\r
+ $table = 'books';\r
+ } else {\r
+ $table = 'books_vue';\r
+ }\r
+ $sql = 'SELECT * FROM ' . $table . ' WHERE book_id=\'' . $this->con->escape($book_id) . '\' LIMIT 1';\r
$r = $this->con->select($sql);\r
return $this->singleton($r);\r
}\r
$c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
}\r
\r
- public function isUpToDate($book_id, $html = false) {\r
- // V2\r
- if (!file_exists(WS_BOOKS . '/final/' . $book_id)) {\r
- return false;\r
- }\r
- $r = $this->con->select('SELECT changedate,compiledate FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
- if ($r->compiledate < $r->changedate) {\r
- return false;\r
- }\r
-\r
-\r
- // V1\r
- if (!file_exists(WS_BOOKS . '/finalv1/' . $book_id . '/index.swf')) {\r
- return false;\r
- }\r
-\r
-\r
- // HTML5\r
- $checks = array($r->changedate, cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5'), cubeFiles::filemtimeRecursive(ROOT . '/inc/ws/Util/html5'));\r
- $reffile = WS_BOOKS . '/html5/' . $book_id;\r
-\r
- if (!file_exists($reffile)) {\r
- return false;\r
- }\r
- $reftime = filemtime($reffile);\r
- foreach ($checks as $check) {\r
- if ($check > $reftime) {\r
+ public function isUpToDate($book, $version) {\r
+ $version = (string) $version;\r
+ if ($version == '2') {\r
+ if (!file_exists(WS_BOOKS . '/final/' . $book->book_id)) {\r
+ return false;\r
+ }\r
+ if ($book->compiledate < $book->changedate) {\r
return false;\r
}\r
+ } else if ($version == '1') {\r
+ // V1\r
+ if (!file_exists(WS_BOOKS . '/finalv1/' . $book->book_id . '/index.swf')) {\r
+ return false;\r
+ }\r
+ if ($book->compile1date < $book->changedate) {\r
+ return false;\r
+ }\r
+ } else if ($version == 'html5') {\r
+ // HTML5\r
+ $checks = array($book->changedate, cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5'), cubeFiles::filemtimeRecursive(ROOT . '/inc/ws/Util/html5'));\r
+ foreach ($checks as $check) {\r
+ if ($check > $book->compilehtml5date) {\r
+ return false;\r
+ }\r
+ }\r
}\r
return true;\r
}\r
$book = $this->selectById($book_id);\r
$pages = $this->getPagesOfBook($book_id);\r
\r
- $v1 = $v1 && $book->compile1date < $book->changedate;\r
- $v2 = $v2 && $book->compiledate < $book->changedate;\r
- $html5 = $html5 && $book->compilehtml5date < $book->changedate;\r
+ $v1 = $v1 && !$this->isUpToDate($book, 1);\r
+ $v2 = $v2 && !$this->isUpToDate($book, 2);\r
+ $html5 = $html5 && !$this->isUpToDate($book, 'html5');\r
\r
\r
if ($v1 || $v2) {\r
- fb(time(),'Compile PDF & Widget');\r
+ fb(time(), 'Compile PDF & Widget');\r
$this->compilePDF($book, $pages);\r
$this->compileWidget($book, $pages);\r
}\r
$res = '';\r
if ($v1) {\r
- fb(time(),'Compile V1');\r
+ fb(time(), 'Compile V1');\r
$res.=$this->compile1($book_id, $book, $pages);\r
$this->touchCompile($book_id, '1');\r
}\r
if ($v2) {\r
- fb(time(),'Compile V2');\r
+ fb(time(), 'Compile V2');\r
$res .= $this->compile3($book_id, $complete, $book, $pages);\r
$this->touchCompile($book_id, '2');\r
}\r
if ($html5) {\r
- fb(time(),'Compile HTML5');\r
+ fb(time(), 'Compile HTML5');\r
$res.=$this->compileHTML5($book_id);\r
$this->touchCompile($book_id, 'html5');\r
}\r
- fb(time(),'End Compile');\r
+ fb(time(), 'End Compile');\r
return $res;\r
}\r
\r
$res[] = '#fluidbook{left:' . $offsetLeft . 'px;top:' . $offsetTop . 'px;}';
$res[] = '.landscape #fluidbook{left:' . $offsetLeft2 . 'px;}';
- $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';
+ $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links,.doublePage._3d{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';
$res[] = '.doublePage,#pages,.landscape #shadow.double{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}';
- $res[] = '.landscape .doublePage.next{' . $this->writeCSSUA('transform', 'translate(' . $w2 . ',0)') . '}';
- $res[] = '.landscape .doublePage.prev{' . $this->writeCSSUA('transform', 'translate(-' . $w2 . ',0)') . '}';
- $res[] = '.portrait .doublePage.next{' . $this->writeCSSUA('transform', 'translate(' . $w . ',0)') . '}';
- $res[] = '.portrait .doublePage.prev{' . $this->writeCSSUA('transform', 'translate(-' . $w . ',0)') . '}';
+ $res[] = '.landscape .doublePage._2d.next{' . $this->writeCSSUA('transform', 'translate(' . $w2 . ',0)') . '}';
+ $res[] = '.landscape .doublePage._2d.prev{' . $this->writeCSSUA('transform', 'translate(-' . $w2 . ',0)') . '}';
+ $res[] = '.portrait .doublePage._2d.next{' . $this->writeCSSUA('transform', 'translate(' . $w . ',0)') . '}';
+ $res[] = '.portrait .doublePage._2d.prev{' . $this->writeCSSUA('transform', 'translate(-' . $w . ',0)') . '}';
+ $res[] = '.doublePage._3d{left:' . $w . ';}';
$res[] = '.landscape #shadow.single.right{left: ' . $w . ';}';
$res[] = '.landscape .page.right{left:' . $w . '}';
if ($this->theme->parametres->displayPageNumber) {
// Links Styles
$res = array_merge($res, $links);
$res[] = '.link a.displayArea:hover,.link a.displayArea.animating{background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}';
- $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}';
+ $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.0001) . ';}';
// Menus
# View
}
public static function colorToCSS($color, $forceAlpha = null) {
-
if (!is_null($forceAlpha)) {
- $a = $forceAlpha * 255;
- $a = base_convert($a, 10, 16);
+ if ($forceAlpha <= 0) {
+ $a = '00';
+ } elseif ($forceAlpha < 1) {
+ $a = ceil($forceAlpha * 255);
+ $a = base_convert($a, 10, 16);
+ if (strlen($a) == 1) {
+ $a = '0' . $a;
+ }
+ } else {
+ $a = 'FF';
+ }
+
if (strlen($color) == 6) {
$color = $a . $color;
} else {