Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/label/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_once("../../config.php");
00028 
00029 $id = optional_param('id',0,PARAM_INT);    // Course Module ID, or
00030 $l = optional_param('l',0,PARAM_INT);     // Label ID
00031 
00032 if ($id) {
00033     $PAGE->set_url('/mod/label/index.php', array('id'=>$id));
00034     if (! $cm = get_coursemodule_from_id('label', $id)) {
00035         print_error('invalidcoursemodule');
00036     }
00037 
00038     if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
00039         print_error('coursemisconf');
00040     }
00041 
00042     if (! $label = $DB->get_record("label", array("id"=>$cm->instance))) {
00043         print_error('invalidcoursemodule');
00044     }
00045 
00046 } else {
00047     $PAGE->set_url('/mod/label/index.php', array('l'=>$l));
00048     if (! $label = $DB->get_record("label", array("id"=>$l))) {
00049         print_error('invalidcoursemodule');
00050     }
00051     if (! $course = $DB->get_record("course", array("id"=>$label->course)) ){
00052         print_error('coursemisconf');
00053     }
00054     if (! $cm = get_coursemodule_from_instance("label", $label->id, $course->id)) {
00055         print_error('invalidcoursemodule');
00056     }
00057 }
00058 
00059 require_login($course, true, $cm);
00060 
00061 redirect("$CFG->wwwroot/course/view.php?id=$course->id");
00062 
00063 
 All Data Structures Namespaces Files Functions Variables Enumerations