Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core\content\export\exportable_items\exportable_filearea Class Reference

The definition of a set of files in a filearea to be exported. More...

Inheritance diagram for core\content\export\exportable_items\exportable_filearea:
core\content\export\exportable_item

Public Member Functions

 __construct (context $context, string $component, string $uservisiblename, string $filearea, int $itemid, ?int $pluginfileitemid=null, string $folderpath='')
 Create a new exportable_item instance.
 
 add_to_archive (zipwriter $archive)
 Add the content to the archive.
 
 get_component ()
 Get the component that this exportable item relates to.
 
 get_context ()
 Get the context that this exportable item is for.
 
 get_user_visible_name ()
 Get the user visible name for the exportable item.
 

Protected Member Functions

 get_filepath_for_file (stored_file $file)
 Get the filepath for the specified stored_file.
 

Static Protected Member Functions

static get_pluginfile_url_for_stored_file (stored_file $file, ?int $pluginfileitemid)
 Get the pluginfile URL for a stored file.
 

Protected Attributes

string $component = null
 The component being exported.
 
context $context = null
 The context associated with this exportable item.
 
string $filearea
 $filearea The file to be exported
 
string $folderpath
 The destination path of the text content.
 
bool int $itemid
 The itemid in the Files API.
 
int $pluginfileitemid
 The itemid to use in the pluginfile URL.
 
string $uservisiblename = null
 The name displayed to the user.
 

Detailed Description

The definition of a set of files in a filearea to be exported.

All files mustbe in a single filearea and itemid combination.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core\content\export\exportable_items\exportable_filearea::__construct ( context $context,
string $component,
string $uservisiblename,
string $filearea,
int $itemid,
?int $pluginfileitemid = null,
string $folderpath = '' )

Create a new exportable_item instance.

If no filearea or itemid is specified the no attempt will be made to export files.

Parameters
context$contextThe context that this content belongs to
string$component
string$uservisiblenameThe name displayed to the user when filtering
string$fileareaThe file area in the Files API where these files are located
int$itemidThe itemid in the Files API where these files are located
null | int$pluginfileitemidThe itemid as used in the Pluginfile URL
string$folderpathAny sub-directory to place files in

Member Function Documentation

◆ add_to_archive()

core\content\export\exportable_items\exportable_filearea::add_to_archive ( zipwriter $archive)

Add the content to the archive.

Parameters
zipwriter$archive

Reimplemented from core\content\export\exportable_item.

◆ get_component()

core\content\export\exportable_item::get_component ( )
inherited

Get the component that this exportable item relates to.

Return values
string

◆ get_context()

core\content\export\exportable_item::get_context ( )
inherited

Get the context that this exportable item is for.

Return values
context

◆ get_filepath_for_file()

core\content\export\exportable_items\exportable_filearea::get_filepath_for_file ( stored_file $file)
protected

Get the filepath for the specified stored_file.

Parameters
stored_file$fileThe file to get a filepath for
Return values
stringThe generated filepath

◆ get_pluginfile_url_for_stored_file()

static core\content\export\exportable_items\exportable_filearea::get_pluginfile_url_for_stored_file ( stored_file $file,
?int $pluginfileitemid )
staticprotected

Get the pluginfile URL for a stored file.

Note: The itemid in the pluginfile may be omitted in some URLs, despite an itemid being present in the database. Equally, the itemid in the URL may not match the itemid in the files table.

The pluginfileitemid argument provided to this function is the variant in the URL, and not the one in the files table.

Parameters
stored_file$fileThe file whose link will be generated
null | int$pluginfileitemidThe itemid of the file in pluginfile URL.

◆ get_user_visible_name()

core\content\export\exportable_item::get_user_visible_name ( )
inherited

Get the user visible name for the exportable item.

Return values
string

The documentation for this class was generated from the following file: