function test_scorm12_format() { $stryears = get_string('years'); $strmonths = trim(get_string('nummonths')); $strdays = get_string('days'); $strhours = get_string('hours'); $strminutes = get_string('minutes'); $strseconds = get_string('seconds'); $SUTs = array(1 => '00:00:00', 2 => '1:2:3', 3 => '12:34:56.78', 4 => '00:12:00.03', 5 => '01:00:23', 6 => '00:12:34.00', 7 => '00:01:02.03', 8 => '00:00:00.1', 9 => '1:23:00', 10 => '2:00:00'); $validates = array(1 => '', 2 => "1 {$strhours} 2 {$strminutes} 3 {$strseconds}", 3 => "12 {$strhours} 34 {$strminutes} 56.78 {$strseconds}", 4 => "12 {$strminutes} 0.03 {$strseconds}", 5 => "1 {$strhours} 23 {$strseconds}", 6 => "12 {$strminutes} 34 {$strseconds}", 7 => "1 {$strminutes} 2.03 {$strseconds}", 8 => "0.1 {$strseconds}", 9 => "1 {$strhours} 23 {$strminutes} ", 10 => "2 {$strhours} "); foreach ($SUTs as $key => $SUT) { $formatted = scorm_format_duration($SUT); $this->assertEquals($formatted, $validates[$key]); } }
$string="interactionslatency"; } else if (stristr($element, '.pattern') !== false) { $string="interactionspattern"; } else if (stristr($element, '.suspend_data') !== false) { $string="interactionssuspenddata"; } $row[]=$element; if (empty($string)) { $row[]=null; } else { $row[] = get_string($string, 'scorm'); } if (strpos($element, '_time') === false) { $row[] = s($value); } else { $row[] = s(scorm_format_duration($value)); } $table->data[] = $row; } } } if ($existelements) { echo '<h3>'.get_string('othertracks', 'scorm').'</h3>'; echo html_writer::table($table); } echo $OUTPUT->box_end(); } // Print footer echo $OUTPUT->footer();
} if ($trackdata->status == '') { if (!empty($trackdata->progress)) { $trackdata->status = $trackdata->progress; } else { $trackdata->status = 'notattempted'; } } $tracksurl->param('scoid', $sco->id); $detailslink = html_writer::link($tracksurl, get_string('details', 'scorm')); } else { $trackdata = new stdClass(); $trackdata->status = 'notattempted'; $trackdata->total_time = ' '; $detailslink = ' '; } $strstatus = get_string($trackdata->status, 'scorm'); $row[] = '<img src="' . $OUTPUT->pix_url($trackdata->status, 'scorm') . '" alt="' . $strstatus . '" title="' . $strstatus . '" /> ' . format_string($sco->title); $row[] = get_string($trackdata->status, 'scorm'); $row[] = scorm_format_duration($trackdata->total_time); $row[] = $score; $row[] = $detailslink; } else { $row = array(format_string($sco->title), ' ', ' ', ' ', ' '); } $table->data[] = $row; } echo html_writer::table($table); } // Print footer. echo $OUTPUT->footer();