mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
some minor cleanup/bug fix
This commit is contained in:
parent
5b5eb8e6c7
commit
7759d32720
11 changed files with 30 additions and 67 deletions
|
@ -9,7 +9,7 @@ class grade_export_form extends moodleform {
|
||||||
$mform->addElement('header', 'general', get_string('gradeitemsinc', 'grades')); // TODO: localize
|
$mform->addElement('header', 'general', get_string('gradeitemsinc', 'grades')); // TODO: localize
|
||||||
$id = $this->_customdata['id']; // course id
|
$id = $this->_customdata['id']; // course id
|
||||||
$mform->addElement('hidden', 'id', $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) {
|
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 = new HTML_QuickForm_advcheckbox('itemids[]', null, $grade_item->itemname, array('selected'=>'selected'), array(0, $grade_item->id));
|
||||||
$element->setChecked(1);
|
$element->setChecked(1);
|
||||||
|
|
|
@ -121,7 +121,7 @@ class grade_export {
|
||||||
foreach ($itemids as $iid) {
|
foreach ($itemids as $iid) {
|
||||||
|
|
||||||
if ($iid) {
|
if ($iid) {
|
||||||
$params->id = $iid;
|
$params->id = clean_param($iid, PARAM_INT);
|
||||||
$gradeitems[] = new grade_item($params);
|
$gradeitems[] = new grade_item($params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||||
require_once('grade_export_ods.php');
|
require_once('grade_export_ods.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT); // course id
|
$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);
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||||
|
|
||||||
// print all the exported data here
|
// print all the exported data here
|
||||||
|
|
|
@ -26,8 +26,10 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||||
require_once('grade_export_ods.php');
|
require_once('grade_export_ods.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);
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||||
|
$action = 'exportods';
|
||||||
|
print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
|
||||||
// process post information
|
// process post information
|
||||||
if (($data = data_submitted()) && confirm_sesskey()) {
|
if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
|
|
||||||
|
@ -38,9 +40,6 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// print the grades on screen for feedbacks
|
// 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 = new grade_export($id, $data->itemids);
|
||||||
$export->display_grades($feedback);
|
$export->display_grades($feedback);
|
||||||
|
@ -49,9 +48,7 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
|
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
|
||||||
exit;
|
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_gradeitem_selections($id);
|
||||||
print_footer();
|
print_footer();
|
||||||
?>
|
?>
|
|
@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||||
require_once('grade_export_txt.php');
|
require_once('grade_export_txt.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT); // course id
|
$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);
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||||
|
|
||||||
// print all the exported data here
|
// print all the exported data here
|
||||||
|
|
|
@ -9,7 +9,7 @@ class grade_export_txt_form extends moodleform {
|
||||||
$mform->addElement('header', 'general', 'Gradeitems to be included'); // TODO: localize
|
$mform->addElement('header', 'general', 'Gradeitems to be included'); // TODO: localize
|
||||||
$id = $this->_customdata['id']; // course id
|
$id = $this->_customdata['id']; // course id
|
||||||
$mform->addElement('hidden', 'id', $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) {
|
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 = new HTML_QuickForm_advcheckbox('itemids[]', null, $grade_item->itemname, array('selected'=>'selected'), array(0, $grade_item->id));
|
||||||
$element->setChecked(1);
|
$element->setChecked(1);
|
||||||
|
|
|
@ -27,20 +27,20 @@ require_once('grade_export_txt.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT); // course id
|
$id = required_param('id', PARAM_INT); // course id
|
||||||
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
$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
|
// process post information
|
||||||
if (($data = data_submitted()) && confirm_sesskey()) {
|
if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
|
|
||||||
|
// $itemids consists of ints and ",", will be cleaned in the main export class
|
||||||
if (!is_array($data->itemids)) {
|
if (!is_array($data->itemids)) {
|
||||||
$itemidsurl = $data->itemids;
|
$itemidsurl = $data->itemids;
|
||||||
} else {
|
} else {
|
||||||
$itemidsurl = implode(",",$data->itemids);
|
$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 = new grade_export($id, $data->itemids);
|
||||||
$export->display_grades($feedback);
|
$export->display_grades($feedback);
|
||||||
|
|
||||||
|
@ -49,42 +49,10 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print the form to choose what grade_items to export
|
||||||
$course = get_record('course', 'id', $id);
|
|
||||||
$action = 'exporttxt';
|
|
||||||
print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
|
|
||||||
include_once('grade_export_txt_form.php');
|
include_once('grade_export_txt_form.php');
|
||||||
$mform = new grade_export_txt_form(qualified_me(), array('id'=>$id));
|
$mform = new grade_export_txt_form(qualified_me(), array('id'=>$id));
|
||||||
$mform->display();
|
$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();
|
print_footer();
|
||||||
?>
|
?>
|
|
@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||||
require_once('grade_export_xls.php');
|
require_once('grade_export_xls.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT); // course id
|
$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);
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||||
|
|
||||||
// print all the exported data here
|
// print all the exported data here
|
||||||
|
|
|
@ -26,8 +26,12 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||||
require_once('grade_export_xls.php');
|
require_once('grade_export_xls.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);
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||||
|
|
||||||
|
$action = 'exporttxt';
|
||||||
|
print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
|
||||||
|
|
||||||
// process post information
|
// process post information
|
||||||
if (($data = data_submitted()) && confirm_sesskey()) {
|
if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
|
|
||||||
|
@ -38,9 +42,6 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// print the grades on screen for feedbacks
|
// 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 = new grade_export($id, $data->itemids);
|
||||||
$export->display_grades($feedback);
|
$export->display_grades($feedback);
|
||||||
|
@ -49,9 +50,7 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
|
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
|
||||||
exit;
|
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_gradeitem_selections($id);
|
||||||
print_footer();
|
print_footer();
|
||||||
?>
|
?>
|
|
@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||||
require_once('grade_export_xml.php');
|
require_once('grade_export_xml.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT); // course id
|
$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);
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||||
|
|
||||||
// print all the exported data here
|
// print all the exported data here
|
||||||
|
|
|
@ -26,8 +26,12 @@ require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||||
require_once('grade_export_xml.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);
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||||
|
|
||||||
|
$action = 'exportxml';
|
||||||
|
print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
|
||||||
|
|
||||||
// process post information
|
// process post information
|
||||||
if (($data = data_submitted()) && confirm_sesskey()) {
|
if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
|
|
||||||
|
@ -38,9 +42,6 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// print the grades on screen for feedbacks
|
// 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 = new grade_export($id, $data->itemids);
|
||||||
$export->display_grades($feedback);
|
$export->display_grades($feedback);
|
||||||
|
@ -49,9 +50,7 @@ if (($data = data_submitted()) && confirm_sesskey()) {
|
||||||
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
|
redirect('export.php?id='.$id.'&itemids='.$itemidsurl);
|
||||||
exit;
|
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_gradeitem_selections($id);
|
||||||
print_footer();
|
print_footer();
|
||||||
?>
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue