Skip to content
Snippets Groups Projects
Commit abed9406 authored by TamaraGunkel's avatar TamaraGunkel
Browse files

improved code style

parent 791ba1e0
No related branches found
No related tags found
No related merge requests found
<?php
namespace filter_opencast;
defined('MOODLE_INTERNAL') || die();
class rest extends \core\oauth2\rest {
/**
* Define the functions of the rest API.
*
* @return array Example:
* [ 'listFiles' => [ 'method' => 'get', 'endpoint' => 'http://...', 'args' => [ 'folder' => PARAM_STRING ] ] ]
*/
public function get_api_functions() {
$baseurl = get_config('filter_opencast', 'baseurlapi');
return [
'me' => [
'endpoint' => $baseurl . '/info/me.json',
'method' => 'get',
'args' => [],
'response' => 'raw'
],
'episode' => [
'endpoint' => $baseurl . '/search/episode.json',
'method' => 'get',
'args' => [
'id' => PARAM_RAW
],
'response' => 'raw'
],
'footprint' => [
'endpoint' => $baseurl . '/usertracking/footprint.json',
'method' => 'get',
'args' => [
'id' => PARAM_RAW
],
'response' => 'raw'
],
];
}
}
\ No newline at end of file
......@@ -53,11 +53,11 @@ class filter_opencast extends moodle_text_filter {
if ($matches) {
// Login if user is not logged in yet.
$loggedIn = true;
$loggedin = true;
if (!isset($_COOKIE['JSESSIONID'])) {
// Login and set cookie.
filter_opencast_login();
$loggedIn = false;
$loggedin = false;
}
$video = false;
......@@ -84,13 +84,12 @@ class filter_opencast extends moodle_text_filter {
$id = substr($match, strpos($match, 'api/') + 4, 36);
$src = $CFG->wwwroot . '/filter/opencast/player/core.html?id=' . $id . '&ocurl=' . urlencode($apiurl);
if($loggedIn) {
if ($loggedin) {
// Set the source attribute directly.
$player = '<iframe src="' . $src . '" width="95%" height="455px" class="ocplayer"></iframe>';
}
else {
} else {
// Set the source attribute after login.
$player = '<iframe src="" data-frameSrc="' . $src .'" width="95%" height="455px" class="ocplayer"></iframe>';
$player = '<iframe data-frameSrc="' . $src . '" width="95%" height="455px" class="ocplayer"></iframe>';
}
......
{
"search-results": {
"offset": "0",
"limit": "0",
"total": "0",
"searchTime": "7",
"query": "(id:caffc928\\-255b\\-4a8d\\-8302\\-d91d55c2a126) AND oc_organization:mh_default_org AND (oc_acl_read:ROLE_ANONYMOUS) AND -oc_mediatype:Series AND -oc_deleted:[* TO *]"
}
}
\ No newline at end of file
{"footprints":{"total":"1","footprint":{"position":0,"views":0}}}
\ No newline at end of file
{
"org": {
"anonymousRole": "ROLE_ANONYMOUS",
"name": "Opencast Project",
"adminRole": "ROLE_ADMIN",
"id": "mh_default_org",
"properties": {
"admin.shortcut.general.series_view": "s",
"admin.shortcut.editor.split_at_current_time": "v",
"player.shortcut.controls.nextChapter": "pageup",
"engageui.annotations.enable": "true",
"player.shortcut.controls.jumpToBegin": "backspace",
"admin.shortcut.general.select_previous_dashboard_filter": "F",
"admin.shortcut.player.mute": "m",
"admin.shortcut.editor.play_ending_of_current_segment": "n",
"player.mastervideotype": "presenter\/delivery",
"player.shortcut.layout.focusPrev": "<",
"org.opencastproject.admin.help.documentation.url": "http:\/\/docs.opencast.org",
"player.shortcut.controls.prevChapter": "pagedown",
"player.positioncontrols": "bottom",
"player.shortcut.zoom.moveLeft": "a",
"admin.shortcut.general.event_view": "e",
"admin.shortcut.editor.clear_list": "ctrl+backspace",
"adminui.user.external_role_display": "false",
"admin.shortcut.general.help": "?",
"logo_mediamodule": "\/engage\/ui\/img\/logo\/opencast-icon.svg",
"org.opencastproject.admin.help.restdocs.url": "\/rest_docs.html",
"admin.shortcut.general.new_series": "N",
"engageui.link_mobile_redirect.description": "For more information have a look at the official site.",
"player.shortcut.zoom.moveRight": "d",
"player.hide_video_context_menu": "false",
"player.shortcut.layout.movePiP": "p",
"player.shortcut.playbackrate.decrease": "T",
"admin.shortcut.general.select_next_dashboard_filter": "f",
"player.shortcut.zoom.in": "+",
"admin.shortcut.player.next_segment": "down",
"admin.shortcut.general.new_event": "n",
"player.shortcut.controls.playPause": "space",
"admin.shortcut.player.next_frame": "right",
"player.shortcut.fullscreen.cancel": "escape",
"org.opencastproject.admin.mediamodule.url": "\/engage\/ui",
"player.focusedflavor": "presentation",
"player.allowedtags": "engage-download,engage-streaming",
"player.shortcut.zoom.moveUp": "w",
"player.shortcut.zoom.out": "-",
"player.shortcut.layout.focusNext": ">",
"player.shortcut-sequence": "controls,volume,playbackrate,layout,zoom,fullscreen",
"player.shortcut.controls.seekLeft": "left",
"player.shortcut.playbackrate.increase": "t",
"admin.shortcut.editor.play_current_segment_with_pre-roll": "C",
"player.shortcut.volume.up": "9",
"adminui.chunksize": "2048",
"admin.shortcut.editor.cut_selected_segment": "backspace",
"admin.shortcut.player.step_backward": "ctrl+left",
"player.shortcut.controls.seekRight": "right",
"admin.shortcut.editor.play_current_segment": "c",
"logo_player": "\/engage\/theodul\/ui\/img\/opencast.svg",
"admin.shortcut.general.remove_filters": "r",
"player": "\/engage\/theodul\/ui\/core.html",
"player.shortcut.volume.down": "8",
"admin.shortcut.general.main_menu": "m",
"engageui.link_download.enable": "false",
"engageui.links_media_module.enable": "true",
"engageui.link_mobile_redirect.enable": "false",
"login.display_defaults": "true",
"show_embed_links": "true",
"admin.shortcut.player.volume_up": "+",
"player.layout": "off",
"link_mediamodule": "true",
"admin.shortcut.player.previous_frame": "left",
"player.shortcut.fullscreen.enable": "mod+enter",
"admin.shortcut.player.play_pause": "space",
"player.shortcut.volume.muteToggle": "m",
"admin.shortcut.player.volume_down": "-",
"admin.shortcut.player.previous_segment": "up",
"engageui.link_mobile_redirect.url": "http:\/\/opencast.org\/",
"org.opencastproject.oaipmh.server.hosturl": "",
"player.shortcut.layout.togglePiP": "o",
"admin.shortcut.player.step_forward": "ctrl+right",
"player.shortcut.zoom.moveDown": "s"
}
},
"roles": [
"ROLE_ANONYMOUS"
],
"userRole": "ROLE_USER_ANONYMOUS",
"user": {
"provider": null,
"name": null,
"email": null,
"username": "anonymous"
}
}
\ No newline at end of file
......@@ -13,9 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
require_once($CFG->dirroot.'/mod/lti/locallib.php');
require_once($CFG->dirroot.'/lib/oauthlib.php');
/**
* Opencast library functions.
*
......@@ -26,6 +23,8 @@ require_once($CFG->dirroot.'/lib/oauthlib.php');
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/mod/lti/locallib.php');
require_once($CFG->dirroot . '/lib/oauthlib.php');
/**
* Use lti to login and retrieve cookie from opencast.
......
......@@ -24,8 +24,10 @@
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configtext('filter_opencast/consumerkey', get_string('setting_consumerkey', 'filter_opencast'),
$settings->add(new admin_setting_configtext('filter_opencast/consumerkey',
get_string('setting_consumerkey', 'filter_opencast'),
get_string('setting_consumerkey_desc', 'filter_opencast'), ''));
$settings->add(new admin_setting_configtext('filter_opencast/consumersecret', get_string('setting_consumersecret', 'filter_opencast'),
$settings->add(new admin_setting_configtext('filter_opencast/consumersecret',
get_string('setting_consumersecret', 'filter_opencast'),
get_string('setting_consumersecret_desc', 'filter_opencast'), ''));
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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/>.
/**
* Opencast filter settings
*
* @package filter_opencastfilter
* @copyright 2017 Tamara Gunkel
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../config.php');
// TODO get issuerid
$issuerid = get_config('filter_opencast', 'issuerid');
$issuer = \core\oauth2\api::get_issuer($issuerid);
// Get an OAuth client from the issuer.
// TODO return url
$returnurl = new moodle_url('/filter/opencastfilter/adminsettings.php');
$client = \core\oauth2\api::get_user_oauth_client($issuer, $returnurl);
$service = new \filter_opencast\rest($client);
$me = $service->call('me', []);
file_put_contents('info/me.json', $me);
$id = '607e3bc5-f134-4ca2-87fd-b87a76ea3a65';
$params = ['id' => $id];
$episode = $service->call('episode', $params);
file_put_contents('info/episode.json', $episode);
$params = ['id' => '6103ef9b-d699-435d-9e69-4676afd30c87'];
$footprint = $service->call('footprint', $params);
file_put_contents('info/footprint.json', $footprint);
......@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018021500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2017050500; // Requires this Moodle version
$plugin->component = 'filter_opencast'; // Full name of the plugin (used for diagnostics)
$plugin->version = 2018021500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2017050500; // Requires this Moodle version.
$plugin->component = 'filter_opencast'; // Full name of the plugin.
$plugin->dependencies = array('tool_opencast' => ANY_VERSION);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment