Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

(no description)

File Size: 229 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Sample:: (14 methods):
  isCli()
  getScriptFilename()
  isIndex()
  getPageTitle()
  getPageHeading()
  getSamples()
  write()
  getTemporaryFolder()
  getFilename()
  getTemporaryFilename()
  log()
  logEndingNotes()
  logWrite()
  logRead()


Class: Sample  - X-Ref

Helper class to be used in sample code.

isCli()   X-Ref
Returns whether we run on CLI or browser.

return: bool

getScriptFilename()   X-Ref
Return the filename currently being executed.

return: string

isIndex()   X-Ref
Whether we are executing the index page.

return: bool

getPageTitle()   X-Ref
Return the page title.

return: string

getPageHeading()   X-Ref
Return the page heading.

return: string

getSamples()   X-Ref
Returns an array of all known samples.

return: string[] [$name => $path]

write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx', 'Xls'])   X-Ref
Write documents.

param: string $filename
param: string[] $writers

getTemporaryFolder()   X-Ref
Returns the temporary directory and make sure it exists.

return: string

getFilename($filename, $extension = 'xlsx')   X-Ref
Returns the filename that should be used for sample output.

param: string $filename
param: string $extension
return: string

getTemporaryFilename($extension = 'xlsx')   X-Ref
Return a random temporary file name.

param: string $extension
return: string

log($message)   X-Ref
No description

logEndingNotes()   X-Ref
Log ending notes.


logWrite(IWriter $writer, $path, $callStartTime)   X-Ref
Log a line about the write operation.

param: string $path
param: float $callStartTime

logRead($format, $path, $callStartTime)   X-Ref
Log a line about the read operation.

param: string $format
param: string $path
param: float $callStartTime