Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
core\content\export\exportable_items\exportable_stored_file Class Reference

An object used to represent content which can be served. More...

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

Public Member Functions

 __construct (context $context, string $component, string $uservisiblename, stored_file $file, ?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.
 

Static Public Member Functions

static create_from_area_params (context $context, string $component, string $filearea, ?int $itemid, ?int $pluginfileitemid=null, string $folderpath='')
 Create a set of exportable_items from a set of area paramaters as passed to get_areas_files().
 

Protected Member Functions

 get_filepath_for_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.
 
stored_file $file
 The file to be exported.
 
string $folderpath
 The destination path of the text content.
 
int $pluginfileitemid
 The itemid to use in the pluginfile URL.
 
string $uservisiblename = null
 The name displayed to the user.
 

Detailed Description

An object used to represent content which can be served.

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

Constructor & Destructor Documentation

◆ __construct()

core\content\export\exportable_items\exportable_stored_file::__construct ( context $context,
string $component,
string $uservisiblename,
stored_file $file,
?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
stored_file$file
null | int$pluginfileitemidThe itemid as used in the pluginfile URL. If no itemid is used, then a null value can be provided
string$folderpathAny sub-directory to place files in

Member Function Documentation

◆ add_to_archive()

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

Add the content to the archive.

Parameters
zipwriter$archive

Reimplemented from core\content\export\exportable_item.

◆ create_from_area_params()

static core\content\export\exportable_items\exportable_stored_file::create_from_area_params ( context $context,
string $component,
string $filearea,
?int $itemid,
?int $pluginfileitemid = null,
string $folderpath = '' )
static

Create a set of exportable_items from a set of area paramaters as passed to get_areas_files().

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$filearea
null | int$itemid
null | int$pluginfileitemidThe itemid as used in the pluginfile URL. If no itemid is used, then a null value can be provided
string$folderpathAny sub-directory to place files in
Return values
array

◆ 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_stored_file::get_filepath_for_file ( )
protected

Get the filepath for the specified stored_file.

Return values
string

◆ get_pluginfile_url_for_stored_file()

static core\content\export\exportable_items\exportable_stored_file::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: