Description « Hide
enable teacher to add a "template text" for students to base their answer upon
when giving them an online assignment.
patch explanation follows in the comments for this tracker issue
Description enable teacher to add a "template text" for students to base their answer upon when giving them an online assignment. patch explanation follows in the comments for this tracker issue Show »
All Comments Change History Version Control Sort Order: Ascending order - Click to sort in descending order
[ Permalink
« Hide ]
Nadav Kavalerchik added a comment - 27/May/09 04:15 AM
add new field to the DB, table assignment called "answertemplate" type=text collation=utf8_unicode_ci
patch the file mod/assignment/type/online/assignment.class.php
line 117:
print_single_button('view.php', array('id'=>$this->cm->id,'edit'=>'1','assignmentid'=>$this->assignment->id),
just after line 252 add:
$mform->addElement('htmleditor', 'answertemplate', get_string('answertemplate', 'assignment'), array('cols'=>60, 'rows'=>30));
$mform->setType('answertemplate', PARAM_RAW); // to be cleaned before display
$mform->setHelpButton('answertemplate', array('reading', 'writing', 'richtext'), false, 'editorhelpbutton');
$mform->addRule('answertemplate', get_string('required'), 'required', null, 'client');
just after line 283 add:
if (! $answertemplate = get_field('assignment','answertemplate' ,'id', $_GET['assignmentid'])) {
//error('assignment ID was incorrect');
}
$mform->setDefault('text', $answertemplate);
add to you local lang assignment.php files the string:
$string['answertemplate'] = 'A template for student\'s answer';
enjoy
[ Show » ]
Nadav Kavalerchik added a comment - 27/May/09 04:15 AM
add new field to the DB, table assignment called "answertemplate" type=text collation=utf8_unicode_ci
patch the file mod/assignment/type/online/assignment.class.php line 117:
print_single_button('view.php', array('id'=>$this->cm->id,'edit'=>'1','assignmentid'=>$this->assignment->id),
just after line 252 add:
$mform->addElement('htmleditor', 'answertemplate', get_string('answertemplate', 'assignment'), array('cols'=>60, 'rows'=>30));
$mform->setType('answertemplate', PARAM_RAW); // to be cleaned before display
$mform->setHelpButton('answertemplate', array('reading', 'writing', 'richtext'), false, 'editorhelpbutton');
$mform->addRule('answertemplate', get_string('required'), 'required', null, 'client');
just after line 283 add:
if (! $answertemplate = get_field('assignment','answertemplate' ,'id', $_GET['assignmentid'])) {
//error('assignment ID was incorrect');
}
$mform->setDefault('text', $answertemplate);
add to you local lang assignment.php files the string:
$string['answertemplate'] = 'A template for student\'s answer';
enjoy
ไม่มีความคิดเห็น:
แสดงความคิดเห็น