当前位置: 首页>>代码示例>>PHP>>正文


PHP scorm_get_adlnav_json函数代码示例

本文整理汇总了PHP中scorm_get_adlnav_json函数的典型用法代码示例。如果您正苦于以下问题:PHP scorm_get_adlnav_json函数的具体用法?PHP scorm_get_adlnav_json怎么用?PHP scorm_get_adlnav_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了scorm_get_adlnav_json函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: scorm_get_adlnav_json

function scorm_get_adlnav_json($scoes, &$adlnav = array(), $parentscoid = null)
{
    if (is_object($scoes)) {
        $sco = $scoes;
        if (isset($sco->url)) {
            $adlnav[$sco->id]['identifier'] = $sco->identifier;
            $adlnav[$sco->id]['launch'] = $sco->launch;
            $adlnav[$sco->id]['title'] = $sco->title;
            $adlnav[$sco->id]['url'] = $sco->url;
            $adlnav[$sco->id]['parent'] = $sco->parent;
            if (isset($sco->choice)) {
                $adlnav[$sco->id]['choice'] = $sco->choice;
            }
            if (isset($sco->flow)) {
                $adlnav[$sco->id]['flow'] = $sco->flow;
            } else {
                if (isset($parentscoid) && isset($adlnav[$parentscoid]['flow'])) {
                    $adlnav[$sco->id]['flow'] = $adlnav[$parentscoid]['flow'];
                }
            }
            if (isset($sco->isvisible)) {
                $adlnav[$sco->id]['isvisible'] = $sco->isvisible;
            }
            if (isset($sco->parameters)) {
                $adlnav[$sco->id]['parameters'] = $sco->parameters;
            }
            if (isset($sco->hidecontinue)) {
                $adlnav[$sco->id]['hidecontinue'] = $sco->hidecontinue;
            }
            if (isset($sco->hideprevious)) {
                $adlnav[$sco->id]['hideprevious'] = $sco->hideprevious;
            }
            if (isset($sco->hidesuspendall)) {
                $adlnav[$sco->id]['hidesuspendall'] = $sco->hidesuspendall;
            }
            if (!empty($parentscoid)) {
                $adlnav[$sco->id]['parentscoid'] = $parentscoid;
            }
            if (isset($adlnav['prevscoid'])) {
                $adlnav[$sco->id]['prevscoid'] = $adlnav['prevscoid'];
                $adlnav[$adlnav['prevscoid']]['nextscoid'] = $sco->id;
                if (isset($adlnav['prevparent']) && $adlnav['prevparent'] == $sco->parent) {
                    $adlnav[$sco->id]['prevsibling'] = $adlnav['prevscoid'];
                    $adlnav[$adlnav['prevscoid']]['nextsibling'] = $sco->id;
                }
            }
            $adlnav['prevscoid'] = $sco->id;
            $adlnav['prevparent'] = $sco->parent;
        }
        if (isset($sco->children)) {
            foreach ($sco->children as $children) {
                scorm_get_adlnav_json($children, $adlnav, $sco->id);
            }
        }
    } else {
        foreach ($scoes as $sco) {
            scorm_get_adlnav_json($sco, $adlnav);
        }
        unset($adlnav['prevscoid']);
        unset($adlnav['prevparent']);
    }
    return json_encode($adlnav);
}
开发者ID:helenagarcia90,项目名称:moodle,代码行数:63,代码来源:locallib.php

示例2: moodle_url

        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 {
    include_once $CFG->dirroot . '/mod/scorm/datamodels/scorm_12.php';
开发者ID:Keneth1212,项目名称:moodle,代码行数:31,代码来源:player.php


注:本文中的scorm_get_adlnav_json函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。