$mform->addElement('header', 'general', get_string('gradeitemsinc', 'grades')); // TODO: localize
$id = $this->_customdata['id']; // course id
$mform->addElement('hidden', 'id', $id);
- if ($grade_items = grade_grades::fetch_all(array('courseid'=>$id))) {
+ if ($grade_items = grade_item::fetch_all(array('courseid'=>$id))) {
foreach ($grade_items as $grade_item) {
$element = new HTML_QuickForm_advcheckbox('itemids[]', null, $grade_item->itemname, array('selected'=>'selected'), array(0, $grade_item->id));
$element->setChecked(1);
foreach ($itemids as $iid) {
if ($iid) {
- $params->id = $iid;
+ $params->id = clean_param($iid, PARAM_INT);
$gradeitems[] = new grade_item($params);
}
}
require_once('grade_export_ods.php');
$id = required_param('id', PARAM_INT); // course id
-$itemids = explode(",", required_param('itemids', PARAM_NOTAGS));
+$itemids = explode(",", required_param('itemids', PARAM_RAW));
$feedback = optional_param('feedback', '', PARAM_ALPHA);
// print all the exported data here
require_once($CFG->dirroot.'/grade/export/lib.php');
require_once('grade_export_ods.php');
-$id = required_param('id', PARAM_INT); // course id
-$feedback = optional_param('feedback', '', PARAM_ALPHA);
-
+$id = required_param('id', PARAM_INT); // course id
+$course = get_record('course', 'id', $id);
+$feedback = optional_param('feedback', '', PARAM_ALPHA);
+$action = 'exportods';
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
}
// print the grades on screen for feedbacks
- $course = get_record('course', 'id', $id);
- $action = 'exporttxt';
- print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
$export = new grade_export($id, $data->itemids);
$export->display_grades($feedback);
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
exit;
}
-$course = get_record('course', 'id', $id);
-$action = 'exportods';
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+
print_gradeitem_selections($id);
print_footer();
?>
\ No newline at end of file
require_once('grade_export_txt.php');
$id = required_param('id', PARAM_INT); // course id
-$itemids = explode(",", required_param('itemids', PARAM_NOTAGS));
+$itemids = explode(",", required_param('itemids', PARAM_RAW));
$feedback = optional_param('feedback', '', PARAM_ALPHA);
// print all the exported data here
$mform->addElement('header', 'general', 'Gradeitems to be included'); // TODO: localize
$id = $this->_customdata['id']; // course id
$mform->addElement('hidden', 'id', $id);
- if ($grade_items = grade_grades::fetch_all(array('courseid'=>$id))) {
+ if ($grade_items = grade_item::fetch_all(array('courseid'=>$id))) {
foreach ($grade_items as $grade_item) {
$element = new HTML_QuickForm_advcheckbox('itemids[]', null, $grade_item->itemname, array('selected'=>'selected'), array(0, $grade_item->id));
$element->setChecked(1);
$id = required_param('id', PARAM_INT); // course id
$feedback = optional_param('feedback', '', PARAM_ALPHA);
+$course = get_record('course', 'id', $id);
+$action = 'exporttxt'; // for printing header
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
+ // $itemids consists of ints and ",", will be cleaned in the main export class
if (!is_array($data->itemids)) {
$itemidsurl = $data->itemids;
} else {
$itemidsurl = implode(",",$data->itemids);
}
-
- $course = get_record('course', 'id', $id);
- $action = 'exporttxt';
- print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
$export = new grade_export($id, $data->itemids);
$export->display_grades($feedback);
exit;
}
-
-$course = get_record('course', 'id', $id);
-$action = 'exporttxt';
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+// print the form to choose what grade_items to export
include_once('grade_export_txt_form.php');
$mform = new grade_export_txt_form(qualified_me(), array('id'=>$id));
$mform->display();
-/*
-// print_gradeitem_selections($id);
-// print all items for selections
-// make this a standard function in lib maybe
-if ($grade_items = grade_grades::fetch_all(array('courseid'=>$id))) {
- echo '<form action="index.php" method="post">';
- echo '<div>';
- foreach ($grade_items as $grade_item) {
-
- echo '<br/><input type="checkbox" name="itemids[]" value="'.$grade_item->id.'" checked="checked"/>';
-
- if ($grade_item->itemtype == 'category') {
- // grade categories should be displayed bold
- echo '<b>'.$grade_item->itemname.'</b>';
- } else {
- echo $grade_item->itemname;
- }
- }
- echo '<br/>';
- echo 'tab<input type="radio" name="separator" value="tab"/>';
- echo 'comma<input type="radio" name="separator" value="comma" checked="checked"/>';
- echo '<input type="hidden" name="id" value="'.$id.'"/>';
- echo '<input type="hidden" name="sesskey" value="'.sesskey().'"/>';
- echo '<br/>';
- echo '<input type="submit" value="'.get_string('submit').'" />';
- echo '</div>';
- echo '</form>';
-}
-*/
print_footer();
?>
\ No newline at end of file
require_once('grade_export_xls.php');
$id = required_param('id', PARAM_INT); // course id
-$itemids = explode(",", required_param('itemids', PARAM_NOTAGS));
+$itemids = explode(",", required_param('itemids', PARAM_RAW));
$feedback = optional_param('feedback', '', PARAM_ALPHA);
// print all the exported data here
require_once('grade_export_xls.php');
$id = required_param('id', PARAM_INT); // course id
+$course = get_record('course', 'id', $id);
$feedback = optional_param('feedback', '', PARAM_ALPHA);
+$action = 'exporttxt';
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
}
// print the grades on screen for feedbacks
- $course = get_record('course', 'id', $id);
- $action = 'exporttxt';
- print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
$export = new grade_export($id, $data->itemids);
$export->display_grades($feedback);
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
exit;
}
-$course = get_record('course', 'id', $id);
-$action = 'exportxls';
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+
print_gradeitem_selections($id);
print_footer();
?>
\ No newline at end of file
require_once('grade_export_xml.php');
$id = required_param('id', PARAM_INT); // course id
-$itemids = explode(",", required_param('itemids', PARAM_NOTAGS));
+$itemids = explode(",", required_param('itemids', PARAM_RAW));
$feedback = optional_param('feedback', '', PARAM_ALPHA);
// print all the exported data here
require_once($CFG->dirroot.'/grade/export/lib.php');
require_once('grade_export_xml.php');
-$id = required_param('id', PARAM_INT); // course id
+$id = required_param('id', PARAM_INT); // course id
+$course = get_record('course', 'id', $id);
$feedback = optional_param('feedback', '', PARAM_ALPHA);
+
+$action = 'exportxml';
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
// process post information
if (($data = data_submitted()) && confirm_sesskey()) {
}
// print the grades on screen for feedbacks
- $course = get_record('course', 'id', $id);
- $action = 'exportxml';
- print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
-
+
$export = new grade_export($id, $data->itemids);
$export->display_grades($feedback);
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
exit;
}
-$course = get_record('course', 'id', $id);
-$action = 'exportxml';
-print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+
print_gradeitem_selections($id);
print_footer();
?>
\ No newline at end of file