removing trustbitmask for now and comment from riskbitmask
[moodle.git] / mod / scorm / view.php
CommitLineData
f9d5371b 1<?php // $Id$
2
3 require_once("../../config.php");
4 require_once('locallib.php');
5
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
9
10 if (!empty($id)) {
11 if (! $cm = $cm = get_coursemodule_from_id('scorm', $id)) {
12 error("Course Module ID was incorrect");
13 }
14 if (! $course = get_record("course", "id", $cm->course)) {
15 error("Course is misconfigured");
16 }
17 if (! $scorm = get_record("scorm", "id", $cm->instance)) {
18 error("Course module is incorrect");
19 }
20 } else if (!empty($a)) {
21 if (! $scorm = get_record("scorm", "id", $a)) {
22 error("Course module is incorrect");
23 }
24 if (! $course = get_record("course", "id", $scorm->course)) {
25 error("Course is misconfigured");
26 }
27 if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
28 error("Course Module ID was incorrect");
29 }
30 } else {
31 error('A required parameter is missing');
32 }
33
34 require_login($course->id, false, $cm);
35
36 if (isset($SESSION->scorm_scoid)) {
37 unset($SESSION->scorm_scoid);
38 }
39
40 $strscorms = get_string("modulenameplural", "scorm");
41 $strscorm = get_string("modulename", "scorm");
42
43 if ($course->category != 0) {
44 $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
45 if ($scorms = get_all_instances_in_course('scorm', $course)) {
46 // The module SCORM activity with the least id is the course
47 $firstscorm = current($scorms);
48 if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {
49 $navigation .= "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
50 }
51 }
52 } else {
53 $navigation = "<a target=\"{$CFG->framename}\" href=\"index.php?id=$course->id\">$strscorms</a> ->";
54 }
55
56 $pagetitle = strip_tags($course->shortname.': '.format_string($scorm->name));
57
58 add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id");
59
60 //
61 // Print the page header
62 //
2b3447c3 63 print_header($pagetitle, "$course->fullname",
64 "$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>",
65 '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
f9d5371b 66
2b3447c3 67 if (empty($cm->visible) and !has_capability('moodle/course:manageactivities', $context)) {
68 notice(get_string("activityiscurrentlyhidden"));
69 }
f9d5371b 70
2b3447c3 71 if (has_capability('moodle/course:manageactivities', $context)) {
72 // Added by Pham Minh Duc
73 $examNumber = get_record_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1','count(id) as examCount');
74 if ($examNumber->examCount > 0){
75 echo "<div class=\"reportlink\"><img src='pix/SuaHeSoDiem.png' /><a target=\"{$CFG->framename}\" href=\"coefficientSetting.php?id=$cm->id\"> ".get_string('scorecoefficientsetting','scorm',$examNumber->examCount).'</a></div>';
f9d5371b 76 }
2b3447c3 77 // End Add
f9d5371b 78
2b3447c3 79 $trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');
80 if ($trackedusers->c > 0) {
81 echo "<div class=\"reportlink\"><img src='pix/ThongKe.png' /><a target=\"{$CFG->framename}\" href=\"report.php?id=$cm->id\"> ".get_string('viewallreports','scorm',$trackedusers->c).'</a></div>';
82 } else {
83 echo '<div class="reportlink">'.get_string('noreports','scorm').'</div>';
84 }
f9d5371b 85 }
2b3447c3 86
87 // Added by Pham Minh Duc
88 $USER->setAttempt = 'notset';
89 // End Add
90
91 // Print the main part of the page
92 print_heading(format_string($scorm->name));
93 print_simple_box(format_text($scorm->summary), 'center', '70%', '', 5, 'generalbox', 'intro');
94 scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);
95 print_footer($course);
f9d5371b 96?>