Skip to content

Commit

Permalink
Merge branch 'MDL-46658-master' of git://github.com/andrewnicols/moodle
Browse files Browse the repository at this point in the history
Conflicts:
	theme/bootstrapbase/less/moodle/grade.less
	theme/bootstrapbase/style/moodle.css
  • Loading branch information
danpoltawski committed Oct 8, 2014
2 parents e5d5bfd + 7feac0a commit e462093
Show file tree
Hide file tree
Showing 24 changed files with 3,500 additions and 1,083 deletions.
2 changes: 1 addition & 1 deletion grade/report/grader/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}

$PAGE->set_url(new moodle_url('/grade/report/grader/index.php', array('id'=>$courseid)));
$PAGE->requires->yui_module('moodle-gradereport_grader-scrollview', 'M.gradereport_grader.scrollview.init');
$PAGE->requires->yui_module('moodle-gradereport_grader-gradereporttable', 'Y.M.gradereport_grader.init', null, null, true);

// basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
Expand Down
1 change: 1 addition & 0 deletions grade/report/grader/lang/en/gradereport_grader.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
$string['preferences'] = 'Grader report preferences';
$string['useractivitygrade'] = '{$a} grade';
$string['useractivityfeedback'] = '{$a} feedback';
$string['overriddengrade'] = 'Overridden grade';
68 changes: 21 additions & 47 deletions grade/report/grader/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,10 @@ public function get_left_rows($displayaverages) {

$rows = $this->get_left_icons_row($rows, $colspan);

$rowclasses = array('even', 'odd');

$suspendedstring = null;
foreach ($this->users as $userid => $user) {
$userrow = new html_table_row();
$userrow->id = 'fixed_user_'.$userid;
$userrow->attributes['class'] = 'r'.$this->rowcount++.' '.$rowclasses[$this->rowcount % 2];

$usercell = new html_table_cell();
$usercell->attributes['class'] = 'user';
Expand All @@ -644,7 +641,9 @@ public function get_left_rows($displayaverages) {
}

$fullname = fullname($user);
$usercell->text .= html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), $fullname);
$usercell->text .= html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), $fullname, array(
'class' => 'username',
));

if (!empty($user->suspendedenrolment)) {
$usercell->attributes['class'] .= ' usersuspended';
Expand Down Expand Up @@ -680,6 +679,7 @@ public function get_left_rows($displayaverages) {
$userrow->cells[] = $fieldcell;
}

$userrow->attributes['data-uid'] = $userid;
$rows[] = $userrow;
}

