Skip to content

Commit

Permalink
V2.9.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jul 20, 2015
1 parent d6ef354 commit 6b67bab
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ Known Issues

History
=============
Version 2.9.1.2.
1. Fixed coding fault when restoring a course from backup file.
2. Attempt self repair if grid image not in the files table.

Version 2.9.1.1.
1. Add the 'space' key as a means of opening / closing the shade box for accessibility.
2. Attempt to set focus on first activity.
Expand Down
4 changes: 2 additions & 2 deletions format.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
}
// End backwards-compatible aliasing..

$context = context_course::instance($course->id);
$coursecontext = context_course::instance($course->id);

if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $coursecontext) && confirm_sesskey()) {
$course->marker = $marker;
course_set_marker($course->id, $marker);
}
Expand Down
22 changes: 10 additions & 12 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ public function update_course_format_options($data, $oldcourse = null) {
}
}

$data = (array) $data;
if ($oldcourse !== null) {
$data = (array) $data;
$oldcourse = (array) $oldcourse;
$options = $this->course_format_options();

Expand Down Expand Up @@ -933,8 +933,8 @@ public function delete_section($section, $forcedeleteifnotempty = false) {
}

if (parent::delete_section($section, $forcedeleteifnotempty)) {
$context = context_course::instance($this->courseid);
$this->delete_image($section->id, $context->id);
$coursecontext = context_course::instance($this->courseid);
$this->delete_image($section->id, $coursecontext->id);
return true;
}
return false;
Expand Down Expand Up @@ -1458,6 +1458,7 @@ public function setup_displayed_image($sectionimage, $contextid, $settings) {
}
} else {
error_log(get_string('cannotfinduploadedimage', 'format_grid').' ConxID: '.$contextid.' CID: '.$this->courseid.' SID: '.$sectionimage->sectionid.' DIX: '.$sectionimage->displayedimageindex.' IMG: '.$sectionimage->newimage.' - Please send this information along with a dump of the \'grid_icon\', \'course_section\' and \'files\' DB tables to the developer. Also look in the moodledata \'filedir\' folder for the \'file\' with the \'contenthash\' from the \'files\' table where the \'itemid\' is the same as the \'SID\' and \'component\' is \'course\' and \'filearea\' is \'section\' and see if it exists.');
$DB->set_field('format_grid_icon', 'image', null, array('sectionid' => $sectionimage->sectionid));
print_error('cannotfinduploadedimage', 'format_grid', $CFG->wwwroot . "/course/view.php?id=" . $this->courseid);
}

