19 declare(strict_types=1);
99 $this->db = $DIC[
'ilDB'];
100 $this->log = $DIC[
'ilLog'];
101 $this->
help = $DIC[
'ilHelp'];
102 $this->global_screen = $DIC[
'global_screen'];
103 $this->component_factory = $DIC[
'component.factory'];
104 $this->component_repository = $DIC[
'component.repository'];
105 $this->navigation_history = $DIC[
'ilNavigationHistory'];
106 $this->ui_service = $DIC->uiService();
107 $this->taxonomy = $DIC->taxonomy();
108 $this->archives = $DIC->archives();
109 $this->content_style = $DIC->contentStyle();
113 $local_dic = QuestionPoolDIC::dic();
114 $this->request_data_collector = $local_dic[
'request_data_collector'];
115 $this->questionrepository = $local_dic[
'question.general_properties.repository'];
116 $this->global_test_settings = $local_dic[
'global_test_settings'];
120 $this->
ctrl->saveParameter($this, [
128 $this->
ctrl->saveParameterByClass(
'ilAssQuestionPageGUI',
'consumer_context');
129 $this->
ctrl->saveParameterByClass(
'ilobjquestionpoolgui',
'consumer_context');
131 $this->
lng->loadLanguageModule(
'assessment');
133 $here_uri = $this->data_factory->uri($this->request->getUri()->__toString());
135 $query_params_namespace = [
'qpool',
'table'];
136 list($url_builder, $action_parameter_token, $row_id_token) = $url_builder->
acquireParameters(
137 $query_params_namespace,
145 $this->notes_service->gui()->initJavascript();
150 $write_access = $this->
access->checkAccess(
'write',
'', $this->request_data_collector->getRefId());
152 if ((!$this->
access->checkAccess(
'read',
'', $this->request_data_collector->getRefId()))
153 && (!$this->
access->checkAccess(
'visible',
'', $this->request_data_collector->getRefId()))) {
154 $this->
ilias->raiseError($this->
lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
158 $this->
access->checkAccess(
'read',
'', $this->request_data_collector->getRefId())) {
159 if (
'qpl' === $this->
object->getType()) {
160 $this->navigation_history->addItem(
161 $this->request_data_collector->getRefId(),
162 ilLink::_getLink($this->request_data_collector->getRefId(),
"qpl"),
168 $cmd = $this->
ctrl->getCmd(self::DEFAULT_CMD);
169 $next_class = $this->
ctrl->getNextClass($this);
170 $q_id = $this->request_data_collector->getQuestionId() ??
null;
172 if (in_array($next_class, [
'',
'ilobjquestionpoolgui']) && $cmd == self::DEFAULT_CMD) {
180 $q_type = $this->request_data_collector->string(
'question_type');
181 switch ($next_class) {
182 case 'ilcommonactiondispatchergui':
184 $this->
ctrl->forwardCommand($gui);
187 case 'ilobjectmetadatagui':
188 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
189 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->WARNING);
192 $this->
ctrl->forwardCommand($md_gui);
195 case 'ilassquestionpreviewgui':
196 if (!$this->
access->checkAccess(
'read',
'', $this->object->getRefId())) {
200 $this->
ctrl->saveParameterByClass(ilAssQuestionPreviewGUI::class,
'q_id');
201 $this->
ctrl->saveParameter($this,
'q_id');
218 $question_gui = assQuestion::instantiateQuestionGUI($this->request_data_collector->int(
'q_id'));
220 $this->
lng->txt(
'edit_question'),
221 $this->
ctrl->getLinkTargetByClass(
222 get_class($question_gui),
226 $gui->addAdditionalCmd(
227 $this->
lng->txt(
'edit_page'),
228 $this->
ctrl->getLinkTargetByClass(
229 ilAssQuestionPageGUI::class,
238 $gui->initPreviewSettings($this->
object->getRefId());
240 $this->
ctrl->clearParameterByClass(self::class,
'q_id');
241 $this->tabs_gui->setBackTarget(
242 $this->
lng->txt(
'backtocallingpool'),
243 $this->
ctrl->getLinkTargetByClass(self::class, self::DEFAULT_CMD)
246 $this->
help->setScreenIdComponent(
'qpl');
248 $this->
ctrl->forwardCommand($gui);
251 case 'ilassquestionpagegui':
252 if ($cmd ==
'finishEditing') {
253 $this->
ctrl->redirectByClass(
'ilassquestionpreviewgui',
'show');
256 if ($cmd ===
'edit' && !$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
259 $this->tpl->setCurrentBlock(
'ContentStyle');
261 $this->tpl->parseCurrentBlock();
263 $this->tpl->setCurrentBlock(
'SyntaxStyle');
265 $this->tpl->parseCurrentBlock();
268 $question_gui->setQuestionTabs();
270 $question_gui->setQuestionActionCmd(
'');
272 if ($this->
object->getType() ===
'qpl') {
273 $question_gui->addHeaderAction();
278 if ($this->questionrepository->isInActiveTest($question->getObjId())) {
279 $this->tpl->setOnScreenMessage(
281 $this->
lng->txt(
'question_is_part_of_running_test'),
287 $this->
ctrl->saveParameter($this,
'q_id');
288 $this->
lng->loadLanguageModule(
'content');
289 $this->
ctrl->setReturnByClass(
'ilAssQuestionPageGUI',
'view');
290 $this->
ctrl->setReturn($this, self::DEFAULT_CMD);
293 $this->
ctrl->getLinkTargetByClass(ilObjQuestionPoolGUI::class,
'downloadFile')
295 $page_gui->obj->addUpdateListener(
299 $page_gui->setEditPreview(
true);
300 $page_gui->setEnabledTabs(
false);
301 $page_gui->setQuestionHTML([$question_gui->
getObject()->getId() => $question_gui->getPreview(
true)]);
302 $page_gui->setTemplateTargetVar(
'ADM_CONTENT');
303 $page_gui->setOutputMode(
'edit');
304 $page_gui->setHeader($question->getTitleForHTMLOutput());
305 $page_gui->setPresentationTitle($question->getTitleForHTMLOutput());
306 $ret = $this->
ctrl->forwardCommand($page_gui);
308 $this->tpl->setContent($ret);
312 case 'ilpermissiongui':
314 $this->
ctrl->forwardCommand($perm_gui);
317 case 'ilobjectcopygui':
320 $this->
ctrl->forwardCommand($cp);
325 $ret = $this->
ctrl->forwardCommand($exp_gui);
328 case strtolower(ilInfoScreenGUI::class):
332 case 'illocalunitconfigurationgui':
333 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
334 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->WARNING);
341 $question->setObjId($this->
object->getId());
342 $question_gui->setObject($question);
343 $question_gui->setQuestionTabs();
345 $this->
ctrl->setReturn($this, self::DEFAULT_CMD);
349 $this->
ctrl->forwardCommand($gui);
352 case 'ilassquestionfeedbackeditinggui':
353 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
357 $this->
ctrl->setReturn($this, self::DEFAULT_CMD);
363 $question->setObjId($this->
object->getId());
364 $question_gui->setObject($question);
365 $question_gui->setQuestionTabs();
367 if ($this->questionrepository->isInActiveTest($question_gui->
getObject()->getObjId())) {
368 $this->tpl->setOnScreenMessage(
370 $this->
lng->txt(
'question_is_part_of_running_test'),
376 $this->
help->setScreenIdComponent(
'qpl');
378 if ($this->
object->getType() ==
'qpl' && $write_access) {
379 $question_gui->addHeaderAction();
389 $this->request_data_collector,
390 $this->content_style,
393 $this->
ctrl->forwardCommand($gui);
397 case 'ilobjquestionpoolsettingsgeneralgui':
410 $this->
ctrl->forwardCommand($gui);
413 case strtolower(ilTaxonomySettingsGUI::class):
414 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
424 $this->component_repository,
431 $forwarder->forward();
435 case 'ilquestionpoolskilladministrationgui':
446 $this->component_repository,
451 $this->
ctrl->forwardCommand($gui);
454 case 'ilbulkeditquestionsgui':
455 if (!$this->
access->checkAccess(
'read',
'', $this->object->getRefId())) {
458 $this->tabs_gui->setBackTarget(
459 $this->
lng->txt(
'backtocallingpool'),
460 $this->
ctrl->getLinkTargetByClass(self::class, self::DEFAULT_CMD)
462 $this->tabs_gui->addTarget(
466 $this->
ctrl->getCmdClass(),
469 $this->tabs_gui->setTabActive(
'edit_questions');
471 $gui = new \ilBulkEditQuestionsGUI(
479 $this->request_wrapper,
482 $this->
ctrl->forwardCommand($gui);
485 case 'ilobjquestionpoolgui':
488 if ($action = $this->request_data_collector->string($this->action_parameter_token->getName())) {
489 $ids = $this->request_data_collector->raw($this->row_id_token->getName()) ??
null;
492 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_questions_selected'),
true);
493 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
495 if ($ids[0] ===
'ALL_OBJECTS') {
496 $ids = $this->
object->getAllQuestionIds();
498 if (!is_array($ids)) {
499 $ids = explode(
',', $ids);
503 $class = strtolower($this->questionrepository->getForQuestionId(current($ids))->getGuiClassName());
504 $this->
ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id", current($ids));
505 $this->
ctrl->setParameterByClass(
"ilAssQuestionPreviewGUI",
"q_id", current($ids));
506 $this->
ctrl->setParameterByClass(
'ilAssQuestionFeedbackEditingGUI',
'q_id', current($ids));
507 $this->
ctrl->setParameterByClass($class,
"q_id", current($ids));
518 case 'edit_question':
519 $url = $this->
ctrl->getLinkTargetByClass($class,
'editQuestion');
523 $url = $this->
ctrl->getLinkTargetByClass(
'ilAssQuestionPageGUI',
'edit');
532 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
536 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
543 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
548 $this->
object->getRefId(),
550 $this->
object->getId(),
556 .
' event = new Event("click");' 565 $this->
ctrl->clearParameters($this);
566 $this->
ctrl->setParameterByClass(
567 ilBulkEditQuestionsGUI::class,
571 $url = $this->
ctrl->getLinkTargetByClass(
572 ilBulkEditQuestionsGUI::class,
579 throw new \Exception(
"'$action'" .
" not implemented");
585 if ($cmd == self::DEFAULT_CMD) {
586 $this->
ctrl->setParameter($this,
'q_id',
'');
589 $ret = $this->$cmd();
595 [
'editQuestion',
'save',
'suggestedsolution',
'uploadImage',
'removeImage']
596 ) && !$this->
access->checkAccess(
599 $this->object->getRefId()
604 $this->
ctrl->setReturnByClass(self::class, self::DEFAULT_CMD);
613 $question->setObjId($this->
object->getId());
614 $question_gui->setObject($question);
616 if ($this->
object->getType() ===
'qpl') {
617 $question_gui->setTaxonomyIds($this->
object->getTaxonomyIds());
620 $question_gui->addHeaderAction();
624 $this->
help->setScreenIdComponent(
'qpl');
626 if ($qid === 0 && $question_gui->cmdNeedsExistingQuestion($cmd)) {
627 $question_gui->
getObject()->createNewQuestion();
630 $question_gui->setQuestionTabs();
632 if (!in_array($cmd, [
'save',
'saveReturn'])) {
633 $question_gui->$cmd();
637 if (!$question_gui->saveQuestion()) {
640 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
641 if ($cmd ===
'saveReturn') {
642 $this->
ctrl->setParameterByClass(
643 ilAssQuestionPreviewGUI::class,
645 (
string) $question_gui->
getObject()->getId()
647 $this->
ctrl->redirectToURL(
652 if ($cmd ===
'save') {
653 $this->tabs_gui->activateTab(
'edit_question');
654 $question_gui->editQuestion(
false,
false);
659 if (!(strtolower($this->request_data_collector->raw(
'baseClass')) ==
'iladministrationgui' 660 || strtolower($this->request_data_collector->raw(
'baseClass')) ==
'ilrepositorygui')
662 $this->tpl->printToStdout();
668 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_permission'),
true);
669 $target_class = get_class($this->
object) .
'GUI';
670 $this->
ctrl->setParameterByClass($target_class,
'ref_id', $this->ref_id);
671 $this->
ctrl->redirectByClass($target_class);
680 $this->
ctrl->redirectByClass(
'ilQuestionPoolExportGUI');
685 $file = explode(
'_', $this->request_data_collector->raw(
'file_id'));
686 $fileObj =
new ilObjFile((
int) $file[count($file) - 1],
false);
687 $fileObj->sendFile();
698 $this->
ctrl->getLinkTargetByClass(ilObjQuestionPoolGUI::class,
'downloadFile')
700 $page_gui->showMediaFullscreen();
709 $pg_obj->
sendParagraph($this->request_data_collector->raw(
'par_id'), $this->request_data_collector->raw(
'downloadtitle'));
715 if ($this->creation_mode
716 && !$this->
checkPermissionBool(
'create',
'', $this->request_data_collector->string(
'new_type'))
717 || !$this->creation_mode
727 $new_obj->setType($this->request_data_collector->raw(
'new_type'));
728 $new_obj->setTitle(
'dummy');
729 $new_obj->setDescription(
'questionpool import');
730 $new_obj->create(
true);
731 $new_obj->createReference();
732 $new_obj->putInTree($this->request_data_collector->getRefId());
733 $new_obj->setPermissions($this->request_data_collector->getRefId());
736 'importVerifiedFile',
742 if (is_file($importdir . DIRECTORY_SEPARATOR .
'manifest.xml')) {
757 $new_obj->fromXML($xmlfile);
760 $new_obj->saveToDb();
764 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_imported'),
true);
765 $this->
ctrl->setParameterByClass(self::class,
'ref_id', $new_obj->getRefId());
766 $this->
ctrl->redirectByClass(self::class);
773 if (mb_substr($file_to_import, -3) ===
'xml') {
774 $importdir = dirname($file_to_import);
776 'importVerifiedQuestionsFile',
790 'importVerifiedQuestionsFile',
795 if (is_file($importdir . DIRECTORY_SEPARATOR .
'manifest.xml')) {
814 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_imported'),
true);
821 $data = $import_questions_modal->getData();
824 $import_questions_modal->withOnLoad(
825 $import_questions_modal->getShowSignal()
830 $path_to_imported_file_in_temp_dir =
$data[
'import_file'][0];
836 $constraint = $this->
refinery->custom()->constraint(
837 function ($vs):
bool {
843 $this->
lng->txt(
'msg_no_files_selected')
846 $file_upload_input = $this->ui_factory->input()->field()
848 ->withAcceptedMimeTypes(self::SUPPORTED_IMPORT_MIME_TYPES)
850 ->withAdditionalTransformation($constraint);
851 return $this->ui_factory->modal()->roundtrip(
852 $this->
lng->txt(
'import'),
854 [
'import_file' => $file_upload_input],
855 $this->
ctrl->getFormActionByClass(self::class,
'uploadQuestionsImport')
856 )->withSubmitLabel($this->
lng->txt(
'import'));
861 array $selected_questions,
862 string $file_to_import
865 ilSession::set(
'qpl_import_selected_questions', $selected_questions);
866 $imp =
new ilImport($this->request_data_collector->getRefId());
868 $map->addMapping(
'components/ILIAS/TestQuestionPool',
'qpl',
'new_id', (
string) $obj->
getId());
869 $imp->
importObject($obj, $file_to_import, basename($file_to_import),
'qpl',
'components/ILIAS/TestQuestionPool',
true);
874 array $selected_questions,
888 if ($xmlfile ===
'') {
897 $cont_parser->setQuestionMapping($qti_parser->getImportMapping());
898 $cont_parser->startParsing();
909 public function createQuestionObject():
void 912 $data_with_section = $form->getData();
913 if ($data_with_section ===
null) {
917 $data = $data_with_section[0];
919 $this->
ctrl->setReturnByClass(self::class, self::DEFAULT_CMD);
925 $question = $question_gui->getObject();
926 $question->setObjId($this->
object->getId());
927 $question->setAdditionalContentEditingMode(
$data[
'editing_type']);
928 $question_gui->setObject($question);
929 $question_gui->setQuestionTabs();
930 $question_gui->editQuestion();
936 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
939 'ilias.php?ref_id=' . $new_object->
getRefId() .
940 '&baseClass=ilObjQuestionPoolGUI' 948 $questionIdsToDelete = array_filter(
array_map(
'intval', $ids));
949 if (0 === count($questionIdsToDelete)) {
950 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_delete_select_none'),
true);
951 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
954 $this->tpl->setOnScreenMessage(
'question', $this->
lng->txt(
'qpl_confirm_delete_questions'));
955 $deleteable_questions = $this->
object->getDeleteableQuestionDetails($questionIdsToDelete);
956 $table_gui =
new ilQuestionBrowserTableGUI($this, self::DEFAULT_CMD, (($rbacsystem->checkAccess(
'write', $this->request_data_collector->getRefId()) ?
true :
false)),
true);
957 $table_gui->setShowRowsSelector(
false);
958 $table_gui->setLimit(PHP_INT_MAX);
959 $table_gui->setEditable($rbacsystem->checkAccess(
'write', $this->request_data_collector->getRefId()));
960 $table_gui->setData($deleteable_questions);
961 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
971 $questionIdsToDelete = $this->request_data_collector->isset(
'q_id') ? (array) $this->request_data_collector->raw(
'q_id') : [];
972 if ($questionIdsToDelete === [] && $this->request_data_collector->isset(
'q_id')) {
973 $questionIdsToDelete = [$this->request_data_collector->getQuestionId()];
976 $questionIdsToDelete = array_filter(
array_map(
'intval', $questionIdsToDelete));
977 if ($questionIdsToDelete === []) {
978 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_delete_select_none'),
true);
979 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
982 $this->tpl->setOnScreenMessage(
'question', $this->
lng->txt(
'qpl_confirm_delete_questions'));
983 $deleteable_questions = &$this->
object->getDeleteableQuestionDetails($questionIdsToDelete);
987 (($rbacsystem->checkAccess(
'write', $this->request_data_collector->getRefId()) ?
true :
false)),
990 $table_gui->setShowRowsSelector(
false);
991 $table_gui->setLimit(PHP_INT_MAX);
992 $table_gui->setEditable($rbacsystem->checkAccess(
'write', $this->request_data_collector->getRefId()));
993 $table_gui->setData($deleteable_questions);
994 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
1002 $qst_ids = $this->request_data_collector->intArray(
'q_id');
1003 foreach ($qst_ids as $value) {
1004 $this->
object->deleteQuestion((
int) $value);
1005 $this->
object->cleanupClipboard((
int) $value);
1007 if ($qst_ids !== []) {
1008 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'qpl_questions_deleted'),
true);
1011 $this->
ctrl->setParameter($this,
'q_id',
'');
1012 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
1017 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
1026 $export_file = $qpl_exp->buildExportFile();
1029 if ($export_file ===
'') {
1030 $export_file =
'StandIn';
1035 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_export_select_none'),
true);
1044 $this->
ctrl->redirectByClass(
1046 ilRepositoryGUI::class,
1048 ilInfoScreenGUI::class
1058 if (!$this->
access->checkAccess(
"read",
"", $this->request_data_collector->getRefId())) {
1063 $this->
object->purgeQuestions();
1065 if ($qsa_import_fails->failedImportsRegistered()) {
1066 $button = $this->ui_factory->button()->standard(
1067 $this->
lng->txt(
'ass_skl_import_fails_remove_btn'),
1068 $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
'renoveImportFails')
1070 $this->tpl->setOnScreenMessage(
1072 $qsa_import_fails->getFailedImportsMessage($this->lng) .
'<br />' . $this->ui_renderer->render(
1079 if ($this->rbac_system->checkAccess(
'write', $this->request_data_collector->getRefId())) {
1080 $btn = $this->ui_factory->button()->primary(
1081 $this->
lng->txt(
'ass_create_question'),
1082 $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
'createQuestionForm')
1084 $this->
toolbar->addComponent($btn);
1086 if ($import_questions_modal ===
null) {
1090 $btn_import = $this->ui_factory->button()->standard(
1091 $this->
lng->txt(
'import'),
1092 $import_questions_modal->getShowSignal()
1094 $this->
toolbar->addComponent($btn_import);
1095 $out[] = $this->ui_renderer->render($import_questions_modal);
1098 $btn_paste = $this->ui_factory->button()->standard(
1099 $this->
lng->txt(
'paste'),
1100 $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
'paste')
1102 $this->
toolbar->addComponent($btn_paste);
1106 $this->tpl->setPermanentLink($this->
object->getType(), $this->
object->getRefId());
1108 $this->tpl->setContent(implode(
'',
$out));
1113 $q_id = $this->request_data_collector->getQuestionId();
1115 if ($q_id === 0 || $this->
object->checkQuestionParent($q_id)) {
1124 $this->
help->setScreenId(
'assQuestions');
1125 if ($this->global_test_settings->isPageEditorEnabled()) {
1126 $this->
help->setSubScreenId(
'createQuestion_editMode');
1128 $this->
help->setSubScreenId(
'createQuestion');
1131 $this->tpl->setContent(
1132 $this->ui_renderer->render(
1133 $form ?? $this->buildQuestionCreationForm()
1144 $this->ui_factory->input()->field()->section(
$inputs, $this->
lng->txt(
'ass_create_question'))
1147 $form = $this->ui_factory->input()->container()->form()->standard(
1148 $this->
ctrl->getFormAction($this,
'createQuestion'),
1150 )->withSubmitLabel($this->
lng->txt(
'create'));
1157 $question_types = (
new ilObjQuestionPool())->getQuestionTypes(
false,
true,
false);
1159 foreach ($question_types as $label =>
$data) {
1160 $options[
$data[
'question_type_id']] = $label;
1163 return $this->ui_factory->input()->field()->select(
1164 $this->
lng->txt(
'question_type'),
1166 )->withRequired(
true);
1171 if (!$this->global_test_settings->isPageEditorEnabled()) {
1172 return $this->ui_factory->input()->field()->hidden()->
withValue(
1177 return $this->ui_factory->input()->field()->radio($this->
lng->txt(
'tst_add_quest_cont_edit_mode'))
1180 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
1181 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info')
1184 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE'),
1185 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_RTE_info')
1192 $this->tabs_gui->activateTab(
'print_view');
1193 $this->
ctrl->setParameter($this,
'output',
'overview');
1194 $output_link = $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
'print');
1195 $this->
ctrl->setParameter($this,
'output',
'detailed_output_solutions');
1196 $output_link_detailed = $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
'print');
1197 $this->
ctrl->setParameter($this,
'output',
'detailed_output_printview');
1198 $output_link_printview = $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
'print');
1200 $mode = $this->ui_factory->dropdown()->standard([
1201 $this->ui_factory->button()->shy($this->
lng->txt(
'overview'), $output_link),
1202 $this->ui_factory->button()->shy($this->
lng->txt(
'detailed_output_solutions'), $output_link_detailed),
1203 $this->ui_factory->button()->shy($this->
lng->txt(
'detailed_output_printview'), $output_link_printview)
1204 ])->withLabel($this->
lng->txt(
'output_mode'));
1206 $output = $this->request_data_collector->raw(
'output') ??
'';
1209 $data = $this->
object->getPrintviewQuestions();
1212 $totalPoints += $d[
'points'];
1214 $table_gui->setTotalPoints($totalPoints);
1215 $table_gui->initColumns();
1216 $table_gui->setData(
$data);
1217 $this->tpl->setContent($this->ui_renderer->render($mode) . $table_gui->getHTML());
1222 $this->
object->update();
1223 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
1229 if ($this->
object->pasteFromClipboard()) {
1230 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'qpl_paste_success'),
true);
1232 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'qpl_paste_error'),
true);
1235 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_paste_no_objects'),
true);
1237 $this->
ctrl->redirect($this, self::DEFAULT_CMD);
1243 foreach ($ids as
$id) {
1244 $this->
object->copyToClipboard($id);
1246 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_copy_insert_clipboard'),
true);
1248 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_copy_select_none'),
true);
1255 foreach ($ids as
$id) {
1256 $this->
object->moveToClipboard($id);
1258 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_move_insert_clipboard'),
true);
1260 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'qpl_move_select_none'),
true);
1267 if ($rbacsystem->checkAccess(
'write', $this->request_data_collector->getRefId())) {
1268 $question_ids = &$this->
object->getAllQuestionIds();
1270 $qpl_exp->buildExportFile();
1271 $this->
ctrl->redirectByClass(
'ilquestionpoolexportgui',
'');
1277 $this->
ctrl->redirectByClass(ilAssQuestionPreviewGUI::class,
'show');
1282 if (!$this->temp_file_system->hasDir($path_to_uploaded_file_in_temp_dir)
1283 || ($files = $this->temp_file_system->listContents($path_to_uploaded_file_in_temp_dir)) === []) {
1284 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'obj_import_file_error'));
1287 $file_to_import = $this->import_temp_directory . DIRECTORY_SEPARATOR . $files[0]->getPath();
1288 $qtifile = $file_to_import;
1289 $importdir = dirname($file_to_import);
1292 if ($this->temp_file_system->getMimeType($files[0]->getPath()) === MimeType::APPLICATION__ZIP) {
1295 $unzip = $this->archives->unzip($this->temp_file_system->readStream($files[0]->getPath()), $options);
1299 if (!file_exists($qtifile)) {
1301 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'cannot_find_xml'),
true);
1307 ilSession::set(
'path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1310 'importVerifiedQuestionsFile',
1313 $path_to_uploaded_file_in_temp_dir
1316 if ($form ===
null) {
1320 $panel = $this->ui_factory->panel()->standard(
1321 $this->
lng->txt(
'import_question'),
1323 $this->ui_factory->legacy()->content($this->
lng->txt(
'qpl_import_verify_found_questions')),
1327 $this->tpl->setContent($this->ui_renderer->render($panel));
1328 $this->tpl->printToStdout();
1332 protected function importFile(
string $file_to_import,
string $path_to_uploaded_file_in_temp_dir): void
1339 $unzip = $this->archives->unzip(Streams::ofResource(fopen($file_to_import,
'r')), $options);
1342 if (!file_exists($qtifile)) {
1344 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'cannot_find_xml'),
true);
1349 ilSession::set(
'path_to_uploaded_file_in_temp_dir', $path_to_uploaded_file_in_temp_dir);
1351 $this->
ctrl->setParameterByClass(self::class,
'new_type', $this->type);
1353 'importVerifiedFile',
1356 $path_to_uploaded_file_in_temp_dir
1359 if ($form ===
null) {
1363 $panel = $this->ui_factory->panel()->standard(
1364 $this->
lng->txt(
'import_qpl'),
1366 $this->ui_factory->legacy()->content($this->
lng->txt(
'qpl_import_verify_found_questions')),
1370 $this->tpl->setContent($this->ui_renderer->render($panel));
1371 $this->tpl->printToStdout();
1379 switch ($this->
ctrl->getCmd()) {
1385 $this->
ctrl->clearParameterByClass(self::class,
'q_id');
1386 $ilLocator->addItem(
1387 $this->
object->getTitle(),
1388 $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
''),
1390 $this->request_data_collector->getRefId()
1392 $this->
ctrl->setParameter($this,
'q_id', $this->request_data_collector->getQuestionId());
1396 if (!is_array($this->request_data_collector->raw(
'q_id')) && $this->request_data_collector->raw(
'q_id') > 0 && $this->request_data_collector->raw(
1398 ) !== self::DEFAULT_CMD) {
1400 if ($question_gui !==
null && $question_gui->getObject() instanceof
assQuestion) {
1401 $question = $question_gui->getObject();
1402 $question->setObjId($this->
object->getId());
1403 $question_gui->setObject($question);
1404 $title = $question_gui->getObject()->getTitleForHTMLOutput();
1406 $title = $this->
lng->txt(
'new') .
': ' . $this->questionrepository->getForQuestionId(
1407 $question_gui->getObject()->getId()
1408 )->getTypeName($this->
lng);
1410 $ilLocator->addItem($title, $this->
ctrl->getLinkTargetByClass(get_class($question_gui),
'editQuestion'));
1413 $this->
ctrl->setParameter($this,
'q_id',
'');
1414 $this->
ctrl->redirect($this);
1424 parent::setTitleAndDescription();
1426 if (!is_array($this->request_data_collector->raw(
'q_id')) && $this->request_data_collector->raw(
'q_id') > 0 && $this->request_data_collector->raw(
1428 ) !== self::DEFAULT_CMD) {
1430 if ($question_gui->getObject() instanceof
assQuestion) {
1431 $question = $question_gui->getObject();
1432 $question->setObjId($this->
object->getId());
1433 $question_gui->setObject($question);
1434 $title = $this->
object->getTitle() .
': ' . $question_gui->getObject()->getTitleForHTMLOutput();
1436 $title = $this->
lng->txt(
'new') .
': ' . $this->questionrepository->getForQuestionId(
1437 $question_gui->getObject()->getId()
1438 )->getTypeName($this->
lng);
1440 $this->tpl->setTitle(
1441 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1445 $this->tpl->setDescription(
1446 $question_gui->getObject()->getDescriptionForHTMLOutput()
1451 $this->
ctrl->setParameter($this,
'q_id',
'');
1452 $this->
ctrl->redirect($this);
1455 $this->tpl->setTitle(
1456 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1457 $this->
object->getTitle()
1460 $this->tpl->setDescription(
1461 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
1462 $this->
object->getLongDescription()
1476 $with_write_access = $this->
access->checkAccess(
'write',
'', $this->
object->getRefId());
1477 $with_read_access = $this->
access->checkAccess(
'read',
'', $this->
object->getRefId());
1479 $this->
help->setScreenIdComponent(
'qpl');
1481 switch ($this->
ctrl->getNextClass()) {
1483 case strtolower(ilInfoScreenGUI::class):
1484 case strtolower(ilPermissionGUI::class):
1485 case strtolower(ilObjectMetaDataGUI::class):
1486 case strtolower(ilExportGUI::class):
1487 case strtolower(ilQuestionPoolSkillAdministrationGUI::class):
1490 case strtolower(ilTaxonomySettingsGUI::class):
1491 case strtolower(ilObjQuestionPoolSettingsGeneralGUI::class):
1492 if ($with_write_access) {
1502 $force_active =
false;
1503 $commands = $this->request_data_collector->raw(
'cmd');
1504 if (is_array($commands)) {
1505 foreach ($commands as $key => $value) {
1506 if (preg_match(
'/^delete_.*/', $key, $matches) ||
1507 preg_match(
'/^addSelectGap_.*/', $key, $matches) ||
1508 preg_match(
'/^addTextGap_.*/', $key, $matches) ||
1509 preg_match(
'/^deleteImage_.*/', $key, $matches) ||
1510 preg_match(
'/^upload_.*/', $key, $matches) ||
1511 preg_match(
'/^addSuggestedSolution_.*/', $key, $matches)
1513 $force_active =
true;
1518 $force_active = $force_active || $this->request_data_collector->isset(
'imagemap_x');
1519 if (!$force_active) {
1520 $force_active = strtolower($this->
ctrl->getCmdClass()) === strtolower(self::class)
1521 || $this->
ctrl->getCmdClass() ===
'' && $this->
ctrl->getCmd() ===
'' 1525 if ($with_read_access) {
1526 $this->tabs_gui->addTarget(
1528 $this->
ctrl->getLinkTargetByClass(
1529 [ilRepositoryGUI::class, self::class],
1539 'filterQuestionBrowser',
1548 'addSuggestedSolution',
1551 'removeSuggestedSolution',
1558 'uploadingImagemap',
1564 'uploadingJavaapplet',
1571 'toggleGraphicalAnswers',
1581 if ($with_read_access) {
1582 $this->tabs_gui->addTab(
1584 $this->
lng->txt(
'info_short'),
1585 $this->
ctrl->getLinkTargetByClass(
1587 ilRepositoryGUI::class,
1589 ilInfoScreenGUI::class
1595 if ($with_write_access) {
1597 $this->tabs_gui->addTarget(
1599 $this->
ctrl->getLinkTargetByClass(ilObjQuestionPoolSettingsGeneralGUI::class),
1601 [ilObjQuestionPoolSettingsGeneralGUI::class, ilObjTaxonomyGUI::class]
1606 $link = $this->
ctrl->getLinkTargetByClass(
1607 [ilQuestionPoolSkillAdministrationGUI::class, ilAssQuestionSkillAssignmentsGUI::class],
1611 $this->tabs_gui->addTarget(
'qpl_tab_competences', $link, [], []);
1615 if ($with_read_access) {
1617 $this->tabs_gui->addTarget(
1619 $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class],
'print'),
1626 if ($with_write_access) {
1628 $mdtab = $mdgui->getTab();
1630 $this->tabs_gui->addTarget(
1639 if ($with_write_access) {
1640 $this->tabs_gui->addTarget(
1642 $this->
ctrl->getLinkTargetByClass(ilExportGUI::class,
''),
1648 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
1649 $this->tabs_gui->addTarget(
1651 $this->
ctrl->getLinkTargetByClass([ilRepositoryGUI::class, self::class, ilPermissionGUI::class],
'perm'),
1652 [
'perm',
'info',
'owner'],
1664 if (!$this->
object->isSkillServiceEnabled()) {
1679 $this->
lng->txt(
'qpl_settings_subtab_general'),
1680 $this->
ctrl->getLinkTargetByClass(ilObjQuestionPoolSettingsGeneralGUI::class),
1685 $this->
lng->txt(
'qpl_settings_subtab_taxonomies'),
1686 $this->
ctrl->getLinkTargetByClass(ilTaxonomySettingsGUI::class,
''),
1692 $this->
ctrl->redirectByClass(
1694 ilRepositoryGUI::class,
1696 ilInfoScreenGUI::class
1703 if (!$this->
access->checkAccess(
'visible',
'', $this->ref_id)) {
1704 $this->error->raiseError($this->
lng->txt(
'msg_no_perm_read'));
1707 $this->tabs_gui->activateTab(
'info_short');
1709 $info->enablePrivateNotes();
1710 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
1715 public static function _goto($a_target):
void 1719 $main_tpl = $DIC->ui()->mainTemplate();
1720 $ilAccess = $DIC[
'ilAccess'];
1723 $ctrl = $DIC[
'ilCtrl'];
1725 $target_ref_id = (
int) $a_target;
1727 if ($ilAccess->checkAccess(
'write',
'', $target_ref_id)
1728 || $ilAccess->checkAccess(
'read',
'', $target_ref_id)
1731 $ctrl->
redirectByClass([ilRepositoryGUI::class, ilObjQuestionPoolGUI::class], self::DEFAULT_CMD);
1734 if ($ilAccess->checkAccess(
'visible',
'', $target_ref_id)) {
1735 $DIC->ctrl()->setParameterByClass(ilInfoScreenGUI::class,
'ref_id', $a_target);
1736 $DIC->ctrl()->redirectByClass(
1738 ilRepositoryGUI::class,
1740 ilInfoScreenGUI::class
1745 $main_tpl->setOnScreenMessage(
1748 $lng->
txt(
'msg_no_perm_read_item'),
1767 $this->data_factory,
1770 $this->action_parameter_token,
1771 $this->row_id_token,
1774 $this->component_repository,
1777 $this->taxonomy->domain(),
1779 $this->
object->getId(),
1780 $this->request_data_collector->getRefId()
1787 $filter_action = $this->
ctrl->getLinkTarget($this, self::DEFAULT_CMD);
1788 $filter = $table->getFilter($this->ui_service, $filter_action);
1790 $filter_params = $this->ui_service->filter()->getData($filter);
1792 if ($filter_params) {
1793 foreach (array_filter($filter_params) as $item => $value) {
1796 foreach ($value as $tax_value) {
1797 if ($tax_value ===
'null') {
1798 $table->addTaxonomyFilterNoTaxonomySet(
true);
1800 $tax_nodes = explode(
'-', $tax_value);
1801 $tax_id = array_shift($tax_nodes);
1802 $table->addTaxonomyFilter(
1806 $this->
object->getType()
1812 $table->setCommentFilter((
int) $value);
1815 $table->addFieldFilter($item, $value);
1823 ->withRequest($this->request)
buildImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ?string $path_to_uploaded_file_in_temp_dir=null)
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
ilNavigationHistory $navigation_history
static get(string $a_var)
afterSave(ilObject $new_object)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildImportQuestionsModal()
ilRbacSystem $rbac_system
importQuestionsFile(string $path_to_uploaded_file_in_temp_dir)
URLBuilderToken $action_parameter_token
DataFactory $data_factory
importVerifiedQuestionsFileObject()
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
renoveImportFailsObject()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
confirmDeleteQuestions(array $ids)
confirmDeleteQuestionsObject()
delete questions after confirmation
GUI class for the workflow of copying objects.
prepareOutput(bool $show_sub_objects=true)
static getQuestionTypeByTypeId($type_id)
importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
copyQuestions(array $ids)
trait TestQuestionsImportTrait
acquireParameters(array $namespace, string ... $names)
Class ilUnitConfigurationRepository.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setParameterByClass(string $a_class, string $a_parameter, $a_value)
const TAB_COMMON_SETTINGS
Component logger with individual log levels by component id.
getTabs()
adds tabs to tab gui object
download_paragraphObject()
download source code paragraph
RequestDataCollector $request_data_collector
questionsObject(?RoundTripModal $import_questions_modal=null)
list questions of question pool
const SUPPORTED_IMPORT_MIME_TYPES
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
GlobalScreen $global_screen
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
importObject(?object $a_new_obj, string $a_tmp_file, string $a_filename, string $a_type, string $a_comp="", bool $a_copy_file=false)
static _lookupObjId(int $ref_id)
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, ?string $sub_type=null, ?int $sub_id=null, int $news_id=0)
Build ajax hash.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
editQuestionForTestObject()
deleteUploadedImportFile(string $path_to_uploaded_file_in_temp_dir)
URLBuilderToken $row_id_token
moveQuestions(array $ids)
ilComponentRepository $component_repository
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importQuestionsFromQtiFile(ilObjQuestionPool $obj, array $selected_questions, string $qtifile, string $importdir, string $xmlfile='')
deleteQuestionsObject()
delete questions confirmation screen
deleteRegisteredImportFails()
ilComponentFactory $component_factory
static _lookupTitle(int $obj_id)
ILIAS Notes Service $notes_service
setTitleAndDescription()
called by prepare output
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importQuestionPoolWithValidManifest(ilObjQuestionPool $obj, array $selected_questions, string $file_to_import)
Class ilObjectGUI Basic methods of all Output classes.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
GeneralQuestionPropertiesRepository $questionrepository
cancelDeleteQuestionsObject()
Legacy Content Object Parser.
Class ilObjForumAdministration.
addSettingsSubTabs(ilTabsGUI $tabs)
createQuestionFormObject(?Form $form=null)
static getSyntaxStylePath()
importVerifiedFileObject()
buildQuestionCreationForm()
Class ilObjQuestionPoolGUI.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
Last visited history for repository items.
const EDIT_CONTEXT_AUTHORING
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static getListCommentsJSCall(string $a_hash, ?string $a_update_code=null)
Get list comments js call.
static redirect(string $a_script)
ContentStyle $content_style
fullscreenObject()
show fullscreen view
setFileDownloadLink(string $a_download_link)
fetchAuthoringQuestionIdParamater()
static isSkillManagementGloballyActivated()
retrieveSelectedQuestionsFromImportQuestionsSelectionForm(string $form_cmd, string $importdir, string $qtifile, ServerRequestInterface $request)
sendParagraph(string $par_id, string $filename)
__construct(Container $dic, ilPlugin $plugin)
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GlobalTestSettings $global_test_settings
uploadQuestionsImportObject()
Class ilLocalUnitConfigurationGUI.
array buildImportDirectoriesFromImportFile(string $file_to_import)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
redirectAfterMissingWrite()
exportQuestions(array $ids)
setPrimaryCmd(string $label, string $cmd)
static clear(string $a_var)
const RENDER_PURPOSE_PREVIEW
static set(string $a_var, $a_val)
Set a value.
const CMD_SHOW_SKILL_QUEST_ASSIGNS
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
cleanupAfterImport(string $importdir)