本文整理汇总了PHP中lesson_grade_item_update函数的典型用法代码示例。如果您正苦于以下问题:PHP lesson_grade_item_update函数的具体用法?PHP lesson_grade_item_update怎么用?PHP lesson_grade_item_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lesson_grade_item_update函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lesson_reset_gradebook
/**
* Removes all grades from gradebook
*
* @global stdClass
* @global object
* @param int $courseid
* @param string optional type
*/
function lesson_reset_gradebook($courseid, $type = '')
{
global $CFG, $DB;
$sql = "SELECT l.*, cm.idnumber as cmidnumber, l.course as courseid\n FROM {lesson} l, {course_modules} cm, {modules} m\n WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id AND l.course=:course";
$params = array("course" => $courseid);
if ($lessons = $DB->get_records_sql($sql, $params)) {
foreach ($lessons as $lesson) {
lesson_grade_item_update($lesson, 'reset');
}
}
}
示例2: lesson_update_grades
/**
* Update grades in central gradebook
*
* @param object $lesson null means all lessons
* @param int $userid specific user only, 0 mean all
*/
function lesson_update_grades($lesson = null, $userid = 0, $nullifnone = true)
{
global $CFG;
if (!function_exists('grade_update')) {
//workaround for buggy PHP versions
require_once $CFG->libdir . '/gradelib.php';
}
if ($lesson != null) {
if ($grades = lesson_get_user_grades($lesson, $userid)) {
grade_update('mod/lesson', $lesson->course, 'mod', 'lesson', $lesson->id, 0, $grades);
} else {
if ($userid and $nullifnone) {
$grade = new object();
$grade->userid = $userid;
$grade->rawgrade = NULL;
grade_update('mod/lesson', $lesson->course, 'mod', 'lesson', $lesson->id, 0, $grade);
}
}
} else {
$sql = "SELECT l.*, cm.idnumber as cmidnumber, l.course as courseid\n FROM {$CFG->prefix}lesson l, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m\n WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
if ($rs = get_recordset_sql($sql)) {
if ($rs->RecordCount() > 0) {
while ($lesson = rs_fetch_next_record($rs)) {
lesson_grade_item_update($lesson);
if ($lesson->grade != 0) {
lesson_update_grades($lesson, 0, false);
}
}
}
rs_close($rs);
}
}
}