-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.php
83 lines (67 loc) · 3.04 KB
/
view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?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/>.
/**
* Playlist resource plugin
*
* This plugin provides a simple container for a list of URLs that
* can be referenced by the RTMP filter plugin
*
* @author Fred Woolard <woolardfa@appstate.edu>
* @copyright (c) 2013 Appalachian State Universtiy, Boone, NC
* @license GNU General Public License version 3
* @package mod
* @subpackage playlist
*/
require_once("../../config.php");
// Course module id is supplied.
$id = optional_param('id',0,PARAM_INT);
// Set this up in case print_error() is needed.
$PAGE->set_url('/mod/playlist/view.php', array('id' => $id));
$cm = get_coursemodule_from_id('playlist', $id);
if (!$cm) {
throw new moodle_exception('invalidcoursemodule', 'error');
}
// Authenticate & authorize.
require_login($cm->course, true, $cm);
// Fetch the playlist instance.
$playlist = $DB->get_record('playlist', array('id' => $cm->instance));
if (!$playlist) {
throw new moodle_exception('coursemisconf', 'error');
}
$context = context_module::instance($cm->id);
require_capability('mod/playlist:view', $context);
// Trigger module viewed event.
$event = \mod_playlist\event\course_module_viewed::create(array(
'objectid' => $playlist->id,
'context' => $context
));
$event->trigger();
$PAGE->set_title("{$COURSE->shortname}: {$playlist->name}");
$PAGE->set_heading($COURSE->fullname);
if (optional_param('inpopup', 0, PARAM_BOOL)) {
$PAGE->set_pagelayout('popup');
$PAGE->set_heading('');
}
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($playlist->name), 2, 'main', 'pageheading');
echo $OUTPUT->box(get_string('example_usage', 'mod_playlist') . "<br /><br /><a href=\"rtmp://playlist={$playlist->name}\">{$playlist->name}</a>", "generalbox center clearfix");
$formatoptions = new stdClass;
$formatoptions->noclean = true;
$formatoptions->overflowdiv = true;
$formatoptions->context = $context;
echo $OUTPUT->box(format_text($playlist->list, FORMAT_PLAIN, $formatoptions), "generalbox center clearfix");
echo $OUTPUT->continue_button(new moodle_url("/course/view.php", array('id' => $COURSE->id)));
echo $OUTPUT->footer();