3 /// This page prints a particular instance of lams
4 /// (Replace lams with the name of your module)
6 require_once("../../config.php");
7 require_once("lib.php");
8 require_once("constants.php");
10 $id = optional_param('id', 0, PARAM_INT
); // Course Module ID, or
12 if (! $cm = get_coursemodule_from_id('lams', $id)) {
13 error("Course Module ID was incorrect");
16 if (! $course = get_record("course", "id", $cm->course
)) {
17 error("Course is misconfigured");
20 if (! $lams = get_record("lams", "id", $cm->instance
)) {
21 error("Course module is incorrect");
24 require_login($course, true, $cm);
25 $context = get_context_instance(CONTEXT_MODULE
, $cm->id
);
27 add_to_log($course->id
, "lams", "view", "view.php?id=$cm->id", "$lams->id");
29 /// Print the page header
31 //if ($course->id != SITEID) {
32 // $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
35 $navlinks[] = array('name' => $strchoices, 'link' => "index.php?id=$course->id", 'type' => 'misc');
36 $navlinks[] = array('name' => format_string($lams->name
), 'link' => null, 'type' => 'misc');
37 $navigation = build_navigation($navlinks);
38 print_header_simple(format_string($lams->name
), "", $navigation, "", "", true,
39 update_module_button($cm->id
, $course->id
, get_string("lesson","lams")), navmenu($course, $cm));
41 echo '<table id="layout-table"><tr>';
42 echo '<td id="middle-column">';
43 print_heading(format_string($lams->name
));
45 //$strlamss = get_string("modulenameplural", "lams");
46 //$strlams = get_string("modulename", "lams");
48 //print_header("$course->shortname: $lams->name", "$course->fullname",
49 // "$navigation <A HREF=index.php?id=$course->id>$strlamss</A> -> $lams->name",
50 // "", "", true, update_module_button($cm->id, $course->id, $strlams),
51 // navmenu($course, $cm));
53 /// Print the main part of the page
54 if(has_capability('mod/lams:manage', $context)){
55 $datetime = date("F d,Y g:i a");
56 $plaintext = trim($datetime).trim($USER->username
).trim($LAMSCONSTANTS->monitor_method
).trim($CFG->lams_serverid
).trim($CFG->lams_serverkey
);
57 $hash = sha1(strtolower($plaintext));
58 $url = $CFG->lams_serverurl
.$LAMSCONSTANTS->login_request
.
59 '?'.$LAMSCONSTANTS->param_uid
.'='.$USER->username
.
60 '&'.$LAMSCONSTANTS->param_method
.'='.$LAMSCONSTANTS->monitor_method
.
61 '&'.$LAMSCONSTANTS->param_timestamp
.'='.urlencode($datetime).
62 '&'.$LAMSCONSTANTS->param_serverid
.'='.$CFG->lams_serverid
.
63 '&'.$LAMSCONSTANTS->param_hash
.'='.$hash.
64 '&'.$LAMSCONSTANTS->param_lsid
.'='.$lams->learning_session_id
.
65 '&'.$LAMSCONSTANTS->param_courseid
.'='.$lams->course
;
66 print_simple_box_start('center');
67 echo '<a target="LAMS Monitor" title="LAMS Monitor" href="'.$url.'">'.get_string("openmonitor", "lams").'</a>';
68 print_simple_box_end();
70 $plaintext = trim($datetime).trim($USER->username
).trim($LAMSCONSTANTS->learner_method
).trim($CFG->lams_serverid
).trim($CFG->lams_serverkey
);
71 $hash = sha1(strtolower($plaintext));
72 $url = $CFG->lams_serverurl
.$LAMSCONSTANTS->login_request
.
73 '?'.$LAMSCONSTANTS->param_uid
.'='.$USER->username
.
74 '&'.$LAMSCONSTANTS->param_method
.'='.$LAMSCONSTANTS->learner_method
.
75 '&'.$LAMSCONSTANTS->param_timestamp
.'='.urlencode($datetime).
76 '&'.$LAMSCONSTANTS->param_serverid
.'='.$CFG->lams_serverid
.
77 '&'.$LAMSCONSTANTS->param_hash
.'='.$hash.
78 '&'.$LAMSCONSTANTS->param_lsid
.'='.$lams->learning_session_id
.
79 '&'.$LAMSCONSTANTS->param_courseid
.'='.$lams->course
;
80 print_simple_box_start('center');
81 echo '<a target="LAMS Learner" title="LAMS Learner" href="'.$url.'">'.get_string("openlearner", "lams").'</a>';
82 print_simple_box_end();
83 }else if(has_capability('mod/lams:participate', $context)){
84 $datetime = date("F d,Y g:i a");
85 $plaintext = trim($datetime).trim($USER->username
).trim($LAMSCONSTANTS->learner_method
).trim($CFG->lams_serverid
).trim($CFG->lams_serverkey
);
86 $hash = sha1(strtolower($plaintext));
87 $url = $CFG->lams_serverurl
.$LAMSCONSTANTS->login_request
.
88 '?'.$LAMSCONSTANTS->param_uid
.'='.$USER->username
.
89 '&'.$LAMSCONSTANTS->param_method
.'='.$LAMSCONSTANTS->learner_method
.
90 '&'.$LAMSCONSTANTS->param_timestamp
.'='.urlencode($datetime).
91 '&'.$LAMSCONSTANTS->param_serverid
.'='.$CFG->lams_serverid
.
92 '&'.$LAMSCONSTANTS->param_hash
.'='.$hash.
93 '&'.$LAMSCONSTANTS->param_lsid
.'='.$lams->learning_session_id
.
94 '&'.$LAMSCONSTANTS->param_courseid
.'='.$lams->course
;
95 print_simple_box_start('center');
96 echo '<a target="LAMS Learner" title="LAMS Learner" href="'.$url.'">'.get_string("openlearner", "lams").'</a>';
97 print_simple_box_end();
100 if ($lams->introduction
) {
101 print_box(format_text($lams->introduction
), 'generalbox', 'intro');
106 echo '</td></tr></table>';
111 print_footer($course);