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.

Functions for operating with the skydrive API

Author: Dan Poltawski <dan.poltawski@luns.net.uk>
Copyright: 2012 Lancaster University Network Services Ltd
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 245 lines (9 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

microsoft_skydrive:: (8 methods):
  __construct()
  auth_url()
  token_url()
  post()
  download_file()
  get_folder_name()
  get_file_list()
  folder_cache_key()


Class: microsoft_skydrive  - X-Ref

A helper class to access microsoft live resources using the api.

This uses the microsfot API defined in
http://msdn.microsoft.com/en-us/library/hh243648.aspx

__construct($clientid, $clientsecret, $returnurl)   X-Ref
Construct a skydrive request object

param: string $clientid client id for OAuth 2.0 provided by microsoft
param: string $clientsecret secret for OAuth 2.0 provided by microsoft
param: moodle_url $returnurl url to return to after succseful auth

auth_url()   X-Ref
Returns the auth url for OAuth 2.0 request

return: string the auth url

token_url()   X-Ref
Returns the token url for OAuth 2.0 request

return: string the auth url

post($url, $params = '', $options = array()   X-Ref
Post request.

Overridden to convert the data to a string, else curl will set the wrong headers.

param: string $url The URL.
param: array|string $params The parameters.
param: array $options The options.
return: bool

download_file($id, $path)   X-Ref
Downloads a file to a  file from skydrive using authenticated request

param: string $id id of file
param: string $path path to save file to
return: array stucture for repository download_file

get_folder_name($folderid)   X-Ref
Returns a folder name property for a given folderid.

param: string $folderid the folder id which is passed
return: mixed folder name or false in case of error

get_file_list($path = '')   X-Ref
Returns a list of files the user has formated for files api

param: string $path the path which we are in
return: mixed Array of files formated for fileapoi

folder_cache_key($folderid)   X-Ref
Returns a key for foldernane cache

param: string $folderid the folder id which is to be cached
return: string the cache key to use