Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ cache:
- $HOME/.npm

php:
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
env:
matrix:
- DB=mysqli MOODLE_BRANCH=master
- DB=pgsql MOODLE_BRANCH=master
- DB=mysqli MOODLE_BRANCH=MOODLE_39_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_39_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_38_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_38_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_37_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_37_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_36_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_36_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_35_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_35_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_404_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_404_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_403_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_403_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_402_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_402_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_401_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_401_STABLE
- DB=mysqli MOODLE_BRANCH=MOODLE_400_STABLE
- DB=pgsql MOODLE_BRANCH=MOODLE_400_STABLE

before_install:
- phpenv config-rm xdebug.ini
- nvm install 14.2.0
- nvm use 14.2.0
- nvm install 20
- nvm use 20
- cd ../..
- composer create-project -n --no-dev --prefer-dist blackboard-open-source/moodle-plugin-ci ci ^2
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ See [MDL-61198](https://tracker.moodle.org/browse/MDL-61198).
v3.0.0
------
* Add support for Moodle versions 3.3 and higher by complete rewrite using Moodle 3.3 format_weeks as code base
* Add "Hide future week" settings
* Add "Hide future week" settings
69 changes: 32 additions & 37 deletions renderer.php → classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace format_weeksrev\output;

use core_courseformat\output\section_renderer;
use core_courseformat\output\local\content\section;
use core_courseformat\output\local\content\section\cmlist;
use core_courseformat\output\local\content\section\availability;
use core_courseformat\output\local\content\section\summary;
use core_courseformat\output\local\content\addsection;
use html_writer;

defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/course/format/renderer.php');
require_once($CFG->dirroot.'/course/format/weeksrev/classes/output/renderer.php');
require_once($CFG->dirroot.'/course/format/weeksrev/lib.php');


/**
* Basic renderer for weeksrev format.
*
Expand All @@ -38,7 +46,8 @@
* based on code from 2012 Dan Poltawski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class format_weeksrev_renderer extends format_section_renderer_base {
class renderer extends section_renderer {

/**
* Generate the starting container html for a list of sections
* @return string HTML to output.
Expand All @@ -59,7 +68,7 @@ protected function end_section_list() {
* @return string the page title
*/
protected function page_title() {
return get_string('weeklyoutline');
return get_string('weeklyoutline', 'format_weeksrev');
}

/**
Expand Down Expand Up @@ -111,18 +120,14 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
}

$o .= html_writer::start_tag('li', ['id' => 'section-' . $section->section,
'class' => 'section main clearfix' . $sectionstyle, 'role' => 'region',
$sectionstyle, 'role' => 'region',
'aria-label' => get_section_name($course, $section)]);

// Create a span that contains the section title to be used to create the keyboard section move menu.
$o .= html_writer::tag('span', get_section_name($course, $section), ['class' => 'hidden sectionname']);

$leftcontent = $this->section_left_content($section, $course, $onsectionpage);
$o .= html_writer::tag('div', $leftcontent, ['class' => 'left side']);

$rightcontent = $this->section_right_content($section, $course, $onsectionpage);
$o .= html_writer::tag('div', $rightcontent, ['class' => 'right side']);
$o .= html_writer::start_tag('div', ['class' => 'content']);
$sectionoutput = new section($courseformat, $section);
$o .= $this->render($sectionoutput);

// When not on a section page, we display the section titles except the general section if null.
$hasnamenotsecpg = (!$onsectionpage && ($section->section != 0 || !is_null($section->name)));
Expand All @@ -134,13 +139,13 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
if ($hasnamenotsecpg || $hasnamesecpg) {
$classes = '';
}
$sectionname = html_writer::tag('span', $this->section_title($section, $course));
$o .= $this->output->heading($sectionname, 3, 'sectionname' . $classes);

$o .= $this->section_availability($section);
$availability = new availability($courseformat, $section);
$o .= $this->render($availability);

$o .= html_writer::start_tag('div', ['class' => 'summary']);
$o .= $this->format_summary_text($section);
$summary = new summary($courseformat, $section);
$o .= $summary->format_summary_text();
$o .= html_writer::end_tag('div');

return $o;
Expand Down Expand Up @@ -185,11 +190,13 @@ protected function section_summary($section, $course, $mods) {
$o .= $this->output->heading($title, 3, 'section-title');

$o .= html_writer::start_tag('div', ['class' => 'summarytext']);
$o .= $this->format_summary_text($section);
$summary = new summary($courseformat, $section);
$o .= $summary->format_summary_text();
$o .= html_writer::end_tag('div');
$o .= $this->section_activity_summary($section, $course, null);

$o .= $this->section_availability($section);
$availability = new availability($courseformat, $section);
$o .= $this->render($availability);

$o .= html_writer::end_tag('div');
$o .= html_writer::end_tag('li');
Expand All @@ -207,7 +214,7 @@ protected function section_summary($section, $course, $mods) {
* @param int $displaysection The section number in the course which is being displayed
*/
public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection) {
$context = context_course::instance($course->id);
$context = \context_course::instance($course->id);
$canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
if ($course->hidefuture && $canviewhidden) {
echo html_writer::tag('ul',
Expand All @@ -232,19 +239,16 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
$courseformat = course_get_format($course);
$course = $courseformat->get_course();

$context = context_course::instance($course->id);
$context = \context_course::instance($course->id);
// Title with completion help icon.
$completioninfo = new completion_info($course);
echo $completioninfo->display_help_icon();
$completioninfo = new \completion_info($course);
echo $this->output->help_icon('completion', 'completion');
echo $this->output->heading($this->page_title(), 2, 'accesshide');

// Copy activity clipboard..
echo $this->course_activity_clipboard($course, 0);

$canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
if ($course->hidefuture && $canviewhidden) {
echo html_writer::tag('ul',
html_writer::tag('li', get_string('futureweeks', 'format_weeksrev'), ['class' => 'future-legend']),
echo \html_writer::tag('ul',
\html_writer::tag('li', get_string('futureweeks', 'format_weeksrev'), ['class' => 'future-legend']),
['class' => 'weeksrev']
);
}
Expand All @@ -263,9 +267,6 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
// 0-section is displayed a little different then the others.
if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
echo $this->section_header($thissection, $course, false, 0);
echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->courserenderer->course_section_add_cm_control($course, 0, 0);
echo $this->section_footer();
}
continue;
}
Expand Down Expand Up @@ -295,11 +296,6 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
echo $this->section_summary($thissection, $course, null);
} else {
echo $this->section_header($thissection, $course, false, 0);
if ($thissection->uservisible) {
echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->courserenderer->course_section_add_cm_control($course, $section, 0);
}
echo $this->section_footer();
}
}

