mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
grade items in xml export should not be checkable if they have no idnumbers
This commit is contained in:
parent
98240e51a6
commit
0da010f792
@ -5,9 +5,12 @@ class grade_export_form extends moodleform {
|
||||
function definition (){
|
||||
global $CFG;
|
||||
include_once($CFG->libdir.'/pear/HTML/QuickForm/advcheckbox.php');
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
if (isset($this->_customdata['plugin'])) {
|
||||
$plugin = $this->_customdata['plugin'];
|
||||
} else {
|
||||
$plugin = 'unknown';
|
||||
}
|
||||
$mform->addElement('advcheckbox', 'export_letters', get_string('exportletters', 'grades'));
|
||||
$mform->setDefault('export_letters', 0);
|
||||
$mform->setHelpButton('export_letters', array(false, get_string('exportletters', 'grades'),
|
||||
@ -18,13 +21,25 @@ class grade_export_form extends moodleform {
|
||||
$id = $this->_customdata['id']; // course id
|
||||
$mform->addElement('hidden', 'id', $id);
|
||||
if ($grade_items = grade_item::fetch_all(array('courseid'=>$id))) {
|
||||
$noidnumber = false;
|
||||
foreach ($grade_items as $grade_item) {
|
||||
$element = new HTML_QuickForm_advcheckbox('itemids[]', null, $grade_item->get_name(), array('selected'=>'selected'), array(0, $grade_item->id));
|
||||
$element->setChecked(1);
|
||||
|
||||
if ($plugin != 'xmlexport' || $grade_item->idnumber) {
|
||||
$element = new HTML_QuickForm_advcheckbox('itemids[]', null, $grade_item->get_name(), array('selected'=>'selected'), array(0, $grade_item->id));
|
||||
$element->setChecked(1);
|
||||
} else {
|
||||
$noidnumber = true;
|
||||
$element = new HTML_QuickForm_advcheckbox('itemids[]', null, $grade_item->get_name(), array('disabled'=>'disabled'), array(0, $grade_item->id));
|
||||
}
|
||||
|
||||
$mform->addElement($element);
|
||||
}
|
||||
}
|
||||
|
||||
if ($noidnumber) {
|
||||
$mform->addElement('static', 'noidnumber', '', get_string('noidnumber'));
|
||||
}
|
||||
|
||||
$options = array('10'=>10, '20'=>20, '100'=>100, '1000'=>1000, '100000'=>100000);
|
||||
$mform->addElement('select', 'previewrows', 'Preview rows', $options); // TODO: localize
|
||||
$mform->setType('previewrows', PARAM_INT);
|
||||
|
@ -30,12 +30,12 @@ require_once($CFG->dirroot.'/grade/lib.php');
|
||||
* Prints all grade items for selection
|
||||
* @input int id - course id
|
||||
*/
|
||||
function print_gradeitem_selections($id, $params = NULL) {
|
||||
function print_gradeitem_selections($id, $params = array()) {
|
||||
global $CFG;
|
||||
// print all items for selections
|
||||
// make this a standard function in lib maybe
|
||||
include_once('grade_export_form.php');
|
||||
$mform = new grade_export_form(qualified_me(), array('id'=>$id));
|
||||
$mform = new grade_export_form(qualified_me(), array('id'=>$id)+$params);
|
||||
$mform->display();
|
||||
|
||||
}
|
||||
|
@ -66,6 +66,6 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print_gradeitem_selections($id);
|
||||
print_gradeitem_selections($id, array('plugin'=>'xmlexport'));
|
||||
print_footer();
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user