Browse Source

Update from 1.11.x

Julio Montoya 6 years ago
parent
commit
7adfb47bbb

+ 42 - 2
src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php

@@ -174,8 +174,8 @@ class ChamiloApi
     /**
      * Adds or Subtract a time in hh:mm:ss to a datetime.
      *
-     * @param string $time      Time in hh:mm:ss format
-     * @param string $datetime  Datetime as accepted by the Datetime class constructor
+     * @param string $time      Time to add or substract in hh:mm:ss format
+     * @param string $datetime  Datetime to be modified as accepted by the Datetime class constructor
      * @param bool   $operation True for Add, False to Subtract
      *
      * @return string
@@ -355,4 +355,44 @@ class ChamiloApi
 
         return $localMidnight;
     }
+
+    /**
+     * Get JavaScript code necessary to load quiz markers-rolls in medialement's Markers Rolls plugin.
+     *
+     * @return string
+     */
+    public static function getQuizMarkersRollsJS()
+    {
+        $webCodePath = api_get_path(WEB_CODE_PATH);
+        $colorPalette = self::getColorPalette(false, true);
+
+        return "
+            var \$originalNode = $(originalNode),
+                    qMarkersRolls = \$originalNode.data('q-markersrolls') || [],
+                    qMarkersColor = \$originalNode.data('q-markersrolls-color') || '{$colorPalette[0]}';
+
+                if (0 == qMarkersRolls.length) {
+                    return;
+                }
+
+                instance.options.markersRollsColor = qMarkersColor;
+                instance.options.markersRollsWidth = 2;
+                instance.options.markersRolls = {};
+
+                qMarkersRolls.forEach(function (qMarkerRoll) {
+                    var url = '{$webCodePath}exercise/exercise_submit.php?{{ _p.web_cid_query }}&'
+                        + $.param({
+                            exerciseId: qMarkerRoll[1],
+                            learnpath_id: 0,
+                            learnpath_item_id: 0,
+                            learnpath_item_view_id: 0,
+                            origin: 'embeddable'
+                        });
+
+                    instance.options.markersRolls[qMarkerRoll[0]] = url;
+                });
+
+                instance.buildmarkersrolls(instance, instance.controls, instance.layers, instance.media);
+        ";
+    }
 }

+ 12 - 0
src/Chamilo/CoreBundle/Composer/ScriptHandler.php

@@ -19,6 +19,18 @@ class ScriptHandler
         $newPath = __DIR__.'/../../../../web';
         $fs = new Filesystem();
         $fs->mirror($appCss, $newPath, null, ['override' => true]);
+
+        if ($fs->exists(__DIR__.'/../../../../web/build')) {
+            $fs->remove(__DIR__.'/../../../../web/build');
+        }
+
+        if ($fs->exists(__DIR__.'/../../../../app/cache/twig')) {
+            $fs->remove(__DIR__.'/../../../../app/cache/twig');
+        }
+
+        if (function_exists('opcache_reset')) {
+            opcache_reset();
+        }
     }
 
     /**