some minor cleanup/bug fix

This commit is contained in:
toyomoyo 2007-07-03 06:20:07 +00:00
parent 5b5eb8e6c7
commit 7759d32720
11 changed files with 30 additions and 67 deletions

View File

@ -9,7 +9,7 @@ class grade_export_form extends moodleform {
$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);

View File

@ -121,7 +121,7 @@ class grade_export {
foreach ($itemids as $iid) {
if ($iid) {
$params->id = $iid;
$params->id = clean_param($iid, PARAM_INT);
$gradeitems[] = new grade_item($params);
}
}

View File

@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
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

View File

@ -25,9 +25,11 @@ require_once("../../../config.php");
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()) {
@ -38,9 +40,6 @@ 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);
@ -49,9 +48,7 @@ if (($data = data_submitted()) && confirm_sesskey()) {
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();
?>

View File

@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
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

View File

@ -9,7 +9,7 @@ class grade_export_txt_form extends moodleform {
$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);

View File

@ -27,19 +27,19 @@ require_once('grade_export_txt.php');
$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);
@ -49,42 +49,10 @@ if (($data = data_submitted()) && confirm_sesskey()) {
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();
?>

View File

@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
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

View File

@ -26,8 +26,12 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
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()) {
@ -38,9 +42,6 @@ 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);
@ -49,9 +50,7 @@ if (($data = data_submitted()) && confirm_sesskey()) {
redirect('export.php?id='.$id.'&amp;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();
?>

View File

@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
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

View File

@ -25,8 +25,12 @@ require_once("../../../config.php");
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()) {
@ -38,10 +42,7 @@ 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);
@ -49,9 +50,7 @@ if (($data = data_submitted()) && confirm_sesskey()) {
redirect('export.php?id='.$id.'&amp;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();
?>