Utility class for browsing of module files.
Copyright: | 2008 Petr Skoda (http://skodak.org) |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 347 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
file_info_context_module:: (13 methods):
__construct()
get_file_info()
get_area_intro()
get_area_backup()
get_visible_name()
is_writable()
is_empty_area()
is_directory()
get_children()
get_filtered_children()
get_non_empty_children()
count_non_empty_children()
get_parent()
Class: file_info_context_module - X-Ref
Represents a module context in the tree navigated by {@link file_browser}.__construct($browser, $context, $course, $cm, $modname) X-Ref |
Constructor param: file_browser $browser file browser instance param: stdClass $context context object param: stdClass $course course object param: stdClass $cm course module object param: string $modname module name |
get_file_info($component, $filearea, $itemid, $filepath, $filename) X-Ref |
Return information about this specific context level param: string $component component param: string $filearea file area param: int $itemid item ID param: string $filepath file path param: string $filename file name return: file_info|null |
get_area_intro($itemid, $filepath, $filename) X-Ref |
Get a file from module intro area param: int $itemid item ID param: string $filepath file path param: string $filename file name return: file_info|null |
get_area_backup($itemid, $filepath, $filename) X-Ref |
Get a file from module backup area param: int $itemid item ID param: string $filepath file path param: string $filename file name return: file_info|null |
get_visible_name() X-Ref |
Returns localised visible name. return: string |
is_writable() X-Ref |
Whether or not files or directories can be added return: bool |
is_empty_area() X-Ref |
Whether or not this is an emtpy area return: bool |
is_directory() X-Ref |
Whether or not this is a directory return: bool |
get_children() X-Ref |
Returns list of children. return: array of file_info instances |
get_filtered_children($extensions = '*', $countonly = false, $returnemptyfolders = false) X-Ref |
Help function to return files matching extensions or their count param: string|array $extensions, either '*' or array of lowercase extensions, i.e. array('.gif','.jpg') param: bool|int $countonly if false returns the children, if an int returns just the param: bool $returnemptyfolders if true returns items that don't have matching files inside return: array|int array of file_info instances or the count |
get_non_empty_children($extensions = '*') X-Ref |
Returns list of children which are either files matching the specified extensions or folders that contain at least one such file. param: string|array $extensions either '*' or array of lowercase extensions, i.e. array('.gif','.jpg') return: array of file_info instances |
count_non_empty_children($extensions = '*', $limit = 1) X-Ref |
Returns the number of children which are either files matching the specified extensions or folders containing at least one such file. param: string|array $extensions for example '*' or array('.gif','.jpg') param: int $limit stop counting after at least $limit non-empty children are found return: int |
get_parent() X-Ref |
Returns parent file_info instance return: file_info|null file_info or null for root |