Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 402 and 403]
This plugin is used to access user's dropbox files
Copyright: | 2012 Marina Glancy |
Copyright: | 2010 Dongsheng Cai {@link http://dongsheng.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 788 lines (28 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
repository_dropbox:: (31 methods):
__construct()
send_file()
get_reference_details()
cache_file_by_reference()
get_file_source_info()
get_file_reference()
get_link()
get_file()
supported_filetypes()
supported_returntypes()
get_listing()
search()
send_thumbnail()
fix_old_style_reference()
unpack_reference()
get_file_download_link()
logout()
check_login()
print_login()
callback()
cron()
type_config_form()
set_option()
get_option()
get_oauth2callbackurl()
get_type_option_names()
sync_reference()
process_entries()
process_breadcrumbs()
get_thumbnail_url()
max_cache_bytes()
Class: repository_dropbox - X-Ref
Repository to access Dropbox files__construct($repositoryid, $context = SYSCONTEXTID, $options = []) X-Ref |
Constructor of dropbox plugin. |
send_file($storedfile, $lifetime=null , $filter=0, $forcedownload=false, array $options = null) X-Ref |
Repository method to serve the referenced file. |
get_reference_details($reference, $filestatus = 0) X-Ref |
Return human readable reference information. {@link stored_file::get_reference()} |
cache_file_by_reference($reference, $storedfile) X-Ref |
Cache file from external repository by reference. {@link repository::get_file_reference()} {@link repository::get_file()} Invoked at MOODLE/repository/repository_ajax.php. |
get_file_source_info($source) X-Ref |
Return the source information. The result of the function is stored in files.source field. It may be analysed when the source file is lost or repository may use it to display human-readable location of reference original. This method is called when file is picked for the first time only. When file (either copy or a reference) is already in moodle and it is being picked again to another file area (also as a copy or as a reference), the value of files.source is copied. |
get_file_reference($source) X-Ref |
Prepare file reference information. |
get_link($reference) X-Ref |
Return file URL for external link. |
get_file($reference, $saveas = '') X-Ref |
Downloads a file from external repository and saves it in temp dir. |
supported_filetypes() X-Ref |
Dropbox plugin supports all kinds of files. |
supported_returntypes() X-Ref |
User cannot use the external link to dropbox. |
get_listing($path = '', $page = '1') X-Ref |
Get dropbox files. |
search($query, $page = 0) X-Ref |
Get dropbox files in the specified path. param: string $query The search query param: int $page The page number return: array |
send_thumbnail($source) X-Ref |
Displays a thumbnail for current user's dropbox file. |
fix_old_style_reference($packed) X-Ref |
Fixes references in DB that contains user credentials. param: string $packed Content of DB field files_reference.reference return: string New serialized reference |
unpack_reference($packed) X-Ref |
Unpack the supplied serialized reference, fixing it if required. param: string $packed The packed reference return: object The unpacked reference |
get_file_download_link($sharedurl) X-Ref |
Converts a URL received from dropbox API function 'shares' into URL that can be used to download/access file directly param: string $sharedurl return: string |
logout() X-Ref |
Logout from dropbox. |
check_login() X-Ref |
Check if the dropbox is logged in via the oauth process. |
print_login() X-Ref |
Generate dropbox login url. |
callback() X-Ref |
Request access token. |
cron() X-Ref |
Caches all references to Dropbox files in moodle filepool. Invoked by {@link repository_dropbox_cron()}. Only files smaller than {@link repository_dropbox::max_cache_bytes()} and only files which synchronisation timeout have not expired are cached. |
type_config_form($mform, $classname = 'repository') X-Ref |
Add Plugin settings input to Moodle form. |
set_option($options = []) X-Ref |
Set options. param: array $options return: mixed |
get_option($config = '') X-Ref |
Get dropbox options param: string $config return: mixed |
get_oauth2callbackurl() X-Ref |
Return the OAuth 2 Redirect URI. return: moodle_url |
get_type_option_names() X-Ref |
Option names of dropbox plugin. |
sync_reference(stored_file $file) X-Ref |
Performs synchronisation of an external file if the previous one has expired. This function must be implemented for external repositories supporting FILE_REFERENCE, it is called for existing aliases when their filesize, contenthash or timemodified are requested. It is not called for internal repositories (see {@link repository::has_moodle_files()}), references to internal files are updated immediately when source is modified. Referenced files may optionally keep their content in Moodle filepool (for thumbnail generation or to be able to serve cached copy). In this case both contenthash and filesize need to be synchronized. Otherwise repositories should use contenthash of empty file and correct filesize in bytes. Note that this function may be run for EACH file that needs to be synchronised at the moment. If anything is being downloaded or requested from external sources there should be a small timeout. The synchronisation is performed to update the size of the file and/or to update image and re-generated image preview. There is nothing fatal if syncronisation fails but it is fatal if syncronisation takes too long and hangs the script generating a page. Note: If you wish to call $file->get_filesize(), $file->get_contenthash() or $file->get_timemodified() make sure that recursion does not happen. Called from {@link stored_file::sync_external_file()} |
process_entries(array $entries) X-Ref |
Process a standard entries list. param: array $entries The list of entries returned from the API return: array The manipulated entries for display in the file picker |
process_breadcrumbs($path) X-Ref |
Process the breadcrumbs for a listing. param: string $path The path to create breadcrumbs for return: array |
get_thumbnail_url($entry) X-Ref |
Grab the thumbnail URL for the specified entry. param: object $entry The file entry as retrieved from the API return: moodle_url |
max_cache_bytes() X-Ref |
Returns the maximum size of the Dropbox files to cache in moodle. Note that {@link repository_dropbox::sync_reference()} will try to cache images even when they are bigger in order to generate thumbnails. However there is a small timeout for downloading images for synchronisation and it will probably fail if the image is too big. return: int |