forked from njaber/moodle-mod_mplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
99 lines (81 loc) · 3.13 KB
/
Copy pathview.php
File metadata and controls
99 lines (81 loc) · 3.13 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?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/>.
/**
* This page prints a particular instance of mplayer
*
* @package mod_mplayer
* @category mod
* @author Matt Bury - matbury@gmail.com
* @author Valery Fremaux <valery.fremaux@gmail.com>
* @copyright (C) 2009 Matt Bury
* @licence http://www.gnu.org/copyleft/gpl.html GNU Public Licence
*/
require('../../config.php');
require_once($CFG->dirroot.'/mod/mplayer/lib.php');
list($cm, $course, $mplayer) = mplayer_get_context();
// Check and init storage if empty.
mplayer_init_storage($cm, 0);
mplayer_require_js($mplayer, 'require');
$url = new moodle_url('/mod/mplayer/view.php', array('id' => $cm->id));
$PAGE->set_url($url);
// Security.
require_login($course->id);
if (!isset($CFG->mplayer_default_player)) {
set_config('mplayer_default_player', 'flowplayer');
}
// Trigger module viewed event.
$context = context_module::instance($cm->id);
require_capability('mod/mplayer:view', $context);
$event = \mod_mplayer\event\mplayer_viewed::create(array(
'objectid' => $cm->id,
'context' => $context,
'other' => array(
'objectname' => $mplayer->name
)
));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('course', $course);
$event->add_record_snapshot('mplayer', $mplayer);
$event->trigger();
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
// Print the page header.
$strmplayers = get_string('modulenameplural', 'mplayer');
$strmplayer = get_string('modulename', 'mplayer');
$PAGE->set_title(format_string($mplayer->name));
$PAGE->set_heading('');
$PAGE->navbar->add(get_string('mplayer', 'mplayer').': '.$mplayer->name);
$PAGE->set_focuscontrol('');
$PAGE->set_cacheable(true);
echo $OUTPUT->header();
$mplayer->instance = $cm->instance;
$renderer = $PAGE->get_renderer('mod_mplayer');
echo $renderer->print_body($mplayer); // See mod/mplayer/lib.php.
echo $renderer->intro($mplayer);
if (($COURSE->format != 'singleactivity') || ($COURSE->format == 'page' && optional_param('aspage', false, PARAM_INT))) {
echo '<center>';
if ($COURSE->format == 'page') {
include_once($CFG->dirroot.'/course/format/page/xlib.php');
page_print_page_format_navigation($cm, false);
}
$params = array('id' => $course->id);
$label = get_string('backtocourse', 'mplayer');
echo $OUTPUT->single_button(new moodle_url('/course/view.php', $params), $label);
echo '</center>';
}
// Finish the page.
echo $OUTPUT->footer($course);
// End of mod/mplayer/view.php.