Expand All @@ -311,13 +307,12 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
continue;
}
echo $this->stealth_section_header($section);
echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->stealth_section_footer();
}

echo $this->end_section_list();

echo $this->change_number_sections($course, 0);
$addsection = new addsection($courseformat);
echo $this->render($addsection);
} else {
echo $this->end_section_list();
}
Expand Down
9 changes: 7 additions & 2 deletions format.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@
}
// End backwards-compatible aliasing..

$format = course_get_format($course);

// Make sure section 0 is created.
$course = course_get_format($course)->get_course();
course_create_sections_if_missing($course, 0);
course_create_sections_if_missing($format->get_course(), 0);

$renderer = $PAGE->get_renderer('format_weeksrev');

if (!is_null($displaysection)) {
$format->set_sectionnum($displaysection);
}

if (!empty($displaysection)) {
$renderer->print_single_section_page($course, null, null, null, null, $displaysection);
} else {
Expand Down
3 changes: 2 additions & 1 deletion lang/en/format_weeksrev.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
$string['showfromothers'] = 'Show week';
$string['automaticenddate'] = 'Calculate the end date from the number of sections';
$string['automaticenddate_help'] = 'If enabled, the end date for the course will be automatically calculated from the number of sections and the course start date.';
$string['privacy:metadata'] = 'The Reverse Weekly format plugin does not store any personal data.';
$string['privacy:metadata'] = 'The Reverse Weekly format plugin does not store any personal data.';
$string['weeklyoutline'] = 'Weekly outline';
Loading