165 : bool {
166 switch ($cmd) {
168 $protect_by_write_protection();
169
170 if ($this->is_in_test_with_random_question_set || $this->is_in_test_with_results) {
171 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'questionlist_cannot_be_altered'));
172 return true;
173 }
174
175 $data = $get_table()->getTableComponent()->getData();
176 $this->test_obj->setQuestionOrder(array_flip(
$data), []);
177 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
178 return true;
179
182 current($row_ids),
183 \ilAssQuestionPreviewGUI::class,
185 );
186 return false;
187
190 current($row_ids),
191 \ilTestCorrectionsGUI::class,
192 'showQuestion'
193 );
194 return false;
195
198 current($row_ids),
199 \ilAssQuestionPreviewGUI::class,
201 );
202 return false;
203
205 $question_id = current($row_ids);
206 $qtype = $this->test_obj->getQuestionType($question_id);
207 $target_class = $qtype . 'GUI';
209 $question_id,
210 $target_class,
211 'editQuestion'
212 );
213 return false;
214
217 current($row_ids),
218 \ilAssQuestionPageGUI::class,
219 'edit'
220 );
221 return false;
222
225 current($row_ids),
226 \ilAssQuestionFeedbackEditingGUI::class,
228 );
229 return false;
230
232 $this->test_response->sendAsync(
233 $this->ui_renderer->renderAsync(
234 $this->getDeleteConfirmation(array_filter($row_ids))
235 )
236 );
237 return false;
238
240 $row_ids = $this->request->getParsedBody()['interruptive_items'] ?? [];
241 if (array_filter($row_ids) === []) {
242
243 return true;
244 }
245
246 if ($this->is_in_test_with_random_question_set
247 || $this->is_in_test_with_results
248 && !$this->is_adjusting_questions_with_results_allowed) {
249 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'questionlist_cannot_be_altered'));
250 return true;
251 }
252
253 $protect_by_write_protection();
254 if ($this->is_in_test_with_results) {
255 $this->test_obj->removeQuestionsWithResults($row_ids);
256 } else {
257 $this->test_obj->removeQuestions($row_ids);
258 $this->test_obj->saveCompleteStatus($this->test_question_set_config_factory->getQuestionSetConfig());
259 }
260 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_questions_removed'),
true);
261 return true;
262
264 if (array_filter($row_ids) === []) {
265 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_questions_selected'));
266 return true;
267 }
268
269 if ($this->is_in_test_with_random_question_set || $this->is_in_test_with_results) {
270 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'questionlist_cannot_be_altered'));
271 return true;
272 }
273
274 $protect_by_write_protection();
275 $this->test_obj->copyQuestions($row_ids);
276 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'copy_questions_success'),
true);
277 $this->
ctrl->redirectByClass(\ilObjTestGUI::class,
'showQuestions');
278 return true;
279
281 if (array_filter($row_ids) === []) {
282 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'tst_no_question_selected_for_moving_to_qpl'));
283 return true;
284 }
285 $protect_by_write_protection();
287 return true;
288 }
289 $copy_and_link_to_questionpool();
290 return false;
291
293 if (array_filter($row_ids) === []) {
294 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_questions_selected'));
295 return true;
296 }
297 $protect_by_write_protection();
298 $this->question_printer->printSelectedQuestions(
299 array_reduce(
300 Types::cases(),
301 function (array
$c,
Types $v): array {
302 $c[$v->getLabel($this->
lng)] = $this->table_query
303 ->getPrintViewTypeURL(self::ACTION_PRINT_QUESTIONS, $v->value)->__toString();
305 },
306 []
307 ),
308 Types::tryFrom($this->table_query->getPrintViewType()) ?? Types::RESULTS_VIEW_TYPE_SHOW,
309 $row_ids
310 );
311 return false;
312
314 $protect_by_write_protection();
315 $this->question_printer->printAnswers(current($row_ids));
316 return false;
317
319 $protect_by_write_protection();
322 $question_object->deliverFileUploadZIPFile(
323 $this->test_obj->getRefId(),
324 $this->test_obj->getTestId(),
325 $this->test_obj->getTitle()
326 );
327 }
328
329
330 default:
331 throw new \InvalidArgumentException("No such table_cmd: '$cmd'.");
332 }
333 }
checkQuestionParametersForCopyToPool(array $question_ids)
const ACTION_DELETE_CONFIRMED
redirectWithQuestionParameters(int $question_id, string $target_class, string $cmd)
const ACTION_DOWNLOAD_FILE_QUESTION_ANSWERS
const ACTION_PRINT_ANSWERS
const ACTION_EDIT_QUESTION
const ACTION_PRINT_QUESTIONS
static instantiateQuestion(int $question_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...