See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]
This plugin is used to access Google Drive.
Copyright: | 2009 Dan Poltawski <talktodan@gmail.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1224 lines (50 kb) |
Included or required: | 0 times |
Referenced: | 3 times |
Includes or requires: | 0 files |
repository_googledocs:: (33 methods):
__construct()
get_user_oauth_client()
check_login()
print_login()
print_login_popup()
build_breadcrumb()
build_node_path()
explode_node_path()
get_listing()
search()
query()
logout()
get_file()
get_file_reference()
supported_filetypes()
supported_returntypes()
default_returntype()
get_type_option_names()
callback()
send_file()
folder_exists_in_folder()
create_folder_in_folder()
get_file_summary()
copy_file()
add_temp_writer_to_file()
add_writer_to_file()
move_file_from_root_to_folder()
prevent_writers_from_sharing_file()
set_file_sharing_anyone_with_link_can_read()
reference_file_selected()
get_reference_details()
type_config_form()
repository_googledocs_oauth2_system_scopes()
Class: repository_googledocs - X-Ref
Google Docs Plugin__construct($repositoryid, $context = SYSCONTEXTID, $options = array() X-Ref |
Constructor. param: int $repositoryid repository instance id. param: int|stdClass $context a context id or context object. param: array $options repository options. param: int $readonly indicate this repo is readonly or not. return: void |
get_user_oauth_client($overrideurl = false) X-Ref |
Get a cached user authenticated oauth client. param: moodle_url $overrideurl - Use this url instead of the repo callback. return: \core\oauth2\client |
check_login() X-Ref |
Checks whether the user is authenticate or not. return: bool true when logged in. |
print_login() X-Ref |
Print or return the login form. return: void|array for ajax. |
print_login_popup($attr = null) X-Ref |
Print the login in a popup. param: array|null $attr Custom attributes to be applied to popup div. |
build_breadcrumb($path) X-Ref |
Build the breadcrumb from a path. param: string $path to create a breadcrumb from. return: array containing name and path of each crumb. |
build_node_path($id, $name = '', $root = '') X-Ref |
Generates a safe path to a node. Typically, a node will be id|Name of the node. param: string $id of the node. param: string $name of the node, will be URL encoded. param: string $root to append the node on, must be a result of this function. return: string path to the node. |
explode_node_path($node) X-Ref |
Returns information about a node in a path. param: string $node to extrat information from. return: array about the node. |
get_listing($path='', $page = '') X-Ref |
List the files and folders. param: string $path path to browse. param: string $page page to browse. return: array of result. |
search($searchtext, $page = 0) X-Ref |
Search throughout the Google Drive. param: string $searchtext text to search for. param: int $page search page. return: array of results. |
query($q, $path = null, $page = 0) X-Ref |
Query Google Drive for files and folders using a search query. Documentation about the query format can be found here: https://developers.google.com/drive/search-parameters This returns a list of files and folders with their details as they should be formatted and returned by functions such as get_listing() or search(). param: string $q search query as expected by the Google API. param: string $path parent path of the current files, will not be used for the query. param: int $page page. return: array of files and folders. |
logout() X-Ref |
Logout. return: string |
get_file($reference, $filename = '') X-Ref |
Get a file. param: string $reference reference of the file. param: string $file name to save the file to. return: string JSON encoded array of information about the file. |
get_file_reference($source) X-Ref |
Prepare file reference information. We are using this method to clean up the source to make sure that it is a valid source. param: string $source of the file. return: string file reference. |
supported_filetypes() X-Ref |
What kind of files will be in this repository? return: array return '*' means this repository support any files, otherwise |
supported_returntypes() X-Ref |
Tells how the file can be picked from this repository. return: int |
default_returntype() X-Ref |
Which return type should be selected by default. return: int |
get_type_option_names() X-Ref |
Return names of the general options. By default: no general option name. return: array |
callback() X-Ref |
Store the access token. |
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 |
folder_exists_in_folder(\repository_googledocs\rest $client, $foldername, $parentid) X-Ref |
See if a folder exists within a folder param: \repository_googledocs\rest $client Authenticated client. param: string $foldername The folder we are looking for. param: string $parentid The parent folder we are looking in. return: string|boolean The file id if it exists or false. |
create_folder_in_folder(\repository_googledocs\rest $client, $foldername, $parentid) X-Ref |
Create a folder within a folder param: \repository_googledocs\rest $client Authenticated client. param: string $foldername The folder we are creating. param: string $parentid The parent folder we are creating in. return: string The file id of the new folder. |
get_file_summary(\repository_googledocs\rest $client, $fileid) X-Ref |
Get simple file info for humans. param: \repository_googledocs\rest $client Authenticated client. param: string $fileid The file we are querying. return: stdClass |
copy_file(\repository_googledocs\rest $client, $fileid, $name) X-Ref |
Copy a file and return the new file details. A side effect of the copy is that the owner will be the account authenticated with this oauth client. param: \repository_googledocs\rest $client Authenticated client. param: string $fileid The file we are copying. param: string $name The original filename (don't change it). return: stdClass file details. |
add_temp_writer_to_file(\repository_googledocs\rest $client, $fileid, $email) X-Ref |
Add a writer to the permissions on the file (temporary). param: \repository_googledocs\rest $client Authenticated client. param: string $fileid The file we are updating. param: string $email The email of the writer account to add. return: boolean |
add_writer_to_file(\repository_googledocs\rest $client, $fileid, $email) X-Ref |
Add a writer to the permissions on the file. param: \repository_googledocs\rest $client Authenticated client. param: string $fileid The file we are updating. param: string $email The email of the writer account to add. return: boolean |
move_file_from_root_to_folder(\repository_googledocs\rest $client, $fileid, $folderid) X-Ref |
Move from root to folder param: \repository_googledocs\rest $client Authenticated client. param: string $fileid The file we are updating. param: string $folderid The id of the folder we are moving to return: boolean |
prevent_writers_from_sharing_file(\repository_googledocs\rest $client, $fileid) X-Ref |
Prevent writers from sharing. param: \repository_googledocs\rest $client Authenticated client. param: string $fileid The file we are updating. return: boolean |
set_file_sharing_anyone_with_link_can_read(\repository_googledocs\rest $client, $fileid) X-Ref |
Allow anyone with the link to read the file. param: \repository_googledocs\rest $client Authenticated client. param: string $fileid The file we are updating. return: boolean |
reference_file_selected($reference, $context, $component, $filearea, $itemid) X-Ref |
Called when a file is selected as a "link". Invoked at MOODLE/repository/repository_ajax.php This is called at the point the reference files are being copied from the draft area to the real area (when the file has really really been selected. param: string $reference this reference is generated by param: context $context the target context for this new file. param: string $component the target component for this new file. param: string $filearea the target filearea for this new file. param: string $itemid the target itemid for this new file. return: string updated reference (final one before it's saved to db). |
get_reference_details($reference, $filestatus = 0) X-Ref |
Get human readable file info from a the reference. param: string $reference param: int $filestatus |
type_config_form($mform, $classname = 'repository') X-Ref |
Edit/Create Admin Settings Moodle form. param: moodleform $mform Moodle form (passed by reference). param: string $classname repository class name. |
repository_googledocs_oauth2_system_scopes(\core\oauth2\issuer $issuer) X-Ref |
Callback to get the required scopes for system account. param: \core\oauth2\issuer $issuer return: string |