]> _ Git - cubeextranet.git/commitdiff
wip #3909 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 29 Sep 2020 13:35:37 +0000 (13:35 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 29 Sep 2020 13:35:37 +0000 (13:35 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 4b594a7abf6617c9bbfc163bdcfb76b37bd0f068..a0739a3721a89380171b968134a8349da58ddf49 100644 (file)
@@ -543,6 +543,7 @@ class wsBookParametres extends wsParametres
                 'Remarkable' => 'Remarkable',
                 'Mopec' => 'Mopec',
                 'Zoom + lien produit (déprécié, utiliser la fonctionnalité "Zoom produits")' => 'ZoomProductLink',
+                'Wishlist Jouéclub' => 'JoueclubWishlist',
             ), 'grade' => 5);
 
         $this->fields['basketReferences'] = array('type' => 'freefile', 'default' => '', 'editable' => true,
index 80ae0e28164bdb4e21e72a95c926d5fee639c518..888b92be56fbd784156c820d9c8b49144aa0cba7 100644 (file)
@@ -116,6 +116,8 @@ class wsHTML5Link
                     return new zoomProductLink($id, $init, $compiler);
                 }
                 switch ($compiler->book->parametres->basketManager) {
+                    case 'JoueclubWishlist':
+                        return new JoueclubWishlistLink($id, $init, $compiler);
                     case 'Remarkable':
                         return new remarkableCartLink($id, $init, $compiler);
                     case 'ZoomProductLink':
@@ -1734,6 +1736,26 @@ class audioLink extends wsHTML5Link
 
 }
 
+class JoueclubWishlistLink extends normalLink
+{
+    protected $role = 'link';
+
+    public function getURL()
+    {
+        return 'https://joueclub.dev.amazing.cat/scan?deviceId=$uuid&ean=' . $this->to;
+    }
+
+    public function getTarget()
+    {
+        return '_blank';
+    }
+
+    public function getDefaultTooltip()
+    {
+        return 'Ajouter à la wishlist';
+    }
+}
+
 class wescoLink extends normalLink
 {
     protected $role = 'link';
@@ -2299,19 +2321,20 @@ class slideshowLink extends normalLink
         }
 
         // Main slider
-        $res = '<div class="fb-slideshow splide" id="' . $slideshowID . '" data-open-index="' . $this->extra . '" data-thumbnails="' . ($thumbnails ? '1' : '0') . '" data-splide=\''. json_encode($slideshow_settings) .'\'>' . $this->_slides($slides) . '</div>';
+        $res = '<div class="fb-slideshow splide" id="' . $slideshowID . '" data-open-index="' . $this->extra . '" data-thumbnails="' . ($thumbnails ? '1' : '0') . '" data-splide=\'' . json_encode($slideshow_settings) . '\'>' . $this->_slides($slides) . '</div>';
 
         // Thumbnails slider
         if ($thumbnails) {
             $res .= '<div class="fb-slideshow-thumbnails splide" id="' . $slideshowID . '_thumbnails">' . $this->_slides($slides, false, $this->thumbnail_height) . '</div>';
         }
 
-        $res = '<div class="fb-slideshow-wrapper">'. $res .'</div>';
+        $res = '<div class="fb-slideshow-wrapper">' . $res . '</div>';
 
         return $res;
     }
 
-    protected function _getSlidesFromDirectory($path) {
+    protected function _getSlidesFromDirectory($path)
+    {
         // Previously this was getting all files recursively but it caused problems
         // when there was a __MACOSX sub directory inside the zip file containing
         // resource forks for the JPGs. There's no need to support nested directories
@@ -2335,9 +2358,10 @@ class slideshowLink extends normalLink
         return $slides;
     }
 
-    protected function _slides($slides, $show_captions = true, $max_height = null) {
+    protected function _slides($slides, $show_captions = true, $max_height = null)
+    {
 
-        $res  = '<div class="splide__track">';
+        $res = '<div class="splide__track">';
         $res .= '<ul class="splide__list">';
 
         foreach ($slides as $slide) {
@@ -2350,12 +2374,12 @@ class slideshowLink extends normalLink
             // We set dimensions here to avoid extra work on the client side
             if ($max_height && $image_info) {
                 $thumb_width = round($max_height / $image_info[1] * $image_info[0]); // max_height / image_height * image_width
-                $image_dimensions = 'style="width:'. $thumb_width .'px; height:'. $max_height .'px"';
+                $image_dimensions = 'style="width:' . $thumb_width . 'px; height:' . $max_height . 'px"';
             }
 
             $res .= '<li class="fb-slideshow-slide splide__slide">';
             //$res .= '<div class="splide__slide__container">';
-            $res .= '<img class="fb-slideshow-slide-image" src="' . $image_path_relative . '" data-meta="'. htmlspecialchars($image_info_json, ENT_QUOTES) .'" '. $image_dimensions .'>';
+            $res .= '<img class="fb-slideshow-slide-image" src="' . $image_path_relative . '" data-meta="' . htmlspecialchars($image_info_json, ENT_QUOTES) . '" ' . $image_dimensions . '>';
             //$res .= '</div>'; // .splide__slide__container
 
             if ($show_captions && null !== $slide['caption']) {