コード例 #1
0
ファイル: lib.php プロジェクト: CTANZ/moodle-mod_equella
/**
 * Append token to existing url
 *
 * @param string $url
 * @param string $token
 *
 * @return string
 */
function equella_appendtoken($url, $token = null)
{
    if ($token === null) {
        $token = equella_getssotoken();
    }
    $url .= strpos($url, '?') != false ? '&' : '?';
    $url .= 'token=' . rawurlencode($token);
    return $url;
}
コード例 #2
0
ファイル: locallib.php プロジェクト: CTANZ/moodle-mod_equella
function equella_build_integration_url($args, $appendtoken = true)
{
    global $USER, $CFG, $DB;
    $callbackurlparams = array('course' => $args->course, 'section' => $args->section);
    if (!empty($args->cmid)) {
        $callbackurlparams['coursemodule'] = $args->cmid;
    }
    if (!empty($args->module)) {
        $callbackurlparams['module'] = $args->module;
    }
    if (!empty($args->instance)) {
        $callbackurlparams['instance'] = $args->instance;
    }
    if (!empty($args->module)) {
        $callbackurlparams['modulename'] = $args->modulename;
    } else {
        $callbackurlparams['modulename'] = 'equella';
    }
    $callbackurl = new moodle_url('/mod/equella/callbackmulti.php', $callbackurlparams);
    $cancelurl = new moodle_url('/mod/equella/cancel.php', array('course' => $args->course));
    $coursecode = equella_get_coursecode($args->course);
    $equrlparams = array('method' => 'lms', 'attachmentUuidUrls' => 'true', 'returnprefix' => 'tle', 'template' => 'standard', 'courseId' => $args->course, 'courseCode' => $coursecode, 'action' => $CFG->equella_action, 'selectMultiple' => 'true', 'cancelDisabled' => 'true', 'returnurl' => $callbackurl->out(false), 'cancelurl' => $cancelurl->out(false));
    if ($appendtoken) {
        $course = $DB->get_record('course', array('id' => $args->course), '*', MUST_EXIST);
        $equrlparams['token'] = equella_getssotoken($course);
    }
    if (!empty($CFG->equella_options)) {
        $equrlparams['options'] = $CFG->equella_options;
    }
    if ($CFG->equella_select_restriction && $CFG->equella_select_restriction != EQUELLA_CONFIG_SELECT_RESTRICT_NONE) {
        $equrlparams[$CFG->equella_select_restriction] = 'true';
    }
    return new moodle_url($CFG->equella_url, $equrlparams);
}
コード例 #3
0
 public static function contribute_file_with_shared_secret($filename, $fp, $params = array())
 {
     $params['token'] = equella_getssotoken();
     return self::contribute_file($filename, $fp, $params, false);
 }