[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/repository/filesystem/ -> lib.php (summary)

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: 668 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

repository_filesystem:: (27 methods):
  __construct()
  get_listing()
  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()
  repository_filesystem_cron()


Class: repository_filesystem  - X-Ref

repository_filesystem class

Create a repository from your local filesystem
*NOTE* for security issue, we use a fixed repository path
which is %moodledata%/repository

__construct($repositoryid, $context = SYSCONTEXTID, $options = array()   X-Ref
Constructor

param: int $repositoryid repository ID
param: int $context context ID
param: array $options

get_listing($path = '', $page = '')   X-Ref
Get the list of files and directories in that repository.

param: string $path to browse.
param: string $page page number.
return: array list of files and folders.

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

repository_filesystem_cron()   X-Ref
Cron callback for repository_filesystem. Deletes the thumbnails for deleted or changed files.




Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1