mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-47520 core_grades: added CSS classes to the setup page
Part of: MDL-46576
This commit is contained in:
parent
a9937aec06
commit
d75a2367c3
@ -90,7 +90,10 @@ class grade_edit_tree {
|
||||
|
||||
$this->table = new html_table();
|
||||
$this->table->id = "grade_edit_tree_table";
|
||||
$this->table->attributes['class'] = 'generaltable simple';
|
||||
$this->table->attributes['class'] = 'generaltable simple setup-grades';
|
||||
if ($this->moving) {
|
||||
$this->table->attributes['class'] .= ' moving';
|
||||
}
|
||||
|
||||
foreach ($this->columns as $column) {
|
||||
if (!($this->moving && $column->hide_when_moving)) {
|
||||
@ -168,7 +171,8 @@ class grade_edit_tree {
|
||||
// do not diplay children
|
||||
$cell = new html_table_cell();
|
||||
$cell->colspan = 12;
|
||||
$cell->attributes['class'] = $element['type'] . ' moving';
|
||||
$cell->attributes['class'] = $element['type'] . ' moving column-name level' .
|
||||
($level + 1) . ' level' . ($level % 2 ? 'even' : 'odd');
|
||||
$cell->text = $object->name.' ('.get_string('move').')';
|
||||
return array(new html_table_row(array($cell)));
|
||||
}
|
||||
@ -222,6 +226,7 @@ class grade_edit_tree {
|
||||
|
||||
$cell = new html_table_cell();
|
||||
$cell->colspan = 12;
|
||||
$cell->attributes['class'] = 'movehere level' . ($level + 1) . ' level' . ($level % 2 ? 'even' : 'odd');
|
||||
|
||||
$icon = new pix_icon('movehere', $strmovehere, null, array('class'=>'movetarget'));
|
||||
$cell->text = $OUTPUT->action_icon($aurl, $icon);
|
||||
@ -273,7 +278,7 @@ class grade_edit_tree {
|
||||
$root = true;
|
||||
}
|
||||
|
||||
$levelclass = "level$level";
|
||||
$levelclass = "level$level level" . ($level % 2 ? 'odd' : 'even');
|
||||
|
||||
$courseclass = '';
|
||||
if ($level == 1) {
|
||||
@ -290,7 +295,7 @@ class grade_edit_tree {
|
||||
$headercell->header = true;
|
||||
$headercell->scope = 'row';
|
||||
$headercell->attributes['title'] = $object->stripped_name;
|
||||
$headercell->attributes['class'] = 'cell rowspan ' . $levelclass;
|
||||
$headercell->attributes['class'] = 'cell column-rowspan rowspan ' . $levelclass;
|
||||
$headercell->rowspan = $row_count + 1;
|
||||
$row->cells[] = $headercell;
|
||||
|
||||
@ -309,7 +314,7 @@ class grade_edit_tree {
|
||||
// Print a coloured row to show the end of the category across the table
|
||||
$endcell = new html_table_cell();
|
||||
$endcell->colspan = (19 - $level);
|
||||
$endcell->attributes['class'] = 'colspan ' . $levelclass;
|
||||
$endcell->attributes['class'] = 'emptyrow colspan ' . $levelclass;
|
||||
|
||||
$returnrows[] = new html_table_row(array($endcell));
|
||||
|
||||
@ -323,6 +328,9 @@ class grade_edit_tree {
|
||||
if ($item->itemtype == 'category') {
|
||||
$categoryitemclass = 'categoryitem';
|
||||
}
|
||||
if ($item->itemtype == 'course') {
|
||||
$categoryitemclass = 'courseitem';
|
||||
}
|
||||
|
||||
$dimmed = ($item->is_hidden()) ? "dimmed_text" : "";
|
||||
$gradeitemrow = new html_table_row();
|
||||
@ -576,14 +584,27 @@ abstract class grade_edit_tree_column {
|
||||
|
||||
public abstract function get_header_cell();
|
||||
|
||||
public abstract function get_category_cell($category, $levelclass, $params);
|
||||
public function get_category_cell($category, $levelclass, $params) {
|
||||
$cell = clone($this->categorycell);
|
||||
$cell->attributes['class'] .= ' ' . $levelclass;
|
||||
$cell->attributes['text'] = '';
|
||||
return $cell;
|
||||
}
|
||||
|
||||
public abstract function get_item_cell($item, $params);
|
||||
public function get_item_cell($item, $params) {
|
||||
$cell = clone($this->itemcell);
|
||||
$cell->attributes['text'] = '';
|
||||
if (isset($params['level'])) {
|
||||
$level = $params['level'] + (($item->itemtype == 'category' || $item->itemtype == 'course') ? 0 : 1);
|
||||
$cell->attributes['class'] .= ' level' . $level;
|
||||
$cell->attributes['class'] .= ' level' . ($level % 2 ? 'odd' : 'even');
|
||||
}
|
||||
return $cell;
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
$this->headercell = new html_table_cell();
|
||||
$this->headercell->header = true;
|
||||
$this->headercell->style = 'whitespace: normal;';
|
||||
$this->headercell->attributes['class'] = 'header';
|
||||
|
||||
$this->categorycell = new html_table_cell();
|
||||
@ -591,6 +612,12 @@ abstract class grade_edit_tree_column {
|
||||
|
||||
$this->itemcell = new html_table_cell();
|
||||
$this->itemcell->attributes['class'] = 'cell';
|
||||
|
||||
if (preg_match('/^grade_edit_tree_column_(\w*)$/', get_class($this), $matches)) {
|
||||
$this->headercell->attributes['class'] .= ' column-' . $matches[1];
|
||||
$this->categorycell->attributes['class'] .= ' column-' . $matches[1];
|
||||
$this->itemcell->attributes['class'] .= ' column-' . $matches[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,7 +646,6 @@ class grade_edit_tree_column_name extends grade_edit_tree_column {
|
||||
|
||||
public function get_header_cell() {
|
||||
$headercell = clone($this->headercell);
|
||||
$headercell->attributes['class'] .= ' name';
|
||||
$headercell->colspan = $this->deepest_level + 1;
|
||||
$headercell->text = get_string('name');
|
||||
return $headercell;
|
||||
@ -631,8 +657,7 @@ class grade_edit_tree_column_name extends grade_edit_tree_column {
|
||||
throw new Exception('Array key (name or level) missing from 3rd param of grade_edit_tree_column_name::get_category_cell($category, $levelclass, $params)');
|
||||
}
|
||||
$moveaction = isset($params['moveaction']) ? $params['moveaction'] : '';
|
||||
$categorycell = clone($this->categorycell);
|
||||
$categorycell->attributes['class'] .= ' name ' . $levelclass;
|
||||
$categorycell = parent::get_category_cell($category, $levelclass, $params);
|
||||
$categorycell->colspan = ($this->deepest_level +1) - $params['level'];
|
||||
$categorycell->text = $OUTPUT->heading($moveaction . $params['name'], 4);
|
||||
return $categorycell;
|
||||
@ -648,8 +673,7 @@ class grade_edit_tree_column_name extends grade_edit_tree_column {
|
||||
$name = $params['name'];
|
||||
$moveaction = isset($params['moveaction']) ? $params['moveaction'] : '';
|
||||
|
||||
$itemcell = clone($this->itemcell);
|
||||
$itemcell->attributes['class'] .= ' name';
|
||||
$itemcell = parent::get_item_cell($item, $params);
|
||||
$itemcell->colspan = ($this->deepest_level + 1) - $params['level'];
|
||||
$itemcell->text = $moveaction . $name;
|
||||
return $itemcell;
|
||||
@ -684,15 +708,14 @@ class grade_edit_tree_column_aggregation extends grade_edit_tree_column {
|
||||
$options = grade_helper::get_aggregation_strings();
|
||||
$aggregation = $options[$category->aggregation];
|
||||
|
||||
$categorycell = clone($this->categorycell);
|
||||
$categorycell->attributes['class'] .= ' ' . $levelclass;
|
||||
$categorycell = parent::get_category_cell($category, $levelclass, $params);
|
||||
$categorycell->text = $aggregation;
|
||||
return $categorycell;
|
||||
|
||||
}
|
||||
|
||||
public function get_item_cell($item, $params) {
|
||||
$itemcell = clone($this->itemcell);
|
||||
$itemcell = parent::get_item_cell($item, $params);
|
||||
$itemcell->text = ' - ';
|
||||
return $itemcell;
|
||||
}
|
||||
@ -716,8 +739,7 @@ class grade_edit_tree_column_weight extends grade_edit_tree_column {
|
||||
public function get_category_cell($category, $levelclass, $params) {
|
||||
|
||||
$item = $category->get_grade_item();
|
||||
$categorycell = clone($this->categorycell);
|
||||
$categorycell->attributes['class'] .= ' ' . $levelclass;
|
||||
$categorycell = parent::get_category_cell($category, $levelclass, $params);
|
||||
$categorycell->text = grade_edit_tree::get_weight_input($item);
|
||||
return $categorycell;
|
||||
}
|
||||
@ -726,7 +748,7 @@ class grade_edit_tree_column_weight extends grade_edit_tree_column {
|
||||
if (empty($params['element'])) {
|
||||
throw new Exception('Array key (element) missing from 2nd param of grade_edit_tree_column_weightorextracredit::get_item_cell($item, $params)');
|
||||
}
|
||||
$itemcell = clone($this->itemcell);
|
||||
$itemcell = parent::get_item_cell($item, $params);
|
||||
$itemcell->text = ' ';
|
||||
|
||||
if (!in_array($params['element']['object']->itemtype, array('courseitem', 'categoryitem', 'category'))) {
|
||||
@ -752,8 +774,7 @@ class grade_edit_tree_column_range extends grade_edit_tree_column {
|
||||
}
|
||||
|
||||
public function get_category_cell($category, $levelclass, $params) {
|
||||
$categorycell = clone($this->categorycell);
|
||||
$categorycell->attributes['class'] .= ' range ' . $levelclass;
|
||||
$categorycell = parent::get_category_cell($category, $levelclass, $params);
|
||||
$categorycell->text = ' - ';
|
||||
return $categorycell;
|
||||
}
|
||||
@ -784,7 +805,7 @@ class grade_edit_tree_column_range extends grade_edit_tree_column {
|
||||
$grademax = format_float($item->grademax, $item->get_decimals());
|
||||
}
|
||||
|
||||
$itemcell = clone($this->itemcell);
|
||||
$itemcell = parent::get_item_cell($item, $params);
|
||||
$itemcell->text = $grademax;
|
||||
return $itemcell;
|
||||
}
|
||||
@ -804,7 +825,6 @@ class grade_edit_tree_column_actions extends grade_edit_tree_column {
|
||||
|
||||
public function get_header_cell() {
|
||||
$headercell = clone($this->headercell);
|
||||
$headercell->attributes['class'] .= ' actions';
|
||||
$headercell->text = get_string('actions');
|
||||
return $headercell;
|
||||
}
|
||||
@ -815,8 +835,7 @@ class grade_edit_tree_column_actions extends grade_edit_tree_column {
|
||||
throw new Exception('Array key (actions) missing from 3rd param of grade_edit_tree_column_actions::get_category_actions($category, $levelclass, $params)');
|
||||
}
|
||||
|
||||
$categorycell = clone($this->categorycell);
|
||||
$categorycell->attributes['class'] .= ' ' . $levelclass;
|
||||
$categorycell = parent::get_category_cell($category, $levelclass, $params);
|
||||
$categorycell->text = $params['actions'];
|
||||
return $categorycell;
|
||||
}
|
||||
@ -825,8 +844,7 @@ class grade_edit_tree_column_actions extends grade_edit_tree_column {
|
||||
if (empty($params['actions'])) {
|
||||
throw new Exception('Array key (actions) missing from 2nd param of grade_edit_tree_column_actions::get_item_cell($item, $params)');
|
||||
}
|
||||
$itemcell = clone($this->itemcell);
|
||||
$itemcell->attributes['class'] .= ' actions';
|
||||
$itemcell = parent::get_item_cell($item, $params);
|
||||
$itemcell->text = $params['actions'];
|
||||
return $itemcell;
|
||||
}
|
||||
@ -842,7 +860,6 @@ class grade_edit_tree_column_select extends grade_edit_tree_column {
|
||||
|
||||
public function get_header_cell() {
|
||||
$headercell = clone($this->headercell);
|
||||
$headercell->attributes['class'] .= ' selection';
|
||||
$headercell->text = get_string('select');
|
||||
return $headercell;
|
||||
}
|
||||
@ -855,8 +872,7 @@ class grade_edit_tree_column_select extends grade_edit_tree_column {
|
||||
$selectall = new action_link(new moodle_url('#'), get_string('all'), new component_action('click', 'togglecheckboxes', array('eid' => $params['eid'], 'check' => true)));
|
||||
$selectnone = new action_link(new moodle_url('#'), get_string('none'), new component_action('click', 'togglecheckboxes', array('eid' => $params['eid'], 'check' => false)));
|
||||
|
||||
$categorycell = clone($this->categorycell);
|
||||
$categorycell->attributes['class'] .= ' selection ' . $levelclass;
|
||||
$categorycell = parent::get_category_cell($category, $levelclass, $params);
|
||||
$categorycell->text = $OUTPUT->render($selectall) . '<br />' . $OUTPUT->render($selectnone);
|
||||
return $categorycell;
|
||||
}
|
||||
@ -865,9 +881,7 @@ class grade_edit_tree_column_select extends grade_edit_tree_column {
|
||||
if (empty($params['itemtype']) || empty($params['eid'])) {
|
||||
error('Array key (itemtype or eid) missing from 2nd param of grade_edit_tree_column_select::get_item_cell($item, $params)');
|
||||
}
|
||||
$itemcell = clone($this->itemcell);
|
||||
$itemcell->attributes['class'] .= ' selection';
|
||||
$itemcell->text = '';
|
||||
$itemcell = parent::get_item_cell($item, $params);
|
||||
|
||||
if ($params['itemtype'] != 'course' && $params['itemtype'] != 'category') {
|
||||
$itemcell->text = '<label class="accesshide" for="select_'.$params['eid'].'">'.
|
||||
@ -875,7 +889,6 @@ class grade_edit_tree_column_select extends grade_edit_tree_column {
|
||||
<input class="itemselect ignoredirty" type="checkbox" name="select_'.$params['eid'].'" id="select_'.$params['eid'].
|
||||
'" onchange="toggleCategorySelector();"/>'; // TODO: convert to YUI handler
|
||||
}
|
||||
//html_writer::table() will wrap the item cell contents in a <TD> so don't do it here
|
||||
return $itemcell;
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +376,8 @@ class grade_report_user extends grade_report {
|
||||
$data = array();
|
||||
$hidden = '';
|
||||
$excluded = '';
|
||||
$class = '';
|
||||
$itemlevel = ($type == 'categoryitem' || $type == 'category' || $type == 'courseitem') ? $depth : ($depth + 1);
|
||||
$class = 'level' . $itemlevel . ' level' . ($itemlevel % 2 ? 'odd' : 'even');
|
||||
$classfeedback = '';
|
||||
|
||||
// If this is a hidden grade category, hide it completely from the user
|
||||
@ -442,7 +443,7 @@ class grade_report_user extends grade_report {
|
||||
**/
|
||||
|
||||
/// Other class information
|
||||
$class = "$hidden $excluded";
|
||||
$class .= $hidden . $excluded;
|
||||
if ($this->switch) { // alter style based on whether aggregation is first or last
|
||||
$class .= ($type == 'categoryitem' or $type == 'courseitem') ? " ".$alter."d$depth baggt b2b" : " item b1b";
|
||||
} else {
|
||||
@ -665,6 +666,9 @@ class grade_report_user extends grade_report {
|
||||
}
|
||||
|
||||
/// Add this row to the overall system
|
||||
foreach ($data as $key => $celldata) {
|
||||
$data[$key]['class'] .= ' column-' . $key;
|
||||
}
|
||||
$this->tabledata[] = $data;
|
||||
|
||||
/// Recursively iterate through all child elements
|
||||
@ -768,10 +772,10 @@ class grade_report_user extends grade_report {
|
||||
class='boxaligncenter generaltable user-grade'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th id='".$this->tablecolumns[0]."' class=\"header\" colspan='$maxspan'>".$this->tableheaders[0]."</th>\n";
|
||||
<th id='".$this->tablecolumns[0]."' class=\"header column-{$this->tablecolumns[0]}\" colspan='$maxspan'>".$this->tableheaders[0]."</th>\n";
|
||||
|
||||
for ($i = 1; $i < count($this->tableheaders); $i++) {
|
||||
$html .= "<th id='".$this->tablecolumns[$i]."' class=\"header\">".$this->tableheaders[$i]."</th>\n";
|
||||
$html .= "<th id='".$this->tablecolumns[$i]."' class=\"header column-{$this->tablecolumns[$i]}\">".$this->tableheaders[$i]."</th>\n";
|
||||
}
|
||||
|
||||
$html .= "
|
||||
|
@ -73,7 +73,6 @@
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.path-grade-edit-tree table.generaltable td.selection,
|
||||
.path-grade-edit-tree table.generaltable th.selection {
|
||||
.path-grade-edit-tree table.setup-grades .column-select {
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -231,7 +231,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.path-grade-edit-tree table.generaltable td.selection,
|
||||
.path-grade-edit-tree table.generaltable th.selection {
|
||||
.path-grade-edit-tree table.setup-grades .column-select {
|
||||
text-align: center;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user