allowing horizontal and vertical highlighting
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
/**
|
||||
* enables highlight and marking of rows in data tables
|
||||
*
|
||||
*/
|
||||
function markRowsInit() {
|
||||
// for every table row ...
|
||||
var rows = document.getElementById('user-grades').getElementsByTagName('tr');
|
||||
for ( var i = 0; i < rows.length; i++ ) {
|
||||
// ... with the class 'odd' or 'even' ...
|
||||
// ... and to mark the row on click ...
|
||||
rows[i].onmousedown = function() {
|
||||
|
||||
if (this.className.search(/marked/) != -1) {
|
||||
this.className = this.className.replace(' marked', '');
|
||||
/** highlight/unset the row of a table **/
|
||||
function set_row(idx) {
|
||||
var table = document.getElementById('user-grades');
|
||||
var rowsize = table.rows[idx].cells.length;
|
||||
for (var i = 1; i < rowsize; i++) {
|
||||
if (table.rows[idx].cells[i]) {
|
||||
if (table.rows[idx].cells[i].className.search(/hmarked/) != -1) {
|
||||
table.rows[idx].cells[i].className = table.rows[idx].cells[i].className.replace(' hmarked', '');
|
||||
} else {
|
||||
this.className += ' marked';
|
||||
table.rows[idx].cells[i].className += ' hmarked';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.onload=markRowsInit;
|
||||
|
||||
/** highlight/unset the column of a table **/
|
||||
function set_col(idx) {
|
||||
var table = document.getElementById('user-grades');
|
||||
for (var i = 1; i < table.rows.length; i++) {
|
||||
if (table.rows[i].cells[idx]) {
|
||||
if (table.rows[i].cells[idx].className.search(/vmarked/) != -1) {
|
||||
table.rows[i].cells[idx].className = table.rows[i].cells[idx].className.replace(' vmarked', '');
|
||||
} else {
|
||||
table.rows[i].cells[idx].className += ' vmarked';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,7 +587,7 @@ class grade_report_grader extends grade_report {
|
||||
}
|
||||
|
||||
$headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
|
||||
$headerhtml .= '<th class="header '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col">'. $headerlink . $arrow;
|
||||
$headerhtml .= '<th class="header '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col" onclick="set_col(this.cellIndex)">'. $headerlink . $arrow;
|
||||
$headerhtml .= $this->get_icons($element) . '</th>';
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ class grade_report_grader extends grade_report {
|
||||
$user_pic = '<div class="userpic">' . print_user_picture($user->id, $this->courseid, true, 0, true) . '</div>';
|
||||
}
|
||||
|
||||
$studentshtml .= '<tr class="r'.$this->rowcount++.'"><th class="header c'.$columncount++.' user" scope="row">'.$user_pic
|
||||
$studentshtml .= '<tr class="r'.$this->rowcount++.'"><th class="header c'.$columncount++.' user" scope="row" onclick="set_row(this.parentNode.rowIndex);">'.$user_pic
|
||||
.'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->course->id.'">'
|
||||
.fullname($user).'</a></th>';
|
||||
|
||||
|
||||
@@ -10,8 +10,16 @@ white-space:normal;
|
||||
whitespace: nowrap;
|
||||
}
|
||||
|
||||
.grade-report-grader table#user-grades tr.marked td.cell {
|
||||
background-color: #FFCC99 ;
|
||||
.grade-report-grader table#user-grades td.vmarked {
|
||||
background-color: #ffcc33;
|
||||
}
|
||||
|
||||
.grade-report-grader table#user-grades td.hmarked {
|
||||
background-color: #ffff99;
|
||||
}
|
||||
|
||||
.grade-report-grader table#user-grades td.hmarked.vmarked{
|
||||
background-color: #ffcc99;
|
||||
}
|
||||
|
||||
.grade-report-grader table#user-grades .catlevel1 {
|
||||
|
||||
Reference in New Issue
Block a user