Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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
 * IMS CP module main user interface
19
 *
20
 * @package mod_imscp
21
 * @copyright  2009 Petr Skoda  {@link http://skodak.org}
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
require('../../config.php');
26
require_once($CFG->dirroot . '/mod/imscp/lib.php');
27
require_once("$CFG->dirroot/mod/imscp/locallib.php");
28
require_once($CFG->libdir . '/completionlib.php');
29
 
30
$id = optional_param('id', 0, PARAM_INT);  // Course module id.
31
$i  = optional_param('i', 0, PARAM_INT);   // IMS CP instance id.
32
 
33
if ($i) {  // Two ways to specify the module.
34
    $imscp = $DB->get_record('imscp', array('id' => $i), '*', MUST_EXIST);
35
    $cm = get_coursemodule_from_instance('imscp', $imscp->id, $imscp->course, false, MUST_EXIST);
36
 
37
} else {
38
    $cm = get_coursemodule_from_id('imscp', $id, 0, false, MUST_EXIST);
39
    $imscp = $DB->get_record('imscp', array('id' => $cm->instance), '*', MUST_EXIST);
40
}
41
 
42
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
43
 
44
require_course_login($course, true, $cm);
45
$context = context_module::instance($cm->id);
46
require_capability('mod/imscp:view', $context);
47
 
48
// Completion and trigger events.
49
imscp_view($imscp, $course, $cm, $context);
50
 
51
$PAGE->set_url('/mod/imscp/view.php', array('id' => $cm->id));
52
$PAGE->requires->js('/mod/imscp/dummyapi.js', true);
53
 
54
$PAGE->requires->string_for_js('navigation', 'imscp');
55
$PAGE->requires->string_for_js('toc', 'imscp');
56
$PAGE->requires->string_for_js('hide', 'moodle');
57
$PAGE->requires->string_for_js('show', 'moodle');
58
 
59
// TODO: find some better way to disable blocks and minimise footer - pagetype just for this does not seem like a good solution.
60
// $PAGE->set_pagelayout('maxcontent'); ?
61
 
62
$PAGE->set_title($course->shortname.': '.$imscp->name);
63
$PAGE->set_heading($course->fullname);
64
$PAGE->set_activity_record($imscp);
65
 
66
// Verify imsmanifest was parsed properly.
67
if (!$imscp->structure) {
68
    redirect(course_get_url($course->id, $cm->section), get_string('deploymenterror', 'imscp'));
69
}
70
 
71
echo $OUTPUT->header();
72
 
73
imscp_print_content($imscp, $cm, $course);
74
 
75
echo $OUTPUT->footer();