Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

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: 327 lines (12 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