First translation into Portuguese
[moodle.git] / mod / scorm / cmi.php
CommitLineData
98ca59f6 1<?php
2 require_once("../../config.php");
3 require_once("lib.php");
4
5 optional_variable($id); // Course Module ID, or
6 optional_variable($a); // scorm ID
7
8 if ($id) {
9 if (! $cm = get_record("course_modules", "id", $id)) {
10 error("Course Module ID was incorrect");
11 }
12
13 if (! $course = get_record("course", "id", $cm->course)) {
14 error("Course is misconfigured");
15 }
16
17 if (! $scorm = get_record("scorm", "id", $cm->instance)) {
18 error("Course module is incorrect");
19 }
20
21 } else {
22 if (! $scorm = get_record("scorm", "id", $a)) {
23 error("Course module is incorrect");
24 }
25 if (! $course = get_record("course", "id", $scorm->course)) {
26 error("Course is misconfigured");
27 }
28 if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
29 error("Course Module ID was incorrect");
30 }
31 }
32
33 require_login($course->id);
34
fc274a5f 35 if (!empty($_POST["scoid"])) {
36 if (!empty($_POST["cmi_core_lesson_location"])) {
6d9c91c7 37 set_field("scorm_sco_users","cmi_core_lesson_location",$_POST["cmi_core_lesson_location"],"scoid",$_POST["scoid"],"userid",$USER->id);
38 }
fc274a5f 39 if (!empty($_POST["cmi_core_lesson_status"])) {
6d9c91c7 40 set_field("scorm_sco_users","cmi_core_lesson_status",$_POST["cmi_core_lesson_status"],"scoid",$_POST["scoid"],"userid",$USER->id);
41 }
fc274a5f 42 if (!empty($_POST["cmi_core_exit"])) {
6d9c91c7 43 set_field("scorm_sco_users","cmi_core_exit",$_POST["cmi_core_exit"],"scoid",$_POST["scoid"],"userid",$USER->id);
44 }
fc274a5f 45 if (!empty($_POST["cmi_core_total_time"])) {
6d9c91c7 46 set_field("scorm_sco_users","cmi_core_total_time",$_POST["cmi_core_total_time"],"scoid",$_POST["scoid"],"userid",$USER->id);
47 }
fc274a5f 48 if (!empty($_POST["cmi_core_score_raw"])) {
6d9c91c7 49 set_field("scorm_sco_users","cmi_core_score_raw",$_POST["cmi_core_score_raw"],"scoid",$_POST["scoid"],"userid",$USER->id);
50 }
fc274a5f 51 if (!empty($_POST["cmi_suspend_data"])) {
6d9c91c7 52 set_field("scorm_sco_users","cmi_suspend_data",$_POST["cmi_suspend_data"],"scoid",$_POST["scoid"],"userid",$USER->id);
53 }
98ca59f6 54 }
55?>
56<html>
57<head>
58 <title>cmi</title>
59</head>
60<body>
5d8790cb 61 <form name="theform" method="POST" action="<?php echo $ME ?>?id=<?php echo $cm->id ?>">
98ca59f6 62 <input type="hidden" name="scoid" />
63 <input type="hidden" name="cmi_core_lesson_location" />
64 <input type="hidden" name="cmi_core_lesson_status" />
65 <input type="hidden" name="cmi_core_exit" />
66 <input type="hidden" name="cmi_core_session_time" />
fc274a5f 67 <input type="hidden" name="cmi_core_total_time" />
98ca59f6 68 <input type="hidden" name="cmi_core_score_raw" />
69 <input type="hidden" name="cmi_suspend_data" />
70 </form>
98ca59f6 71</body>
72</html>