Esempio n. 1
0
/**
 * Return the js params required for this module.
 * @return array of additional params to pass to javascript init function.
 */
function atto_mediacore_params_for_js()
{
    global $COURSE;
    //NOTE: the params used for the tinymce editor plugin and
    //  the atto editor plugin are the same
    $client = new mediacore_client();
    $params = $client->get_texteditor_params();
    return array('chooser_js_url' => $params['mcore_chooser_js_url'], 'url' => $params['mcore_chooser_url'], 'mode' => 'popup');
}
Esempio n. 2
0
 protected function update_init_params(array &$params, context $context, array $options = null)
 {
     // 'mediacore' is the key used in Moodle >= 2.5
     // 'filter/mediacore' is the key used in Moodle < 2.5
     $filters = filter_get_active_in_context($context);
     $enabled = array_key_exists('mediacore', $filters) || array_key_exists('filter/mediacore', $filters);
     // If mediacore filter is disabled, do not add button.
     if (!$enabled) {
         return;
     }
     $mcore_client = new mediacore_client();
     $params = $params + $mcore_client->get_texteditor_params();
     $numrows = $this->count_button_rows($params);
     $this->add_button_after($params, $numrows, '|,mediacore');
     // Add JS file, which uses default name.
     $this->add_js_plugin($params);
 }
Esempio n. 3
0
<?php

require_once '../../config.php';
defined('MOODLE_INTERNAL') || die('Invalid access');
require_once $CFG->dirroot . '/local/mediacore/lib.php';
require_once 'mediacore_client.class.php';
$url = $_SERVER['REQUEST_URI'];
$mcore_client = new mediacore_client();
$pos = strpos($url, '?');
if ($pos === false) {
    $response_string = 'HTTP/1.1 400 Bad Request';
    header($response_string);
    echo $response_string;
    return;
}
// The url contains query params, so split out the query string
// params as an array so we can pass them to the lti signing
// method
$qs = substr($url, $pos + 1);
$params = array();
parse_str($qs, $params);
$url = substr($url, 0, $pos);
$courseid = $params['context_id'];
$site_url = $mcore_client->get_siteurl();
$url = str_replace($_SERVER['SCRIPT_NAME'], $site_url, $url);
$params = $mcore_client->get_signed_lti_params($url, 'GET', $courseid, $params);
$url .= '?' . http_build_query($params);
redirect($url);