Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
File browsing support class. More...
Public Member Functions | |
copy_to_pathname ($pathname) | |
Copy content of this file to local storage, overriding current file if needed. | |
copy_to_storage ($filerecord) | |
Copy content of this file to local storage, overriding current file if needed. | |
count_non_empty_children ($extensions=' *', $limit=1) | |
Returns the number of children which are either files matching the specified extensions or folders containing at least one such file. | |
create_directory ($newdirname, $userid=NULL) | |
Create new directory, may throw exception - make sure params are valid. | |
create_file_from_pathname ($newfilename, $pathname, $userid=NULL) | |
Create new file from pathname - make sure params are valid. | |
create_file_from_storedfile ($newfilename, $fid, $userid=NULL) | |
Create new file from stored file - make sure params are valid. | |
create_file_from_string ($newfilename, $content, $userid=NULL) | |
Create new file from string - make sure params are valid. | |
delete () | |
Delete file, make sure file is deletable first. | |
get_author () | |
Returns the author name of the file. | |
get_children () | |
Returns list of children. | |
get_filesize () | |
Returns file size in bytes, null for directories. | |
get_imageinfo () | |
Returns width, height and mimetype of the stored image, or false. | |
get_license () | |
Returns the license type of the file. | |
get_mimetype () | |
Returns mimetype. | |
get_non_empty_children ($extensions=' *') | |
Returns list of children which are either files matching the specified extensions or folders that contain at least one such file. | |
get_params () | |
Returns list of standard virtual file/directory identification. | |
get_params_rawencoded () | |
Returns array of url encoded params. | |
get_parent () | |
Returns parent file_info instance. | |
get_readable_fullname () | |
Returns the localised human-readable name of the file together with virtual path. | |
get_sortorder () | |
Returns the sort order of the file. | |
get_source () | |
Returns the source of the file. | |
get_status () | |
Returns file status flag. | |
get_timecreated () | |
Returns time created unix timestamp if known. | |
get_timemodified () | |
Returns time modified unix timestamp if known. | |
get_url ($forcedownload=false, $https=false) | |
Returns file download url. | |
get_visible_name () | |
Returns localised visible name. | |
is_directory () | |
Whether or not this is a directory. | |
is_empty_area () | |
Whether or not this is an empty area. | |
is_external_file () | |
Whether or not this is a external resource. | |
is_readable () | |
Whether or not I can read content of this file or enter directory. | |
is_writable () | |
Whether or not new files or directories can be added. | |
Protected Member Functions | |
build_search_files_sql ($extensions, $prefix=null) | |
Builds SQL sub query (WHERE clause) for selecting files with the specified extensions. | |
Protected Attributes | |
string | $areaonly |
do not show links to parent context/area | |
file_browser | $browser |
File browser instance. | |
context | $context |
File context. | |
int bool | $itemidused |
it's false if itemid is 0 and not included in URL | |
stored_file virtual_root_file | $lf |
stored_file or virtual_root_file instance | |
bool | $readaccess |
allow file reading | |
string | $topvisiblename |
the human readable name of this area | |
string | $urlbase |
the serving script | |
bool | $writeaccess |
allow file write, delee | |
File browsing support class.
|
protectedinherited |
Builds SQL sub query (WHERE clause) for selecting files with the specified extensions.
If $extensions == '*' (any file), the result is array('', array()) otherwise the result is something like array('AND filename ...', array(...))
string | array | $extensions | - either '*' or array of lowercase extensions, i.e. array('.gif','.jpg') |
string | $prefix | prefix for DB table files in the query (empty by default) |
array | of two elements: $sql - sql where clause and $params - array of parameters |
|
inherited |
Copy content of this file to local storage, overriding current file if needed.
string | $pathname | real local full file name |
bool | success |
Reimplemented from file_info.
|
inherited |
Copy content of this file to local storage, overriding current file if needed.
array | stdClass | $filerecord | contains contextid, component, filearea, itemid, filepath, filename and optionally other attributes of the new file |
bool | success |
Reimplemented from file_info.
|
inherited |
Returns the number of children which are either files matching the specified extensions or folders containing at least one such file.
string | array | $extensions,for | example '*' or array('.gif','.jpg') |
int | $limit | stop counting after at least $limit non-empty children are found |
int |
Reimplemented from file_info.
|
inherited |
|
inherited |
|
inherited |
Create new file from stored file - make sure params are valid.
string | $newfilename | name of new file |
int | stored_file | $fid | file id or stored_file of file |
int | $userid | id of author, default $USER->id |
file_info|null | new file's file_info instance or null if failed |
Reimplemented from file_info.
|
inherited |
|
inherited |
Delete file, make sure file is deletable first.
bool | success |
Reimplemented from file_info.
|
inherited |
Returns the author name of the file.
string | author name or null |
Reimplemented from file_info.
|
inherited |
Returns list of children.
array | of file_info instances |
Reimplemented from file_info.
Reimplemented in file_info_area_course_legacy.
|
inherited |
Returns file size in bytes, null for directories.
int | bytes or null if not known |
Reimplemented from file_info.
|
inherited |
Returns width, height and mimetype of the stored image, or false.
array|false |
|
inherited |
Returns the license type of the file.
string | license short name or null |
Reimplemented from file_info.
|
inherited |
|
inherited |
Returns list of children which are either files matching the specified extensions or folders that contain at least one such file.
string | array | $extensions,either | '*' or array of lowercase extensions, i.e. array('.gif','.jpg') |
array | of file_info instances |
Reimplemented from file_info.
Reimplemented in file_info_area_course_legacy.
|
inherited |
Returns list of standard virtual file/directory identification.
The difference from stored_file parameters is that null values are allowed in all fields
array | with keys contextid, component, filearea, itemid, filepath and filename |
Reimplemented from file_info.
|
inherited |
Returns array of url encoded params.
array | with numeric keys |
page_content_file_info::get_parent | ( | ) |
Returns parent file_info instance.
file_info|null | file_info instance or null for root |
Reimplemented from file_info_stored.
|
inherited |
Returns the localised human-readable name of the file together with virtual path.
string |
Reimplemented from file_info.
|
inherited |
|
inherited |
Returns the source of the file.
string | a source url or null |
Reimplemented from file_info.
|
inherited |
Returns file status flag.
int | 0 means file OK, anything else is a problem and file can not be used |
Reimplemented from file_info.
|
inherited |
Returns time created unix timestamp if known.
int | timestamp or null |
Reimplemented from file_info.
|
inherited |
Returns time modified unix timestamp if known.
int | timestamp or null |
Reimplemented from file_info.
|
inherited |
Returns file download url.
bool | $forcedownload | Whether or not force download |
bool | $https | whether or not force https |
string | url |
Reimplemented from file_info.
Reimplemented in file_info_area_course_legacy.
page_content_file_info::get_visible_name | ( | ) |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Whether or not I can read content of this file or enter directory.
bool |
Reimplemented from file_info.
|
inherited |
Whether or not new files or directories can be added.
bool |
Reimplemented from file_info.