// Fetch the actual data.
$gradeduser = \core_user::get_user($gradeduserid);
+ $hasgrade = $gradeitem->user_has_grade($gradeduser);
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
- return self::get_fetch_data($grade);
+ return self::get_fetch_data($grade, $hasgrade);
}
/**
* Get the data to be fetched.
*
* @param stdClass $grade
+ * @param bool $hasgrade
* @return array
*/
- public static function get_fetch_data(stdClass $grade): array {
+ public static function get_fetch_data(stdClass $grade, bool $hasgrade): array {
return [
'templatename' => 'core_grades/grades/grader/gradingpanel/point',
+ 'hasgrade' => $hasgrade,
'grade' => [
'grade' => $grade->grade,
'timecreated' => $grade->timecreated,
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'templatename' => new external_value(PARAM_SAFEPATH, 'The template to use when rendering this data'),
+ 'hasgrade' => new external_value(PARAM_BOOL, 'Does the user have a grade?'),
'grade' => new external_single_structure([
'grade' => new external_value(PARAM_FLOAT, 'The numeric grade'),
'timecreated' => new external_value(PARAM_INT, 'The time that the grade was created'),
// Grade.
$gradeitem->store_grade_from_formdata($gradeduser, $USER, (object) $data);
- $hasgrade = $gradeitem->get_grade_status_for_user($gradeduser);
+ $hasgrade = $gradeitem->user_has_grade($gradeduser);
// Fetch the updated grade back out.
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
public static function get_fetch_data(gradeitem $gradeitem, stdClass $gradeduser): array {
global $USER;
+ $hasgrade = $gradeitem->user_has_grade($gradeduser);
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
$currentgrade = (int) unformat_float($grade->grade);
return [
'templatename' => 'core_grades/grades/grader/gradingpanel/scale',
+ 'hasgrade' => $hasgrade,
'grade' => [
'options' => $values,
'timecreated' => $grade->timecreated,
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'templatename' => new external_value(PARAM_SAFEPATH, 'The template to use when rendering this data'),
+ 'hasgrade' => new external_value(PARAM_BOOL, 'Does the user have a grade?'),
'grade' => new external_single_structure([
'options' => new external_multiple_structure(
new external_single_structure([
public static function get_fetch_data(gradeitem $gradeitem, stdClass $gradeduser): array {
global $USER;
+ $hasgrade = $gradeitem->user_has_grade($gradeduser);
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
$instance = $gradeitem->get_advanced_grading_instance($USER, $grade);
$controller = $instance->get_controller();
return [
'templatename' => 'gradingform_guide/grades/grader/gradingpanel',
+ 'hasgrade' => $hasgrade,
'grade' => [
'instanceid' => $instance->get_id(),
'criterion' => $criterion,
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'templatename' => new external_value(PARAM_SAFEPATH, 'The template to use when rendering this data'),
+ 'hasgrade' => new external_value(PARAM_BOOL, 'Does the user have a grade?'),
'grade' => new external_single_structure([
'instanceid' => new external_value(PARAM_INT, 'The id of the current grading instance'),
'criterion' => new external_multiple_structure(
global $USER;
// Set up all the controllers etc that we'll be needing.
+ $hasgrade = $gradeitem->user_has_grade($gradeduser);
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
$instance = $gradeitem->get_advanced_grading_instance($USER, $grade);
$controller = $instance->get_controller();
return [
'templatename' => 'gradingform_rubric/grades/grader/gradingpanel',
+ 'hasgrade' => $hasgrade,
'grade' => [
'instanceid' => $instance->get_id(),
'criteria' => $criterion,
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'templatename' => new external_value(PARAM_SAFEPATH, 'The template to use when rendering this data'),
+ 'hasgrade' => new external_value(PARAM_BOOL, 'Does the user have a grade?'),
'grade' => new external_single_structure([
'instanceid' => new external_value(PARAM_INT, 'The id of the current grading instance'),
'rubricmode' => new external_value(PARAM_RAW, 'The mode i.e. evaluate editable'),
defined('MOODLE_INTERNAL') || die();
$string['addcriterion'] = 'Add criterion';
+$string['additionalfeedback'] = 'Additional feedback';
$string['alwaysshowdefinition'] = 'Allow users to preview rubric (otherwise it will only be displayed after grading)';
$string['backtoediting'] = 'Back to editing';
$string['confirmdeletecriterion'] = 'Are you sure you want to delete this criterion?';