use App\Jobs\FluidbookCompiler;
use App\Models\FluidbookDocument;
use App\Util\Excel;
+use Cubist\Util\Json;
use Cubist\Util\Text;
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;
}
$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;
}
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
{
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();
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)
{