Línea 69... |
Línea 69... |
69 |
* and there is an area with the active grading method set to 'rubric'.
|
69 |
* and there is an area with the active grading method set to 'rubric'.
|
70 |
*
|
70 |
*
|
71 |
* @param settings_navigation $settingsnav {@link settings_navigation}
|
71 |
* @param settings_navigation $settingsnav {@link settings_navigation}
|
72 |
* @param navigation_node $node {@link navigation_node}
|
72 |
* @param navigation_node $node {@link navigation_node}
|
73 |
*/
|
73 |
*/
|
74 |
public function extend_settings_navigation(settings_navigation $settingsnav, navigation_node $node=null) {
|
74 |
public function extend_settings_navigation(settings_navigation $settingsnav, ?navigation_node $node=null) {
|
75 |
$node->add(get_string('definerubric', 'gradingform_rubric'),
|
75 |
$node->add(get_string('definerubric', 'gradingform_rubric'),
|
76 |
$this->get_editor_url(), settings_navigation::TYPE_CUSTOM,
|
76 |
$this->get_editor_url(), settings_navigation::TYPE_CUSTOM,
|
77 |
null, null, new pix_icon('icon', '', 'gradingform_rubric'));
|
77 |
null, null, new pix_icon('icon', '', 'gradingform_rubric'));
|
78 |
}
|
78 |
}
|
Línea 84... |
Línea 84... |
84 |
* FEATURE_ADVANCED_GRADING and there is an area with the active grading method set to the given plugin.
|
84 |
* FEATURE_ADVANCED_GRADING and there is an area with the active grading method set to the given plugin.
|
85 |
*
|
85 |
*
|
86 |
* @param global_navigation $navigation {@link global_navigation}
|
86 |
* @param global_navigation $navigation {@link global_navigation}
|
87 |
* @param navigation_node $node {@link navigation_node}
|
87 |
* @param navigation_node $node {@link navigation_node}
|
88 |
*/
|
88 |
*/
|
89 |
public function extend_navigation(global_navigation $navigation, navigation_node $node=null) {
|
89 |
public function extend_navigation(global_navigation $navigation, ?navigation_node $node=null) {
|
90 |
if (has_capability('moodle/grade:managegradingforms', $this->get_context())) {
|
90 |
if (has_capability('moodle/grade:managegradingforms', $this->get_context())) {
|
91 |
// no need for preview if user can manage forms, he will have link to manage.php in settings instead
|
91 |
// no need for preview if user can manage forms, he will have link to manage.php in settings instead
|
92 |
return;
|
92 |
return;
|
93 |
}
|
93 |
}
|
94 |
if ($this->is_form_defined() && ($options = $this->get_options()) && !empty($options['alwaysshowdefinition'])) {
|
94 |
if ($this->is_form_defined() && ($options = $this->get_options()) && !empty($options['alwaysshowdefinition'])) {
|
Línea 861... |
Línea 861... |
861 |
public function update($data) {
|
861 |
public function update($data) {
|
862 |
global $DB;
|
862 |
global $DB;
|
863 |
$currentgrade = $this->get_rubric_filling();
|
863 |
$currentgrade = $this->get_rubric_filling();
|
864 |
parent::update($data);
|
864 |
parent::update($data);
|
865 |
foreach ($data['criteria'] as $criterionid => $record) {
|
865 |
foreach ($data['criteria'] as $criterionid => $record) {
|
- |
|
866 |
// Hardcoding/defaulting to html format for new/existing record
|
- |
|
867 |
$record['remarkformat'] = FORMAT_HTML;
|
- |
|
868 |
|
866 |
if (!array_key_exists($criterionid, $currentgrade['criteria'])) {
|
869 |
if (!array_key_exists($criterionid, $currentgrade['criteria'])) {
|
867 |
$newrecord = array('instanceid' => $this->get_id(), 'criterionid' => $criterionid,
|
870 |
$newrecord = array('instanceid' => $this->get_id(), 'criterionid' => $criterionid,
|
868 |
'levelid' => $record['levelid'], 'remarkformat' => FORMAT_MOODLE);
|
871 |
'levelid' => $record['levelid'], 'remarkformat' => $record['remarkformat']);
|
869 |
if (isset($record['remark'])) {
|
872 |
if (isset($record['remark'])) {
|
870 |
$newrecord['remark'] = $record['remark'];
|
873 |
$newrecord['remark'] = $record['remark'];
|
871 |
}
|
874 |
}
|
872 |
$DB->insert_record('gradingform_rubric_fillings', $newrecord);
|
875 |
$DB->insert_record('gradingform_rubric_fillings', $newrecord);
|
873 |
} else {
|
876 |
} else {
|
874 |
$newrecord = array('id' => $currentgrade['criteria'][$criterionid]['id']);
|
877 |
$newrecord = array('id' => $currentgrade['criteria'][$criterionid]['id']);
|
875 |
foreach (array('levelid', 'remark'/*, 'remarkformat' */) as $key) {
|
878 |
foreach (array('levelid', 'remark', 'remarkformat') as $key) {
|
876 |
// TODO MDL-31235 format is not supported yet
|
879 |
// TODO MDL-31235 format is not supported yet
|
877 |
if (isset($record[$key]) && $currentgrade['criteria'][$criterionid][$key] != $record[$key]) {
|
880 |
if (isset($record[$key]) && $currentgrade['criteria'][$criterionid][$key] != $record[$key]) {
|
878 |
$newrecord[$key] = $record[$key];
|
881 |
$newrecord[$key] = $record[$key];
|
879 |
}
|
882 |
}
|
880 |
}
|
883 |
}
|