本文整理汇总了PHP中grade_grade::set_hidden方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_grade::set_hidden方法的具体用法?PHP grade_grade::set_hidden怎么用?PHP grade_grade::set_hidden使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_grade
的用法示例。
在下文中一共展示了grade_grade::set_hidden方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_get_grade_items_student
/**
* Test get_grades_items function case student
*/
public function test_get_grade_items_student()
{
$this->resetAfterTest(true);
$s1grade = 80;
$s2grade = 60;
list($course, $teacher, $student1, $student2, $assignment) = $this->load_data($s1grade, $s2grade);
grade_set_setting($course->id, 'report_user_showrank', 1);
grade_set_setting($course->id, 'report_user_showpercentage', 1);
grade_set_setting($course->id, 'report_user_showgrade', 1);
grade_set_setting($course->id, 'report_user_showfeedback', 1);
grade_set_setting($course->id, 'report_user_showweight', 1);
grade_set_setting($course->id, 'report_user_showcontributiontocoursetotal', 1);
grade_set_setting($course->id, 'report_user_showlettergrade', 1);
grade_set_setting($course->id, 'report_user_showaverage', 1);
$this->setUser($student1);
$studentgrades = gradereport_user_external::get_grade_items($course->id, $student1->id);
$studentgrades = external_api::clean_returnvalue(gradereport_user_external::get_grade_items_returns(), $studentgrades);
// No warnings returned.
$this->assertCount(0, $studentgrades['warnings']);
// Check that only grades for the student in the teacher group are returned.
$this->assertCount(1, $studentgrades['usergrades']);
$this->assertCount(2, $studentgrades['usergrades'][0]['gradeitems']);
$this->assertEquals($course->id, $studentgrades['usergrades'][0]['courseid']);
$this->assertEquals($student1->id, $studentgrades['usergrades'][0]['userid']);
$this->assertEquals('mod', $studentgrades['usergrades'][0]['gradeitems'][0]['itemtype']);
$this->assertEquals('assign', $studentgrades['usergrades'][0]['gradeitems'][0]['itemmodule']);
$this->assertEquals($assignment->id, $studentgrades['usergrades'][0]['gradeitems'][0]['iteminstance']);
$this->assertEquals($assignment->cmidnumber, $studentgrades['usergrades'][0]['gradeitems'][0]['cmid']);
$this->assertEquals(0, $studentgrades['usergrades'][0]['gradeitems'][0]['itemnumber']);
$this->assertEmpty($studentgrades['usergrades'][0]['gradeitems'][0]['outcomeid']);
$this->assertEmpty($studentgrades['usergrades'][0]['gradeitems'][0]['scaleid']);
$this->assertEquals(80, $studentgrades['usergrades'][0]['gradeitems'][0]['graderaw']);
$this->assertEquals('80.00', $studentgrades['usergrades'][0]['gradeitems'][0]['gradeformatted']);
$this->assertEquals(0, $studentgrades['usergrades'][0]['gradeitems'][0]['grademin']);
$this->assertEquals(100, $studentgrades['usergrades'][0]['gradeitems'][0]['grademax']);
$this->assertEquals('0–100', $studentgrades['usergrades'][0]['gradeitems'][0]['rangeformatted']);
$this->assertEquals('80.00 %', $studentgrades['usergrades'][0]['gradeitems'][0]['percentageformatted']);
$this->assertEmpty($studentgrades['usergrades'][0]['gradeitems'][0]['feedback']);
$this->assertFalse($studentgrades['usergrades'][0]['gradeitems'][0]['gradehiddenbydate']);
$this->assertFalse($studentgrades['usergrades'][0]['gradeitems'][0]['gradeneedsupdate']);
$this->assertFalse($studentgrades['usergrades'][0]['gradeitems'][0]['gradeishidden']);
$this->assertEquals('B-', $studentgrades['usergrades'][0]['gradeitems'][0]['lettergradeformatted']);
$this->assertEquals(1, $studentgrades['usergrades'][0]['gradeitems'][0]['rank']);
$this->assertEquals(2, $studentgrades['usergrades'][0]['gradeitems'][0]['numusers']);
$this->assertEquals(70, $studentgrades['usergrades'][0]['gradeitems'][0]['averageformatted']);
// Hide one grade for the user.
$gradegrade = new grade_grade(array('userid' => $student1->id, 'itemid' => $studentgrades['usergrades'][0]['gradeitems'][0]['id']), true);
$gradegrade->set_hidden(1);
$studentgrades = gradereport_user_external::get_grade_items($course->id, $student1->id);
$studentgrades = external_api::clean_returnvalue(gradereport_user_external::get_grade_items_returns(), $studentgrades);
// Check we get only the course final grade.
$this->assertCount(1, $studentgrades['usergrades']);
$this->assertCount(1, $studentgrades['usergrades'][0]['gradeitems']);
$this->assertEquals('course', $studentgrades['usergrades'][0]['gradeitems'][0]['itemtype']);
}
示例2: empty
// change overridden flag only if grade or feedback not changed
if (!isset($data->overridden)) {
$data->overridden = 0;
// checkbox
}
$grade_grade->set_overridden($data->overridden);
}
}
if (has_capability('moodle/grade:manage', $context) or has_capability('moodle/grade:hide', $context)) {
$hidden = empty($data->hidden) ? 0 : $data->hidden;
$hiddenuntil = empty($data->hiddenuntil) ? 0 : $data->hiddenuntil;
if ($grade_item->is_hidden()) {
if ($old_grade_grade->hidden == 1 and $hiddenuntil == 0) {
//nothing to do - grade was originally hidden, we want to keep it that way
} else {
$grade_grade->set_hidden($hiddenuntil);
}
} else {
if ($hiddenuntil) {
$grade_grade->set_hidden($hiddenuntil);
} else {
$grade_grade->set_hidden($hidden);
// checkbox data might be undefined
}
}
}
if (isset($data->locked) and !$grade_item->is_locked()) {
if (($old_grade_grade->locked or $old_grade_grade->locktime) and (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:unlock', $context))) {
//ignore data
} else {
if (!$old_grade_grade->locked and !$old_grade_grade->locktime and (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:lock', $context))) {
示例3: fullname
$fullname = fullname($user);
$info = "{$grade_item->itemname}: $fullname";
add_to_log($course->id, 'grade', 'update', $url, $info);
}
}
if (has_capability('moodle/grade:manage', $context) or has_capability('moodle/grade:hide', $context)) {
$hidden = empty($data->hidden) ? 0: $data->hidden;
$hiddenuntil = empty($data->hiddenuntil) ? 0: $data->hiddenuntil;
if ($grade_item->is_hidden()) {
if ($old_grade_grade->hidden == 1 and $hiddenuntil == 0) {
//nothing to do - grade was originally hidden, we want to keep it that way
} else {
$grade_grade->set_hidden($hiddenuntil);
}
} else {
if ($hiddenuntil) {
$grade_grade->set_hidden($hiddenuntil);
} else {
$grade_grade->set_hidden($hidden); // checkbox data might be undefined
}
}
}
if (isset($data->locked) and !$grade_item->is_locked()) {
if (($old_grade_grade->locked or $old_grade_grade->locktime)
and (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:unlock', $context))) {
//ignore data