Skip to content

Commit 7084517

Browse files
committed
Update renderer.php
1 parent 066327c commit 7084517

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

renderer.php

+22-6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ class mod_diary_renderer extends plugin_renderer_base {
3939
*/
4040
private $diary;
4141

42+
/**
43+
* Initialize internal objects.
44+
*
45+
* @var int $cm
46+
*/
47+
protected $cm;
48+
4249
/**
4350
* Return introduction box and content for the page generated by view.php file.
4451
*
@@ -66,8 +73,10 @@ public function introduction($diary, $cm) {
6673
public function toolbar($firstkey, $cm) {
6774
// 20201003 Changed toolbar code to $output instead of html_writer::alist.
6875
$options = [];
69-
$options['id'] = $cm->id;
76+
// 20250110 Changed this option for all tools used on the toolbar.
77+
$options['id'] = $cm['id'];
7078
$output = ' ';
79+
7180
// Print export to .csv file toolbutton.
7281
$options['action'] = 'download';
7382
$url = new moodle_url('/mod/diary/view.php', $options);
@@ -87,8 +96,11 @@ public function toolbar($firstkey, $cm) {
8796
);
8897

8998
// Print edit entry toolbutton.
99+
// 20250110 Changed option for firstkey.
100+
// 20250113 Added option to include promptid.
90101
$options['action'] = 'editentry';
91-
$options['firstkey'] = $firstkey;
102+
$options['firstkey'] = $cm['firstkey'];
103+
$options['promptid'] = $cm['promptid'];
92104
$url = new moodle_url('/mod/diary/edit.php', $options);
93105
$output .= html_writer::link($url, $this->pix_icon('i/edit', get_string('edittopoflist', 'diary')),
94106
[
@@ -97,8 +109,9 @@ public function toolbar($firstkey, $cm) {
97109
);
98110

99111
// Print sort to first entry toolbutton.
112+
// 20250110 Changed option for firstkey.
100113
$options['action'] = 'sortfirstentry';
101-
$options['firstkey'] = $firstkey;
114+
$options['firstkey'] = $cm['firstkey'];
102115
$url = new moodle_url('/mod/diary/view.php', $options);
103116
$output .= html_writer::link($url, $this->pix_icon('t/left', get_string('sortfirstentry', 'diary')),
104117
[
@@ -107,8 +120,9 @@ public function toolbar($firstkey, $cm) {
107120
);
108121

109122
// Print lowest grade entry toolbutton.
123+
// 20250110 Changed option for firstkey.
110124
$options['action'] = 'lowestgradeentry';
111-
$options['firstkey'] = $firstkey;
125+
$options['firstkey'] = $cm['firstkey'];
112126
$url = new moodle_url('/mod/diary/view.php', $options);
113127
$output .= html_writer::link($url, $this->pix_icon('t/down', get_string('lowestgradeentry', 'diary')),
114128
[
@@ -117,8 +131,9 @@ public function toolbar($firstkey, $cm) {
117131
);
118132

119133
// Print highest grade entry toolbutton.
134+
// 20250110 Changed option for firstkey.
120135
$options['action'] = 'highestgradeentry';
121-
$options['firstkey'] = $firstkey;
136+
$options['firstkey'] = $cm['firstkey'];
122137
$url = new moodle_url('/mod/diary/view.php', $options);
123138
$output .= html_writer::link($url, $this->pix_icon('t/up', get_string('highestgradeentry', 'diary')),
124139
[
@@ -127,8 +142,9 @@ public function toolbar($firstkey, $cm) {
127142
);
128143

129144
// Print latest modified entry toolbutton.
145+
// 20250110 Changed option for firstkey.
130146
$options['action'] = 'latestmodifiedentry';
131-
$options['firstkey'] = $firstkey;
147+
$options['firstkey'] = $cm['firstkey'];
132148
$url = new moodle_url('/mod/diary/view.php', $options);
133149
$output .= html_writer::link($url, $this->pix_icon('t/right', get_string('latestmodifiedentry', 'diary')),
134150
[

0 commit comments

Comments
 (0)