]> _ Git - fluidbook-toolbox.git/commitdiff
wip #4592 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 29 Aug 2022 18:36:52 +0000 (20:36 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 29 Aug 2022 18:36:52 +0000 (20:36 +0200)
app/Fluidbook/SEO/Document.php
app/Jobs/FluidbookCompiler.php
app/Models/FluidbookPublication.php
app/Models/FluidbookTheme.php

index a1767027be69acccc89ceea07ddd666d85f14704..21c51b4e19d0c44f8490d0184c14560389e68c09 100644 (file)
@@ -5,6 +5,7 @@ namespace App\Fluidbook\SEO;
 use App\Jobs\FluidbookCompiler;
 use App\Models\FluidbookDocument;
 use App\Util\Excel;
+use Cubist\Util\Json;
 use Cubist\Util\Text;
 
 class Document
@@ -126,7 +127,7 @@ class Document
     public function _getPageLabel($page)
     {
         $res = $this->compiler->getSetting('title');
-        foreach ($this->compiler->getFluidbook()->chapters as $chapter) {
+        foreach ($this->compiler->getFluidbook()->getChapters() as $chapter) {
             if (trim($chapter['label'], "\t\r\n\0\x0B-+") == '') {
                 continue;
             }
index 425ab48948aed9a8ef43aaf4238bf713d979db61..3eb75d4751159a7ed62e19b6209e9ae58c7a82da 100644 (file)
@@ -3187,7 +3187,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
         $this->lessVariables['menu-chapters-columns-width'] = $this->fluidbookSettings->chaptersColMaxWidth;
         $this->lessVariables['menu-chapters-font-size'] = $this->fluidbookSettings->chaptersFontSize;
 
-        foreach ($this->getFluidbook()->chapters as $chapter) {
+        foreach ($this->getFluidbook()->getChapters() as $chapter) {
             if ($chapter['color'] == '') {
                 continue;
             }
index d4899d74b0c59f685cf339122400984d80462e13..945084248c3fcf07714179c67de3b56b86e34e92 100644 (file)
@@ -16,13 +16,14 @@ use App\Models\Base\ToolboxSettingsModel;
 use App\Models\Traits\PublicationSettings;
 use App\Models\Traits\SCORMVersionTrait;
 use Backpack\CRUD\app\Library\Widget;
-use Cubist\Backpack\Magic\Fields\Datetime;
 use Cubist\Backpack\Magic\Fields\FormBigSection;
 use Cubist\Backpack\Magic\Fields\FormSuperSection;
 use Cubist\Backpack\Magic\Fields\Hidden;
 use Cubist\Backpack\Magic\Fields\Integer;
 use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Util\Files\Files;
+use Cubist\Util\Json;
+use Datetime;
 
 class FluidbookPublication extends ToolboxSettingsModel
 {
@@ -283,7 +284,7 @@ class FluidbookPublication extends ToolboxSettingsModel
     public function getCompositionUpdate(): int
     {
         if (null === $this->composition_updated_at) {
-            $this->composition_updated_at = new Datetime();
+            $this->setAttribute('composition_updated_at', new Datetime());
             $this->saveQuietly();
         }
         return $this->composition_updated_at->getTimestamp();
@@ -295,6 +296,17 @@ class FluidbookPublication extends ToolboxSettingsModel
         return self::_getDocument($compo[0])->getPDFSource($type);
     }
 
+    /**
+     * @return array
+     */
+    public function getChapters(): array
+    {
+        if (!$this->chapters) {
+            return [];
+        }
+        return Json::decode($this->chapters, true);
+    }
+
     public function compile($dest)
     {
 
index 5c52e7a40132415f786c6c6f78cf11779d714a11..b91ee22e8870406afa54ca28af02c073fd7a7c49 100644 (file)
@@ -811,7 +811,7 @@ class FluidbookTheme extends ToolboxSettingsModel
         } else {
             $get = '';
         }
-        return 'https://workshop.fluidbook.com/viewerh/20098-' . $id . '_f2e0452eed6dba9878016ce5603fdc54/' . $get . '#/page/' . $page;
+        return 'https://toolbox.fluidbook.com/fluidbook-publication/preview/20098-' . $id . '_f2e0452eed6dba9878016ce5603fdc54/' . $get . '#/page/' . $page;
     }