if ($id !== 0) { $url->param('id', $id); } $PAGE->set_url($url); $PAGE->set_pagelayout('admin'); navigation_node::override_active_url(new moodle_url('/grade/edit/tree/index.php', array('id' => $courseid))); if (!($course = $DB->get_record('course', array('id' => $courseid)))) { print_error('nocourseid'); } require_login($course); $context = context_course::instance($course->id); 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); } $heading = get_string('outcomeitemsedit', 'grades'); if ($grade_item = grade_item::fetch(array('id' => $id, 'courseid' => $courseid))) { // redirect if outcomeid present if (empty($grade_item->outcomeid)) { $url = $CFG->wwwroot . '/grade/edit/tree/item.php?id=' . $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; if ($item->itemtype == 'mod') { $cm = get_coursemodule_from_instance($item->itemmodule, $item->iteminstance, $item->courseid);