33 protected \ILIAS\Survey\PrintView\GUIService
$print;
34 protected \ILIAS\HTTP\Services
$http;
35 protected \ILIAS\DI\UIServices
$ui;
55 $this->
tabs = $DIC->tabs();
56 $this->
help = $DIC[
"ilHelp"];
57 $this->
toolbar = $DIC->toolbar();
58 $this->
user = $DIC->user();
59 $this->tree = $DIC->repositoryTree();
60 $ilCtrl = $DIC->ctrl();
61 $lng = $DIC->language();
64 $this->parent_gui = $a_parent_gui;
67 $this->
object = $survey;
69 $this->
ctrl = $ilCtrl;
73 $this->
ctrl->saveParameter($this, array(
"pgov",
"pgov_pos"));
75 $this->print_options = array(
81 $this->edit_manager = $DIC->survey()
85 $this->request = $DIC->survey()
90 $this->requested_pgov = $this->request->getTargetPosition();
91 $this->
ui = $DIC->ui();
92 $this->
http = $DIC->http();
93 $this->print = $DIC->survey()
97 $this->sequence_manager = $DIC->survey()->internal()->domain()->sequence(
98 $this->
object->getSurveyId(),
105 $this->requested_pgov = $pgov;
112 $cmd = $this->
ctrl->getCmd(
"questions");
114 if ($this->requested_pgov !==
"") {
115 if ($cmd ===
"questions") {
116 $this->
ctrl->setCmdClass(
"ilSurveyPageEditGUI");
117 $this->
ctrl->setCmd(
"renderpage");
118 } elseif ($cmd ===
"confirmRemoveQuestions") {
120 $this->
ctrl->setCmdClass(
"ilSurveyPageEditGUI");
121 $this->
ctrl->setCmd(
"confirmRemoveQuestions");
125 $next_class = $this->
ctrl->getNextClass($this);
126 switch ($next_class) {
127 case 'ilsurveypageeditgui':
130 $this->
ctrl->forwardCommand($pg);
135 if (stripos($next_class,
"questiongui") !==
false) {
136 $ilTabs->clearTargets();
137 $this->
ctrl->saveParameter($this, array(
"new_for_survey"));
140 $this->request->getQuestionId()
142 if (is_object($q_gui->object)) {
147 $q_gui->setBackUrl($this->
ctrl->getLinkTarget($this,
"questions"));
148 $q_gui->setQuestionTabs();
149 $this->
ctrl->forwardCommand($q_gui);
151 if (!$this->request->getNewForSurvey()) {
153 $this->tpl->setTitle($this->
lng->txt(
"question") .
": " . $q_gui->object->getTitle());
168 if ($a_cmd ===
"questions" && $this->requested_pgov !==
"") {
174 $this->
lng->txt(
"survey_per_page_view"),
175 $this->
ctrl->getLinkTargetByClass(
"ilSurveyPageEditGUI",
"renderPage")
178 $this->
ctrl->setParameter($this,
"pgov",
"");
181 $this->
lng->txt(
"survey_question_editor"),
182 $this->
ctrl->getLinkTarget($this,
"questions")
184 $this->
ctrl->setParameter($this,
"pgov", $this->requested_pgov);
186 if ($this->
object->getSurveyPages()) {
187 if ($a_cmd ===
"page") {
188 $this->
ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"pgov", max(1, $this->request->getPage()));
190 $this->
ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"prvw", 1);
193 $this->
lng->txt(
"preview"),
194 $this->
ctrl->getLinkTargetByClass(array(
"ilobjsurveygui",
"ilsurveyexecutiongui"),
"preview")
198 $ilTabs->activateSubTab($a_cmd);
212 if ($this->request->getNewId() > 0) {
214 $existing = $this->
object->getExistingQuestions();
215 if (!in_array($this->request->getNewId(), $existing)) {
216 $inserted = $this->
object->insertQuestion($this->request->getNewId());
218 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_error_insert_incomplete_question"));
221 $this->
ctrl->redirect($this,
"questions");
228 $read_only = $hasDatasets;
234 $qtypes[
$data[
"type_tag"]] = $translation;
237 $ilToolbar->setFormAction($this->
ctrl->getFormAction($this));
239 $types->setOptions($qtypes);
240 $ilToolbar->addStickyItem($types,
"");
243 $button->setCaption(
"svy_create_question");
244 $button->setCommand(
"createQuestion");
245 $ilToolbar->addStickyItem($button);
247 if ($this->
object->getPoolUsage()) {
248 $cmd = ((
int)
$ilUser->getPref(
'svy_insert_type') === 1 ||
249 (
$ilUser->getPref(
'svy_insert_type') ??
'') ===
'')
250 ?
'browseForQuestions' 251 :
'browseForQuestionblocks';
254 $button->setCaption(
"browse_for_questions");
255 $button->setUrl($this->
ctrl->getLinkTarget($this, $cmd));
256 $ilToolbar->addStickyItem($button);
259 $ilToolbar->addSeparator();
262 $button->setCaption(
"add_heading");
263 $button->setUrl($this->
ctrl->getLinkTarget($this,
"addHeading"));
264 $ilToolbar->addInputItem($button);
266 $ilToolbar->addSeparator();
267 $print_view = $this->print->list($this->
object->getRefId());
268 $modal_elements = $print_view->getModalElements(
269 $this->
ctrl->getLinkTarget(
271 "printListViewSelection" 274 $ilToolbar->addComponent($modal_elements->button);
275 $ilToolbar->addComponent($modal_elements->modal);
280 $mess = $mbox->getHTML();
290 $this->tpl->setContent($mess . $table->getHTML());
298 bool $allow_blocks =
true,
299 bool $allow_questions =
true,
300 bool $allow_headings =
false,
301 bool $allow_questions_in_blocks =
false 303 $block_map = array();
304 foreach ($this->
object->getSurveyQuestions() as $item) {
305 $block_map[$item[
"question_id"]] = $item[
"questionblock_id"];
308 $questions = $blocks = $headings = array();
309 $ids = $this->request->getIds();
310 if (count($ids) > 0) {
311 foreach ($ids as
$key) {
313 if ($allow_questions && preg_match(
"/cb_(\d+)/", $key, $matches)) {
314 if (($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
315 !in_array($block_map[$matches[1]], $blocks)) {
316 $questions[] = $matches[1];
320 if ($allow_blocks && preg_match(
"/cb_qb_(\d+)/", $key, $matches)) {
321 $blocks[] = $matches[1];
324 if ($allow_headings && preg_match(
"/cb_tb_(\d+)/", $key, $matches)) {
325 $headings[] = $matches[1];
330 return array(
"questions" => $questions,
332 "headings" => $headings);
337 $req_order = $this->request->getOrder();
338 $req_block_order = $this->request->getBlockOrder();
339 if (count($req_order) > 0) {
343 foreach (array_keys($req_order) as
$id) {
345 if (strpos($id,
"qb_") === 0) {
346 $block_id = substr($id, 3);
347 $block = $req_block_order[$block_id];
349 foreach (array_keys($block) as $question_id) {
351 $order[$question_id] = $position;
354 $question_id = substr($id, 2);
356 $order[$question_id] = $position;
359 $this->
object->updateOrder($order);
362 $obligatory = $this->request->getObligatory();
363 $this->
object->setObligatoryStates($obligatory);
364 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
365 $this->
ctrl->redirect($this,
"questions");
371 if (count($items[
"blocks"])) {
372 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
373 $this->
object->unfoldQuestionblocks($items[
"blocks"]);
375 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"qpl_unfold_select_none"),
true);
377 $this->
ctrl->redirect($this,
"questions");
384 $move_questions = $items[
"questions"];
385 foreach ($items[
"blocks"] as $block_id) {
386 foreach ($this->
object->getQuestionblockQuestionIds($block_id) as $qid) {
387 $move_questions[] = $qid;
390 if (count($move_questions) === 0) {
391 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_question_selected_for_move"),
true);
392 $this->
ctrl->redirect($this,
"questions");
394 $this->edit_manager->setMoveSurveyQuestions($this->
object->getId(), $move_questions);
395 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"select_target_position_for_move_question"));
414 $ids = $this->request->getIds();
415 if (count($ids) > 0) {
419 while (!$insert_id && count($ids) > 0) {
420 $target = array_shift($ids);
421 if (preg_match(
"/^cb_(\d+)$/", $target, $matches)) {
423 if (in_array($matches[1], $items[
"questions"])) {
424 $insert_id = $matches[1];
427 if (!$insert_id && preg_match(
"/^cb_qb_(\d+)$/", $target, $matches)) {
428 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
430 if ($insert_mode === 0) {
431 $insert_id = $ids[0];
432 } elseif ($insert_mode === 1) {
433 $insert_id = $ids[count($ids) - 1];
441 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_target_selected_for_move"),
true);
443 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
444 if ($this->edit_manager->getMoveSurveyId() === $this->
object->getId()) {
445 $this->
object->moveQuestions(
446 $this->edit_manager->getMoveSurveyQuestions(),
450 $this->edit_manager->clearMoveSurveyQuestions();
454 $this->
ctrl->redirect($this,
"questions");
460 if (count($items[
"blocks"]) + count($items[
"questions"]) + count($items[
"headings"]) > 0) {
461 $this->tpl->setOnScreenMessage(
'question', $this->
lng->txt(
"remove_questions"));
464 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_question_selected_for_removal"),
true);
465 $this->
ctrl->redirect($this,
"questions");
470 array $checked_questionblocks,
471 array $checked_questions,
472 array $checked_headings
475 $cgui->setHeaderText($this->
lng->txt(
"survey_sure_delete_questions"));
476 $cgui->setFormAction($this->
ctrl->getFormAction($this,
"confirmRemoveQuestions"));
477 $cgui->setCancel($this->
lng->txt(
"cancel"),
"questions");
478 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmRemoveQuestions");
479 $surveyquestions = $this->
object->getSurveyQuestions();
480 foreach ($surveyquestions as $question_id =>
$data) {
481 if (in_array(
$data[
"question_id"], $checked_questions)) {
486 $data[
"question_id"],
489 } elseif ((in_array(
$data[
"questionblock_id"], $checked_questionblocks))) {
493 "cb[" .
$data[
"questionblock_id"] .
"]",
494 $data[
"questionblock_id"],
497 } elseif (in_array(
$data[
"question_id"], $checked_headings)) {
499 "heading[" .
$data[
"question_id"] .
"]",
500 $data[
"question_id"],
506 $this->tpl->setContent($cgui->getHTML());
511 $checked_questions = $this->request->getQuestionIds();
512 $checked_questionblocks = $this->request->getBlockIds();
513 $checked_headings = $this->request->getHeadings();
515 if (count($checked_questions) || count($checked_questionblocks)) {
516 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
518 if ($checked_headings) {
519 foreach ($checked_headings as $q_id) {
520 $this->
object->saveHeading(
"", $q_id);
523 $this->
object->saveCompletionStatus();
524 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"questions_removed"),
true);
525 $this->
ctrl->redirect($this,
"questions");
533 $copy_questions = $items[
"questions"];
534 foreach ($items[
"blocks"] as $block_id) {
535 foreach ($this->
object->getQuestionblockQuestionIds($block_id) as $qid) {
536 $copy_questions[] = $qid;
539 $copy_questions = array_unique($copy_questions);
542 if (count($copy_questions)) {
543 foreach ($copy_questions as $idx => $question_id) {
545 if ($question->getOriginalId()) {
546 unset($copy_questions[$idx]);
550 if (count($copy_questions) === 0) {
551 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_question_selected_for_copy_to_pool"),
true);
552 $this->
ctrl->redirect($this,
"questions");
558 $form->setFormAction($this->
ctrl->getFormAction($this,
"executeCreateQuestion"));
561 $ids->setValue(implode(
";", $copy_questions));
562 $form->addItem($ids);
564 $questionpools = $this->
object->getAvailableQuestionpools(
false,
false,
true,
"write");
565 $pools =
new ilSelectInputGUI($this->
lng->txt(
"survey_copy_select_questionpool"),
"sel_spl");
566 $pools->setOptions($questionpools);
567 $form->addItem($pools);
569 $form->addCommandButton(
"executeCopyQuestionsToPool", $this->
lng->txt(
"submit"));
570 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
572 $this->tpl->setContent($form->getHTML());
578 $question_ids = $this->request->getQuestionIdsFromString();
581 foreach ($question_ids as $qid) {
584 $new_question->setId();
585 $new_question->setObjId($pool_id);
586 $new_question->saveToDb();
592 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"survey_copy_to_questionpool_success"),
true);
593 $this->
ctrl->redirect($this,
"questions");
603 $sel_question_types = null,
604 string $pgov_pos = null
606 if (!$this->
object->getPoolUsage()) {
615 if (is_null($sel_question_types)) {
616 $sel_question_types = $this->request->getSelectedQuestionTypes();
618 $this->
ctrl->setParameter($this,
"sel_question_types", $sel_question_types);
619 $form->setFormAction($this->
ctrl->getFormAction($this,
"executeCreateQuestion"));
627 $usage->addOption($no_pool);
628 $existing_pool =
new ilRadioOption($this->
lng->txt(
"survey_existing_pool"), 3);
629 $usage->addOption($existing_pool);
631 $usage->addOption($new_pool);
632 $form->addItem($usage);
634 if ($this->edit_manager->getPoolChoice() > 0) {
635 $usage->
setValue($this->edit_manager->getPoolChoice());
641 $questionpools = $this->
object->getAvailableQuestionpools(
false,
true,
true,
"write");
643 $pools->setOptions($questionpools);
644 $existing_pool->addSubItem($pools);
648 $name->setMaxLength(50);
649 $new_pool->addSubItem(
$name);
655 $form->addCommandButton(
"executeCreateQuestion", $this->
lng->txt(
"submit"));
656 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
658 $this->tpl->setContent($form->getHTML());
663 ?
string $q_type = null,
664 ?
int $pool_usage = null,
665 ?
string $pgov_pos = null
667 $this->edit_manager->setPoolChoice($this->request->getPoolUsage());
669 if (is_null($q_type)) {
670 $q_type = $this->request->getSelectedQuestionTypes();
674 if (is_null($pgov_pos)) {
675 $pgov_pos = $this->request->getTargetQuestionPosition();
678 if (is_null($pool_usage)) {
679 $pool_usage = $this->request->getPoolUsage();
685 if ($pool_usage == 1) {
686 $obj_id = $this->
object->getId();
689 elseif ($pool_usage == 3 && $this->request->getSelectedPool() > 0) {
693 elseif ($pool_usage == 2 && $this->request->getPoolName() !==
"") {
697 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"),
true);
699 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"err_no_pool_name"),
true);
701 $this->
ctrl->setParameter($this,
"sel_question_types", $q_type);
702 $this->
ctrl->redirect($this,
"createQuestion");
709 $q_gui->object->setObjId($obj_id);
710 $q_gui->object->createNewQuestion();
711 $q_gui_class = get_class($q_gui);
714 $this->
ctrl->setParameterByClass($q_gui_class,
"pgov", $pgov);
715 $this->
ctrl->setParameterByClass($q_gui_class,
"pgov_pos", $pgov_pos);
718 $this->
ctrl->setParameterByClass($q_gui_class,
"ref_id", $this->
object->getRefId());
719 $this->
ctrl->setParameterByClass($q_gui_class,
"new_for_survey", $this->
object->getRefId());
720 $this->
ctrl->setParameterByClass($q_gui_class,
"q_id", $q_gui->object->getId());
721 $this->
ctrl->setParameterByClass($q_gui_class,
"sel_question_types", $q_gui->getQuestionType());
722 $this->
ctrl->redirectByClass($q_gui_class,
"editQuestion");
732 $qpl->setType(
"spl");
733 $qpl->setTitle(
$name);
734 $qpl->setDescription(
"");
736 $qpl->createReference();
737 $qpl->putInTree($parent_ref);
738 $qpl->setPermissions($parent_ref);
742 return $qpl->getId();
756 if ($this->requested_pgov ===
"") {
757 $link = $this->
ctrl->getLinkTarget($this,
"questions");
759 $link = $this->
ctrl->getLinkTargetByClass(
"ilSurveyPageEditGUI",
"renderpage");
761 $ilTabs->setBackTarget($this->
lng->txt(
"menubacktosurvey"), $link);
765 $types->setOptions(array(
766 1 => $this->
lng->txt(
"questions"),
767 2 => $this->
lng->txt(
"questionblocks")
769 $types->setValue(
$ilUser->getPref(
'svy_insert_type'));
770 $ilToolbar->addInputItem($types,
true);
771 $ilToolbar->addFormButton($this->
lng->txt(
"change"),
"changeDatatype");
772 $ilToolbar->setFormAction($this->
ctrl->getFormAction($this,
"changeDatatype"));
779 $ilUser->writePref(
'svy_insert_type', $this->request->getDataType());
781 switch ($this->request->getDataType()) {
783 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
788 $this->
ctrl->redirect($this,
'browseForQuestions');
798 $table_gui->setEditable(
true);
799 $this->tpl->setContent($table_gui->getHTML());
805 $table_gui->writeFilterToSession();
806 $this->
ctrl->redirect($this,
'browseForQuestions');
812 $table_gui->resetFilter();
813 $this->
ctrl->redirect($this,
'browseForQuestions');
818 $inserted_objects = 0;
820 $qids = $this->request->getQuestionIds();
821 if (count($qids) > 0) {
822 if ($this->requested_pgov !==
"") {
824 $page_gui->determineCurrentPage();
827 $qids = array_reverse($qids);
829 foreach ($qids as $question_id) {
830 if ($this->requested_pgov ===
"") {
831 $this->
object->insertQuestion($question_id);
835 $page_gui->insertNewQuestion($question_id);
840 if ($inserted_objects) {
841 $this->
object->saveCompletionStatus();
842 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"questions_inserted"),
true);
843 if ($this->requested_pgov ===
"") {
844 $this->
ctrl->redirect($this,
"questions");
847 if (substr($this->request->getTargetQuestionPosition(), -1) ===
"c") {
849 if ((
int) $this->request->getTargetQuestionPosition()) {
855 $this->
ctrl->setParameterByClass(
"ilSurveyPageEditGUI",
"pgov", $target_page);
856 $this->
ctrl->redirectByClass(
"ilSurveyPageEditGUI",
"renderpage");
859 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"insert_missing_question"),
true);
860 $this->
ctrl->redirect($this,
'browseForQuestions');
869 $table_gui->setEditable(
true);
870 $this->tpl->setContent($table_gui->getHTML());
876 $table_gui->writeFilterToSession();
877 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
883 $table_gui->resetFilter();
884 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
889 $inserted_objects = 0;
891 $block_ids = $this->request->getBlockIds();
892 if (count($block_ids) > 0) {
893 if ($this->requested_pgov !==
"") {
895 $page_gui->determineCurrentPage();
898 $block_ids = array_reverse($block_ids);
900 foreach ($block_ids as $questionblock_id) {
901 if ($this->requested_pgov ===
"") {
902 $this->
object->insertQuestionblock($questionblock_id);
904 $page_gui->insertQuestionBlock($questionblock_id);
909 if ($inserted_objects) {
910 $this->
object->saveCompletionStatus();
911 $this->tpl->setOnScreenMessage(
'success', ($inserted_objects === 1) ? $this->
lng->txt(
"questionblock_inserted") : $this->
lng->txt(
"questionblocks_inserted"),
true);
912 if ($this->requested_pgov ===
"") {
913 $this->
ctrl->redirect($this,
"questions");
916 if (substr($this->request->getTargetQuestionPosition(), -1) ===
"c") {
919 $this->
ctrl->setParameterByClass(
"ilSurveyPageEditGUI",
"pgov", $target_page);
920 $this->
ctrl->redirectByClass(
"ilSurveyPageEditGUI",
"renderpage");
923 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"insert_missing_questionblock"),
true);
924 $this->
ctrl->redirect($this,
'browseForQuestionblocks');
936 $block_id = $this->request->getBlockId();
937 $this->
ctrl->setParameter($this,
"bl_id", $block_id);
944 $this->tpl->setContent($a_form->getHTML());
954 $qids = $this->request->getQuestionIds();
955 if (count($qids) > 0) {
956 $items[
"questions"] = $qids;
958 if (count($items[
"questions"]) < 2) {
959 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"qpl_define_questionblock_select_missing"),
true);
960 $this->
ctrl->redirect($this,
"questions");
967 $this->tpl->setContent($a_form->getHTML());
971 ?
int $a_block_id = null,
972 ?array $a_question_ids = null
974 $questionblock = null;
976 $form->setFormAction($this->
ctrl->getFormAction($this,
"saveDefineQuestionblock"));
977 $form->setTitle($this->
lng->txt(
"define_questionblock"));
980 $title->setRequired(
true);
981 $form->addItem($title);
983 $toggle_blocktitle =
new ilCheckboxInputGUI($this->
lng->txt(
"survey_show_blocktitle"),
"show_blocktitle");
984 $toggle_blocktitle->
setInfo($this->
lng->txt(
"survey_show_blocktitle_description"));
985 $form->addItem($toggle_blocktitle);
987 $toggle_questiontitle =
new ilCheckboxInputGUI($this->
lng->txt(
"show_questiontext"),
"show_questiontext");
988 $toggle_questiontitle->
setInfo($this->
lng->txt(
"show_questiontext_description"));
989 $form->addItem($toggle_questiontitle);
993 $title->setValue($questionblock[
"title"]);
994 $toggle_blocktitle->setChecked((
bool) $questionblock[
"show_blocktitle"]);
995 $toggle_questiontitle->setChecked((
bool) $questionblock[
"show_questiontext"]);
997 $toggle_blocktitle->setChecked(
true);
998 $toggle_questiontitle->setChecked(
true);
1002 $compress_view->
setInfo($this->
lng->txt(
"svy_compress_view_info"));
1003 $compress_view->setChecked((
bool) ($questionblock[
"compress_view"] ??
false));
1004 $form->addItem($compress_view);
1006 $form->addCommandButton(
"saveDefineQuestionblock", $this->
lng->txt(
"save"));
1007 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
1010 $qids = $this->request->getQuestionIds();
1011 if (!$a_question_ids && count($qids) > 0) {
1012 $a_question_ids = $qids;
1015 if ($a_question_ids) {
1016 foreach ($a_question_ids as $q_id) {
1018 $hidden->setValue($q_id);
1019 $form->addItem($hidden);
1028 $block_id = $this->request->getBlockId();
1029 $q_ids = $this->request->getQuestionIds();
1031 $this->
ctrl->setParameter($this,
"bl_id", $block_id);
1033 if (!$block_id && count($q_ids) === 0) {
1034 $this->
ctrl->redirect($this,
"questions");
1038 if ($form->checkInput()) {
1039 $title = $form->getInput(
"title");
1040 $show_questiontext = $form->getInput(
"show_questiontext");
1041 $show_blocktitle = $form->getInput(
"show_blocktitle") ;
1042 $compress_view = $form->getInput(
"compress_view") ;
1044 $this->
object->modifyQuestionblock(
1052 $this->
object->createQuestionblock(
1061 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
1062 $this->
ctrl->redirect($this,
"questions");
1065 $form->setValuesByPost();
1075 ?
int $a_question_id = null
1077 $survey_questions = $this->
object->getSurveyQuestions();
1080 $form->setFormAction($this->
ctrl->getFormAction($this,
""));
1085 $heading->setCols(80);
1087 $heading->setUseRte(
true);
1090 $heading->setRTESupport($this->
object->getId(),
"svy",
"survey");
1092 $heading->setRequired(
true);
1093 $form->addItem($heading);
1097 foreach ($survey_questions as
$key => $value) {
1098 $options[
$key] = $this->
lng->txt(
"before") .
": \"" . $value[
"title"] .
"\"";
1100 $insertbefore->setOptions($options);
1101 $insertbefore->setRequired(
true);
1102 $form->addItem($insertbefore);
1104 $form->addCommandButton(
"saveHeading", $this->
lng->txt(
"save"));
1105 $form->addCommandButton(
"questions", $this->
lng->txt(
"cancel"));
1107 if ($a_question_id) {
1108 $form->setTitle($this->
lng->txt(
"edit_heading"));
1110 $heading->setValue($this->
object->prepareTextareaOutput($survey_questions[$a_question_id][
"heading"] ??
""));
1111 $insertbefore->setValue($a_question_id);
1112 $insertbefore->setDisabled(
true);
1114 $form->setTitle($this->
lng->txt(
"add_heading"));
1123 $q_id = $this->request->getQuestionId();
1124 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1132 $this->tpl->setContent($a_form->getHTML());
1138 $q_id = $this->request->getQuestionId();
1139 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1147 $this->tpl->setContent($a_form->getHTML());
1153 $q_id = $this->request->getQuestionId();
1154 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1157 if ($form->checkInput()) {
1158 $this->
object->saveHeading(
1160 $form->getInput(
"heading"),
1164 $form->getInput(
"insertbefore")
1166 $this->
ctrl->redirect($this,
"questions");
1169 $form->setValuesByPost();
1175 $q_id = $this->request->getQuestionId();
1176 $this->
ctrl->setParameter($this,
"q_id", $q_id);
1179 $this->
ctrl->redirect($this,
"questions");
1185 $cgui->setHeaderText($this->
lng->txt(
"confirm_remove_heading"));
1187 $cgui->setFormAction($this->
ctrl->getFormAction($this,
"confirmedRemoveHeading"));
1188 $cgui->setCancel($this->
lng->txt(
"cancel"),
"questions");
1189 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmedRemoveHeading");
1191 $this->tpl->setContent($cgui->getHTML());
1196 $q_id = $this->request->getQuestionId();
1198 $this->
ctrl->redirect($this,
"questions");
1201 $this->
object->saveHeading(
"", $q_id);
1202 $this->
ctrl->redirect($this,
"questions");
1207 $print_view = $this->print->page($this->
object->getRefId());
1208 $print_view->sendPrintView();
1213 $view = $this->print->list($this->
object->getRefId());
1219 $print_view = $this->print->list($this->
object->getRefId());
1220 $print_view->sendPrintView();
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
insertQuestionsBeforeObject()
setBrowseForQuestionsSubtabs()
static _hasDatasets(int $survey_id)
printListViewSelectionObject()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
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()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
unfoldQuestionblockObject()
__construct(Container $dic, ilPlugin $plugin)
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()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...