namespace App\Models;
+use App\Fields\ElearningLocale;
use App\Fields\SCORMVersion;
use App\Http\Controllers\Admin\Operations\ChangeownerOperation;
use App\Http\Controllers\Admin\Operations\ELearningMedia\ImportOperation;
$this->addHashField();
+
$this->addField(['name' => 'client',
'label' => __('Nom du client'),
'type' => 'Text',
'column_label' => __('Projet')
]);
+ $this->addField(['name' => 'locale',
+ 'label' => __('Langue'),
+ 'type' => ElearningLocale::class,
+ 'default' => 'en',
+ 'column' => true,
+ 'column_label' => '<i class="fa fa-language"></i>']);
+
$this->addField('type', Hidden::class, __('Type'), ['column' => true]);
$this->addField('title', Text::class, __('Titre'), ['column' => true]);
$this->addField(['name' => 'scorm_version',
$this->addField('complete_pct', Percent::class, __('Marquer terminé quand ce pourcentage est lu'), ['default' => 75, 'when' => ['complete_button' => 0, 'type' => ['logical_operator' => 'OR', 'values' => ['video', 'audio']]]]);
}
- public function preSave()
+ public function onSaving(): bool
{
$file = $this->getMediaInField('file')->first();
if ($file !== null) {
$spl = new \SplFileInfo($file->getPath());
$this->setAttribute('type', self::getType($spl->getExtension()));
}
- return parent::preSave();
+ return parent::onSaving();
}
public static function getType($ext)
$vdir->file_put_contents('pdfjs/web/viewer.css', $css);
}
$vdir->copy($file, 'media.' . $ext);
- $vdir->file_put_contents('index.html', view('elearningmedia.index', ['complete_pct' => $complete_pct,'title' => $title, 'type' => $type]));
+ $vdir->file_put_contents('index.html', view('elearningmedia.index', ['complete_pct' => $complete_pct, 'title' => $title, 'type' => $type]));
$vdir->sync(true);
return $title;
}