diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php
index c0590a732c2..7130e6364aa 100644
--- a/mod/assign/locallib.php
+++ b/mod/assign/locallib.php
@@ -5187,7 +5187,8 @@ class assign {
$this->get_course_module()->id,
$this->count_submissions_need_grading(),
$instance->teamsubmission,
- $warnofungroupedusers);
+ $warnofungroupedusers,
+ $this->can_grade());
} else {
// The active group has already been updated in groups_print_activity_menu().
$countparticipants = $this->count_participants($activitygroup);
@@ -5201,7 +5202,8 @@ class assign {
$this->get_course_module()->id,
$this->count_submissions_need_grading(),
$instance->teamsubmission,
- false);
+ false,
+ $this->can_grade());
}
diff --git a/mod/assign/renderable.php b/mod/assign/renderable.php
index 8c6435e6a4f..06eb4becc34 100644
--- a/mod/assign/renderable.php
+++ b/mod/assign/renderable.php
@@ -748,6 +748,8 @@ class assign_grading_summary implements renderable {
public $teamsubmission = false;
/** @var boolean warnofungroupedusers - Do we need to warn people that there are users without groups */
public $warnofungroupedusers = false;
+ /** @var boolean cangrade - Can the current user grade students? */
+ public $cangrade = false;
/**
* constructor
@@ -762,6 +764,7 @@ class assign_grading_summary implements renderable {
* @param int $coursemoduleid
* @param int $submissionsneedgradingcount
* @param bool $teamsubmission
+ * @param bool $cangrade
*/
public function __construct($participantcount,
$submissiondraftsenabled,
@@ -773,7 +776,8 @@ class assign_grading_summary implements renderable {
$coursemoduleid,
$submissionsneedgradingcount,
$teamsubmission,
- $warnofungroupedusers) {
+ $warnofungroupedusers,
+ $cangrade = true) {
$this->participantcount = $participantcount;
$this->submissiondraftsenabled = $submissiondraftsenabled;
$this->submissiondraftscount = $submissiondraftscount;
@@ -785,6 +789,7 @@ class assign_grading_summary implements renderable {
$this->submissionsneedgradingcount = $submissionsneedgradingcount;
$this->teamsubmission = $teamsubmission;
$this->warnofungroupedusers = $warnofungroupedusers;
+ $this->cangrade = $cangrade;
}
}
diff --git a/mod/assign/renderer.php b/mod/assign/renderer.php
index 649e6742018..3d9bde8a385 100644
--- a/mod/assign/renderer.php
+++ b/mod/assign/renderer.php
@@ -339,9 +339,11 @@ class mod_assign_renderer extends plugin_renderer_base {
$urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grading');
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$o .= '' . get_string('viewgrading', 'mod_assign') . ' ';
- $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grader');
- $url = new moodle_url('/mod/assign/view.php', $urlparams);
- $o .= '' . get_string('grade') . '';
+ if ($summary->cangrade) {
+ $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grader');
+ $url = new moodle_url('/mod/assign/view.php', $urlparams);
+ $o .= '' . get_string('grade') . '';
+ }
$o .= $this->output->container_end();
// Close the container and insert a spacer.