mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +02:00
added code to write back timestamp
This commit is contained in:
parent
2df712352d
commit
1b07462560
7 changed files with 206 additions and 12 deletions
15
grade/export/txt/export.php
Executable file
15
grade/export/txt/export.php
Executable file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
require_once("../../../config.php");
|
||||
require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||
require_once('grade_export_txt.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$itemids = required_param('itemids', PARAM_NOTAGS);
|
||||
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||
|
||||
// print all the exported data here
|
||||
$export = new grade_export_txt($id, $itemids);
|
||||
$export->print_grades($feedback);
|
||||
|
||||
?>
|
|
@ -31,10 +31,10 @@ class grade_export_txt extends grade_export {
|
|||
/**
|
||||
* To be implemented by child classes
|
||||
*/
|
||||
function print_grades($feedback = false;) {
|
||||
function print_grades($feedback = false) {
|
||||
|
||||
/// Print header to force download
|
||||
|
||||
global $CFG;
|
||||
header("Content-Type: application/download\n");
|
||||
$downloadfilename = clean_filename("$this->course->shortname $this->strgrades");
|
||||
header("Content-Disposition: attachment; filename=\"$downloadfilename.txt\"");
|
||||
|
@ -71,7 +71,27 @@ class grade_export_txt extends grade_export {
|
|||
|
||||
if ($feedback) {
|
||||
echo "\t".array_shift($this->comments[$student->id]);
|
||||
}
|
||||
}
|
||||
|
||||
/// if export flag needs to be set
|
||||
/// construct the grade_grades_final object and update timestamp if CFG flag is set
|
||||
|
||||
if ($expplugins = explode(",", get_config($CFG->gradeexport))) {
|
||||
if (in_array($this->format, $expplugins)) {
|
||||
$params->idnumber = $this->idnumber;
|
||||
// get the grade item
|
||||
$gradeitem = new grade_item($params);
|
||||
|
||||
unset($params);
|
||||
$params->itemid = $gradeitem->id;
|
||||
$params->userid = $studentid;
|
||||
|
||||
$grade_grades_final = new grade_grades_final($params);
|
||||
$grade_grades_final->exported = time();
|
||||
// update the time stamp;
|
||||
$grade_grades_final->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "\t".$this->totals[$student->id];
|
||||
echo "\n";
|
||||
|
@ -81,4 +101,4 @@ class grade_export_txt extends grade_export {
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
46
grade/export/txt/index.php
Executable file
46
grade/export/txt/index.php
Executable file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 2001-2003 Martin Dougiamas http://dougiamas.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
require_once("../../../config.php");
|
||||
require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||
require_once('grade_export_txt.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
||||
|
||||
// process post information
|
||||
if ($data = data_submitted() && confirm_sesskey()) {
|
||||
$itemids = implode(",", $data->itemids);
|
||||
// this redirect should trigger a download prompt
|
||||
redirect('export.php?id='.$id.'&itemids='.$itemids);
|
||||
|
||||
// print the grades on screen for feedbacks
|
||||
print_header();
|
||||
$export = new grade_export($id, $itemids);
|
||||
$export->display_grades($feedback);
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
print_gradeitem_selections($id);
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue