unset($SESSION->scorm_scoid); } $strscorms = get_string("modulenameplural", "scorm"); $strscorm = get_string("modulename", "scorm"); if ($course->id != SITEID) { if ($scorms = get_all_instances_in_course('scorm', $course)) { // The module SCORM activity with the least id is the course $firstscorm = current($scorms); if (!($course->format == 'scorm' && $firstscorm->id == $scorm->id)) { $navlinks[] = array('name' => $strscorms, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); } } } $pagetitle = strip_tags($course->shortname . ': ' . format_string($scorm->name)); add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id=' . $cm->id, "{$scorm->id}"); if (has_capability('mod/scorm:skipview', get_context_instance(CONTEXT_MODULE, $cm->id)) && scorm_simple_play($scorm, $USER)) { exit; } // // Print the page header // $navlinks = array(); $navlinks[] = array('name' => format_string($scorm->name, true), 'link' => "view.php?id={$cm->id}", 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header($pagetitle, $course->fullname, $navigation, '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm)); if (has_capability('mod/scorm:viewreport', $context)) { $trackedusers = scorm_get_count_users($scorm->id, $cm->groupingid); if ($trackedusers > 0) { echo "<div class=\"reportlink\"><a {$CFG->frametarget} href=\"report.php?id={$cm->id}\"> " . get_string('viewalluserreports', 'scorm', $trackedusers) . '</a></div>'; } else { echo '<div class="reportlink">' . get_string('noreports', 'scorm') . '</div>';
if (isset($courseformat->coursedisplay) && $courseformat->coursedisplay == COURSE_DISPLAY_MULTIPAGE) { $sectionid = $cm->sectionnum; } $PAGE->requires->data_for_js('scormplayerdata', array('launch' => $launch, 'currentorg' => $orgidentifier, 'sco' => $scoid, 'scorm' => $scorm->id, 'courseurl' => course_get_url($course, $sectionid)->out(false), 'cwidth' => $scorm->width, 'cheight' => $scorm->height, 'popupoptions' => $scorm->options), true); $PAGE->requires->js('/mod/scorm/view.js', true); } if (isset($SESSION->scorm)) { unset($SESSION->scorm); } $strscorms = get_string("modulenameplural", "scorm"); $strscorm = get_string("modulename", "scorm"); $shortname = format_string($course->shortname, true, array('context' => $context)); $pagetitle = strip_tags($shortname . ': ' . format_string($scorm->name)); add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id=' . $cm->id, "{$scorm->id}", $cm->id); if (empty($launch) && has_capability('mod/scorm:skipview', $contextmodule)) { scorm_simple_play($scorm, $USER, $contextmodule, $cm->id); } // // Print the page header // $PAGE->set_title($pagetitle); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($scorm->name)); if (!empty($action) && confirm_sesskey() && has_capability('mod/scorm:deleteownresponses', $contextmodule)) { if ($action == 'delete') { $confirmurl = new moodle_url($PAGE->url, array('action' => 'deleteconfirm')); echo $OUTPUT->confirm(get_string('deleteuserattemptcheck', 'scorm'), $confirmurl, $PAGE->url); echo $OUTPUT->footer(); exit; } else {
function scorm_course_format_display($user, $course) { global $CFG, $DB, $PAGE, $OUTPUT; $strupdate = get_string('update'); $context = get_context_instance(CONTEXT_COURSE, $course->id); echo '<div class="mod-scorm">'; if ($scorms = get_all_instances_in_course('scorm', $course)) { // The module SCORM activity with the least id is the course $scorm = current($scorms); if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) { print_error('invalidcoursemodule'); } $contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id); if ((has_capability('mod/scorm:skipview', $contextmodule))) { scorm_simple_play($scorm, $user, $contextmodule, $cm->id); } $colspan = ''; $headertext = '<table width="100%"><tr><td class="title">'.get_string('name').': <b>'.format_string($scorm->name).'</b>'; if (has_capability('moodle/course:manageactivities', $context)) { if ($PAGE->user_is_editing()) { // Display update icon $path = $CFG->wwwroot.'/course'; $headertext .= '<span class="commands">'. '<a title="'.$strupdate.'" href="'.$path.'/mod.php?update='.$cm->id.'&sesskey='.sesskey().'">'. '<img src="'.$OUTPUT->pix_url('t/edit') . '" class="iconsmall" alt="'.$strupdate.'" /></a></span>'; } $headertext .= '</td>'; // Display report link $trackedusers = $DB->get_record('scorm_scoes_track', array('scormid'=>$scorm->id), 'count(distinct(userid)) as c'); if ($trackedusers->c > 0) { $headertext .= '<td class="reportlink">'. '<a href="'.$CFG->wwwroot.'/mod/scorm/report.php?id='.$cm->id.'">'. get_string('viewallreports', 'scorm', $trackedusers->c).'</a>'; } else { $headertext .= '<td class="reportlink">'.get_string('noreports', 'scorm'); } $colspan = ' colspan="2"'; } $headertext .= '</td></tr><tr><td'.$colspan.'>'.get_string('summary').':<br />'.format_module_intro('scorm', $scorm, $scorm->coursemodule).'</td></tr></table>'; echo $OUTPUT->box($headertext, 'generalbox boxwidthwide'); scorm_view_display($user, $scorm, 'view.php?id='.$course->id, $cm); } else { if (has_capability('moodle/course:update', $context)) { // Create a new activity $url = new moodle_url('/course/mod.php', array('id'=>$course->id, 'section'=>'0', 'sesskey'=>sesskey(),'add'=>'scorm')); redirect($url); } else { echo $OUTPUT->notification('Could not find a scorm course here'); } } echo '</div>'; }
$PAGE->set_url($url); $forcejs = get_config('scorm', 'forcejavascript'); if (!empty($forcejs)) { $PAGE->add_body_class('forcejavascript'); } require_login($course->id, false, $cm); $context = get_context_instance(CONTEXT_COURSE, $course->id); $contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id); 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)); add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id=' . $cm->id, "{$scorm->id}", $cm->id); if (has_capability('mod/scorm:skipview', $contextmodule) && scorm_simple_play($scorm, $USER, $contextmodule)) { exit; } // // Print the page header // $PAGE->set_title($pagetitle); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); $currenttab = 'info'; require $CFG->dirroot . '/mod/scorm/tabs.php'; // Print the main part of the page echo $OUTPUT->heading(format_string($scorm->name)); $attemptstatus = ''; if ($scorm->displayattemptstatus == 1) { $attemptstatus = scorm_get_attempt_status($USER, $scorm);