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


PHP scorm_get_user_grades函数代码示例

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


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

示例1: scorm_update_grades

/**
 * Update grades in central gradebook
 *
 * @category grade
 * @param object $scorm
 * @param int $userid specific user only, 0 mean all
 * @param bool $nullifnone
 */
function scorm_update_grades($scorm, $userid=0, $nullifnone=true) {
    global $CFG;
    require_once($CFG->libdir.'/gradelib.php');
    require_once($CFG->libdir.'/completionlib.php');

    if ($grades = scorm_get_user_grades($scorm, $userid)) {
        scorm_grade_item_update($scorm, $grades);
        // Set complete.
        scorm_set_completion($scorm, $userid, COMPLETION_COMPLETE, $grades);
    } else if ($userid and $nullifnone) {
        $grade = new stdClass();
        $grade->userid   = $userid;
        $grade->rawgrade = null;
        scorm_grade_item_update($scorm, $grade);
        // Set incomplete.
        scorm_set_completion($scorm, $userid, COMPLETION_INCOMPLETE);
    } else {
        scorm_grade_item_update($scorm);
    }
}
开发者ID:ruddj,项目名称:moodle,代码行数:28,代码来源:lib.php

示例2: scorm_update_grades

/**
 * Update grades in central gradebook
 *
 * @param object $scorm null means all scormbases
 * @param int $userid specific user only, 0 mean all
 */
function scorm_update_grades($scorm = null, $userid = 0, $nullifnone = true)
{
    global $CFG;
    if (!function_exists('grade_update')) {
        //workaround for buggy PHP versions
        require_once $CFG->libdir . '/gradelib.php';
    }
    if ($scorm != null) {
        if ($grades = scorm_get_user_grades($scorm, $userid)) {
            grade_update('mod/scorm', $scorm->course, 'mod', 'scorm', $scorm->id, 0, $grades);
        } else {
            if ($userid and $nullifnone) {
                $grade = new object();
                $grade->userid = $userid;
                $grade->rawgrade = NULL;
                grade_update('mod/scorm', $scorm->course, 'mod', 'scorm', $scorm->id, 0, $grade);
            }
        }
    } else {
        $sql = "SELECT s.*, cm.idnumber as cmidnumber\n                  FROM {$CFG->prefix}scorm s, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m\n                 WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
        if ($rs = get_recordset_sql($sql)) {
            if ($rs->RecordCount() > 0) {
                while ($scorm = rs_fetch_next_record($rs)) {
                    scorm_grade_item_update($scorm);
                    scorm_update_grades($scorm, 0, false);
                }
            }
            rs_close($rs);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:37,代码来源:lib.php

示例3: scorm_update_grades

/**
 * Update grades in central gradebook
 *
 * @global stdClass
 * @global object
 * @param object $scorm
 * @param int $userid specific user only, 0 mean all
 * @param bool $nullifnone
 */
function scorm_update_grades($scorm, $userid = 0, $nullifnone = true)
{
    global $CFG, $DB;
    require_once $CFG->libdir . '/gradelib.php';
    if ($grades = scorm_get_user_grades($scorm, $userid)) {
        scorm_grade_item_update($scorm, $grades);
    } else {
        if ($userid and $nullifnone) {
            $grade = new stdClass();
            $grade->userid = $userid;
            $grade->rawgrade = NULL;
            scorm_grade_item_update($scorm, $grade);
        } else {
            scorm_grade_item_update($scorm);
        }
    }
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:26,代码来源:lib.php


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