2004-09-12 17:34:35 +00:00
|
|
|
<?php // $Id$
|
2002-10-17 14:03:59 +00:00
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
2003-11-27 19:09:47 +00:00
|
|
|
|
2005-03-04 10:13:42 +00:00
|
|
|
$id = optional_param('id', 0, PARAM_INT); // Course Module ID
|
|
|
|
$r = optional_param('r', 0, PARAM_INT); // Resource
|
2002-10-17 14:03:59 +00:00
|
|
|
|
2005-03-04 10:13:42 +00:00
|
|
|
if ($r) { // Two ways to specify the resource
|
|
|
|
if (! $resource = get_record('resource', 'id', $r)) {
|
|
|
|
error('Resource ID was incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $cm = get_coursemodule_from_instance('resource', $resource->id, $resource->course)) {
|
|
|
|
error('Course Module ID was incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if ($id) {
|
2006-08-08 22:09:55 +00:00
|
|
|
if (! $cm = get_coursemodule_from_id('resource', $id)) {
|
2005-03-04 10:13:42 +00:00
|
|
|
error('Course Module ID was incorrect');
|
|
|
|
}
|
2002-10-17 14:03:59 +00:00
|
|
|
|
2005-03-04 10:13:42 +00:00
|
|
|
if (! $resource = get_record('resource', 'id', $cm->instance)) {
|
|
|
|
error('Resource ID was incorrect');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
error('No valid parameters!!');
|
2002-10-17 14:03:59 +00:00
|
|
|
}
|
|
|
|
|
2007-01-22 18:49:42 +00:00
|
|
|
require_course_login($course, true, $cm);
|
|
|
|
|
2005-03-04 10:13:42 +00:00
|
|
|
require ($CFG->dirroot.'/mod/resource/type/'.$resource->type.'/resource.class.php');
|
|
|
|
$resourceclass = 'resource_'.$resource->type;
|
2004-11-11 07:45:27 +00:00
|
|
|
$resourceinstance = new $resourceclass($cm->id);
|
2004-01-09 06:36:43 +00:00
|
|
|
|
2004-07-25 14:32:05 +00:00
|
|
|
$resourceinstance->display();
|
2002-10-17 14:03:59 +00:00
|
|
|
|
2003-12-06 07:34:55 +00:00
|
|
|
?>
|