]> _ Git - cubeextranet.git/commitdiff
wait #4047
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 18 Nov 2020 12:40:55 +0000 (12:40 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 18 Nov 2020 12:40:55 +0000 (12:40 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index c55477d07dadd19615b8918f8eafb8791d888df7..8962d79924afabe0b8d4ead98f3d2de717e4dba8 100644 (file)
@@ -533,6 +533,7 @@ class wsBookParametres extends wsParametres
             __('360°') => 'icon-360',
             __('Photo') => 'icon-photo'];
         $actions = [
+            __('Désactiver') => 'disabled',
             __('Ouvrir un lien') => 'link',
             __('Ouvrir en iframe') => 'iframe',
             __('Copier un contenu') => 'copy',
@@ -547,7 +548,7 @@ class wsBookParametres extends wsParametres
             $this->fields['product_zoom_label_' . $i] = ['type' => 'text', 'label' => __('Label du bouton') . ' ' . $i, 'default' => '', 'editable' => true, 'grade' => 3];
             $this->fields['product_zoom_tooltip_' . $i] = ['type' => 'text', 'label' => __('Label de l\'infobulle') . ' ' . $i, 'default' => '', 'editable' => true, 'grade' => 3];
             $this->fields['product_zoom_icon_' . $i] = ['type' => 'combo', 'datas' => $icons, 'label' => __('Icône du bouton') . ' ' . $i, 'default' => 'click', 'editable' => true, 'grade' => 3];
-            $this->fields['product_zoom_action_' . $i] = ['type' => 'combo', 'datas' => $actions, 'label' => __('Action du bouton') . ' ' . $i, 'default' => 'link', 'editable' => true, 'grade' => 3];
+            $this->fields['product_zoom_action_' . $i] = ['type' => 'combo', 'datas' => $actions, 'label' => __('Action du bouton') . ' ' . $i, 'default' => 'disabled', 'editable' => true, 'grade' => 3];
             $f[] = '|';
             $f[] = 'product_zoom_label_' . $i;
             $f[] = 'product_zoom_tooltip_' . $i;
@@ -633,6 +634,7 @@ class wsBookParametres extends wsParametres
                 'Remarkable' => 'Remarkable',
                 'Mopec' => 'Mopec',
                 'Puma' => 'Puma',
+                'MIF' => 'MIF',
                 'Zoom + lien produit (déprécié, utiliser la fonctionnalité "Zoom produits")' => 'ZoomProductLink',
                 'Wishlist Jouéclub' => 'JoueclubWishlist',
             ), 'grade' => 5);
@@ -735,9 +737,10 @@ class wsBookParametres extends wsParametres
         $this->fields['scorm_complete_on_exit'] = ['type' => 'boolean', 'default' => false, 'label' => 'Marquer le cours comme "Complete" à la fermeture de la fenêtre', 'editable' => true];
         $this->fields['scorm_complete_on_last_page'] = ['type' => 'boolean', 'default' => false, 'label' => 'Marquer le cours comme "Complete" lorsque le visiteur atteint la dernière page', 'editable' => true];
         $this->fields['scorm_force_attempts'] = ['type' => 'boolean', 'default' => false, 'label' => __('Forcer la création d\'un "attempt" à chaque ouverture'), 'editable' => true];
+        $this->fields['scorm_pass_on_complete'] = ['type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Marquer le cours comme Pass lorsqu'il est terminé (lorsque le cours n'est pas noté)")];
 
         $this->forms['scorm'] = array('label' => __('SCORM'),
-            'fieldsnames' => array('scorm_enable', 'scorm_version', 'scorm_id', 'scorm_org', 'scorm_title', 'scorm_variables', '|', 'scorm_complete_on_exit', 'scorm_complete_on_last_page', '|', 'scorm_quizdata', 'scorm_score', 'scorm_score_min', 'scorm_quiz_as_questionnaire', '|', 'scorm_force_attempts'));
+            'fieldsnames' => array('scorm_enable', 'scorm_version', 'scorm_id', 'scorm_org', 'scorm_title', 'scorm_variables', '|', 'scorm_complete_on_exit', 'scorm_complete_on_last_page', 'scorm_pass_on_complete', '|', 'scorm_quizdata', 'scorm_score', 'scorm_score_min', 'scorm_quiz_as_questionnaire', '|', 'scorm_force_attempts'));
 
         $versions = wsUrl::getFluidbookVersions(false);
         $ignore = ['v1', 'v2', 'phonegap'];
index 67dee5341853e74591044d65e09498541ecfd5d0..ebf18b2fe86a8c33284135771028527c47ce6ea7 100644 (file)
@@ -217,7 +217,7 @@ class wsHTML5Compiler
     public $writeLinksData = false;
     public $content_lock = [];
     public $cssfont = [];
-    public $lessVariables = [];
+    public $lessVariables = ["import-cart-styles" => 'none'];
     protected $_indexVars = null;
     public $accessibleTexts = [];
     protected $_svgSymbols = [];
@@ -411,8 +411,61 @@ class wsHTML5Compiler
         $this->config->seoArticles = $this->seoArticles;
     }
 
