本文整理汇总了PHP中grade_scale::compact_items方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_scale::compact_items方法的具体用法?PHP grade_scale::compact_items怎么用?PHP grade_scale::compact_items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_scale
的用法示例。
在下文中一共展示了grade_scale::compact_items方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sub_test_scale_one_item
protected function sub_test_scale_one_item()
{
$params = new stdClass();
$params->name = 'unittestscale1i';
$params->courseid = $this->course->id;
$params->userid = $this->userid;
$params->scale = 'Like';
$params->description = 'This scale is used to like something.';
$params->timemodified = time();
$scale = new grade_scale($params, false);
$scale->load_items();
$this->assertCount(1, $scale->scale_items);
$this->assertSame(array('Like'), $scale->scale_items);
$this->assertSame('Like', $scale->compact_items());
$scale->insert();
// Manual grade item with 1 item scale.
$grade_item = new stdClass();
$grade_item->courseid = $this->course->id;
$grade_item->categoryid = $this->grade_categories[0]->id;
$grade_item->itemname = 'manual grade_item scale_1';
$grade_item->itemtype = 'manual';
$grade_item->itemnumber = 0;
$grade_item->needsupdate = false;
$grade_item->gradetype = GRADE_TYPE_SCALE;
$grade_item->scaleid = $scale->id;
$grade_item->iteminfo = 'Manual grade item used for unit testing';
$grade_item->timecreated = time();
$grade_item->timemodified = time();
$grade_item = new grade_item($grade_item);
$grade_item->insert();
$this->assertNotEmpty($grade_item->id);
$this->assertEquals(1, $grade_item->grademin);
$this->assertEquals(1, $grade_item->grademax);
}