1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-17 14:35:29 +02:00

MDL-29482 The rubric editor is now able to save the status of the form definition

This commit is contained in:
David Mudrak 2011-11-01 18:04:31 +01:00
parent 4d064218fb
commit 49a537b356
5 changed files with 32 additions and 4 deletions
grade/grading
lang/en
theme/standard/style

@ -56,8 +56,13 @@ if ($mform->is_cancelled()) {
redirect($returnurl);
} else if ($mform->is_submitted() && $mform->is_validated()) {
$data = $mform->get_data();
$controller->update_definition($data); // todo set status
redirect($returnurl);
if (!empty($data->submitfinal)) {
$controller->update_definition($data, gradingform_controller::DEFINITION_STATUS_READY);
redirect($returnurl);
} else {
$controller->update_definition($data, gradingform_controller::DEFINITION_STATUS_DRAFT);
redirect($PAGE->url);
}
}
echo $OUTPUT->header();

@ -64,6 +64,14 @@ class gradingform_rubric_editrubric extends moodleform {
$element->freeze();
}
$this->add_action_buttons(true);
// submit and cancel buttons
$buttonarray = array(
$form->createElement('submit', 'submitdraft', get_string('saveandcontinue', 'core_grading')),
$form->createElement('submit', 'submitfinal', get_string('saveandmakeready', 'core_grading')),
$form->createElement('cancel')
);
$form->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$form->setType('buttonar', PARAM_RAW);
$form->closeHeaderBefore('buttonar');
}
}

@ -222,7 +222,14 @@ if (!empty($method)) {
// display the grading form preview
if ($controller->is_form_defined()) {
echo $output->box($controller->render_preview($PAGE), 'preview');
if ($definition->status == gradingform_controller::DEFINITION_STATUS_READY) {
$tag = html_writer::tag('span', get_string('statusready', 'core_grading'), array('class' => 'status-ready'));
} else {
$tag = html_writer::tag('span', get_string('statusdraft', 'core_grading'), array('class' => 'status-draft'));
}
echo $output->heading(s($definition->name) . ' ' . $tag, 3, 'definition-name');
echo $output->box(format_text($definition->description, $definition->descriptionformat));
echo $output->box($controller->render_preview($PAGE), 'definition-preview');
}
}

@ -57,6 +57,10 @@ $string['manageactionshareconfirm'] = 'You are going to save a copy of the gradi
$string['manageactionsharedone'] = 'The form was successfully saved as a template';
$string['noitemid'] = 'Grading not possible. The graded item does not exist.';
$string['nosharedformfound'] = 'No template found';
$string['saveandcontinue'] = 'Save as draft';
$string['saveandmakeready'] = 'Save as ready for usage';
$string['statusdraft'] = 'Draft';
$string['statusready'] = 'Ready for usage';
$string['templatedelete'] = 'Delete';
$string['templatedeleteconfirm'] = 'You are going to delete the shared template \'{$a}\'. Deleting a template does not affect existing forms that were created from it.';
$string['templateedit'] = 'Edit';

@ -45,6 +45,10 @@ td.grade div.overridden {background-color: #DDDDDD;}
#page-grade-grading-manage #actionresultmessagebox {background-color:#D2EBFF;width:60%;margin:1em auto 1em auto;text-align:center;
padding:0.5em;border:2px solid #CCC;text-align:center;-moz-border-radius:5px;position:relative}
#page-grade-grading-manage #actionresultmessagebox span {position:absolute;right:0px;top:-1.2em;color:#666;font-size:80%}
#page-grade-grading-manage .definition-name span {padding:0.25em;font-weight:bold;text-transform:uppercase;}
#page-grade-grading-manage .definition-name span.status-ready {background-color:#e7f1c3;border:2px solid #AAEEAA;}
#page-grade-grading-manage .definition-name span.status-draft {background-color:#f3f2aa;border:2px solid #EEEE22;}
#page-grade-grading-manage .definition-preview {width:50%;margin:1em auto;border:1px solid #EEE; padding: 1em;}
#page-grade-grading-pick .templatesearchform {text-align:center;margin:0px auto;}
#page-grade-grading-pick .template-name {clear: both; padding:3px; background-color: #F6F6F6;}
#page-grade-grading-pick .template-description {margin-bottom: 1em; padding: 0px 2em 0px 0px; margin-right:51%;}