Repository navigation
Expand file tree
/
Copy pathview.php
More file actions
70 lines (53 loc) · 2.18 KB
/
Copy pathview.php
File metadata and controls
70 lines (53 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php // $Id: view.php,v 1.4 2006/08/28 16:41:20 mark-nielsen Exp $
/**
* This page prints a particular instance of newmodule
*
* @author
* @version $Id: view.php,v 1.4 2006/08/28 16:41:20 mark-nielsen Exp $
* @package newmodule
**/
/// (Replace newmodule with the name of your module)
require_once("../../config.php");
require_once("lib.php");
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
$a = optional_param('a', 0, PARAM_INT); // newmodule ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
}
if (! $newmodule = get_record("newmodule", "id", $cm->instance)) {
error("Course module is incorrect");
}
} else {
if (! $newmodule = get_record("newmodule", "id", $a)) {
error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $newmodule->course)) {
error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("newmodule", $newmodule->id, $course->id)) {
error("Course Module ID was incorrect");
}
}
require_login($course->id);
add_to_log($course->id, "newmodule", "view", "view.php?id=$cm->id", "$newmodule->id");
/// Print the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
} else {
$navigation = '';
}
$strnewmodules = get_string("modulenameplural", "newmodule");
$strnewmodule = get_string("modulename", "newmodule");
print_header("$course->shortname: $newmodule->name", "$course->fullname",
"$navigation <a href=index.php?id=$course->id>$strnewmodules</a> -> $newmodule->name",
"", "", true, update_module_button($cm->id, $course->id, $strnewmodule),
navmenu($course, $cm));
/// Print the main part of the page
echo "YOUR CODE GOES HERE";
/// Finish the page
print_footer($course);
?>