]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7661 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 31 Jul 2025 15:19:53 +0000 (17:19 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 31 Jul 2025 15:19:53 +0000 (17:19 +0200)
app/Console/Commands/SCORMCloseForHemsley.php [new file with mode: 0644]
app/Fluidbook/Link/LinksData.php

diff --git a/app/Console/Commands/SCORMCloseForHemsley.php b/app/Console/Commands/SCORMCloseForHemsley.php
new file mode 100644 (file)
index 0000000..a2b0fc4
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Console\Commands\Base\ToolboxCommand;
+use App\Fluidbook\Link\LinksData;
+use App\Models\FluidbookPublication;
+
+class SCORMCloseForHemsley extends ToolboxCommand
+{
+    protected $signature = 'scorm:closeforhemsley';
+
+    public function handle()
+    {
+        $fluidbooks = FluidbookPublication::withoutGlobalScopes()->where('c_title', 'LIKE', 'Hemsley\ Fraser\ -%')->get();
+
+        $changed = 0;
+        foreach ($fluidbooks as $fluidbook) {
+            /** @var $fluidbook FluidbookPublication */
+            $fluidbook->getLinksAndRulers($links, $rulers, 'latest', true);
+            $change = false;
+            foreach ($links as $id => $link) {
+                if (trim($link['to'], ' ;') === 'javascript:scormComplete()') {
+                    $change = true;
+                    $links[$id]['to'] = 'javascript:scormCompleteAndClose();';
+                }
+            }
+            if ($change) {
+                LinksData::saveLinksInFile($fluidbook->id, 0, 'Automatic change of scormComplete() function (see details in ticket #7661)', $links, $rulers);
+                $changed++;
+            }
+        }
+        $this->line($changed . ' fluidbooks altered');
+    }
+}
index 95ca34a37f773d7d5d2dfb4988b2e5e8adda5b6a..ff7725d66641d9f6efc24477331403b807c967b0 100644 (file)
@@ -295,7 +295,7 @@ class LinksData
     protected static function _fixV2TooltipLinks(&$links)
     {
         foreach ($links as $k => $link) {
-            if ($link['type'] == Link::TOOLTIP && (!$link['inline'] || $link['inline'] === 'popup')) {
+            if ($link['type'] == Link::TOOLTIP && (!isset($link['inline']) || !$link['inline'] || $link['inline'] === 'popup')) {
                 $links[$k]['type'] = Link::TEXT_POPUP;
                 $links[$k]['to'] = $link['infobulle'];
                 $links[$k]['infobulle'] = $links[$k]['tooltip'] = '';