public static function type_config_form($mform, $classname = 'repository') { $a = new stdClass(); $a->callbackurl = google_oauth::callback_url()->out(false); $mform->addElement('static', null, '', get_string('oauthinfo', 'repository_skydrive', $a)); parent::type_config_form($mform); $strrequired = get_string('required'); $mform->addElement('text', 'clientid', get_string('clientid', 'repository_skydrive')); $mform->addElement('text', 'secret', get_string('secret', 'repository_skydrive')); $mform->addRule('clientid', $strrequired, 'required', null, 'client'); $mform->addRule('secret', $strrequired, 'required', null, 'client'); }
public function admin_config_form(&$mform) { $a = new stdClass; $a->docsurl = get_docs_url('Google_OAuth2_Setup'); $a->callbackurl = google_oauth::callback_url()->out(false); $mform->addElement('static', null, '', get_string('oauthinfo', 'portfolio_googledocs', $a)); $mform->addElement('text', 'clientid', get_string('clientid', 'portfolio_googledocs')); $mform->addElement('text', 'secret', get_string('secret', 'portfolio_googledocs')); $strrequired = get_string('required'); $mform->addRule('clientid', $strrequired, 'required', null, 'client'); $mform->addRule('secret', $strrequired, 'required', null, 'client'); }
public static function admin_config_form(&$mform) { $a = new stdClass(); $a->docsurl = get_docs_url('Google_OAuth_2.0_setup'); $a->callbackurl = google_oauth::callback_url()->out(false); $mform->addElement('static', null, '', get_string('oauthinfo', 'portfolio_picasa', $a)); $mform->addElement('text', 'clientid', get_string('clientid', 'portfolio_picasa')); $mform->setType('clientid', PARAM_RAW_TRIMMED); $mform->addElement('text', 'secret', get_string('secret', 'portfolio_picasa')); $mform->setType('secret', PARAM_RAW_TRIMMED); $strrequired = get_string('required'); $mform->addRule('clientid', $strrequired, 'required', null, 'client'); $mform->addRule('secret', $strrequired, 'required', null, 'client'); }
// // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Link to CSV course upload * * @package tool * @subpackage uploadcourse * @copyright 2010 Petr Skoda {@link http://skodak.org} * @copyright 2011 Piers Harding * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; require_once $CFG->libdir . '/googleapi.php'; $a = new stdClass(); $a->docsurl = get_docs_url('Google_OAuth_2.0_setup'); $a->callbackurl = google_oauth::callback_url()->out(false); //default display settings $settings->add(new admin_setting_heading('gradeexport_fusion/displaysettings', get_string('oauthinfo', 'gradeexport_fusion', $a), '')); $settings->add(new admin_setting_configtext('gradeexport_fusion/clientid', get_string('clientid', 'gradeexport_fusion'), get_string('clientiddesc', 'gradeexport_fusion'), '', PARAM_TEXT)); $settings->add(new admin_setting_configtext('gradeexport_fusion/secret', get_string('secret', 'gradeexport_fusion'), get_string('clientiddesc', 'gradeexport_fusion'), '', PARAM_TEXT));
public static function type_config_form($mform, $classname = 'repository') { $a = new stdClass; $a->docsurl = get_docs_url('Google_OAuth_2.0_setup'); $a->callbackurl = google_oauth::callback_url()->out(false); $mform->addElement('static', null, '', get_string('oauthinfo', 'repository_googledocs', $a)); parent::type_config_form($mform); $mform->addElement('text', 'clientid', get_string('clientid', 'repository_googledocs')); $mform->setType('clientid', PARAM_RAW_TRIMMED); $mform->addElement('text', 'secret', get_string('secret', 'repository_googledocs')); $mform->setType('secret', PARAM_RAW_TRIMMED); $strrequired = get_string('required'); $mform->addRule('clientid', $strrequired, 'required', null, 'client'); $mform->addRule('secret', $strrequired, 'required', null, 'client'); }
protected function multi($requests, $options = array()) { if ($this->token) { // Adds authorisation head to a request so that it can be authentcated $this->setHeader('Authorization: ' . $this->get_auth_header_name() . '"' . $this->token . '"'); } foreach ($this->persistantheaders as $h) { $this->setHeader($h); } $ret = parent::multi($requests, $options); // reset headers for next request $this->header = array(); return $ret; }
print_error('cannotaccessgroup', 'grades'); } } // parameters to preserve $preserve = array('id' => $id, 'groupid' => $groupid, 'itemids' => $itemids, 'export_feedback' => $export_feedback, 'separator' => $separator, 'updatedgradesonly' => $updatedgradesonly, 'displaytype' => $displaytype, 'decimalpoints' => $decimalpoints, 'tablename' => $tablename); // check OAuth //$oauth = new fusion_grade_export_fusion(); $returnurl = new moodle_url('/grade/export/fusion/export.php'); foreach ($preserve as $k => $v) { $returnurl->param($k, $v); } $returnurl->param('sesskey', sesskey()); // check the config $clientid = get_config('gradeexport_fusion', 'clientid'); $secret = get_config('gradeexport_fusion', 'secret'); if (empty($clientid) || empty($secret)) { print_error('noconfig', 'gradeexport_fusion'); } $fusion_realm = 'https://www.googleapis.com/auth/fusiontables'; $googleoauth = new google_oauth($clientid, $secret, $returnurl, $fusion_realm); if (!$googleoauth->is_logged_in()) { $url = $googleoauth->get_login_url(); redirect($url, get_string('login', 'gradeexport_fusion'), 2); // echo '<a target="_blank" href="'.$url->out(false).'">'.get_string('login', 'repository').'</a>'; } $oauth = new fusion_grade_export_oauth_fusion($googleoauth); $oauth->show_tables(); // print all the exported data here $export = new grade_export_fusion($course, $groupid, $itemids, $export_feedback, $updatedgradesonly, $displaytype, $decimalpoints, $separator, $tablename); $export->set_table($tablename); $export->export_grades($oauth);