Skip to content
Browse files

SCORM MDL-16184 MDL-21423 backport from HEAD

  • Loading branch information...
1 parent fc289ca commit 2114f6764be260983aece3e681dd5e0ea435cf7e @danmarsden danmarsden committed Apr 21, 2010
Showing with 7 additions and 20 deletions.
  1. +0 −3 mod/scorm/api.php
  2. +6 −9 mod/scorm/lib.php
  3. +1 −8 mod/scorm/locallib.php
View
3 mod/scorm/api.php
@@ -81,9 +81,6 @@
include_once($CFG->dirroot.'/mod/scorm/datamodels/scorm_12.js.php');
}
- // set the start time of this SCO
- scorm_insert_track($USER->id,$scorm->id,$scoid,$attempt,'x.start.time',time());
-
?>
var errorCode = "0";
View
15 mod/scorm/lib.php
@@ -244,6 +244,7 @@ function scorm_user_outline($course, $user, $mod, $scorm) {
function scorm_user_complete($course, $user, $mod, $scorm) {
global $CFG;
require_once("$CFG->libdir/gradelib.php");
+ require_once("locallib.php");
$liststyle = 'structlist';
$scormpixdir = $CFG->modpixpath.'/scorm/pix';
@@ -252,6 +253,11 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
$lastmodify = 0;
$sometoreport = false;
$report = '';
+
+ // First Access and Last Access dates for SCOs
+ $timetracks = scorm_get_sco_runtime($scorm->id, false, $user->id);
+ $firstmodify = $timetracks->start;
+ $lastmodify = $timetracks->finish;
$grades = grade_get_grades($course->id, 'mod', 'scorm', $scorm->id, $user->id);
if (!empty($grades->items[0]->grades)) {
@@ -318,7 +324,6 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
}
if ($sco->launch) {
- require_once('locallib.php');
$score = '';
$totaltime = '';
if ($usertrack=scorm_get_tracks($sco->id,$user->id)) {
@@ -327,14 +332,6 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
}
$strstatus = get_string($usertrack->status,'scorm');
$report .= "<img src='".$scormpixdir.'/'.$usertrack->status.".gif' alt='$strstatus' title='$strstatus' />";
- if ($usertrack->timemodified != 0) {
- if ($usertrack->timemodified > $lastmodify) {
- $lastmodify = $usertrack->timemodified;
- }
- if ($usertrack->timemodified < $firstmodify) {
- $firstmodify = $usertrack->timemodified;
- }
- }
} else {
if ($sco->scormtype == 'sco') {
$report .= '<img src="'.$scormpixdir.'/'.'notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
View
9 mod/scorm/locallib.php
@@ -350,9 +350,6 @@ function scorm_get_tracks($scoid,$userid,$attempt='') {
$track->value = stripslashes_safe($track->value);
$usertrack->{$element} = $track->value;
switch ($element) {
- case 'x.start.time':
- $usertrack->x_start_time = $track->value;
- break;
case 'cmi.core.lesson_status':
case 'cmi.completion_status':
if ($track->value == 'not attempted') {
@@ -405,11 +402,7 @@ function scorm_get_sco_runtime($scormid, $scoid, $userid, $attempt=1) {
$tracks = array_values($tracks);
}
- if ($start_track = get_records_select('scorm_scoes_track',"$sql AND element='x.start.time' ORDER BY scoid ASC")) {
- $start_track = array_values($start_track);
- $timedata->start = $start_track[0]->value;
- }
- else if ($tracks) {
+ if ($tracks) {
$timedata->start = $tracks[0]->timemodified;
}
else {

0 comments on commit 2114f67

Please sign in to comment.
Something went wrong with that request. Please try again.