Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400]

(no description)

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

Defines 1 class


Class: FileSystemHelper  - X-Ref

Class FileSystemHelper
This class provides helper functions to help with the file system operations
like files/folders creation & deletion for XLSX files

__construct($baseFolderPath, $zipHelper, $escaper)   X-Ref

param: string $baseFolderPath The path of the base folder where all the I/O can occur
param: ZipHelper $zipHelper Helper to perform tasks with Zip archive
param: \Box\Spout\Common\Helper\Escaper\XLSX $escaper Used to escape XML data

getRootFolder()   X-Ref

return: string

getXlFolder()   X-Ref

return: string

getXlWorksheetsFolder()   X-Ref

return: string

createBaseFilesAndFolders()   X-Ref
Creates all the folders needed to create a XLSX file, as well as the files that won't change.

return: void

createRootFolder()   X-Ref
Creates the folder that will be used as root

return: FileSystemHelper

createRelsFolderAndFile()   X-Ref
Creates the "_rels" folder under the root folder as well as the ".rels" file in it

return: FileSystemHelper

createRelsFile()   X-Ref
Creates the ".rels" file under the "_rels" folder (under root)

return: FileSystemHelper

createDocPropsFolderAndFiles()   X-Ref
Creates the "docProps" folder under the root folder as well as the "app.xml" and "core.xml" files in it

return: FileSystemHelper

createAppXmlFile()   X-Ref
Creates the "app.xml" file under the "docProps" folder

return: FileSystemHelper

createCoreXmlFile()   X-Ref
Creates the "core.xml" file under the "docProps" folder

return: FileSystemHelper

createXlFolderAndSubFolders()   X-Ref
Creates the "xl" folder under the root folder as well as its subfolders

return: FileSystemHelper

createXlRelsFolder()   X-Ref
Creates the "_rels" folder under the "xl" folder

return: FileSystemHelper

createXlWorksheetsFolder()   X-Ref
Creates the "worksheets" folder under the "xl" folder

return: FileSystemHelper

createContentTypesFile($worksheets)   X-Ref
Creates the "[Content_Types].xml" file under the root folder

return: FileSystemHelper
param: Worksheet[] $worksheets

createWorkbookFile($worksheets)   X-Ref
Creates the "workbook.xml" file under the "xl" folder

return: FileSystemHelper
param: Worksheet[] $worksheets

createWorkbookRelsFile($worksheets)   X-Ref
Creates the "workbook.xml.res" file under the "xl/_res" folder

return: FileSystemHelper
param: Worksheet[] $worksheets

createStylesFile($styleManager)   X-Ref
Creates the "styles.xml" file under the "xl" folder

return: FileSystemHelper
param: StyleManager $styleManager

zipRootFolderAndCopyToStream($streamPointer)   X-Ref
Zips the root folder and streams the contents of the zip into the given stream

return: void
param: resource $streamPointer Pointer to the stream to copy the zip