public function send_package() { if (!$this->googleoauth) { throw new portfolio_plugin_exception('noauthtoken', 'portfolio_googledocs'); } $gdocs = new google_docs($this->googleoauth); foreach ($this->exporter->get_tempfiles() as $file) { if (!$gdocs->send_file($file)) { throw new portfolio_plugin_exception('sendfailed', 'portfolio_gdocs', $file->get_filename()); } } }
public function post_control($stage, $params) { if ($stage != PORTFOLIO_STAGE_CONFIG) { return; } if (!array_key_exists('token', $params)) { throw new portfolio_plugin_exception('noauthtoken', 'portfolio_googledocs'); } // we now have our auth token, get a session token.. $gauth = new google_authsub(false, $params['token']); $this->sessiontoken = $gauth->get_sessiontoken(); google_docs::set_sesskey($this->sessiontoken, $this->get('user')->id); }
public function get_file($url, $file = '') { $gdocs = new google_docs($this->googleoauth); $path = $this->prepare_file($file); return $gdocs->download_file($url, $path); }
public function get_file($url, $file = '') { global $CFG; $path = $this->prepare_file($file); $fp = fopen($path, 'w'); $gdocs = new google_docs(new google_authsub($this->subauthtoken)); $gdocs->download_file($url, $fp); return array('path' => $path, 'url' => $url); }
public function get_file($url, $file = '') { if (empty($url)) { throw new repository_exception('cannotdownload', 'repository'); } $gdocs = new google_docs($this->googleoauth); $path = $this->prepare_file($file); return $gdocs->download_file($url, $path, self::GETFILE_TIMEOUT); }
/** * Constructor. * * @param google_oauth $googleoauth oauth curl class for making authenticated requests */ public function __construct(google_oauth $googleoauth) { $this->mygoogleoauth = $googleoauth; parent::__construct($googleoauth); }