use App\Models\ELearningMedia;
use App\Models\ELearningPackage;
use App\Models\FluidbookHealthIssues;
+use App\Models\FluidbookIconset;
use App\Models\FluidbookPublication;
use App\Models\FluidbookTheme;
use App\Models\Quiz;
$this->initMobileFirst();
}
+ $icons = FluidbookIconset::getSVGPath();
+
$this->svgfiles = array_unique([$this->assets . '/images/symbols/interface.svg',
- storage_path('icons/15.svg')]);
+ $icons . '15.svg',]);
if ($this->themeSettings->iconSet > 15) {
- $this->svgfiles[] = storage_path('icons/' . $this->themeSettings->iconSet . '.svg');
+ $this->svgfiles[] = $icons . $this->themeSettings->iconSet . '.svg';
}
if ($symbols = $this->themeAsset('symbols')) {
$this->svgfiles[] = $symbols->getPathname();
}
+
if ($this->isMobileFirst()) {
$this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssOneScale;
} else {
{
$symbols = [];
foreach ($this->svgfiles as $svgfile) {
- $symbols = array_merge($symbols, $this->_getSVGSymbols($svgfile));
+ $s = $this->_getSVGSymbols($svgfile);
+ $symbols = array_merge($symbols, $s);
}
$symbols = array_merge($symbols, $this->_svgSymbols);
return '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">' . str_replace('> <', '><', Text::removeNewLines(implode('', $symbols))) . '</svg>';
use Cubist\Backpack\Magic\Fields\Code;
use Cubist\Backpack\Magic\Fields\Text;
use Cubist\Util\Files\Files;
+
// __('!!Paramètres des fluidbooks')
class FluidbookIconset extends ToolboxModel
{
'default' => '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"></svg>']);
}
- public function postSave()
+ public function onSaved(): bool
{
- parent::postSave();
- self::updateWS2();
+ $res = parent::onSaved();
+ self::writeSVGFiles();
+ return $res;
}
- public static function updateWS2()
+ public static function writeSVGFiles()
{
- foreach (self::all() as $item) {
- $dir = '/home/extranet/www/fluidbook/icones/' . $item->id;
- Files::mkdir($dir);
- file_put_contents($dir . '/interface.svg', $item->icons);
- // For WS3
- file_put_contents(Files::mkdir(storage_path('icons')) . '/' . $item->id . '.svg', $item->icons);
+ $icons = self::getSVGPath();
+ foreach (self::withoutGlobalScopes()->get() as $item) {
+ file_put_contents($icons . $item->id . '.svg', $item->icons);
}
}
- public function postCreate()
+ public static function getSVGPath()
{
- parent::postCreate();
- self::updateWS2();
+ return Files::mkdir(protected_path('fluidbookpublication/icons'));
+ }
+
+ public function onCreated(): bool
+ {
+
+ $res = parent::onCreated();
+ self::writeSVGFiles();
+ return $res;
}
- public function postDelete()
+ public function onDeleted(): bool
{
- parent::postDelete();
- self::updateWS2();
+ $res = parent::onDeleted();
+ self::writeSVGFiles();
+ return $res;
}
}
}
}
+if (!function_exists('dddump')) {
+ function dddump()
+ {
+ $devs = [5, 5908];
+ if (backpack_user() === null || !in_array(backpack_user()->id, $devs)) {
+ return;
+ }
+ return call_user_func_array('dump', func_get_args());
+ }
+}
+
+
if (!function_exists('us_path')) {
function us_path($path = '')