'js/libs/fluidbook/fluidbook.scorm.js',
'js/libs/fluidbook/menu/fluidbook.chapters.js',
'js/libs/fluidbook/menu/fluidbook.index.js',
+ 'js/libs/fluidbook/fluidbook.landingpage.js',
'js/libs/fluidbook/fluidbook.js',
'js/main.js');
$ignore = split(',', $ignore);
}
+ if ($this->book->parametres->externalChaptersHTML != '') {
+ $d = $this->unzipFile($this->book->parametres->externalChaptersHTML, false, 'data/chapters/');
+ $meta = $this->getConfigZIP($d['dir']);
+ $this->config->externalChaptersSize = new stdClass();
+ $this->config->externalChaptersSize->width = $meta['width'];
+ $this->config->externalChaptersSize->height = $meta['height'];
+ $this->vdir->copyDirectory($d['dir'], $d['fdir']);
+ }
+
$daoDoc = new wsDAODocument($core->con);
$daoDoc->getLinksAndRulers($this->book_id, $links, $rulers);
+ // Custom landing page content
+ if ($this->book->parametres->landingPage != '') {
+ $d = $this->unzipFile($this->book->parametres->landingPage, false, 'data/landing-page/');
+ $this->vdir->copyDirectory($d['dir'], $d['fdir']);
+ }
+
if ($this->book->parametres->tabsHTML5 != '') {
$links[] = [
'page' => 'background',
}
+
+ public function unzipFile($file, $moveAssets = false, $baseDir = null) {
+ $fdir = is_null($baseDir) ? 'data/links/' . $file : $baseDir;
+
+ $tmp = CubeIT_Files::tmpdir();
+ $dir = $tmp . '/' . $fdir;
+ if (file_exists($dir) && is_file($dir)) {
+ unlink($dir);
+ }
+ if (!file_exists($dir)) {
+ mkdir($dir, 0777, true);
+ }
+ $unzip = new cubeCommandLine('unzip');
+ $unzip->setArg(null, $this->wdir . '/' . $file);
+ $unzip->setArg('d', $dir);
+ $unzip->execute();
+
+ if ($moveAssets) {
+ `mv $dir/Assets/* $dir`;
+ rmdir($dir . '/Assets');
+ }
+
+ return array('dir' => $dir, 'fdir' => $fdir);
+ }
+
+ public function getConfigZIP($d) {
+ $res = array('width' => 0, 'height' => 0);
+ if (file_exists($d . '/index.html')) {
+ $doc = new DOMDocument();
+ $doc->loadHTMLFile($d . '/index.html');
+ $xpath = new DOMXPath($doc);
+ $c = $xpath->query("//canvas");
+ foreach ($c as $canvas) {
+ /* @var $canvas DOMElement */
+ $res['width'] = intval((string)$canvas->getAttribute('width'));
+ $res['height'] = intval((string)$canvas->getAttribute('height'));
+ }
+
+ $r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
+ } else {
+ $r = array('html' => false, 'inject' => array(file_get_contents($d . '/init.js')), 'injectcss' => array('multimedia.css'), 'injectjs' => array('multimedia.js'));
+ }
+ $res = array_merge($res, $r);
+ return $res;
+ }
+
}
}
public function unzipFile($file, $moveAssets = false) {
- $fdir = 'data/links/' . $file;
-
- $tmp = CubeIT_Files::tmpdir();
- $dir = $tmp . '/' . $fdir;
- if (file_exists($dir) && is_file($dir)) {
- unlink($dir);
- }
- if (!file_exists($dir)) {
- mkdir($dir, 0777, true);
- }
- $unzip = new cubeCommandLine('unzip');
- $unzip->setArg(null, $this->compiler->wdir . '/' . $file);
- $unzip->setArg('d', $dir);
- $unzip->execute();
-
- if ($moveAssets) {
- `mv $dir/Assets/* $dir`;
- rmdir($dir . '/Assets');
- }
-
- return array('dir' => $dir, 'fdir' => $fdir);
+ return $this->compiler->unzipFile($file, $moveAssets);
}
public function getCssScale() {
}
public function getConfigZIP($d) {
- $res = array('width' => $this->video_width, 'height' => $this->video_height);
- if (file_exists($d . '/index.html')) {
- $doc = new DOMDocument();
- $doc->loadHTMLFile($d . '/index.html');
- $xpath = new DOMXPath($doc);
- $c = $xpath->query("//canvas");
- foreach ($c as $canvas) {
- /* @var $canvas DOMElement */
- $res['width'] = intval((string)$canvas->getAttribute('width'));
- $res['height'] = intval((string)$canvas->getAttribute('height'));
- }
-
- $r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
- } else {
- $r = array('html' => false, 'inject' => array(file_get_contents($d . '/init.js')), 'injectcss' => array('multimedia.css'), 'injectjs' => array('multimedia.js'));
- }
- $res = array_merge($res, $r);
- return $res;
+ return $this->compiler->getConfigZIP($d);
}
public function getConfigHTML($d, $html) {