1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* @package mod
|
|
|
19 |
* @subpackage eduplayer
|
|
|
20 |
* @author Humanage Srl <info@humanage.it>
|
|
|
21 |
* @copyright 2013 Humanage Srl <info@humanage.it>
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
|
|
|
26 |
require_once(dirname(__FILE__).'/lib.php');
|
|
|
27 |
|
|
|
28 |
$id = required_param('id', PARAM_INT);
|
|
|
29 |
|
|
|
30 |
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
|
|
|
31 |
|
|
|
32 |
require_course_login($course);
|
|
|
33 |
|
|
|
34 |
add_to_log($course->id, 'eduplayer', 'view all', 'index.php?id='.$course->id, '');
|
|
|
35 |
|
|
|
36 |
$coursecontext = CONTEXT_COURSE::instance($course->id);
|
|
|
37 |
|
|
|
38 |
$PAGE->set_pagelayout('incourse');
|
|
|
39 |
$PAGE->set_url('/mod/eduplayer/index.php', array('id' => $id));
|
|
|
40 |
$PAGE->set_title(format_string($course->fullname));
|
|
|
41 |
$PAGE->set_heading(format_string($course->fullname));
|
|
|
42 |
$PAGE->set_context($coursecontext);
|
|
|
43 |
|
|
|
44 |
echo $OUTPUT->header();
|
|
|
45 |
|
|
|
46 |
if (! $eduplayers = get_all_instances_in_course('eduplayer', $course)) {
|
|
|
47 |
notice(get_string('noeduplayers', 'eduplayer'), new moodle_url('/course/view.php', array('id' => $course->id)));
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
$table = new html_table();
|
|
|
51 |
if ($course->format == 'weeks') {
|
|
|
52 |
$table->head = array(get_string('week'), get_string('name'));
|
|
|
53 |
$table->align = array('center', 'left');
|
|
|
54 |
} else if ($course->format == 'topics') {
|
|
|
55 |
$table->head = array(get_string('topic'), get_string('name'));
|
|
|
56 |
$table->align = array('center', 'left', 'left', 'left');
|
|
|
57 |
} else {
|
|
|
58 |
$table->head = array(get_string('name'));
|
|
|
59 |
$table->align = array('left', 'left', 'left');
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
foreach ($eduplayers as $eduplayer) {
|
|
|
63 |
if (!$eduplayer->visible) {
|
|
|
64 |
$link = html_writer::link(
|
|
|
65 |
new moodle_url('/mod/eduplayer/view.php', array('id' => $eduplayer->coursemodule)),
|
|
|
66 |
format_string($eduplayer->name, true),
|
|
|
67 |
array('class' => 'dimmed'));
|
|
|
68 |
} else {
|
|
|
69 |
$link = html_writer::link(
|
|
|
70 |
new moodle_url('/mod/eduplayer/view.php', array('id' => $eduplayer->coursemodule)),
|
|
|
71 |
format_string($eduplayer->name, true));
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
if ($course->format == 'weeks' or $course->format == 'topics') {
|
|
|
75 |
$table->data[] = array($eduplayer->section, $link);
|
|
|
76 |
} else {
|
|
|
77 |
$table->data[] = array($link);
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
echo $OUTPUT->heading(get_string('modulenameplural', 'eduplayer'), 2);
|
|
|
82 |
echo html_writer::table($table);
|
|
|
83 |
echo $OUTPUT->footer();
|