adding some strings
[moodle-linuxchix.git] / mod / scorm / view.php
blobf753e3056b76db66453b4f95e26df58cddce640a
1 <?php // $Id$
3 require_once("../../config.php");
4 require_once('locallib.php');
6 $id = optional_param('id', '', PARAM_INT); // Course Module ID, or
7 $a = optional_param('a', '', PARAM_INT); // scorm ID
8 $organization = optional_param('organization', '', PARAM_INT); // organization ID
10 if (!empty($id)) {
11 if (! $cm = get_coursemodule_from_id('scorm', $id)) {
12 error("Course Module ID was incorrect");
14 if (! $course = get_record("course", "id", $cm->course)) {
15 error("Course is misconfigured");
17 if (! $scorm = get_record("scorm", "id", $cm->instance)) {
18 error("Course module is incorrect");
20 } else if (!empty($a)) {
21 if (! $scorm = get_record("scorm", "id", $a)) {
22 error("Course module is incorrect");
24 if (! $course = get_record("course", "id", $scorm->course)) {
25 error("Course is misconfigured");
27 if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
28 error("Course Module ID was incorrect");
30 } else {
31 error('A required parameter is missing');
34 require_login($course->id, false, $cm);
36 $context = get_context_instance(CONTEXT_COURSE, $course->id);
38 if (isset($SESSION->scorm_scoid)) {
39 unset($SESSION->scorm_scoid);
42 $strscorms = get_string("modulenameplural", "scorm");
43 $strscorm = get_string("modulename", "scorm");
45 if ($course->id != SITEID) {
47 if ($scorms = get_all_instances_in_course('scorm', $course)) {
48 // The module SCORM activity with the least id is the course
49 $firstscorm = current($scorms);
50 if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {
51 $navlinks[] = array('name' => $strscorms, 'link' => "index.php?id=$course->id", 'type' => 'activity');
55 $pagetitle = strip_tags($course->shortname.': '.format_string($scorm->name));
57 add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id");
59 if ((has_capability('mod/scorm:skipview', get_context_instance(CONTEXT_MODULE,$cm->id))) && scorm_simple_play($scorm,$USER)) {
60 exit;
64 // Print the page header
66 $navlinks = array();
67 $navlinks[] = array('name' => format_string($scorm->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
68 $navigation = build_navigation($navlinks);
70 print_header($pagetitle, $course->fullname, $navigation,
71 '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
73 if (empty($cm->visible) and !has_capability('moodle/course:manageactivities', $context)) {
74 notice(get_string("activityiscurrentlyhidden"));
77 if (has_capability('moodle/course:manageactivities', $context)) {
78 $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');
79 if ($trackedusers->c > 0) {
80 echo "<div class=\"reportlink\"><a $CFG->frametarget href=\"report.php?id=$cm->id\"> ".get_string('viewallreports','scorm',$trackedusers->c).'</a></div>';
81 } else {
82 echo '<div class="reportlink">'.get_string('noreports','scorm').'</div>';
86 // Print the main part of the page
87 print_heading(format_string($scorm->name));
88 print_box(format_text($scorm->summary), 'generalbox', 'intro');
89 scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);
90 print_footer($course);