$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);
$this->get_course_module()->id,
$this->count_submissions_need_grading(),
$instance->teamsubmission,
- false);
+ false,
+ $this->can_grade());
}
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
* @param int $coursemoduleid
* @param int $submissionsneedgradingcount
* @param bool $teamsubmission
+ * @param bool $cangrade
*/
public function __construct($participantcount,
$submissiondraftsenabled,
$coursemoduleid,
$submissionsneedgradingcount,
$teamsubmission,
- $warnofungroupedusers) {
+ $warnofungroupedusers,
+ $cangrade = true) {
$this->participantcount = $participantcount;
$this->submissiondraftsenabled = $submissiondraftsenabled;
$this->submissiondraftscount = $submissiondraftscount;
$this->submissionsneedgradingcount = $submissionsneedgradingcount;
$this->teamsubmission = $teamsubmission;
$this->warnofungroupedusers = $warnofungroupedusers;
+ $this->cangrade = $cangrade;
}
}
$urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grading');
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$o .= '<a href="' . $url . '" class="btn btn-secondary">' . get_string('viewgrading', 'mod_assign') . '</a> ';
- $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grader');
- $url = new moodle_url('/mod/assign/view.php', $urlparams);
- $o .= '<a href="' . $url . '" class="btn btn-primary">' . get_string('grade') . '</a>';
+ if ($summary->cangrade) {
+ $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grader');
+ $url = new moodle_url('/mod/assign/view.php', $urlparams);
+ $o .= '<a href="' . $url . '" class="btn btn-primary">' . get_string('grade') . '</a>';
+ }
$o .= $this->output->container_end();
// Close the container and insert a spacer.