mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-18229 gradereport: updated index.php test to calculate navigation based on new class name 'gradereport_selectable_items'
This commit is contained in:
parent
8ec7b088ef
commit
0a55da571a
8 changed files with 32 additions and 23 deletions
|
@ -658,17 +658,24 @@ class grade_report_grader extends grade_report {
|
|||
|
||||
$userrow->cells[] = $usercell;
|
||||
|
||||
$userreportcell = new html_table_cell();
|
||||
$userreportcell->attributes['class'] = 'userreport';
|
||||
$userreportcell->header = true;
|
||||
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
|
||||
$userreportcell = new html_table_cell();
|
||||
$userreportcell->attributes['class'] = 'userreport';
|
||||
$userreportcell->header = true;
|
||||
$a = new stdClass();
|
||||
$a->user = $fullname;
|
||||
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
|
||||
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php', array('userid' => $user->id, 'id' => $this->course->id));
|
||||
$userreportcell->text .= $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser));
|
||||
}
|
||||
|
||||
if (has_capability('gradereport/singleview:view', $this->context)) {
|
||||
$url = new moodle_url('/grade/report/singleview/index.php', array('id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user'));
|
||||
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', get_string('singleview', 'grades', $fullname)));
|
||||
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php', array('userid' => $user->id, 'id' => $this->course->id));
|
||||
$userreportcell->text = $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser)) . $singleview;
|
||||
$userreportcell->text .= $singleview;
|
||||
}
|
||||
|
||||
if ($userreportcell->text) {
|
||||
$userrow->cells[] = $userreportcell;
|
||||
}
|
||||
|
||||
|
@ -808,7 +815,8 @@ class grade_report_grader extends grade_report {
|
|||
}
|
||||
|
||||
$singleview = '';
|
||||
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
|
||||
if (has_capability('gradereport/singleview:view', $this->context) &&
|
||||
preg_match('/^item/', $type)) {
|
||||
$url = new moodle_url('/grade/report/singleview/index.php', array(
|
||||
'id' => $this->course->id,
|
||||
'item' => 'grade',
|
||||
|
|
|
@ -215,9 +215,6 @@ abstract class gradereport_singleview_screen {
|
|||
$oldname = "old$name";
|
||||
|
||||
$posted = $data->$name;
|
||||
if (isset($data->$oldname)) {
|
||||
$oldvalue = $data->$oldname;
|
||||
}
|
||||
|
||||
$format = $element->determine_format();
|
||||
|
||||
|
@ -226,7 +223,7 @@ abstract class gradereport_singleview_screen {
|
|||
}
|
||||
|
||||
// Same value; skip.
|
||||
if ($oldvalue == $posted) {
|
||||
if (isset($data->$oldname) && $data->$oldname == $posted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ class gradereport_singleview_bulk_insert_ui extends gradereport_singleview_ui_el
|
|||
$select = html_writer::select(
|
||||
$insertoptions, $this->selectname, 'blanks', false
|
||||
);
|
||||
|
||||
|
||||
$label = html_writer::tag('label', $insertappliesto);
|
||||
$text = new gradereport_singleview_text_attribute($this->insertname, "0", 'bulk');
|
||||
return implode(' ', array($apply, $text->html(), $label, $select));
|
||||
|
|
|
@ -110,7 +110,7 @@ if ($data = data_submitted()) {
|
|||
}
|
||||
|
||||
$graderrightnav = $graderleftnav = null;
|
||||
if ($report->screen instanceof selectable_items
|
||||
if ($report->screen instanceof gradereport_selectable_items
|
||||
&& class_exists(gradereport_singleview::classname($report->screen->item_type()))) {
|
||||
|
||||
$optionkeys = array_keys($report->screen->options());
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for Single view
|
||||
* Strings for Single view
|
||||
*
|
||||
* @package gradereport_singleview
|
||||
* @copyright 2014 Moodle Pty Ltd (http://moodle.com)
|
||||
|
|
|
@ -57,13 +57,16 @@ class gradereport_singleview_grade extends gradereport_singleview_tablelike
|
|||
}
|
||||
|
||||
public function options() {
|
||||
return array_map(function($user) {
|
||||
$options = array_map(function($user) {
|
||||
if (!empty($user->alternatename)) {
|
||||
return $user->alternatename . ' (' . $user->firstname . ') ' . $user->lastname;
|
||||
} else {
|
||||
return fullname($user);
|
||||
}
|
||||
}, $this->items);
|
||||
|
||||
$options['name']= 'foo';
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function item_type() {
|
||||
|
|
|
@ -27,9 +27,11 @@ class gradereport_singleview_select extends gradereport_singleview_screen {
|
|||
public function init($selfitemisempty = false) {
|
||||
global $DB;
|
||||
|
||||
$roleids = explode(',', get_config('moodle', 'gradebookroles'));
|
||||
|
||||
$this->items = get_role_users(
|
||||
'', $this->context, false, '',
|
||||
'u.lastname, u.firstname', null, $this->groupid,
|
||||
$roleids, $this->context, false, '',
|
||||
'u.id, u.lastname, u.firstname', null, $this->groupid,
|
||||
$this->perpage * $this->page, $this->perpage
|
||||
);
|
||||
$this->item = $DB->get_record('course', array('id' => $this->courseid));
|
||||
|
|
|
@ -32,16 +32,16 @@ Feature: We can use Single view
|
|||
| assign | C1 | a2 | Test assignment two | Submit something! | 100 |
|
||||
| assign | C1 | a3 | Test assignment three | Submit something! | 150 |
|
||||
| assign | C1 | a4 | Test assignment four | Submit nothing! | 150 |
|
||||
Then I log in as "teacher1"
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Grades"
|
||||
|
||||
@javascript
|
||||
@javascript
|
||||
Scenario: I can update grades, add feedback and exclude grades.
|
||||
Given I click on "Single view" "option"
|
||||
Then I click on "studentawesemo (Student) 4" "option"
|
||||
And I click on "studentawesemo (Student) 4" "option"
|
||||
And I click on "Override for Test assignment one" "checkbox"
|
||||
And I set the following fields to these values:
|
||||
When I set the following fields to these values:
|
||||
| Grade for Test assignment one | 10.00 |
|
||||
| Feedback for Test assignment one | test data |
|
||||
And I click on "Exclude for Test assignment four" "checkbox"
|
||||
|
@ -49,7 +49,7 @@ Feature: We can use Single view
|
|||
Then the following should exist in the "user-grades" table:
|
||||
| Test assignment four |
|
||||
| excluded |
|
||||
Then the following should exist in the "user-grades" table:
|
||||
And the following should exist in the "user-grades" table:
|
||||
| Test assignment one |
|
||||
| 10.00 |
|
||||
And I click on "Single view for Test assignment three" "link"
|
||||
|
@ -59,12 +59,11 @@ Feature: We can use Single view
|
|||
| Feedback for studentbro (Student) 1 | test data2 |
|
||||
And I click on "Exclude for studentjo (Student) 2" "checkbox"
|
||||
And I press "Update"
|
||||
Then the following should exist in the "user-grades" table:
|
||||
And the following should exist in the "user-grades" table:
|
||||
| Test assignment three |
|
||||
| 12.05 |
|
||||
| Excluded |
|
||||
|
||||
@javascript
|
||||
Scenario: Single view quick links work on grade report.
|
||||
Given I follow "Single view for Test assignment one"
|
||||
Then I should see "Test assignment one"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue