Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

Utility class for browsing of curse category files.

Copyright: 2008 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 301 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

file_info_context_coursecat:: (12 methods):
  __construct()
  get_file_info()
  get_area_coursecat_description()
  get_visible_name()
  is_writable()
  is_directory()
  get_children()
  get_courses()
  get_categories()
  get_child_course()
  count_non_empty_children()
  get_parent()


Class: file_info_context_coursecat  - X-Ref

Represents a course category context in the tree navigated by {@link file_browser}.

__construct($browser, $context, $category)   X-Ref
Constructor

param: file_browser $browser file browser instance
param: stdClass $context context object
param: stdClass $category category object

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: fileinfo|null

get_area_coursecat_description($itemid, $filepath, $filename)   X-Ref
Return a file from course category description area

param: int $itemid item ID
param: string $filepath file path
param: string $filename file name
return: fileinfo|null

get_visible_name()   X-Ref
Returns localised visible name.

return: string

is_writable()   X-Ref
Whether or not new files or directories can be added

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_courses($hiddencats)   X-Ref
List of courses in this category and in hidden subcategories

param: array $hiddencats list of categories that are hidden from current user and returned by {@link get_categories()}
return: array list of courses

get_categories()   X-Ref
Finds accessible and non-accessible direct subcategories

return: array [$coursecats, $hiddencats] - child categories that are visible to the current user and not visible

get_child_course($course)   X-Ref
Returns the file info element for a given course or null if course is not accessible

param: stdClass $course may contain context fields for preloading
return: file_info_context_course|null

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 fileinfo instance or null for root directory