本文整理汇总了PHP中lesson_get_user_grades函数的典型用法代码示例。如果您正苦于以下问题:PHP lesson_get_user_grades函数的具体用法?PHP lesson_get_user_grades怎么用?PHP lesson_get_user_grades使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lesson_get_user_grades函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_coursemodule_from_instance
}
$cm = get_coursemodule_from_instance('lesson', $lesson->id);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if ($lesson->deadline == 0) {
$due = $strnodeadline;
} else {
if ($lesson->deadline > $timenow) {
$due = userdate($lesson->deadline);
} else {
$due = "<font color=\"red\">" . userdate($lesson->deadline) . "</font>";
}
}
if ($course->format == "weeks" or $course->format == "topics") {
if (has_capability('mod/lesson:manage', $context)) {
$grade_value = $lesson->grade;
} else {
// it's a student, show their grade
$grade_value = 0;
if ($return = lesson_get_user_grades($lesson, $USER->id)) {
$grade_value = $return[$USER->id]->rawgrade;
}
}
$table->data[] = array($lesson->section, $link, $grade_value, $due);
} else {
$table->data[] = array($link, $lesson->grade, $due);
}
}
echo "<br />";
print_table($table);
/// Finish the page
print_footer($course);
示例2: lesson_update_grades
/**
* Update grades in central gradebook
*
* @category grade
* @param object $lesson
* @param int $userid specific user only, 0 means all
* @param bool $nullifnone
*/
function lesson_update_grades($lesson, $userid = 0, $nullifnone = true)
{
global $CFG, $DB;
require_once $CFG->libdir . '/gradelib.php';
if ($lesson->grade == 0) {
lesson_grade_item_update($lesson);
} else {
if ($grades = lesson_get_user_grades($lesson, $userid)) {
lesson_grade_item_update($lesson, $grades);
} else {
if ($userid and $nullifnone) {
$grade = new stdClass();
$grade->userid = $userid;
$grade->rawgrade = NULL;
lesson_grade_item_update($lesson, $grade);
} else {
lesson_grade_item_update($lesson);
}
}
}
}