2009-09-24 08:28:51 +00:00
|
|
|
<?php
|
2006-08-08 22:09:55 +00:00
|
|
|
|
|
|
|
require_once("../../config.php");
|
|
|
|
require_once('locallib.php');
|
2009-11-01 15:24:58 +00:00
|
|
|
|
2006-08-08 22:09:55 +00:00
|
|
|
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
|
|
|
$a = optional_param('a', '', PARAM_INT); // scorm ID
|
2006-08-31 10:29:16 +00:00
|
|
|
$organization = optional_param('organization', '', PARAM_INT); // organization ID
|
2006-08-08 22:09:55 +00:00
|
|
|
|
|
|
|
if (!empty($id)) {
|
2006-08-31 10:29:16 +00:00
|
|
|
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
|
2008-06-15 11:00:30 +00:00
|
|
|
print_error('invalidcoursemodule');
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
2008-06-05 10:02:26 +00:00
|
|
|
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
2008-06-15 11:00:30 +00:00
|
|
|
print_error('coursemisconf');
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
2008-06-05 10:02:26 +00:00
|
|
|
if (! $scorm = $DB->get_record("scorm", array("id"=>$cm->instance))) {
|
2008-06-15 11:00:30 +00:00
|
|
|
print_error('invalidcoursemodule');
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
|
|
|
} else if (!empty($a)) {
|
2008-06-05 10:02:26 +00:00
|
|
|
if (! $scorm = $DB->get_record("scorm", array("id"=>$a))) {
|
2008-06-15 11:00:30 +00:00
|
|
|
print_error('invalidcoursemodule');
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
2008-06-05 10:02:26 +00:00
|
|
|
if (! $course = $DB->get_record("course", array("id"=>$scorm->course))) {
|
2008-06-15 11:00:30 +00:00
|
|
|
print_error('coursemisconf');
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
|
|
|
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
|
2008-06-15 11:00:30 +00:00
|
|
|
print_error('invalidcoursemodule');
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-06-15 11:00:30 +00:00
|
|
|
print_error('missingparameter');
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$url = new moodle_url('/mod/scorm/view.php', array('id'=>$cm->id));
|
2009-09-24 08:28:51 +00:00
|
|
|
if ($organization !== '') {
|
|
|
|
$url->param('organization', $organization);
|
|
|
|
}
|
|
|
|
$PAGE->set_url($url);
|
2009-11-01 15:24:58 +00:00
|
|
|
|
2006-08-08 22:09:55 +00:00
|
|
|
require_login($course->id, false, $cm);
|
|
|
|
|
2006-08-31 10:37:33 +00:00
|
|
|
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
2006-08-31 10:29:16 +00:00
|
|
|
|
2006-08-08 22:09:55 +00:00
|
|
|
if (isset($SESSION->scorm_scoid)) {
|
|
|
|
unset($SESSION->scorm_scoid);
|
|
|
|
}
|
|
|
|
|
|
|
|
$strscorms = get_string("modulenameplural", "scorm");
|
|
|
|
$strscorm = get_string("modulename", "scorm");
|
|
|
|
|
|
|
|
$pagetitle = strip_tags($course->shortname.': '.format_string($scorm->name));
|
|
|
|
|
2008-08-05 22:58:32 +00:00
|
|
|
add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id", $cm->id);
|
2006-08-08 22:09:55 +00:00
|
|
|
|
2006-09-26 14:40:00 +00:00
|
|
|
if ((has_capability('mod/scorm:skipview', get_context_instance(CONTEXT_MODULE,$cm->id))) && scorm_simple_play($scorm,$USER)) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2006-08-08 22:09:55 +00:00
|
|
|
//
|
|
|
|
// Print the page header
|
|
|
|
//
|
2009-09-04 01:41:51 +00:00
|
|
|
$PAGE->set_title($pagetitle);
|
|
|
|
$PAGE->set_heading($course->fullname);
|
|
|
|
echo $OUTPUT->header();
|
2006-08-08 22:09:55 +00:00
|
|
|
|
2008-02-08 10:00:13 +00:00
|
|
|
if (has_capability('mod/scorm:viewreport', $context)) {
|
2009-11-01 15:24:58 +00:00
|
|
|
|
2007-08-28 02:54:37 +00:00
|
|
|
$trackedusers = scorm_get_count_users($scorm->id, $cm->groupingid);
|
|
|
|
if ($trackedusers > 0) {
|
2008-03-04 20:11:36 +00:00
|
|
|
echo "<div class=\"reportlink\"><a $CFG->frametarget href=\"report.php?id=$cm->id\"> ".get_string('viewalluserreports','scorm',$trackedusers).'</a></div>';
|
2006-08-31 08:34:13 +00:00
|
|
|
} else {
|
|
|
|
echo '<div class="reportlink">'.get_string('noreports','scorm').'</div>';
|
|
|
|
}
|
2006-08-08 22:09:55 +00:00
|
|
|
}
|
2006-08-31 08:34:13 +00:00
|
|
|
|
|
|
|
// Print the main part of the page
|
2009-08-06 08:21:24 +00:00
|
|
|
echo $OUTPUT->heading(format_string($scorm->name));
|
2008-09-16 20:32:50 +00:00
|
|
|
$attemptstatus = '';
|
2009-04-22 05:10:08 +00:00
|
|
|
if ($scorm->displayattemptstatus == 1) {
|
2008-09-16 20:32:50 +00:00
|
|
|
$attemptstatus = scorm_get_attempt_status($USER,$scorm);
|
|
|
|
}
|
2009-08-18 05:16:50 +00:00
|
|
|
echo $OUTPUT->box(format_module_intro('scorm', $scorm, $cm->id).$attemptstatus, 'generalbox boxaligncenter boxwidthwide', 'intro');
|
2009-11-01 15:24:58 +00:00
|
|
|
|
2008-11-28 09:20:59 +00:00
|
|
|
$scormopen = true;
|
|
|
|
$timenow = time();
|
|
|
|
if ($scorm->timeclose !=0) {
|
|
|
|
if ($scorm->timeopen > $timenow) {
|
2009-08-18 05:16:50 +00:00
|
|
|
echo $OUTPUT->box(get_string("notopenyet", "scorm", userdate($scorm->timeopen)), "generalbox boxaligncenter");
|
2008-11-28 09:20:59 +00:00
|
|
|
$scormopen = false;
|
|
|
|
} else if ($timenow > $scorm->timeclose) {
|
2009-08-18 05:16:50 +00:00
|
|
|
echo $OUTPUT->box(get_string("expired", "scorm", userdate($scorm->timeclose)), "generalbox boxaligncenter");
|
2008-11-28 09:20:59 +00:00
|
|
|
$scormopen = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($scormopen) {
|
|
|
|
scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);
|
|
|
|
}
|
2009-08-06 14:20:31 +00:00
|
|
|
echo $OUTPUT->footer();
|
2009-11-01 15:24:58 +00:00
|
|
|
|