mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
Merge branch 'MDL-72097' of git://github.com/danmarsden/moodle
This commit is contained in:
commit
735bd7ffdb
3 changed files with 16 additions and 10 deletions
|
@ -638,7 +638,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||||
public function col_workflowstatus(stdClass $row) {
|
public function col_workflowstatus(stdClass $row) {
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
$gradingdisabled = $this->assignment->grading_disabled($row->id);
|
$gradingdisabled = $this->assignment->grading_disabled($row->id, true, $this->gradinginfo);
|
||||||
// The function in the assignment keeps a static cache of this list of states.
|
// The function in the assignment keeps a static cache of this list of states.
|
||||||
$workflowstates = $this->assignment->get_marking_workflow_states_for_current_user();
|
$workflowstates = $this->assignment->get_marking_workflow_states_for_current_user();
|
||||||
$workflowstate = $row->workflowstate;
|
$workflowstate = $row->workflowstate;
|
||||||
|
@ -946,7 +946,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function col_gradecanbechanged(stdClass $row) {
|
public function col_gradecanbechanged(stdClass $row) {
|
||||||
$gradingdisabled = $this->assignment->grading_disabled($row->id);
|
$gradingdisabled = $this->assignment->grading_disabled($row->id, true, $this->gradinginfo);
|
||||||
if ($gradingdisabled) {
|
if ($gradingdisabled) {
|
||||||
return get_string('no');
|
return get_string('no');
|
||||||
} else {
|
} else {
|
||||||
|
@ -981,7 +981,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||||
$link = '';
|
$link = '';
|
||||||
$separator = $this->output->spacer(array(), true);
|
$separator = $this->output->spacer(array(), true);
|
||||||
$grade = '';
|
$grade = '';
|
||||||
$gradingdisabled = $this->assignment->grading_disabled($row->id);
|
$gradingdisabled = $this->assignment->grading_disabled($row->id, true, $this->gradinginfo);
|
||||||
|
|
||||||
if (!$this->is_downloading() && $this->hasgrade) {
|
if (!$this->is_downloading() && $this->hasgrade) {
|
||||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||||
|
|
|
@ -7585,10 +7585,10 @@ class assign {
|
||||||
*
|
*
|
||||||
* @param int $userid - The student userid
|
* @param int $userid - The student userid
|
||||||
* @param bool $checkworkflow - whether to include a check for the workflow state.
|
* @param bool $checkworkflow - whether to include a check for the workflow state.
|
||||||
|
* @param stdClass $gradinginfo - optional, allow gradinginfo to be passed for performance.
|
||||||
* @return bool $gradingdisabled
|
* @return bool $gradingdisabled
|
||||||
*/
|
*/
|
||||||
public function grading_disabled($userid, $checkworkflow=true) {
|
public function grading_disabled($userid, $checkworkflow = true, $gradinginfo = null) {
|
||||||
global $CFG;
|
|
||||||
if ($checkworkflow && $this->get_instance()->markingworkflow) {
|
if ($checkworkflow && $this->get_instance()->markingworkflow) {
|
||||||
$grade = $this->get_user_grade($userid, false);
|
$grade = $this->get_user_grade($userid, false);
|
||||||
$validstates = $this->get_marking_workflow_states_for_current_user();
|
$validstates = $this->get_marking_workflow_states_for_current_user();
|
||||||
|
@ -7596,11 +7596,15 @@ class assign {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_null($gradinginfo)) {
|
||||||
$gradinginfo = grade_get_grades($this->get_course()->id,
|
$gradinginfo = grade_get_grades($this->get_course()->id,
|
||||||
'mod',
|
'mod',
|
||||||
'assign',
|
'assign',
|
||||||
$this->get_instance()->id,
|
$this->get_instance()->id,
|
||||||
array($userid));
|
array($userid));
|
||||||
|
}
|
||||||
|
|
||||||
if (!$gradinginfo) {
|
if (!$gradinginfo) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
This files describes API changes in the assign code.
|
This files describes API changes in the assign code.
|
||||||
|
=== 4.0 ===
|
||||||
|
* The method \assign::grading_disabled() now has optional $gradinginfo parameter to improve performance
|
||||||
|
|
||||||
=== 3.9 ===
|
=== 3.9 ===
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue