From e4d0413eb507047ec9cba3370cc16c91f4a0f0f3 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 6 Sep 2023 11:38:25 +0200 Subject: [PATCH] wip #6248 @0.5 --- app/Models/Base/ToolboxContentTranslate.php | 16 ++++++++++++++-- app/Models/ElearningTranslate.php | 17 ++--------------- app/Models/FluidbookTranslate.php | 14 +------------- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/app/Models/Base/ToolboxContentTranslate.php b/app/Models/Base/ToolboxContentTranslate.php index 96cbaebd4..5a0f9e0c6 100644 --- a/app/Models/Base/ToolboxContentTranslate.php +++ b/app/Models/Base/ToolboxContentTranslate.php @@ -16,6 +16,8 @@ class ToolboxContentTranslate extends Translate protected static string $_name = 'content'; + protected static $_basePath = ''; + protected $_operations = [ExcelExportOperation::class, ExcelImportOperation::class]; public function __construct(array $attributes = []) @@ -47,10 +49,10 @@ class ToolboxContentTranslate extends Translate public function getExtensions() { - return array_merge(parent::getExtensions(), ['js']); + return parent::getExtensions() + ['js']; } - public static function getAllTranslations($force = false) + public static function getAllTranslations($force = true) { if (null === static::$_allTranslations) { $cacheKey = 'all_' . static::$_name . '_translations'; @@ -124,4 +126,14 @@ class ToolboxContentTranslate extends Translate return $all[$locale] ?? []; } + public function getPaths() + { + $res = []; + foreach (static::getActiveBranches() as $branch) { + $res['Player - git:' . $branch] = static::$_basePath . '/branches/' . $branch; + $res['Player - local:' . $branch] = static::$_basePath . '/local/' . $branch; + } + return $res; + } + } diff --git a/app/Models/ElearningTranslate.php b/app/Models/ElearningTranslate.php index 6abe4c465..041d997f3 100644 --- a/app/Models/ElearningTranslate.php +++ b/app/Models/ElearningTranslate.php @@ -17,7 +17,8 @@ class ElearningTranslate extends ToolboxContentTranslate use QuizBranches; protected $table = 'elearning_translate'; - protected static string $_name='elearning'; + protected static string $_name = 'elearning'; + protected static $_basePath='resources/quiz/player'; protected $_enableRevisions = false; @@ -27,18 +28,4 @@ class ElearningTranslate extends ToolboxContentTranslate 'oneinstance' => true]; protected $_operations = [ExcelExportOperation::class, ExcelImportOperation::class]; - - - public function getPaths() - { - $res = []; - foreach (self::getActiveBranches() as $branch) { - $res['Player - git:' . $branch] = 'resources/quiz/player/branches/' . $branch . '/js'; - $res['Player - local:' . $branch] = 'resources/quiz/player/local/' . $branch . '/js'; - } - //$res[__('Compilateur')]='resources/compiler'; - //$res[__('Application')]=''resources/html5app'; - return $res; - } - } diff --git a/app/Models/FluidbookTranslate.php b/app/Models/FluidbookTranslate.php index 34df1d4e5..22c153a70 100644 --- a/app/Models/FluidbookTranslate.php +++ b/app/Models/FluidbookTranslate.php @@ -20,6 +20,7 @@ class FluidbookTranslate extends ToolboxContentTranslate protected $table = 'fluidbook_translate'; protected static string $_name = 'elearning'; + protected static $_basePath = 'resources/fluidbookpublication/player'; protected static $_allTranslations = null; @@ -36,19 +37,6 @@ class FluidbookTranslate extends ToolboxContentTranslate parent::setFields(); } - public function getPaths() - { - $res = []; - foreach (self::getActiveBranches() as $branch) { - $res['Player - git:' . $branch] = 'resources/fluidbookpublication/player/branches/' . $branch . '/js'; - $res['Player - local:' . $branch] = 'resources/fluidbookpublication/player/local/' . $branch . '/js'; - } - //$res[__('Compilateur')]='resources/compiler'; - //$res[__('Application')]=''resources/html5app'; - return $res; - } - - public static function getAllFluidbookTranslations($force = false) { return static::getAllTranslations($force); -- 2.39.5