Skip to content

Commit

Permalink
Merge pull request #92 from DigiDago/dev
Browse files Browse the repository at this point in the history
Update for Moodle 4.5
  • Loading branch information
CrymSonir authored Oct 16, 2024
2 parents e9a443e + 629d779 commit 9c1518d
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 205 deletions.
382 changes: 206 additions & 176 deletions block_course_modulenavigation.php

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* Course module navigation block main controller
*
* @package block_course_modulenavigation
* @copyright 2019 Pimenko <contact@pimenko.com> <pimenko.com>
* @author Sylvain Revneu | Jordan Kesraoui | Pimenko
Expand All @@ -28,6 +29,7 @@

/**
* Privacy Subsystem for block_course_modulenavigation implementing null_provider.
*
* @copyright 2019 Pimenko <contact@pimenko.com> <pimenko.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -37,9 +39,10 @@ class provider implements // This plugin does not store any personal user data.
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:null_reason';
}
}
4 changes: 2 additions & 2 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
'manager' => CAP_ALLOW,
],

'clonepermissionsfrom' => 'moodle/site:manageblocks'
'clonepermissionsfrom' => 'moodle/site:manageblocks',
],
];
6 changes: 3 additions & 3 deletions lang/en/block_course_modulenavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
$string['course_modulenavigation:addinstance'] = 'Add a new course contents block';
$string['notusingsections'] = 'This course format does not use sections.';
$string['pluginname'] = 'Course Module Navigation';
$string['privacy:null_reason'] = 'The Blog Course Module Navigation block only shows data stored in other locations';
$string['toggleclickontitle'] = 'Clicking on the title';
$string['toggleclickontitle_desc'] = "'Displays the menu' or 'Goes to that page'.";
$string['toggleclickontitle_menu'] = 'Displays the menu';
$string['toggleclickontitle_page'] = 'Goes to that page';
$string['toggleshowlabels'] = 'Show labels';
$string['toggleshowlabels_desc'] = 'Choose whether to display labels or not';
$string['togglecollapse'] = 'Collapse tabs';
$string['togglecollapse_desc'] = 'Choose whether to display all tabs not collapsed';
$string['toggleshowlabels'] = 'Show labels';
$string['toggleshowlabels_desc'] = 'Choose whether to display labels or not';
$string['toggletitles'] = 'Show only titles';
$string['toggletitles_desc'] = 'Choose whether to display only titles or titles and content';
$string['privacy:null_reason'] = 'The Blog Course Module Navigation block only shows data stored in other locations';
7 changes: 3 additions & 4 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@
class block_course_modulenavigation_nav_renderer extends plugin_renderer_base {

/**
* Renders navigation based on the provided template configuration.
*
* Render HTML template.
* @param object $template The template object containing configuration settings.
*
* @param $template
* @return bool|string
* @throws moodle_exception
* @return string Rendered navigation content based on the template configuration.
*/
public function render_nav($template) {
if (isset($template->config->onesection) && ($template->config->onesection == 1)) {
Expand Down
6 changes: 3 additions & 3 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
$choices = [
1 => new lang_string('no'),
// No.
2 => new lang_string('yes')
2 => new lang_string('yes'),
// Yes.
];
$settings->add(
Expand All @@ -98,7 +98,7 @@
$choices = [
1 => new lang_string('no'),
// No.
2 => new lang_string('yes')
2 => new lang_string('yes'),
// Yes.
];
$settings->add(
Expand All @@ -125,7 +125,7 @@
$choices = [
1 => new lang_string('no'),
// No.
2 => new lang_string('yes')
2 => new lang_string('yes'),
// Yes.
];
$settings->add(
Expand Down
31 changes: 18 additions & 13 deletions templates/coursenav.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,26 @@
<div class="section-body">
<ul class="activities">
{{#modules}}
{{^onlytitles}}
<li>
<a href="{{{url}}}" class="{{active}} {{#label}}modulenavigationlabel{{/label}}" onclick="{{{onclick}}}">
{{#completionon}}
<div class="completionbox">
<div class="completioncheck {{completeclass}}">
{{^issubsection}}
{{^onlytitles}}
<li>
<a href="{{{url}}}" class="{{active}} {{#label}}modulenavigationlabel{{/label}}" onclick="{{{onclick}}}">
{{#completionon}}
<div class="completionbox">
<div class="completioncheck {{completeclass}}">
</div>
</div>
{{/completionon}}
<div class="activityname">
{{{name}}}
</div>
{{/completionon}}
<div class="activityname">
{{{name}}}
</div>
</a>
</li>
{{/onlytitles}}
</a>
</li>
{{/onlytitles}}
{{/issubsection}}
{{#issubsection}}
{{> block_course_modulenavigation/subsection }}
{{/issubsection}}
{{/modules}}
</ul>
</div>
Expand Down
58 changes: 58 additions & 0 deletions templates/subsection.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{#subsection}}
<div class="section section-default p-1">
<div class="module-navigation-section-heading" role="tab" id="heading{{number}}">
<div class="section-title">
<ul class="allpagination">
<li class="allsectionnames">
{{#collapse}}
<a href="{{{url}}}">{{{title}}}</a>
{{/collapse}}
{{^collapse}}
{{#onlytitles}}
<a href="{{{url}}}">{{{title}}}</a>
{{/onlytitles}}
{{^onlytitles}}
<a data-toggle="collapse" data-parent="#accordion" href="#collapse{{number}}"
aria-expanded="true" aria-controls="collapse{{number}}">{{{title}}}</a>
{{/onlytitles}}
{{/collapse}}
</li>
{{#collapse}}
<li class="arrowaccordion">
{{#hasmodules}}
<a class="expand-arrow" role="button" data-toggle="collapse"
data-parent="#accordion" href="#collapse{{number}}" aria-expanded="true"
aria-controls="collapse{{number}}">
</a>
{{/hasmodules}}
</li>
{{/collapse}}
</ul>
</div>
</div>
<div id="collapse{{number}}" class="section-collapse collapse {{#selected}}show{{/selected}}"
role="tabsection" aria-labelledby="heading{{number}}">
<div class="section-body">
<ul class="activities">
{{#modules}}
{{^onlytitles}}
<li>
<a href="{{{url}}}" class="{{active}} {{#label}}modulenavigationlabel{{/label}}" onclick="{{{onclick}}}">
{{#completionon}}
<div class="completionbox">
<div class="completioncheck {{completeclass}}">
</div>
</div>
{{/completionon}}
<div class="activityname">
{{{name}}}
</div>
</a>
</li>
{{/onlytitles}}
{{/modules}}
</ul>
</div>
</div>
</div>
{{/subsection}}
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'block_course_modulenavigation';
$plugin->release = 'v4.6.3';
$plugin->version = 2023101700;
$plugin->requires = 2022041905; // Moodle 4.0.5 and above.
$plugin->release = 'v4.7.1';
$plugin->version = 2024101401; // YYYYMMDD.
$plugin->requires = 2024100100; // Moodle 4.0.5 and above.
$plugin->maturity = MATURITY_STABLE;

0 comments on commit 9c1518d

Please sign in to comment.