MDL-47146 core_grades: remove advanced mode in setup
authorMarina Glancy <marina@moodle.com>
Tue, 16 Sep 2014 05:55:01 +0000 (13:55 +0800)
committerAdrian Greeve <adrian@moodle.com>
Fri, 3 Oct 2014 05:54:38 +0000 (13:54 +0800)
Part of: MDL-46576

grade/edit/tree/index.php
grade/edit/tree/lib.php

index f49ecac..c3ae0d3 100644 (file)
@@ -32,12 +32,8 @@ $action          = optional_param('action', 0, PARAM_ALPHA);
 $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');
 
@@ -57,37 +53,6 @@ $PAGE->requires->js('/grade/edit/tree/functions.js');
 $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))) {
@@ -200,12 +165,6 @@ switch ($action) {
         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
@@ -376,11 +335,6 @@ $PAGE->requires->yui_module('moodle-core-formchangechecker',
 $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;
 
 
index 3710f23..93bd3a3 100644 (file)
@@ -91,21 +91,12 @@ class grade_edit_tree {
         $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();
             }
         }
@@ -166,8 +157,6 @@ class grade_edit_tree {
         $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;
 
@@ -308,7 +297,7 @@ class grade_edit_tree {
             $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));
                 }
             }
@@ -343,7 +332,7 @@ class grade_edit_tree {
             }
 
             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));
                 }