}
}
- protected function writeScorm() {
- $manifest = file_get_contents($this->assets . '/_imsmanifest.xml');
+ protected function writeScorm()
+ {
+ if ($this->book->parametres->scorm_version == '1.2') {
+ $manifestfile = '_imsmanifest.12.xml';
+ } elseif ($this->book->parametres->scorm_version = '2004') {
+ $manifestfile = '_imsmanifest.2004.xml';
+ }
+
+ $manifest = file_get_contents($this->assets . '/' . $manifestfile);
if (!$this->book->parametres->scorm_title) {
$this->book->parametres->scorm_title = $this->book->parametres->title;
}
- if (!$this->book->parametres->scorm_id) {
- $this->book->parametres->scorm_id = 'fb_' . $this->book->parametres->id;
+ if (!$this->book->parametres->scorm_id || ($this->book->book_id > 16614 && $this->book->parametres->scorm_id == 'MFMCTE091mobile')) {
+ $this->book->parametres->scorm_id = 'fb_' . $this->book->book_id;
}
if (!$this->book->parametres->scorm_org) {
$this->book->parametres->scorm_org = 'Fluidbook';
$variables[$f[0]] = $f[1];
}
$this->config->scorm_variables = $this->book->parametres->scorm_variables = $variables;
+ if ($this->book->parametres->scorm_quizdata) {
+ $this->config->scorm_quizdata = wsUtil::excelToArray($this->wdir . '/' . $this->book->parametres->scorm_quizdata);
+ }
}
protected function writePrint() {
'js/libs/fluidbook/menu/fluidbook.chapters.js',
'js/libs/fluidbook/menu/fluidbook.index.js',
'js/libs/fluidbook/fluidbook.landingpage.js',
+ 'js/libs/fluidbook/fluidbook.slideshow.js',
'js/libs/fluidbook/fluidbook.js',
'js/main.js');
}
$origDir = $this->wdir;
-
+ $types = $this->getVideosFormats();
if ($video) {
wsTools::encodeWebVideos($origDir . $source, null, true);
$e = explode('.', $source);
array_pop($e);
$base = implode('.', $e);
$source = array();
- $types = $this->getVideosFormats();
foreach ($types as $type) {
$source[] = $base . '.' . $type;
}
case 29:
return new facebookLikeLink($id, $init, $compiler);
break;
+ case 30:
+ return new slideshowLink($id, $init, $compiler);
+ break;
default:
return null;
}
return array_merge(['zoomPopup'], parent::getClasses());
}
}
+
+
+class slideshowLink extends normalLink {
+
+ protected $path;
+ protected $path_absolute;
+
+ public function getURL() {
+
+ if (empty($this->to)) {
+ return '';
+ }
+
+ $d = $this->unzipFile($this->to, false);
+ $this->copyExternalDir($d['dir'], $d['fdir']);
+
+ $this->path = $d['fdir'];
+ $this->path_absolute = $this->compiler->vdir->path($d['fdir']);
+
+ return '#/slideshow/' . $this->uid;
+ }
+
+ public function getAdditionnalContent() {
+ return ' data-slideshow="' . rawurlencode($this->generateSlideshow()) . '" ';
+ }
+
+// public function keep() {
+// return true;
+// }
+
+ public function getDefaultTooltip() {
+ return 'view slideshow';
+ }
+
+ public function generateSlideshow() {
+
+ $this->compiler->addJs('js/libs/slick/slick.js');
+ $this->compiler->addLess('slick/slick-bundle');
+ $this->compiler->addLess('fluidbook.slideshow');
+
+ $extensions = ['jpg', 'png', 'jpeg', 'gif'];
+
+ $slideshowID = 'slideshow_' . $this->uid;
+ $XML_path = $this->path_absolute . '/slideshow.xml'; // Optional file so it may not exist
+
+ $this->getURL();
+
+ $slides = [];
+ // If the zip file contained a slideshow.xml file, use that for fetching images and their captions
+ if (file_exists($XML_path)) {
+
+ $slideshow_XML = simplexml_load_file($XML_path);
+ $slideshowData = CubeIT_Util_Xml::toObject($slideshow_XML);
+ foreach ($slideshowData->image as $img) {
+ $full_path = $this->path_absolute . '/' . $img->_name;
+ $slides[] = ['caption' => $img->_caption, 'path' => $full_path];
+ }
+
+ } else {
+ // Or by default, just get all the images that were in the zip file...
+ $afiles = CubeIT_Files::getRecursiveDirectoryIterator($this->path_absolute);
+
+ foreach ($afiles as $afile) {
+ /** @var SplFileInfo $afile */
+ if (!$afile->isFile()) {
+ continue;
+ }
+ $ext = mb_strtolower($afile->getExtension());
+ if (!in_array($ext, $extensions)) {
+ continue;
+ }
+ $slides[] = ['path' => $afile->getPathname(), 'caption' => null];
+ uasort($slides, [$this, '_orderSlidesByFilename']);
+ }
+ }
+
+ $res = '';
+ foreach ($slides as $slide) {
+ $res .= '<div class="fb-slideshow-slide">';
+ $res .= '<img class="fb-slideshow-slide-image" src="' . $this->compiler->vdir->relativePath($slide['path']) . '">';
+ if (null !== $slide['caption']) {
+ $res .= '<p class="fb-slideshow-slide-caption">' . $slide['caption'] . '</p>';
+ }
+
+ $res .= '</div>'; // .fb-slideshow-slide
+ }
+
+ $res = '<div class="fb-slideshow" id="'. $slideshowID .'">'. $res .'</div>';
+
+ $res .= '<script>';
+ $res .= 'fluidbook.slideshow.initSlideshow("'. $slideshowID .'");';
+ $res .= '</script>';
+
+ return $res;
+ }
+
+
+ protected function _orderSlidesByFilename($a, $b)
+ {
+ return strcmp($a['path'], $b['path']);
+ }
+}