diff --git a/lib.php b/lib.php index d913e59..7156dee 100644 --- a/lib.php +++ b/lib.php @@ -877,13 +877,13 @@ function customcert_generate_report_file($customcert, $users, $type) { $filename = clean_filename($COURSE->shortname . ' ' . rtrim($customcert->name, '.') . '.' . $type); - // Send HTTP headers + // Send HTTP headers. $workbook->send($filename); - // Creating the first worksheet + // Creating the first worksheet. $myxls = $workbook->add_worksheet(get_string('report', 'customcert')); - // Print names of all the fields + // Print names of all the fields. $myxls->write_string(0, 0, get_string('lastname')); $myxls->write_string(0, 1, get_string('firstname')); $myxls->write_string(0, 2, get_string('idnumber')); @@ -891,7 +891,7 @@ function customcert_generate_report_file($customcert, $users, $type) { $myxls->write_string(0, 4, get_string('receiveddate', 'customcert')); $myxls->write_string(0, 5, get_string('code', 'customcert')); - // Generate the data for the body of the spreadsheet + // Generate the data for the body of the spreadsheet. $i = 0; $row = 1; if ($users) { @@ -912,6 +912,6 @@ function customcert_generate_report_file($customcert, $users, $type) { $row++; } } - // Close the workbook + // Close the workbook. $workbook->close(); } diff --git a/report.php b/report.php index d9c6a4c..844e713 100644 --- a/report.php +++ b/report.php @@ -16,7 +16,7 @@ // along with Moodle. If not, see . /** - * Handles viewing a customcert. + * Handles viewing a report that shows who has received a customcert. * * @package mod_customcert * @copyright Mark Nelson @@ -62,10 +62,10 @@ if ($download) { // Create the table for the users. $table = new html_table(); -$table->width = '95%'; -$table->tablealign = 'center'; +$table->attributes['class'] = 'generaltable centre'; +$table->attributes['style'] = 'width: 95%;'; $table->head = array(get_string('awardedto', 'customcert'), get_string('receiveddate', 'customcert'), get_string('code', 'customcert')); -$table->align = array('left', 'left', 'center', 'center'); +$table->align = array('left', 'left', 'center'); foreach ($users as $user) { $name = $OUTPUT->user_picture($user) . fullname($user); $date = userdate($user->timecreated); @@ -75,7 +75,7 @@ foreach ($users as $user) { // Create table to store buttons. $tablebutton = new html_table(); -$tablebutton->attributes['class'] = 'downloadreport'; +$tablebutton->attributes['class'] = 'centre'; $btndownloadods = $OUTPUT->single_button(new moodle_url('report.php', array('id' => $cm->id, 'download' => 'ods')), get_string("downloadods")); $btndownloadxls = $OUTPUT->single_button(new moodle_url('report.php', array('id' => $cm->id, 'download' => 'xls')), get_string("downloadexcel")); $tablebutton->data[] = array($btndownloadods, $btndownloadxls); diff --git a/styles.css b/styles.css index ea1a624..e054eb3 100644 --- a/styles.css +++ b/styles.css @@ -1,3 +1,8 @@ #page-mod-customcert-edit .deletebutton { text-align:right; } + +#page-mod-customcert-report .centre { + margin-left: auto; + margin-right: auto; +}