mirror of
https://github.com/moodle/moodle.git
synced 2025-02-15 21:36:58 +01:00
This check-in removes about 400 lines of code. I hope I have not screwed anything up. I would be grateful if people could review this change, and keep an eye on the navigation bar in modules. Any navigation bar bugs you find in the near future, feel free to file them in the tracker and assign them to me. Thanks. If not to many problems are found, I think I would like to backport this to 1.9 stable, but I am not sure that is a good idea. Opinions to the General Developer Forum please. I am about to start a thread there.
107 lines
4.5 KiB
PHP
107 lines
4.5 KiB
PHP
<?php // $Id$
|
|
|
|
/// This page prints a particular instance of lams
|
|
/// (Replace lams with the name of your module)
|
|
|
|
require_once("../../config.php");
|
|
require_once("lib.php");
|
|
require_once("constants.php");
|
|
|
|
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
|
|
|
|
if (! $cm = get_coursemodule_from_id('lams', $id)) {
|
|
error("Course Module ID was incorrect");
|
|
}
|
|
|
|
if (! $course = get_record("course", "id", $cm->course)) {
|
|
error("Course is misconfigured");
|
|
}
|
|
|
|
if (! $lams = get_record("lams", "id", $cm->instance)) {
|
|
error("Course module is incorrect");
|
|
}
|
|
|
|
require_login($course, true, $cm);
|
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
|
|
|
add_to_log($course->id, "lams", "view", "view.php?id=$cm->id", "$lams->id");
|
|
|
|
/// Print the page header
|
|
$navigation = build_navigation('', $cm);
|
|
print_header_simple(format_string($lams->name), "", $navigation, "", "", true,
|
|
update_module_button($cm->id, $course->id, get_string("lesson","lams")), navmenu($course, $cm));
|
|
|
|
echo '<table id="layout-table"><tr>';
|
|
echo '<td id="middle-column">';
|
|
print_heading(format_string($lams->name));
|
|
|
|
//$strlamss = get_string("modulenameplural", "lams");
|
|
//$strlams = get_string("modulename", "lams");
|
|
|
|
//print_header("$course->shortname: $lams->name", "$course->fullname",
|
|
// "$navigation <A HREF=index.php?id=$course->id>$strlamss</A> -> $lams->name",
|
|
// "", "", true, update_module_button($cm->id, $course->id, $strlams),
|
|
// navmenu($course, $cm));
|
|
|
|
/// Print the main part of the page
|
|
if(has_capability('mod/lams:manage', $context)){
|
|
$datetime = date("F d,Y g:i a");
|
|
$plaintext = trim($datetime).trim($USER->username).trim($LAMSCONSTANTS->monitor_method).trim($CFG->lams_serverid).trim($CFG->lams_serverkey);
|
|
$hash = sha1(strtolower($plaintext));
|
|
$url = $CFG->lams_serverurl.$LAMSCONSTANTS->login_request.
|
|
'?'.$LAMSCONSTANTS->param_uid.'='.$USER->username.
|
|
'&'.$LAMSCONSTANTS->param_method.'='.$LAMSCONSTANTS->monitor_method.
|
|
'&'.$LAMSCONSTANTS->param_timestamp.'='.urlencode($datetime).
|
|
'&'.$LAMSCONSTANTS->param_serverid.'='.$CFG->lams_serverid.
|
|
'&'.$LAMSCONSTANTS->param_hash.'='.$hash.
|
|
'&'.$LAMSCONSTANTS->param_lsid.'='.$lams->learning_session_id.
|
|
'&'.$LAMSCONSTANTS->param_courseid.'='.$lams->course;
|
|
print_simple_box_start('center');
|
|
echo '<a target="LAMS Monitor" title="LAMS Monitor" href="'.$url.'">'.get_string("openmonitor", "lams").'</a>';
|
|
print_simple_box_end();
|
|
|
|
$plaintext = trim($datetime).trim($USER->username).trim($LAMSCONSTANTS->learner_method).trim($CFG->lams_serverid).trim($CFG->lams_serverkey);
|
|
$hash = sha1(strtolower($plaintext));
|
|
$url = $CFG->lams_serverurl.$LAMSCONSTANTS->login_request.
|
|
'?'.$LAMSCONSTANTS->param_uid.'='.$USER->username.
|
|
'&'.$LAMSCONSTANTS->param_method.'='.$LAMSCONSTANTS->learner_method.
|
|
'&'.$LAMSCONSTANTS->param_timestamp.'='.urlencode($datetime).
|
|
'&'.$LAMSCONSTANTS->param_serverid.'='.$CFG->lams_serverid.
|
|
'&'.$LAMSCONSTANTS->param_hash.'='.$hash.
|
|
'&'.$LAMSCONSTANTS->param_lsid.'='.$lams->learning_session_id.
|
|
'&'.$LAMSCONSTANTS->param_courseid.'='.$lams->course;
|
|
print_simple_box_start('center');
|
|
echo '<a target="LAMS Learner" title="LAMS Learner" href="'.$url.'">'.get_string("openlearner", "lams").'</a>';
|
|
print_simple_box_end();
|
|
}else if(has_capability('mod/lams:participate', $context)){
|
|
$datetime = date("F d,Y g:i a");
|
|
$plaintext = trim($datetime).trim($USER->username).trim($LAMSCONSTANTS->learner_method).trim($CFG->lams_serverid).trim($CFG->lams_serverkey);
|
|
$hash = sha1(strtolower($plaintext));
|
|
$url = $CFG->lams_serverurl.$LAMSCONSTANTS->login_request.
|
|
'?'.$LAMSCONSTANTS->param_uid.'='.$USER->username.
|
|
'&'.$LAMSCONSTANTS->param_method.'='.$LAMSCONSTANTS->learner_method.
|
|
'&'.$LAMSCONSTANTS->param_timestamp.'='.urlencode($datetime).
|
|
'&'.$LAMSCONSTANTS->param_serverid.'='.$CFG->lams_serverid.
|
|
'&'.$LAMSCONSTANTS->param_hash.'='.$hash.
|
|
'&'.$LAMSCONSTANTS->param_lsid.'='.$lams->learning_session_id.
|
|
'&'.$LAMSCONSTANTS->param_courseid.'='.$lams->course;
|
|
print_simple_box_start('center');
|
|
echo '<a target="LAMS Learner" title="LAMS Learner" href="'.$url.'">'.get_string("openlearner", "lams").'</a>';
|
|
print_simple_box_end();
|
|
}
|
|
|
|
if ($lams->introduction) {
|
|
print_box(format_text($lams->introduction), 'generalbox', 'intro');
|
|
}
|
|
|
|
|
|
/// Finish the page
|
|
echo '</td></tr></table>';
|
|
|
|
|
|
|
|
/// Finish the page
|
|
print_footer($course);
|
|
|
|
?>
|