本文整理汇总了PHP中scorm_grade_item_update函数的典型用法代码示例。如果您正苦于以下问题:PHP scorm_grade_item_update函数的具体用法?PHP scorm_grade_item_update怎么用?PHP scorm_grade_item_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scorm_grade_item_update函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}
示例2: scorm_reset_gradebook
/**
* Removes all grades from gradebook
* @param int $courseid
* @param string optional type
*/
function scorm_reset_gradebook($courseid, $type = '')
{
global $CFG;
$sql = "SELECT s.*, cm.idnumber as cmidnumber, s.course as courseid\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 AND s.course={$courseid}";
if ($scorms = get_records_sql($sql)) {
foreach ($scorms as $scorm) {
scorm_grade_item_update($scorm, 'reset');
}
}
}
示例3: scorm_reset_gradebook
/**
* Removes all grades from gradebook
*
* @global stdClass
* @global object
* @param int $courseid
* @param string optional type
*/
function scorm_reset_gradebook($courseid, $type='') {
global $CFG, $DB;
$sql = "SELECT s.*, cm.idnumber as cmidnumber, s.course as courseid
FROM {scorm} s, {course_modules} cm, {modules} m
WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id AND s.course=?";
if ($scorms = $DB->get_records_sql($sql, array($courseid))) {
foreach ($scorms as $scorm) {
scorm_grade_item_update($scorm, 'reset');
}
}
}
示例4: array
$scorm->reference = $filename;
$scorm->md5hash = '';
$scorm->sha1hash = $hash;
$DB->update_record('scorm', $scorm);
// 2. The 'instance' field in the {course_modules} table of the record,
// where ('id' => $scorm->coursemodule) is set to the new record ID from step 1
$DB->set_field('course_modules', 'instance', $scormid, array('id' => $cmid));
// Get the whole SCORM object data
$scorm = $DB->get_record('scorm', array('id' => $scormid));
// Extra fields required in grade related functions.
$scorm->course = $courseid;
$scorm->cmidnumber = '';
$scorm->cmid = $cmid;
xlog("Configuring SCORM module '{$scormname}'");
scorm_parse($scorm, true);
scorm_grade_item_update($scorm);
// Specific settings for the SCORM package
$scormsettings = new stdClass();
$scormsettings->id = $scormid;
$scormsettings->introformat = 0;
$scormsettings->maxgrade = 100;
$scormsettings->grademethod = 1;
$scormsettings->whatgrade = 0;
$scormsettings->maxattempt = 0;
$scormsettings->forcecompleted = 1;
$scormsettings->forcenewattempt = 1;
$scormsettings->lastattemptlock = 0;
$scormsettings->displayattemptstatus = 0;
$scormsettings->displaycoursestructure = 0;
$scormsettings->updatefreq = 0;
$scormsettings->skipview = 2;