$eid = optional_param('eid', 0, PARAM_ALPHANUM);
$category = optional_param('category', null, PARAM_INT);
$aggregationtype = optional_param('aggregationtype', null, PARAM_INT);
-$showadvanced = optional_param('showadvanced', -1, PARAM_BOOL); // sticky editing mode
$url = new moodle_url('/grade/edit/tree/index.php', array('id' => $courseid));
-if($showadvanced!=-1) {
- $url->param("showadvanced",$showadvanced);
-}
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
$gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'tree', 'courseid'=>$courseid));
$returnurl = $gpr->get_return_url(null);
-/// Build editing on/off buttons
-if (!isset($USER->gradeediting)) {
- $USER->gradeediting = array();
-}
-
-if (has_capability('moodle/grade:manage', $context)) {
- if (!isset($USER->gradeediting[$course->id])) {
- $USER->gradeediting[$course->id] = 0;
- }
-
- if ($showadvanced == 1) {
- $USER->gradeediting[$course->id] = 1;
- } else if ($showadvanced == 0) {
- $USER->gradeediting[$course->id] = 0;
- }
-
- // page params for the turn editing on
- $options = $gpr->get_options();
- $options['sesskey'] = sesskey();
-
- if ($USER->gradeediting[$course->id]) {
- $options['showadvanced'] = 0;
- } else {
- $options['showadvanced'] = 1;
- }
-
-} else {
- $USER->gradeediting[$course->id] = 0;
- $buttons = '';
-}
-
// Change category aggregation if requested
if (!is_null($category) && !is_null($aggregationtype) && confirm_sesskey()) {
if (!$grade_category = grade_category::fetch(array('id'=>$category, 'courseid'=>$courseid))) {
break;
}
-// Hide advanced columns if moving
-if ($grade_edit_tree->moving) {
- $original_gradeediting = $USER->gradeediting[$course->id];
- $USER->gradeediting[$course->id] = 0;
-}
-
//if we go straight to the db to update an element we need to recreate the tree as
// $grade_edit_tree has already been constructed.
//Ideally we could do the updates through $grade_edit_tree to avoid recreating it
$PAGE->requires->string_for_js('changesmadereallygoaway', 'moodle');
echo $OUTPUT->footer();
-
-// Restore original show/hide preference if moving
-if ($moving) {
- $USER->gradeediting[$course->id] = $original_gradeediting;
-}
die;
$this->columns[] = grade_edit_tree_column::factory('actions');
$this->columns[] = grade_edit_tree_column::factory('select');
- $mode = ($USER->gradeediting[$COURSE->id]) ? 'advanced' : 'simple';
-
- $widthstyle = '';
- if ($mode == 'simple') {
- $widthstyle = ' style="width:auto;" ';
- }
-
$this->table = new html_table();
$this->table->id = "grade_edit_tree_table";
- $this->table->cellpadding = 5;
- $this->table->attributes['class'] = 'generaltable ' . $mode;
- $this->table->style = $widthstyle;
+ $this->table->attributes['class'] = 'generaltable simple';
foreach ($this->columns as $column) {
- if (!($this->moving && $column->hide_when_moving) && !$column->is_hidden($mode)) {
+ if (!($this->moving && $column->hide_when_moving) && !$column->is_hidden()) {
$this->table->head[] = $column->get_header_cell();
}
}
$actions .= $this->gtree->get_locking_icon($element, $this->gpr);
$actions .= $this->gtree->get_reset_icon($element, $this->gpr);
- $mode = ($USER->gradeediting[$COURSE->id]) ? 'advanced' : 'simple';
-
$returnrows = array();
$root = false;
$row->cells[] = $headercell;
foreach ($this->columns as $column) {
- if (!($this->moving && $column->hide_when_moving) && !$column->is_hidden($mode)) {
+ if (!($this->moving && $column->hide_when_moving) && !$column->is_hidden()) {
$row->cells[] = $column->get_category_cell($category, $levelclass, array('id' => $id, 'name' => $object->name, 'level' => $level, 'actions' => $actions, 'eid' => $eid));
}
}
}
foreach ($this->columns as $column) {
- if (!($this->moving && $column->hide_when_moving) && !$column->is_hidden($mode)) {
+ if (!($this->moving && $column->hide_when_moving) && !$column->is_hidden()) {
$gradeitemrow->cells[] = $column->get_item_cell($item, array('id' => $id, 'name' => $object->name, 'level' => $level, 'actions' => $actions,
'element' => $element, 'eid' => $eid, 'itemtype' => $object->itemtype));
}