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


PHP scorm_get_toc函数代码示例

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


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

示例1: scorm_simple_play

function scorm_simple_play($scorm, $user, $context, $cmid)
{
    global $DB;
    $result = false;
    if (has_capability('mod/scorm:viewreport', $context)) {
        //if this user can view reports, don't skipview so they can see links to reports.
        return $result;
    }
    if ($scorm->scormtype != SCORM_TYPE_LOCAL && $scorm->updatefreq == SCORM_UPDATE_EVERYTIME) {
        scorm_parse($scorm, false);
    }
    $scoes = $DB->get_records_select('scorm_scoes', 'scorm = ? AND ' . $DB->sql_isnotempty('scorm_scoes', 'launch', false, true), array($scorm->id), 'sortorder, id', 'id');
    if ($scoes) {
        $orgidentifier = '';
        if ($sco = scorm_get_sco($scorm->launch, SCO_ONLY)) {
            if ($sco->organization == '' && $sco->launch == '') {
                $orgidentifier = $sco->identifier;
            } else {
                $orgidentifier = $sco->organization;
            }
        }
        if ($scorm->skipview >= SCORM_SKIPVIEW_FIRST) {
            $sco = current($scoes);
            $url = new moodle_url('/mod/scorm/player.php', array('a' => $scorm->id, 'currentorg' => $orgidentifier, 'scoid' => $sco->id));
            if ($scorm->skipview == SCORM_SKIPVIEW_ALWAYS || !scorm_has_tracks($scorm->id, $user->id)) {
                if (!empty($scorm->forcenewattempt)) {
                    $result = scorm_get_toc($user, $scorm, $cmid, TOCFULLURL, $orgidentifier);
                    if ($result->incomplete === false) {
                        $url->param('newattempt', 'on');
                    }
                }
                redirect($url);
            }
        }
    }
    return $result;
}
开发者ID:helenagarcia90,项目名称:moodle,代码行数:37,代码来源:locallib.php

示例2: strtolower

//
// TOC processing
//
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR));
// Just to be safe
if (!file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php')) {
    $scorm->version = 'scorm_12';
}
require_once $CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php';
$attempt = scorm_get_last_attempt($scorm->id, $USER->id);
if ($newattempt == 'on' && ($attempt < $scorm->maxattempt || $scorm->maxattempt == 0)) {
    $attempt++;
    $mode = 'normal';
}
$attemptstr = '&amp;attempt=' . $attempt;
$result = scorm_get_toc($USER, $scorm, 'structurelist', $currentorg, $scoid, $mode, $attempt, true);
$sco = $result->sco;
if ($mode == 'browse' && $scorm->hidebrowse == 1) {
    $mode = 'normal';
}
if ($mode != 'browse') {
    if ($trackdata = scorm_get_tracks($sco->id, $USER->id, $attempt)) {
        if ($trackdata->status == 'completed' || $trackdata->status == 'passed' || $trackdata->status == 'failed') {
            $mode = 'review';
        } else {
            $mode = 'normal';
        }
    } else {
        $mode = 'normal';
    }
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:player.php

示例3: scorm_view_display

function scorm_view_display($user, $scorm, $action, $cm, $boxwidth = '')
{
    global $CFG;
    if ($scorm->updatefreq == UPDATE_EVERYTIME) {
        require_once $CFG->dirroot . '/mod/scorm/lib.php';
        $scorm->instance = $scorm->id;
        scorm_update_instance($scorm);
    }
    $organization = optional_param('organization', '', PARAM_INT);
    print_simple_box_start('center', $boxwidth);
    ?>
        <div class="structurehead"><?php 
    print_string('contents', 'scorm');
    ?>
</div>
<?php 
    if (empty($organization)) {
        $organization = $scorm->launch;
    }
    if ($orgs = get_records_select_menu('scorm_scoes', "scorm='{$scorm->id}' AND organization='' AND launch=''", 'id', 'id,title')) {
        if (count($orgs) > 1) {
            ?>
            <div class='scorm-center'>
                <?php 
            print_string('organizations', 'scorm');
            ?>
                <form id='changeorg' method='post' action='<?php 
            echo $action;
            ?>
'>
                    <?php 
            choose_from_menu($orgs, 'organization', "{$organization}", '', 'submit()');
            ?>
                </form>
            </div>
<?php 
        }
    }
    $orgidentifier = '';
    if ($sco = scorm_get_sco($organization, SCO_ONLY)) {
        if ($sco->organization == '' && $sco->launch == '') {
            $orgidentifier = $sco->identifier;
        } else {
            $orgidentifier = $sco->organization;
        }
    }
    /*
     $orgidentifier = '';
        if ($org = get_record('scorm_scoes','id',$organization)) {
            if (($org->organization == '') && ($org->launch == '')) {
                $orgidentifier = $org->identifier;
            } else {
                $orgidentifier = $org->organization;
            }
        }*/
    $scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR));
    // Just to be safe
    if (!file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php')) {
        $scorm->version = 'scorm_12';
    }
    require_once $CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php';
    $result = scorm_get_toc($user, $scorm, 'structlist', $orgidentifier);
    $incomplete = $result->incomplete;
    echo $result->toc;
    print_simple_box_end();
    ?>
            <div class="scorm-center">
               <form id="theform" method="post" action="<?php 
    echo $CFG->wwwroot;
    ?>
