本文整理汇总了PHP中scorm_repeater函数的典型用法代码示例。如果您正苦于以下问题:PHP scorm_repeater函数的具体用法?PHP scorm_repeater怎么用?PHP scorm_repeater使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scorm_repeater函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scorm_format_toc_for_droplist
function scorm_format_toc_for_droplist($scorm, $scoes, $usertracks, $currentorg = '', $organizationsco = null, $children = false, $level = 0, $tocmenus = array())
{
if (!empty($scoes)) {
if (!empty($organizationsco) && !$children) {
$tocmenus[$organizationsco->id] = $organizationsco->title;
}
$parents[$level] = '/';
foreach ($scoes as $sco) {
if ($parents[$level] != $sco->parent) {
if ($newlevel = array_search($sco->parent, $parents)) {
$level = $newlevel;
} else {
$i = $level;
while ($i > 0 && $parents[$level] != $sco->parent) {
$i--;
}
if ($i == 0 && $sco->parent != $currentorg) {
$level++;
} else {
$level = $i;
}
$parents[$level] = $sco->parent;
}
}
if ($sco->prereq) {
if ($sco->scormtype == 'sco') {
$tocmenus[$sco->id] = scorm_repeater('−', $level) . '>' . format_string($sco->title);
}
} else {
if ($sco->scormtype == 'sco') {
$tocmenus[$sco->id] = scorm_repeater('−', $level) . '>' . format_string($sco->title);
}
}
if (!empty($sco->children)) {
$tocmenus = scorm_format_toc_for_droplist($scorm, $sco->children, $usertracks, $currentorg, $organizationsco, true, $level, $tocmenus);
}
}
}
return $tocmenus;
}
示例2: scorm_get_toc
//.........这里部分代码省略.........
$startbold = '';
$endbold = '';
$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;
}
if ($sco->scormtype == 'sco') {
$statusicon = '<img src="' . $OUTPUT->mod_icon_url('pix/notattempted', 'scorm') . '" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />';
$incomplete = true;
} 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->prev) ? $sco->prev : 0;
}
if ($nextid == 0 && scorm_count_launchable($scorm->id, $currentorg) > 1 && $nextsco !== false && !$findnext) {
if (!empty($sco->launch)) {
$previd = $sco->id;
}
}
require_once 'sequencinglib.php';
if (scorm_seq_evaluate($sco->id, $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 .= ' ' . 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) {
$sco = $DB->get_record('scorm_scoes', array('id' => $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
//.........这里部分代码省略.........
$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="' . $scormpixdir . '/suspend.gif" alt="' . $strstatus . ' - ' . $strsuspended . '" title="' . $strstatus . ' - ' . $strsuspended . '" />';
}
}
} else {
if ($play && empty($scoid)) {
$scoid = $sco->id;
}
if ($sco->scormtype == 'sco') {
$statusicon = '<img src="' . $scormpixdir . '/notattempted.gif" alt="' . get_string('notattempted', 'scorm') . '" title="' . get_string('notattempted', 'scorm') . '" />';
$incomplete = true;
} else {
$statusicon = '<img src="' . $scormpixdir . '/asset.gif" 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->prev) ? $sco->prev : 0;
}
if ($nextid == 0 && scorm_count_launchable($scorm->id, $currentorg) > 1 && $nextsco !== false && !$findnext) {
if (!empty($sco->launch)) {
$previd = $sco->id;
}
}
require_once 'sequencinglib.php';
if (scorm_seq_evaluate($sco->id, $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 .= ' ' . 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) {
$sco = $DB->get_record('scorm_scoes', array('id' => $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) {
$result->toc .= '
<script type="text/javascript">
//<![CDATA[
function expandCollide(which,list,item) {
var el = document.ids ? document.ids[list] : document.getElementById ? document.getElementById(list) : document.all[list];
which = which.substring(0,(which.length));
var el2 = document.ids ? document.ids[which] : document.getElementById ? document.getElementById(which) : document.all[which];
if (el.style.display != "none") {
el2.src = "' . $scormpixdir . '/plus.gif";
el.style.display=\'none\';
new cookie("hide:SCORMitem" + item, 1, 356, "/").set();
} else {
el2.src = "' . $scormpixdir . '/minus.gif";
el.style.display=\'block\';
new cookie("hide:SCORMitem" + item, 1, -1, "/").set();
}
}
//]]>
</script>' . "\n";
}
$url = $CFG->wwwroot . '/mod/scorm/player.php?a=' . $scorm->id . '&currentorg=' . $currentorg . $modestr . '&scoid=';
$result->tocmenu = popup_form($url, $tocmenus, "tocmenu", $sco->id, '', '', '', true);
return $result;
}
示例4: scorm_get_toc
//.........这里部分代码省略.........
}
}
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";
}
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) {
$sco = scorm_get_sco($scoid);
$sco->previd = $previd;
$sco->nextid = $nextid;
$result->sco = $sco;
$result->incomplete = $incomplete;
} else {
$result->incomplete = $incomplete;
}
}
$result->toc .= '</ul>';
// NEW IMS TOC
if ($tocheader) {
$result->toc .= '</div></div></div>';
$result->toc .= '<div id="scorm_navpanel"></div>';
}
if ($scorm->hidetoc == 0) {
$result->toc .= html_writer::script(js_writer::set_variable('scormdata', array('plusicon' => $OUTPUT->pix_url('plus', 'scorm'), 'minusicon' => $OUTPUT->pix_url('minus', 'scorm'))));
$result->toc .= html_writer::script('', $CFG->wwwroot . '/lib/cookies.js');
$result->toc .= html_writer::script('', $CFG->wwwroot . '/mod/scorm/datamodels/scorm_datamodels.js');
}
$url = new moodle_url('/mod/scorm/player.php?a=' . $scorm->id . '¤torg=' . $currentorg . $modestr);
$result->tocmenu = $OUTPUT->single_select($url, 'scoid', $tocmenus, $sco->id, null, "tocmenu");
return $result;
}