本文整理汇总了PHP中scorm_eval_prerequisites函数的典型用法代码示例。如果您正苦于以下问题:PHP scorm_eval_prerequisites函数的具体用法?PHP scorm_eval_prerequisites怎么用?PHP scorm_eval_prerequisites使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scorm_eval_prerequisites函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scorm_get_toc_object
function scorm_get_toc_object($user, $scorm, $currentorg = '', $scoid = '', $mode = 'normal', $attempt = '', $play = false, $organizationsco = null)
{
global $CFG, $DB, $PAGE, $OUTPUT;
$modestr = '';
if ($mode != 'normal') {
$modestr = '&mode=' . $mode;
}
$result = array();
$incomplete = false;
if (!empty($organizationsco)) {
$result[0] = $organizationsco;
$result[0]->isvisible = true;
$result[0]->statusicon = '';
$result[0]->url = '';
}
if ($scoes = scorm_get_scoes($scorm->id, $currentorg)) {
// Retrieve user tracking data for each learning object.
$usertracks = array();
foreach ($scoes as $sco) {
if (!empty($sco->launch)) {
if ($usertrack = scorm_get_tracks($sco->id, $user->id, $attempt)) {
if ($usertrack->status == '') {
$usertrack->status = 'notattempted';
}
$usertracks[$sco->identifier] = $usertrack;
}
}
}
foreach ($scoes as $sco) {
if (!isset($sco->isvisible)) {
$sco->isvisible = true;
}
if (empty($sco->title)) {
$sco->title = $sco->identifier;
}
if (scorm_version_check($scorm->version, SCORM_13)) {
$sco->prereq = true;
} else {
$sco->prereq = empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites, $usertracks);
}
if ($sco->isvisible) {
if (!empty($sco->launch)) {
if (empty($scoid) && $mode != 'normal') {
$scoid = $sco->id;
}
if (isset($usertracks[$sco->identifier])) {
$usertrack = $usertracks[$sco->identifier];
$strstatus = get_string($usertrack->status, 'scorm');
if ($sco->scormtype == 'sco') {
$statusicon = '<img src="' . $OUTPUT->pix_url($usertrack->status, 'scorm') . '" alt="' . $strstatus . '" title="' . $strstatus . '" />';
} else {
$statusicon = '<img src="' . $OUTPUT->pix_url('asset', 'scorm') . '" alt="' . get_string('assetlaunched', 'scorm') . '" title="' . get_string('assetlaunched', 'scorm') . '" />';
}
if ($usertrack->status == 'notattempted' || $usertrack->status == 'incomplete' || $usertrack->status == 'browsed') {
$incomplete = true;
if ($play && empty($scoid)) {
$scoid = $sco->id;
}
}
$strsuspended = get_string('suspended', 'scorm');
$exitvar = 'cmi.core.exit';
if (scorm_version_check($scorm->version, SCORM_13)) {
$exitvar = 'cmi.exit';
}
if ($incomplete && isset($usertrack->{$exitvar}) && $usertrack->{$exitvar} == 'suspend') {
$statusicon = '<img src="' . $OUTPUT->pix_url('suspend', 'scorm') . '" alt="' . $strstatus . ' - ' . $strsuspended . '" title="' . $strstatus . ' - ' . $strsuspended . '" />';
}
} else {
if ($play && empty($scoid)) {
$scoid = $sco->id;
}
$incomplete = true;
if ($sco->scormtype == 'sco') {
$statusicon = '<img src="' . $OUTPUT->pix_url('notattempted', 'scorm') . '" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />';
} else {
$statusicon = '<img src="' . $OUTPUT->pix_url('asset', 'scorm') . '" alt="' . get_string('asset', 'scorm') . '" title="' . get_string('asset', 'scorm') . '" />';
}
}
}
}
if (empty($statusicon)) {
$sco->statusicon = '<img src="' . $OUTPUT->pix_url('notattempted', 'scorm') . '" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />';
} else {
$sco->statusicon = $statusicon;
}
$sco->url = 'a=' . $scorm->id . '&scoid=' . $sco->id . '¤torg=' . $currentorg . $modestr . '&attempt=' . $attempt;
$sco->incomplete = $incomplete;
if (!in_array($sco->id, array_keys($result))) {
$result[$sco->id] = $sco;
}
}
}
// Get the parent scoes!
$result = scorm_get_toc_get_parent_child($result, $currentorg);
// Be safe, prevent warnings from showing up while returning array
if (!isset($scoid)) {
$scoid = '';
}
return array('scoes' => $result, 'usertracks' => $usertracks, 'scoid' => $scoid);
}
示例2: scorm_get_toc
//.........这里部分代码省略.........
$score = '';
if (empty($scoid) && $mode != 'normal') {
$scoid = $sco->id;
}
if (isset($usertracks[$sco->identifier])) {
$usertrack = $usertracks[$sco->identifier];
$strstatus = get_string($usertrack->status, 'scorm');
if ($sco->scormtype == 'sco') {
$statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/' . $usertrack->status, 'scorm') . '" alt="' . $strstatus . '" title="' . $strstatus . '" />';
} else {
$statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/assetc/', 'scorm') . '" alt="' . get_string('assetlaunched', 'scorm') . '" title="' . get_string('assetlaunched', 'scorm') . '" />';
}
if ($usertrack->status == 'notattempted' || $usertrack->status == 'incomplete' || $usertrack->status == 'browsed') {
$incomplete = true;
if ($play && empty($scoid)) {
$scoid = $sco->id;
}
}
if ($usertrack->score_raw != '') {
$score = '(' . get_string('score', 'scorm') . ': ' . $usertrack->score_raw . ')';
}
$strsuspended = get_string('suspended', 'scorm');
if (isset($usertrack->{'cmi.core.exit'}) && $usertrack->{'cmi.core.exit'} == 'suspend') {
if ($usertrack->status != 'completed') {
$statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/suspend', 'scorm') . '" alt="' . $strstatus . ' - ' . $strsuspended . '" title="' . $strstatus . ' - ' . $strsuspended . '" />';
}
}
} else {
if ($play && empty($scoid)) {
$scoid = $sco->id;
}
$incomplete = true;
if ($sco->scormtype == 'sco') {
$statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/notattempted', 'scorm') . '" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />';
} else {
$statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/asset', 'scorm') . '" alt="' . get_string('asset', 'scorm') . '" title="' . get_string('asset', 'scorm') . '" />';
}
}
if ($sco->id == $scoid) {
$startbold = '<b>';
$endbold = '</b>';
$findnext = true;
$shownext = isset($sco->next) ? $sco->next : 0;
$showprev = isset($sco->previous) ? $sco->previous : 0;
}
if ($nextid == 0 && scorm_count_launchable($scorm->id, $currentorg) > 1 && $nextsco !== false && !$findnext) {
if (!empty($sco->launch)) {
$previd = $sco->id;
}
}
if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites, $usertracks)) {
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
$url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '&currentorg=' . $currentorg . $modestr . '&scoid=' . $sco->id;
$result->toc .= $statusicon . ' ' . $startbold . '<a href="' . $url . '">' . format_string($sco->title) . '</a>' . $score . $endbold . "</li>\n";
$tocmenus[$sco->id] = scorm_repeater('−', $level) . '>' . format_string($sco->title);
} else {
if ($sco->id == $scoid) {
$result->prerequisites = false;
}
$result->toc .= $statusicon . ' ' . format_string($sco->title) . "</li>\n";
}
}
} else {
$result->toc .= ' ' . format_string($sco->title) . "</li>\n";
}
if ($nextsco !== false && $nextid == 0 && $findnext) {
if (!empty($nextsco->launch)) {
$nextid = $nextsco->id;
}
}
}
for ($i = 0; $i < $level; $i++) {
$result->toc .= "\t\t</ul></li>\n";
}
if ($play) {
// it is possible that scoid is still not set, in this case we dont want an empty object
if ($scoid) {
$sco = scorm_get_sco($scoid);
}
$sco->previd = $previd;
$sco->nextid = $nextid;
$result->sco = $sco;
$result->incomplete = $incomplete;
} else {
$result->incomplete = $incomplete;
}
}
$result->toc .= "\t</ul>\n";
if ($scorm->hidetoc == 0) {
$PAGE->requires->data_for_js('scormdata', array('plusicon' => $OUTPUT->mod_icon_url('pix/plus', 'scorm'), 'minusicon' => $OUTPUT->mod_icon_url('pix/minus', 'scorm')));
$PAGE->requires->js('mod/scorm/datamodels/scorm_datamodels.js');
}
$url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '¤torg=' . $currentorg . $modestr;
$select = html_select::make_popup_form($url, 'scoid', $tocmenus, "tocmenu", $sco->id);
$select->nothinglabel = false;
$result->tocmenu = $OUTPUT->select($select);
return $result;
}
示例3: scorm_get_toc
//.........这里部分代码省略.........
$scoid = $sco->id;
}
}
if ($usertrack->score_raw != '') {
$score = '(' . get_string('score', 'scorm') . ': ' . $usertrack->score_raw . ')';
}
$strsuspended = get_string('suspended', 'scorm');
if ($incomplete && isset($usertrack->{'cmi.core.exit'}) && $usertrack->{'cmi.core.exit'} == 'suspend') {
$statusicon = '<img src="' . $OUTPUT->pix_url('suspend', 'scorm') . '" alt="' . $strstatus . ' - ' . $strsuspended . '" title="' . $strstatus . ' - ' . $strsuspended . '" />';
}
} else {
if ($play && empty($scoid)) {
$scoid = $sco->id;
}
$incomplete = true;
if ($sco->scormtype == 'sco') {
$statusicon = '<img src="' . $OUTPUT->pix_url('notattempted', 'scorm') . '" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />';
} else {
$statusicon = '<img src="' . $OUTPUT->pix_url('asset', 'scorm') . '" alt="' . get_string('asset', 'scorm') . '" title="' . get_string('asset', 'scorm') . '" />';
}
}
if ($sco->id == $scoid) {
$startbold = '<b>';
$endbold = '</b>';
$findnext = true;
$shownext = isset($sco->next) ? $sco->next : 0;
$showprev = isset($sco->previous) ? $sco->previous : 0;
}
if ($nextid == 0 && scorm_count_launchable($scorm->id, $currentorg) > 1 && $nextsco !== false && !$findnext) {
if (!empty($sco->launch)) {
$previd = $sco->id;
}
}
if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites, $usertracks)) {
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
$url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '&currentorg=' . $currentorg . $modestr . '&scoid=' . $sco->id;
$thisscoidstr = '&scoid=' . $sco->id;
//$link = $CFG->wwwroot.'/mod/scorm/loadSCO.php?a='.$scorm->id.$thisscoidstr.$modestr;
$link = 'a=' . $scorm->id . $thisscoidstr . '¤torg=' . $currentorg . $modestr . '&attempt=' . $attempt;
//$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
//$result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
if ($sco->launch) {
$result->toc .= '<a title="' . $link . '">' . $statusicon . ' ' . format_string($sco->title) . ' ' . $score . '</a>';
} else {
$result->toc .= '<span>' . $statusicon . ' ' . format_string($sco->title) . '</span>';
}
$tocmenus[$sco->id] = scorm_repeater('−', $level) . '>' . format_string($sco->title);
} else {
if ($sco->id == $scoid) {
$result->prerequisites = false;
}
if ($play) {
// should be disabled
$result->toc .= '<span>' . $statusicon . ' ' . format_string($sco->title) . '</span>';
} else {
$result->toc .= $statusicon . ' ' . format_string($sco->title) . "\n";
}
}
if ($nextsco === false || $nextsco->parent == $sco->parent) {
$result->toc .= '</li>';
}
}
} else {
$result->toc .= ' ' . format_string($sco->title) . "</li>\n";