Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

reduce length of worksheet name to 31 chars if running under Moodle 1.5

  • Loading branch information...
commit 2a532aa68c6cffa4b78b17d09e5277555e3c3ca8 1 parent 3c4f45c
gbateson authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 mod/hotpot/report/default.php
View
13 mod/hotpot/report/default.php
@@ -625,11 +625,13 @@ function print_excel_report(&$course, &$hotpot, &$tables, &$options) {
// Moodle >= 1.6
require_once("$CFG->libdir/excellib.class.php");
$wb = new MoodleExcelWorkbook("-");
+ $wsnamelimit = 0; // no limit
} else {
// Moodle <= 1.5
require_once("$CFG->libdir/excel/Worksheet.php");
require_once("$CFG->libdir/excel/Workbook.php");
$wb = new Workbook("-");
+ $wsnamelimit = 31; // max length in chars
}
// send HTTP headers
@@ -638,7 +640,16 @@ function print_excel_report(&$course, &$hotpot, &$tables, &$options) {
// create one worksheet for each table
foreach($tables as $table) {
unset($ws);
- $ws = &$wb->add_worksheet(empty($table->caption) ? '' : strip_tags($table->caption));
+ if (empty($table->caption)) {
+ $wsname = '';
+ } else {
+ $wsname = strip_tags($table->caption);
+ if ($wsnamelimit && strlen($wsname) > $wsnamelimit) {
+ $wsname = substr($wsname, -$wsnamelimit); // end of string
+ // $wsname = substr($wsname, 0, $wsnamelimit); // start of string
+ }
+ }
+ $ws = &$wb->add_worksheet($wsname);
$row = 0;
$this->print_excel_head($wb, $ws, $table, $row, $options);
Please sign in to comment.
Something went wrong with that request. Please try again.