本文整理汇总了PHP中grade_item::denormalize_formula方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_item::denormalize_formula方法的具体用法?PHP grade_item::denormalize_formula怎么用?PHP grade_item::denormalize_formula使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_item
的用法示例。
在下文中一共展示了grade_item::denormalize_formula方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_calculation
/**
* Returns calculation string if grade calculated.
* @return mixed string if calculation used, null if not
*/
function get_calculation()
{
if ($this->is_calculated()) {
return grade_item::denormalize_formula($this->calculation, $this->courseid);
} else {
return NULL;
}
}
示例2: grade_plugin_return
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url($CFG->wwwroot . '/grade/report.php?id=' . $course->id);
if (!($grade_item = grade_item::fetch(array('id' => $id, 'courseid' => $course->id)))) {
error('Incorect item id');
}
// activity items and items without grade can not have calculation
if ($grade_item->is_external_item() or $grade_item->gradetype != GRADE_TYPE_VALUE and $grade_item->gradetype != GRADE_TYPE_SCALE) {
redirect($returnurl, get_string('errornocalculationallowed', 'grades'));
}
$mform = new edit_calculation_form(null, array('gpr' => $gpr, 'itemid' => $grade_item->id));
if ($mform->is_cancelled()) {
redirect($returnurl);
}
$calculation = calc_formula::localize($grade_item->calculation);
$calculation = grade_item::denormalize_formula($calculation, $grade_item->courseid);
$mform->set_data(array('courseid' => $grade_item->courseid, 'calculation' => $calculation, 'id' => $grade_item->id, 'itemname' => $grade_item->itemname));
$errors = array();
if ($data = $mform->get_data(false)) {
$calculation = calc_formula::unlocalize($data->calculation);
$grade_item->set_calculation($calculation);
redirect($returnurl);
} elseif (!empty($section) and $section = 'idnumbers' and !empty($idnumbers)) {
// Handle idnumbers separately (non-mform)
//first validate and store the new idnumbers
foreach ($idnumbers as $giid => $value) {
if ($gi = grade_item::fetch(array('id' => $giid))) {
if ($gi->itemtype == 'mod') {
$cm = get_coursemodule_from_instance($gi->itemmodule, $gi->iteminstance, $gi->courseid);
} else {
$cm = null;
示例3: require_capability
require_capability('moodle/grade:manage', $context);
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url('index.php?id=' . $course->id);
$mform = new edit_outcomeitem_form(null, array('gpr' => $gpr));
if ($mform->is_cancelled() || empty($CFG->enableoutcomes)) {
redirect($returnurl);
}
if ($item = get_record('grade_items', 'id', $id, 'courseid', $course->id)) {
$item = new grade_item($item, false);
// redirect if outcomeid present
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 {