$item->hiddenuntil = 0; } $item->locked = !empty($item->locked); $item->gradepass = format_float($item->gradepass, $decimalpoints); if (empty($parent_category)) { $item->aggregationcoef = 0; } else { if ($parent_category->aggregation == GRADE_AGGREGATE_SUM) { $item->aggregationcoef = $item->aggregationcoef > 0 ? 1 : 0; $item->aggregationcoef2 = format_float($item->aggregationcoef2 * 100.0); } else { $item->aggregationcoef = format_float($item->aggregationcoef, 4); } } $mform->set_data($item); if ($data = $mform->get_data()) { if (!isset($data->aggregationcoef)) { $data->aggregationcoef = 0; } if (property_exists($data, 'calculation')) { $data->calculation = grade_item::normalize_formula($data->calculation, $course->id); } $hidden = empty($data->hidden) ? 0 : $data->hidden; $hiddenuntil = empty($data->hiddenuntil) ? 0 : $data->hiddenuntil; unset($data->hidden); unset($data->hiddenuntil); $locked = empty($data->locked) ? 0 : $data->locked; $locktime = empty($data->locktime) ? 0 : $data->locktime; unset($data->locked); unset($data->locktime); $convert = array('gradepass', 'aggregationcoef', 'aggregationcoef2');
} else { $item->hiddenuntil = 0; } $item->locked = !empty($item->locked); $item->gradepass = format_float($item->gradepass, $decimalpoints); if (empty($parent_category)) { $item->aggregationcoef = 0; } else { if ($parent_category->aggregation == GRADE_AGGREGATE_SUM) { $item->aggregationcoef = $item->aggregationcoef > 0 ? 1 : 0; } else { $item->aggregationcoef = format_float($item->aggregationcoef, 4); } } $mform->set_data($item); if ($data = $mform->get_data(false)) { if (!isset($data->aggregationcoef)) { $data->aggregationcoef = 0; } if (array_key_exists('calculation', $data)) { $data->calculation = grade_item::normalize_formula($data->calculation, $course->id); } $hidden = empty($data->hidden) ? 0 : $data->hidden; $hiddenuntil = empty($data->hiddenuntil) ? 0 : $data->hiddenuntil; unset($data->hidden); unset($data->hiddenuntil); $locked = empty($data->locked) ? 0 : $data->locked; $locktime = empty($data->locktime) ? 0 : $data->locktime; unset($data->locked); unset($data->locktime); $convert = array('gradepass', 'aggregationcoef');