Skip to content

Commit

Permalink
MDL-56046 dataformat: changes to docs, upgrade.txt and error message
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Jun 27, 2017
1 parent 7ad2822 commit e0ee37e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dataformat/json/classes/writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class writer extends \core\dataformat\base {
/** @var $extension */
public $extension = ".json";

/** @var $hasstarted */
/** @var $sheetstarted */
public $sheetstarted = false;

/** @var $sheetdatadded */
Expand Down
6 changes: 3 additions & 3 deletions dataformat/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ information provided here is intended especially for developers.
=== 3.4 ===

* In order to allow multiple sheets in an exported file the functions write_header() and write_footer() have
been removed from core dataformats plugins and have been replaced.
- write_header() has been split into the two functions start_output() and start_sheet().
- write_footer() has been split into the two functions close_output() and close_sheet().
been removed from core dataformat plugins and have been replaced.
- write_header() has been replaced with the two functions start_output() and start_sheet().
- write_footer() has been replaced with the two functions close_output() and close_sheet().
For backwards compatibility write_header() and write_footer() will continue to work but if used will
trigger the function error_log().

Expand Down
4 changes: 2 additions & 2 deletions lib/dataformatlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function download_as_dataformat($filename, $dataformat, $columns, $iterator, $ca
$format->send_http_headers();
// This exists to support all dataformats - see MDL-56046.
if (method_exists($format, 'write_header')) {
error_log('The function write_header() does not support multiple tables. In order to support multiple tables you ' .
error_log('The function write_header() does not support multiple sheets. In order to support multiple sheets you ' .
'must implement start_output() and start_sheet() and remove write_header() in your dataformat.');
$format->write_header($columns);
} else {
Expand All @@ -77,7 +77,7 @@ function download_as_dataformat($filename, $dataformat, $columns, $iterator, $ca
}
// This exists to support all dataformats - see MDL-56046.
if (method_exists($format, 'write_footer')) {
error_log('The function write_footer() does not support multiple tables. In order to support multiple tables you ' .
error_log('The function write_footer() does not support multiple sheets. In order to support multiple sheets you ' .
'must implement close_sheet() and close_output() and remove write_footer() in your dataformat.');
$format->write_footer($columns);
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/tablelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ public function start_table($sheettitle) {
public function output_headers($headers) {
$this->columns = $headers;
if (method_exists($this->dataformat, 'write_header')) {
error_log('The function write_header() does not support multiple tables. In order to support multiple tables you ' .
error_log('The function write_header() does not support multiple sheets. In order to support multiple sheets you ' .
'must implement start_output() and start_sheet() and remove write_header() in your dataformat.');
$this->dataformat->write_header($headers);
} else {
Expand All @@ -1797,7 +1797,7 @@ public function add_data($row) {
*/
public function finish_table() {
if (method_exists($this->dataformat, 'write_footer')) {
error_log('The function write_footer() does not support multiple tables. In order to support multiple tables you ' .
error_log('The function write_footer() does not support multiple sheets. In order to support multiple sheets you ' .
'must implement close_sheet() and close_output() and remove write_footer() in your dataformat.');
$this->dataformat->write_footer($this->columns);
} else {
Expand Down

0 comments on commit e0ee37e

Please sign in to comment.