Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

(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

param: Worksheet[] $worksheets
return: FileSystemHelper

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

param: Worksheet[] $worksheets
return: FileSystemHelper

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

param: Worksheet[] $worksheets
return: FileSystemHelper

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

param: StyleManager $styleManager
return: FileSystemHelper

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

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