Merge branch 'MDL-47310-master' of git://github.com/jethac/moodle

This commit is contained in:
Marina Glancy 2014-10-30 14:22:48 +08:00
commit f1d3d8ccb3
6 changed files with 94 additions and 14 deletions

View File

@ -1354,15 +1354,14 @@ class grade_structure {
return $header;
}
if ($withlink) {
$url = $this->get_activity_link($element);
if ($url) {
$a = new stdClass();
$a->name = get_string('modulename', $element['object']->itemmodule);
$title = get_string('linktoactivity', 'grades', $a);
if ($withlink && $url = $this->get_activity_link($element)) {
$a = new stdClass();
$a->name = get_string('modulename', $element['object']->itemmodule);
$title = get_string('linktoactivity', 'grades', $a);
$header = html_writer::link($url, $header, array('title' => $title));
}
$header = html_writer::link($url, $header, array('title' => $title));
} else {
$header = html_writer::span($header);
}
if ($withdescription) {

View File

@ -160,7 +160,6 @@ class grade extends tablelike implements selectable_items, filterable_items {
public function original_headers() {
return array(
'', // For filter icon.
'', // For user picture.
get_string('firstname') . ' (' . get_string('alternatename') . ') ' . get_string('lastname'),
get_string('range', 'grades'),
get_string('grade', 'grades'),
@ -208,12 +207,31 @@ class grade extends tablelike implements selectable_items, filterable_items {
$line = array(
$OUTPUT->action_icon($this->format_link('user', $item->id), new pix_icon('t/editstring', $iconstring)),
$OUTPUT->user_picture($item),
$OUTPUT->user_picture($item, array('visibletoscreenreaders' => false)) .
html_writer::link($url, $fullname),
$this->item_range()
);
$lineclasses = array(
"action",
"user",
"range"
);
$outputline = array();
$i = 0;
foreach ($line as $key => $value) {
$cell = new \html_table_cell($value);
if ($isheader = $i == 1) {
$cell->header = $isheader;
$cell->scope = "row";
}
if (array_key_exists($key, $lineclasses)) {
$cell->attributes['class'] = $lineclasses[$key];
}
$outputline[] = $cell;
$i++;
}
return $this->format_definition($line, $grade);
return $this->format_definition($outputline, $grade);
}
/**
@ -267,6 +285,15 @@ class grade extends tablelike implements selectable_items, filterable_items {
return $this->item->get_name();
}
/**
* Get the summary for this table.
*
* @return string
*/
public function summary() {
return get_string('summarygrade', 'gradereport_singleview');
}
/**
* Process the data from the form.
*

View File

@ -59,6 +59,13 @@ abstract class tablelike extends screen {
*/
public abstract function format_line($item);
/**
* Get the summary for this table.
*
* @return string
*/
public abstract function summary();
/**
* Get the table headers
*
@ -166,6 +173,11 @@ abstract class tablelike extends screen {
$table->head = $this->headers();
$summary = $this->summary();
if (!empty($summary)) {
$table->summary = $summary;
}
// To be used for extra formatting.
$this->index = 0;
$this->total = count($this->items);

View File

@ -139,7 +139,6 @@ class user extends tablelike implements selectable_items {
public function original_headers() {
return array(
'', // For filter icon.
'', // For activity icon.
get_string('assessmentname', 'gradereport_singleview'),
get_string('gradecategory', 'grades'),
get_string('range', 'grades'),
@ -197,9 +196,33 @@ class user extends tablelike implements selectable_items {
$line = array(
$OUTPUT->action_icon($this->format_link('grade', $item->id), new pix_icon('t/editstring', $iconstring)),
$this->format_icon($item) . $lockicon, $itemlabel, $this->category($item), (new range($item))
$this->format_icon($item) . $lockicon . $itemlabel,
$this->category($item),
new range($item)
);
return $this->format_definition($line, $grade);
$lineclasses = array(
"action",
"gradeitem",
"category",
"range"
);
$outputline = array();
$i = 0;
foreach ($line as $key => $value) {
$cell = new \html_table_cell($value);
if ($isheader = $i == 1) {
$cell->header = $isheader;
$cell->scope = "row";
}
if (array_key_exists($key, $lineclasses)) {
$cell->attributes['class'] = $lineclasses[$key];
}
$outputline[] = $cell;
$i++;
}
return $this->format_definition($outputline, $grade);
}
/**
@ -252,6 +275,15 @@ class user extends tablelike implements selectable_items {
return fullname($this->item);
}
/**
* Get the summary for this table.
*
* @return string
*/
public function summary() {
return get_string('summaryuser', 'gradereport_singleview');
}
/**
* Default pager
*

View File

@ -46,3 +46,5 @@ $string['overridefor'] = 'Override for {$a}';
$string['overridenone'] = 'Override no grades';
$string['pluginname'] = 'Single view';
$string['singleview:view'] = 'View report';
$string['summarygrade'] = 'A table of users, with columns for range, grade, feedback, and whether to override or exclude a particular grade.';
$string['summaryuser'] = 'A table of grade items, with columns for grade category, range, grade, feedback, and whether to override or exclude a particular grade.';

View File

@ -25,6 +25,14 @@
.path-grade-report-singleview input[name^="finalgrade"] {
width: 50px;
}
.path-grade-report-singleview .generaltable tbody th {
white-space: nowrap;
}
.path-grade-report-singleview .generaltable tbody th > * {
display: inline-block;
vertical-align: middle;
margin: 0 2px;
}
.path-grade-report-singleview #region-main h2, .paging{
text-align: center;