ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 987 of file class.ilSurveyEditorGUI.php.

References ILIAS\Repository\ctrl(), initHeadingForm(), and questionsSubtabs().

Referenced by saveHeadingObject().

989  : void {
990  $q_id = $this->request->getQuestionId();
991  $this->ctrl->setParameter($this, "q_id", $q_id);
992 
993  $this->questionsSubtabs("questions");
994 
995  if (!$a_form) {
996  $a_form = $this->initHeadingForm($q_id);
997  }
998 
999  $this->tpl->setContent($a_form->getHTML());
1000  }
initHeadingForm(?int $a_question_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browseForQuestionblocksObject()

ilSurveyEditorGUI::browseForQuestionblocksObject ( )

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

References setBrowseForQuestionsSubtabs().

753  : void
754  {
756 
757  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object, true);
758  $table_gui->setEditable(true);
759  $this->tpl->setContent($table_gui->getHTML());
760  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ browseForQuestionsObject()

ilSurveyEditorGUI::browseForQuestionsObject ( )

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

References setBrowseForQuestionsSubtabs().

703  : void
704  {
706 
707  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object, true);
708  $table_gui->setEditable(true);
709  $this->tpl->setContent($table_gui->getHTML());
710  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ changeDatatypeObject()

ilSurveyEditorGUI::changeDatatypeObject ( )

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

References $user, ILIAS\Repository\ctrl(), and ilObjUser\writePref().

685  : void
686  {
687  $ilUser = $this->user;
688 
689  $ilUser->writePref('svy_insert_type', $this->request->getDataType());
690 
691  switch ($this->request->getDataType()) {
692  case 2:
693  $this->ctrl->redirect($this, 'browseForQuestionblocks');
694  break;
695 
696  case 1:
697  default:
698  $this->ctrl->redirect($this, 'browseForQuestions');
699  break;
700  }
701  }
writePref(string $a_keyword, string $a_value)
+ Here is the call graph for this function:

◆ clearClipboard()

ilSurveyEditorGUI::clearClipboard ( )
protected

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

References ILIAS\Repository\object().

Referenced by copyPasteObject().

1211  : void
1212  {
1213  $this->edit_manager->clearQuestionClipboard($this->object->getRefId());
1214  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmedRemoveHeadingObject()

ilSurveyEditorGUI::confirmedRemoveHeadingObject ( )

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

References ILIAS\Repository\ctrl().

1061  : void
1062  {
1063  $q_id = $this->request->getQuestionId();
1064  if (!$q_id) {
1065  $this->ctrl->redirect($this, "questions");
1066  }
1067 
1068  $this->object->saveHeading("", $q_id);
1069  $this->ctrl->redirect($this, "questions");
1070  }
+ Here is the call graph for this function:

◆ confirmRemoveQuestionsObject()

ilSurveyEditorGUI::confirmRemoveQuestionsObject ( )

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

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

496  : void
497  {
498  $checked_questions = $this->request->getQuestionIds();
499  $checked_questionblocks = $this->request->getBlockIds();
500  $checked_headings = $this->request->getHeadings();
501 
502  if (count($checked_questions) || count($checked_questionblocks)) {
503  $this->object->removeQuestions($checked_questions, $checked_questionblocks);
504  }
505  if ($checked_headings) {
506  foreach ($checked_headings as $q_id) {
507  $this->object->saveHeading("", $q_id);
508  }
509  }
510  $this->object->saveCompletionStatus();
511  $this->tpl->setOnScreenMessage('success', $this->lng->txt("questions_removed"), true);
512  $this->ctrl->redirect($this, "questions");
513  }
+ 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 1110 of file class.ilSurveyEditorGUI.php.

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

Referenced by insertQuestions().

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

◆ copyQuestionObject()

ilSurveyEditorGUI::copyQuestionObject ( )
protected

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

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

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

◆ copyQuestionsToPoolObject()

ilSurveyEditorGUI::copyQuestionsToPoolObject ( )

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

References ilObjSurvey\_instanciateQuestion(), ILIAS\Repository\ctrl(), gatherSelectedTableItems(), ILIAS\Repository\lng(), ILIAS\Repository\object(), questionsSubtabs(), and ilSelectInputGUI\setOptions().

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

◆ createQuestionblockObject()

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

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

References ILIAS\Repository\ctrl(), gatherSelectedTableItems(), initQuestionblockForm(), ILIAS\Repository\lng(), null, and questionsSubtabs().

822  : void {
823  if (!$a_form) {
824  // gather questions from table selected
825  $items = $this->gatherSelectedTableItems(false, true, false, false);
826 
827  $qids = $this->request->getQuestionIds();
828  if (count($qids) > 0) {
829  $items["questions"] = $qids;
830  }
831  if (count($items["questions"]) < 2) {
832  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_define_questionblock_select_missing"), true);
833  $this->ctrl->redirect($this, "questions");
834  }
835 
836  $a_form = $this->initQuestionblockForm(null, $items["questions"]);
837  }
838 
839  $this->questionsSubtabs("questions");
840  $this->tpl->setContent($a_form->getHTML());
841  }
initQuestionblockForm(?int $a_block_id=null, ?array $a_question_ids=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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 588 of file class.ilSurveyEditorGUI.php.

References executeCreateQuestionObject(), and null.

592  : ?ilPropertyFormGUI {
593  $this->executeCreateQuestionObject(null, 1, $pgov_pos);
594  }
executeCreateQuestionObject(?string $q_type=null, ?int $pool_usage=null, ?string $pgov_pos=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ createQuestionPool()

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

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

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

639  : int
640  {
641  $tree = $this->tree;
642 
643  $parent_ref = $tree->getParentId($this->object->getRefId());
644 
645  $qpl = new ilObjSurveyQuestionPool();
646  $qpl->setType("spl");
647  $qpl->setTitle($name);
648  $qpl->setDescription("");
649  $qpl->create();
650  $qpl->createReference();
651  $qpl->putInTree($parent_ref);
652  $qpl->setPermissions($parent_ref);
653  $qpl->setOnline(1); // must be online to be available
654  $qpl->saveToDb();
655 
656  return $qpl->getId();
657  }
Class ilObjSurveyQuestionPool.
getParentId(int $a_node_id)
get parent id of given node
+ Here is the call graph for this function:

◆ editHeadingObject()

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

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

References ILIAS\Repository\ctrl(), initHeadingForm(), and questionsSubtabs().

1004  : void {
1005  $q_id = $this->request->getQuestionId();
1006  $this->ctrl->setParameter($this, "q_id", $q_id);
1007 
1008  $this->questionsSubtabs("questions");
1009 
1010  if (!$a_form) {
1011  $a_form = $this->initHeadingForm($q_id);
1012  }
1013 
1014  $this->tpl->setContent($a_form->getHTML());
1015  }
initHeadingForm(?int $a_question_id=null)
+ Here is the call graph for this function:

◆ editQuestionblockObject()

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

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

References ILIAS\Repository\ctrl(), initQuestionblockForm(), and questionsSubtabs().

Referenced by saveDefineQuestionblockObject().

808  : void {
809  $block_id = $this->request->getBlockId();
810  $this->ctrl->setParameter($this, "bl_id", $block_id);
811 
812  if (!$a_form) {
813  $a_form = $this->initQuestionblockForm($block_id);
814  }
815 
816  $this->questionsSubtabs("questions");
817  $this->tpl->setContent($a_form->getHTML());
818  }
initQuestionblockForm(?int $a_block_id=null, ?array $a_question_ids=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilSurveyEditorGUI::executeCommand ( )

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

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getQuestionGUI(?string $questiontype, int $question_id=-1)
Creates a question gui representation.
setScreenIdComponent(string $a_comp)
+ Here is the call graph for this function:

◆ executeCopyQuestionsToPoolObject()

ilSurveyEditorGUI::executeCopyQuestionsToPoolObject ( )

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

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

563  : void
564  {
565  $question_ids = $this->request->getQuestionIdsFromString();
566  $pool_id = ilObject::_lookupObjId($this->request->getSelectedPool());
567 
568  foreach ($question_ids as $qid) {
569  // create copy (== pool "original")
570  $new_question = ilObjSurvey::_instanciateQuestion($qid);
571  $new_question->setId();
572  $new_question->setObjId($pool_id);
573  $new_question->saveToDb();
574 
575  // link "source" (survey) to copy (pool)
576  SurveyQuestion::_changeOriginalId($qid, $new_question->getId(), $pool_id);
577  }
578 
579  $this->tpl->setOnScreenMessage('success', $this->lng->txt("survey_copy_to_questionpool_success"), true);
580  $this->ctrl->redirect($this, "questions");
581  }
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)
static _instanciateQuestion(int $question_id)
Creates an instance of a question with a given question id.
+ 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 596 of file class.ilSurveyEditorGUI.php.

References $requested_pgov, SurveyQuestionGUI\_getQuestionGUI(), ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

Referenced by createQuestionObject().

600  : void {
601  $this->edit_manager->setPoolChoice($this->request->getPoolUsage());
602 
603  if (is_null($q_type)) {
604  $q_type = $this->request->getSelectedQuestionTypes();
605  }
606 
607  $pgov = $this->requested_pgov;
608  if (is_null($pgov_pos)) {
609  $pgov_pos = $this->request->getTargetQuestionPosition();
610  }
611 
612  if (is_null($pool_usage)) {
613  $pool_usage = $this->request->getPoolUsage();
614  }
615  $pool_usage = 1;
616 
617  $obj_id = 0;
618  $obj_id = $this->object->getId();
619 
620  // create question and redirect to question form
621 
622  $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type);
623  $q_gui->object->setObjId($obj_id); // survey/pool!
624  $q_gui->object->createNewQuestion();
625  $q_gui_class = get_class($q_gui);
626 
627  if ($pgov !== "") {
628  $this->ctrl->setParameterByClass($q_gui_class, "pgov", $pgov);
629  $this->ctrl->setParameterByClass($q_gui_class, "pgov_pos", $pgov_pos);
630  }
631 
632  $this->ctrl->setParameterByClass($q_gui_class, "ref_id", $this->object->getRefId());
633  $this->ctrl->setParameterByClass($q_gui_class, "new_for_survey", $this->object->getRefId());
634  $this->ctrl->setParameterByClass($q_gui_class, "q_id", $q_gui->object->getId());
635  $this->ctrl->setParameterByClass($q_gui_class, "sel_question_types", $q_gui->getQuestionType());
636  $this->ctrl->redirectByClass($q_gui_class, "editQuestion");
637  }
static _getQuestionGUI(?string $questiontype, int $question_id=-1)
Creates a question gui representation.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filterQuestionblockBrowserObject()

ilSurveyEditorGUI::filterQuestionblockBrowserObject ( )

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

References ILIAS\Repository\ctrl().

762  : void
763  {
764  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
765  $table_gui->writeFilterToSession();
766  $this->ctrl->redirect($this, 'browseForQuestionblocks');
767  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ filterQuestionBrowserObject()

ilSurveyEditorGUI::filterQuestionBrowserObject ( )

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

References ILIAS\Repository\ctrl().

712  : void
713  {
714  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
715  $table_gui->writeFilterToSession();
716  $this->ctrl->redirect($this, 'browseForQuestions');
717  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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 279 of file class.ilSurveyEditorGUI.php.

References ILIAS\Repository\object().

Referenced by copyQuestionsToPoolObject(), createQuestionblockObject(), insertQuestions(), moveQuestionsObject(), removeQuestionsObject(), and unfoldQuestionblockObject().

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

◆ getAutoBlockTitle()

ilSurveyEditorGUI::getAutoBlockTitle ( )

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

References $lng, and ilLanguage\txt().

1216  : string
1217  {
1218  $lng = $this->lng;
1219  return $lng->txt("survey_auto_block_title");
1220  }
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...
+ Here is the call graph for this function:

◆ initHeadingForm()

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

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

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

Referenced by addHeadingObject(), editHeadingObject(), and saveHeadingObject().

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

◆ initQuestionblockForm()

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

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

References ilObjSurvey\_getQuestionblock(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and null.

Referenced by createQuestionblockObject(), editQuestionblockObject(), and saveDefineQuestionblockObject().

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

◆ insertQuestionblocksObject()

ilSurveyEditorGUI::insertQuestionblocksObject ( )

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

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

776  : void
777  {
778  $inserted_objects = 0;
779  $page_gui = null;
780  $block_ids = $this->request->getBlockIds();
781  if (count($block_ids) > 0) {
782  foreach ($block_ids as $questionblock_id) {
783  if ($this->requested_pgov === "") {
784  $this->object->insertQuestionblock($questionblock_id);
785  } else {
786  $page_gui->insertQuestionBlock($questionblock_id);
787  }
788  $inserted_objects++;
789  }
790  }
791  if ($inserted_objects) {
792  $this->object->saveCompletionStatus();
793  $this->tpl->setOnScreenMessage('success', ($inserted_objects === 1) ? $this->lng->txt("questionblock_inserted") : $this->lng->txt("questionblocks_inserted"), true);
794  $this->ctrl->redirect($this, "questions");
795  } else {
796  $this->tpl->setOnScreenMessage('info', $this->lng->txt("insert_missing_questionblock"), true);
797  $this->ctrl->redirect($this, 'browseForQuestionblocks');
798  }
799  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ insertQuestions()

ilSurveyEditorGUI::insertQuestions ( int  $insert_mode)
protected

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

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

Referenced by insertQuestionsAfterObject(), and insertQuestionsBeforeObject().

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

◆ insertQuestionsAfterObject()

ilSurveyEditorGUI::insertQuestionsAfterObject ( )

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

References insertQuestions().

387  : void
388  {
389  $this->insertQuestions(1);
390  }
insertQuestions(int $insert_mode)
+ Here is the call graph for this function:

◆ insertQuestionsBeforeObject()

ilSurveyEditorGUI::insertQuestionsBeforeObject ( )

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

References insertQuestions().

382  : void
383  {
384  $this->insertQuestions(0);
385  }
insertQuestions(int $insert_mode)
+ Here is the call graph for this function:

◆ insertQuestionsObject()

ilSurveyEditorGUI::insertQuestionsObject ( )

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

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

726  : void
727  {
728  $inserted_objects = 0;
729  $page_gui = null;
730  $qids = $this->request->getQuestionIds();
731  if (count($qids) > 0) {
732  foreach ($qids as $question_id) {
733  if ($this->requested_pgov === "") {
734  $this->object->insertQuestion($question_id);
735  } else {
736  // "pgov" must be set to 1 to land here
737  // target position in page (pgov_pos) is processed there
738  $page_gui->insertNewQuestion($question_id);
739  }
740  $inserted_objects++;
741  }
742  }
743  if ($inserted_objects) {
744  $this->object->saveCompletionStatus();
745  $this->tpl->setOnScreenMessage('success', $this->lng->txt("questions_inserted"), true);
746  $this->ctrl->redirect($this, "questions");
747  } else {
748  $this->tpl->setOnScreenMessage('info', $this->lng->txt("insert_missing_question"), true);
749  $this->ctrl->redirect($this, 'browseForQuestions');
750  }
751  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ moveQuestionsObject()

ilSurveyEditorGUI::moveQuestionsObject ( )

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

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

362  : void
363  {
364  $items = $this->gatherSelectedTableItems(true, true, false, false);
365 
366  $move_questions = $items["questions"];
367  foreach ($items["blocks"] as $block_id) {
368  foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
369  $move_questions[] = $qid;
370  }
371  }
372  if (count($move_questions) === 0) {
373  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_move"), true);
374  $this->ctrl->redirect($this, "questions");
375  } else {
376  $this->edit_manager->setMoveSurveyQuestions($this->object->getId(), $move_questions);
377  $this->tpl->setOnScreenMessage('info', $this->lng->txt("select_target_position_for_move_question"));
378  $this->questionsObject();
379  }
380  }
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.
+ Here is the call graph for this function:

◆ printListViewObject()

ilSurveyEditorGUI::printListViewObject ( )

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

References ILIAS\Repository\object().

1084  : void
1085  {
1086  $print_view = $this->print->list($this->object->getRefId());
1087  $print_view->sendPrintView();
1088  }
+ Here is the call graph for this function:

◆ printListViewSelectionObject()

ilSurveyEditorGUI::printListViewSelectionObject ( )

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

References ILIAS\Repository\object().

1078  : void
1079  {
1080  $view = $this->print->list($this->object->getRefId());
1081  $view->sendForm();
1082  }
+ Here is the call graph for this function:

◆ printViewObject()

ilSurveyEditorGUI::printViewObject ( )

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

References ILIAS\Repository\object().

1072  : void
1073  {
1074  $print_view = $this->print->page($this->object->getRefId());
1075  $print_view->sendPrintView();
1076  }
+ Here is the call graph for this function:

◆ questionsObject()

ilSurveyEditorGUI::questionsObject ( )

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

References $data, $toolbar, $user, ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjSurvey\_hasDatasets(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\object(), questionsSubtabs(), and ilSelectInputGUI\setOptions().

Referenced by moveQuestionsObject().

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  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("survey_error_insert_incomplete_question"));
201  } else {
202  // this ensures the status update of the survey, see #36162
203  $this->ctrl->redirect($this, "questions");
204  }
205  }
206  }
207  $this->questionsSubtabs("questions");
208 
209  $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
210  $read_only = $hasDatasets;
211 
212  // toolbar
213  if (!$read_only) {
214  $qtypes = array();
215  foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
216  $qtypes[$data["type_tag"]] = $translation;
217  }
218 
219  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
220  $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
221  $types->setOptions($qtypes);
222  $ilToolbar->addStickyItem($types, "");
223 
224  $this->gui->button(
225  $this->lng->txt("svy_create_question"),
226  "createQuestion"
227  )->submit()->toToolbar(true);
228 
229 
230  $cmd = ((int) $ilUser->getPref('svy_insert_type') === 1 ||
231  ($ilUser->getPref('svy_insert_type') ?? '') === '')
232  ? 'browseForQuestions'
233  : 'browseForQuestionblocks';
234 
235  $this->gui->button(
236  $this->lng->txt("browse_for_questions"),
237  $this->ctrl->getLinkTarget($this, $cmd)
238  )->toToolbar(true);
239 
240  if ($this->object->hasQuestions()) {
241  $ilToolbar->addSeparator();
242  $this->gui->button(
243  $this->lng->txt("add_heading"),
244  $this->ctrl->getLinkTarget($this, "addHeading")
245  )->toToolbar();
246  }
247 
248  $ilToolbar->addSeparator();
249  $print_view = $this->print->list($this->object->getRefId());
250  $modal_elements = $print_view->getModalElements(
251  $this->ctrl->getLinkTarget(
252  $this,
253  "printListViewSelection"
254  )
255  );
256  $ilToolbar->addComponent($modal_elements->button);
257  $ilToolbar->addComponent($modal_elements->modal);
258  }
259  $mess = "";
260  if ($hasDatasets) {
261  $mbox = new ilSurveyContainsDataMessageBoxGUI();
262  $mess = $mbox->getHTML();
263  }
264 
265  // table gui
266  $table = new ilSurveyQuestionTableGUI(
267  $this,
268  "questions",
269  $this->object,
270  $read_only
271  );
272  $this->tpl->setContent($mess . $table->getHTML());
273  }
static _hasDatasets(int $survey_id)
This class represents a selection list property in a property form.
setOptions(array $a_options)
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 _getQuestiontypes()
Get all available question types.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ questionsSubtabs()

ilSurveyEditorGUI::questionsSubtabs ( string  $a_cmd)
protected

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

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

Referenced by addHeadingObject(), copyQuestionsToPoolObject(), createQuestionblockObject(), editHeadingObject(), editQuestionblockObject(), questionsObject(), and removeHeadingObject().

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeHeadingObject()

ilSurveyEditorGUI::removeHeadingObject ( )

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

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

1040  : void
1041  {
1042  $q_id = $this->request->getQuestionId();
1043  $this->ctrl->setParameter($this, "q_id", $q_id);
1044 
1045  if (!$q_id) {
1046  $this->ctrl->redirect($this, "questions");
1047  }
1048 
1049  $this->questionsSubtabs("questions");
1050 
1051  $cgui = new ilConfirmationGUI();
1052  $cgui->setHeaderText($this->lng->txt("confirm_remove_heading"));
1053 
1054  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedRemoveHeading"));
1055  $cgui->setCancel($this->lng->txt("cancel"), "questions");
1056  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedRemoveHeading");
1057 
1058  $this->tpl->setContent($cgui->getHTML());
1059  }
+ Here is the call graph for this function:

◆ removeQuestionsForm()

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

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

References $data, SurveyQuestion\_getQuestionTypeName(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by removeQuestionsObject().

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

◆ removeQuestionsObject()

ilSurveyEditorGUI::removeQuestionsObject ( )

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

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

444  : void
445  {
446  $items = $this->gatherSelectedTableItems(true, true, true, true);
447  if (count($items["blocks"]) + count($items["questions"]) + count($items["headings"]) > 0) {
448  $this->tpl->setOnScreenMessage('question', $this->lng->txt("remove_questions"));
449  $this->removeQuestionsForm($items["blocks"], $items["questions"], $items["headings"]);
450  } else {
451  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_removal"), true);
452  $this->ctrl->redirect($this, "questions");
453  }
454  }
removeQuestionsForm(array $checked_questionblocks, array $checked_questions, array $checked_headings)
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.
+ Here is the call graph for this function:

◆ resetfilterQuestionblockBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionblockBrowserObject ( )

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

References ILIAS\Repository\ctrl().

769  : void
770  {
771  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
772  $table_gui->resetFilter();
773  $this->ctrl->redirect($this, 'browseForQuestionblocks');
774  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ resetfilterQuestionBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionBrowserObject ( )

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

References ILIAS\Repository\ctrl().

719  : void
720  {
721  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
722  $table_gui->resetFilter();
723  $this->ctrl->redirect($this, 'browseForQuestions');
724  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ saveDefineQuestionblockObject()

ilSurveyEditorGUI::saveDefineQuestionblockObject ( )

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

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

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

◆ saveHeadingObject()

ilSurveyEditorGUI::saveHeadingObject ( )

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

References ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), addHeadingObject(), ILIAS\Repository\ctrl(), initHeadingForm(), and ilUtil\stripSlashes().

1017  : void
1018  {
1019  // #15474
1020  $q_id = $this->request->getQuestionId();
1021  $this->ctrl->setParameter($this, "q_id", $q_id);
1022 
1023  $form = $this->initHeadingForm($q_id);
1024  if ($form->checkInput()) {
1025  $this->object->saveHeading(
1027  $form->getInput("heading"),
1028  true,
1030  ),
1031  $form->getInput("insertbefore")
1032  );
1033  $this->ctrl->redirect($this, "questions");
1034  }
1035 
1036  $form->setValuesByPost();
1037  $this->addHeadingObject($form);
1038  }
initHeadingForm(?int $a_question_id=null)
addHeadingObject(?ilPropertyFormGUI $a_form=null)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
+ Here is the call graph for this function:

◆ saveObligatoryObject()

ilSurveyEditorGUI::saveObligatoryObject ( )

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

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

317  : void
318  {
319  $req_order = $this->request->getOrder();
320  $req_block_order = $this->request->getBlockOrder();
321  if (count($req_order) > 0) {
322  $position = -1;
323  $order = array();
324  asort($req_order);
325  foreach (array_keys($req_order) as $id) {
326  // block items
327  if (strpos($id, "qb_") === 0) {
328  $block_id = substr($id, 3);
329  $block = $req_block_order[$block_id];
330  asort($block);
331  foreach (array_keys($block) as $question_id) {
332  $position++;
333  $order[$question_id] = $position;
334  }
335  } else {
336  $question_id = substr($id, 2);
337  $position++;
338  $order[$question_id] = $position;
339  }
340  }
341  $this->object->updateOrder($order);
342  }
343 
344  $obligatory = $this->request->getObligatory();
345  $this->object->setObligatoryStates($obligatory);
346  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
347  $this->ctrl->redirect($this, "questions");
348  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ setBrowseForQuestionsSubtabs()

ilSurveyEditorGUI::setBrowseForQuestionsSubtabs ( )
protected

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

References $tabs, $toolbar, $user, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilSelectInputGUI\setOptions().

Referenced by browseForQuestionblocksObject(), and browseForQuestionsObject().

664  : void
665  {
666  $ilTabs = $this->tabs;
667  $ilToolbar = $this->toolbar;
668  $ilUser = $this->user;
669 
670  $link = $this->ctrl->getLinkTarget($this, "questions");
671  $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $link);
672 
673  // type selector
674  $types = new ilSelectInputGUI($this->lng->txt("display_all_available"), "datatype");
675  $types->setOptions(array(
676  1 => $this->lng->txt("questions"),
677  2 => $this->lng->txt("questionblocks")
678  ));
679  $types->setValue($ilUser->getPref('svy_insert_type'));
680  $ilToolbar->addInputItem($types, true);
681  $ilToolbar->addFormButton($this->lng->txt("change"), "changeDatatype");
682  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "changeDatatype"));
683  }
This class represents a selection list property in a property form.
setOptions(array $a_options)
+ Here is the call graph for this function:
+ Here is the caller 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 350 of file class.ilSurveyEditorGUI.php.

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

350  : void
351  {
352  $items = $this->gatherSelectedTableItems(true, false, false, false);
353  if (count($items["blocks"])) {
354  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
355  $this->object->unfoldQuestionblocks($items["blocks"]);
356  } else {
357  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_unfold_select_none"), true);
358  }
359  $this->ctrl->redirect($this, "questions");
360  }
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.
+ 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.

Referenced by copyQuestionObject(), and getAutoBlockTitle().

◆ $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.

Referenced by executeCreateQuestionObject().

◆ $sequence_manager

ILIAS Survey Sequence SequenceManager ilSurveyEditorGUI::$sequence_manager
protected

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

◆ $tabs

ilTabsGUI ilSurveyEditorGUI::$tabs
protected

◆ $toolbar

ilToolbarGUI ilSurveyEditorGUI::$toolbar
protected

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

Referenced by questionsObject(), and setBrowseForQuestionsSubtabs().

◆ $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.

Referenced by createQuestionPool().

◆ $ui

ILIAS DI UIServices ilSurveyEditorGUI::$ui
protected

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

◆ $user

ilObjUser ilSurveyEditorGUI::$user
protected

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