mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
fixing formslib usage and locked implementation
This commit is contained in:
parent
943e3dcdd2
commit
9c25957a13
@ -20,14 +20,19 @@ require_capability('gradereport/grader:manage', $context);
|
||||
// default return url
|
||||
$returnurl = $CFG->wwwroot.'/grade/report.php?report=grader&id='.$course->id;
|
||||
|
||||
$mform = new edit_grade_form(qualified_me(), array('id'=>$id));
|
||||
$grade_grades = get_record('grade_grades', 'id', $id);
|
||||
$gradeitem = get_record('grade_items', 'id', $grade_grades->itemid);
|
||||
|
||||
$mform = new edit_grade_form(qualified_me(), array('gradeitem'=>$gradeitem));
|
||||
if ($grade_grades = get_record('grade_grades', 'id', $id)) {
|
||||
if ($grade_text = get_record('grade_grades_text', 'gradeid', $id)) {
|
||||
$mform->set_data($grade_text);
|
||||
}
|
||||
}
|
||||
|
||||
$grade_grades->locked = $grade_grades->locked > 0 ? 1:0;
|
||||
$grade_grades->courseid = $courseid;
|
||||
$mform->set_data($grade_grades);
|
||||
|
||||
} else {
|
||||
$mform->set_data(array('courseid'=>$course->id, 'id' => $id));
|
||||
}
|
||||
|
@ -4,12 +4,11 @@ require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class edit_grade_form extends moodleform {
|
||||
function definition() {
|
||||
|
||||
global $CFG, $USER;
|
||||
$mform =& $this->_form;
|
||||
|
||||
$id = $this->_customdata['id'];
|
||||
$grade_grades = get_record('grade_grades', 'id', $id);
|
||||
$gradeitem = get_record('grade_items', 'id', $grade_grades->itemid);
|
||||
$gradeitem = $this->_customdata['gradeitem'];
|
||||
|
||||
/// actual grade - numeric or scale
|
||||
if ($gradeitem->gradetype == 1) {
|
||||
@ -29,13 +28,12 @@ class edit_grade_form extends moodleform {
|
||||
|
||||
$mform->addElement('select', 'finalgrade', get_string('finalgrade', 'grades'), $scaleopt);
|
||||
}
|
||||
/// hidden
|
||||
|
||||
/// hidden
|
||||
$mform->addElement('advcheckbox', 'hidden', get_string('hidden', 'grades'));
|
||||
|
||||
/// locked
|
||||
$mform->addElement('advcheckbox', 'locked', get_string('locked', 'grades'),'','',$grade_grades->locked);
|
||||
$mform->addElement('advcheckbox', 'locked', get_string('locked', 'grades'));
|
||||
|
||||
/// locktime
|
||||
$mform->addElement('date_time_selector', 'locktime', get_string('locktime', 'grades'), array('optional'=>true));
|
||||
@ -49,7 +47,7 @@ class edit_grade_form extends moodleform {
|
||||
// User preference determines the format
|
||||
if ($CFG->htmleditor && $USER->htmleditor && $feedbackformat == GRADER_REPORT_FEEDBACK_FORMAT_HTML) {
|
||||
$mform->addElement('htmleditor', 'feedback', get_string('feedback', 'grades'),
|
||||
array('rows'=> '15', 'course' => optional_param('courseid', PARAM_INT), 'cols'=>'45'));
|
||||
array('rows'=> '15', 'course' => $gradeitem->courseid, 'cols'=>'45'));
|
||||
} else {
|
||||
$mform->addElement('textarea', 'feedback', get_string('feedback', 'grades'));
|
||||
}
|
||||
@ -69,4 +67,4 @@ class edit_grade_form extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user