19 declare(strict_types=1);
49 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
51 $pos = array_search($this->testrequest->raw(
'q_id'), $questions);
54 $next = $questions[$pos + 1];
56 $next = $questions[0];
59 $this->
ctrl->setParameter($this,
'q_id', $next);
60 $link = $this->
ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
68 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
70 $pos = array_search($this->testrequest->raw(
'q_id'), $questions);
73 $next = $questions[$pos - 1];
75 $next = $questions[0];
78 $this->
ctrl->setParameter($this,
'q_id', $next);
79 $link = $this->
ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
87 $this->tree = $DIC[
'tree'];
88 $this->db = $DIC[
'ilDB'];
89 $this->component_repository = $DIC[
'component.repository'];
97 $next_class = $this->
ctrl->getNextClass($this);
98 $cmd = $this->
ctrl->getCmd();
100 switch ($next_class) {
101 case 'ilobjquestionpoolgui':
103 $nodeParts = explode(
':', $this->testrequest->raw(
'cmdNode'));
106 'ref_id' => $this->testrequest->getRefId(),
107 'calling_test' => $this->testrequest->getRefId(),
108 'q_id' => $this->testrequest->getQuestionId(),
109 'cmd' => $this->testrequest->raw(
'cmd'),
110 'cmdClass' => $this->testrequest->raw(
'cmdClass'),
111 'baseClass' =>
'ilObjQuestionPoolGUI',
112 'test_express_mode' =>
'1' 117 '?' . http_build_query($params, null,
'&'),
118 'cmdNode=' . ($nodeParts[count($nodeParts) - 2] .
':' . $nodeParts[count($nodeParts) - 1])
124 case 'ilpageeditorgui':
127 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
128 $this->
ctrl->redirect($this,
'preview');
133 $page_editor->setHeader($this->
getHeader());
134 $page_editor->setPageBackTitle($this->page_back_title);
135 $page_editor->setIntLinkReturn($this->int_link_return);
137 $this->
ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
139 $ret = $this->
ctrl->forwardCommand($page_editor);
141 $this->tpl->setContent($ret);
146 case 'iltestexpresspageobjectgui':
147 if ($cmd ==
'view') {
149 $this->
ctrl->setCmd($cmd);
154 if ($q_gui->object) {
160 'handleToolbarCommand',
164 'browseForQuestions',
165 'filterAvailableQuestions',
166 'resetfilterAvailableQuestions' 169 if (in_array($cmd, $cmds)) {
170 return $this->$cmd();
171 } elseif ($q_gui->object) {
172 $total = $this->test_object->evalTotalPersons();
177 $link =
$DIC->ui()->factory()->link()->standard(
178 $DIC->language()->txt(
'test_has_datasets_warning_page_view_link'),
179 $DIC->ctrl()->getLinkTargetByClass([
'ilTestResultsGUI',
'ilParticipantsTestResultsGUI'])
182 $message =
$DIC->language()->txt(
'test_has_datasets_warning_page_view');
184 $msgBox =
$DIC->ui()->factory()->messageBox()->info(
$message)->withLinks([
$link]);
186 $DIC->ui()->mainTemplate()->setCurrentBlock(
'mess');
187 $DIC->ui()->mainTemplate()->setVariable(
189 $DIC->ui()->renderer()->render($msgBox)
191 $DIC->ui()->mainTemplate()->parseCurrentBlock();
194 if ((in_array($cmd, [
'view',
'showPage']) || $cmd ==
'edit') && $this->test_object->evalTotalPersons()) {
198 return parent::executeCommand();
206 if (!$this->testrequest->raw(
'q_id')) {
207 $q_gui = $this->
addPageOfQuestions(preg_replace(
'/(.*?)gui/i',
'$1', $this->testrequest->raw(
'sel_question_types')));
208 $q_gui->setQuestionTabs();
210 $this->
ctrl->forwardCommand($q_gui);
214 $this->
ctrl->setReturn($this,
'questions');
217 if ($q_gui->object) {
222 $this->
ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_id');
223 $this->
ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
225 $q_gui->setQuestionTabs();
226 $this->
ctrl->forwardCommand($q_gui);
235 $qtype = $this->testrequest->raw(
'qtype');
240 $this->
ctrl->setReturn($this,
'questions');
253 if ($this->testrequest->raw(
'qtype')) {
255 } elseif ($this->testrequest->raw(
'sel_question_types')) {
256 $questionType = $this->testrequest->raw(
'sel_question_types');
260 $addContEditMode = $this->testrequest->raw(
'add_quest_cont_edit_mode');
268 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
270 $q_gui->object->createNewQuestion();
272 $previousQuestionId = $this->testrequest->raw(
'position');
274 switch ($this->testrequest->raw(
'usage')) {
277 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'sel_qpl', $this->testrequest->raw(
'sel_qpl'));
278 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
279 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
280 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
282 if ($this->testrequest->raw(
'test_express_mode')) {
283 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
286 if ($this->testrequest->isset(
'add_quest_cont_edit_mode')) {
287 $this->
ctrl->setParameterByClass(
289 'add_quest_cont_edit_mode',
290 $this->testrequest->raw(
'add_quest_cont_edit_mode')
294 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'usage', 3);
295 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
297 $link = $this->
ctrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
305 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'txt_qpl', $this->testrequest->raw(
'txt_qpl'));
306 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
307 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
308 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
310 if ($this->testrequest->raw(
'test_express_mode')) {
311 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
314 if ($this->testrequest->isset(
'add_quest_cont_edit_mode')) {
315 $this->
ctrl->setParameterByClass(
317 'add_quest_cont_edit_mode',
318 $this->testrequest->raw(
'add_quest_cont_edit_mode')
322 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'usage', 2);
323 $this->
ctrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
325 $link = $this->
ctrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
341 $subScreenId = [
'createQuestion'];
343 $this->
ctrl->setParameter($this,
'qtype', $this->testrequest->raw(
'qtype'));
347 $this->
ctrl->setParameter($this,
'test_express_mode', 1);
353 $questionTypes = $pool->getQuestionTypes(
false,
true,
false);
357 foreach ($questionTypes as $label =>
$data) {
358 $options[
$data[
'question_type_id']] = $label;
366 $questions = $this->test_object->getQuestionTitlesAndIndexes();
369 $options = [
'0' => $this->
lng->txt(
'first')];
370 foreach ($questions as
$key => $title) {
371 $options[
$key] = $this->
lng->txt(
'behind') .
' ' . $title .
' [' . $this->
lng->txt(
'question_id_short') .
': ' .
$key .
']';
373 $si->setOptions($options);
374 $si->setValue($this->testrequest->raw(
'q_id'));
380 $subScreenId[] =
'editMode';
385 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
388 $option_ipe->
setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info'));
389 $ri->addOption($option_ipe);
392 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE'),
395 $option_rte->
setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE_info'));
396 $ri->addOption($option_rte);
407 $subScreenId[] =
'poolSelect';
413 $usage->addOption($no_pool);
414 $existing_pool =
new ilRadioOption($this->
lng->txt(
'assessment_existing_pool'),
'3');
415 $usage->addOption($existing_pool);
417 $usage->addOption($new_pool);
424 foreach ($questionpools as
$key => $p) {
425 $pools_data[
$key] = $p[
'title'];
429 $existing_pool->addSubItem($pools);
433 $name->setMaxLength(50);
434 $new_pool->addSubItem($name);
439 $this->
help->setSubScreenId(implode(
'_', $subScreenId));
446 $this->
ctrl->saveParameterByClass(
'ilobjtestgui',
'q_id');
447 $this->
ctrl->redirectByClass(
'ilobjtestgui',
'showPage');
452 $cmdClass = $questionType .
'GUI';
454 $this->
ctrl->setParameterByClass($cmdClass,
'ref_id', $this->testrequest->getRefId());
455 $this->
ctrl->setParameterByClass($cmdClass,
'sel_question_types', $questionType);
456 $this->
ctrl->setParameterByClass($cmdClass,
'test_ref_id', $this->testrequest->getRefId());
457 $this->
ctrl->setParameterByClass($cmdClass,
'calling_test', $this->testrequest->getRefId());
458 $this->
ctrl->setParameterByClass($cmdClass,
'q_id', $qid);
459 $this->
ctrl->setParameterByClass($cmdClass,
'prev_qid', $prev_qid);
461 if ($this->testrequest->raw(
'test_express_mode')) {
462 $this->
ctrl->setParameterByClass($cmdClass,
'test_express_mode', 1);
465 $this->
ctrl->redirectByClass(
466 [
'ilRepositoryGUI',
'ilObjTestGUI', $questionType .
'GUI'],
473 $this->
ctrl->setParameterByClass(
'ilObjTestGUI',
'ref_id', $this->testrequest->getRefId());
474 $this->
ctrl->setParameterByClass(
'ilObjTestGUI',
'q_id', $qid);
475 $this->
ctrl->setParameterByClass(
'ilObjTestGUI',
'sel_question_types', $questionType);
476 $this->
ctrl->setParameterByClass(
'ilObjTestGUI',
'prev_qid', $prev_qid);
477 $redir = $this->
ctrl->getLinkTargetByClass(
'ilObjTestGUI',
'createQuestion',
'',
false,
false);
484 $selected_array = (is_array($_POST[
'q_id'])) ? $_POST[
'q_id'] : [];
485 if (!count($selected_array)) {
486 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_insert_missing_question'),
true);
487 $this->
ctrl->redirect($this,
'browseForQuestions');
496 $this->component_repository,
500 $test_question_set_config = $test_question_set_config_factory->getQuestionSetConfig();
502 foreach ($selected_array as
$key => $value) {
503 $last_question_id = $this->test_object->insertQuestion($test_question_set_config, $value);
509 $this->test_object->saveCompleteStatus($test_question_set_config);
511 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'manscoring_hint'),
true);
513 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_questions_inserted'),
true);
516 $this->
ctrl->setParameter($this,
'q_id', $last_question_id);
517 $this->
ctrl->redirect($this,
'showPage');
__construct($a_id=0, $a_old_nr=0, $test_object=null)
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Readable part of repository interface to ilComponentDataDB.
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
setOutputMode(string $a_mode=self::PRESENTATION)
static _getAvailableQuestionpools( $use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission='read', $usr_id='')
Returns the available question pools for the active user.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getQuestionTypeByTypeId($type_id)
ilComponentRepository $component_repository
addPageOfQuestions($type='')
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
static _needsManualScoring(int $question_id)
ILIAS COPage Link LinkManager $link
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjectId(int $ref_id)
Basic GUI class for assessment questions.
static redirect(string $a_script)
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
redirectToQuestionEditPage($questionType, $qid, $prev_qid)
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
redirectToQuestionPoolSelectionPage($questionType, $qid, $prev_qid)
ilTestExpressPageObjectGUI: assMultipleChoiceGUI, assClozeTestGUI, assMatchingQuestionGUI ilTestExpr...