ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilSurveyEditorGUI Class Reference

Class ilSurveyEditorGUI. More...

+ Collaboration diagram for ilSurveyEditorGUI:

Public Member Functions

 setRequestedPgov (string $pgov)
 
 executeCommand ()
 
 questionsObject ()
 
 saveObligatoryObject ()
 
 unfoldQuestionblockObject ()
 
 moveQuestionsObject ()
 
 insertQuestionsBeforeObject ()
 
 insertQuestionsAfterObject ()
 
 removeQuestionsObject ()
 
 removeQuestionsForm (array $checked_questionblocks, array $checked_questions, array $checked_headings)
 
 confirmRemoveQuestionsObject ()
 
 copyQuestionsToPoolObject ()
 
 executeCopyQuestionsToPoolObject ()
 
 createQuestionObject (?ilPropertyFormGUI $a_form=null, $sel_question_types=null, ?string $pgov_pos=null)
 
 executeCreateQuestionObject (?string $q_type=null, ?int $pool_usage=null, ?string $pgov_pos=null)
 
 changeDatatypeObject ()
 
 browseForQuestionsObject ()
 
 filterQuestionBrowserObject ()
 
 resetfilterQuestionBrowserObject ()
 
 insertQuestionsObject ()
 
 browseForQuestionblocksObject ()
 
 filterQuestionblockBrowserObject ()
 
 resetfilterQuestionblockBrowserObject ()
 
 insertQuestionblocksObject ()
 
 editQuestionblockObject (?ilPropertyFormGUI $a_form=null)
 
 createQuestionblockObject (?ilPropertyFormGUI $a_form=null)
 
 saveDefineQuestionblockObject ()
 
 addHeadingObject (?ilPropertyFormGUI $a_form=null)
 
 editHeadingObject (?ilPropertyFormGUI $a_form=null)
 
 saveHeadingObject ()
 
 removeHeadingObject ()
 
 confirmedRemoveHeadingObject ()
 
 printViewObject ()
 
 printListViewSelectionObject ()
 
 printListViewObject ()
 
 getAutoBlockTitle ()
 

Protected Member Functions

 questionsSubtabs (string $a_cmd)
 
 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. More...
 
 insertQuestions (int $insert_mode)
 
 createQuestionPool ($name="dummy")
 
 setBrowseForQuestionsSubtabs ()
 
 initQuestionblockForm (?int $a_block_id=null, ?array $a_question_ids=null)
 
 initHeadingForm (?int $a_question_id=null)
 
 copyQuestionObject ()
 
 copyPasteObject ($pos=0)
 Paste from clipboard. More...
 
 clearClipboard ()
 

Protected Attributes

ILIAS Survey Sequence SequenceManager $sequence_manager
 
ILIAS Survey InternalGUIService $gui
 
ILIAS Survey PrintView GUIService $print
 
ILIAS HTTP Services $http
 
ILIAS DI UIServices $ui
 
string $requested_pgov
 
EditingGUIRequest $request
 
EditManager $edit_manager
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
ilHelpGUI $help
 
ilToolbarGUI $toolbar
 
ilObjUser $user
 
ilTree $tree
 
ilObjSurveyGUI $parent_gui
 
ilObjSurvey $object
 
array $print_options
 

Detailed Description

Member Function Documentation

◆ addHeadingObject()

ilSurveyEditorGUI::addHeadingObject ( ?ilPropertyFormGUI  $a_form = null)

Definition at line 992 of file class.ilSurveyEditorGUI.php.

994 : void {
995 $q_id = $this->request->getQuestionId();
996 $this->ctrl->setParameter($this, "q_id", $q_id);
997
998 $this->questionsSubtabs("questions");
999
1000 if (!$a_form) {
1001 $a_form = $this->initHeadingForm($q_id);
1002 }
1003
1004 $this->tpl->setContent($a_form->getHTML());
1005 }
initHeadingForm(?int $a_question_id=null)

◆ browseForQuestionblocksObject()

ilSurveyEditorGUI::browseForQuestionblocksObject ( )

Definition at line 758 of file class.ilSurveyEditorGUI.php.

758 : void
759 {
761
762 $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object, true);
763 $table_gui->setEditable(true);
764 $this->tpl->setContent($table_gui->getHTML());
765 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ browseForQuestionsObject()

ilSurveyEditorGUI::browseForQuestionsObject ( )

Definition at line 708 of file class.ilSurveyEditorGUI.php.

708 : void
709 {
711
712 $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object, true);
713 $table_gui->setEditable(true);
714 $this->tpl->setContent($table_gui->getHTML());
715 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ changeDatatypeObject()

ilSurveyEditorGUI::changeDatatypeObject ( )

Definition at line 690 of file class.ilSurveyEditorGUI.php.

690 : void
691 {
692 $ilUser = $this->user;
693
694 $ilUser->writePref('svy_insert_type', $this->request->getDataType());
695
696 switch ($this->request->getDataType()) {
697 case 2:
698 $this->ctrl->redirect($this, 'browseForQuestionblocks');
699 break;
700
701 case 1:
702 default:
703 $this->ctrl->redirect($this, 'browseForQuestions');
704 break;
705 }
706 }
writePref(string $key, string $value)

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ clearClipboard()

ilSurveyEditorGUI::clearClipboard ( )
protected

Definition at line 1214 of file class.ilSurveyEditorGUI.php.

