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.

Exported Item.

Copyright: 2020 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 198 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

exported_item:: (12 methods):
  __construct()
  set_title()
  add_file()
  add_files()
  set_content()
  get_content()
  get_title()
  get_template_data()
  get_all_files()
  get_content_files()
  get_noncontent_files()
  has_any_data()


Class: exported_item  - X-Ref

This class describes the files which were exported, and any text content that those files were contained in.

__construct(array $files = [])   X-Ref
Constructor for the exported_item.

param: array $files A list of all files which were exported

set_title(string $title)   X-Ref
Set a title for this exported item.

param: string $title

add_file(string $relativefilepath, bool $incontent = false, ?string $url = null)   X-Ref
Add a file to the list of exported files.

param: string $relativefilepath The path to the content relative to the exported context
param: bool $incontent Whether this file is included within the content
param: null|string $url The URL to use of the live file where the file could not be stored in the archive

add_files(array $files, bool $incontent = false)   X-Ref
Add a list of files to the list of exported files.

param: string[] $files The path to the content relative to the exported context
param: bool $incontent Whether this file is included within the content

set_content(string $content)   X-Ref
Set the rewritten content.

param: string $content

get_content()   X-Ref
Fetch the rewritten content.

return: string

get_title()   X-Ref
Get a short, descriptive name associated with the exported content, if one is avaiable.

return: null|string

get_template_data()   X-Ref
Get all template data for this exported item.

return: stdClass

get_all_files()   X-Ref
Get a list of all files in the exported item.

return: array

get_content_files()   X-Ref
Get a list of all files present in the content.

That is those files which were exported, and which are referenced in some fashion.
These files typically do not need to be listed separately.

return: array

get_noncontent_files()   X-Ref
Get all files which are not already referenced in the content.

These files will typically be displayed in a separate list.

return: array

has_any_data()   X-Ref
Check whether the exported_item includes any data.

return: bool