$db->books->status('integer', 0, false);\r
$db->books->date_status('integer', 0, false);\r
$db->books->parametres('text', 0, false);\r
- $db->books->chapters('text',0,false);\r
- $db->books->links('text',0,false);\r
+ $db->books->chapters('text', 0, false);\r
+ $db->books->links('text', 0, false);\r
+ $db->books->rulers('text', 0, false);\r
$db->books->date('integer', 0, false);\r
// Clés\r
$db->books->primary('pk_books', 'book_id');\r
}\r
$fname = cubeFiles::tidyName($infos['name']);\r
$dir = '/books/working/' . $this->args['book_id'] . '/' ;\r
- if (!file_exists(ROOT.$dir)) {\r
- mkdir(ROOT.$dir, 0777, true);\r
+ if (!file_exists(ROOT . $dir)) {\r
+ mkdir(ROOT . $dir, 0777, true);\r
}\r
$dest = $dir . $fname;\r
move_uploaded_file($infos['tmp_name'], ROOT . $dest);\r
\r
$this->xml->addChild('width', $size[0]);\r
$this->xml->addChild('height', $size[1]);\r
+ $this->xml->addChild('rulers', json_encode($book->rulers));\r
fb($book->links);\r
}\r
\r
+ public function saveLinks()\r
+ {\r
+ global $core;\r
+ $dao = new wsDAOBook($core->con);\r
+ $dao->setLinksAndRulers($this->args['book_id'], $this->args['links'], $this->args['rulers']);\r
+ }\r
+\r
public function formatSize($val)\r
{\r
$str = files::size($val);\r
$book->links = json_decode($r->links, false);\r
}\r
\r
+ if ($r->rulers = '') {\r
+ $book->rulers = array();\r
+ } else {\r
+ $book->rulers = json_decode($r->rulers, false);\r
+ }\r
+\r
$p = unserialize($r->parametres);\r
if (!$p || $p->isEmpty()) {\r
$p = new wsBookParametres($book);\r
$c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
}\r
\r
+ public function setLinksAndRulers($book_id, $links, $rulers)\r
+ {\r
+ $c = $this->con->openCursor('books');\r
+ $c->links = json_encode(json_decode($links, false));\r
+ $c->rulers = json_encode(json_decode($rulers, false));\r
+ $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
+ }\r
+\r
public function getLinksFromCSV($book_id)\r
{\r
+ $booleans = array('video_loop', 'video_auto_start', 'video_controls', 'video_sound_on');\r
$pages = $this->getPagesOfBook($book_id);\r
$res = array();\r
foreach($pages as $page => $p) {\r
continue;\r
}\r
$link = array();\r
- $cols = array('page' => '', 'type' => '', 'to' => '','left'=>'', 'top' => '', 'width' => '', 'height' => '', 'target' => '_blank', 'video_loop' => '1', 'video_auto_start' => '1', 'video_controls' => '1', 'video_sound_on' => '1');\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);\r
$k = 0;\r
foreach($cols as $col => $default) {\r
if (isset($line[$k])) {\r
- $link[$col] = $line[$k];\r
+ if (in_array($k, $booleans)) {\r
+ $link[$col] = ($line[$k] == '1');\r
+ } else {\r
+ $link[$col] = $line[$k];\r
+ }\r
} else {\r
$link[$col] = $default;\r
}\r