Skip to content

Commit

Permalink
MDL-29030 update completion block to use migrated report
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Nov 6, 2011
1 parent 635284c commit ffd8bb2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
19 changes: 11 additions & 8 deletions blocks/completionstatus/block_completionstatus.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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');

/**
Expand Down Expand Up @@ -81,8 +84,8 @@ public function get_content() {
// 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;
}
Expand Down
18 changes: 9 additions & 9 deletions blocks/completionstatus/details.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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');

Expand Down Expand Up @@ -62,9 +62,9 @@
$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;
}

Expand Down Expand Up @@ -165,7 +165,7 @@
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
Expand Down
17 changes: 15 additions & 2 deletions blocks/completionstatus/version.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);

0 comments on commit ffd8bb2

Please sign in to comment.