本文整理汇总了PHP中scorm_get_toc_object函数的典型用法代码示例。如果您正苦于以下问题:PHP scorm_get_toc_object函数的具体用法?PHP scorm_get_toc_object怎么用?PHP scorm_get_toc_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scorm_get_toc_object函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scorm_get_toc
function scorm_get_toc($user, $scorm, $cmid, $toclink = TOCJSLINK, $currentorg = '', $scoid = '', $mode = 'normal', $attempt = '', $play = false, $tocheader = false)
{
global $CFG, $DB, $OUTPUT;
if (empty($attempt)) {
$attempt = scorm_get_last_attempt($scorm->id, $user->id);
}
$result = new stdClass();
$organizationsco = null;
if ($tocheader) {
$result->toc = "<div id=\"scorm_layout\" class=\"yui3-g-r\">\n";
$result->toc .= "<div id=\"scorm_toc\" class=\"yui3-u-1-5\">\n";
$result->toc .= "<div id=\"scorm_toc_title\"></div>\n";
$result->toc .= "<div id=\"scorm_tree\">\n";
}
if (!empty($currentorg)) {
$organizationsco = $DB->get_record('scorm_scoes', array('scorm' => $scorm->id, 'identifier' => $currentorg));
if (!empty($organizationsco->title)) {
if ($play) {
$result->toctitle = $organizationsco->title;
}
}
}
$scoes = scorm_get_toc_object($user, $scorm, $currentorg, $scoid, $mode, $attempt, $play, $organizationsco);
$treeview = scorm_format_toc_for_treeview($user, $scorm, $scoes['scoes'][0]->children, $scoes['usertracks'], $cmid, $toclink, $currentorg, $attempt, $play, $organizationsco, false);
if ($tocheader) {
$result->toc .= $treeview->toc;
} else {
$result->toc = $treeview->toc;
}
if (!empty($scoes['scoid'])) {
$scoid = $scoes['scoid'];
}
if (empty($scoid)) {
$result->sco = $scoes['scoes'][0]->children[0];
} else {
$result->sco = scorm_get_sco($scoid);
}
if ($scorm->hidetoc == SCORM_TOC_POPUP) {
$tocmenu = scorm_format_toc_for_droplist($scorm, $scoes['scoes'][0]->children, $scoes['usertracks'], $currentorg, $organizationsco);
$modestr = '';
if ($mode != 'normal') {
$modestr = '&mode=' . $mode;
}
$url = new moodle_url('/mod/scorm/player.php?a=' . $scorm->id . '¤torg=' . $currentorg . $modestr);
$result->tocmenu = $OUTPUT->single_select($url, 'scoid', $tocmenu, $result->sco->id, null, "tocmenu");
}
$result->prerequisites = $treeview->prerequisites;
$result->incomplete = $treeview->incomplete;
$result->attemptleft = $treeview->attemptleft;
if ($tocheader) {
$result->toc .= "</div></div>\n";
$result->toc .= "<div id=\"scorm_toc_toggle\">\n";
$result->toc .= "<button id=\"scorm_toc_toggle_btn\"></button></div>\n";
$result->toc .= "<div id=\"scorm_content\">";
$result->toc .= "<div id=\"scorm_navpanel\"></div>\n";
$result->toc .= "</div></div>\n";
}
return $result;
}
示例2: scorm_get_toc_object
?>
<noscript>
<!--[if IE]>
<iframe id="main" class="scoframe" name="main" src="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr; ?>"></iframe>
<![endif]-->
<!--[if !IE]>
<object id="main" class="scoframe" type="text/html" data="loadSCO.php?id=<?php echo $cm->id.$scoidstr.$modestr; ?>"></object>
<![endif]-->
</noscript>
<?php
}
} else {
echo $OUTPUT->box(get_string('noprerequisites', 'scorm'));
}
?>
</div> <!-- SCORM page -->
<?php
$scoes = scorm_get_toc_object($USER, $scorm, "", $sco->id, $mode, $attempt);
$adlnav = scorm_get_adlnav_json($scoes['scoes']);
// NEW IMS TOC
if (empty($scorm->popup) || $displaymode == 'popup') {
if (!isset($result->toctitle)) {
$result->toctitle = get_string('toc', 'scorm');
}
$PAGE->requires->js_init_call('M.mod_scorm.init', array($scorm->hidenav, $scorm->hidetoc, $result->toctitle, $name, $sco->id, $adlnav));
}
if (!empty($forcejs)) {
echo $OUTPUT->box(get_string("forcejavascriptmessage", "scorm"), "generalbox boxaligncenter forcejavascriptmessage");
}
echo $OUTPUT->footer();
示例3: preg_replace
$name = preg_replace("/[^A-Za-z0-9]/", "", $scorm->name);
if (!$name) {
$name = 'DefaultPlayerWindow';
}
$name = 'scorm_' . $name;
echo html_writer::script('', $CFG->wwwroot . '/mod/scorm/player.js');
$url = new moodle_url($PAGE->url, array('scoid' => $sco->id, 'display' => 'popup', 'mode' => $mode));
echo html_writer::script(js_writer::function_call('scorm_openpopup', array($url->out(false), $name, $scorm->options, $scorm->width, $scorm->height)));
echo html_writer::tag('noscript', html_writer::tag('iframe', '', array('id' => 'main', 'class' => 'scoframe', 'name' => 'main', 'src' => 'loadSCO.php?id=' . $cm->id . $scoidstr . $modestr)));
}
} else {
echo $OUTPUT->box(get_string('noprerequisites', 'scorm'));
}
echo html_writer::end_div();
// Scorm page ends.
$scoes = scorm_get_toc_object($USER, $scorm, $currentorg, $sco->id, $mode, $attempt);
$adlnav = scorm_get_adlnav_json($scoes['scoes']);
if (empty($scorm->popup) || $displaymode == 'popup') {
if (!isset($result->toctitle)) {
$result->toctitle = get_string('toc', 'scorm');
}
$jsmodule = array('name' => 'mod_scorm', 'fullpath' => '/mod/scorm/module.js', 'requires' => array('json'));
$scorm->nav = intval($scorm->nav);
$PAGE->requires->js_init_call('M.mod_scorm.init', array($scorm->nav, $scorm->navpositionleft, $scorm->navpositiontop, $scorm->hidetoc, $collapsetocwinsize, $result->toctitle, $name, $sco->id, $adlnav), false, $jsmodule);
}
if (!empty($forcejs)) {
echo $OUTPUT->box(get_string("forcejavascriptmessage", "scorm"), "generalbox boxaligncenter forcejavascriptmessage");
}
if (file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . '.php')) {
include_once $CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . '.php';
} else {
示例4: scorm_get_toc
function scorm_get_toc($user, $scorm, $cmid, $toclink=TOCJSLINK, $currentorg='', $scoid='', $mode='normal',
$attempt='', $play=false, $tocheader=false) {
global $CFG, $DB, $OUTPUT;
if (empty($attempt)) {
$attempt = scorm_get_last_attempt($scorm->id, $user->id);
}
$result = new stdClass();
$organizationsco = null;
if ($tocheader) {
$result->toc = html_writer::start_div('yui3-g-r', array('id' => 'scorm_layout'));
$result->toc .= html_writer::start_div('yui3-u-1-5', array('id' => 'scorm_toc'));
$result->toc .= html_writer::div('', '', array('id' => 'scorm_toc_title'));
$result->toc .= html_writer::start_div('', array('id' => 'scorm_tree'));
}
if (!empty($currentorg)) {
$organizationsco = $DB->get_record('scorm_scoes', array('scorm' => $scorm->id, 'identifier' => $currentorg));
if (!empty($organizationsco->title)) {
if ($play) {
$result->toctitle = $organizationsco->title;
}
}
}
$scoes = scorm_get_toc_object($user, $scorm, $currentorg, $scoid, $mode, $attempt, $play, $organizationsco);
$treeview = scorm_format_toc_for_treeview($user, $scorm, $scoes['scoes'][0]->children, $scoes['usertracks'], $cmid,
$toclink, $currentorg, $attempt, $play, $organizationsco, false);
if ($tocheader) {
$result->toc .= $treeview->toc;
} else {
$result->toc = $treeview->toc;
}
if (!empty($scoes['scoid'])) {
$scoid = $scoes['scoid'];
}
if (empty($scoid)) {
// If this is a normal package with an org sco and child scos get the first child.
if (!empty($scoes['scoes'][0]->children)) {
$result->sco = $scoes['scoes'][0]->children[0];
} else { // This package only has one sco - it may be a simple external AICC package.
$result->sco = $scoes['scoes'][0];
}
} else {
$result->sco = scorm_get_sco($scoid);
}
if ($scorm->hidetoc == SCORM_TOC_POPUP) {
$tocmenu = scorm_format_toc_for_droplist($scorm, $scoes['scoes'][0]->children, $scoes['usertracks'],
$currentorg, $organizationsco);
$modestr = '';
if ($mode != 'normal') {
$modestr = '&mode='.$mode;
}
$url = new moodle_url('/mod/scorm/player.php?a='.$scorm->id.'¤torg='.$currentorg.$modestr);
$result->tocmenu = $OUTPUT->single_select($url, 'scoid', $tocmenu, $result->sco->id, null, "tocmenu");
}
$result->prerequisites = $treeview->prerequisites;
$result->incomplete = $treeview->incomplete;
$result->attemptleft = $treeview->attemptleft;
if ($tocheader) {
$result->toc .= html_writer::end_div().html_writer::end_div();
$result->toc .= html_writer::start_div('', array('id' => 'scorm_toc_toggle'));
$result->toc .= html_writer::tag('button', '', array('id' => 'scorm_toc_toggle_btn')).html_writer::end_div();
$result->toc .= html_writer::start_div('', array('id' => 'scorm_content'));
$result->toc .= html_writer::div('', '', array('id' => 'scorm_navpanel'));
$result->toc .= html_writer::end_div().html_writer::end_div();
}
return $result;
}