+    public function writeMIFCart()
+    {
+        $this->lessVariables['import-cart-styles'] = 'mif';
+
+        $this->addJsLib('cookie', 'js/libs/jquery/jquery.cookie.js');
+        $this->addJsLib('mif', 'js/libs/fluidbook/cart/fluidbook.cart.mif.js');
+        $this->addJsLib('html2pdf', 'js/libs/html2pdf/html2pdf.min.js');
+
+        $cdir = $this->wdir . '/commerce/';
+        $odir = $cdir . '/opt/';
+        if (!file_exists($odir)) {
+            mkdir($odir, 0777, true);
+        }
+
+        $file = $cdir . $this->book->parametres->basketReferences;
+        $this->config->basketReferences = wsUtil::excelToArrayKeyVars($file);
+
+        wsLinks::getLinksAndRulersFromFile($this->book_id, $links, $rulers);
+
+        foreach ($this->config->basketReferences as $ref => $data) {
+            $source = $cdir . '/' . $data['Image'];
+            if (!file_exists($source)) {
+                continue;
+            }
+            $d = CubeIT_Text::str2URL($ref) . '.jpg';
+            $dest = $odir . '/' . $d;
+            if (!file_exists($dest) || !filesize($dest) || filemtime($dest) < filemtime($source)) {
+                $convert = new CubeIT_Image_Resizer_ImageMagick();
+                $convert->loadImage($source);
+                $convert->resize(500, 500, 'ratio', false, 'C', 'M', 'ffffff');
+                $convert->output('jpg', $dest, 80);
+            }
+            $vdest = 'data/commerce/opt/' . $d;
+            $this->vdir->copy($dest, $vdest);
+            $this->config->basketReferences[$ref]['Image'] = $vdest;
+        }
+
+        foreach ($links as $link) {
+            if ($link['type'] == '12') {
+
+            }
+        }
+
+        $this->config->product_zoom_references = [];
+        foreach ($this->config->basketReferences as $ref => $data) {
+            $r = [$data['Lien']];
+            $this->config->product_zoom_references[$ref] = $r;
+        }
+    }
+
+
     public function writePumaCart()
     {
+        $this->lessVariables['import-cart-styles'] = 'puma';
+
         $this->addJsLib('parsley', 'js/libs/parsley.min.js');
         $this->addJsLib('cookie', 'js/libs/jquery/jquery.cookie.js');
         $this->addJsLib('puma', 'js/libs/fluidbook/cart/fluidbook.cart.puma.js');
@@ -457,6 +510,8 @@ class wsHTML5Compiler
             $this->addJsLib('cart', 'js/libs/fluidbook/fluidbook.cart.js');
             if ($this->config->basketManager === 'Puma') {
                 return $this->writePumaCart();
+            } else if ($this->config->basketManager === 'MIF') {
+                return $this->writeMIFCart();
             }
             switch ($this->config->basketManager) {
                 case 'Remarkable':
@@ -834,7 +889,7 @@ class wsHTML5Compiler
         if ($this->book->parametres->soundTheme == '') {
             return;
         }
-        $this->config->simpleSoundTheme=file_exists(WS_SOUNDS . '/' . $this->book->parametres->soundTheme.'/flip.mp3');
+        $this->config->simpleSoundTheme = file_exists(WS_SOUNDS . '/' . $this->book->parametres->soundTheme . '/flip.mp3');
         $this->vdir->copyDirectory(WS_SOUNDS . '/' . $this->book->parametres->soundTheme, 'data/sounds');
     }
 
index 1b04be640376162b6d58a9d5a9e43a232a3090d8..2de10784a3f1e49893961fdc81ba3e9ae9c24183 100644 (file)
@@ -83,6 +83,9 @@ class wsHTML5Link
                 if ($compiler->book->parametres->basketManager === 'Puma') {
                     return new pumaCartLink($id, $init, $compiler);
                 }
+                if ($compiler->book->parametres->basketManager === 'MIF') {
+                    return new cartLink($id, $init, $compiler);
+                }
                 switch ($compiler->book->parametres->customLinkClass) {
                     case 'WescoLink':
                         return new wescoLink($id, $init, $compiler);
@@ -112,7 +115,7 @@ class wsHTML5Link
             case 11:
                 return new actionLink($id, $init, $compiler);
             case 12:
-                if ($compiler->book->parametres->basketManager === 'Puma') {
+                if ($compiler->book->parametres->basketManager === 'Puma' || $compiler->book->parametres->basketManager === 'MIF') {
                     return new zoomProductLink($id, $init, $compiler);
                 }
                 if ($compiler->book->parametres->product_zoom_references !== '') {
@@ -1306,7 +1309,7 @@ class pumaCartLink extends cartLink
 <style type="text/css">
        .st0{fill:#B09474;}
        .st1{fill:#FFFFFF;}
-       .st2{opacity:0.5;fill:#B09474;enable-background:new    ;}
+       .st2{opacity:0.5;fill:#B09474;enable-background:new;}
 </style>
 <g class="on">
        <circle class="st0" cx="16" cy="16" r="14"/>
@@ -1320,8 +1323,14 @@ class pumaCartLink extends cartLink
                 M12.8,12.3c-0.9,0-1.8,0.5-2.3,1.4c-0.5,0.9-0.3,2.1,0.5,2.8l5,5l5-5c0.8-0.7,1-1.9,0.5-2.8c-0.1-0.2-0.3-0.4-0.5-0.6
                c-1-1-2.6-1-3.6,0l-0.9,0.9c-0.3,0.3-0.7,0.3-1,0L14.6,13c-0.2-0.2-0.4-0.3-0.7-0.5C13.6,12.3,13.2,12.3,12.8,12.3z"/>
 </g>
-</svg>
-';
+</svg>';
+    }
+
+    public function getAdditionnalContent()
+    {
+        $res = parent::getAdditionnalContent();
+        $res .= ' data-tooltip-conditional="' . htmlspecialchars(json_encode(['.active' => 'remove from cart'])) . '" ';
+        return $res;
     }
 }