Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-58983-34' of git://github.com/damyon/moodle into MO…
…ODLE_34_STABLE
  • Loading branch information
David Monllao committed Dec 27, 2017
2 parents dc24b81 + b4cbad1 commit dfe9aa2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 4 additions & 2 deletions mod/assign/locallib.php
Expand Up @@ -5323,7 +5323,8 @@ public function get_assign_grading_summary_renderable() {
$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);
Expand All @@ -5337,7 +5338,8 @@ public function get_assign_grading_summary_renderable() {
$this->get_course_module()->id,
$this->count_submissions_need_grading(),
$instance->teamsubmission,
false);
false,
$this->can_grade());

}

Expand Down
7 changes: 6 additions & 1 deletion mod/assign/renderable.php
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -773,7 +776,8 @@ public function __construct($participantcount,
$coursemoduleid,
$submissionsneedgradingcount,
$teamsubmission,
$warnofungroupedusers) {
$warnofungroupedusers,
$cangrade = true) {
$this->participantcount = $participantcount;
$this->submissiondraftsenabled = $submissiondraftsenabled;
$this->submissiondraftscount = $submissiondraftscount;
Expand All @@ -785,6 +789,7 @@ public function __construct($participantcount,
$this->submissionsneedgradingcount = $submissionsneedgradingcount;
$this->teamsubmission = $teamsubmission;
$this->warnofungroupedusers = $warnofungroupedusers;
$this->cangrade = $cangrade;
}
}

Expand Down
8 changes: 5 additions & 3 deletions mod/assign/renderer.php
Expand Up @@ -339,9 +339,11 @@ public function render_assign_grading_summary(assign_grading_summary $summary) {
$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.
Expand Down

0 comments on commit dfe9aa2

Please sign in to comment.