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->id
);
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> ->";
34 print_header_simple(format_string($lams->name
), "",
35 "<a href=\"index.php?id=$course->id\">$strchoices</a> -> ".format_string($lams->name
), "", "", true,
36 update_module_button($cm->id
, $course->id
, get_string("lesson","lams")), navmenu($course, $cm));
38 echo '<table id="layout-table"><tr>';
39 echo '<td id="middle-column">';
40 print_heading(format_string($lams->name
));
42 //$strlamss = get_string("modulenameplural", "lams");
43 //$strlams = get_string("modulename", "lams");
45 //print_header("$course->shortname: $lams->name", "$course->fullname",
46 // "$navigation <A HREF=index.php?id=$course->id>$strlamss</A> -> $lams->name",
47 // "", "", true, update_module_button($cm->id, $course->id, $strlams),
48 // navmenu($course, $cm));
50 /// Print the main part of the page
51 if(has_capability('mod/lams:manage', $context)){
52 $datetime = date("F d,Y g:i a");
53 $plaintext = trim($datetime).trim($USER->username
).trim($LAMSCONSTANTS->monitor_method
).trim($CFG->lams_serverid
).trim($CFG->lams_serverkey
);
54 $hash = sha1(strtolower($plaintext));
55 $url = $CFG->lams_serverurl
.$LAMSCONSTANTS->login_request
.
56 '?'.$LAMSCONSTANTS->param_uid
.'='.$USER->username
.
57 '&'.$LAMSCONSTANTS->param_method
.'='.$LAMSCONSTANTS->monitor_method
.
58 '&'.$LAMSCONSTANTS->param_timestamp
.'='.urlencode($datetime).
59 '&'.$LAMSCONSTANTS->param_serverid
.'='.$CFG->lams_serverid
.
60 '&'.$LAMSCONSTANTS->param_hash
.'='.$hash.
61 '&'.$LAMSCONSTANTS->param_lsid
.'='.$lams->learning_session_id
.
62 '&'.$LAMSCONSTANTS->param_courseid
.'='.$lams->course
;
63 print_simple_box_start('center');
64 echo '<a target="LAMS Monitor" title="LAMS Monitor" href="'.$url.'">'.get_string("openmonitor", "lams").'</a>';
65 print_simple_box_end();
67 $plaintext = trim($datetime).trim($USER->username
).trim($LAMSCONSTANTS->learner_method
).trim($CFG->lams_serverid
).trim($CFG->lams_serverkey
);
68 $hash = sha1(strtolower($plaintext));
69 $url = $CFG->lams_serverurl
.$LAMSCONSTANTS->login_request
.
70 '?'.$LAMSCONSTANTS->param_uid
.'='.$USER->username
.
71 '&'.$LAMSCONSTANTS->param_method
.'='.$LAMSCONSTANTS->learner_method
.
72 '&'.$LAMSCONSTANTS->param_timestamp
.'='.urlencode($datetime).
73 '&'.$LAMSCONSTANTS->param_serverid
.'='.$CFG->lams_serverid
.
74 '&'.$LAMSCONSTANTS->param_hash
.'='.$hash.
75 '&'.$LAMSCONSTANTS->param_lsid
.'='.$lams->learning_session_id
.
76 '&'.$LAMSCONSTANTS->param_courseid
.'='.$lams->course
;
77 print_simple_box_start('center');
78 echo '<a target="LAMS Learner" title="LAMS Learner" href="'.$url.'">'.get_string("openlearner", "lams").'</a>';
79 print_simple_box_end();
80 }else if(has_capability('mod/lams:participate', $context)){
81 $datetime = date("F d,Y g:i a");
82 $plaintext = trim($datetime).trim($USER->username
).trim($LAMSCONSTANTS->learner_method
).trim($CFG->lams_serverid
).trim($CFG->lams_serverkey
);
83 $hash = sha1(strtolower($plaintext));
84 $url = $CFG->lams_serverurl
.$LAMSCONSTANTS->login_request
.
85 '?'.$LAMSCONSTANTS->param_uid
.'='.$USER->username
.
86 '&'.$LAMSCONSTANTS->param_method
.'='.$LAMSCONSTANTS->learner_method
.
87 '&'.$LAMSCONSTANTS->param_timestamp
.'='.urlencode($datetime).
88 '&'.$LAMSCONSTANTS->param_serverid
.'='.$CFG->lams_serverid
.
89 '&'.$LAMSCONSTANTS->param_hash
.'='.$hash.
90 '&'.$LAMSCONSTANTS->param_lsid
.'='.$lams->learning_session_id
.
91 '&'.$LAMSCONSTANTS->param_courseid
.'='.$lams->course
;
92 print_simple_box_start('center');
93 echo '<a target="LAMS Learner" title="LAMS Learner" href="'.$url.'">'.get_string("openlearner", "lams").'</a>';
94 print_simple_box_end();
97 if ($lams->introduction
) {
98 print_box(format_text($lams->introduction
), 'generalbox', 'intro');
103 echo '</td></tr></table>';
108 print_footer($course);