Expand Down Expand Up @@ -1490,17 +1491,16 @@ public function delete_images() {

if (is_array($sectionimages)) {
global $DB;
$context = context_course::instance($this->courseid);
$contextid = $context->id;
$coursecontext = context_course::instance($this->courseid);
$fs = get_file_storage();
$gridimagepath = $this->get_image_path();

foreach ($sectionimages as $sectionimage) {
// Delete the image.
if ($file = $fs->get_file($contextid, 'course', 'section', $sectionimage->sectionid, '/', $sectionimage->image)) {
if ($file = $fs->get_file($coursecontext->id, 'course', 'section', $sectionimage->sectionid, '/', $sectionimage->image)) {
$file->delete();
// Delete the displayed image.
if ($file = $fs->get_file($contextid, 'course', 'section', $sectionimage->sectionid, $gridimagepath,
if ($file = $fs->get_file($coursecontext->id, 'course', 'section', $sectionimage->sectionid, $gridimagepath,
$sectionimage->displayedimageindex . '_' . $sectionimage->image)) {
$file->delete();
}
Expand All @@ -1516,15 +1516,14 @@ public function delete_displayed_images() {
if (is_array($sectionimages)) {
global $DB;

$context = context_course::instance($this->courseid);
$contextid = $context->id;
$coursecontext = context_course::instance($this->courseid);
$fs = get_file_storage();
$gridimagepath = $this->get_image_path();
$t = $DB->start_delegated_transaction();

foreach ($sectionimages as $sectionimage) {
// Delete the displayed image.
if ($file = $fs->get_file($contextid, 'course', 'section', $sectionimage->sectionid, $gridimagepath,
if ($file = $fs->get_file($coursecontext->id, 'course', 'section', $sectionimage->sectionid, $gridimagepath,
$sectionimage->displayedimageindex . '_' . $sectionimage->image)) {
$file->delete();
$DB->set_field('format_grid_icon', 'displayedimageindex', 0, array('sectionid' => $sectionimage->sectionid));
Expand All @@ -1547,13 +1546,12 @@ private function update_displayed_images($courseid, $us, $settings, $ignorenorec
$sectionimages = $us->get_images($courseid);
if (is_array($sectionimages)) {
$coursecontext = context_course::instance($courseid);
$contextid = $coursecontext->id;

$t = $DB->start_delegated_transaction();
foreach ($sectionimages as $sectionimage) {
if ($sectionimage->displayedimageindex > 0) {
$sectionimage->newimage = $sectionimage->image;
$sectionimage = $us->setup_displayed_image($sectionimage, $contextid, $settings);
$sectionimage = $us->setup_displayed_image($sectionimage, $coursecontext->id, $settings);

if (self::is_developer_debug()) {
error_log('update_displayed_images: Updated displayed image in course id: ' . $courseid . ' for section ' .
Expand Down
14 changes: 7 additions & 7 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
global $PAGE;

$summarystatus = $this->courseformat->get_summary_visibility($course->id);
$context = context_course::instance($course->id);
$coursecontext = context_course::instance($course->id);
$editing = $PAGE->user_is_editing();
$hascapvishidsect = has_capability('moodle/course:viewhiddensections', $context);
$hascapvishidsect = has_capability('moodle/course:viewhiddensections', $coursecontext);

if ($editing) {
$streditsummary = get_string('editsummary');
Expand Down Expand Up @@ -120,7 +120,7 @@ public function print_multiple_section_page($course, $sections, $mods, $modnames
'aria-label' => get_string('gridimagecontainer', 'format_grid')));
echo html_writer::start_tag('ul', array('class' => 'gridicons'));
// Print all of the image containers.
$this->make_block_icon_topics($context->id, $modinfo, $course, $editing, $hascapvishidsect, $urlpicedit);
$this->make_block_icon_topics($coursecontext->id, $modinfo, $course, $editing, $hascapvishidsect, $urlpicedit);
echo html_writer::end_tag('ul');
echo html_writer::end_tag('div');
echo html_writer::start_tag('div', array('id' => 'gridshadebox'));
Expand Down Expand Up @@ -591,7 +591,7 @@ private function make_block_show_clipboard_if_file_moving($course) {
*/
private function make_block_topics($course, $sections, $modinfo, $editing, $hascapvishidsect, $streditsummary,
$urlpicedit, $onsectionpage) {
$context = context_course::instance($course->id);
$coursecontext = context_course::instance($course->id);
unset($sections[0]);
for ($section = 1; $section <= $course->numsections; $section++) {
$thissection = $modinfo->get_section_info($section);
Expand Down Expand Up @@ -644,8 +644,8 @@ private function make_block_topics($course, $sections, $modinfo, $editing, $hasc
}
echo html_writer::end_tag('div');

echo $this->section_availability_message($thissection,has_capability('moodle/course:viewhiddensections',
$context));
echo $this->section_availability_message($thissection, has_capability('moodle/course:viewhiddensections',
$coursecontext));

echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->courserenderer->course_section_add_cm_control($course, $thissection->section, 0);
Expand All @@ -654,7 +654,7 @@ private function make_block_topics($course, $sections, $modinfo, $editing, $hasc
echo html_writer::tag('p', get_string('hidden_topic', 'format_grid'));

echo $this->section_availability_message($thissection, has_capability('moodle/course:viewhiddensections',
$context));
$coursecontext));
}

echo html_writer::end_tag('div');
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();

// Plugin version.
$plugin->version = 2015062201;
$plugin->version = 2015062202;

// Required Moodle version.
$plugin->requires = 2015051100.00; // 2.9 (Build: 20150511).
Expand All @@ -41,4 +41,4 @@
$plugin->maturity = MATURITY_STABLE;

// User-friendly version number.
$plugin->release = '2.9.1.1';
$plugin->release = '2.9.1.2';

0 comments on commit 6b67bab

Please sign in to comment.