-/**
- * enables highlight of rows in user grade 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;
\ No newline at end of file
+
+/** 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';
+ }
+ }
+ }
+}
\ No newline at end of file
}
$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>';
}
$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>';
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 {