namespace App\Fluidbook\Compiler;
use App\Fields\FluidbookFont;
-use App\Fluidbook\PDF;
use App\Fluidbook\SEO\Page;
use App\Fluidbook\SocialImage;
use App\Http\Controllers\Admin\Operations\Tools\Favicon;
use Cache;
use Search;
use Accessibility;
+ use Tabs;
+ use PDF;
/** @var Lock */
protected $lock;
'js/libs/jquery/jquery.scrollto.min.js',
],
'aria' => ['js/libs/aria/radio.js',],
- 'bluebird' => ['js/libs/bluebird.min.js'],
+ //'bluebird' => ['js/libs/bluebird.min.js'],
'noaccents' => ['js/libs/noaccents.js'],
'screenfull' => ['js/libs/screenfull.min.js'],
'storage' => ['js/libs/storage.js',],
'android' => array('webintent'));
public $pluginCSS = [];
public $pluginJs = [];
+ protected $customJs = [];
public $htmlmultimedia = [];
public $cssX = [];
public $cssY = [];
$this->dir = $this->getFluidbook()->getFinalPath($theme, $scormVariant);
$this->vdir = new VirtualDirectory($this->dir);
+ $this->vdir->setLogger($this);
$this->vdir->setErrorListener($this);
$this->wdir = $this->getFluidbook()->getAssetDir();
$this->config->vectorPages = array_diff(ArrayUtil::parseRange($this->config->vectorPages), $this->config->rasterizePages);
$this->numerotation = $this->config->numerotation = explode(',', $this->getFluidbook()->page_numbers);
- $hideOnPages = ArrayUtil::parseRange($this->config->tabsHideOnPages);
- $this->config->tabsDisabledOnPages = ArrayUtil::parseRange($this->config->tabsDisabledOnPages);
+ $this->initTabsConfig();
- if ($this->config->tabsHideOnCover) {
- $hideOnPages[] = 0;
- $hideOnPages[] = 1;
- }
- if ($this->config->tabsHideOnLastPage) {
- $hideOnPages[] = count($this->pages);
- }
- $this->config->tabsHideOnPages = $hideOnPages;
$this->config->triggersLinks = [];
$this->config->hasContentLock = false;
}
// We need to be able to reference both navOrder and navOrderH so convert both to arrays
// We also make sure there are no empty items in the arrays (see: http://php.net/manual/en/function.array-filter.php#111091)
- $this->config->navOrder = array_filter(array_map('trim', explode(',', $this->config->navOrder)), 'strlen');
- $this->config->navOrderH = array_filter(array_map('trim', explode(',', $this->config->navOrderH)), 'strlen');
+ $this->config->navOrder = array_values(array_filter(array_map('trim', explode(',', $this->config->navOrder)), 'strlen'));
+ $this->config->navOrderH = array_values(array_filter(array_map('trim', explode(',', $this->config->navOrderH)), 'strlen'));
$this->config->standalone = $this->standalone;
if ($this->config->phonegap) {
}
$this->writeJs();
$this->log('Js written');
+ //$this->vdir->setUpdateMode($this->getFluidbook()->region !== 'UE');
$this->vdir->sync(true, $this);
- `chmod -R 775 $this->dir`;
+
+ \Cubist\Backpack\Jobs\CommandLine::dispatch("chmod -R 775 $this->dir");
$this->log('Files Synced');
// $f=rtrim(str_replace('/html5/', '/compiletime/', $this->dir));
// touch($f);
}
$script = '<script type="text/javascript" charset="utf-8" src="' . $assetsPrefix . 'data/datas.js' . $jstime . '"></script>' . "\n";
+ foreach ($this->customJs as $c) {
+ $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="' . $c . $jstime . '"></script>' . "\n";
+ }
foreach ($this->jsLibs as $jsLib => $files) {
$script .= "\t" . '<script type="text/javascript" charset="utf-8" src="' . $assetsPrefix . 'data/' . $jsLib . '.js' . $jstime . '"></script>' . "\n";
}
return $variables;
}
- protected function writePDF()
- {
- if (!$this->fluidbookSettings->print && !$this->fluidbookSettings->pdf) {
- return;
- }
-
- $res = PDF::compilePDF($this->getFluidbook());
- if (!$this->config->pdfName) {
- $this->config->pdfName = 'document.pdf';
- }
- $this->config->pdfName = Text::removeAccents($this->config->pdfName);
- if (mb_strtolower(substr($this->config->pdfName, -4)) !== '.pdf') {
- $this->config->pdfName .= '.pdf';
- }
- if ($res !== false) {
- $this->vdir->copy($res, 'data/' . $this->config->pdfName);
- }
- $this->log('PDF written');
- return '';
+ protected function replaceVariables($str)
+ {
+ $replace = ['%title%' => $this->config->title];
+ return strtr($str, $replace);
}
protected function addFilesInfos($key, $file)
$this->config->content_lock = $this->content_lock;
}
+ public function addPDFJSPageRenderer()
+ {
+ $this->vdir->copyDirectory(resource_path('pdfjs/dist-min'), 'pdfjs');
+ $this->customJs[] = 'pdfjs/build/pdf.js';
+ }
+
public function addPDFJS($force = false)
{
if ($this->_addedPDFJS) {