mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-47562 gradereport_singleview: ui fixes and improvements
Collection of ui improvements that did not get completed before 2.8 was released. See the tracker for more details.
This commit is contained in:
parent
06c2753115
commit
2a6cdc51b7
@ -71,6 +71,14 @@ class grade extends tablelike implements selectable_items, filterable_items {
|
||||
!($item->is_course_item() || $item->is_category_item());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the label for the select box that chooses items for this page.
|
||||
* @return string
|
||||
*/
|
||||
public function select_label() {
|
||||
return get_string('selectuser', 'gradereport_singleview');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the description of this page
|
||||
* @return string
|
||||
@ -278,7 +286,7 @@ class grade extends tablelike implements selectable_items, filterable_items {
|
||||
* @return string
|
||||
*/
|
||||
public function heading() {
|
||||
return $this->item->get_name();
|
||||
return get_string('gradeitem', 'gradereport_singleview', $this->item->get_name());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,7 +200,7 @@ abstract class screen {
|
||||
* @return string
|
||||
*/
|
||||
public function heading() {
|
||||
return get_string('pluginname', 'gradereport_singleview');
|
||||
return get_string('entrypage', 'gradereport_singleview');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,10 +104,11 @@ class select extends screen {
|
||||
|
||||
$url = new moodle_url('/grade/report/singleview/index.php', $params);
|
||||
|
||||
$select = new \single_select($url, 'itemid', $options);
|
||||
$select->set_label($screen->description());
|
||||
$select = new \single_select($url, 'itemid', $options, '', array('' => $screen->select_label()));
|
||||
$select->set_label($screen->select_label(), array('class'=>'accesshide'));
|
||||
$html .= $OUTPUT->render($select);
|
||||
}
|
||||
$html = $OUTPUT->container($html, 'selectitems');
|
||||
|
||||
if (empty($html)) {
|
||||
$OUTPUT->notification(get_string('noscreens', 'gradereport_singleview'));
|
||||
|
@ -40,6 +40,12 @@ interface selectable_items {
|
||||
*/
|
||||
public function description();
|
||||
|
||||
/**
|
||||
* Get the label for the select box that chooses items for this page.
|
||||
* @return string
|
||||
*/
|
||||
public function select_label();
|
||||
|
||||
/**
|
||||
* Get the list of options to show.
|
||||
* @return array
|
||||
|
@ -183,7 +183,7 @@ abstract class tablelike extends screen {
|
||||
|
||||
$underlying = get_class($this);
|
||||
|
||||
$data = new stdClass;
|
||||
$data = new stdClass();
|
||||
$data->table = $table;
|
||||
$data->instance = $this;
|
||||
|
||||
@ -191,14 +191,18 @@ abstract class tablelike extends screen {
|
||||
$buttonhtml = implode(' ', $this->buttons());
|
||||
|
||||
$buttons = html_writer::tag('div', $buttonhtml, $buttonattr);
|
||||
$selectview = new select($this->courseid, $this->itemid, $this->groupid);
|
||||
|
||||
$sessionvalidation = html_writer::empty_tag('input',
|
||||
array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
|
||||
|
||||
return html_writer::tag('form',
|
||||
$html = $selectview->html();
|
||||
$html .= html_writer::tag('form',
|
||||
$buttons . html_writer::table($table) . $this->bulk_insert() . $buttons . $sessionvalidation,
|
||||
array('method' => 'POST')
|
||||
);
|
||||
$html .= $selectview->html();
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,6 +52,14 @@ class user extends tablelike implements selectable_items {
|
||||
/** @var int $requirespaging Do we have more items than the paging limit? */
|
||||
private $requirespaging = true;
|
||||
|
||||
/**
|
||||
* Get the label for the select box that chooses items for this page.
|
||||
* @return string
|
||||
*/
|
||||
public function select_label() {
|
||||
return get_string('selectgrade', 'gradereport_singleview');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the description for the screen.
|
||||
*
|
||||
@ -83,15 +91,6 @@ class user extends tablelike implements selectable_items {
|
||||
return 'grade';
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we show the group selector on this screen?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function display_group_selector() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the screen
|
||||
*
|
||||
@ -103,9 +102,12 @@ class user extends tablelike implements selectable_items {
|
||||
if (!$selfitemisempty) {
|
||||
$validusers = $this->load_users();
|
||||
if (!isset($validusers[$this->itemid])) {
|
||||
print_error('invaliduserid');
|
||||
// If the passed user id is not valid, show the first user from the list instead.
|
||||
$this->item = reset($validusers);
|
||||
$this->itemid = $this->item->id;
|
||||
} else {
|
||||
$this->item = $validusers[$this->itemid];
|
||||
}
|
||||
$this->item = $validusers[$this->itemid];
|
||||
}
|
||||
|
||||
$params = array('courseid' => $this->courseid);
|
||||
@ -282,7 +284,7 @@ class user extends tablelike implements selectable_items {
|
||||
* @return string
|
||||
*/
|
||||
public function heading() {
|
||||
return fullname($this->item);
|
||||
return get_string('gradeuser', 'gradereport_singleview', fullname($this->item));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,7 @@ $perpage = optional_param('perpage', 100, PARAM_INT);
|
||||
|
||||
$courseparams = array('id' => $courseid);
|
||||
$PAGE->set_url(new moodle_url('/grade/report/singleview/index.php', $courseparams));
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
|
||||
if (!$course = $DB->get_record('course', $courseparams)) {
|
||||
print_error('nocourseid');
|
||||
@ -138,13 +139,13 @@ if (!empty($options)) {
|
||||
$navparams['itemid'] = $reloptionssorting[$i - 1];
|
||||
$link = new moodle_url('/grade/report/singleview/index.php', $navparams);
|
||||
$navprev = html_writer::link($link, $OUTPUT->larrow() . ' ' . $reloptions[$reloptionssorting[$i - 1]]);
|
||||
$graderleftnav = html_writer::tag('small', $navprev, array('class' => 'itemnav previtem'));
|
||||
$graderleftnav = html_writer::tag('div', $navprev, array('class' => 'itemnav previtem'));
|
||||
}
|
||||
if ($i < count($reloptionssorting) - 1) {
|
||||
$navparams['itemid'] = $reloptionssorting[$i + 1];
|
||||
$link = new moodle_url('/grade/report/singleview/index.php', $navparams);
|
||||
$navnext = html_writer::link($link, $reloptions[$reloptionssorting[$i + 1]] . ' ' . $OUTPUT->rarrow());
|
||||
$graderrightnav = html_writer::tag('small', $navnext, array('class' => 'itemnav nextitem'));
|
||||
$graderrightnav = html_writer::tag('div', $navnext, array('class' => 'itemnav nextitem'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ $string['bulkinsertvalue'] = 'Insert value';
|
||||
$string['bulklegend'] = 'Bulk insert';
|
||||
$string['bulkperform'] = 'Perform bulk insert';
|
||||
$string['bulkfor'] = 'Grades for {$a}';
|
||||
$string['entrypage'] = 'Grade user or grade item';
|
||||
$string['exclude'] = 'Exclude';
|
||||
$string['excludeall'] = 'Exclude all grades';
|
||||
$string['excludefor'] = 'Exclude for {$a}';
|
||||
@ -39,6 +40,8 @@ $string['eventgradereportviewed'] = 'Grade single view report viewed.';
|
||||
$string['feedbackfor'] = 'Feedback for {$a}';
|
||||
$string['filtergrades'] = 'Show grades for {$a}.';
|
||||
$string['gradefor'] = 'Grade for {$a}';
|
||||
$string['gradeitem'] = 'Grade item: {$a}';
|
||||
$string['gradeuser'] = 'Grade user: {$a}';
|
||||
$string['noscreens'] = 'Could not find a suitable single view screen.';
|
||||
$string['gradeitemcannotbeoverridden'] = 'This grade item cannot be overridden.';
|
||||
$string['notvalid'] = 'Not a valid Single view screen: {$a}';
|
||||
@ -49,6 +52,9 @@ $string['overridenone'] = 'Do not override any grades';
|
||||
$string['pluginname'] = 'Single view';
|
||||
$string['savegrades'] = 'Saving grades';
|
||||
$string['savegradessuccess'] = 'Grades were set for {$a} items';
|
||||
$string['selectgrade'] = 'Select grade item...';
|
||||
$string['selectuser'] = 'Select user...';
|
||||
$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.';
|
||||
$string['userselect'] = 'Select activity';
|
||||
|
@ -107,7 +107,7 @@ class gradereport_singleview extends grade_report {
|
||||
*/
|
||||
public function output() {
|
||||
global $OUTPUT;
|
||||
return $OUTPUT->box($this->screen->html());
|
||||
return $OUTPUT->container($this->screen->html(), 'reporttable');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,39 @@
|
||||
.path-grade-report-singleview div.generalbox {
|
||||
margin: 0 20px 15px 20px;
|
||||
.path-grade-report-singleview div.reporttable {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.generalbox div.singleselect form div {
|
||||
.path-grade-report-singleview div.groupselector,
|
||||
.path-grade-report-singleview div.reporttable form div.singleview_buttons,
|
||||
.path-grade-report-singleview div.selectitems {
|
||||
display: block;
|
||||
text-align: right;
|
||||
clear: both;
|
||||
}
|
||||
.dir-rtl.path-grade-report-singleview div.groupselector,
|
||||
.dir-rtl.path-grade-report-singleview div.reporttable form div.singleview_buttons,
|
||||
.dir-rtl.path-grade-report-singleview div.selectitems {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.singleselect+div.singleselect select,
|
||||
.path-grade-report-singleview div.groupselector select {
|
||||
margin-right: 0px;
|
||||
}
|
||||
dir-rtl.path-grade-report-singleview div.singleselect+div.singleselect select,
|
||||
dir-rtl.path-grade-report-singleview div.groupselector select {
|
||||
margin-right: 10px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.reporttable div.singleselect form div {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.generalbox table.generaltable {
|
||||
.path-grade-report-singleview div.reporttable table.reporttable {
|
||||
margin: 0 auto 15px auto;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.generalbox form div {
|
||||
.path-grade-report-singleview div.reporttable form div {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@ -19,17 +41,18 @@
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.generalbox h2 {
|
||||
.path-grade-report-singleview div.reporttable h2 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview input[name^="finalgrade"] {
|
||||
width: 50px;
|
||||
}
|
||||
.path-grade-report-singleview .generaltable tbody th {
|
||||
.path-grade-report-singleview .reporttable tbody th,
|
||||
.path-grade-report-singleview .reporttable tbody td.range {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.path-grade-report-singleview .generaltable tbody th > * {
|
||||
.path-grade-report-singleview .reporttable tbody th > * {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 2px;
|
||||
@ -37,37 +60,43 @@
|
||||
|
||||
.path-grade-report-singleview #region-main h2, .paging{
|
||||
text-align: center;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview .itemnav {
|
||||
font-size: small;
|
||||
display: inline;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
.path-grade-report-singleview itemnav.previtem {
|
||||
float:left;
|
||||
}
|
||||
.path-grade-report-singleview.dir-rtl small.previtem {
|
||||
.path-grade-report-singleview.dir-rtl div.previtem {
|
||||
float:right;
|
||||
}
|
||||
.path-grade-report-singleview small.nextitem {
|
||||
.path-grade-report-singleview div.nextitem {
|
||||
float:right;
|
||||
}
|
||||
.path-grade-report-singleview.dir-rtl small.nextitem {
|
||||
.path-grade-report-singleview.dir-rtl div.nextitem {
|
||||
float:left;
|
||||
}
|
||||
.path-grade-report-singleview .generaltable {
|
||||
.path-grade-report-singleview .reporttable {
|
||||
width: 100%;
|
||||
}
|
||||
.path-grade-report-singleview .generaltable th {
|
||||
.path-grade-report-singleview .reporttable th {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.dir-rtl.path-grade-report-singleview .generaltable th {
|
||||
.dir-rtl.path-grade-report-singleview .reporttable th {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.generalbox form div.singleview_bulk {
|
||||
.path-grade-report-singleview div.reporttable form div.singleview_bulk {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.dir-rtl.path-grade-report-singleview div.generalbox form div.singleview_bulk {
|
||||
.dir-rtl.path-grade-report-singleview div.reporttable form div.singleview_bulk {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@ -78,13 +107,22 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview .singleselect select,
|
||||
.path-grade-report-singleview div.reporttable form .singleview_bulk select,
|
||||
.path-grade-report-singleview div.reporttable form .singleview_bulk input {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
.path-grade-report-singleview .singleview_bulk > fieldset {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.path-grade-report-singleview div.generalbox form .singleview_bulk > div.enable {
|
||||
.path-grade-report-singleview div.reporttable form .singleview_bulk > div.enable {
|
||||
margin-bottom: 0.5em;
|
||||
text-align: left;
|
||||
}
|
||||
.dir-rtl.path-grade-report-singleview div.generalbox form .singleview_bulk > div.enable {
|
||||
.dir-rtl.path-grade-report-singleview div.reporttable form .singleview_bulk > div.enable {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user