Expand Down Expand Up @@ -711,7 +711,6 @@ public function get_right_rows($displayaverages) {
$arrows = $this->get_sort_arrows();

$jsarguments = array(
'id' => '#fixed_column',
'cfg' => array('ajaxenabled'=>false),
'items' => array(),
'users' => array(),
Expand Down Expand Up @@ -800,6 +799,7 @@ public function get_right_rows($displayaverages) {

$itemcell = new html_table_cell();
$itemcell->attributes['class'] = $type . ' ' . $catlevel . ' highlightable'. ' i'. $element['object']->id;
$itemcell->attributes['data-itemid'] = $element['object']->id;

if ($element['object']->is_hidden()) {
$itemcell->attributes['class'] .= ' dimmed_text';
Expand Down Expand Up @@ -841,8 +841,6 @@ public function get_right_rows($displayaverages) {
}
$jsscales = $scalesarray;

$rowclasses = array('even', 'odd');

foreach ($this->users as $userid => $user) {

if ($this->canviewhidden) {
Expand All @@ -857,7 +855,6 @@ public function get_right_rows($displayaverages) {

$itemrow = new html_table_row();
$itemrow->id = 'user_'.$userid;
$itemrow->attributes['class'] = $rowclasses[$this->rowcount % 2];

$fullname = fullname($user);
$jsarguments['users'][$userid] = $fullname;
Expand All @@ -869,6 +866,7 @@ public function get_right_rows($displayaverages) {
$itemcell = new html_table_cell();

$itemcell->id = 'u'.$userid.'i'.$itemid;
$itemcell->attributes['data-itemid'] = $itemid;

// Get the decimal points preference for this item
$decimalpoints = $item->get_decimals();
Expand Down Expand Up @@ -917,16 +915,19 @@ public function get_right_rows($displayaverages) {
}
if ($grade->is_overridden()) {
$itemcell->attributes['class'] .= ' overridden';
$itemcell->attributes['aria-label'] = get_string('overriddengrade', 'gradereport_grader');
}

if (!empty($grade->feedback)) {
//should we be truncating feedback? ie $short_feedback = shorten_text($feedback, $this->feedback_trunc_length);
$jsarguments['feedback'][] = array('user'=>$userid, 'item'=>$itemid, 'content'=>wordwrap(trim(format_string($grade->feedback, $grade->feedbackformat)),
34, '<br/ >'));
$feedback = wordwrap(trim(format_string($grade->feedback, $grade->feedbackformat)), 34, '<br>');
$itemcell->attributes['data-feedback'] = $feedback;
$jsarguments['feedback'][] = array('user'=>$userid, 'item'=>$itemid, 'content' => $feedback);
}

if ($grade->is_excluded()) {
$itemcell->text .= "<span class='excludedfloater'>" . $strexcludedgrades . "</span>";
// Adding white spaces before and after to prevent a screenreader from
// thinking that the words are attached to the next/previous <span> or text.
$itemcell->text .= " <span class='excludedfloater'>" . $strexcludedgrades . "</span> ";
}

// Do not show any icons if no grade (no record in DB to match)
Expand Down Expand Up @@ -1112,36 +1113,21 @@ public function get_right_rows($displayaverages) {
*/
public function get_grade_table($displayaverages = false) {
global $OUTPUT;
$fixedstudents = $this->is_fixed_students();

$leftrows = $this->get_left_rows($displayaverages);
$rightrows = $this->get_right_rows($displayaverages);

$html = '';

if ($fixedstudents) {
$fixedcolumntable = new html_table();
$fixedcolumntable->id = 'fixed_column';
$fixedcolumntable->data = $leftrows;
$html .= $OUTPUT->container(html_writer::table($fixedcolumntable), 'left_scroller');

$righttable = new html_table();
$righttable->id = 'user-grades';
$righttable->data = $rightrows;
$fulltable = new html_table();
$fulltable->attributes['class'] = 'gradereport-grader-table';
$fulltable->id = 'user-grades';

$html .= $OUTPUT->container(html_writer::table($righttable), 'right_scroller');
} else {
$fulltable = new html_table();
$fulltable->attributes['class'] = 'gradestable flexible boxaligncenter generaltable';
$fulltable->id = 'user-grades';

// Extract rows from each side (left and right) and collate them into one row each
foreach ($leftrows as $key => $row) {
$row->cells = array_merge($row->cells, $rightrows[$key]->cells);
$fulltable->data[] = $row;
}
$html .= html_writer::table($fulltable);
// Extract rows from each side (left and right) and collate them into one row each
foreach ($leftrows as $key => $row) {
$row->cells = array_merge($row->cells, $rightrows[$key]->cells);
$fulltable->data[] = $row;
}
$html .= html_writer::table($fulltable);
return $OUTPUT->container($html, 'gradeparent');
}

Expand Down Expand Up @@ -1737,18 +1723,6 @@ public static function do_process_action($target, $action, $courseid = null) {
return true;
}

/**
* Returns whether or not to display fixed students column.
* Includes a browser check, because IE6 doesn't support the scrollbar.
*
* @return bool
*/
public function is_fixed_students() {
global $CFG;

return $CFG->grade_report_fixedstudents;
}

/**
* Refactored function for generating HTML of sorting links with matching arrows.
* Returns an array with 'studentname' and 'idnumber' as keys, with HTML ready
Expand Down
Loading

0 comments on commit e462093

Please sign in to comment.