本文整理汇总了PHP中grade_item::get_decimals方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_item::get_decimals方法的具体用法?PHP grade_item::get_decimals怎么用?PHP grade_item::get_decimals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_item
的用法示例。
在下文中一共展示了grade_item::get_decimals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
if ($grade_item->is_course_item() or $grade_item->is_category_item()) {
$grade_category = $grade_item->get_item_category();
$url = $CFG->wwwroot . '/grade/edit/tree/category.php?id=' . $grade_category->id . '&courseid=' . $courseid;
redirect($gpr->add_url_params($url));
}
$item = $grade_item->get_record_data();
$parent_category = $grade_item->get_parent_category();
$item->parentcategory = $parent_category->id;
} else {
$heading = get_string('newitem', 'grades');
$grade_item = new grade_item(array('courseid' => $courseid, 'itemtype' => 'manual'), false);
$item = $grade_item->get_record_data();
$parent_category = grade_category::fetch_course_category($courseid);
$item->parentcategory = $parent_category->id;
}
$decimalpoints = $grade_item->get_decimals();
if ($item->hidden > 1) {
$item->hiddenuntil = $item->hidden;
$item->hidden = 0;
} else {
$item->hiddenuntil = 0;
}
$item->locked = !empty($item->locked);
$item->grademax = format_float($item->grademax, $decimalpoints);
$item->grademin = format_float($item->grademin, $decimalpoints);
$item->gradepass = format_float($item->gradepass, $decimalpoints);
$item->multfactor = format_float($item->multfactor, 4);
$item->plusfactor = format_float($item->plusfactor, 4);
if ($parent_category->aggregation == GRADE_AGGREGATE_SUM or $parent_category->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN2) {
$item->aggregationcoef = $item->aggregationcoef == 0 ? 0 : 1;
} else {
示例2: redirect
if (empty($item->outcomeid)) {
$url = $CFG->wwwroot . '/grade/edit/tree/item.php?id=' . $id . '&courseid=' . $courseid;
redirect($gpr->add_url_params($url));
}
$item->calculation = grade_item::denormalize_formula($item->calculation, $course->id);
if ($item->itemtype == 'mod') {
$cm = get_coursemodule_from_instance($item->itemmodule, $item->iteminstance, $item->courseid);
$item->cmid = $cm->id;
} else {
$item->cmid = 0;
}
} else {
$item = new grade_item(array('courseid' => $courseid, 'itemtype' => 'manual'));
$item->cmid = 0;
}
$decimalpoints = $item->get_decimals();
if ($item->hidden > 1) {
$item->hiddenuntil = $item->hidden;
$item->hidden = 0;
} else {
$item->hiddenuntil = 0;
}
$item->locked = !empty($item->locked);
$item->gradepass = format_float($item->gradepass, $decimalpoints);
$item->aggregationcoef = format_float($item->aggregationcoef, 4);
$mform->set_data($item);
if ($data = $mform->get_data(false)) {
if (array_key_exists('calculation', $data)) {
$data->calculation = grade_item::normalize_formula($data->calculation, $course->id);
}
$hidden = empty($data->hidden) ? 0 : $data->hidden;