See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 403]
This plugin is used to access files on server file system
Copyright: | 2010 Dongsheng Cai {@link http://dongsheng.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 859 lines (32 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
repository_filesystem:: (31 methods):
__construct()
get_listing()
search()
build_breadcrumb()
build_node()
build_node_path()
explode_node_path()
check_login()
print_login()
global_search()
get_file()
get_file_source_info()
logout()
get_instance_option_names()
set_option()
instance_config_form()
create()
instance_form_validation()
supported_returntypes()
get_reference_details()
sync_reference()
send_file()
contains_private_data()
get_rootpath()
is_in_repository()
get_thumbnail_url()
get_thumbnail()
remove_obsolete_thumbnails()
send_relative_file()
supports_relative_file()
repository_filesystem_pluginfile()
Class: repository_filesystem - X-Ref
repository_filesystem class__construct($repositoryid, $context = SYSCONTEXTID, $options = array() X-Ref |
Constructor param: int $repositoryid repository ID param: int $context context ID param: array $options |
get_listing($fullpath = '', $page = '') X-Ref |
Get the list of files and directories in that repository. param: string $fullpath Path to explore. This is assembled by {@link self::build_node_path()}. param: string $page Page number. return: array List of files and folders. |
search($query, $page = 1) X-Ref |
Search files in repository. This search works by walking through the directories returning the files that match. Once the limit of files is reached the walk stops. Whenever more files are requested, the walk starts from the beginning until it reaches an additional set of files to return. param: string $query The query string. param: int $page The page number. return: mixed |
build_breadcrumb($path) X-Ref |
Build the breadcrumb from a full path. param: string $path A path generated by {@link self::build_node_path()}. return: array |
build_node($rootpath, $path, $name, $isdir, $rootnodepath) X-Ref |
Build a file or directory node. param: string $rootpath The absolute path to the repository. param: string $path The relative path of the object param: string $name The name of the object param: string $isdir Is the object a directory? param: string $rootnodepath The node leading to this node (for breadcrumb). return: array |
build_node_path($mode, $realpath = '', $display = '', $root = '') X-Ref |
Build the path to a browsable node. param: string $mode The type of browse mode. param: string $realpath The path, or similar. param: string $display The way to display the node. param: string $root The path preceding this node. return: string |
explode_node_path($path) X-Ref |
Extract information from a node path. Note, this should not include preceding paths. param: string $path The path of the node. return: array Contains the mode, the relative path, and the display text. |
check_login() X-Ref |
To check whether the user is logged in. return: bool |
print_login() X-Ref |
Show the login screen, if required. return: string |
global_search() X-Ref |
Is it possible to do a global search? return: bool |
get_file($file, $title = '') X-Ref |
Return file path. return: array |
get_file_source_info($filepath) X-Ref |
Return the source information param: stdClass $filepath return: string|null |
logout() X-Ref |
Logout from repository instance return: string |
get_instance_option_names() X-Ref |
Return names of the instance options. return: array |
set_option($options = array() X-Ref |
Save settings for repository instance param: array $options settings return: bool |
instance_config_form($mform) X-Ref |
Edit/Create Instance Settings Moodle form param: moodleform $mform Moodle form (passed by reference) |
create($type, $userid, $context, $params, $readonly=0) X-Ref |
Create an instance for this plug-in param: string $type the type of the repository param: int $userid the user id param: stdClass $context the context param: array $params the options for this instance param: int $readonly whether to create it readonly or not (defaults to not) return: mixed |
instance_form_validation($mform, $data, $errors) X-Ref |
Validate repository plugin instance form param: moodleform $mform moodle form param: array $data form data param: array $errors errors return: array errors |
supported_returntypes() X-Ref |
User cannot use the external link to dropbox return: int |
get_reference_details($reference, $filestatus = 0) X-Ref |
Return human readable reference information param: string $reference value of DB field files_reference.reference param: int $filestatus status of the file, 0 - ok, 666 - source missing return: string |
sync_reference(stored_file $file) X-Ref |
No description |
send_file($storedfile, $lifetime=null , $filter=0, $forcedownload=false, array $options = null) X-Ref |
Repository method to serve the referenced file param: stored_file $storedfile the file that contains the reference param: int $lifetime Number of seconds before the file should expire from caches (null means $CFG->filelifetime) param: int $filter 0 (default)=no filtering, 1=all files, 2=html files only param: bool $forcedownload If true (default false), forces download of file rather than view in browser/plugin param: array $options additional options affecting the file serving |
contains_private_data() X-Ref |
Is this repository accessing private data? return: bool |
get_rootpath() X-Ref |
Return the rootpath of this repository instance. Trim() is a necessary step to ensure that the subdirectory is not '/'. return: string path |
is_in_repository($path) X-Ref |
Checks if $path is part of this repository. Try to prevent $path hacks such as ../ . We do not use clean_param(, PARAM_PATH) here because it also trims down some characters that are allowed, like < > ' . But we do ensure that the directory is safe by checking that it starts with $rootpath. param: string $path relative path to a file or directory in the repo. return: boolean false when not. |
get_thumbnail_url($filepath, $thumbsize, $token) X-Ref |
Returns url of thumbnail file. param: string $filepath current path in repository (dir and filename) param: string $thumbsize 'thumb' or 'icon' param: string $token identifier of the file contents - to prevent browser from caching changed file return: moodle_url |
get_thumbnail($filepath, $thumbsize) X-Ref |
Returns the stored thumbnail file, generates it if not present. param: string $filepath current path in repository (dir and filename) param: string $thumbsize 'thumb' or 'icon' return: null|stored_file |
remove_obsolete_thumbnails($storedfiles) X-Ref |
Run in cron for particular repository instance. Removes thumbnails for deleted/modified files. param: stored_file[] $storedfiles |
send_relative_file(stored_file $mainfile, $relativepath) X-Ref |
Gets a file relative to this file in the repository and sends it to the browser. param: stored_file $mainfile The main file we are trying to access relative files for. param: string $relativepath the relative path to the file we are trying to access. |
supports_relative_file() X-Ref |
helper function to check if the repository supports send_relative_file. return: true|false |
repository_filesystem_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array() X-Ref |
Generates and sends the thumbnail for an image in filesystem. param: stdClass $course course object param: stdClass $cm course module object param: stdClass $context context object param: string $filearea file area param: array $args extra arguments param: bool $forcedownload whether or not force download param: array $options additional options affecting the file serving return: bool |