Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

This plugin is used to access box.net repository

Copyright: 2010 Dongsheng Cai {@link http://dongsheng.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 493 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: repository_boxnet  - X-Ref

repository_boxnet class implements box.net client

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

param: int $repositoryid
param: stdClass $context
param: array $options

build_breadcrumb($fullpath)   X-Ref
Construct a breadcrumb from a path.

param: string $fullpath Path containing multiple parts separated by slashes.
return: array Array expected to be generated in {@link self::get_listing()}.

build_part($type, $value, $name = '')   X-Ref
Build a part of the path.

This is used to construct the path that the user is currently browsing.
It must contain a 'type', and a 'value'. Then it can also contain a
'name' which is very useful to prevent extra queries to get the name only.

See {@link self::split_part} to extra the information from a part.

param: string $type Type of part, typically 'folder' or 'search'.
param: string $value The value of the part, eg. a folder ID or search terms.
param: string $name The name of the part.
return: string type:value or type:value|name

split_part($part)   X-Ref
Extract information from a part of path.

param: string $part value generated from {@link self::build_parth()}.
return: array containing type, value and name.

check_login()   X-Ref
check if user logged

return: boolean

logout()   X-Ref
reset auth token

return: string

search($search_text, $page = 0)   X-Ref
Search files from box.net

param: string $search_text
return: mixed

get_file($ref, $filename = '')   X-Ref
Downloads a repository file and saves to a path.

param: string $ref reference to the file
param: string $filename to save file as
return: array

get_listing($fullpath = '', $page = '')   X-Ref
Get file listing

param: string $path
param: string $page
return: mixed

print_login()   X-Ref
Return login form

return: array

get_type_option_names()   X-Ref
Names of the plugin settings

return: array

callback()   X-Ref
Catch the request token.


type_config_form($mform, $classname = 'repository')   X-Ref
Add Plugin settings input to Moodle form

param: moodleform $mform
param: string $classname

supported_returntypes()   X-Ref
Box.net supports copied and links.

Theoretically this API is ready for references, though it only works for
Box.net Business accounts, but it is not enabled because we are not supporting it.

return: int

convert_to_valid_reference($reference)   X-Ref
Convert a reference to the new reference style.

While converting Box.net to APIv2 we introduced a new format for
file references, see {@link self::get_file_reference()}. This function
ensures that the format is always the same regardless of the whether
the reference was from APIv1 or v2.

param: mixed $reference File reference.
return: stdClass Valid file reference.

get_file_reference($source)   X-Ref
Prepare file reference information

param: string $source
return: string file referece

get_link($reference)   X-Ref
Get a link to the file.

This returns the URL of the web view of the file. To generate this link the
file must be shared.

param: stdClass $reference Reference.
return: string URL.

sync_reference(stored_file $file)   X-Ref
Synchronize the references.

param: stored_file $file Stored file.
return: boolean

get_reference_details($reference, $filestatus = 0)   X-Ref
Return human readable reference information
{@link stored_file::get_reference()}

param: string $reference
param: int $filestatus status of the file, 0 - ok, 666 - source missing
return: string

get_file_source_info($source)   X-Ref
Return the source information.

param: string $source Not the reference, just the source.
return: string|null

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