From 62a88a5118ff01b436c53def6dee7884aef7450e Mon Sep 17 00:00:00 2001 From: David Herney Date: Sat, 20 Jul 2024 14:56:14 -0500 Subject: [PATCH] Includes SCORM player scope as a site-level configuration option. --- classes/privacy/provider.php | 1 + lang/en/format_onetopic.php | 3 ++- lang/es/format_onetopic.php | 4 ++++ lib.php | 10 ++++++++++ settings.php | 1 + version.php | 2 +- 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index fa1814d..7ced1dd 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -20,6 +20,7 @@ * @copyright 2019 David Herney Bernal - cirano * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + namespace format_onetopic\privacy; /** diff --git a/lang/en/format_onetopic.php b/lang/en/format_onetopic.php index 655f5d5..92a10db 100644 --- a/lang/en/format_onetopic.php +++ b/lang/en/format_onetopic.php @@ -74,7 +74,7 @@ $string['cssweightlighter'] = 'Lighter'; $string['currentsection'] = 'This topic'; $string['defaultscope'] = 'Default scope'; -$string['defaultscope_help'] = 'Default scope used to define the pages on which the tab menu is printed.'; +$string['defaultscope_help'] = 'Default scope used to define the pages on which the tab menu is printed. The SCORM Player scope require the Modules scope.'; $string['defaultsectionsnavigation'] = 'Default value to sections navigation'; $string['defaultsectionsnavigation_help'] = 'Default value used in courses to define the "Uses sections navigation" feature. This can be overwrite for each course.'; $string['disable'] = 'Disable'; @@ -117,6 +117,7 @@ $string['progress_full'] = 'Duplicating topic'; $string['rebuild_course_cache'] = 'Rebuild course cache'; $string['scope_mod'] = 'Modules'; +$string['scope_scorm'] = 'SCORM Player'; $string['sectionname'] = 'Topic'; $string['sectionsnavigation_both'] = 'At top and bottom section'; $string['sectionsnavigation_bottom'] = 'Only at the bottom'; diff --git a/lang/es/format_onetopic.php b/lang/es/format_onetopic.php index e6a55d4..8436115 100644 --- a/lang/es/format_onetopic.php +++ b/lang/es/format_onetopic.php @@ -36,6 +36,8 @@ $string['cssstyles'] = 'Propiedades CSS'; $string['cssstyles_help'] = 'Sirve para cambiar las propiedades CSS de la pestaña. Utilice el formato tradicional del atributo style de una etiqueta html. Ejemplo:
font-weight: bold; font-size: 16px;'; $string['currentsection'] = 'Este tema'; +$string['defaultscope'] = 'Alcance predeterminado'; +$string['defaultscope_help'] = 'Alcance predeterminado utilizado para definir las páginas adicionales en las que se imprime el menú de pestañas. El alcance del Reproductor SCORM requiere el alcance de los Módulos.'; $string['defaultsectionsnavigation'] = 'Valor por defecto para la navegación de secciones'; $string['defaultsectionsnavigation_help'] = 'Valor por defecto a ser utilizado para definir el comportamiento de la funcionalidad "Usar navegación en secciones". Este valor puede ser sobreescrito por cada curso.'; $string['disable'] = 'Deshabilitar'; @@ -76,6 +78,8 @@ $string['progress_counter'] = 'Duplicando actividades ({$a->current}/{$a->size})'; $string['progress_full'] = 'Duplicando el tema'; $string['rebuild_course_cache'] = 'Recreando el caché del curso'; +$string['scope_mod'] = 'Módulos'; +$string['scope_scorm'] = 'Reproductor de SCORM'; $string['sectionname'] = 'Tema'; $string['sectionsnavigation_both'] = 'En la parte superior e inferior de la sección'; $string['sectionsnavigation_bottom'] = 'Usar en la parte inferior'; diff --git a/lib.php b/lib.php index a7633b2..4307b86 100644 --- a/lib.php +++ b/lib.php @@ -80,6 +80,9 @@ class format_onetopic extends core_courseformat\base { /** @var string Course modules scope */ const SCOPE_MOD = 'mod'; + /** @var string Scorm modules scope */ + const SCOPE_SCORM = 'scorm'; + /** @var bool If the class was previously instanced, in one execution cycle */ private static $loaded = false; @@ -143,6 +146,13 @@ protected function __construct($format, $courseid) { $this->currentscope = self::SCOPE_MOD; $patternavailable = '/^mod-.*-view$/'; $this->printable = preg_match($patternavailable, $PAGE->pagetype); + + if (!$this->printable) { + if (in_array(self::SCOPE_SCORM, $scope) && $PAGE->pagetype == 'mod-scorm-player') { + $this->printable = true; + } + } + } else { $this->printable = false; } diff --git a/settings.php b/settings.php index 6554bd8..12be252 100644 --- a/settings.php +++ b/settings.php @@ -55,6 +55,7 @@ $options = [ \format_onetopic::SCOPE_MOD => new lang_string('scope_mod', 'format_onetopic'), + \format_onetopic::SCOPE_SCORM => new lang_string('scope_scorm', 'format_onetopic'), ]; $settings->add(new admin_setting_configmulticheckbox('format_onetopic/defaultscope', get_string('defaultscope', 'format_onetopic'), diff --git a/version.php b/version.php index 0716221..8e2a808 100644 --- a/version.php +++ b/version.php @@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024050901; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2024050901.01; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2024041600; // Requires this Moodle version. $plugin->component = 'format_onetopic'; // Full name of the plugin (used for diagnostics). $plugin->maturity = MATURITY_BETA;