Exporting Testing Dates Along with Grades to Excel

Exporting Testing Dates Along with Grades to Excel

by Kyle Claypool -
Number of replies: 0
Hi, I've got a client who needs to keep track of grades as well as dates (for certification that expires) and would like all that information to be exportable into Excel using the built-in function. I'm running v. 1.6, and I've isolated the code in the lib.php file that needs to be edited, but don't know enough about how the data is structured to be able to make this change myself. Starting on line 1357:

/// Print names of all the fields

$myxls->write_string(0,0,get_string("firstname"));
$myxls->write_string(0,1,get_string("lastname"));
$myxls->write_string(0,2,get_string("idnumber"));
$myxls->write_string(0,3,get_string("institution"));
$myxls->write_string(0,4,get_string("department"));
$myxls->write_string(0,5,get_string("email"));
$pos=6;
foreach ($item_order as $order => $assignment) {
$myxls->write_string(0, $pos++, strip_tags($assignment->assignment));
}

$myxls->write_string(0,$pos,get_string("total"));


/// Print all the lines of data.

$i = 0;
foreach ($grades as $studentid => $studentgrades) {
$i++;
$student = $students[$studentid];
if (empty($totals[$student->id])) {
$totals[$student->id] = '';
}

$myxls->write_string($i,0,$student->firstname);
$myxls->write_string($i,1,$student->lastname);
$myxls->write_string($i,2,$student->idnumber);
$myxls->write_string($i,3,$student->institution);
$myxls->write_string($i,4,$student->department);
$myxls->write_string($i,5,$student->email);
$j=6;
foreach ($item_order as $order=> $assignment) {
$grade = strip_tags($grades_by_student[$studentid][$assignment->category][$assignment->assignment]['grade']);
if (is_numeric($grade)) {
$myxls->write_number($i,$j++,strip_tags($grade));
}
else {
$myxls->write_string($i,$j++,strip_tags($grade));
}
}
$myxls->write_number($i,$j,$grades_by_student[$studentid]['student_data']['points']);
}

$workbook->close();

exit;

Any help you can give would be much appreciated!
Oh, and I've got GradebookPlus installed, so if there is some way to show the date of a grade even if it is just changed directly by the admin, that would be ideal.

Thanks,
Kyle Claypool