本文整理汇总了PHP中scorm_version_check函数的典型用法代码示例。如果您正苦于以下问题:PHP scorm_version_check函数的具体用法?PHP scorm_version_check怎么用?PHP scorm_version_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scorm_version_check函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scorm_format_toc_for_treeview
function scorm_format_toc_for_treeview($user, $scorm, $scoes, $usertracks, $cmid, $toclink = TOCJSLINK, $currentorg = '', $attempt = '', $play = false, $organizationsco = null, $children = false)
{
global $CFG;
$result = new stdClass();
$result->prerequisites = true;
$result->incomplete = true;
$result->toc = '';
if (!$children) {
$attemptsmade = scorm_get_attempt_count($user->id, $scorm);
$result->attemptleft = $scorm->maxattempt == 0 ? 1 : $scorm->maxattempt - $attemptsmade;
}
if (!$children) {
$result->toc = "<ul>\n";
if (!$play && !empty($organizationsco)) {
$result->toc .= "\t<li>" . $organizationsco->title . "</li>\n";
}
}
$prevsco = '';
if (!empty($scoes)) {
foreach ($scoes as $sco) {
$result->toc .= "\t<li>\n";
$scoid = $sco->id;
$sco->isvisible = true;
if ($sco->isvisible) {
$score = '';
if (isset($usertracks[$sco->identifier])) {
$viewscore = has_capability('mod/scorm:viewscores', context_module::instance($cmid));
if (isset($usertracks[$sco->identifier]->score_raw) && $viewscore) {
if ($usertracks[$sco->identifier]->score_raw != '') {
$score = '(' . get_string('score', 'scorm') . ': ' . $usertracks[$sco->identifier]->score_raw . ')';
}
}
}
if (!empty($sco->prereq)) {
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
if (!empty($prevsco) && scorm_version_check($scorm->version, SCORM_13) && !empty($prevsco->hidecontinue)) {
if ($sco->scormtype == 'sco') {
$result->toc .= '<span>' . $sco->statusicon . ' ' . format_string($sco->title) . '</span>';
} else {
$result->toc .= '<span> ' . format_string($sco->title) . '</span>';
}
} else {
if ($toclink == TOCFULLURL) {
$url = $CFG->wwwroot . '/mod/scorm/player.php?' . $sco->url;
if (!empty($sco->launch)) {
if ($sco->scormtype == 'sco') {
$result->toc .= $sco->statusicon . ' <a href="' . $url . '">' . format_string($sco->title) . '</a>' . $score . "\n";
} else {
$result->toc .= ' <a data-scoid="' . $sco->id . '" href="' . $url . '">' . format_string($sco->title) . '</a>' . $score . "\n";
}
} else {
if ($sco->scormtype == 'sco') {
$result->toc .= $sco->statusicon . ' ' . format_string($sco->title) . $score . "\n";
} else {
$result->toc .= ' ' . format_string($sco->title) . $score . "\n";
}
}
} else {
if (!empty($sco->launch)) {
if ($sco->scormtype == 'sco') {
$result->toc .= '<a data-scoid="' . $sco->id . '" title="' . $sco->url . '">' . $sco->statusicon . ' ' . format_string($sco->title) . ' ' . $score . '</a>';
} else {
$result->toc .= '<a data-scoid="' . $sco->id . '" title="' . $sco->url . '"> ' . format_string($sco->title) . ' ' . $score . '</a>';
}
} else {
if ($sco->scormtype == 'sco') {
$result->toc .= '<span>' . $sco->statusicon . ' ' . format_string($sco->title) . '</span>';
} else {
$result->toc .= '<span> ' . format_string($sco->title) . '</span>';
}
}
}
}
} else {
if ($play) {
if ($sco->scormtype == 'sco') {
$result->toc .= '<span>' . $sco->statusicon . ' ' . format_string($sco->title) . '</span>';
} else {
$result->toc .= ' ' . format_string($sco->title) . '</span>';
}
} else {
if ($sco->scormtype == 'sco') {
$result->toc .= $sco->statusicon . ' ' . format_string($sco->title) . "\n";
} else {
$result->toc .= ' ' . format_string($sco->title) . "\n";
}
}
}
} else {
$result->toc .= "\t\t " . format_string($sco->title) . "\n";
}
if (!empty($sco->children)) {
$result->toc .= "\n\t\t<ul>\n";
$childresult = scorm_format_toc_for_treeview($user, $scorm, $sco->children, $usertracks, $cmid, $toclink, $currentorg, $attempt, $play, $organizationsco, true);
$result->toc .= $childresult->toc;
$result->toc .= "\t\t</ul>\n";
$result->toc .= "\t</li>\n";
} else {
//.........这里部分代码省略.........
示例2: foreach
if ($userdata->mode == 'normal') {
$userdata->credit = 'credit';
} else {
$userdata->credit = 'no-credit';
}
if ($scodatas = scorm_get_sco($scoid, SCO_DATA)) {
foreach ($scodatas as $key => $value) {
$userdata->$key = addslashes_js($value);
}
} else {
print_error('cannotfindsco', 'scorm');
}
if (!$sco = scorm_get_sco($scoid)) {
print_error('cannotfindsco', 'scorm');
}
if (scorm_version_check($scorm->version, SCORM_13)) {
$objectives = $DB->get_records('scorm_seq_objective', array('scoid' => $scoid));
$index = 0;
foreach ($objectives as $objective) {
if (!empty($objective->minnormalizedmeasure)) {
$userdata->{'cmi.scaled_passing_score'} = $objective->minnormalizedmeasure;
}
if (!empty($objective->objectiveid)) {
$userdata->{'cmi.objectives.N'.$index.'.id'} = $objective->objectiveid;
$index++;
}
}
}
header('Content-Type: text/javascript; charset=UTF-8');
示例3: Commit
+ ' name="getDiagnosticButton">'
+ ' <input type="button"'
+ ' value="<?php
echo $LMS_prefix;
?>
Commit() "'
+ ' onclick="tryLMSCommit();"'
+ ' id="commitButton"'
+ ' name="commitButton">'
+ ' <input type="button"'
+ ' value="<?php
echo scorm_version_check($scorm->version, SCORM_12) ? 'LMSFinish' : 'Terminate';
?>
() "'
+ ' onclick="try<?php
echo scorm_version_check($scorm->version, SCORM_12) ? 'LMSFinish' : 'LMSTerminate';
?>
();"'
+ ' id="finishButton"'
+ ' name="finishButton">'
+ ' </td>'
+ ' </tr>'
+ ' <tr>'
+ ' <td>'
+ ' <label>Result: </label><br />'
+ ' <textarea name="msgtxt" id="msgtxt" rows="2" cols="150" wrap="VIRTUAL" readonly>None</textarea>'
+ ' </td>'
+ ' </tr>'
+ ' </table>'
+ '</form>'
+ '<h3 id="mod-scorm-marker">SCORM API Activity Log<\/h3>';
示例4: header
$userdata->{'cmi.scaled_passing_score'} = $objective->minnormalizedmeasure;
}
if (!empty($objective->objectiveid)) {
$userdata->{'cmi.objectives.N'.$index.'.id'} = $objective->objectiveid;
$index++;
}
}
}
header('Content-Type: text/javascript; charset=UTF-8');
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe.
/*
* TCAPI - Bypass loading of API since we don't need it when is TCAPI.
*/
if (scorm_version_check($scorm->version, SCORM_TCAPI)) {
// Do nothing and bypass API loading
} else if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
include_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
} else {
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";
function underscore(str) {
str = String(str).replace(/.N/g,".");
return str.replace(/\./g,"__");
示例5: add_to_log
}
add_to_log($course->id, 'scorm', 'launch', 'view.php?id='.$cm->id, $result, $cm->id);
header('Content-Type: text/html; charset=UTF-8');
if ($sco->scormtype == 'asset') {
// HTTP 302 Found => Moved Temporarily.
header('Location: ' . $result);
// Provide a short feedback in case of slow network connection.
echo '<html><body><p>' . get_string('activitypleasewait', 'scorm'). '</p></body></html>';
exit;
}
// We expect a SCO: select which API are we looking for.
$LMS_api = (scorm_version_check($scorm->version, SCORM_12) || empty($scorm->version)) ? 'API' : 'API_1484_11';
?>
<html>
<head>
<title>LoadSCO</title>
<script type="text/javascript">
//<![CDATA[
var myApiHandle = null;
var myFindAPITries = 0;
function myGetAPIHandle() {
myFindAPITries = 0;
if (myApiHandle == null) {
myApiHandle = myGetAPI();
}
示例6: display
//.........这里部分代码省略.........
$row[] = userdate($timetracks->finish, get_string('strftimedatetime', 'langconfig'));
} else {
$row[] = userdate($timetracks->finish);
}
$row[] = scorm_grade_user_attempt($scorm, $scouser->userid, $scouser->attempt);
}
// Print out all scores of attempt.
foreach ($scoes as $sco) {
if ($sco->launch != '') {
if ($trackdata = scorm_get_tracks($sco->id, $scouser->userid, $scouser->attempt)) {
if ($trackdata->status == '') {
$trackdata->status = 'notattempted';
}
$strstatus = get_string($trackdata->status, 'scorm');
if ($trackdata->score_raw != '') {
// If raw score exists, print it.
$score = $trackdata->score_raw;
// Add max score if it exists.
if (isset($trackdata->score_max)) {
$score .= '/' . $trackdata->score_max;
}
} else {
// ...else print out status.
$score = $strstatus;
}
if (!$download) {
$url = new \moodle_url('/mod/scorm/report/userreporttracks.php', array('id' => $cm->id, 'scoid' => $sco->id, 'user' => $scouser->userid, 'attempt' => $scouser->attempt));
$row[] = \html_writer::img($OUTPUT->pix_url($trackdata->status, 'scorm'), $strstatus, array('title' => $strstatus)) . \html_writer::empty_tag('br') . \html_writer::link($url, $score, array('title' => get_string('details', 'scorm')));
} else {
$row[] = $score;
}
// Iterate over tracks and match objective id against values.
$scorm2004 = false;
if (scorm_version_check($scorm->version, SCORM_13)) {
$scorm2004 = true;
$objectiveprefix = "cmi.objectives.";
} else {
$objectiveprefix = "cmi.objectives_";
}
$keywords = array(".id", $objectiveprefix);
$objectivestatus = array();
$objectivescore = array();
foreach ($trackdata as $name => $value) {
if (strpos($name, $objectiveprefix) === 0 && strrpos($name, '.id') !== false) {
$num = trim(str_ireplace($keywords, '', $name));
if (is_numeric($num)) {
if ($scorm2004) {
$element = $objectiveprefix . $num . '.completion_status';
} else {
$element = $objectiveprefix . $num . '.status';
}
if (isset($trackdata->{$element})) {
$objectivestatus[$value] = $trackdata->{$element};
} else {
$objectivestatus[$value] = '';
}
if ($displayoptions['objectivescore']) {
$element = $objectiveprefix . $num . '.score.raw';
if (isset($trackdata->{$element})) {
$objectivescore[$value] = $trackdata->{$element};
} else {
$objectivescore[$value] = '';
}
}
}
}
示例7: header
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('scorm', $scorm);
$event->add_record_snapshot('scorm_scoes', $sco);
$event->trigger();
header('Content-Type: text/html; charset=UTF-8');
if ($sco->scormtype == 'asset') {
// HTTP 302 Found => Moved Temporarily.
header('Location: ' . $result);
// Provide a short feedback in case of slow network connection.
echo html_writer::start_tag('html');
echo html_writer::tag('body', html_writer::tag('p', get_string('activitypleasewait', 'scorm')));
echo html_writer::end_tag('html');
exit;
}
// We expect a SCO: select which API are we looking for.
$lmsapi = scorm_version_check($scorm->version, SCORM_12) || empty($scorm->version) ? 'API' : 'API_1484_11';
echo html_writer::start_tag('html');
echo html_writer::start_tag('head');
echo html_writer::tag('title', 'LoadSCO');
?>
<script type="text/javascript">
//<![CDATA[
var myApiHandle = null;
var myFindAPITries = 0;
function myGetAPIHandle() {
myFindAPITries = 0;
if (myApiHandle == null) {
myApiHandle = myGetAPI();
}
return myApiHandle;
示例8: print_error
print_error('invalidcoursemodule');
}
} else {
print_error('missingparameter');
}
$url = new moodle_url('/mod/scorm/loaddatamodel.php', array('scoid'=>$scoid, 'id'=>$cm->id, 'attempt'=>$attempt));
if ($mode !== '') {
$url->param('mode', $mode);
}
$PAGE->set_url($url);
require_login($course, false, $cm);
if ($usertrack = scorm_get_tracks($scoid, $USER->id, $attempt)) {
if ((isset($usertrack->{'cmi.exit'}) && ($usertrack->{'cmi.exit'} != 'time-out')) || (!scorm_version_check($scorm->version, SCORM_13))) {
foreach ($usertrack as $key => $value) {
$userdata->$key = addslashes_js($value);
}
} else {
$userdata->status = '';
$userdata->score_raw = '';
}
} else {
$userdata->status = '';
$userdata->score_raw = '';
}
$userdata->student_id = addslashes_js($USER->username);
$userdata->student_name = addslashes_js($USER->lastname .', '. $USER->firstname);
$userdata->mode = 'normal';
if (isset($mode)) {
示例9: display
//.........这里部分代码省略.........
$row[] = '-';
$row[] = '-';
} else {
if (!$download) {
$row[] = '<a href="' . $CFG->wwwroot . '/mod/scorm/report/userreport.php?id=' . $cm->id . '&user=' . $scouser->userid . '&attempt=' . $scouser->attempt . '">' . $scouser->attempt . '</a>';
} else {
$row[] = $scouser->attempt;
}
if ($download == 'ODS' || $download == 'Excel') {
$row[] = userdate($timetracks->start, get_string("strftimedatetime", "langconfig"));
} else {
$row[] = userdate($timetracks->start);
}
if ($download == 'ODS' || $download == 'Excel') {
$row[] = userdate($timetracks->finish, get_string('strftimedatetime', 'langconfig'));
} else {
$row[] = userdate($timetracks->finish);
}
$row[] = scorm_grade_user_attempt($scorm, $scouser->userid, $scouser->attempt);
}
// print out all scores of attempt
if ($scoes) {
foreach ($scoes as $sco) {
if ($sco->launch != '') {
if ($trackdata = scorm_get_tracks($sco->id, $scouser->userid, $scouser->attempt)) {
if ($trackdata->status == '') {
$trackdata->status = 'notattempted';
}
$strstatus = get_string($trackdata->status, 'scorm');
// if raw score exists, print it
if ($trackdata->score_raw != '') {
$score = $trackdata->score_raw;
// add max score if it exists
if (scorm_version_check($scorm->version, SCORM_13)) {
$maxkey = 'cmi.score.max';
} else {
$maxkey = 'cmi.core.score.max';
}
if (isset($trackdata->{$maxkey})) {
$score .= '/' . $trackdata->{$maxkey};
}
// else print out status
} else {
$score = $strstatus;
}
if (!$download) {
$row[] = '<img src="' . $OUTPUT->pix_url($trackdata->status, 'scorm') . '" alt="' . $strstatus . '" title="' . $strstatus . '" /><br/>
<a href="' . $CFG->wwwroot . '/mod/scorm/report/userreporttracks.php?id=' . $cm->id . '&scoid=' . $sco->id . '&user=' . $scouser->userid . '&attempt=' . $scouser->attempt . '" title="' . get_string('details', 'scorm') . '">' . $score . '</a>';
} else {
$row[] = $score;
}
} else {
// if we don't have track data, we haven't attempted yet
$strstatus = get_string('notattempted', 'scorm');
if (!$download) {
$row[] = '<img src="' . $OUTPUT->pix_url('notattempted', 'scorm') . '" alt="' . $strstatus . '" title="' . $strstatus . '" /><br/>' . $strstatus;
} else {
$row[] = $strstatus;
}
}
}
}
}
if (!$download) {
$table->add_data($row);
} else {
示例10: scorm_version_check
+ ' onclick="tryLMSGetErrorString();"'
+ ' id="getErrorStringButton"'
+ ' name="getErrorStringButton">'
+ ' <input type="button"'
+ ' value="<?php echo $LMS_prefix; ?>GetDiagnostic() "'
+ ' onclick="tryLMSGetDiagnostic();"'
+ ' id="getDiagnosticButton"'
+ ' name="getDiagnosticButton">'
+ ' <input type="button"'
+ ' value="<?php echo $LMS_prefix; ?>Commit() "'
+ ' onclick="tryLMSCommit();"'
+ ' id="commitButton"'
+ ' name="commitButton">'
+ ' <input type="button"'
+ ' value="<?php echo scorm_version_check($scorm->version, SCORM_12) ? 'LMSFinish' : 'Terminate'; ?>() "'
+ ' onclick="try<?php echo scorm_version_check($scorm->version, SCORM_12) ? 'LMSFinish' : 'LMSTerminate'; ?>();"'
+ ' id="finishButton"'
+ ' name="finishButton">'
+ ' </td>'
+ ' </tr>'
+ ' <tr>'
+ ' <td>'
+ ' <label>Result: </label><br />'
+ ' <textarea name="msgtxt" id="msgtxt" rows="2" cols="150" wrap="VIRTUAL" readonly>None</textarea>'
+ ' </td>'
+ ' </tr>'
+ ' </table>'
+ '</form>'
+ '<h3 id="mod-scorm-marker">SCORM API Activity Log<\/h3>';
// Is logging active?
示例11: scorm_format_toc_for_treeview
function scorm_format_toc_for_treeview($user, $scorm, $scoes, $usertracks, $cmid, $toclink=TOCJSLINK, $currentorg='',
$attempt='', $play=false, $organizationsco=null, $children=false) {
global $CFG;
$result = new stdClass();
$result->prerequisites = true;
$result->incomplete = true;
$result->toc = '';
if (!$children) {
$attemptsmade = scorm_get_attempt_count($user->id, $scorm);
$result->attemptleft = $scorm->maxattempt == 0 ? 1 : $scorm->maxattempt - $attemptsmade;
}
if (!$children) {
$result->toc = html_writer::start_tag('ul');
if (!$play && !empty($organizationsco)) {
$result->toc .= html_writer::start_tag('li').$organizationsco->title.html_writer::end_tag('li');
}
}
$prevsco = '';
if (!empty($scoes)) {
foreach ($scoes as $sco) {
$result->toc .= html_writer::start_tag('li');
$scoid = $sco->id;
$sco->isvisible = true;
if ($sco->isvisible) {
$score = '';
if (isset($usertracks[$sco->identifier])) {
$viewscore = has_capability('mod/scorm:viewscores', context_module::instance($cmid));
if (isset($usertracks[$sco->identifier]->score_raw) && $viewscore) {
if ($usertracks[$sco->identifier]->score_raw != '') {
$score = '('.get_string('score', 'scorm').': '.$usertracks[$sco->identifier]->score_raw.')';
}
}
}
if (!empty($sco->prereq)) {
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
if (!empty($prevsco) && scorm_version_check($scorm->version, SCORM_13) && !empty($prevsco->hidecontinue)) {
if ($sco->scormtype == 'sco') {
$result->toc .= html_writer::span($sco->statusicon.' '.format_string($sco->title));
} else {
$result->toc .= html_writer::span(' '.format_string($sco->title));
}
} else if ($toclink == TOCFULLURL) {
$url = $CFG->wwwroot.'/mod/scorm/player.php?'.$sco->url;
if (!empty($sco->launch)) {
if ($sco->scormtype == 'sco') {
$result->toc .= $sco->statusicon.' ';
$result->toc .= html_writer::link($url, format_string($sco->title)).$score;
} else {
$result->toc .= ' '.html_writer::link($url, format_string($sco->title),
array('data-scoid' => $sco->id)).$score;
}
} else {
if ($sco->scormtype == 'sco') {
$result->toc .= $sco->statusicon.' '.format_string($sco->title).$score;
} else {
$result->toc .= ' '.format_string($sco->title).$score;
}
}
} else {
if (!empty($sco->launch)) {
if ($sco->scormtype == 'sco') {
$result->toc .= html_writer::tag('a', $sco->statusicon.' '.
format_string($sco->title).' '.$score,
array('data-scoid' => $sco->id, 'title' => $sco->url));
} else {
$result->toc .= html_writer::tag('a', ' '.format_string($sco->title).' '.$score,
array('data-scoid' => $sco->id, 'title' => $sco->url));
}
} else {
if ($sco->scormtype == 'sco') {
$result->toc .= html_writer::span($sco->statusicon.' '.format_string($sco->title));
} else {
$result->toc .= html_writer::span(' '.format_string($sco->title));
}
}
}
} else {
if ($play) {
if ($sco->scormtype == 'sco') {
$result->toc .= html_writer::span($sco->statusicon.' '.format_string($sco->title));
} else {
$result->toc .= ' '.format_string($sco->title).html_writer::end_span();
}
} else {
if ($sco->scormtype == 'sco') {
$result->toc .= $sco->statusicon.' '.format_string($sco->title);
} else {
//.........这里部分代码省略.........