Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/imscp/view.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00027 require('../../config.php');
00028 require_once("$CFG->dirroot/mod/imscp/locallib.php");
00029 require_once($CFG->libdir . '/completionlib.php');
00030 
00031 $id = optional_param('id', 0, PARAM_INT);  // Course module ID
00032 $i  = optional_param('i', 0, PARAM_INT);   // IMS CP instance id
00033 
00034 if ($i) {  // Two ways to specify the module
00035     $imscp = $DB->get_record('imscp', array('id'=>$i), '*', MUST_EXIST);
00036     $cm = get_coursemodule_from_instance('imscp', $imscp->id, $imscp->course, false, MUST_EXIST);
00037 
00038 } else {
00039     $cm = get_coursemodule_from_id('imscp', $id, 0, false, MUST_EXIST);
00040     $imscp = $DB->get_record('imscp', array('id'=>$cm->instance), '*', MUST_EXIST);
00041 }
00042 
00043 $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
00044 
00045 require_course_login($course, true, $cm);
00046 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
00047 require_capability('mod/imscp:view', $context);
00048 
00049 add_to_log($course->id, 'imscp', 'view', 'view.php?id='.$cm->id, $imscp->id, $cm->id);
00050 
00051 // Update 'viewed' state if required by completion system
00052 $completion = new completion_info($course);
00053 $completion->set_module_viewed($cm);
00054 
00055 $PAGE->set_url('/mod/imscp/view.php', array('id' => $cm->id));
00056 $PAGE->requires->js('/mod/imscp/dummyapi.js', true);
00057 
00058 $PAGE->requires->string_for_js('navigation', 'imscp');
00059 $PAGE->requires->string_for_js('toc', 'imscp');
00060 $PAGE->requires->string_for_js('hide', 'moodle');
00061 $PAGE->requires->string_for_js('show', 'moodle');
00062 
00063 //TODO: find some better way to disable blocks and minimise footer - pagetype just for this does not seem like a good solution
00064 //$PAGE->set_pagelayout('maxcontent');
00065 
00066 $PAGE->set_title($course->shortname.': '.$imscp->name);
00067 $PAGE->set_heading($course->fullname);
00068 $PAGE->set_activity_record($imscp);
00069 echo $OUTPUT->header();
00070 
00071 // verify imsmanifest was parsed properly
00072 if (!$imscp->structure) {
00073     echo $OUTPUT->notification(get_string('deploymenterror', 'imscp'), 'notifyproblem');
00074     echo $OUTPUT->footer();
00075     die;
00076 }
00077 
00078 imscp_print_content($imscp, $cm, $course);
00079 
00080 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations