MDL-29030 update completion block to use migrated report

This commit is contained in:
Petr Skoda
2011-11-06 12:22:50 +01:00
parent 635284c42f
commit ffd8bb207e
3 changed files with 35 additions and 19 deletions
@@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -15,15 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block for displayed logged in user's course completion status
*
* @package moodlecore
* @copyright 2009 Catalyst IT Ltd
* @author Aaron Barnes <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package block
* @subpackage completion
* @copyright 2009 Catalyst IT Ltd
* @author Aaron Barnes <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/completionlib.php');
/**
@@ -81,8 +84,8 @@ class block_completionstatus extends block_base {
// Check this user is enroled
if (!$info->is_tracked_user($USER->id)) {
// If not enrolled, but are can view the report:
if (has_capability('coursereport/completion:view', get_context_instance(CONTEXT_COURSE, $COURSE->id))) {
$this->content->text = '<a href="'.$CFG->wwwroot.'/course/report/completion/index.php?course='.$COURSE->id.
if (has_capability('report/completion:view', get_context_instance(CONTEXT_COURSE, $COURSE->id))) {
$this->content->text = '<a href="'.$CFG->wwwroot.'/report/completion/index.php?course='.$COURSE->id.
'">'.get_string('viewcoursereport', 'completion').'</a>';
return $this->content;
}
+9 -9
View File
@@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -15,15 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block for displayed logged in user's course completion status
*
* @package moodlecore
* @copyright 2009 Catalyst IT Ltd
* @author Aaron Barnes <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package block
* @subpackage completion
* @copyright 2009 Catalyst IT Ltd
* @author Aaron Barnes <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
require_once($CFG->libdir.'/completionlib.php');
@@ -62,9 +62,9 @@ if ($USER->id == $user->id) {
$can_view = true;
} else if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext)) {
$can_view = true;
} else if (has_capability('coursereport/completion:view', $coursecontext)) {
} else if (has_capability('report/completion:view', $coursecontext)) {
$can_view = true;
} else if (has_capability('coursereport/completion:view', $personalcontext)) {
} else if (has_capability('report/completion:view', $personalcontext)) {
$can_view = true;
}
@@ -165,7 +165,7 @@ echo '<th class="c1 header" scope="col">'.get_string('criteria', 'completion').'
echo '<th class="c2 header" scope="col">'.get_string('requirement', 'block_completionstatus').'</th>';
echo '<th class="c3 header" scope="col">'.get_string('status').'</th>';
echo '<th class="c4 header" scope="col">'.get_string('complete').'</th>';
echo '<th class="c5 header" scope="col">'.get_string('completiondate', 'coursereport_completion').'</th>';
echo '<th class="c5 header" scope="col">'.get_string('completiondate', 'report_completion').'</th>';
echo '</tr>';
// Save row data
+15 -2
View File
@@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -15,4 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
$plugin->version = 2009072800;
/**
* Version info
*
* @package block
* @subpackage completion
* @copyright 2009 Catalyst IT Ltd
* @author Aaron Barnes <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2011110300;
$plugin->component = 'block_completionstatus';
$plugin->dependencies = array('report_completion' => 2011110200);