/mod/scorm/player.php">
              <?php 
    if ($scorm->hidebrowse == 0) {
        print_string('mode', 'scorm');
        echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">' . get_string('browse', 'scorm') . '</label>' . "\n";
        echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">' . get_string('normal', 'scorm') . "</label>\n";
    } else {
        echo '<input type="hidden" name="mode" value="normal" />' . "\n";
    }
    if ($incomplete === false && ($result->attemptleft > 0 || $scorm->maxattempt == 0)) {
        ?>
                  <br />
                  <input type="checkbox" id="a" name="newattempt" />
                  <label for="a"><?php 
        print_string('newattempt', 'scorm');
        ?>
</label>
<?php 
    }
    ?>
              <br />
              <input type="hidden" name="scoid"/>
              <input type="hidden" name="id" value="<?php 
    echo $cm->id;
    ?>
"/>
              <input type="hidden" name="currentorg" value="<?php 
    echo $orgidentifier;
    ?>
" />
//.........这里部分代码省略.........
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:101,代码来源:locallib.php

示例4: strtolower

    }
}
// TOC processing
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR));
// Just to be safe
if (!file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php')) {
    $scorm->version = 'scorm_12';
}
require_once $CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php';
$attempt = scorm_get_last_attempt($scorm->id, $USER->id);
if ($newattempt == 'on' && ($attempt < $scorm->maxattempt || $scorm->maxattempt == 0)) {
    $attempt++;
    $mode = 'normal';
}
$attemptstr = '&amp;attempt=' . $attempt;
$result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, true);
$sco = $result->sco;
if ($mode == 'browse' && $scorm->hidebrowse == 1) {
    $mode = 'normal';
}
if ($mode != 'browse') {
    if ($trackdata = scorm_get_tracks($sco->id, $USER->id, $attempt)) {
        if ($trackdata->status == 'completed' || $trackdata->status == 'passed' || $trackdata->status == 'failed') {
            $mode = 'review';
        } else {
            $mode = 'normal';
        }
    } else {
        $mode = 'normal';
    }
}
开发者ID:richheath,项目名称:moodle,代码行数:31,代码来源:player.php

示例5: scorm_view_display

function scorm_view_display($user, $scorm, $action, $cm)
{
    global $CFG, $DB, $PAGE, $OUTPUT;
    if ($scorm->updatefreq == UPDATE_EVERYTIME) {
        scorm_parse($scorm, false);
    }
    $organization = optional_param('organization', '', PARAM_INT);
    if ($scorm->displaycoursestructure == 1) {
        echo $OUTPUT->box_start('generalbox boxaligncenter toc');
        ?>
        <div class="structurehead"><?php 
        print_string('contents', 'scorm');
        ?>
</div>
        <?php 
    }
    if (empty($organization)) {
        $organization = $scorm->launch;
    }
    if ($orgs = $DB->get_records_select_menu('scorm_scoes', 'scorm = ? AND ' . $DB->sql_isempty('scorm_scoes', 'launch', false, true) . ' AND ' . $DB->sql_isempty('scorm_scoes', 'organization', false, false), array($scorm->id), 'id', 'id,title')) {
        if (count($orgs) > 1) {
            $select = new single_select(new moodle_url($action), 'organization', $orgs, $organization, null);
            $select->label = get_string('organizations', 'scorm');
            $select->class = 'scorm-center';
            echo $OUTPUT->render($select);
        }
    }
    $orgidentifier = '';
    if ($sco = scorm_get_sco($organization, SCO_ONLY)) {
        if ($sco->organization == '' && $sco->launch == '') {
            $orgidentifier = $sco->identifier;
        } else {
            $orgidentifier = $sco->organization;
        }
    }
    $scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR));
    // Just to be safe
    if (!file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php')) {
        $scorm->version = 'scorm_12';
    }
    require_once $CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php';
    $result = scorm_get_toc($user, $scorm, $cm->id, TOCFULLURL, $orgidentifier);
    $incomplete = $result->incomplete;
    // do we want the TOC to be displayed?
    if ($scorm->displaycoursestructure == 1) {
        echo $result->toc;
        echo $OUTPUT->box_end();
    }
    // is this the first attempt ?
    $attemptcount = scorm_get_attempt_count($user->id, $scorm);
    // do not give the player launch FORM if the SCORM object is locked after the final attempt
    if ($scorm->lastattemptlock == 0 || $result->attemptleft > 0) {
        ?>
            <div class="scorm-center">
               <form id="theform" method="post" action="<?php 
        echo $CFG->wwwroot;
        ?>
/mod/scorm/player.php">
        <?php 
        if ($scorm->hidebrowse == 0) {
            print_string('mode', 'scorm');
            echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">' . get_string('browse', 'scorm') . '</label>' . "\n";
            echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">' . get_string('normal', 'scorm') . "</label>\n";
        } else {
            echo '<input type="hidden" name="mode" value="normal" />' . "\n";
        }
        if ($scorm->forcenewattempt == 1) {
            if ($incomplete === false) {
                echo '<input type="hidden" name="newattempt" value="on" />' . "\n";
            }
        } else {
            if (!empty($attemptcount) && $incomplete === false && ($result->attemptleft > 0 || $scorm->maxattempt == 0)) {
                ?>
                      <br />
                      <input type="checkbox" id="a" name="newattempt" />
                      <label for="a"><?php 
                print_string('newattempt', 'scorm');
                ?>
</label>
            <?php 
            }
        }
        ?>
              <br />
              <input type="hidden" name="scoid"/>
              <input type="hidden" name="cm" value="<?php 
        echo $cm->id;
        ?>
"/>
              <input type="hidden" name="currentorg" value="<?php 
        echo $orgidentifier;
        ?>
" />
              <input type="submit" value="<?php 
        print_string('enter', 'scorm');
        ?>
" />
              </form>
          </div>
        <?php 
//.........这里部分代码省略.........
开发者ID:richheath,项目名称:moodle,代码行数:101,代码来源:locallib.php


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