33 protected \ILIAS\Survey\InternalGUIService
$gui;
34 protected \ILIAS\Survey\PrintView\GUIService
$print;
35 protected \ILIAS\HTTP\Services
$http;
36 protected \ILIAS\DI\UIServices
$ui;
56 $this->
tabs = $DIC->tabs();
57 $this->
help = $DIC[
"ilHelp"];
58 $this->
toolbar = $DIC->toolbar();
59 $this->
user = $DIC->user();
60 $this->tree = $DIC->repositoryTree();
61 $ilCtrl = $DIC->ctrl();
62 $lng = $DIC->language();
65 $this->parent_gui = $a_parent_gui;
68 $this->
object = $survey;
70 $this->
ctrl = $ilCtrl;
74 $this->
ctrl->saveParameter($this, array(
"pgov",
"pgov_pos"));
76 $this->print_options = array(
82 $this->edit_manager = $DIC->survey()
86 $this->request = $DIC->survey()
91 $this->requested_pgov = $this->request->getTargetPosition();
92 $this->
ui = $DIC->ui();
93 $this->
http = $DIC->http();
94 $this->print = $DIC->survey()
98 $this->gui = $DIC->survey()
101 $this->sequence_manager = $DIC->survey()->internal()->domain()->sequence(
102 $this->
object->getSurveyId(),
109 $this->requested_pgov = $pgov;
116 $cmd = $this->
ctrl->getCmd(
"questions");
118 $next_class = $this->
ctrl->getNextClass($this);
119 switch ($next_class) {
123 if (stripos($next_class,
"questiongui") !==
false) {
124 $ilTabs->clearTargets();
125 $this->
ctrl->saveParameter($this, array(
"new_for_survey"));
128 $this->request->getQuestionId()
130 if (is_object($q_gui->object)) {
135 $q_gui->setBackUrl($this->
ctrl->getLinkTarget($this,
"questions"));
136 $q_gui->setQuestionTabs();
137 $this->
ctrl->forwardCommand($q_gui);
139 if (!$this->request->getNewForSurvey()) {
141 $this->tpl->setTitle($this->
lng->txt(
"question") .
": " . $q_gui->object->getTitle());
156 if ($a_cmd ===
"questions" && $this->requested_pgov !==
"") {
160 $this->
ctrl->setParameter($this,
"pgov",
"");
163 $this->
lng->txt(
"survey_question_editor"),
164 $this->
ctrl->getLinkTarget($this,
"questions")
166 $this->
ctrl->setParameter($this,
"pgov", $this->requested_pgov);
168 if ($this->
object->getSurveyPages()) {
169 if ($a_cmd ===
"page") {
170 $this->
ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"pgov", max(1, $this->request->getPage()));
172 $this->
ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"prvw", 1);
175 $this->
lng->txt(
"preview"),
176 $this->
ctrl->getLinkTargetByClass(array(
"ilobjsurveygui",
"ilsurveyexecutiongui"),
"preview")
180 $ilTabs->activateSubTab($a_cmd);
194 if ($this->request->getNewId() > 0) {
196 $existing = $this->
object->getExistingQuestions();
197 if (!in_array($this->request->getNewId(), $existing)) {
198 $inserted = $this->
object->insertQuestion($this->request->getNewId());
200 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_error_insert_incomplete_question"));
203 $this->
ctrl->redirect($this,
"questions");
210 $read_only = $hasDatasets;
216 $qtypes[
$data[
"type_tag"]] = $translation;
219 $ilToolbar->setFormAction($this->
ctrl->getFormAction($this));
222 $ilToolbar->addStickyItem($types,
"");
225 $this->
lng->txt(
"svy_create_question"),
227 )->submit()->toToolbar(
true);
229 if ($this->
object->getPoolUsage()) {
230 $cmd = ((
int) $ilUser->getPref(
'svy_insert_type') === 1 ||
231 ($ilUser->getPref(
'svy_insert_type') ??
'') ===
'')
232 ?
'browseForQuestions' 233 :
'browseForQuestionblocks';
236 $this->
lng->txt(
"browse_for_questions"),
237 $this->
ctrl->getLinkTarget($this, $cmd)
241 if ($this->
object->hasQuestions()) {
242 $ilToolbar->addSeparator();
244 $this->
lng->txt(
"add_heading"),
245 $this->
ctrl->getLinkTarget($this,
"addHeading")
249 $ilToolbar->addSeparator();
250 $print_view = $this->print->list($this->
object->getRefId());
251 $modal_elements = $print_view->getModalElements(
252 $this->
ctrl->getLinkTarget(
254 "printListViewSelection" 257 $ilToolbar->addComponent($modal_elements->button);
258 $ilToolbar->addComponent($modal_elements->modal);
263 $mess = $mbox->getHTML();
273 $this->tpl->setContent($mess . $table->getHTML());
281 bool $allow_blocks =
true,
282 bool $allow_questions =
true,
283 bool $allow_headings =
false,
284 bool $allow_questions_in_blocks =
false 286 $block_map = array();
287 foreach ($this->
object->getSurveyQuestions() as $item) {
288 $block_map[$item[
"question_id"]] = $item[
"questionblock_id"];
291 $questions = $blocks = $headings = array();
292 $ids = $this->request->getIds();
293 if (count($ids) > 0) {
294 foreach ($ids as
$key) {
296 if ($allow_questions && preg_match(
"/cb_(\d+)/", $key, $matches)) {
297 if (($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
298 !in_array($block_map[$matches[1]], $blocks)) {
299 $questions[] = $matches[1];
303 if ($allow_blocks && preg_match(
"/cb_qb_(\d+)/", $key, $matches)) {
304 $blocks[] = $matches[1];
307 if ($allow_headings && preg_match(
"/cb_tb_(\d+)/", $key, $matches)) {
308 $headings[] = $matches[1];
313 return array(
"questions" => $questions,
315 "headings" => $headings);
320 $req_order = $this->request->getOrder();
321 $req_block_order = $this->request->getBlockOrder();
322 if (count($req_order) > 0) {
326 foreach (array_keys($req_order) as
$id) {
328 if (strpos($id,
"qb_") === 0) {
329 $block_id = substr($id, 3);
330 $block = $req_block_order[$block_id];
332 foreach (array_keys($block) as $question_id) {
334 $order[$question_id] = $position;
337 $question_id = substr($id, 2);
339 $order[$question_id] = $position;
342 $this->
object->updateOrder($order);
345 $obligatory = $this->request->getObligatory();
346 $this->
object->setObligatoryStates($obligatory);
347 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
348 $this->
ctrl->redirect($this,
"questions");
354 if (count($items[
"blocks"])) {
355 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
356 $this->
object->unfoldQuestionblocks($items[
"blocks"]);
358 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"qpl_unfold_select_none"),
true);
360 $this->
ctrl->redirect($this,
"questions");
367 $move_questions = $items[
"questions"];
368 foreach ($items[
"blocks"] as $block_id) {
369 foreach ($this->
object->getQuestionblockQuestionIds($block_id) as $qid) {
370 $move_questions[] = $qid;
373 if (count($move_questions) === 0) {
374 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_question_selected_for_move"),
true);
375 $this->
ctrl->redirect($this,
"questions");
377 $this->edit_manager->setMoveSurveyQuestions($this->
object->getId(), $move_questions);
378 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"select_target_position_for_move_question"));
396 $copy = ($this->edit_manager->getQuestionClipboardMode($this->
object->getRefId()) ===
"copy");
403 $ids = $this->request->getIds();
404 if (count($ids) > 0) {
408 while (!$insert_id && count($ids) > 0) {
409 $target = array_shift($ids);
410 if (preg_match(
"/^cb_(\d+)$/", $target, $matches)) {
412 if (in_array($matches[1], $items[
"questions"])) {
413 $insert_id = $matches[1];
416 if (!$insert_id && preg_match(
"/^cb_qb_(\d+)$/", $target, $matches)) {
417 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
419 if ($insert_mode === 0) {
420 $insert_id = $ids[0];
421 } elseif ($insert_mode === 1) {
422 $insert_id = $ids[count($ids) - 1];
429 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_target_selected_for_move"),
true);
431 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
432 if ($this->edit_manager->getMoveSurveyId() === $this->
object->getId()) {
433 $this->
object->moveQuestions(
434 $this->edit_manager->getMoveSurveyQuestions(),
438 $this->edit_manager->clearMoveSurveyQuestions();
442 $this->
ctrl->redirect($this,
"questions");
448 if (count($items[
"blocks"]) + count($items[
"questions"]) + count($items[
"headings"]) > 0) {
449 $this->tpl->setOnScreenMessage(
'question', $this->
lng->txt(
"remove_questions"));
452 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_question_selected_for_removal"),
true);
453 $this->
ctrl->redirect($this,
"questions");
458 array $checked_questionblocks,
459 array $checked_questions,
460 array $checked_headings
463 $cgui->setHeaderText($this->
lng->txt(
"survey_sure_delete_questions"));
464 $cgui->setFormAction($this->
ctrl->getFormAction($this,
"confirmRemoveQuestions"));
465 $cgui->setCancel($this->
lng->txt(
"cancel"),
"questions");
466 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmRemoveQuestions");
467 $surveyquestions = $this->
object->getSurveyQuestions();
468 foreach ($surveyquestions as $question_id =>
$data) {
469 if (in_array(
$data[
"question_id"], $checked_questions)) {
474 $data[
"question_id"],
475 $type .
": " .
$data[
"title"]
477 } elseif ((in_array(
$data[
"questionblock_id"], $checked_questionblocks))) {
481 "cb[" .
$data[
"questionblock_id"] .
"]",
482 $data[
"questionblock_id"],
483 $data[
"questionblock_title"] .
" - " . $type .
": " .
$data[
"title"]
485 } elseif (in_array(
$data[
"question_id"], $checked_headings)) {
487 "heading[" .
$data[
"question_id"] .
"]",
488 $data[
"question_id"],
494 $this->tpl->setContent($cgui->getHTML());
499 $checked_questions = $this->request->getQuestionIds();
500 $checked_questionblocks = $this->request->getBlockIds();
501 $checked_headings = $this->request->getHeadings();
503 if (count($checked_questions) || count($checked_questionblocks)) {
504 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
506 if ($checked_headings) {
507 foreach ($checked_headings as $q_id) {
508 $this->
object->saveHeading(
"", $q_id);
511 $this->
object->saveCompletionStatus();
512 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"questions_removed"),
true);
513 $this->
ctrl->redirect($this,
"questions");
521 $copy_questions = $items[
"questions"];
522 foreach ($items[
"blocks"] as $block_id) {
523 foreach ($this->
object->getQuestionblockQuestionIds($block_id) as $qid) {
524 $copy_questions[] = $qid;
527 $copy_questions = array_unique($copy_questions);
530 if (count($copy_questions)) {
531 foreach ($copy_questions as $idx => $question_id) {
533 if ($question->getOriginalId()) {
534 unset($copy_questions[$idx]);
538 if (count($copy_questions) === 0) {
539 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_question_selected_for_copy_to_pool"),
true);
540 $this->
ctrl->redirect($this,
"questions");
546 $form->setFormAction($this->
ctrl->getFormAction($this,
"executeCreateQuestion"));
549 $ids->setValue(implode(
";", $copy_questions));
550 $form->addItem($ids);
552 $questionpools = $this->
object->getAvailableQuestionpools(
false,
false,
true,
"write");
553 $pools =
new ilSelectInputGUI($this->
lng->txt(
"survey_copy_select_questionpool"),
"sel_spl");
555 $form->addItem($pools);
557 $form->addCommandButton(
"executeCopyQuestionsToPool", $this->
lng->txt(
"submit"));
558 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
560 $this->tpl->setContent($form->getHTML());
566 $question_ids = $this->request->getQuestionIdsFromString();
569 foreach ($question_ids as $qid) {
572 $new_question->setId();
573 $new_question->setObjId($pool_id);
574 $new_question->saveToDb();
580 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"survey_copy_to_questionpool_success"),
true);
581 $this->
ctrl->redirect($this,
"questions");
591 $sel_question_types = null,
592 string $pgov_pos = null
594 if (!$this->
object->getPoolUsage()) {
603 if (is_null($sel_question_types)) {
604 $sel_question_types = $this->request->getSelectedQuestionTypes();
606 $this->
ctrl->setParameter($this,
"sel_question_types", $sel_question_types);
607 $form->setFormAction($this->
ctrl->getFormAction($this,
"executeCreateQuestion"));
615 $usage->addOption($no_pool);
616 $existing_pool =
new ilRadioOption($this->
lng->txt(
"survey_existing_pool"), 3);
617 $usage->addOption($existing_pool);
619 $usage->addOption($new_pool);
620 $form->addItem($usage);
622 if ($this->edit_manager->getPoolChoice() > 0) {
623 $usage->
setValue($this->edit_manager->getPoolChoice());
629 $questionpools = $this->
object->getAvailableQuestionpools(
false,
true,
true,
"write");
632 $existing_pool->addSubItem($pools);
636 $name->setMaxLength(50);
637 $new_pool->addSubItem($name);
643 $form->addCommandButton(
"executeCreateQuestion", $this->
lng->txt(
"submit"));
644 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
646 $this->tpl->setContent($form->getHTML());
651 ?
string $q_type = null,
652 ?
int $pool_usage = null,
653 ?
string $pgov_pos = null
655 $this->edit_manager->setPoolChoice($this->request->getPoolUsage());
657 if (is_null($q_type)) {
658 $q_type = $this->request->getSelectedQuestionTypes();
662 if (is_null($pgov_pos)) {
663 $pgov_pos = $this->request->getTargetQuestionPosition();
666 if (is_null($pool_usage)) {
667 $pool_usage = $this->request->getPoolUsage();
673 if ($pool_usage == 1) {
674 $obj_id = $this->
object->getId();
677 elseif ($pool_usage == 3 && $this->request->getSelectedPool() > 0) {
681 elseif ($pool_usage == 2 && $this->request->getPoolName() !==
"") {
685 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"),
true);
687 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"err_no_pool_name"),
true);
689 $this->
ctrl->setParameter($this,
"sel_question_types", $q_type);
690 $this->
ctrl->redirect($this,
"createQuestion");
697 $q_gui->object->setObjId($obj_id);
698 $q_gui->object->createNewQuestion();
699 $q_gui_class = get_class($q_gui);
702 $this->
ctrl->setParameterByClass($q_gui_class,
"pgov", $pgov);
703 $this->
ctrl->setParameterByClass($q_gui_class,
"pgov_pos", $pgov_pos);
706 $this->
ctrl->setParameterByClass($q_gui_class,
"ref_id", $this->
object->getRefId());
707 $this->
ctrl->setParameterByClass($q_gui_class,
"new_for_survey", $this->
object->getRefId());
708 $this->
ctrl->setParameterByClass($q_gui_class,
"q_id", $q_gui->object->getId());
709 $this->
ctrl->setParameterByClass($q_gui_class,
"sel_question_types", $q_gui->getQuestionType());
710 $this->
ctrl->redirectByClass($q_gui_class,
"editQuestion");
720 $qpl->setType(
"spl");
721 $qpl->setTitle($name);
722 $qpl->setDescription(
"");
724 $qpl->createReference();
725 $qpl->putInTree($parent_ref);
726 $qpl->setPermissions($parent_ref);
730 return $qpl->getId();
744 $link = $this->
ctrl->getLinkTarget($this,
"questions");
745 $ilTabs->setBackTarget($this->
lng->txt(
"menubacktosurvey"), $link);
750 1 => $this->
lng->txt(
"questions"),
751 2 => $this->
lng->txt(
"questionblocks")
753 $types->setValue($ilUser->getPref(
'svy_insert_type'));
754 $ilToolbar->addInputItem($types,
true);
755 $ilToolbar->addFormButton($this->
lng->txt(
"change"),
"changeDatatype");
756 $ilToolbar->setFormAction($this->
ctrl->getFormAction($this,
"changeDatatype"));
763 $ilUser->
writePref(
'svy_insert_type', $this->request->getDataType());
765 switch ($this->request->getDataType()) {
767 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
772 $this->
ctrl->redirect($this,
'browseForQuestions');
782 $table_gui->setEditable(
true);
783 $this->tpl->setContent($table_gui->getHTML());
789 $table_gui->writeFilterToSession();
790 $this->
ctrl->redirect($this,
'browseForQuestions');
796 $table_gui->resetFilter();
797 $this->
ctrl->redirect($this,
'browseForQuestions');
802 $inserted_objects = 0;
804 $qids = $this->request->getQuestionIds();
805 if (count($qids) > 0) {
806 foreach ($qids as $question_id) {
807 if ($this->requested_pgov ===
"") {
808 $this->
object->insertQuestion($question_id);
812 $page_gui->insertNewQuestion($question_id);
817 if ($inserted_objects) {
818 $this->
object->saveCompletionStatus();
819 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"questions_inserted"),
true);
820 $this->
ctrl->redirect($this,
"questions");
822 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"insert_missing_question"),
true);
823 $this->
ctrl->redirect($this,
'browseForQuestions');
832 $table_gui->setEditable(
true);
833 $this->tpl->setContent($table_gui->getHTML());
839 $table_gui->writeFilterToSession();
840 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
846 $table_gui->resetFilter();
847 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
852 $inserted_objects = 0;
854 $block_ids = $this->request->getBlockIds();
855 if (count($block_ids) > 0) {
856 foreach ($block_ids as $questionblock_id) {
857 if ($this->requested_pgov ===
"") {
858 $this->
object->insertQuestionblock($questionblock_id);
860 $page_gui->insertQuestionBlock($questionblock_id);
865 if ($inserted_objects) {
866 $this->
object->saveCompletionStatus();
867 $this->tpl->setOnScreenMessage(
'success', ($inserted_objects === 1) ? $this->
lng->txt(
"questionblock_inserted") : $this->
lng->txt(
"questionblocks_inserted"),
true);
868 $this->
ctrl->redirect($this,
"questions");
870 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"insert_missing_questionblock"),
true);
871 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
883 $block_id = $this->request->getBlockId();
884 $this->
ctrl->setParameter($this,
"bl_id", $block_id);
891 $this->tpl->setContent($a_form->getHTML());
901 $qids = $this->request->getQuestionIds();
902 if (count($qids) > 0) {
903 $items[
"questions"] = $qids;
905 if (count($items[
"questions"]) < 2) {
906 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"qpl_define_questionblock_select_missing"),
true);
907 $this->
ctrl->redirect($this,
"questions");
914 $this->tpl->setContent($a_form->getHTML());
918 ?
int $a_block_id = null,
919 ?array $a_question_ids = null
921 $questionblock = null;
923 $form->setFormAction($this->
ctrl->getFormAction($this,
"saveDefineQuestionblock"));
924 $form->setTitle($this->
lng->txt(
"define_questionblock"));
927 $title->setRequired(
true);
928 $form->addItem($title);
930 $toggle_blocktitle =
new ilCheckboxInputGUI($this->
lng->txt(
"survey_show_blocktitle"),
"show_blocktitle");
931 $toggle_blocktitle->setInfo($this->
lng->txt(
"survey_show_blocktitle_description"));
932 $form->addItem($toggle_blocktitle);
934 $toggle_questiontitle =
new ilCheckboxInputGUI($this->
lng->txt(
"show_questiontext"),
"show_questiontext");
935 $toggle_questiontitle->setInfo($this->
lng->txt(
"show_questiontext_description"));
936 $form->addItem($toggle_questiontitle);
940 $title->setValue($questionblock[
"title"]);
941 $toggle_blocktitle->setChecked((
bool) $questionblock[
"show_blocktitle"]);
942 $toggle_questiontitle->setChecked((
bool) $questionblock[
"show_questiontext"]);
944 $toggle_blocktitle->setChecked(
true);
945 $toggle_questiontitle->setChecked(
true);
949 $compress_view->setInfo($this->
lng->txt(
"svy_compress_view_info"));
950 $compress_view->setChecked((
bool) ($questionblock[
"compress_view"] ??
false));
951 $form->addItem($compress_view);
953 $form->addCommandButton(
"saveDefineQuestionblock", $this->
lng->txt(
"save"));
954 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
957 $qids = $this->request->getQuestionIds();
958 if (!$a_question_ids && count($qids) > 0) {
959 $a_question_ids = $qids;
962 if ($a_question_ids) {
963 foreach ($a_question_ids as $q_id) {
965 $hidden->setValue($q_id);
966 $form->addItem($hidden);
975 $block_id = $this->request->getBlockId();
976 $q_ids = $this->request->getQuestionIds();
978 $this->
ctrl->setParameter($this,
"bl_id", $block_id);
980 if (!$block_id && count($q_ids) === 0) {
981 $this->
ctrl->redirect($this,
"questions");
985 if ($form->checkInput()) {
986 $title = $form->getInput(
"title");
987 $show_questiontext = $form->getInput(
"show_questiontext");
988 $show_blocktitle = $form->getInput(
"show_blocktitle") ;
989 $compress_view = $form->getInput(
"compress_view") ;
991 $this->
object->modifyQuestionblock(
999 $this->
object->createQuestionblock(
1008 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
1009 $this->
ctrl->redirect($this,
"questions");
1012 $form->setValuesByPost();
1022 ?
int $a_question_id = null
1024 $survey_questions = $this->
object->getSurveyQuestions();
1027 $form->setFormAction($this->
ctrl->getFormAction($this,
""));
1032 $heading->setCols(80);
1034 $heading->setUseRte(
true);
1037 $heading->setRTESupport($this->
object->getId(),
"svy",
"survey");
1039 $heading->setRequired(
true);
1040 $form->addItem($heading);
1044 foreach ($survey_questions as
$key => $value) {
1045 $options[
$key] = $this->
lng->txt(
"before") .
": \"" . $value[
"title"] .
"\"";
1047 $insertbefore->setOptions($options);
1048 $insertbefore->setRequired(
true);
1049 $form->addItem($insertbefore);
1051 $form->addCommandButton(
"saveHeading", $this->
lng->txt(
"save"));
1052 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
1054 if ($a_question_id) {
1055 $form->setTitle($this->
lng->txt(
"edit_heading"));
1057 $heading->setValue($this->
object->prepareTextareaOutput($survey_questions[$a_question_id][
"heading"] ??
""));
1058 $insertbefore->setValue($a_question_id);
1059 $insertbefore->setDisabled(
true);
1061 $form->setTitle($this->
lng->txt(
"add_heading"));
1070 $q_id = $this->request->getQuestionId();
1071 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1079 $this->tpl->setContent($a_form->getHTML());
1085 $q_id = $this->request->getQuestionId();
1086 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1094 $this->tpl->setContent($a_form->getHTML());
1100 $q_id = $this->request->getQuestionId();
1101 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1104 if ($form->checkInput()) {
1105 $this->
object->saveHeading(
1107 $form->getInput(
"heading"),
1111 $form->getInput(
"insertbefore")
1113 $this->
ctrl->redirect($this,
"questions");
1116 $form->setValuesByPost();
1122 $q_id = $this->request->getQuestionId();
1123 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1126 $this->
ctrl->redirect($this,
"questions");
1132 $cgui->setHeaderText($this->
lng->txt(
"confirm_remove_heading"));
1134 $cgui->setFormAction($this->
ctrl->getFormAction($this,
"confirmedRemoveHeading"));
1135 $cgui->setCancel($this->
lng->txt(
"cancel"),
"questions");
1136 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmedRemoveHeading");
1138 $this->tpl->setContent($cgui->getHTML());
1143 $q_id = $this->request->getQuestionId();
1145 $this->
ctrl->redirect($this,
"questions");
1148 $this->
object->saveHeading(
"", $q_id);
1149 $this->
ctrl->redirect($this,
"questions");
1154 $print_view = $this->print->page($this->
object->getRefId());
1155 $print_view->sendPrintView();
1160 $view = $this->print->list($this->
object->getRefId());
1166 $print_view = $this->print->list($this->
object->getRefId());
1167 $print_view->sendPrintView();
1172 $id = $this->request->getQuestionId();
1174 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"survey_questions_to_clipboard_copy"),
true);
1177 $this->edit_manager->setQuestionClipboard(
1178 $this->
object->getRefId(),
1183 $this->
ctrl->redirect($this,
"questions");
1193 $ids = $this->request->getIds();
1194 if (count($ids) > 0) {
1195 if (substr($ids[0], 0, 3) ==
"cb_") {
1196 $a_id = (
int) substr($ids[0], 3);
1199 if (is_null($a_id)) {
1203 $qids = $this->edit_manager->getQuestionClipboardQuestions($this->
object->getRefId());
1204 $mode = $this->edit_manager->getQuestionClipboardMode($this->
object->getRefId());
1205 $pages = $this->
object->getSurveyPages();
1207 foreach ($pages as $page) {
1208 foreach ($page as $question) {
1209 if ($question[
"question_id"] === $a_id) {
1214 if (is_null($target)) {
1218 if ($mode !==
"copy") {
1223 foreach ($this->
object->getSurveyPages() as $page) {
1224 foreach ($page as $question) {
1225 $titles[] = $question[
"title"];
1230 $question_pointer = array();
1231 foreach ($qids as $qid) {
1236 $title = $question->getTitle();
1238 foreach ($titles as $existing_title) {
1239 #21278 preg_quote with delimiter 1240 if (preg_match(
"/" . preg_quote($title,
"/") .
" \(([0-9]+)\)$/", $existing_title, $match)) {
1241 $max = max($match[1], $max);
1245 $title .=
" (" . ($max + 1) .
")";
1250 $question->setTitle($title);
1253 $question->saveToDb();
1255 $question_pointer[$qid] = $question->getId();
1256 $this->sequence_manager->appendQuestion($question->getId(),
false);
1260 $this->
object->cloneTextblocks($question_pointer);
1262 $this->
object->loadQuestionsFromDb();
1264 $nodes = array_values($question_pointer);
1270 if (count($target) === 1) {
1271 $this->
object->moveQuestions($nodes, $a_id, $pos);
1275 $target_block_id = $target;
1276 $target_block_id = array_shift($target_block_id);
1277 $target_block_id = $target_block_id[
"questionblock_id"];
1279 foreach ($nodes as $qid) {
1280 $this->
object->addQuestionToBlock($qid, $target_block_id);
1284 $this->
object->moveQuestions($nodes, $a_id, $pos);
1288 $this->
ctrl->redirect($this,
"questions");
1293 $this->edit_manager->clearQuestionClipboard($this->
object->getRefId());
1299 return $lng->
txt(
"survey_auto_block_title");
resetfilterQuestionBrowserObject()
copyQuestionsToPoolObject()
setRequestedPgov(string $pgov)
initHeadingForm(?int $a_question_id=null)
createQuestionObject(ilPropertyFormGUI $a_form=null, $sel_question_types=null, string $pgov_pos=null)
confirmedRemoveHeadingObject()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
confirmRemoveQuestionsObject()
editHeadingObject(ilPropertyFormGUI $a_form=null)
ILIAS HTTP Services $http
copyPasteObject($pos=0)
Paste from clipboard.
insertQuestionsBeforeObject()
setBrowseForQuestionsSubtabs()
static _hasDatasets(int $survey_id)
writePref(string $a_keyword, string $a_value)
printListViewSelectionObject()
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...
Class ilObjSurveyQuestionPool.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
ILIAS Survey PrintView GUIService $print
insertQuestions(int $insert_mode)
ilObjSurveyGUI $parent_gui
insertQuestionsAfterObject()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
resetfilterQuestionblockBrowserObject()
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _getQuestionblock(int $questionblock_id)
get question block properties
removeQuestionsForm(array $checked_questionblocks, array $checked_questions, array $checked_headings)
addHeadingObject(ilPropertyFormGUI $a_form=null)
initQuestionblockForm(?int $a_block_id=null, ?array $a_question_ids=null)
executeCreateQuestionObject(?string $q_type=null, ?int $pool_usage=null, ?string $pgov_pos=null)
executeCopyQuestionsToPoolObject()
static _changeOriginalId(int $a_question_id, int $a_original_id, int $a_object_id)
Change original id of existing question in db.
ilGlobalTemplateInterface $tpl
EditingGUIRequest $request
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
editQuestionblockObject(ilPropertyFormGUI $a_form=null)
questionsSubtabs(string $a_cmd)
createQuestionblockObject(ilPropertyFormGUI $a_form=null)
gatherSelectedTableItems(bool $allow_blocks=true, bool $allow_questions=true, bool $allow_headings=false, bool $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
static _lookupObjId(int $ref_id)
createQuestionPool($name="dummy")
static _getQuestionGUI(?string $questiontype, int $question_id=-1)
Creates a question gui representation.
static http()
Fetches the global http state from ILIAS.
EditManager $edit_manager
static _instanciateQuestion(int $question_id)
Creates an instance of a question with a given question id.
const ILIAS_IMG_MANAGER_PLUGIN
setScreenIdComponent(string $a_comp)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValue(string $a_value)
saveDefineQuestionblockObject()
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
getParentId(int $a_node_id)
get parent id of given node
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
browseForQuestionsObject()
ILIAS Survey InternalGUIService $gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
unfoldQuestionblockObject()
This class represents a text area property in a property form.
static _getQuestiontypes()
Get all available question types.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
browseForQuestionblocksObject()
insertQuestionblocksObject()
filterQuestionBrowserObject()
ILIAS Survey Sequence SequenceManager $sequence_manager
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
filterQuestionblockBrowserObject()