From 3960a0444c351a65ee58d0bdae7541a0590984cd Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 15 Oct 2018 17:06:04 +0000 Subject: [PATCH] wip #2298 @1 --- inc/ws/Controlleur/class.ws.flash.php | 7 ++++- inc/ws/DAO/class.ws.dao.book.php | 26 ++++++++++--------- inc/ws/Util/class.ws.links.php | 2 +- .../html5/master/class.ws.html5.compiler.php | 5 ++++ .../html5/master/class.ws.html5.links.php | 19 +++++++++++--- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index a78c6cda2..4cd843bfe 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -16,7 +16,12 @@ class wsFlash extends cubeFlashGateway $gateway->addAttribute('creation', $droits->creation ? '1' : '0'); $gateway->addAttribute('revendeur', $droits->revendeur ? '1' : '0'); $gateway->addAttribute('admin', $droits->admin ? '1' : '0'); - $gateway->addAttribute('grade', $core->user->ws_grade); + if (null !== $core->user) { + $grade = -1; + } else { + $grade = $core->user->ws_grade; + } + $gateway->addAttribute('grade', $grade); } public function saveConversionSettings() diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index f9c56323b..21e334a53 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -1023,19 +1023,21 @@ class wsDAOBook extends commonDAO if (file_exists($fby)) { $words = CubeIT_Util_Json::decode(file_get_contents($fby), CubeIT_Util_Json::TYPE_OBJECT); - foreach ($words as $i => $w) { - $word = $w->word; - $word = trim($word, "\0"); - if ($word == '') { - continue; - } - unset($w->word); - $w->page = $book_page; - $w->idx = $i; - if (!isset($res->{$word})) { - $res->{$word} = array(); + if (is_array($words)) { + foreach ($words as $i => $w) { + $word = $w->word; + $word = trim($word, "\0"); + if ($word == '') { + continue; + } + unset($w->word); + $w->page = $book_page; + $w->idx = $i; + if (!isset($res->{$word})) { + $res->{$word} = array(); + } + $res->{$word}[] = $w; } - $res->{$word}[] = $w; } } } diff --git a/inc/ws/Util/class.ws.links.php b/inc/ws/Util/class.ws.links.php index b11eecde8..6e58b2fd5 100644 --- a/inc/ws/Util/class.ws.links.php +++ b/inc/ws/Util/class.ws.links.php @@ -31,7 +31,7 @@ class wsLinks 'extra' => __('Paramètre supplémentaire'), 'alternative' => __('Alternative'), 'read_mode' => __('Mode de lecture'), - 'image' => __('Image'), + 'image' => __('Image'), 'image_rollover' => __('Animation au survol'), 'group' => __('Groupe'), ); diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 80670630b..6ac9b6727 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -577,6 +577,9 @@ class wsHTML5Compiler protected function _writeIndex($page) { + if (!isset($this->seo->pages[$page])) { + return; + } $seo = $this->seo->pages[$page]; $html = $seo->getHTML(); @@ -1021,7 +1024,9 @@ class wsHTML5Compiler $dupData = $linkData; $dupData['image'] = ''; $dupData['to'] = $linkData['image']; + $dupData['rollover'] = $linkData['image_rollover']; $dupData['type'] = 15; + $dupData['uid'] = 'i_' . $linkData['uid']; if (wsHTML5Link::isScorm($linkData)) { $dupData['scorm'] = true; } diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 8528b96fc..833fa0e80 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -21,6 +21,7 @@ class wsHTML5Link public $video_height; public $video_width; public $video_service; + public $rollover; public $inline; public $in_popup = false; public $display_area; @@ -200,7 +201,7 @@ class wsHTML5Link public static function isScorm($linkData) { - return (isset($linkData['scorm']) && $linkData['scorm']) || (stristr($linkData['to'], 'scorm') || stristr($linkData['alternative'], 'scorm')); + return (isset($linkData['scorm']) && $linkData['scorm']) || (stristr($linkData['to'], 'scorm') || (isset($linkData['alternative']) && stristr($linkData['alternative'], 'scorm'))); } public function __construct($id, $init, &$compiler) @@ -282,7 +283,12 @@ class wsHTML5Link public function getClasses() { - return array(); + + $res = array(); + if ($this->image_rollover != 'none') { + $res[] = 'image_rollover'; + } + return $res; } public function copyExternalFile($file, $video = false) @@ -517,7 +523,7 @@ class zoomhdLink extends normalLink public function init() { $this->compiler->addJs('js/libs/fluidbook/links/fluidbook.links.zoomhd.js'); - $this->compiler->writeLinksData=true; + $this->compiler->writeLinksData = true; } public function getURL() @@ -1039,6 +1045,13 @@ class imageLink extends contentLink return 'background-image:url(' . wsHTML5Link::getUniversalLocation($this->to, true) . ');background-size:100% 100%;background-repeat:no-repeat;'; } + public function getAdditionnalContent() + { + $res = parent::getAdditionnalContent(); + $res .= ' data-rollover="' . $this->rollover . '"'; + return $res; + } + } class inlineSlideshowLink extends contentLink -- 2.39.5