mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
regular whitespace cleanup in grade code
This commit is contained in:
parent
e1d2692a73
commit
ba74762bda
21 changed files with 297 additions and 297 deletions
|
@ -25,22 +25,22 @@
|
|||
require_once($CFG->dirroot.'/grade/export/lib.php');
|
||||
|
||||
class grade_export_txt extends grade_export {
|
||||
|
||||
|
||||
var $format = 'txt'; // export format
|
||||
var $separator = "\t"; // default separator
|
||||
|
||||
|
||||
function set_separator($separator) {
|
||||
if ($separator == 'comma') {
|
||||
$this->separator = ",";
|
||||
} else if ($separator == 'tab') {
|
||||
$this->separator = "\t";
|
||||
}
|
||||
$this->separator = "\t";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To be implemented by child classes
|
||||
*/
|
||||
function print_grades($feedback = false) {
|
||||
function print_grades($feedback = false) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
|
@ -49,14 +49,14 @@ class grade_export_txt extends grade_export {
|
|||
if (in_array($this->format, $expplugins)) {
|
||||
$export = true;
|
||||
} else {
|
||||
$export = false;
|
||||
$export = false;
|
||||
}
|
||||
} else {
|
||||
$export = false;
|
||||
$export = false;
|
||||
}
|
||||
|
||||
/// Print header to force download
|
||||
header("Content-Type: application/download\n");
|
||||
|
||||
/// Print header to force download
|
||||
header("Content-Type: application/download\n");
|
||||
$downloadfilename = clean_filename("{$this->course->shortname} $this->strgrades");
|
||||
header("Content-Disposition: attachment; filename=\"$downloadfilename.txt\"");
|
||||
|
||||
|
@ -71,17 +71,17 @@ class grade_export_txt extends grade_export {
|
|||
foreach ($this->columns as $column) {
|
||||
$column = strip_tags($column);
|
||||
echo "{$this->separator}$column";
|
||||
|
||||
/// add a column_feedback column
|
||||
|
||||
/// add a column_feedback column
|
||||
if ($feedback) {
|
||||
echo "{$this->separator}{$column}_feedback";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "{$this->separator}".get_string("total")."\n";
|
||||
|
||||
|
||||
/// Print all the lines of data.
|
||||
foreach ($this->grades as $studentid => $studentgrades) {
|
||||
|
||||
|
||||
$student = $this->students[$studentid];
|
||||
if (empty($this->totals[$student->id])) {
|
||||
$this->totals[$student->id] = '';
|
||||
|
@ -90,12 +90,12 @@ class grade_export_txt extends grade_export {
|
|||
|
||||
foreach ($studentgrades as $gradeitemid => $grade) {
|
||||
$grade = strip_tags($grade);
|
||||
echo "{$this->separator}$grade";
|
||||
|
||||
echo "{$this->separator}$grade";
|
||||
|
||||
if ($feedback) {
|
||||
echo "{$this->separator}".array_shift($this->comments[$student->id]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// if export flag needs to be set
|
||||
/// construct the grade_grades object and update timestamp if CFG flag is set
|
||||
|
||||
|
@ -103,7 +103,7 @@ class grade_export_txt extends grade_export {
|
|||
$params = new object();
|
||||
$params->itemid = $gradeitemid;
|
||||
$params->userid = $studentid;
|
||||
|
||||
|
||||
$grade_grades = new grade_grades($params);
|
||||
$grade_grades->exported = time();
|
||||
// update the time stamp;
|
||||
|
@ -113,7 +113,7 @@ class grade_export_txt extends grade_export {
|
|||
echo "{$this->separator}".$this->totals[$student->id];
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue