mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
gradebook MDL-19133 Make grading settings part of mod_edit form. first of several commits.
This commit is contained in:
parent
1238246b45
commit
1d50dd13f6
@ -49,6 +49,9 @@ abstract class moodleform_mod extends moodleform {
|
||||
/** current context, course or module depends if already exists*/
|
||||
protected $context;
|
||||
|
||||
/** a flag indicating whether outcomes are being used*/
|
||||
protected $_outcomesused;
|
||||
|
||||
function moodleform_mod($current, $section, $cm, $course) {
|
||||
$this->current = $current;
|
||||
$this->_instance = $current->instance;
|
||||
@ -328,10 +331,10 @@ abstract class moodleform_mod extends moodleform {
|
||||
global $COURSE, $CFG, $DB;
|
||||
$mform =& $this->_form;
|
||||
|
||||
$outcomesused = false;
|
||||
$this->_outcomesused = false;
|
||||
if ($this->_features->outcomes) {
|
||||
if ($outcomes = grade_outcome::fetch_all_available($COURSE->id)) {
|
||||
$outcomesused = true;
|
||||
$this->_outcomesused = true;
|
||||
$mform->addElement('header', 'modoutcomes', get_string('outcomes', 'grades'));
|
||||
foreach($outcomes as $outcome) {
|
||||
$mform->addElement('advcheckbox', 'outcome_'.$outcome->id, $outcome->get_name());
|
||||
@ -401,11 +404,6 @@ abstract class moodleform_mod extends moodleform {
|
||||
$mform->setHelpButton('cmidnumber', array('cmidnumber', get_string('idnumbermod')), true);
|
||||
}
|
||||
|
||||
if ($this->_features->gradecat) {
|
||||
$categories = grade_get_categories_menu($COURSE->id, $outcomesused);
|
||||
$mform->addElement('select', 'gradecat', get_string('gradecategory', 'grades'), $categories);
|
||||
}
|
||||
|
||||
if (!empty($CFG->enableavailability)) {
|
||||
// Conditional availability
|
||||
$mform->addElement('header', '', get_string('availabilityconditions', 'condition'));
|
||||
@ -620,6 +618,23 @@ abstract class moodleform_mod extends moodleform {
|
||||
$mform->setType('return', PARAM_BOOL);
|
||||
}
|
||||
|
||||
public function coursemodule_grading_elements() {
|
||||
global $COURSE;
|
||||
$mform =& $this->_form;
|
||||
|
||||
if (plugin_supports('mod', $this->_modname, FEATURE_GRADE_HAS_GRADE, false)) {
|
||||
$mform->addElement('header', 'modstandardgrade', get_string('grade'));
|
||||
|
||||
$mform->addElement('modgrade', 'grade', get_string('grade'));
|
||||
$mform->setDefault('grade', 100);
|
||||
|
||||
if ($this->_features->gradecat) {
|
||||
$categories = grade_get_categories_menu($COURSE->id, $this->_outcomesused);
|
||||
$mform->addElement('select', 'gradecat', get_string('gradecategory', 'grades'), $categories);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function add_intro_editor($required=false, $customlabel=null) {
|
||||
if (!$this->_features->introeditor) {
|
||||
// intro editor not supported in this module
|
||||
|
@ -3340,6 +3340,7 @@ function assignment_supports($feature) {
|
||||
case FEATURE_GRADE_HAS_GRADE: return true;
|
||||
case FEATURE_GRADE_OUTCOMES: return true;
|
||||
case FEATURE_MOD_SUBPLUGINS: return array('assignment'=>'mod/assignment/type'); // to be hopefully removed in 2.0
|
||||
case FEATURE_GRADE_HAS_GRADE: return true;
|
||||
|
||||
default: return null;
|
||||
}
|
||||
|
@ -43,9 +43,6 @@ class mod_assignment_mod_form extends moodleform_mod {
|
||||
|
||||
$this->add_intro_editor(true, get_string('description', 'assignment'));
|
||||
|
||||
$mform->addElement('modgrade', 'grade', get_string('grade'));
|
||||
$mform->setDefault('grade', 100);
|
||||
|
||||
$mform->addElement('date_time_selector', 'timeavailable', get_string('availabledate', 'assignment'), array('optional'=>true));
|
||||
$mform->setDefault('timeavailable', time());
|
||||
$mform->addElement('date_time_selector', 'timedue', get_string('duedate', 'assignment'), array('optional'=>true));
|
||||
@ -56,7 +53,7 @@ class mod_assignment_mod_form extends moodleform_mod {
|
||||
$mform->addElement('select', 'preventlate', get_string('preventlate', 'assignment'), $ynoptions);
|
||||
$mform->setDefault('preventlate', 0);
|
||||
|
||||
|
||||
$this->coursemodule_grading_elements();
|
||||
|
||||
$typetitle = get_string('type'.$type, 'assignment');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user