Línea 15... |
Línea 15... |
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
Línea 16... |
Línea 16... |
16 |
|
16 |
|
Línea 17... |
Línea 17... |
17 |
namespace gradereport_grader\output;
|
17 |
namespace gradereport_grader\output;
|
- |
|
18 |
|
- |
|
19 |
use core\output\comboboxsearch;
|
- |
|
20 |
use core_course\output\actionbar\group_selector;
|
18 |
|
21 |
use core_course\output\actionbar\initials_selector;
|
19 |
use core\output\comboboxsearch;
|
22 |
use core_course\output\actionbar\user_selector;
|
Línea 20... |
Línea 23... |
20 |
use core_grades\output\general_action_bar;
|
23 |
use core_grades\output\general_action_bar;
|
21 |
use moodle_url;
|
24 |
use moodle_url;
|
Línea 67... |
Línea 70... |
67 |
* @param \renderer_base $output renderer to be used to render the action bar elements.
|
70 |
* @param \renderer_base $output renderer to be used to render the action bar elements.
|
68 |
* @return array
|
71 |
* @return array
|
69 |
* @throws \moodle_exception
|
72 |
* @throws \moodle_exception
|
70 |
*/
|
73 |
*/
|
71 |
public function export_for_template(\renderer_base $output): array {
|
74 |
public function export_for_template(\renderer_base $output): array {
|
72 |
global $PAGE, $OUTPUT, $SESSION, $USER;
|
75 |
global $SESSION, $USER;
|
73 |
// If in the course context, we should display the general navigation selector in gradebook.
|
76 |
// If in the course context, we should display the general navigation selector in gradebook.
|
74 |
$courseid = $this->context->instanceid;
|
77 |
$courseid = $this->context->instanceid;
|
75 |
// Get the data used to output the general navigation selector.
|
78 |
// Get the data used to output the general navigation selector.
|
76 |
$generalnavselector = new general_action_bar($this->context,
|
79 |
$generalnavselector = new general_action_bar($this->context,
|
77 |
new moodle_url('/grade/report/grader/index.php', ['id' => $courseid]), 'gradereport', 'grader');
|
80 |
new moodle_url('/grade/report/grader/index.php', ['id' => $courseid]), 'gradereport', 'grader');
|
Línea 80... |
Línea 83... |
80 |
|
83 |
|
81 |
// If the user has the capability to view all grades, display the group selector (if applicable), the user selector
|
84 |
// If the user has the capability to view all grades, display the group selector (if applicable), the user selector
|
82 |
// and the view mode selector (if applicable).
|
85 |
// and the view mode selector (if applicable).
|
83 |
if (has_capability('moodle/grade:viewall', $this->context)) {
|
86 |
if (has_capability('moodle/grade:viewall', $this->context)) {
|
84 |
$course = get_course($courseid);
|
- |
|
85 |
$gradesrenderer = $PAGE->get_renderer('core_grades');
|
- |
|
86 |
|
- |
|
87 |
$initialscontent = $gradesrenderer->initials_selector(
|
- |
|
88 |
$course,
|
- |
|
89 |
$this->context,
|
- |
|
90 |
'/grade/report/grader/index.php'
|
- |
|
Línea 91... |
Línea 87... |
91 |
);
|
87 |
$course = get_course($courseid);
|
92 |
|
88 |
|
- |
|
89 |
$firstnameinitial = $SESSION->gradereport["filterfirstname-{$this->context->id}"] ?? '';
|
Línea 93... |
Línea -... |
93 |
$firstnameinitial = $SESSION->gradereport["filterfirstname-{$this->context->id}"] ?? '';
|
- |
|
94 |
$lastnameinitial = $SESSION->gradereport["filtersurname-{$this->context->id}"] ?? '';
|
- |
|
95 |
|
90 |
$lastnameinitial = $SESSION->gradereport["filtersurname-{$this->context->id}"] ?? '';
|
96 |
$initialselector = new comboboxsearch(
|
91 |
$additionalparams = [];
|
97 |
false,
|
92 |
|
98 |
$initialscontent->buttoncontent,
|
- |
|
99 |
$initialscontent->dropdowncontent,
|
- |
|
100 |
'initials-selector',
|
93 |
if ($this->userid > 0) {
|
101 |
'initialswidget',
|
94 |
$additionalparams['gpr_userid'] = $this->userid;
|
- |
|
95 |
} else if (!empty($this->usersearch)) {
|
102 |
'initialsdropdown',
|
96 |
$additionalparams['gpr_search'] = $this->usersearch;
|
103 |
$initialscontent->buttonheader,
|
97 |
}
|
104 |
true,
|
98 |
|
105 |
get_string('filterbyname', 'core_grades'),
|
99 |
$initialselector = new initials_selector(
|
106 |
'nameinitials',
|
100 |
course: $course,
|
107 |
json_encode([
|
101 |
targeturl: '/grade/report/grader/index.php',
|
108 |
'first' => $firstnameinitial,
|
102 |
firstinitial: $firstnameinitial,
|
109 |
'last' => $lastnameinitial,
|
103 |
lastinitial: $lastnameinitial,
|
- |
|
104 |
additionalparams: $additionalparams,
|
- |
|
105 |
);
|
- |
|
106 |
$data['initialselector'] = $initialselector->export_for_template($output);
|
110 |
])
|
107 |
|
- |
|
108 |
if ($course->groupmode) {
|
Línea 111... |
Línea 109... |
111 |
);
|
109 |
$gs = new group_selector($this->context);
|
112 |
$data['initialselector'] = $initialselector->export_for_template($output);
|
- |
|
113 |
$data['groupselector'] = $gradesrenderer->group_selector($course);
|
110 |
$data['groupselector'] = $gs->export_for_template($output);
|
114 |
|
111 |
}
|
115 |
$resetlink = new moodle_url('/grade/report/grader/index.php', ['id' => $courseid]);
|
- |
|
116 |
$searchinput = $OUTPUT->render_from_template('core_user/comboboxsearch/user_selector', [
|
112 |
|
117 |
'currentvalue' => $this->usersearch,
|
- |
|
118 |
'courseid' => $courseid,
|
- |
|
119 |
'instance' => rand(),
|
- |
|
120 |
'resetlink' => $resetlink->out(false),
|
113 |
$resetlink = new moodle_url('/grade/report/grader/index.php', ['id' => $courseid]);
|
121 |
'group' => 0,
|
- |
|
122 |
'name' => 'usersearch',
|
- |
|
123 |
'value' => json_encode([
|
- |
|
124 |
'userid' => $this->userid,
|
- |
|
125 |
'search' => $this->usersearch,
|
114 |
$userselector = new user_selector(
|
126 |
]),
|
- |
|
127 |
]);
|
- |
|
128 |
$searchdropdown = new comboboxsearch(
|
115 |
course: $course,
|
129 |
true,
|
- |
|
130 |
$searchinput,
|
- |
|
131 |
null,
|
- |
|
132 |
'user-search d-flex',
|
- |
|
133 |
null,
|
116 |
resetlink: $resetlink,
|
134 |
'usersearchdropdown overflow-auto',
|
117 |
userid: $this->userid,
|
135 |
null,
|
- |
|
136 |
false,
|
118 |
groupid: 0,
|
137 |
);
|
119 |
usersearch: $this->usersearch
|
Línea 138... |
Línea 120... |
138 |
$data['searchdropdown'] = $searchdropdown->export_for_template($output);
|
120 |
);
|
139 |
|
121 |
$data['searchdropdown'] = $userselector->export_for_template($output);
|
140 |
// The collapsed column dialog is aligned to the edge of the screen, we need to place it such that it also aligns.
|
122 |
// The collapsed column dialog is aligned to the edge of the screen, we need to place it such that it also aligns.
|
141 |
$collapsemenudirection = right_to_left() ? 'dropdown-menu-left' : 'dropdown-menu-right';
|
123 |
$collapsemenudirection = right_to_left() ? 'dropdown-menu-start' : 'dropdown-menu-end';
|