|
40 | 40 |
|
41 | 41 | $owner = $questionnaire->is_survey_owner(); |
42 | 42 | if ($questionnaire->capabilities->manage && $owner) { |
43 | | - $row[] = new tabobject('settings', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/qsettings.php?'. |
44 | | - 'id='.$questionnaire->cm->id), get_string('advancedsettings')); |
| 43 | + $row[] = new tabobject( |
| 44 | + 'settings', |
| 45 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/qsettings.php?' . 'id=' . $questionnaire->cm->id), |
| 46 | + get_string('advancedsettings') |
| 47 | + ); |
45 | 48 | } |
46 | 49 |
|
47 | 50 | if ($questionnaire->capabilities->editquestions && $owner) { |
48 | | - $row[] = new tabobject('questions', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/questions.php?'. |
49 | | - 'id='.$questionnaire->cm->id), get_string('questions', 'questionnaire')); |
| 51 | + $row[] = new tabobject( |
| 52 | + 'questions', |
| 53 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/questions.php?' . 'id=' . $questionnaire->cm->id), |
| 54 | + get_string('questions', 'questionnaire') |
| 55 | + ); |
50 | 56 | } |
51 | 57 |
|
52 | 58 | if ($questionnaire->capabilities->editquestions && $owner) { |
53 | | - $row[] = new tabobject('feedback', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/feedback.php?'. |
54 | | - 'id='.$questionnaire->cm->id), get_string('feedback')); |
| 59 | + $row[] = new tabobject( |
| 60 | + 'feedback', |
| 61 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/feedback.php?' . 'id=' . $questionnaire->cm->id), |
| 62 | + get_string('feedback') |
| 63 | + ); |
55 | 64 | } |
56 | 65 |
|
57 | 66 | if ($questionnaire->capabilities->preview && $owner) { |
58 | 67 | if (!empty($questionnaire->questions)) { |
59 | | - $row[] = new tabobject('preview', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/preview.php?'. |
60 | | - 'id='.$questionnaire->cm->id), get_string('preview_label', 'questionnaire')); |
| 68 | + $row[] = new tabobject( |
| 69 | + 'preview', |
| 70 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/preview.php?' . 'id=' . $questionnaire->cm->id), |
| 71 | + get_string('preview_label', 'questionnaire') |
| 72 | + ); |
61 | 73 | } |
62 | 74 | } |
63 | 75 |
|
64 | 76 | $usernumresp = $questionnaire->count_submissions($USER->id); |
65 | 77 |
|
66 | 78 | if ($questionnaire->capabilities->readownresponses && ($usernumresp > 0)) { |
67 | | - $argstr = 'instance='.$questionnaire->id.'&user='.$USER->id.'&group='.$currentgroupid; |
| 79 | + $argstr = 'instance=' . $questionnaire->id . '&user=' . $USER->id . '&group=' . $currentgroupid; |
68 | 80 | if ($usernumresp == 1) { |
69 | 81 | $argstr .= '&byresponse=1&action=vresp'; |
70 | 82 | $yourrespstring = get_string('yourresponse', 'questionnaire'); |
71 | 83 | } else { |
72 | 84 | $yourrespstring = get_string('yourresponses', 'questionnaire'); |
73 | 85 | } |
74 | | - $row[] = new tabobject('myreport', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/myreport.php?'. |
75 | | - $argstr), $yourrespstring); |
| 86 | + $row[] = new tabobject( |
| 87 | + 'myreport', |
| 88 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/myreport.php?'. $argstr), |
| 89 | + $yourrespstring |
| 90 | + ); |
76 | 91 |
|
77 | 92 | if ($usernumresp > 1 && in_array($currenttab, array('mysummary', 'mybyresponse', 'myvall', 'mydownloadcsv'))) { |
78 | 93 | $inactive[] = 'myreport'; |
79 | 94 | $activated[] = 'myreport'; |
80 | 95 | $row2 = array(); |
81 | | - $argstr2 = $argstr.'&action=summary'; |
82 | | - $row2[] = new tabobject('mysummary', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/myreport.php?'.$argstr2), |
83 | | - get_string('summary', 'questionnaire')); |
84 | | - $argstr2 = $argstr.'&byresponse=1&action=vresp'; |
85 | | - $row2[] = new tabobject('mybyresponse', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/myreport.php?'.$argstr2), |
86 | | - get_string('viewindividualresponse', 'questionnaire')); |
87 | | - $argstr2 = $argstr.'&byresponse=0&action=vall&group='.$currentgroupid; |
88 | | - $row2[] = new tabobject('myvall', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/myreport.php?'.$argstr2), |
89 | | - get_string('myresponses', 'questionnaire')); |
| 96 | + $argstr2 = $argstr . '&action=summary'; |
| 97 | + $row2[] = new tabobject( |
| 98 | + 'mysummary', |
| 99 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/myreport.php?' . $argstr2), |
| 100 | + get_string('summary', 'questionnaire') |
| 101 | + ); |
| 102 | + $argstr2 = $argstr . '&byresponse=1&action=vresp'; |
| 103 | + $row2[] = new tabobject( |
| 104 | + 'mybyresponse', |
| 105 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/myreport.php?' . $argstr2), |
| 106 | + get_string('viewindividualresponse', 'questionnaire') |
| 107 | + ); |
| 108 | + $argstr2 = $argstr . '&byresponse=0&action=vall&group=' . $currentgroupid; |
| 109 | + $row2[] = new tabobject( |
| 110 | + 'myvall', |
| 111 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/myreport.php?' . $argstr2), |
| 112 | + get_string('myresponses', 'questionnaire') |
| 113 | + ); |
90 | 114 | if ($questionnaire->capabilities->downloadresponses) { |
91 | | - $argstr2 = $argstr.'&action=dwnpg'; |
92 | | - $link = $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2); |
| 115 | + $argstr2 = $argstr . '&action=dwnpg'; |
| 116 | + $link = $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2); |
93 | 117 | $row2[] = new tabobject('mydownloadcsv', $link, get_string('downloadtextformat', 'questionnaire')); |
94 | 118 | } |
95 | 119 | } else if (in_array($currenttab, array('mybyresponse', 'mysummary'))) { |
|
118 | 142 | $resplogic = ($numresp > 0) && ($numselectedresps > 0); |
119 | 143 |
|
120 | 144 | if ($questionnaire->can_view_all_responses_anytime($grouplogic, $resplogic)) { |
121 | | - $argstr = 'instance='.$questionnaire->id; |
122 | | - $row[] = new tabobject('allreport', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'. |
123 | | - $argstr.'&action=vall'), get_string('viewallresponses', 'questionnaire')); |
124 | | - if (in_array($currenttab, array('vall', 'vresp', 'valldefault', 'vallasort', 'vallarsort', 'deleteall', 'downloadcsv', |
125 | | - 'vrespsummary', 'individualresp', 'printresp', 'deleteresp'))) { |
| 145 | + $argstr = 'instance=' . $questionnaire->id; |
| 146 | + $row[] = new tabobject( |
| 147 | + 'allreport', |
| 148 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?'. $argstr . '&action=vall'), |
| 149 | + get_string('viewallresponses', 'questionnaire') |
| 150 | + ); |
| 151 | + if (in_array( |
| 152 | + $currenttab, |
| 153 | + array('vall', 'vresp', 'valldefault', 'vallasort', 'vallarsort', 'deleteall', 'downloadcsv', |
| 154 | + 'vrespsummary', 'individualresp', 'printresp', 'deleteresp') |
| 155 | + ) |
| 156 | + ) { |
126 | 157 | $inactive[] = 'allreport'; |
127 | 158 | $activated[] = 'allreport'; |
128 | 159 | if ($currenttab == 'vrespsummary' || $currenttab == 'valldefault') { |
129 | 160 | $inactive[] = 'vresp'; |
130 | 161 | } |
131 | 162 | $row2 = array(); |
132 | | - $argstr2 = $argstr.'&action=vall&group='.$currentgroupid; |
133 | | - $row2[] = new tabobject('vall', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
134 | | - get_string('summary', 'questionnaire')); |
| 163 | + $argstr2 = $argstr . '&action=vall&group=' . $currentgroupid; |
| 164 | + $row2[] = new tabobject( |
| 165 | + 'vall', |
| 166 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 167 | + get_string('summary', 'questionnaire') |
| 168 | + ); |
135 | 169 | if ($questionnaire->capabilities->viewsingleresponse) { |
136 | | - $argstr2 = $argstr.'&byresponse=1&action=vresp&group='.$currentgroupid; |
137 | | - $row2[] = new tabobject('vrespsummary', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
138 | | - get_string('viewbyresponse', 'questionnaire')); |
| 170 | + $argstr2 = $argstr . '&byresponse=1&action=vresp&group=' . $currentgroupid; |
| 171 | + $row2[] = new tabobject( |
| 172 | + 'vrespsummary', |
| 173 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 174 | + get_string('viewbyresponse', 'questionnaire') |
| 175 | + ); |
139 | 176 | if ($currenttab == 'individualresp' || $currenttab == 'deleteresp') { |
140 | | - $argstr2 = $argstr.'&byresponse=1&action=vresp'; |
141 | | - $row2[] = new tabobject('vresp', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
142 | | - get_string('viewindividualresponse', 'questionnaire')); |
| 177 | + $argstr2 = $argstr . '&byresponse=1&action=vresp'; |
| 178 | + $row2[] = new tabobject( |
| 179 | + 'vresp', |
| 180 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 181 | + get_string('viewindividualresponse', 'questionnaire') |
| 182 | + ); |
143 | 183 | } |
144 | 184 | } |
145 | 185 | } |
146 | 186 | if (in_array($currenttab, array('valldefault', 'vallasort', 'vallarsort', 'deleteall', 'downloadcsv'))) { |
147 | 187 | $activated[] = 'vall'; |
148 | 188 | $row3 = array(); |
149 | 189 |
|
150 | | - $argstr2 = $argstr.'&action=vall&group='.$currentgroupid; |
151 | | - $row3[] = new tabobject('valldefault', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
152 | | - get_string('order_default', 'questionnaire')); |
| 190 | + $argstr2 = $argstr . '&action=vall&group=' . $currentgroupid; |
| 191 | + $row3[] = new tabobject( |
| 192 | + 'valldefault', |
| 193 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 194 | + get_string('order_default', 'questionnaire') |
| 195 | + ); |
153 | 196 | if ($currenttab != 'downloadcsv' && $currenttab != 'deleteall') { |
154 | | - $argstr2 = $argstr.'&action=vallasort&group='.$currentgroupid; |
155 | | - $row3[] = new tabobject('vallasort', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
156 | | - get_string('order_ascending', 'questionnaire')); |
157 | | - $argstr2 = $argstr.'&action=vallarsort&group='.$currentgroupid; |
158 | | - $row3[] = new tabobject('vallarsort', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
159 | | - get_string('order_descending', 'questionnaire')); |
| 197 | + $argstr2 = $argstr . '&action=vallasort&group=' . $currentgroupid; |
| 198 | + $row3[] = new tabobject( |
| 199 | + 'vallasort', |
| 200 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 201 | + get_string('order_ascending', 'questionnaire') |
| 202 | + ); |
| 203 | + $argstr2 = $argstr . '&action=vallarsort&group=' . $currentgroupid; |
| 204 | + $row3[] = new tabobject( |
| 205 | + 'vallarsort', |
| 206 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 207 | + get_string('order_descending', 'questionnaire') |
| 208 | + ); |
160 | 209 | } |
161 | 210 | if ($questionnaire->capabilities->deleteresponses) { |
162 | | - $argstr2 = $argstr.'&action=delallresp&group='.$currentgroupid; |
163 | | - $row3[] = new tabobject('deleteall', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
164 | | - get_string('deleteallresponses', 'questionnaire')); |
| 211 | + $argstr2 = $argstr . '&action=delallresp&group=' . $currentgroupid; |
| 212 | + $row3[] = new tabobject( |
| 213 | + 'deleteall', |
| 214 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 215 | + get_string('deleteallresponses', 'questionnaire') |
| 216 | + ); |
165 | 217 | } |
166 | 218 |
|
167 | 219 | if ($questionnaire->capabilities->downloadresponses) { |
168 | | - $argstr2 = $argstr.'&action=dwnpg&group='.$currentgroupid; |
169 | | - $link = $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2); |
| 220 | + $argstr2 = $argstr . '&action=dwnpg&group=' . $currentgroupid; |
| 221 | + $link = $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2); |
170 | 222 | $row3[] = new tabobject('downloadcsv', $link, get_string('downloadtextformat', 'questionnaire')); |
171 | 223 | } |
172 | 224 | } |
|
177 | 229 | $activated[] = 'vresp'; |
178 | 230 | } |
179 | 231 | if ($questionnaire->capabilities->deleteresponses) { |
180 | | - $argstr2 = $argstr.'&action=dresp&rid='.$rid.'&individualresponse=1'; |
181 | | - $row2[] = new tabobject('deleteresp', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
182 | | - get_string('deleteresp', 'questionnaire')); |
| 232 | + $argstr2 = $argstr . '&action=dresp&rid=' . $rid . '&individualresponse=1'; |
| 233 | + $row2[] = new tabobject( |
| 234 | + 'deleteresp', |
| 235 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 236 | + get_string('deleteresp', 'questionnaire') |
| 237 | + ); |
183 | 238 | } |
184 | | - |
185 | 239 | } |
186 | 240 | } else if ($questionnaire->can_view_all_responses_with_restrictions($usernumresp, $grouplogic, $resplogic)) { |
187 | | - $argstr = 'instance='.$questionnaire->id.'&sid='.$questionnaire->sid; |
188 | | - $row[] = new tabobject('allreport', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'. |
189 | | - $argstr.'&action=vall&group='.$currentgroupid), get_string('viewallresponses', 'questionnaire')); |
| 241 | + $argstr = 'instance=' . $questionnaire->id . '&sid=' . $questionnaire->sid; |
| 242 | + $row[] = new tabobject( |
| 243 | + 'allreport', |
| 244 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr . '&action=vall&group=' . $currentgroupid), |
| 245 | + get_string('viewallresponses', 'questionnaire') |
| 246 | + ); |
190 | 247 | if (in_array($currenttab, array('valldefault', 'vallasort', 'vallarsort', 'deleteall', 'downloadcsv'))) { |
191 | 248 | $inactive[] = 'vall'; |
192 | 249 | $activated[] = 'vall'; |
193 | 250 | $row2 = array(); |
194 | | - $argstr2 = $argstr.'&action=vall&group='.$currentgroupid; |
195 | | - $row2[] = new tabobject('valldefault', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
196 | | - get_string('summary', 'questionnaire')); |
| 251 | + $argstr2 = $argstr . '&action=vall&group=' . $currentgroupid; |
| 252 | + $row2[] = new tabobject( |
| 253 | + 'valldefault', |
| 254 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 255 | + get_string('summary', 'questionnaire') |
| 256 | + ); |
197 | 257 | $inactive[] = $currenttab; |
198 | 258 | $activated[] = $currenttab; |
199 | 259 | $row3 = array(); |
200 | | - $argstr2 = $argstr.'&action=vall&group='.$currentgroupid; |
201 | | - $row3[] = new tabobject('valldefault', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
202 | | - get_string('order_default', 'questionnaire')); |
203 | | - $argstr2 = $argstr.'&action=vallasort&group='.$currentgroupid; |
204 | | - $row3[] = new tabobject('vallasort', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
205 | | - get_string('order_ascending', 'questionnaire')); |
206 | | - $argstr2 = $argstr.'&action=vallarsort&group='.$currentgroupid; |
207 | | - $row3[] = new tabobject('vallarsort', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
208 | | - get_string('order_descending', 'questionnaire')); |
| 260 | + $argstr2 = $argstr . '&action=vall&group=' . $currentgroupid; |
| 261 | + $row3[] = new tabobject( |
| 262 | + 'valldefault', |
| 263 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 264 | + get_string('order_default', 'questionnaire') |
| 265 | + ; |
| 266 | + $argstr2 = $argstr . '&action=vallasort&group=' . $currentgroupid; |
| 267 | + $row3[] = new tabobject( |
| 268 | + 'vallasort', |
| 269 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 270 | + get_string('order_ascending', 'questionnaire') |
| 271 | + ); |
| 272 | + $argstr2 = $argstr . '&action=vallarsort&group=' . $currentgroupid; |
| 273 | + $row3[] = new tabobject( |
| 274 | + 'vallarsort', |
| 275 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 276 | + get_string('order_descending', 'questionnaire') |
| 277 | + ); |
209 | 278 | if ($questionnaire->capabilities->deleteresponses) { |
210 | | - $argstr2 = $argstr.'&action=delallresp'; |
211 | | - $row2[] = new tabobject('deleteall', $CFG->wwwroot.htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2), |
212 | | - get_string('deleteallresponses', 'questionnaire')); |
| 279 | + $argstr2 = $argstr . '&action=delallresp'; |
| 280 | + $row2[] = new tabobject( |
| 281 | + 'deleteall', |
| 282 | + $CFG->wwwroot . htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2), |
| 283 | + get_string('deleteallresponses', 'questionnaire') |
| 284 | + ); |
213 | 285 | } |
214 | 286 |
|
215 | 287 | if ($questionnaire->capabilities->downloadresponses) { |
216 | | - $argstr2 = $argstr.'&action=dwnpg'; |
217 | | - $link = htmlspecialchars('/mod/questionnaire/report.php?'.$argstr2); |
| 288 | + $argstr2 = $argstr . '&action=dwnpg'; |
| 289 | + $link = htmlspecialchars('/mod/questionnaire/report.php?' . $argstr2); |
218 | 290 | $row2[] = new tabobject('downloadcsv', $link, get_string('downloadtextformat', 'questionnaire')); |
219 | 291 | } |
220 | 292 | if (count($row2) <= 1) { |
|
224 | 296 | } |
225 | 297 |
|
226 | 298 | if ($questionnaire->capabilities->viewsingleresponse && ($canviewallgroups || $canviewgroups)) { |
227 | | - $nonrespondenturl = new moodle_url('/mod/questionnaire/show_nonrespondents.php', array('id' => $questionnaire->cm->id)); |
228 | | - $row[] = new tabobject('nonrespondents', |
229 | | - $nonrespondenturl->out(), |
230 | | - get_string('show_nonrespondents', 'questionnaire')); |
| 299 | + $nonrespondenturl = new moodle_url('/mod/questionnaire/show_nonrespondents.php', ['id' => $questionnaire->cm->id]); |
| 300 | + $row[] = new tabobject( |
| 301 | + 'nonrespondents', |
| 302 | + $nonrespondenturl->out(), |
| 303 | + get_string('show_nonrespondents', 'questionnaire') |
| 304 | + ); |
231 | 305 | } |
232 | 306 |
|
233 | 307 | if ((count($row) > 1) || (!empty($row2) && (count($row2) > 1))) { |
|
0 commit comments