Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
This class provides the main entry point for other code wishing to get information about files. More...
Public Member Functions | |
get_file_info ($context=NULL, $component=NULL, $filearea=NULL, $itemid=NULL, $filepath=NULL, $filename=NULL) | |
Looks up file_info instance. | |
is_enrolled ($courseid) | |
Check if user is enrolled into the course. | |
Protected Attributes | |
array | $enrolledcourses = null |
cached list of enrolled courses. | |
This class provides the main entry point for other code wishing to get information about files.
The whole file storage for a Moodle site can be seen as a huge virtual tree. The spine of the tree is the tree of contexts (system, course-categories, courses, modules, also users). Then, within each context, there may be any number of file areas, and a file area contains folders and files. The various file_info subclasses return info about the things in this tree. They should be obtained from an instance of this class.
This virtual tree is different for each user depending of his/her current permissions. Some branches such as draft areas are hidden, but accessible.
Always use this abstraction when you need to access module files from core code.
file_browser::get_file_info | ( | $context = NULL, | |
$component = NULL, | |||
$filearea = NULL, | |||
$itemid = NULL, | |||
$filepath = NULL, | |||
$filename = NULL ) |
file_browser::is_enrolled | ( | $courseid | ) |
Check if user is enrolled into the course.
This function keeps a cache of enrolled courses because it may be called multiple times for many courses in one request
int | $courseid |
bool |
|
protected |
cached list of enrolled courses.