+ class="content {{^iscoursedisplaymultipage}}{{^sitehome}}{{^displayonesection}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/displayonesection}}{{/sitehome}}{{/iscoursedisplaymultipage}}">
{{#summary}}
{{$ core_courseformat/local/content/section/summary }}
@@ -112,11 +133,4 @@
{{/ core_courseformat/local/content/section/cmlist }}
{{/cmlist}}
{{{cmcontrols}}}
- {{#insertafter}}
- {{#numsections}}
- {{$ core_courseformat/local/content/addsection}}
- {{> core_courseformat/local/content/addsection}}
- {{/ core_courseformat/local/content/addsection}}
- {{/numsections}}
- {{/insertafter}}
\ No newline at end of file
diff --git a/tests/behat/edit_delete_sections.feature b/tests/behat/edit_delete_sections.feature
index 22f9527..1250b6e 100644
--- a/tests/behat/edit_delete_sections.feature
+++ b/tests/behat/edit_delete_sections.feature
@@ -25,32 +25,30 @@ Feature: Sections can be edited and deleted in Onetopic format
Scenario: View the default name of the general section in Onetopic format
When I edit the section "0"
- Then the field "Custom" matches value "0"
- And the field "New value for Section name" matches value "General"
+ Then the field "Section name" matches value ""
+ And I should see "General"
Scenario: Edit the default name of the general section in Onetopic format
When I edit the section "0" and I fill the form with:
- | Custom | 1 |
- | New value for Section name | This is the general section |
+ | Section name | This is the general section |
Then I should see "This is the general section" in the ".format_onetopic-tabs .tab_position_0 .nav-link.active" "css_element"
Scenario: View the default name of the second section in Onetopic format
When I click on "Topic 2" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
And I edit the section "2"
- Then the field "Custom" matches value "0"
- And the field "New value for Section name" matches value "Topic 2"
+ Then the field "Section name" matches value ""
+ And I should see "Topic 2"
- Scenario: Edit section summary in Onetopic format
+ Scenario: Edit section description in Onetopic format
When I click on "Topic 2" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
And I edit the section "2" and I fill the form with:
- | Summary | Welcome to section 2 |
+ | Description | Welcome to section 2 |
Then I should see "Welcome to section 2" in the "#page-content li#section-2" "css_element"
Scenario: Edit section default name in Onetopic format
When I click on "Topic 2" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
And I edit the section "2" and I fill the form with:
- | Custom | 1 |
- | New value for Section name | This is the second topic |
+ | Section name | This is the second topic |
Then I should see "This is the second topic" in the ".format_onetopic-tabs .tab_position_2 .nav-link.active" "css_element"
And I should not see "Topic 2" in the ".format_onetopic-tabs .tab_position_2 .nav-link.active" "css_element"
@@ -63,15 +61,16 @@ Feature: Sections can be edited and deleted in Onetopic format
And I should see "Topic 4"
Scenario: Deleting the middle section in Onetopic format
- When I click on "Topic 4" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
- And I delete section "4"
+ When I click on "Topic 3" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
+ And I delete section "3"
+ Then I should see "Are you absolutely sure you want to completely delete \"Topic 3\" and all the activities it contains?"
And I press "Delete"
- Then I should not see "Topic 5"
+ And I should not see "Topic 5"
And I should see "Topic 3" in the ".format_onetopic-tabs .tab_position_3 .nav-link.active" "css_element"
- And I click on "Topic 4" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
- And I should not see "Test chat name"
- And I should see "Test choice name" in the "#page-content li#section-4" "css_element"
- And I should see "Topic 4"
+ And I click on "Topic 3" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
+ And I should not see "Test book name"
+ And I should see "Test chat name" in the "#page-content li#section-3" "css_element"
+ And I should see "Topic 3"
Scenario: Adding a section in Onetopic format
When I follow "Add a section after the currently selected section"
@@ -86,3 +85,11 @@ Feature: Sections can be edited and deleted in Onetopic format
Then I should see "Topic 6"
And I should not see "Test choice name" in the "#page-content li#section-5" "css_element"
And ".format_onetopic-tabs .tab_position_7 .nav-link" "css_element" should not exist
+
+ @javascript
+ Scenario: Copy section permalink URL to clipboard
+ Given I am on "Course 1" course homepage with editing mode on
+ When I open section "1" edit menu
+ And I click on "Permalink" "link" in the "Section 1" "section"
+ And I click on "Copy to clipboard" "link" in the "Permalink" "dialogue"
+ Then I should see "Text copied to clipboard"
diff --git a/version.php b/version.php
index 2f53bbd..f28ff95 100644
--- a/version.php
+++ b/version.php
@@ -21,19 +21,19 @@
* Un recorderis de las Veredas de mi pueblo, en homenaje a los campesinos de mi tierra.
*
* Old releases: Guarango, Pantalio, Chalarca, Mazorcal, Chuscalito, Las Teresas, La Madera, Las Brisas, Buenavista,
- * San Juan, La Almería, Piedras Teherán
+ * San Juan, La Almería, Piedras Teherán, El Cardal.
*
- * Next releases: El Cardal, Santa Cruz, Vallejuelito, Fátima, La Cabaña, La Palmera, Las Acacias, Las Colmenas, Minitas,
+ * Next releases: Santa Cruz, Vallejuelito, Fátima, La Cabaña, La Palmera, Las Acacias, Las Colmenas, Minitas,
* Quebrada Negra, San Francisco, San Miguel Abajo, San Miguel, La Concha, La Divisa
*
* @package format_onetopic
- * @copyright 2015 David Herney Bernal - cirano. https://bambuco.co
+ * @copyright 2015 David Herney - cirano. https://bambuco.co
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2024050900.01; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2024050900.04; // 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;
From 04a954ebc13a01978a355577c39754b7bc27cd7f Mon Sep 17 00:00:00 2001
From: David Herney
Date: Thu, 9 May 2024 04:10:24 -0500
Subject: [PATCH 43/50] Behat test changes
---
tests/behat/edit_delete_sections.feature | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/tests/behat/edit_delete_sections.feature b/tests/behat/edit_delete_sections.feature
index 1250b6e..aba447a 100644
--- a/tests/behat/edit_delete_sections.feature
+++ b/tests/behat/edit_delete_sections.feature
@@ -2,7 +2,7 @@
Feature: Sections can be edited and deleted in Onetopic format
In order to rearrange my course contents
As a teacher
- I need to edit and Delete topics
+ I need to edit and delete topics
Background:
Given the following "users" exist:
@@ -15,7 +15,7 @@ Feature: Sections can be edited and deleted in Onetopic format
| activity | name | intro | course | idnumber | section |
| assign | Test assignment name | Test assignment description | C1 | assign1 | 0 |
| book | Test book name | Test book description | C1 | book1 | 1 |
- | chat | Test chat name | Test chat description | C1 | chat1 | 4 |
+ | lesson | Test lesson name | Test lesson description | C1 | lesson1 | 4 |
| choice | Test choice name | Test choice description | C1 | choice1 | 5 |
And the following "course enrolments" exist:
| user | course | role |
@@ -61,16 +61,16 @@ Feature: Sections can be edited and deleted in Onetopic format
And I should see "Topic 4"
Scenario: Deleting the middle section in Onetopic format
- When I click on "Topic 3" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
- And I delete section "3"
- Then I should see "Are you absolutely sure you want to completely delete \"Topic 3\" and all the activities it contains?"
+ When I click on "Topic 4" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
+ And I delete section "4"
+ Then I should see "Are you absolutely sure you want to completely delete \"Topic 4\" and all the activities it contains?"
And I press "Delete"
And I should not see "Topic 5"
And I should see "Topic 3" in the ".format_onetopic-tabs .tab_position_3 .nav-link.active" "css_element"
- And I click on "Topic 3" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
- And I should not see "Test book name"
- And I should see "Test chat name" in the "#page-content li#section-3" "css_element"
- And I should see "Topic 3"
+ And I click on "Topic 4" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
+ And I should not see "Test lesson name"
+ And I should see "Test choice name" in the "#page-content li#section-4" "css_element"
+ And I should see "Topic 4"
Scenario: Adding a section in Onetopic format
When I follow "Add a section after the currently selected section"
@@ -88,8 +88,8 @@ Feature: Sections can be edited and deleted in Onetopic format
@javascript
Scenario: Copy section permalink URL to clipboard
- Given I am on "Course 1" course homepage with editing mode on
- When I open section "1" edit menu
+ When I click on "Topic 1" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
+ And I open section "1" edit menu
And I click on "Permalink" "link" in the "Section 1" "section"
And I click on "Copy to clipboard" "link" in the "Permalink" "dialogue"
Then I should see "Text copied to clipboard"
From cfd1a0afdc63cdfbc3f99ce88768cd133d356ef1 Mon Sep 17 00:00:00 2001
From: David Herney
Date: Sat, 11 May 2024 17:54:16 -0500
Subject: [PATCH 44/50] Behat test tuning
---
tests/behat/edit_delete_sections.feature | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/behat/edit_delete_sections.feature b/tests/behat/edit_delete_sections.feature
index aba447a..8b3124c 100644
--- a/tests/behat/edit_delete_sections.feature
+++ b/tests/behat/edit_delete_sections.feature
@@ -90,6 +90,6 @@ Feature: Sections can be edited and deleted in Onetopic format
Scenario: Copy section permalink URL to clipboard
When I click on "Topic 1" "link" in the "#page-content ul.nav.nav-tabs" "css_element"
And I open section "1" edit menu
- And I click on "Permalink" "link" in the "Section 1" "section"
+ And I click on "Permalink" "link"
And I click on "Copy to clipboard" "link" in the "Permalink" "dialogue"
Then I should see "Text copied to clipboard"
From d14c8f14440dd44c8ea961752caf9dba99506d1e Mon Sep 17 00:00:00 2001
From: David Herney
Date: Thu, 16 May 2024 00:00:53 -0500
Subject: [PATCH 45/50] Fixed: Duplication of activitiy in section 0 #154 - M
4.4+
---
classes/output/courseformat/content.php | 12 ++++++++++--
classes/output/courseformat/content/section.php | 9 +++++++++
lib.php | 15 +++++++++++----
version.php | 2 +-
4 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/classes/output/courseformat/content.php b/classes/output/courseformat/content.php
index 246af67..0f9f2b0 100644
--- a/classes/output/courseformat/content.php
+++ b/classes/output/courseformat/content.php
@@ -128,7 +128,7 @@ public function export_for_template(\renderer_base $output) {
/**
* Export sections array data.
*
- * @param renderer_base $output typically, the renderer that's calling this function
+ * @param \renderer_base $output typically, the renderer that's calling this function
* @return array data context for a mustache template
*/
protected function export_sections(\renderer_base $output): array {
@@ -137,11 +137,14 @@ protected function export_sections(\renderer_base $output): array {
$course = $format->get_course();
$modinfo = $this->format->get_modinfo();
+ $realcoursedisplay = property_exists($course, 'realcoursedisplay') ? $course->realcoursedisplay : false;
+ $firstsectionastab = ($realcoursedisplay == COURSE_DISPLAY_MULTIPAGE) ? 1 : 0;
+
// Generate section list.
$sections = [];
$stealthsections = [];
$numsections = $format->get_last_section_number();
- foreach ($this->get_sections_to_display($modinfo) as $sectionnum => $thissection) {
+ foreach ($this->get_sections_to_display($modinfo) as $thissection) {
// The course/view.php check the section existence but the output can be called
// from other parts so we need to check it.
if (!$thissection) {
@@ -149,6 +152,11 @@ protected function export_sections(\renderer_base $output): array {
}
$section = new $this->sectionclass($format, $thissection);
+ $sectionnum = $section->get_sectionnum();
+
+ if ($sectionnum === 0 && $firstsectionastab) {
+ continue;
+ }
if ($sectionnum > $numsections) {
// Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
diff --git a/classes/output/courseformat/content/section.php b/classes/output/courseformat/content/section.php
index f03af17..65c8f5e 100644
--- a/classes/output/courseformat/content/section.php
+++ b/classes/output/courseformat/content/section.php
@@ -77,4 +77,13 @@ public function export_for_template(\renderer_base $output): stdClass {
return $data;
}
+
+ /**
+ * Get the section number.
+ *
+ * @return int
+ */
+ public function get_sectionnum() {
+ return $this->section->section;
+ }
}
diff --git a/lib.php b/lib.php
index 3928963..a7633b2 100644
--- a/lib.php
+++ b/lib.php
@@ -186,16 +186,20 @@ protected function __construct($format, $courseid) {
}
if ($course->realcoursedisplay == COURSE_DISPLAY_MULTIPAGE && $realsection === 0 && $numsections >= 1) {
- $realsection = 1;
+ $realsection = null;
}
$modinfo = get_fast_modinfo($course);
$sections = $modinfo->get_section_info_all();
// Check if the display section is available.
- if (!$sections[$realsection]->uservisible) {
+ if ($realsection === null || !$sections[$realsection]->uservisible) {
- self::$formatmsgs[] = get_string('hidden_message', 'format_onetopic', $this->get_section_name($realsection));
+ if ($realsection) {
+ self::$formatmsgs[] = get_string('hidden_message',
+ 'format_onetopic',
+ $this->get_section_name($realsection));
+ }
$valid = false;
$k = $course->realcoursedisplay ? 1 : 0;
@@ -214,7 +218,10 @@ protected function __construct($format, $courseid) {
$realsection = $valid ? $k : 0;
}
+ $realsection = $realsection ?? 0;
+ // The $section var is a global var, we need to set it to the real section.
$section = $realsection;
+ $this->set_sectionnum($section);
$USER->display[$course->id] = $realsection;
$urlparams['section'] = $realsection;
$PAGE->set_url('/course/view.php', $urlparams);
@@ -1008,7 +1015,7 @@ public function fot_get_sections_extra() {
}
$course = $this->get_course();
- $realcoursedisplay = property_exists($course, 'coursedisplay') ? $course->coursedisplay : false;
+ $realcoursedisplay = property_exists($course, 'realcoursedisplay') ? $course->realcoursedisplay : false;
$firstsection = ($realcoursedisplay == COURSE_DISPLAY_MULTIPAGE) ? 1 : 0;
$sections = $this->get_sections();
$parentsections = [];
diff --git a/version.php b/version.php
index f28ff95..0716221 100644
--- a/version.php
+++ b/version.php
@@ -33,7 +33,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2024050900.04; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2024050901; // 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;
From 3f2ba2dcb5f6d2a1a2dcbee9fa0c65225be8de54 Mon Sep 17 00:00:00 2001
From: David Herney
Date: Fri, 19 Jul 2024 01:51:24 -0500
Subject: [PATCH 46/50] upgrade activityinformation
---
.../courseformat/content/section/summary.php | 6 +--
.../content/cm/cmiconinline.mustache | 41 +++++++++++++++++++
.../content/cm/cmnameinline.mustache | 11 +++--
3 files changed, 51 insertions(+), 7 deletions(-)
create mode 100644 templates/courseformat/content/cm/cmiconinline.mustache
diff --git a/classes/output/courseformat/content/section/summary.php b/classes/output/courseformat/content/section/summary.php
index bdc0546..ad1fb79 100644
--- a/classes/output/courseformat/content/section/summary.php
+++ b/classes/output/courseformat/content/section/summary.php
@@ -185,9 +185,9 @@ private function replace_resources(section_info $section) {
$cmdata->uniqueid = 'cm_' . $mod->id . '_' . time() . '_' . rand(0, 1000);
$cmdata->singlename = $instancename;
- $cmdata->showinlinehelp = $cmdata->activityinfo->hascompletion
- || $cmdata->activityinfo->hasdates
- || !empty($cmdata->altcontent);
+ // ToDo: Implement additional activity information. Now it's called "activity badge".
+ $cmdata->showinlinehelp = false;
+
$url = $mod->url;
if (empty($url)) {
// If there is content but NO link (like label), then don't display it.
diff --git a/templates/courseformat/content/cm/cmiconinline.mustache b/templates/courseformat/content/cm/cmiconinline.mustache
new file mode 100644
index 0000000..c4e598f
--- /dev/null
+++ b/templates/courseformat/content/cm/cmiconinline.mustache
@@ -0,0 +1,41 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template format_onetopic/courseformat/content/cm/cmiconinline
+
+ Displays a course module icon.
+
+ Example context (json):
+ {
+ "icon": "../../../pix/help.svg",
+ "iconclass": "",
+ "purpose": "content",
+ "modname": "resource",
+ "pluginname": "File",
+ "showtooltip": 1
+ }
+}}
+
+
+
diff --git a/templates/courseformat/content/cm/cmnameinline.mustache b/templates/courseformat/content/cm/cmnameinline.mustache
index 5deb1c3..3361ccd 100644
--- a/templates/courseformat/content/cm/cmnameinline.mustache
+++ b/templates/courseformat/content/cm/cmnameinline.mustache
@@ -15,7 +15,7 @@
along with Moodle. If not, see .
}}
{{!
- @template format_onetopic/courseformat/content/cm/cmname
+ @template format_onetopic/courseformat/content/cm/cmnameinline
Convenience mustache to displays a course module inplcae editable from the format renderer.
@@ -46,9 +46,12 @@
{{#url}}
{{^hideicons}}
-
-
-
+ {{! Icon }}
+ {{#activityicon}}
+ {{$ format_onetopic/courseformat/content/cm/cmiconinline }}
+ {{> format_onetopic/courseformat/content/cm/cmiconinline }}
+ {{/ format_onetopic/courseformat/content/cm/cmiconinline }}
+ {{/activityicon}}
{{/hideicons}}
{{#activityname}}
From 62a88a5118ff01b436c53def6dee7884aef7450e Mon Sep 17 00:00:00 2001
From: David Herney
Date: Sat, 20 Jul 2024 14:56:14 -0500
Subject: [PATCH 47/50] 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;
From 15af18fbfcf239a5f270d8c3dd2c45c93b2d47a1 Mon Sep 17 00:00:00 2001
From: David Herney
Date: Sat, 20 Jul 2024 15:05:50 -0500
Subject: [PATCH 48/50] Code style
---
classes/output/courseformat/content/section/summary.php | 2 +-
classes/privacy/provider.php | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/classes/output/courseformat/content/section/summary.php b/classes/output/courseformat/content/section/summary.php
index ad1fb79..9a879fc 100644
--- a/classes/output/courseformat/content/section/summary.php
+++ b/classes/output/courseformat/content/section/summary.php
@@ -51,7 +51,7 @@ class summary extends summary_base {
/** @var section_info the course section class */
private $section;
- /** @var renderer_base the renderer output class */
+ /** @var \renderer_base the renderer output class */
private $output;
/** @var string Text to search */
diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php
index 7ced1dd..a2d7eb5 100644
--- a/classes/privacy/provider.php
+++ b/classes/privacy/provider.php
@@ -13,6 +13,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Privacy Subsystem implementation for format_onetopic.
*
From 77e6d39d9eedd1451d50d2190378f5ed8aeef9db Mon Sep 17 00:00:00 2001
From: David Herney
Date: Sat, 20 Jul 2024 17:44:57 -0500
Subject: [PATCH 49/50] Include activity badges in summary template
---
amd/build/main.min.js | 2 +-
amd/build/main.min.js.map | 2 +-
amd/src/main.js | 9 +-
classes/header.php | 2 +-
.../courseformat/content/section/summary.php | 20 +++-
styles.css | 22 ++++-
.../content/cm/activity_infoinline.mustache | 66 -------------
.../content/cm/activityinline.mustache | 56 ++---------
.../content/cm/cmhelpinfo.mustache | 95 +++++++++++++++++++
version.php | 4 +-
10 files changed, 146 insertions(+), 132 deletions(-)
delete mode 100644 templates/courseformat/content/cm/activity_infoinline.mustache
create mode 100644 templates/courseformat/content/cm/cmhelpinfo.mustache
diff --git a/amd/build/main.min.js b/amd/build/main.min.js
index a26cdf8..d7ffca9 100644
--- a/amd/build/main.min.js
+++ b/amd/build/main.min.js
@@ -3,6 +3,6 @@ define("format_onetopic/main",["exports","format_onetopic/oneline","jquery","cor
* @package format_onetopic
* @copyright 2021 David Herney Bernal - cirano
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */(OneLine),_jquery=_interopRequireDefault(_jquery),_modal_factory=_interopRequireDefault(_modal_factory);_exports.init=(formattype,icons)=>{2==formattype&&OneLine.load(icons);var infotitle=(0,_str.get_string)("aboutresource","format_onetopic");(0,_jquery.default)(".format-onetopic .onetopic .iconwithhelp").each((function(){var $node=(0,_jquery.default)(this);$node.on("click",(function(e){e.preventDefault();var $content=$node.find(".iconwithhelp-content");if($content.data("modal"))$content.data("modal").show();else{var title=$content.data("title");title||(title=infotitle),_modal_factory.default.create({title:title,body:""}).done((function(modal){var contenthtml=$content.html();contenthtml=contenthtml.replace(//g,(function(match,p1){return p1})),modal.getBody().append(contenthtml),modal.show(),$content.data("modal",modal)}))}}))}))}}));
+ */(OneLine),_jquery=_interopRequireDefault(_jquery),_modal_factory=_interopRequireDefault(_modal_factory);_exports.init=(formattype,icons)=>{2==formattype&&OneLine.load(icons);var infotitle=(0,_str.get_string)("aboutresource","format_onetopic");(0,_jquery.default)(".format-onetopic .onetopic .iconwithhelp[data-helpwindow]").each((function(){var $node=(0,_jquery.default)(this);$node.on("click",(function(e){e.preventDefault();var $content=(0,_jquery.default)("#hw-"+$node.data("helpwindow"));if($content.data("modal"))$content.data("modal").show();else{var title=$content.data("title");title||(title=infotitle),_modal_factory.default.create({title:title,body:""}).done((function(modal){var contenthtml=$content.html();contenthtml=contenthtml.replace(//g,(function(match,p1){return p1}));var $modalBody=modal.getBody();$modalBody.css("min-height","150px"),$modalBody.append(contenthtml),modal.show(),$content.data("modal",modal)}))}}))}))}}));
//# sourceMappingURL=main.min.js.map
\ No newline at end of file
diff --git a/amd/build/main.min.js.map b/amd/build/main.min.js.map
index c4b7d8f..32e27f9 100644
--- a/amd/build/main.min.js.map
+++ b/amd/build/main.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"main.min.js","sources":["../src/main.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/*\n * @package format_onetopic\n * @copyright 2021 David Herney Bernal - cirano\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport * as OneLine from 'format_onetopic/oneline';\nimport $ from 'jquery';\nimport ModalFactory from 'core/modal_factory';\nimport {get_string as getString} from 'core/str';\n\n/**\n * Component initialization.\n *\n * @method init\n * @param {string} formattype The course format type: 0: default, 1: vertical, 2: oneline.\n * @param {object} icons A list of usable icons: left arrow, right arrow.\n */\nexport const init = (formattype, icons) => {\n\n if (formattype == 2) {\n OneLine.load(icons);\n }\n\n var infotitle = getString('aboutresource', 'format_onetopic');\n\n $('.format-onetopic .onetopic .iconwithhelp').each(function() {\n var $node = $(this);\n $node.on('click', function(e) {\n e.preventDefault();\n var $content = $node.find('.iconwithhelp-content');\n\n if ($content.data('modal')) {\n $content.data('modal').show();\n return;\n }\n\n var title = $content.data('title');\n\n if (!title) {\n title = infotitle;\n }\n\n // Show the content in a modal window.\n ModalFactory.create({\n 'title': title,\n 'body': ''\n }).done(function(modal) {\n\n var contenthtml = $content.html();\n\n // Uncomment html in contenthtml. The comment is used in order to load content with tags not inline.\n contenthtml = contenthtml.replace(//g, function(match, p1) {\n return p1;\n });\n\n var $modalBody = modal.getBody();\n $modalBody.append(contenthtml);\n modal.show();\n $content.data('modal', modal);\n });\n });\n });\n\n};"],"names":["formattype","icons","OneLine","load","infotitle","each","$node","this","on","e","preventDefault","$content","find","data","show","title","create","done","modal","contenthtml","html","replace","match","p1","getBody","append"],"mappings":";;;;;2HAgCoB,CAACA,WAAYC,SAEX,GAAdD,YACAE,QAAQC,KAAKF,WAGbG,WAAY,mBAAU,gBAAiB,uCAEzC,4CAA4CC,MAAK,eAC3CC,OAAQ,mBAAEC,MACdD,MAAME,GAAG,SAAS,SAASC,GACvBA,EAAEC,qBACEC,SAAWL,MAAMM,KAAK,4BAEtBD,SAASE,KAAK,SACdF,SAASE,KAAK,SAASC,gBAIvBC,MAAQJ,SAASE,KAAK,SAErBE,QACDA,MAAQX,kCAICY,OAAO,OACPD,WACD,KACTE,MAAK,SAASC,WAETC,YAAcR,SAASS,OAG3BD,YAAcA,YAAYE,QAAQ,sBAAsB,SAASC,MAAOC,WAC7DA,MAGML,MAAMM,UACZC,OAAON,aAClBD,MAAMJ,OACNH,SAASE,KAAK,QAASK"}
\ No newline at end of file
+{"version":3,"file":"main.min.js","sources":["../src/main.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/*\n * @package format_onetopic\n * @copyright 2021 David Herney Bernal - cirano\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport * as OneLine from 'format_onetopic/oneline';\nimport $ from 'jquery';\nimport ModalFactory from 'core/modal_factory';\nimport {get_string as getString} from 'core/str';\n\n/**\n * Component initialization.\n *\n * @method init\n * @param {string} formattype The course format type: 0: default, 1: vertical, 2: oneline.\n * @param {object} icons A list of usable icons: left arrow, right arrow.\n */\nexport const init = (formattype, icons) => {\n\n if (formattype == 2) {\n OneLine.load(icons);\n }\n\n var infotitle = getString('aboutresource', 'format_onetopic');\n\n $('.format-onetopic .onetopic .iconwithhelp[data-helpwindow]').each(function() {\n var $node = $(this);\n $node.on('click', function(e) {\n e.preventDefault();\n var $content = $('#hw-' + $node.data('helpwindow'));\n\n if ($content.data('modal')) {\n $content.data('modal').show();\n return;\n }\n\n var title = $content.data('title');\n\n if (!title) {\n title = infotitle;\n }\n\n // Show the content in a modal window.\n ModalFactory.create({\n 'title': title,\n 'body': '',\n }).done(function(modal) {\n\n var contenthtml = $content.html();\n\n // Uncomment html in contenthtml. The comment is used in order to load content with tags not inline.\n contenthtml = contenthtml.replace(//g, function(match, p1) {\n return p1;\n });\n\n var $modalBody = modal.getBody();\n $modalBody.css('min-height', '150px');\n $modalBody.append(contenthtml);\n modal.show();\n $content.data('modal', modal);\n });\n });\n });\n\n};\n"],"names":["_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","OneLine","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_interopRequireWildcard","_jquery","_modal_factory","_exports","init","formattype","icons","load","infotitle","getString","$","each","$node","this","on","e","preventDefault","$content","data","show","title","ModalFactory","create","body","done","modal","contenthtml","html","replace","match","p1","$modalBody","getBody","css","append"],"mappings":"qKAsB8C,SAAAA,uBAAAC,YAAAA,KAAAA,IAAAC,WAAAD,KAAAE,QAAAF,KAAA,SAAAG,yBAAAC,mCAAAC,wBAAAC,sBAAAD,QAAAE,qBAAAF,eAAAF,kCAAAC,oBAAAA,YAAAG,iBAAAD,oBAAAF,0FAF9CI,QAE8C,SAAAR,IAAAI,iBAAAA,aAAAJ,KAAAA,IAAAC,kBAAAD,cAAAA,sBAAAA,wBAAAA,WAAAE,QAAAF,SAAAS,MAAAN,yBAAAC,gBAAAK,OAAAA,MAAAC,IAAAV,YAAAS,MAAAE,IAAAX,SAAAY,UAAAC,sBAAAC,OAAAC,gBAAAD,OAAAE,iCAAAC,OAAAjB,mBAAAiB,KAAAH,OAAAI,UAAAC,eAAAC,KAAApB,IAAAiB,UAAAI,KAAAR,sBAAAC,OAAAE,yBAAAhB,IAAAiB,UAAAI,OAAAA,KAAAV,KAAAU,KAAAC,KAAAR,OAAAC,eAAAH,OAAAK,IAAAI,MAAAT,OAAAK,KAAAjB,IAAAiB,KAAAL,OAAAV,QAAAF,IAAAS,OAAAA,MAAAa,IAAAtB,IAAAY,eAAAA;;;;;KAF9CW,CAAAf,SACAgB,QAAAzB,uBAAAyB,SACAC,eAAA1B,uBAAA0B,gBAyDEC,SAAAC,KA/CkBA,CAACC,WAAYC,SAEX,GAAdD,YACApB,QAAQsB,KAAKD,OAGjB,IAAIE,WAAY,EAAAC,iBAAU,gBAAiB,oBAE3C,EAAAC,iBAAE,6DAA6DC,MAAK,WAChE,IAAIC,OAAQ,EAAAF,iBAAEG,MACdD,MAAME,GAAG,SAAS,SAASC,GACvBA,EAAEC,iBACF,IAAIC,UAAW,EAAAP,iBAAE,OAASE,MAAMM,KAAK,eAErC,GAAID,SAASC,KAAK,SACdD,SAASC,KAAK,SAASC,WAD3B,CAKA,IAAIC,MAAQH,SAASC,KAAK,SAErBE,QACDA,MAAQZ,WAIZa,uBAAaC,OAAO,CAChBF,MAASA,MACTG,KAAQ,KACTC,MAAK,SAASC,OAEb,IAAIC,YAAcT,SAASU,OAG3BD,YAAcA,YAAYE,QAAQ,sBAAsB,SAASC,MAAOC,IACpE,OAAOA,MAGX,IAAIC,WAAaN,MAAMO,UACvBD,WAAWE,IAAI,aAAc,SAC7BF,WAAWG,OAAOR,aAClBD,MAAMN,OACNF,SAASC,KAAK,QAASO,gBAGjC,CAEJ"}
\ No newline at end of file
diff --git a/amd/src/main.js b/amd/src/main.js
index cbfa15e..7c5ed3f 100644
--- a/amd/src/main.js
+++ b/amd/src/main.js
@@ -38,11 +38,11 @@ export const init = (formattype, icons) => {
var infotitle = getString('aboutresource', 'format_onetopic');
- $('.format-onetopic .onetopic .iconwithhelp').each(function() {
+ $('.format-onetopic .onetopic .iconwithhelp[data-helpwindow]').each(function() {
var $node = $(this);
$node.on('click', function(e) {
e.preventDefault();
- var $content = $node.find('.iconwithhelp-content');
+ var $content = $('#hw-' + $node.data('helpwindow'));
if ($content.data('modal')) {
$content.data('modal').show();
@@ -58,7 +58,7 @@ export const init = (formattype, icons) => {
// Show the content in a modal window.
ModalFactory.create({
'title': title,
- 'body': ''
+ 'body': '',
}).done(function(modal) {
var contenthtml = $content.html();
@@ -69,6 +69,7 @@ export const init = (formattype, icons) => {
});
var $modalBody = modal.getBody();
+ $modalBody.css('min-height', '150px');
$modalBody.append(contenthtml);
modal.show();
$content.data('modal', modal);
@@ -76,4 +77,4 @@ export const init = (formattype, icons) => {
});
});
-};
\ No newline at end of file
+};
diff --git a/classes/header.php b/classes/header.php
index 9436de0..903b6de 100644
--- a/classes/header.php
+++ b/classes/header.php
@@ -299,7 +299,7 @@ private function get_tabs(course_modinfo $modinfo, \renderer_base $output): \for
} while ($parentformatoptions['level'] == 1 && $prevsectionindex >= $firstsection);
if ($parentformatoptions['firsttabtext']) {
- $indextab->content = format_text($parentformatoptions['firsttabtext'], true, $course->id);
+ $indextab->content = format_string($parentformatoptions['firsttabtext'], true, $course->id);
} else {
$indextab->content = get_string('index', 'format_onetopic');
}
diff --git a/classes/output/courseformat/content/section/summary.php b/classes/output/courseformat/content/section/summary.php
index 9a879fc..e77d21a 100644
--- a/classes/output/courseformat/content/section/summary.php
+++ b/classes/output/courseformat/content/section/summary.php
@@ -25,12 +25,10 @@
namespace format_onetopic\output\courseformat\content\section;
use context_course;
-use core\output\named_templatable;
use core_courseformat\base as course_format;
use core_courseformat\output\local\courseformat_named_templatable;
use core_courseformat\output\local\content\cm as cm_base;
use core_courseformat\output\local\content\section\summary as summary_base;
-use renderable;
use section_info;
use stdClass;
@@ -103,11 +101,12 @@ public function format_summary_text(): string {
$course = $this->format->get_course();
$context = context_course::instance($section->course);
+ $summarytext = $section->summary;
if ($course->templatetopic != \format_onetopic::TEMPLATETOPIC_NOT) {
- $section->summary = $this->replace_resources($section);
+ $summarytext = $this->replace_resources($section);
}
- $summarytext = file_rewrite_pluginfile_urls($section->summary, 'pluginfile.php',
+ $summarytext = file_rewrite_pluginfile_urls($summarytext, 'pluginfile.php',
$context->id, 'course', 'section', $section->id);
$options = new stdClass();
@@ -186,7 +185,16 @@ private function replace_resources(section_info $section) {
$cmdata->singlename = $instancename;
// ToDo: Implement additional activity information. Now it's called "activity badge".
+ $cmdata->hascompletion = isset($cmdata->completion) && $cmdata->completion;
+
+ $hasavailability = isset($cmdata->modavailability) ? $cmdata->modavailability->hasmodavailability : false;
+
$cmdata->showinlinehelp = false;
+ if ($cmdata->hascompletion
+ || (isset($cmdata->hasdates) && $cmdata->hasdates)
+ || $hasavailability){
+ $cmdata->showinlinehelp = true;
+ }
$url = $mod->url;
if (empty($url)) {
@@ -233,6 +241,10 @@ private function replace_resources(section_info $section) {
$this->format->tplcmsused[] = $modnumber;
}
+ if ($cmdata->showinlinehelp) {
+ $newsummary .= $renderer->render_from_template('format_onetopic/courseformat/content/cm/cmhelpinfo', $cmdata);
+ }
+
$summary = $newsummary;
}
diff --git a/styles.css b/styles.css
index 11c29b4..a31b1ed 100644
--- a/styles.css
+++ b/styles.css
@@ -176,9 +176,9 @@
/* Template styles */
.format-onetopic .onetopic .cmnameinline .activityiconcontainer {
- width: auto;
- height: auto;
- padding: 0.2rem;
+ padding-left: 0.2rem;
+ padding-right: 0;
+ display: inline;
}
.format-onetopic .activityinsummarytpl .description .course-description-item {
@@ -200,6 +200,22 @@
display: block;
}
+.format-onetopic .modal-body .activity-info .completion-dropdown a[role="button"].btn,
+.format-onetopic .modal-body .activity-info .completion-dropdown button.btn {
+ color: #1d2125;
+ background-color: #fff;
+ border-color: #ced4da;
+ min-height: 32px;
+ font-weight: bold;
+ border-radius: 0.5rem;
+}
+
+.format-onetopic .modal-body .activity-info .completion-dropdown a[role="button"].btn:hover,
+.format-onetopic .modal-body .activity-info .completion-dropdown button.btn:hover {
+ color: #fff;
+ background-color: #6a737b;
+ border-color: #b1bbc4;
+}
/* End of template styles */
/* Completion */
diff --git a/templates/courseformat/content/cm/activity_infoinline.mustache b/templates/courseformat/content/cm/activity_infoinline.mustache
deleted file mode 100644
index af2e45e..0000000
--- a/templates/courseformat/content/cm/activity_infoinline.mustache
+++ /dev/null
@@ -1,66 +0,0 @@
-{{!
- This file is part of Moodle - http://moodle.org/
-
- Moodle is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Moodle is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Moodle. If not, see .
-}}
-{{!
- @template format_onetopic/courseformat/content/cm/activity_infoinline
-
- Container to display activity information on the course page such as:
- - Activity completion requirements (automatic completion)
- - Manual completion button
-
- Example context (json):
- {
- "activityname": "Course announcements",
- "hascompletion": true,
- "uservisible": false,
- "isautomatic": true,
- "showmanualcompletion": true,
- "completiondetails": [
- {
- "statuscomplete": 1,
- "description": "Viewed"
- },
- {
- "statusincomplete": 1,
- "description": "Receive a grade"
- }
- ]
- }
-}}
-
- {{#hascompletion}}
- {{#uservisible}}
-
- {{#isautomatic}}
-
- {{#completiondetails}}
- {{$ core_course/completion_automatic }}
- {{> core_course/completion_automatic }}
- {{/ core_course/completion_automatic }}
- {{/completiondetails}}
-
- {{/isautomatic}}
- {{^isautomatic}}
- {{#showmanualcompletion}}
- {{$ core_course/completion_manual }}
- {{> core_course/completion_manual }}
- {{/ core_course/completion_manual }}
- {{/showmanualcompletion}}
- {{/isautomatic}}
-
- {{/uservisible}}
- {{/hascompletion}}
-
diff --git a/templates/courseformat/content/cm/activityinline.mustache b/templates/courseformat/content/cm/activityinline.mustache
index b7c7fa7..b107fd5 100644
--- a/templates/courseformat/content/cm/activityinline.mustache
+++ b/templates/courseformat/content/cm/activityinline.mustache
@@ -69,55 +69,11 @@
{{/afterlink}}
{{#showinlinehelp}}
- {{#activityinfo}}
- {{! Only show the icon if there is a name to display. }}
- {{#hasname}}
-
- {{#pix}} e/help, core, {{#str}} info {{/str}} {{/pix}}
-
-
- {{$ format_onetopic/courseformat/content/cm/badgesinline }}
- {{> format_onetopic/courseformat/content/cm/badgesinline }}
- {{/ format_onetopic/courseformat/content/cm/badgesinline }}
-
- {{#hascompletion}}
- {{#showcompletionconditions}}
-
- {{> format_onetopic/courseformat/content/cm/activity_infoinline}}
-
- {{/showcompletionconditions}}
- {{/hascompletion}}
-
-
- {{#hasdates}}
-
-
- {{#activitydates}}
- {{$format_onetopic/local/activity_dateinline}}
- {{>format_onetopic/local/activity_dateinline}}
- {{/format_onetopic/local/activity_dateinline}}
- {{/activitydates}}
-
-
- {{/hasdates}}
-
- {{#altcontent}}
-
-
-
-
-
- {{/altcontent}}
- {{#modavailability}}
- {{$ format_onetopic/courseformat/content/cm/availabilityinline }}
- {{> format_onetopic/courseformat/content/cm/availabilityinline }}
- {{/ format_onetopic/courseformat/content/cm/availabilityinline }}
- {{/modavailability}}
-
-
-
-
- {{/hasname}}
- {{/activityinfo}}
+ {{! Only show the icon if there is a name to display. }}
+ {{#hasname}}
+
+ {{#pix}} e/help, core, {{#str}} info {{/str}} {{/pix}}
+
+ {{/hasname}}
{{/showinlinehelp}}
diff --git a/templates/courseformat/content/cm/cmhelpinfo.mustache b/templates/courseformat/content/cm/cmhelpinfo.mustache
new file mode 100644
index 0000000..9589a79
--- /dev/null
+++ b/templates/courseformat/content/cm/cmhelpinfo.mustache
@@ -0,0 +1,95 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template format_onetopic/courseformat/content/cm/cmhelpinfo
+
+ Mustache to displays the help information for a course module instance.
+
+ Example context (json):
+ {
+ "url": "#",
+ "icon": "../../../pix/help.svg",
+ "pluginname": "File",
+ "textclasses": "",
+ "purpose": "content",
+ "modname": "resource",
+ "activityname": {
+ "displayvalue" : "Moodle",
+ "value" : "Moodle",
+ "itemid" : "1",
+ "component" : "core_unknown",
+ "itemtype" : "unknown",
+ "edithint" : "Edit this",
+ "editlabel" : "New name for this",
+ "type" : "text",
+ "options" : "",
+ "linkeverything": 0
+ }
+ }
+}}
+
+{{! Only show the icon if there is a name to display. }}
+{{#hasname}}
+
+
+ {{$ format_onetopic/courseformat/content/cm/badgesinline }}
+ {{> format_onetopic/courseformat/content/cm/badgesinline }}
+ {{/ format_onetopic/courseformat/content/cm/badgesinline }}
+
+ {{! Completion }}
+ {{#completion}}
+ {{#hascompletion}}
+ {{#showcompletionconditions}}
+
+ {{$ core_courseformat/local/content/cm/activity_info}}
+ {{> core_courseformat/local/content/cm/activity_info}}
+ {{/ core_courseformat/local/content/cm/activity_info}}
+
+ {{/showcompletionconditions}}
+ {{/hascompletion}}
+ {{/completion}}
+
+
+ {{#hasdates}}
+
+
+ {{#activitydates}}
+ {{$format_onetopic/local/activity_dateinline}}
+ {{>format_onetopic/local/activity_dateinline}}
+ {{/format_onetopic/local/activity_dateinline}}
+ {{/activitydates}}
+
+
+ {{/hasdates}}
+
+ {{#altcontent}}
+
+ {{/altcontent}}
+
+ {{! Availability }}
+ {{#modavailability}}
+ {{$ core_courseformat/local/content/cm/availability }}
+ {{> core_courseformat/local/content/cm/availability }}
+ {{/ core_courseformat/local/content/cm/availability }}
+ {{/modavailability}}
+
+
+{{/hasname}}
diff --git a/version.php b/version.php
index 8e2a808..038d904 100644
--- a/version.php
+++ b/version.php
@@ -33,9 +33,9 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2024050901.01; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2024050902; // 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;
-$plugin->release = '4.4.01(LasAcacias)';
+$plugin->release = '4.4.02(LasAcacias)';
$plugin->dependencies = ['format_topics' => 2024042200];
From 9ef67acb01841edc0f63a4712f14135b1b70d7fb Mon Sep 17 00:00:00 2001
From: David Herney
Date: Sat, 20 Jul 2024 18:58:25 -0500
Subject: [PATCH 50/50] Include activity badges in summary template
---
amd/build/main.min.js.map | 2 +-
amd/src/main.js | 1 -
classes/output/courseformat/content/section/summary.php | 3 +--
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/amd/build/main.min.js.map b/amd/build/main.min.js.map
index 32e27f9..f07379d 100644
--- a/amd/build/main.min.js.map
+++ b/amd/build/main.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"main.min.js","sources":["../src/main.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/*\n * @package format_onetopic\n * @copyright 2021 David Herney Bernal - cirano\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport * as OneLine from 'format_onetopic/oneline';\nimport $ from 'jquery';\nimport ModalFactory from 'core/modal_factory';\nimport {get_string as getString} from 'core/str';\n\n/**\n * Component initialization.\n *\n * @method init\n * @param {string} formattype The course format type: 0: default, 1: vertical, 2: oneline.\n * @param {object} icons A list of usable icons: left arrow, right arrow.\n */\nexport const init = (formattype, icons) => {\n\n if (formattype == 2) {\n OneLine.load(icons);\n }\n\n var infotitle = getString('aboutresource', 'format_onetopic');\n\n $('.format-onetopic .onetopic .iconwithhelp[data-helpwindow]').each(function() {\n var $node = $(this);\n $node.on('click', function(e) {\n e.preventDefault();\n var $content = $('#hw-' + $node.data('helpwindow'));\n\n if ($content.data('modal')) {\n $content.data('modal').show();\n return;\n }\n\n var title = $content.data('title');\n\n if (!title) {\n title = infotitle;\n }\n\n // Show the content in a modal window.\n ModalFactory.create({\n 'title': title,\n 'body': '',\n }).done(function(modal) {\n\n var contenthtml = $content.html();\n\n // Uncomment html in contenthtml. The comment is used in order to load content with tags not inline.\n contenthtml = contenthtml.replace(//g, function(match, p1) {\n return p1;\n });\n\n var $modalBody = modal.getBody();\n $modalBody.css('min-height', '150px');\n $modalBody.append(contenthtml);\n modal.show();\n $content.data('modal', modal);\n });\n });\n });\n\n};\n"],"names":["_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","OneLine","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_interopRequireWildcard","_jquery","_modal_factory","_exports","init","formattype","icons","load","infotitle","getString","$","each","$node","this","on","e","preventDefault","$content","data","show","title","ModalFactory","create","body","done","modal","contenthtml","html","replace","match","p1","$modalBody","getBody","css","append"],"mappings":"qKAsB8C,SAAAA,uBAAAC,YAAAA,KAAAA,IAAAC,WAAAD,KAAAE,QAAAF,KAAA,SAAAG,yBAAAC,mCAAAC,wBAAAC,sBAAAD,QAAAE,qBAAAF,eAAAF,kCAAAC,oBAAAA,YAAAG,iBAAAD,oBAAAF,0FAF9CI,QAE8C,SAAAR,IAAAI,iBAAAA,aAAAJ,KAAAA,IAAAC,kBAAAD,cAAAA,sBAAAA,wBAAAA,WAAAE,QAAAF,SAAAS,MAAAN,yBAAAC,gBAAAK,OAAAA,MAAAC,IAAAV,YAAAS,MAAAE,IAAAX,SAAAY,UAAAC,sBAAAC,OAAAC,gBAAAD,OAAAE,iCAAAC,OAAAjB,mBAAAiB,KAAAH,OAAAI,UAAAC,eAAAC,KAAApB,IAAAiB,UAAAI,KAAAR,sBAAAC,OAAAE,yBAAAhB,IAAAiB,UAAAI,OAAAA,KAAAV,KAAAU,KAAAC,KAAAR,OAAAC,eAAAH,OAAAK,IAAAI,MAAAT,OAAAK,KAAAjB,IAAAiB,KAAAL,OAAAV,QAAAF,IAAAS,OAAAA,MAAAa,IAAAtB,IAAAY,eAAAA;;;;;KAF9CW,CAAAf,SACAgB,QAAAzB,uBAAAyB,SACAC,eAAA1B,uBAAA0B,gBAyDEC,SAAAC,KA/CkBA,CAACC,WAAYC,SAEX,GAAdD,YACApB,QAAQsB,KAAKD,OAGjB,IAAIE,WAAY,EAAAC,iBAAU,gBAAiB,oBAE3C,EAAAC,iBAAE,6DAA6DC,MAAK,WAChE,IAAIC,OAAQ,EAAAF,iBAAEG,MACdD,MAAME,GAAG,SAAS,SAASC,GACvBA,EAAEC,iBACF,IAAIC,UAAW,EAAAP,iBAAE,OAASE,MAAMM,KAAK,eAErC,GAAID,SAASC,KAAK,SACdD,SAASC,KAAK,SAASC,WAD3B,CAKA,IAAIC,MAAQH,SAASC,KAAK,SAErBE,QACDA,MAAQZ,WAIZa,uBAAaC,OAAO,CAChBF,MAASA,MACTG,KAAQ,KACTC,MAAK,SAASC,OAEb,IAAIC,YAAcT,SAASU,OAG3BD,YAAcA,YAAYE,QAAQ,sBAAsB,SAASC,MAAOC,IACpE,OAAOA,MAGX,IAAIC,WAAaN,MAAMO,UACvBD,WAAWE,IAAI,aAAc,SAC7BF,WAAWG,OAAOR,aAClBD,MAAMN,OACNF,SAASC,KAAK,QAASO,gBAGjC,CAEJ"}
\ No newline at end of file
+{"version":3,"file":"main.min.js","sources":["../src/main.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/*\n * @package format_onetopic\n * @copyright 2021 David Herney Bernal - cirano\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport * as OneLine from 'format_onetopic/oneline';\nimport $ from 'jquery';\nimport ModalFactory from 'core/modal_factory';\nimport {get_string as getString} from 'core/str';\n\n/**\n * Component initialization.\n *\n * @method init\n * @param {string} formattype The course format type: 0: default, 1: vertical, 2: oneline.\n * @param {object} icons A list of usable icons: left arrow, right arrow.\n */\nexport const init = (formattype, icons) => {\n\n if (formattype == 2) {\n OneLine.load(icons);\n }\n\n var infotitle = getString('aboutresource', 'format_onetopic');\n\n $('.format-onetopic .onetopic .iconwithhelp[data-helpwindow]').each(function() {\n var $node = $(this);\n $node.on('click', function(e) {\n e.preventDefault();\n var $content = $('#hw-' + $node.data('helpwindow'));\n\n if ($content.data('modal')) {\n $content.data('modal').show();\n return;\n }\n\n var title = $content.data('title');\n\n if (!title) {\n title = infotitle;\n }\n\n // Show the content in a modal window.\n ModalFactory.create({\n 'title': title,\n 'body': '',\n }).done(function(modal) {\n\n var contenthtml = $content.html();\n\n // Uncomment html in contenthtml. The comment is used in order to load content with tags not inline.\n contenthtml = contenthtml.replace(//g, function(match, p1) {\n return p1;\n });\n\n var $modalBody = modal.getBody();\n $modalBody.css('min-height', '150px');\n $modalBody.append(contenthtml);\n modal.show();\n $content.data('modal', modal);\n });\n });\n });\n};\n"],"names":["_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","OneLine","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_interopRequireWildcard","_jquery","_modal_factory","_exports","init","formattype","icons","load","infotitle","getString","$","each","$node","this","on","e","preventDefault","$content","data","show","title","ModalFactory","create","body","done","modal","contenthtml","html","replace","match","p1","$modalBody","getBody","css","append"],"mappings":"qKAsB8C,SAAAA,uBAAAC,YAAAA,KAAAA,IAAAC,WAAAD,KAAAE,QAAAF,KAAA,SAAAG,yBAAAC,mCAAAC,wBAAAC,sBAAAD,QAAAE,qBAAAF,eAAAF,kCAAAC,oBAAAA,YAAAG,iBAAAD,oBAAAF,0FAF9CI,QAE8C,SAAAR,IAAAI,iBAAAA,aAAAJ,KAAAA,IAAAC,kBAAAD,cAAAA,sBAAAA,wBAAAA,WAAAE,QAAAF,SAAAS,MAAAN,yBAAAC,gBAAAK,OAAAA,MAAAC,IAAAV,YAAAS,MAAAE,IAAAX,SAAAY,UAAAC,sBAAAC,OAAAC,gBAAAD,OAAAE,iCAAAC,OAAAjB,mBAAAiB,KAAAH,OAAAI,UAAAC,eAAAC,KAAApB,IAAAiB,UAAAI,KAAAR,sBAAAC,OAAAE,yBAAAhB,IAAAiB,UAAAI,OAAAA,KAAAV,KAAAU,KAAAC,KAAAR,OAAAC,eAAAH,OAAAK,IAAAI,MAAAT,OAAAK,KAAAjB,IAAAiB,KAAAL,OAAAV,QAAAF,IAAAS,OAAAA,MAAAa,IAAAtB,IAAAY,eAAAA;;;;;KAF9CW,CAAAf,SACAgB,QAAAzB,uBAAAyB,SACAC,eAAA1B,uBAAA0B,gBAwDEC,SAAAC,KA9CkBA,CAACC,WAAYC,SAEX,GAAdD,YACApB,QAAQsB,KAAKD,OAGjB,IAAIE,WAAY,EAAAC,iBAAU,gBAAiB,oBAE3C,EAAAC,iBAAE,6DAA6DC,MAAK,WAChE,IAAIC,OAAQ,EAAAF,iBAAEG,MACdD,MAAME,GAAG,SAAS,SAASC,GACvBA,EAAEC,iBACF,IAAIC,UAAW,EAAAP,iBAAE,OAASE,MAAMM,KAAK,eAErC,GAAID,SAASC,KAAK,SACdD,SAASC,KAAK,SAASC,WAD3B,CAKA,IAAIC,MAAQH,SAASC,KAAK,SAErBE,QACDA,MAAQZ,WAIZa,uBAAaC,OAAO,CAChBF,MAASA,MACTG,KAAQ,KACTC,MAAK,SAASC,OAEb,IAAIC,YAAcT,SAASU,OAG3BD,YAAcA,YAAYE,QAAQ,sBAAsB,SAASC,MAAOC,IACpE,OAAOA,MAGX,IAAIC,WAAaN,MAAMO,UACvBD,WAAWE,IAAI,aAAc,SAC7BF,WAAWG,OAAOR,aAClBD,MAAMN,OACNF,SAASC,KAAK,QAASO,gBAGjC,CACJ"}
\ No newline at end of file
diff --git a/amd/src/main.js b/amd/src/main.js
index 7c5ed3f..936a917 100644
--- a/amd/src/main.js
+++ b/amd/src/main.js
@@ -76,5 +76,4 @@ export const init = (formattype, icons) => {
});
});
});
-
};
diff --git a/classes/output/courseformat/content/section/summary.php b/classes/output/courseformat/content/section/summary.php
index e77d21a..0facddb 100644
--- a/classes/output/courseformat/content/section/summary.php
+++ b/classes/output/courseformat/content/section/summary.php
@@ -184,7 +184,6 @@ private function replace_resources(section_info $section) {
$cmdata->uniqueid = 'cm_' . $mod->id . '_' . time() . '_' . rand(0, 1000);
$cmdata->singlename = $instancename;
- // ToDo: Implement additional activity information. Now it's called "activity badge".
$cmdata->hascompletion = isset($cmdata->completion) && $cmdata->completion;
$hasavailability = isset($cmdata->modavailability) ? $cmdata->modavailability->hasmodavailability : false;
@@ -192,7 +191,7 @@ private function replace_resources(section_info $section) {
$cmdata->showinlinehelp = false;
if ($cmdata->hascompletion
|| (isset($cmdata->hasdates) && $cmdata->hasdates)
- || $hasavailability){
+ || $hasavailability) {
$cmdata->showinlinehelp = true;
}