1214 : void
1215 {
1216 $this->edit_manager->clearQuestionClipboard($this->object->getRefId());
1217 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ confirmedRemoveHeadingObject()

ilSurveyEditorGUI::confirmedRemoveHeadingObject ( )

Definition at line 1064 of file class.ilSurveyEditorGUI.php.

1064 : void
1065 {
1066 $q_id = $this->request->getQuestionId();
1067 if (!$q_id) {
1068 $this->ctrl->redirect($this, "questions");
1069 }
1070
1071 $this->object->saveHeading("", $q_id);
1072 $this->ctrl->redirect($this, "questions");
1073 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ confirmRemoveQuestionsObject()

ilSurveyEditorGUI::confirmRemoveQuestionsObject ( )

Definition at line 501 of file class.ilSurveyEditorGUI.php.

501 : void
502 {
503 $checked_questions = $this->request->getQuestionIds();
504 $checked_questionblocks = $this->request->getBlockIds();
505 $checked_headings = $this->request->getHeadings();
506
507 if (count($checked_questions) || count($checked_questionblocks)) {
508 $this->object->removeQuestions($checked_questions, $checked_questionblocks);
509 }
510 if ($checked_headings) {
511 foreach ($checked_headings as $q_id) {
512 $this->object->saveHeading("", $q_id);
513 }
514 }
515 $this->object->saveCompletionStatus();
516 $this->tpl->setOnScreenMessage('success', $this->lng->txt("questions_removed"), true);
517 $this->ctrl->redirect($this, "questions");
518 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ copyPasteObject()

ilSurveyEditorGUI::copyPasteObject (   $pos = 0)
protected

Paste from clipboard.

Parameters
int$a_idtarget position

Definition at line 1113 of file class.ilSurveyEditorGUI.php.

1113 : void
1114 {
1115 $a_id = null;
1116 $ids = $this->request->getIds();
1117 if (count($ids) > 0) {
1118 if (substr($ids[0], 0, 3) == "cb_") {
1119 $a_id = (int) substr($ids[0], 3);
1120 }
1121 }
1122 if (is_null($a_id)) {
1123 return;
1124 }
1125
1126 $qids = $this->edit_manager->getQuestionClipboardQuestions($this->object->getRefId());
1127 $mode = $this->edit_manager->getQuestionClipboardMode($this->object->getRefId());
1128 $pages = $this->object->getSurveyPages();
1129 $target = null;
1130 foreach ($pages as $page) {
1131 foreach ($page as $question) {
1132 if ($question["question_id"] === $a_id) {
1133 $target = $page;
1134 }
1135 }
1136 }
1137 if (is_null($target)) {
1138 return;
1139 }
1140
1141 if ($mode !== "copy") {
1142 return;
1143 }
1144
1145 $titles = array();
1146 foreach ($this->object->getSurveyPages() as $page) {
1147 foreach ($page as $question) {
1148 $titles[] = $question["title"];
1149 }
1150 }
1151
1152 // copy questions
1153 $question_pointer = array();
1154 foreach ($qids as $qid) {
1155 // create new questions
1156 $question = ilObjSurvey::_instanciateQuestion($qid);
1157
1158 // handle exisiting copies
1159 $title = $question->getTitle();
1160 $max = 0;
1161 foreach ($titles as $existing_title) {
1162 #21278 preg_quote with delimiter
1163 if (preg_match("/" . preg_quote($title, "/") . " \‍(([0-9]+)\‍)$/", $existing_title, $match)) {
1164 $max = max($match[1], $max);
1165 }
1166 }
1167 if ($max) {
1168 $title .= " (" . ($max + 1) . ")";
1169 } else {
1170 $title .= " (2)";
1171 }
1172 $titles[] = $title;
1173 $question->setTitle($title);
1174
1175 $question->id = -1;
1176 $question->saveToDb(); // this creates the copy
1177
1178 $question_pointer[$qid] = $question->getId();
1179 $this->sequence_manager->appendQuestion($question->getId(), false);
1180 }
1181
1182 // copy textblocks
1183 $this->object->cloneTextblocks($question_pointer);
1184
1185 $this->object->loadQuestionsFromDb();
1186
1187 $nodes = array_values($question_pointer);
1188
1189
1190 // paste
1191
1192 // create new block
1193 if (count($target) === 1) {
1194 $this->object->moveQuestions($nodes, $a_id, $pos);
1195 }
1196 // add to existing block
1197 else {
1198 $target_block_id = $target;
1199 $target_block_id = array_shift($target_block_id);
1200 $target_block_id = $target_block_id["questionblock_id"];
1201
1202 foreach ($nodes as $qid) {
1203 $this->object->addQuestionToBlock($qid, $target_block_id);
1204 }
1205
1206 // move to new position
1207 $this->object->moveQuestions($nodes, $a_id, $pos);
1208 }
1209
1210 $this->clearClipboard();
1211 $this->ctrl->redirect($this, "questions");
1212 }
static _instanciateQuestion(int $question_id)
Creates an instance of a question with a given question id.

References ilObjSurvey\_instanciateQuestion(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ copyQuestionObject()

ilSurveyEditorGUI::copyQuestionObject ( )
protected

Definition at line 1093 of file class.ilSurveyEditorGUI.php.

1093 : void
1094 {
1095 $id = $this->request->getQuestionId();
1096 $lng = $this->lng;
1097 $this->tpl->setOnScreenMessage('success', $lng->txt("survey_questions_to_clipboard_copy"), true);
1098 //$this->suppress_clipboard_msg = true;
1099
1100 $this->edit_manager->setQuestionClipboard(
1101 $this->object->getRefId(),
1102 0,
1103 "copy",
1104 [$id]
1105 );
1106 $this->ctrl->redirect($this, "questions");
1107 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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...

References $id, $lng, ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ copyQuestionsToPoolObject()

ilSurveyEditorGUI::copyQuestionsToPoolObject ( )

Definition at line 520 of file class.ilSurveyEditorGUI.php.

520 : void
521 {
522 $items = $this->gatherSelectedTableItems(true, true, false, true);
523
524 // gather questions from blocks
525 $copy_questions = $items["questions"];
526 foreach ($items["blocks"] as $block_id) {
527 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
528 $copy_questions[] = $qid;
529 }
530 }
531 $copy_questions = array_unique($copy_questions);
532
533 // only if not already in pool
534 if (count($copy_questions)) {
535 foreach ($copy_questions as $idx => $question_id) {
536 $question = ilObjSurvey::_instanciateQuestion($question_id);
537 if ($question->getOriginalId()) {
538 unset($copy_questions[$idx]);
539 }
540 }
541 }
542 if (count($copy_questions) === 0) {
543 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_copy_to_pool"), true);
544 $this->ctrl->redirect($this, "questions");
545 } else {
546 $this->questionsSubtabs("questions");
547
548 $form = new ilPropertyFormGUI();
549
550 $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
551
552 $ids = new ilHiddenInputGUI("question_ids");
553 $ids->setValue(implode(";", $copy_questions));
554 $form->addItem($ids);
555
556 $questionpools = $this->object->getAvailableQuestionpools(false, false, true, "write");
557 $pools = new ilSelectInputGUI($this->lng->txt("survey_copy_select_questionpool"), "sel_spl");
558 $pools->setOptions($questionpools);
559 $form->addItem($pools);
560
561 $form->addCommandButton("executeCopyQuestionsToPool", $this->lng->txt("submit"));
562 $form->addCommandButton("questions", $this->lng->txt("cancel"));
563
564 $this->tpl->setContent($form->getHTML());
565 }
566 }
This class represents a hidden form property in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.
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.

References ilObjSurvey\_instanciateQuestion(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ createQuestionblockObject()

ilSurveyEditorGUI::createQuestionblockObject ( ?ilPropertyFormGUI  $a_form = null)

Definition at line 825 of file class.ilSurveyEditorGUI.php.

827 : void {
828 if (!$a_form) {
829 // gather questions from table selected
830 $items = $this->gatherSelectedTableItems(false, true, false, false);
831
832 $qids = $this->request->getQuestionIds();
833 if (count($qids) > 0) {
834 $items["questions"] = $qids;
835 }
836 if (count($items["questions"]) < 2) {
837 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_define_questionblock_select_missing"), true);
838 $this->ctrl->redirect($this, "questions");
839 }
840
841 $a_form = $this->initQuestionblockForm(null, $items["questions"]);
842 }
843
844 $this->questionsSubtabs("questions");
845 $this->tpl->setContent($a_form->getHTML());
846 }
initQuestionblockForm(?int $a_block_id=null, ?array $a_question_ids=null)

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ createQuestionObject()

ilSurveyEditorGUI::createQuestionObject ( ?ilPropertyFormGUI  $a_form = null,
  $sel_question_types = null,
?string  $pgov_pos = null 
)

Definition at line 593 of file class.ilSurveyEditorGUI.php.

598 $this->executeCreateQuestionObject(null, 1, $pgov_pos);
599 }
executeCreateQuestionObject(?string $q_type=null, ?int $pool_usage=null, ?string $pgov_pos=null)

◆ createQuestionPool()

ilSurveyEditorGUI::createQuestionPool (   $name = "dummy")
protected

Definition at line 644 of file class.ilSurveyEditorGUI.php.

644 : int
645 {
647
648 $parent_ref = $tree->getParentId($this->object->getRefId());
649
650 $qpl = new ilObjSurveyQuestionPool();
651 $qpl->setType("spl");
652 $qpl->setTitle($name);
653 $qpl->setDescription("");
654 $qpl->create();
655 $qpl->createReference();
656 $qpl->putInTree($parent_ref);
657 $qpl->setPermissions($parent_ref);
658 $qpl->setOnline(1); // must be online to be available
659 $qpl->saveToDb();
660
661 return $qpl->getId();
662 }
Class ilObjSurveyQuestionPool.
getParentId(int $a_node_id)
get parent id of given node

References ilTree\getParentId(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ editHeadingObject()

ilSurveyEditorGUI::editHeadingObject ( ?ilPropertyFormGUI  $a_form = null)

Definition at line 1007 of file class.ilSurveyEditorGUI.php.

1009 : void {
1010 $q_id = $this->request->getQuestionId();
1011 $this->ctrl->setParameter($this, "q_id", $q_id);
1012
1013 $this->questionsSubtabs("questions");
1014
1015 if (!$a_form) {
1016 $a_form = $this->initHeadingForm($q_id);
1017 }
1018
1019 $this->tpl->setContent($a_form->getHTML());
1020 }

◆ editQuestionblockObject()

ilSurveyEditorGUI::editQuestionblockObject ( ?ilPropertyFormGUI  $a_form = null)

Definition at line 811 of file class.ilSurveyEditorGUI.php.

813 : void {
814 $block_id = $this->request->getBlockId();
815 $this->ctrl->setParameter($this, "bl_id", $block_id);
816
817 if (!$a_form) {
818 $a_form = $this->initQuestionblockForm($block_id);
819 }
820
821 $this->questionsSubtabs("questions");
822 $this->tpl->setContent($a_form->getHTML());
823 }

◆ executeCommand()

ilSurveyEditorGUI::executeCommand ( )

Definition at line 112 of file class.ilSurveyEditorGUI.php.

112 : void
113 {
114 $ilTabs = $this->tabs;
115
116 $cmd = $this->ctrl->getCmd("questions");
117
118 $next_class = $this->ctrl->getNextClass($this);
119 switch ($next_class) {
120
121 default:
122 // question gui
123 if (stripos($next_class, "questiongui") !== false) {
124 $ilTabs->clearTargets();
125 $this->ctrl->saveParameter($this, array("new_for_survey"));
127 null,
128 $this->request->getQuestionId()
129 );
130 if (is_object($q_gui->object)) {
131 $ilHelp = $this->help;
132 $ilHelp->setScreenIdComponent("spl_qt" . $q_gui->object->getQuestionTypeId());
133 }
134 // $q_gui->object->setObjId($this->object->getId());
135 $q_gui->setBackUrl($this->ctrl->getLinkTarget($this, "questions"));
136 $q_gui->setQuestionTabs();
137 $this->ctrl->forwardCommand($q_gui);
138
139 if (!$this->request->getNewForSurvey()) {
140 // not on create
141 $this->tpl->setTitle($this->lng->txt("question") . ": " . $q_gui->object->getTitle());
142 }
143 } else {
144 $cmd .= "Object";
145 $this->$cmd();
146 }
147 break;
148 }
149 }
static _getQuestionGUI(?string $questiontype, int $question_id=-1)
Creates a question gui representation.
setScreenIdComponent(string $a_comp)

References $help, $tabs, SurveyQuestionGUI\_getQuestionGUI(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilHelpGUI\setScreenIdComponent().

+ Here is the call graph for this function:

◆ executeCopyQuestionsToPoolObject()

ilSurveyEditorGUI::executeCopyQuestionsToPoolObject ( )

Definition at line 568 of file class.ilSurveyEditorGUI.php.

568 : void
569 {
570 $question_ids = $this->request->getQuestionIdsFromString();
571 $pool_id = ilObject::_lookupObjId($this->request->getSelectedPool());
572
573 foreach ($question_ids as $qid) {
574 // create copy (== pool "original")
575 $new_question = ilObjSurvey::_instanciateQuestion($qid);
576 $new_question->setId();
577 $new_question->setObjId($pool_id);
578 $new_question->saveToDb();
579
580 // link "source" (survey) to copy (pool)
581 SurveyQuestion::_changeOriginalId($qid, $new_question->getId(), $pool_id);
582 }
583
584 $this->tpl->setOnScreenMessage('success', $this->lng->txt("survey_copy_to_questionpool_success"), true);
585 $this->ctrl->redirect($this, "questions");
586 }
static _changeOriginalId(int $a_question_id, int $a_original_id, int $a_object_id)
Change original id of existing question in db.
static _lookupObjId(int $ref_id)

References SurveyQuestion\_changeOriginalId(), ilObjSurvey\_instanciateQuestion(), ilObject\_lookupObjId(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCreateQuestionObject()

ilSurveyEditorGUI::executeCreateQuestionObject ( ?string  $q_type = null,
?int  $pool_usage = null,
?string  $pgov_pos = null 
)

Definition at line 601 of file class.ilSurveyEditorGUI.php.

605 : void {
606 $this->edit_manager->setPoolChoice($this->request->getPoolUsage());
607
608 if (is_null($q_type)) {
609 $q_type = $this->request->getSelectedQuestionTypes();
610 }
611
612 $pgov = $this->requested_pgov;
613 if (is_null($pgov_pos)) {
614 $pgov_pos = $this->request->getTargetQuestionPosition();
615 }
616
617 if (is_null($pool_usage)) {
618 $pool_usage = $this->request->getPoolUsage();
619 }
620 $pool_usage = 1;
621
622 $obj_id = 0;
623 $obj_id = $this->object->getId();
624
625 // create question and redirect to question form
626
627 $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type);
628 $q_gui->object->setObjId($obj_id); // survey/pool!
629 $q_gui->object->createNewQuestion();
630 $q_gui_class = get_class($q_gui);
631
632 if ($pgov !== "") {
633 $this->ctrl->setParameterByClass($q_gui_class, "pgov", $pgov);
634 $this->ctrl->setParameterByClass($q_gui_class, "pgov_pos", $pgov_pos);
635 }
636
637 $this->ctrl->setParameterByClass($q_gui_class, "ref_id", $this->object->getRefId());
638 $this->ctrl->setParameterByClass($q_gui_class, "new_for_survey", $this->object->getRefId());
639 $this->ctrl->setParameterByClass($q_gui_class, "q_id", $q_gui->object->getId());
640 $this->ctrl->setParameterByClass($q_gui_class, "sel_question_types", $q_gui->getQuestionType());
641 $this->ctrl->redirectByClass($q_gui_class, "editQuestion");
642 }

◆ filterQuestionblockBrowserObject()

ilSurveyEditorGUI::filterQuestionblockBrowserObject ( )

Definition at line 767 of file class.ilSurveyEditorGUI.php.

767 : void
768 {
769 $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
770 $table_gui->writeFilterToSession();
771 $this->ctrl->redirect($this, 'browseForQuestionblocks');
772 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ filterQuestionBrowserObject()

ilSurveyEditorGUI::filterQuestionBrowserObject ( )

Definition at line 717 of file class.ilSurveyEditorGUI.php.

717 : void
718 {
719 $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
720 $table_gui->writeFilterToSession();
721 $this->ctrl->redirect($this, 'browseForQuestions');
722 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ gatherSelectedTableItems()

ilSurveyEditorGUI::gatherSelectedTableItems ( bool  $allow_blocks = true,
bool  $allow_questions = true,
bool  $allow_headings = false,
bool  $allow_questions_in_blocks = false 
)
protected

Gather (and filter) selected items from table gui.

Returns
array (questions, blocks, headings)

Definition at line 284 of file class.ilSurveyEditorGUI.php.

289 : array {
290 $block_map = array();
291 foreach ($this->object->getSurveyQuestions() as $item) {
292 $block_map[$item["question_id"]] = $item["questionblock_id"];
293 }
294
295 $questions = $blocks = $headings = array();
296 $ids = $this->request->getIds();
297 if (count($ids) > 0) {
298 foreach ($ids as $key) {
299 // questions
300 if ($allow_questions && preg_match("/cb_(\d+)/", $key, $matches)) {
301 if (($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
302 !in_array($block_map[$matches[1]], $blocks)) {
303 $questions[] = $matches[1];
304 }
305 }
306 // blocks
307 if ($allow_blocks && preg_match("/cb_qb_(\d+)/", $key, $matches)) {
308 $blocks[] = $matches[1];
309 }
310 // headings
311 if ($allow_headings && preg_match("/cb_tb_(\d+)/", $key, $matches)) {
312 $headings[] = $matches[1];
313 }
314 }
315 }
316
317 return array("questions" => $questions,
318 "blocks" => $blocks,
319 "headings" => $headings);
320 }

◆ getAutoBlockTitle()

ilSurveyEditorGUI::getAutoBlockTitle ( )

Definition at line 1219 of file class.ilSurveyEditorGUI.php.

1219 : string
1220 {
1221 $lng = $this->lng;
1222 return $lng->txt("survey_auto_block_title");
1223 }

References $lng.

◆ initHeadingForm()

ilSurveyEditorGUI::initHeadingForm ( ?int  $a_question_id = null)
protected

Definition at line 952 of file class.ilSurveyEditorGUI.php.

955 $survey_questions = $this->object->getSurveyQuestions();
956
957 $form = new ilPropertyFormGUI();
958 $form->setFormAction($this->ctrl->getFormAction($this, ""));
959
960 // heading
961 $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
962 $heading->setRows(10);
963 $heading->setCols(80);
964 $heading->setRequired(true);
965 $form->addItem($heading);
966
967 $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
968 $options = array();
969 foreach ($survey_questions as $key => $value) {
970 $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
971 }
972 $insertbefore->setOptions($options);
973 $insertbefore->setRequired(true);
974 $form->addItem($insertbefore);
975
976 $form->addCommandButton("saveHeading", $this->lng->txt("save"));
977 $form->addCommandButton("questions", $this->lng->txt("cancel"));
978
979 if ($a_question_id) {
980 $form->setTitle($this->lng->txt("edit_heading"));
981
982 $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"] ?? ""));
983 $insertbefore->setValue($a_question_id);
984 $insertbefore->setDisabled(true);
985 } else {
986 $form->setTitle($this->lng->txt("add_heading"));
987 }
988
989 return $form;
990 }
This class represents a text area property in a property form.

◆ initQuestionblockForm()

ilSurveyEditorGUI::initQuestionblockForm ( ?int  $a_block_id = null,
?array  $a_question_ids = null 
)
protected

Definition at line 848 of file class.ilSurveyEditorGUI.php.

852 $questionblock = null;
853 $form = new ilPropertyFormGUI();
854 $form->setFormAction($this->ctrl->getFormAction($this, "saveDefineQuestionblock"));
855 $form->setTitle($this->lng->txt("define_questionblock"));
856
857 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
858 $title->setRequired(true);
859 $form->addItem($title);
860
861 $toggle_blocktitle = new ilCheckboxInputGUI($this->lng->txt("survey_show_blocktitle"), "show_blocktitle");
862 $toggle_blocktitle->setInfo($this->lng->txt("survey_show_blocktitle_description"));
863 $form->addItem($toggle_blocktitle);
864
865 $toggle_questiontitle = new ilCheckboxInputGUI($this->lng->txt("show_questiontext"), "show_questiontext");
866 $toggle_questiontitle->setInfo($this->lng->txt("show_questiontext_description"));
867 $form->addItem($toggle_questiontitle);
868
869 if ($a_block_id) {
870 $questionblock = ilObjSurvey::_getQuestionblock($a_block_id);
871 $title->setValue($questionblock["title"]);
872 $toggle_blocktitle->setChecked((bool) $questionblock["show_blocktitle"]);
873 $toggle_questiontitle->setChecked((bool) $questionblock["show_questiontext"]);
874 } else {
875 $toggle_blocktitle->setChecked(true);
876 $toggle_questiontitle->setChecked(true);
877 }
878
879 $compress_view = new ilCheckboxInputGUI($this->lng->txt("svy_compress_view"), "compress_view");
880 $compress_view->setInfo($this->lng->txt("svy_compress_view_info"));
881 $compress_view->setChecked((bool) ($questionblock["compress_view"] ?? false));
882 $form->addItem($compress_view);
883
884 $form->addCommandButton("saveDefineQuestionblock", $this->lng->txt("save"));
885 $form->addCommandButton("questions", $this->lng->txt("cancel"));
886
887 // reload?
888 $qids = $this->request->getQuestionIds();
889 if (!$a_question_ids && count($qids) > 0) {
890 $a_question_ids = $qids;
891 }
892
893 if ($a_question_ids) {
894 foreach ($a_question_ids as $q_id) {
895 $hidden = new ilHiddenInputGUI("qids[]");
896 $hidden->setValue($q_id);
897 $form->addItem($hidden);
898 }
899 }
900
901 return $form;
902 }
This class represents a checkbox property in a property form.
static _getQuestionblock(int $questionblock_id)
get question block properties
This class represents a text property in a property form.

◆ insertQuestionblocksObject()

ilSurveyEditorGUI::insertQuestionblocksObject ( )

Definition at line 781 of file class.ilSurveyEditorGUI.php.

781 : void
782 {
783 $inserted_objects = 0;
784 $page_gui = null;
785 $block_ids = $this->request->getBlockIds();
786 if (count($block_ids) > 0) {
787 foreach ($block_ids as $questionblock_id) {
788 if ($this->requested_pgov === "") {
789 $this->object->insertQuestionblock($questionblock_id);
790 } else {
791 $page_gui->insertQuestionBlock($questionblock_id);
792 }
793 $inserted_objects++;
794 }
795 }
796 if ($inserted_objects) {
797 $this->object->saveCompletionStatus();
798 $this->tpl->setOnScreenMessage('success', ($inserted_objects === 1) ? $this->lng->txt("questionblock_inserted") : $this->lng->txt("questionblocks_inserted"), true);
799 $this->ctrl->redirect($this, "questions");
800 } else {
801 $this->tpl->setOnScreenMessage('info', $this->lng->txt("insert_missing_questionblock"), true);
802 $this->ctrl->redirect($this, 'browseForQuestionblocks');
803 }
804 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ insertQuestions()

ilSurveyEditorGUI::insertQuestions ( int  $insert_mode)
protected

Definition at line 397 of file class.ilSurveyEditorGUI.php.

399 : void {
400 $copy = ($this->edit_manager->getQuestionClipboardMode($this->object->getRefId()) === "copy");
401 if ($copy) {
402 $this->copyPasteObject($insert_mode);
403 return;
404 }
405
406 $insert_id = null;
407 $ids = $this->request->getIds();
408 if (count($ids) > 0) {
409 $items = $this->gatherSelectedTableItems(true, true, false, false);
410
411 // we are using POST id for original order
412 while (!$insert_id && count($ids) > 0) {
413 $target = array_shift($ids);
414 if (preg_match("/^cb_(\d+)$/", $target, $matches)) {
415 // questions in blocks are not allowed
416 if (in_array($matches[1], $items["questions"])) {
417 $insert_id = $matches[1];
418 }
419 }
420 if (!$insert_id && preg_match("/^cb_qb_(\d+)$/", $target, $matches)) {
421 $ids = $this->object->getQuestionblockQuestionIds($matches[1]);
422 if (count($ids)) {
423 if ($insert_mode === 0) {
424 $insert_id = $ids[0];
425 } elseif ($insert_mode === 1) {
426 $insert_id = $ids[count($ids) - 1];
427 }
428 }
429 }
430 }
431 }
432 if (!$insert_id) {
433 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_target_selected_for_move"), true);
434 } else {
435 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
436 if ($this->edit_manager->getMoveSurveyId() === $this->object->getId()) {
437 $this->object->moveQuestions(
438 $this->edit_manager->getMoveSurveyQuestions(),
439 $insert_id,
440 $insert_mode
441 );
442 $this->edit_manager->clearMoveSurveyQuestions();
443 }
444 }
445
446 $this->ctrl->redirect($this, "questions");
447 }
copyPasteObject($pos=0)
Paste from clipboard.

◆ insertQuestionsAfterObject()

ilSurveyEditorGUI::insertQuestionsAfterObject ( )

Definition at line 392 of file class.ilSurveyEditorGUI.php.

392 : void
393 {
394 $this->insertQuestions(1);
395 }
insertQuestions(int $insert_mode)

◆ insertQuestionsBeforeObject()

ilSurveyEditorGUI::insertQuestionsBeforeObject ( )

Definition at line 387 of file class.ilSurveyEditorGUI.php.

387 : void
388 {
389 $this->insertQuestions(0);
390 }

◆ insertQuestionsObject()

ilSurveyEditorGUI::insertQuestionsObject ( )

Definition at line 731 of file class.ilSurveyEditorGUI.php.

731 : void
732 {
733 $inserted_objects = 0;
734 $page_gui = null;
735 $qids = $this->request->getQuestionIds();
736 if (count($qids) > 0) {
737 foreach ($qids as $question_id) {
738 if ($this->requested_pgov === "") {
739 $this->object->insertQuestion($question_id);
740 } else {
741 // "pgov" must be set to 1 to land here
742 // target position in page (pgov_pos) is processed there
743 $page_gui->insertNewQuestion($question_id);
744 }
745 $inserted_objects++;
746 }
747 }
748 if ($inserted_objects) {
749 $this->object->saveCompletionStatus();
750 $this->tpl->setOnScreenMessage('success', $this->lng->txt("questions_inserted"), true);
751 $this->ctrl->redirect($this, "questions");
752 } else {
753 $this->tpl->setOnScreenMessage('info', $this->lng->txt("insert_missing_question"), true);
754 $this->ctrl->redirect($this, 'browseForQuestions');
755 }
756 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ moveQuestionsObject()

ilSurveyEditorGUI::moveQuestionsObject ( )

Definition at line 367 of file class.ilSurveyEditorGUI.php.

367 : void
368 {
369 $items = $this->gatherSelectedTableItems(true, true, false, false);
370
371 $move_questions = $items["questions"];
372 foreach ($items["blocks"] as $block_id) {
373 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
374 $move_questions[] = $qid;
375 }
376 }
377 if (count($move_questions) === 0) {
378 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_move"), true);
379 $this->ctrl->redirect($this, "questions");
380 } else {
381 $this->edit_manager->setMoveSurveyQuestions($this->object->getId(), $move_questions);
382 $this->tpl->setOnScreenMessage('info', $this->lng->txt("select_target_position_for_move_question"));
383 $this->questionsObject();
384 }
385 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printListViewObject()

ilSurveyEditorGUI::printListViewObject ( )

Definition at line 1087 of file class.ilSurveyEditorGUI.php.

1087 : void
1088 {
1089 $print_view = $this->print->list($this->object->getRefId());
1090 $print_view->sendPrintView();
1091 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printListViewSelectionObject()

ilSurveyEditorGUI::printListViewSelectionObject ( )

Definition at line 1081 of file class.ilSurveyEditorGUI.php.

1081 : void
1082 {
1083 $view = $this->print->list($this->object->getRefId());
1084 $view->sendForm();
1085 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printViewObject()

ilSurveyEditorGUI::printViewObject ( )

Definition at line 1075 of file class.ilSurveyEditorGUI.php.

1075 : void
1076 {
1077 $print_view = $this->print->page($this->object->getRefId());
1078 $print_view->sendPrintView();
1079 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ questionsObject()

ilSurveyEditorGUI::questionsObject ( )

Definition at line 188 of file class.ilSurveyEditorGUI.php.

188 : void
189 {
190 $ilToolbar = $this->toolbar;
191 $ilUser = $this->user;
192
193 // insert new questions?
194 if ($this->request->getNewId() > 0) {
195 // add a question to the survey previous created in a questionpool
196 $existing = $this->object->getExistingQuestions();
197 if (!in_array($this->request->getNewId(), $existing)) {
198 $inserted = $this->object->insertQuestion($this->request->getNewId());
199 if (!$inserted) {
200 if (!$this->object->isQuestionInSurvey($this->request->getNewId())) {
201 $this->tpl->setOnScreenMessage(
202 'failure',
203 $this->lng->txt("survey_error_insert_incomplete_question")
204 );
205 }
206 } else {
207 // this ensures the status update of the survey, see #36162
208 $this->ctrl->redirect($this, "questions");
209 }
210 }
211 }
212 $this->questionsSubtabs("questions");
213
214 $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
215 $read_only = $hasDatasets;
216
217 // toolbar
218 if (!$read_only) {
219 $qtypes = array();
220 foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
221 $qtypes[$data["type_tag"]] = $translation;
222 }
223
224 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
225 $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
226 $types->setOptions($qtypes);
227 $ilToolbar->addStickyItem($types, "");
228
229 $this->gui->button(
230 $this->lng->txt("svy_create_question"),
231 "createQuestion"
232 )->submit()->toToolbar(true);
233
234
235 $cmd = ((int) $ilUser->getPref('svy_insert_type') === 1 ||
236 ($ilUser->getPref('svy_insert_type') ?? '') === '')
237 ? 'browseForQuestions'
238 : 'browseForQuestionblocks';
239
240 $this->gui->button(
241 $this->lng->txt("browse_for_questions"),
242 $this->ctrl->getLinkTarget($this, $cmd)
243 )->toToolbar(true);
244
245 if ($this->object->hasQuestions()) {
246 $ilToolbar->addSeparator();
247 $this->gui->button(
248 $this->lng->txt("add_heading"),
249 $this->ctrl->getLinkTarget($this, "addHeading")
250 )->toToolbar();
251 }
252
253 $ilToolbar->addSeparator();
254 $print_view = $this->print->list($this->object->getRefId());
255 $modal_elements = $print_view->getModalElements(
256 $this->ctrl->getLinkTarget(
257 $this,
258 "printListViewSelection"
259 )
260 );
261 $ilToolbar->addComponent($modal_elements->button);
262 $ilToolbar->addComponent($modal_elements->modal);
263 }
264 $mess = "";
265 if ($hasDatasets) {
267 $mess = $mbox->getHTML();
268 }
269
270 // table gui
271 $table = new ilSurveyQuestionTableGUI(
272 $this,
273 "questions",
274 $this->object,
275 $read_only
276 );
277 $this->tpl->setContent($mess . $table->getHTML());
278 }
static _getQuestiontypes()
Get all available question types.
static _hasDatasets(int $survey_id)
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...

References $data, ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjSurvey\_hasDatasets(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ questionsSubtabs()

ilSurveyEditorGUI::questionsSubtabs ( string  $a_cmd)
protected

Definition at line 151 of file class.ilSurveyEditorGUI.php.

153 : void {
154 $ilTabs = $this->tabs;
155
156 if ($a_cmd === "questions" && $this->requested_pgov !== "") {
157 $a_cmd = "page";
158 }
159
160 $this->ctrl->setParameter($this, "pgov", "");
161 $ilTabs->addSubTab(
162 "questions",
163 $this->lng->txt("survey_question_editor"),
164 $this->ctrl->getLinkTarget($this, "questions")
165 );
166 $this->ctrl->setParameter($this, "pgov", $this->requested_pgov);
167
168 if ($this->object->getSurveyPages()) {
169 if ($a_cmd === "page") {
170 $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "pgov", max(1, $this->request->getPage()));
171 }
172 $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "prvw", 1);
173 $ilTabs->addSubTab(
174 "preview",
175 $this->lng->txt("preview"),
176 $this->ctrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyexecutiongui"), "preview")
177 );
178 }
179
180 $ilTabs->activateSubTab($a_cmd);
181 }

◆ removeHeadingObject()

ilSurveyEditorGUI::removeHeadingObject ( )

Definition at line 1043 of file class.ilSurveyEditorGUI.php.

1043 : void
1044 {
1045 $q_id = $this->request->getQuestionId();
1046 $this->ctrl->setParameter($this, "q_id", $q_id);
1047
1048 if (!$q_id) {
1049 $this->ctrl->redirect($this, "questions");
1050 }
1051
1052 $this->questionsSubtabs("questions");
1053
1054 $cgui = new ilConfirmationGUI();
1055 $cgui->setHeaderText($this->lng->txt("confirm_remove_heading"));
1056
1057 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedRemoveHeading"));
1058 $cgui->setCancel($this->lng->txt("cancel"), "questions");
1059 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedRemoveHeading");
1060
1061 $this->tpl->setContent($cgui->getHTML());
1062 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ removeQuestionsForm()

ilSurveyEditorGUI::removeQuestionsForm ( array  $checked_questionblocks,
array  $checked_questions,
array  $checked_headings 
)

Definition at line 461 of file class.ilSurveyEditorGUI.php.

465 : void {
466 $cgui = new ilConfirmationGUI();
467 $cgui->setHeaderText($this->lng->txt("survey_sure_delete_questions"));
468 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
469 $cgui->setCancel($this->lng->txt("cancel"), "questions");
470 $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
471 $surveyquestions = $this->object->getSurveyQuestions();
472 foreach ($surveyquestions as $question_id => $data) {
473 if (in_array($data["question_id"], $checked_questions)) {
474 $type = SurveyQuestion::_getQuestionTypeName($data["type_tag"]);
475
476 $cgui->addItem(
477 "q_id[]",
478 $data["question_id"],
479 $type . ": " . $data["title"]
480 );
481 } elseif ((in_array($data["questionblock_id"], $checked_questionblocks))) {
482 $type = SurveyQuestion::_getQuestionTypeName($data["type_tag"]);
483
484 $cgui->addItem(
485 "cb[" . $data["questionblock_id"] . "]",
486 $data["questionblock_id"],
487 $data["questionblock_title"] . " - " . $type . ": " . $data["title"]
488 );
489 } elseif (in_array($data["question_id"], $checked_headings)) {
490 $cgui->addItem(
491 "heading[" . $data["question_id"] . "]",
492 $data["question_id"],
493 $data["heading"]
494 );
495 }
496 }
497
498 $this->tpl->setContent($cgui->getHTML());
499 }
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.

References $data, and SurveyQuestion\_getQuestionTypeName().

+ Here is the call graph for this function:

◆ removeQuestionsObject()

ilSurveyEditorGUI::removeQuestionsObject ( )

Definition at line 449 of file class.ilSurveyEditorGUI.php.

449 : void
450 {
451 $items = $this->gatherSelectedTableItems(true, true, true, true);
452 if (count($items["blocks"]) + count($items["questions"]) + count($items["headings"]) > 0) {
453 $this->tpl->setOnScreenMessage('question', $this->lng->txt("remove_questions"));
454 $this->removeQuestionsForm($items["blocks"], $items["questions"], $items["headings"]);
455 } else {
456 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_removal"), true);
457 $this->ctrl->redirect($this, "questions");
458 }
459 }
removeQuestionsForm(array $checked_questionblocks, array $checked_questions, array $checked_headings)

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ resetfilterQuestionblockBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionblockBrowserObject ( )

Definition at line 774 of file class.ilSurveyEditorGUI.php.

774 : void
775 {
776 $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
777 $table_gui->resetFilter();
778 $this->ctrl->redirect($this, 'browseForQuestionblocks');
779 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ resetfilterQuestionBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionBrowserObject ( )

Definition at line 724 of file class.ilSurveyEditorGUI.php.

724 : void
725 {
726 $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
727 $table_gui->resetFilter();
728 $this->ctrl->redirect($this, 'browseForQuestions');
729 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveDefineQuestionblockObject()

ilSurveyEditorGUI::saveDefineQuestionblockObject ( )

Definition at line 904 of file class.ilSurveyEditorGUI.php.

904 : void
905 {
906 $block_id = $this->request->getBlockId();
907 $q_ids = $this->request->getQuestionIds();
908
909 $this->ctrl->setParameter($this, "bl_id", $block_id);
910
911 if (!$block_id && count($q_ids) === 0) {
912 $this->ctrl->redirect($this, "questions");
913 }
914
915 $form = $this->initQuestionblockForm($block_id);
916 if ($form->checkInput()) {
917 $title = $form->getInput("title");
918 $show_questiontext = $form->getInput("show_questiontext");
919 $show_blocktitle = $form->getInput("show_blocktitle") ;
920 $compress_view = $form->getInput("compress_view") ;
921 if ($block_id) {
922 $this->object->modifyQuestionblock(
923 $block_id,
924 $title,
925 $show_questiontext,
926 $show_blocktitle,
927 $compress_view
928 );
929 } elseif ($q_ids) {
930 $this->object->createQuestionblock(
931 $title,
932 $show_questiontext,
933 $show_blocktitle,
934 $q_ids,
935 $compress_view
936 );
937 }
938
939 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
940 $this->ctrl->redirect($this, "questions");
941 }
942
943 $form->setValuesByPost();
944 $this->editQuestionblockObject($form);
945 }
editQuestionblockObject(?ilPropertyFormGUI $a_form=null)

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveHeadingObject()

ilSurveyEditorGUI::saveHeadingObject ( )

Definition at line 1022 of file class.ilSurveyEditorGUI.php.

1022 : void
1023 {
1024 // #15474
1025 $q_id = $this->request->getQuestionId();
1026 $this->ctrl->setParameter($this, "q_id", $q_id);
1027
1028 $form = $this->initHeadingForm($q_id);
1029 if ($form->checkInput()) {
1030 $purifier = new ilSvyStandardPurifier();
1031 $heading = $form->getInput("heading");
1032
1033 $heading = $purifier->purify($heading);
1034
1035 $this->object->saveHeading($heading, $form->getInput("insertbefore"));
1036 $this->ctrl->redirect($this, "questions");
1037 }
1038
1039 $form->setValuesByPost();
1040 $this->addHeadingObject($form);
1041 }
addHeadingObject(?ilPropertyFormGUI $a_form=null)

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveObligatoryObject()

ilSurveyEditorGUI::saveObligatoryObject ( )

Definition at line 322 of file class.ilSurveyEditorGUI.php.

322 : void
323 {
324 $req_order = $this->request->getOrder();
325 $req_block_order = $this->request->getBlockOrder();
326 if (count($req_order) > 0) {
327 $position = -1;
328 $order = array();
329 asort($req_order);
330 foreach (array_keys($req_order) as $id) {
331 // block items
332 if (strpos($id, "qb_") === 0) {
333 $block_id = substr($id, 3);
334 $block = $req_block_order[$block_id];
335 asort($block);
336 foreach (array_keys($block) as $question_id) {
337 $position++;
338 $order[$question_id] = $position;
339 }
340 } else {
341 $question_id = substr($id, 2);
342 $position++;
343 $order[$question_id] = $position;
344 }
345 }
346 $this->object->updateOrder($order);
347 }
348
349 $obligatory = $this->request->getObligatory();
350 $this->object->setObligatoryStates($obligatory);
351 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
352 $this->ctrl->redirect($this, "questions");
353 }

References $id, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setBrowseForQuestionsSubtabs()

ilSurveyEditorGUI::setBrowseForQuestionsSubtabs ( )
protected

Definition at line 669 of file class.ilSurveyEditorGUI.php.

669 : void
670 {
671 $ilTabs = $this->tabs;
672 $ilToolbar = $this->toolbar;
673 $ilUser = $this->user;
674
675 $link = $this->ctrl->getLinkTarget($this, "questions");
676 $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $link);
677
678 // type selector
679 $types = new ilSelectInputGUI($this->lng->txt("display_all_available"), "datatype");
680 $types->setOptions(array(
681 1 => $this->lng->txt("questions"),
682 2 => $this->lng->txt("questionblocks")
683 ));
684 $types->setValue($ilUser->getPref('svy_insert_type'));
685 $ilToolbar->addInputItem($types, true);
686 $ilToolbar->addFormButton($this->lng->txt("change"), "changeDatatype");
687 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "changeDatatype"));
688 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setRequestedPgov()

ilSurveyEditorGUI::setRequestedPgov ( string  $pgov)

Definition at line 107 of file class.ilSurveyEditorGUI.php.

107 : void
108 {
109 $this->requested_pgov = $pgov;
110 }

◆ unfoldQuestionblockObject()

ilSurveyEditorGUI::unfoldQuestionblockObject ( )

Definition at line 355 of file class.ilSurveyEditorGUI.php.

355 : void
356 {
357 $items = $this->gatherSelectedTableItems(true, false, false, false);
358 if (count($items["blocks"])) {
359 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
360 $this->object->unfoldQuestionblocks($items["blocks"]);
361 } else {
362 $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_unfold_select_none"), true);
363 }
364 $this->ctrl->redirect($this, "questions");
365 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilSurveyEditorGUI::$ctrl
protected

Definition at line 40 of file class.ilSurveyEditorGUI.php.

◆ $edit_manager

EditManager ilSurveyEditorGUI::$edit_manager
protected

Definition at line 39 of file class.ilSurveyEditorGUI.php.

◆ $gui

ILIAS Survey InternalGUIService ilSurveyEditorGUI::$gui
protected

Definition at line 33 of file class.ilSurveyEditorGUI.php.

◆ $help

ilHelpGUI ilSurveyEditorGUI::$help
protected

Definition at line 44 of file class.ilSurveyEditorGUI.php.

Referenced by executeCommand().

◆ $http

ILIAS HTTP Services ilSurveyEditorGUI::$http
protected

Definition at line 35 of file class.ilSurveyEditorGUI.php.

◆ $lng

ilLanguage ilSurveyEditorGUI::$lng
protected

Definition at line 41 of file class.ilSurveyEditorGUI.php.

◆ $object

ilObjSurvey ilSurveyEditorGUI::$object
protected

Definition at line 49 of file class.ilSurveyEditorGUI.php.

◆ $parent_gui

ilObjSurveyGUI ilSurveyEditorGUI::$parent_gui
protected

Definition at line 48 of file class.ilSurveyEditorGUI.php.

◆ $print

ILIAS Survey PrintView GUIService ilSurveyEditorGUI::$print
protected

Definition at line 34 of file class.ilSurveyEditorGUI.php.

◆ $print_options

array ilSurveyEditorGUI::$print_options
protected

Definition at line 50 of file class.ilSurveyEditorGUI.php.

◆ $request

EditingGUIRequest ilSurveyEditorGUI::$request
protected

Definition at line 38 of file class.ilSurveyEditorGUI.php.

◆ $requested_pgov

string ilSurveyEditorGUI::$requested_pgov
protected

Definition at line 37 of file class.ilSurveyEditorGUI.php.

◆ $sequence_manager

ILIAS Survey Sequence SequenceManager ilSurveyEditorGUI::$sequence_manager
protected

Definition at line 32 of file class.ilSurveyEditorGUI.php.

◆ $tabs

ilTabsGUI ilSurveyEditorGUI::$tabs
protected

Definition at line 43 of file class.ilSurveyEditorGUI.php.

Referenced by executeCommand().

◆ $toolbar

ilToolbarGUI ilSurveyEditorGUI::$toolbar
protected

Definition at line 45 of file class.ilSurveyEditorGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilSurveyEditorGUI::$tpl
protected

Definition at line 42 of file class.ilSurveyEditorGUI.php.

◆ $tree

ilTree ilSurveyEditorGUI::$tree
protected

Definition at line 47 of file class.ilSurveyEditorGUI.php.

◆ $ui

ILIAS DI UIServices ilSurveyEditorGUI::$ui
protected

Definition at line 36 of file class.ilSurveyEditorGUI.php.

◆ $user

ilObjUser ilSurveyEditorGUI::$user
protected

Definition at line 46 of file class.ilSurveyEditorGUI.php.


The documentation for this class was generated from the following file: