本文整理匯總了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);
}
}
}
}