Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Attributes | List of all members
virtual_root_file Class Reference

Represents the root directory of an empty file area in the tree navigated by file_browser. More...

Public Member Functions

 __construct ($contextid, $component, $filearea, $itemid)
 Constructor. More...
 
 add_to_curl_request (&$curlrequest, $key)
 adds this file path to a curl request (POST only) More...
 
 archive_file (file_archive $filearch, $archivepath)
 Add file/directory into archive. More...
 
 copy_content_to ($pathname)
 Copy content of file to given pathname. More...
 
 delete ()
 Delete file. More...
 
 extract_to_pathname (file_packer $packer, $pathname)
 Extract file to given file path (real OS filesystem), existing files are overwrited. More...
 
 extract_to_storage (file_packer $packer, $contextid, $component, $filearea, $itemid, $pathbase, $userid=NULL)
 Extract file to given file path (real OS filesystem), existing files are overwrited. More...
 
 get_author ()
 Returns file's author. More...
 
 get_component ()
 Returns file component. More...
 
 get_content ()
 Returns file content as string. More...
 
 get_content_file_handle ()
 Returns file handle - read only mode, no writing allowed into pool files! More...
 
 get_contenthash ()
 Returns sha1 hash code. More...
 
 get_contextid ()
 Returns context ID. More...
 
 get_filearea ()
 Returns file area. More...
 
 get_filename ()
 Returns file name. More...
 
 get_filepath ()
 Returns file path. More...
 
 get_filesize ()
 Returns file size. More...
 
 get_id ()
 Returns ID. More...
 
 get_itemid ()
 Returns file itemid. More...
 
 get_license ()
 Returns license. More...
 
 get_mimetype ()
 Returns mimetype. More...
 
 get_parent_directory ()
 Returns parent directory. More...
 
 get_pathnamehash ()
 Returns path name hash. More...
 
 get_sortorder ()
 Returns file sort order. More...
 
 get_source ()
 Returns file source. More...
 
 get_status ()
 Returns status. More...
 
 get_timecreated ()
 Returns time created. More...
 
 get_timemodified ()
 Returns time modified. More...
 
 get_userid ()
 Returns user ID. More...
 
 is_directory ()
 Whether or not this is a directory. More...
 
 list_files (file_packer $packer)
 List contents of archive. More...
 
 readfile ()
 Dumps file content to page. More...
 

Protected Attributes

string $component
 file component
 
int $contextid
 context id
 
string $filearea
 file area
 
int $itemid
 file itemid
 

Detailed Description

Represents the root directory of an empty file area in the tree navigated by file_browser.

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

Constructor & Destructor Documentation

◆ __construct()

virtual_root_file::__construct (   $contextid,
  $component,
  $filearea,
  $itemid 
)

Constructor.

Parameters
int$contextidcontext ID
string$componentcomponent
string$fileareafile area
int$itemiditem ID

Member Function Documentation

◆ add_to_curl_request()

virtual_root_file::add_to_curl_request ( $curlrequest,
  $key 
)

adds this file path to a curl request (POST only)

Parameters
curl$curlrequestthe curl request object
string$keywhat key to use in the POST request

◆ archive_file()

virtual_root_file::archive_file ( file_archive  $filearch,
  $archivepath 
)

Add file/directory into archive.

Parameters
file_archive$filearchfile archive instance
string$archivepathpathname in archive
Return values
boolsuccess

◆ copy_content_to()

virtual_root_file::copy_content_to (   $pathname)

Copy content of file to given pathname.

Parameters
string$pathnamereal path to new file
Return values
boolsuccess

◆ delete()

virtual_root_file::delete ( )

Delete file.

Return values
success

◆ extract_to_pathname()

virtual_root_file::extract_to_pathname ( file_packer  $packer,
  $pathname 
)

Extract file to given file path (real OS filesystem), existing files are overwrited.

Parameters
file_packer$packerfile packer instance
string$pathnametarget directory
Return values
mixedlist of processed files; false if error

◆ extract_to_storage()

virtual_root_file::extract_to_storage ( file_packer  $packer,
  $contextid,
  $component,
  $filearea,
  $itemid,
  $pathbase,
  $userid = NULL 
)

Extract file to given file path (real OS filesystem), existing files are overwrited.

Parameters
file_packer$packerfile packer instance
int$contextidcontext ID
string$componentcomponent
string$fileareafile area
int$itemiditem ID
string$pathbasepath base
int$useriduser ID
Return values
mixedlist of processed files; false if error

◆ get_author()

virtual_root_file::get_author ( )

Returns file's author.

Return values
string

◆ get_component()

virtual_root_file::get_component ( )

Returns file component.

Return values
stringcomponent

◆ get_content()

virtual_root_file::get_content ( )

Returns file content as string.

Return values
stringcontent

◆ get_content_file_handle()

virtual_root_file::get_content_file_handle ( )

Returns file handle - read only mode, no writing allowed into pool files!

Return values
resourcefile handle

◆ get_contenthash()

virtual_root_file::get_contenthash ( )

Returns sha1 hash code.

Return values
string

◆ get_contextid()

virtual_root_file::get_contextid ( )

Returns context ID.

Return values
intcontext ID

◆ get_filearea()

virtual_root_file::get_filearea ( )

Returns file area.

Return values
stringfilearea

◆ get_filename()

virtual_root_file::get_filename ( )

Returns file name.

Return values
stringfilename

◆ get_filepath()

virtual_root_file::get_filepath ( )

Returns file path.

Return values
stringfilepath

◆ get_filesize()

virtual_root_file::get_filesize ( )

Returns file size.

Return values
intfilesize

◆ get_id()

virtual_root_file::get_id ( )

Returns ID.

Return values
int

◆ get_itemid()

virtual_root_file::get_itemid ( )

Returns file itemid.

Return values
intitemid

◆ get_license()

virtual_root_file::get_license ( )

Returns license.

Return values
string

◆ get_mimetype()

virtual_root_file::get_mimetype ( )

Returns mimetype.

Return values
stringmimetype

◆ get_parent_directory()

virtual_root_file::get_parent_directory ( )

Returns parent directory.

Return values
stored_file

◆ get_pathnamehash()

virtual_root_file::get_pathnamehash ( )

Returns path name hash.

Return values
string

◆ get_sortorder()

virtual_root_file::get_sortorder ( )

Returns file sort order.

Return values
int

◆ get_source()

virtual_root_file::get_source ( )

Returns file source.

Return values
string

◆ get_status()

virtual_root_file::get_status ( )

Returns status.

Return values
int

◆ get_timecreated()

virtual_root_file::get_timecreated ( )

Returns time created.

Return values
int

◆ get_timemodified()

virtual_root_file::get_timemodified ( )

Returns time modified.

Return values
int

◆ get_userid()

virtual_root_file::get_userid ( )

Returns user ID.

Return values
intuserid

◆ is_directory()

virtual_root_file::is_directory ( )

Whether or not this is a directory.

Return values
bool

◆ list_files()

virtual_root_file::list_files ( file_packer  $packer)

List contents of archive.

Parameters
file_packer$packerfile packer instance
Return values
arrayof file infos

◆ readfile()

virtual_root_file::readfile ( )

Dumps file content to page.

Return values
resourcefile handle

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