ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 ()
 

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)
 

Protected Attributes

ILIAS Survey Sequence SequenceManager $sequence_manager
 
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 1120 of file class.ilSurveyEditorGUI.php.

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

Referenced by saveHeadingObject().

1122  : void {
1123  $q_id = $this->request->getQuestionId();
1124  $this->ctrl->setParameter($this, "q_id", $q_id);
1125 
1126  $this->questionsSubtabs("questions");
1127 
1128  if (!$a_form) {
1129  $a_form = $this->initHeadingForm($q_id);
1130  }
1131 
1132  $this->tpl->setContent($a_form->getHTML());
1133  }
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 864 of file class.ilSurveyEditorGUI.php.

References setBrowseForQuestionsSubtabs().

864  : void
865  {
867 
868  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object, true);
869  $table_gui->setEditable(true);
870  $this->tpl->setContent($table_gui->getHTML());
871  }
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 793 of file class.ilSurveyEditorGUI.php.

References setBrowseForQuestionsSubtabs().

793  : void
794  {
796 
797  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object, true);
798  $table_gui->setEditable(true);
799  $this->tpl->setContent($table_gui->getHTML());
800  }
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 775 of file class.ilSurveyEditorGUI.php.

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

775  : void
776  {
778 
779  $ilUser->writePref('svy_insert_type', $this->request->getDataType());
780 
781  switch ($this->request->getDataType()) {
782  case 2:
783  $this->ctrl->redirect($this, 'browseForQuestionblocks');
784  break;
785 
786  case 1:
787  default:
788  $this->ctrl->redirect($this, 'browseForQuestions');
789  break;
790  }
791  }
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ confirmedRemoveHeadingObject()

ilSurveyEditorGUI::confirmedRemoveHeadingObject ( )

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

References ILIAS\Repository\ctrl().

1194  : void
1195  {
1196  $q_id = $this->request->getQuestionId();
1197  if (!$q_id) {
1198  $this->ctrl->redirect($this, "questions");
1199  }
1200 
1201  $this->object->saveHeading("", $q_id);
1202  $this->ctrl->redirect($this, "questions");
1203  }
+ Here is the call graph for this function:

◆ confirmRemoveQuestionsObject()

ilSurveyEditorGUI::confirmRemoveQuestionsObject ( )

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

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

509  : void
510  {
511  $checked_questions = $this->request->getQuestionIds();
512  $checked_questionblocks = $this->request->getBlockIds();
513  $checked_headings = $this->request->getHeadings();
514 
515  if (count($checked_questions) || count($checked_questionblocks)) {
516  $this->object->removeQuestions($checked_questions, $checked_questionblocks);
517  }
518  if ($checked_headings) {
519  foreach ($checked_headings as $q_id) {
520  $this->object->saveHeading("", $q_id);
521  }
522  }
523  $this->object->saveCompletionStatus();
524  $this->tpl->setOnScreenMessage('success', $this->lng->txt("questions_removed"), true);
525  $this->ctrl->redirect($this, "questions");
526  }
+ Here is the call graph for this function:

◆ copyQuestionsToPoolObject()

ilSurveyEditorGUI::copyQuestionsToPoolObject ( )

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

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

528  : void
529  {
530  $items = $this->gatherSelectedTableItems(true, true, false, true);
531 
532  // gather questions from blocks
533  $copy_questions = $items["questions"];
534  foreach ($items["blocks"] as $block_id) {
535  foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
536  $copy_questions[] = $qid;
537  }
538  }
539  $copy_questions = array_unique($copy_questions);
540 
541  // only if not already in pool
542  if (count($copy_questions)) {
543  foreach ($copy_questions as $idx => $question_id) {
544  $question = ilObjSurvey::_instanciateQuestion($question_id);
545  if ($question->getOriginalId()) {
546  unset($copy_questions[$idx]);
547  }
548  }
549  }
550  if (count($copy_questions) === 0) {
551  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_copy_to_pool"), true);
552  $this->ctrl->redirect($this, "questions");
553  } else {
554  $this->questionsSubtabs("questions");
555 
556  $form = new ilPropertyFormGUI();
557 
558  $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
559 
560  $ids = new ilHiddenInputGUI("question_ids");
561  $ids->setValue(implode(";", $copy_questions));
562  $form->addItem($ids);
563 
564  $questionpools = $this->object->getAvailableQuestionpools(false, false, true, "write");
565  $pools = new ilSelectInputGUI($this->lng->txt("survey_copy_select_questionpool"), "sel_spl");
566  $pools->setOptions($questionpools);
567  $form->addItem($pools);
568 
569  $form->addCommandButton("executeCopyQuestionsToPool", $this->lng->txt("submit"));
570  $form->addCommandButton("questions", $this->lng->txt("cancel"));
571 
572  $this->tpl->setContent($form->getHTML());
573  }
574  }
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 947 of file class.ilSurveyEditorGUI.php.

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

949  : void {
950  if (!$a_form) {
951  // gather questions from table selected
952  $items = $this->gatherSelectedTableItems(false, true, false, false);
953 
954  $qids = $this->request->getQuestionIds();
955  if (count($qids) > 0) {
956  $items["questions"] = $qids;
957  }
958  if (count($items["questions"]) < 2) {
959  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_define_questionblock_select_missing"), true);
960  $this->ctrl->redirect($this, "questions");
961  }
962 
963  $a_form = $this->initQuestionblockForm(null, $items["questions"]);
964  }
965 
966  $this->questionsSubtabs("questions");
967  $this->tpl->setContent($a_form->getHTML());
968  }
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.
+ 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 601 of file class.ilSurveyEditorGUI.php.

References $name, ILIAS\Repository\ctrl(), executeCreateQuestionObject(), ILIAS\Repository\lng(), ILIAS\Repository\object(), questionsSubtabs(), ilFormPropertyGUI\setRequired(), and ilRadioOption\setValue().

605  : ?ilPropertyFormGUI {
606  if (!$this->object->getPoolUsage()) {
607  $this->executeCreateQuestionObject(null, 1, $pgov_pos);
608  return null;
609  }
610 
611  if (!$a_form) {
612  $this->questionsSubtabs("questions");
613  $form = new ilPropertyFormGUI();
614 
615  if (is_null($sel_question_types)) {
616  $sel_question_types = $this->request->getSelectedQuestionTypes();
617  }
618  $this->ctrl->setParameter($this, "sel_question_types", $sel_question_types);
619  $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
620  } else {
621  $form = $a_form;
622  }
623 
624  $usage = new ilRadioGroupInputGUI($this->lng->txt("survey_pool_selection"), "usage");
625  $usage->setRequired(true);
626  $no_pool = new ilRadioOption($this->lng->txt("survey_no_pool"), 1);
627  $usage->addOption($no_pool);
628  $existing_pool = new ilRadioOption($this->lng->txt("survey_existing_pool"), 3);
629  $usage->addOption($existing_pool);
630  $new_pool = new ilRadioOption($this->lng->txt("survey_new_pool"), 2);
631  $usage->addOption($new_pool);
632  $form->addItem($usage);
633 
634  if ($this->edit_manager->getPoolChoice() > 0) {
635  $usage->setValue($this->edit_manager->getPoolChoice());
636  } else {
637  // default: no pool
638  $usage->setValue(1);
639  }
640 
641  $questionpools = $this->object->getAvailableQuestionpools(false, true, true, "write");
642  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_spl");
643  $pools->setOptions($questionpools);
644  $existing_pool->addSubItem($pools);
645 
646  $name = new ilTextInputGUI($this->lng->txt("spl_new"), "name_spl"); // #11740
647  $name->setSize(50);
648  $name->setMaxLength(50);
649  $new_pool->addSubItem($name);
650 
651  if ($a_form) {
652  return $a_form;
653  }
654 
655  $form->addCommandButton("executeCreateQuestion", $this->lng->txt("submit"));
656  $form->addCommandButton("questions", $this->lng->txt("cancel"));
657 
658  $this->tpl->setContent($form->getHTML());
659  return null;
660  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
executeCreateQuestionObject(?string $q_type=null, ?int $pool_usage=null, ?string $pgov_pos=null)
if($format !==null) $name
Definition: metadata.php:247
This class represents a property in a property form.
setValue(string $a_value)
setRequired(bool $a_required)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
+ Here is the call graph for this function:

◆ createQuestionPool()

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

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

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

Referenced by executeCreateQuestionObject().

725  : int
726  {
727  $tree = $this->tree;
728 
729  $parent_ref = $tree->getParentId($this->object->getRefId());
730 
731  $qpl = new ilObjSurveyQuestionPool();
732  $qpl->setType("spl");
733  $qpl->setTitle($name);
734  $qpl->setDescription("");
735  $qpl->create();
736  $qpl->createReference();
737  $qpl->putInTree($parent_ref);
738  $qpl->setPermissions($parent_ref);
739  $qpl->setOnline(1); // must be online to be available
740  $qpl->saveToDb();
741 
742  return $qpl->getId();
743  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($format !==null) $name
Definition: metadata.php:247
getParentId(int $a_node_id)
get parent id of given node
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editHeadingObject()

ilSurveyEditorGUI::editHeadingObject ( ilPropertyFormGUI  $a_form = null)

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

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

1137  : void {
1138  $q_id = $this->request->getQuestionId();
1139  $this->ctrl->setParameter($this, "q_id", $q_id);
1140 
1141  $this->questionsSubtabs("questions");
1142 
1143  if (!$a_form) {
1144  $a_form = $this->initHeadingForm($q_id);
1145  }
1146 
1147  $this->tpl->setContent($a_form->getHTML());
1148  }
initHeadingForm(?int $a_question_id=null)
+ Here is the call graph for this function:

◆ editQuestionblockObject()

ilSurveyEditorGUI::editQuestionblockObject ( ilPropertyFormGUI  $a_form = null)

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

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

Referenced by saveDefineQuestionblockObject().

935  : void {
936  $block_id = $this->request->getBlockId();
937  $this->ctrl->setParameter($this, "bl_id", $block_id);
938 
939  if (!$a_form) {
940  $a_form = $this->initQuestionblockForm($block_id);
941  }
942 
943  $this->questionsSubtabs("questions");
944  $this->tpl->setContent($a_form->getHTML());
945  }
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 108 of file class.ilSurveyEditorGUI.php.

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

108  : void
109  {
110  $ilTabs = $this->tabs;
111 
112  $cmd = $this->ctrl->getCmd("questions");
113 
114  if ($this->requested_pgov !== "") {
115  if ($cmd === "questions") {
116  $this->ctrl->setCmdClass("ilSurveyPageEditGUI");
117  $this->ctrl->setCmd("renderpage");
118  } elseif ($cmd === "confirmRemoveQuestions") {
119  // #14324
120  $this->ctrl->setCmdClass("ilSurveyPageEditGUI");
121  $this->ctrl->setCmd("confirmRemoveQuestions");
122  }
123  }
124 
125  $next_class = $this->ctrl->getNextClass($this);
126  switch ($next_class) {
127  case 'ilsurveypageeditgui':
128  $this->questionsSubtabs("page");
129  $pg = new ilSurveyPageEditGUI($this->object, $this);
130  $this->ctrl->forwardCommand($pg);
131  break;
132 
133  default:
134  // question gui
135  if (stripos($next_class, "questiongui") !== false) {
136  $ilTabs->clearTargets();
137  $this->ctrl->saveParameter($this, array("new_for_survey"));
139  null,
140  $this->request->getQuestionId()
141  );
142  if (is_object($q_gui->object)) {
143  $ilHelp = $this->help;
144  $ilHelp->setScreenIdComponent("spl_qt" . $q_gui->object->getQuestionTypeId());
145  }
146  // $q_gui->object->setObjId($this->object->getId());
147  $q_gui->setBackUrl($this->ctrl->getLinkTarget($this, "questions"));
148  $q_gui->setQuestionTabs();
149  $this->ctrl->forwardCommand($q_gui);
150 
151  if (!$this->request->getNewForSurvey()) {
152  // not on create
153  $this->tpl->setTitle($this->lng->txt("question") . ": " . $q_gui->object->getTitle());
154  }
155  } else {
156  $cmd .= "Object";
157  $this->$cmd();
158  }
159  break;
160  }
161  }
static _getQuestionGUI(?string $questiontype, int $question_id=-1)
Creates a question gui representation.
setScreenIdComponent(string $a_comp)
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:

◆ executeCopyQuestionsToPoolObject()

ilSurveyEditorGUI::executeCopyQuestionsToPoolObject ( )

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

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

576  : void
577  {
578  $question_ids = $this->request->getQuestionIdsFromString();
579  $pool_id = ilObject::_lookupObjId($this->request->getSelectedPool());
580 
581  foreach ($question_ids as $qid) {
582  // create copy (== pool "original")
583  $new_question = ilObjSurvey::_instanciateQuestion($qid);
584  $new_question->setId();
585  $new_question->setObjId($pool_id);
586  $new_question->saveToDb();
587 
588  // link "source" (survey) to copy (pool)
589  SurveyQuestion::_changeOriginalId($qid, $new_question->getId(), $pool_id);
590  }
591 
592  $this->tpl->setOnScreenMessage('success', $this->lng->txt("survey_copy_to_questionpool_success"), true);
593  $this->ctrl->redirect($this, "questions");
594  }
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 662 of file class.ilSurveyEditorGUI.php.

References $requested_pgov, SurveyQuestionGUI\_getQuestionGUI(), ilObject\_lookupObjId(), createQuestionPool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by createQuestionObject().

666  : void {
667  $this->edit_manager->setPoolChoice($this->request->getPoolUsage());
668 
669  if (is_null($q_type)) {
670  $q_type = $this->request->getSelectedQuestionTypes();
671  }
672 
673  $pgov = $this->requested_pgov;
674  if (is_null($pgov_pos)) {
675  $pgov_pos = $this->request->getTargetQuestionPosition();
676  }
677 
678  if (is_null($pool_usage)) {
679  $pool_usage = $this->request->getPoolUsage();
680  }
681 
682  $obj_id = 0;
683 
684  // no pool
685  if ($pool_usage == 1) {
686  $obj_id = $this->object->getId();
687  }
688  // existing pool
689  elseif ($pool_usage == 3 && $this->request->getSelectedPool() > 0) {
690  $obj_id = ilObject::_lookupObjId($this->request->getSelectedPool());
691  }
692  // new pool
693  elseif ($pool_usage == 2 && $this->request->getPoolName() !== "") {
694  $obj_id = $this->createQuestionPool($this->request->getPoolName());
695  } else {
696  if (!$pool_usage) {
697  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("select_one"), true);
698  } else {
699  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("err_no_pool_name"), true);
700  }
701  $this->ctrl->setParameter($this, "sel_question_types", $q_type);
702  $this->ctrl->redirect($this, "createQuestion");
703  }
704 
705 
706  // create question and redirect to question form
707 
708  $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type);
709  $q_gui->object->setObjId($obj_id); // survey/pool!
710  $q_gui->object->createNewQuestion();
711  $q_gui_class = get_class($q_gui);
712 
713  if ($pgov !== "") {
714  $this->ctrl->setParameterByClass($q_gui_class, "pgov", $pgov);
715  $this->ctrl->setParameterByClass($q_gui_class, "pgov_pos", $pgov_pos);
716  }
717 
718  $this->ctrl->setParameterByClass($q_gui_class, "ref_id", $this->object->getRefId());
719  $this->ctrl->setParameterByClass($q_gui_class, "new_for_survey", $this->object->getRefId());
720  $this->ctrl->setParameterByClass($q_gui_class, "q_id", $q_gui->object->getId());
721  $this->ctrl->setParameterByClass($q_gui_class, "sel_question_types", $q_gui->getQuestionType());
722  $this->ctrl->redirectByClass($q_gui_class, "editQuestion");
723  }
static _lookupObjId(int $ref_id)
createQuestionPool($name="dummy")
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 873 of file class.ilSurveyEditorGUI.php.

References ILIAS\Repository\ctrl().

873  : void
874  {
875  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
876  $table_gui->writeFilterToSession();
877  $this->ctrl->redirect($this, 'browseForQuestionblocks');
878  }
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 802 of file class.ilSurveyEditorGUI.php.

References ILIAS\Repository\ctrl().

802  : void
803  {
804  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
805  $table_gui->writeFilterToSession();
806  $this->ctrl->redirect($this, 'browseForQuestions');
807  }
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 297 of file class.ilSurveyEditorGUI.php.

References ILIAS\LTI\ToolProvider\$key, and ILIAS\Repository\object().

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

302  : array {
303  $block_map = array();
304  foreach ($this->object->getSurveyQuestions() as $item) {
305  $block_map[$item["question_id"]] = $item["questionblock_id"];
306  }
307 
308  $questions = $blocks = $headings = array();
309  $ids = $this->request->getIds();
310  if (count($ids) > 0) {
311  foreach ($ids as $key) {
312  // questions
313  if ($allow_questions && preg_match("/cb_(\d+)/", $key, $matches)) {
314  if (($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
315  !in_array($block_map[$matches[1]], $blocks)) {
316  $questions[] = $matches[1];
317  }
318  }
319  // blocks
320  if ($allow_blocks && preg_match("/cb_qb_(\d+)/", $key, $matches)) {
321  $blocks[] = $matches[1];
322  }
323  // headings
324  if ($allow_headings && preg_match("/cb_tb_(\d+)/", $key, $matches)) {
325  $headings[] = $matches[1];
326  }
327  }
328  }
329 
330  return array("questions" => $questions,
331  "blocks" => $blocks,
332  "headings" => $headings);
333  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initHeadingForm()

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

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

References ILIAS\LTI\ToolProvider\$key, ilObjAdvancedEditing\_getRichTextEditor(), ilObjAdvancedEditing\_getUsedHTMLTags(), ILIAS\Repository\ctrl(), ilRTE\ILIAS_IMG_MANAGER_PLUGIN, ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilTextAreaInputGUI\setRows().

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

1076  : ilPropertyFormGUI {
1077  $survey_questions = $this->object->getSurveyQuestions();
1078 
1079  $form = new ilPropertyFormGUI();
1080  $form->setFormAction($this->ctrl->getFormAction($this, ""));
1081 
1082  // heading
1083  $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
1084  $heading->setRows(10);
1085  $heading->setCols(80);
1086  if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
1087  $heading->setUseRte(true);
1088  $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
1089  $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
1090  $heading->setRTESupport($this->object->getId(), "svy", "survey");
1091  }
1092  $heading->setRequired(true);
1093  $form->addItem($heading);
1094 
1095  $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
1096  $options = array();
1097  foreach ($survey_questions as $key => $value) {
1098  $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
1099  }
1100  $insertbefore->setOptions($options);
1101  $insertbefore->setRequired(true);
1102  $form->addItem($insertbefore);
1103 
1104  $form->addCommandButton("saveHeading", $this->lng->txt("save"));
1105  $form->addCommandButton("questions", $this->lng->txt("cancel"));
1106 
1107  if ($a_question_id) {
1108  $form->setTitle($this->lng->txt("edit_heading"));
1109 
1110  $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"] ?? ""));
1111  $insertbefore->setValue($a_question_id);
1112  $insertbefore->setDisabled(true);
1113  } else {
1114  $form->setTitle($this->lng->txt("add_heading"));
1115  }
1116 
1117  return $form;
1118  }
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
const ILIAS_IMG_MANAGER_PLUGIN
Definition: class.ilRTE.php:31
string $key
Consumer key/client ID value.
Definition: System.php:193
This class represents a text area property in a property form.
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
+ 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 970 of file class.ilSurveyEditorGUI.php.

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

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

974  $questionblock = null;
975  $form = new ilPropertyFormGUI();
976  $form->setFormAction($this->ctrl->getFormAction($this, "saveDefineQuestionblock"));
977  $form->setTitle($this->lng->txt("define_questionblock"));
978 
979  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
980  $title->setRequired(true);
981  $form->addItem($title);
982 
983  $toggle_blocktitle = new ilCheckboxInputGUI($this->lng->txt("survey_show_blocktitle"), "show_blocktitle");
984  $toggle_blocktitle->setInfo($this->lng->txt("survey_show_blocktitle_description"));
985  $form->addItem($toggle_blocktitle);
986 
987  $toggle_questiontitle = new ilCheckboxInputGUI($this->lng->txt("show_questiontext"), "show_questiontext");
988  $toggle_questiontitle->setInfo($this->lng->txt("show_questiontext_description"));
989  $form->addItem($toggle_questiontitle);
990 
991  if ($a_block_id) {
992  $questionblock = ilObjSurvey::_getQuestionblock($a_block_id);
993  $title->setValue($questionblock["title"]);
994  $toggle_blocktitle->setChecked((bool) $questionblock["show_blocktitle"]);
995  $toggle_questiontitle->setChecked((bool) $questionblock["show_questiontext"]);
996  } else {
997  $toggle_blocktitle->setChecked(true);
998  $toggle_questiontitle->setChecked(true);
999  }
1000 
1001  $compress_view = new ilCheckboxInputGUI($this->lng->txt("svy_compress_view"), "compress_view");
1002  $compress_view->setInfo($this->lng->txt("svy_compress_view_info"));
1003  $compress_view->setChecked((bool) ($questionblock["compress_view"] ?? false));
1004  $form->addItem($compress_view);
1005 
1006  $form->addCommandButton("saveDefineQuestionblock", $this->lng->txt("save"));
1007  $form->addCommandButton("questions", $this->lng->txt("cancel"));
1008 
1009  // reload?
1010  $qids = $this->request->getQuestionIds();
1011  if (!$a_question_ids && count($qids) > 0) {
1012  $a_question_ids = $qids;
1013  }
1014 
1015  if ($a_question_ids) {
1016  foreach ($a_question_ids as $q_id) {
1017  $hidden = new ilHiddenInputGUI("qids[]");
1018  $hidden->setValue($q_id);
1019  $form->addItem($hidden);
1020  }
1021  }
1022 
1023  return $form;
1024  }
static _getQuestionblock(int $questionblock_id)
get question block properties
This class represents a checkbox property in a property form.
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:
+ Here is the caller graph for this function:

◆ insertQuestionblocksObject()

ilSurveyEditorGUI::insertQuestionblocksObject ( )

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

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

887  : void
888  {
889  $inserted_objects = 0;
890  $page_gui = null;
891  $block_ids = $this->request->getBlockIds();
892  if (count($block_ids) > 0) {
893  if ($this->requested_pgov !== "") {
894  $page_gui = new ilSurveyPageEditGUI($this->object, $this);
895  $page_gui->determineCurrentPage();
896 
897  // as target position is predefined, insert in reverse order
898  $block_ids = array_reverse($block_ids);
899  }
900  foreach ($block_ids as $questionblock_id) {
901  if ($this->requested_pgov === "") {
902  $this->object->insertQuestionblock($questionblock_id);
903  } else {
904  $page_gui->insertQuestionBlock($questionblock_id);
905  }
906  $inserted_objects++;
907  }
908  }
909  if ($inserted_objects) {
910  $this->object->saveCompletionStatus();
911  $this->tpl->setOnScreenMessage('success', ($inserted_objects === 1) ? $this->lng->txt("questionblock_inserted") : $this->lng->txt("questionblocks_inserted"), true);
912  if ($this->requested_pgov === "") {
913  $this->ctrl->redirect($this, "questions");
914  } else {
915  $target_page = $this->requested_pgov;
916  if (substr($this->request->getTargetQuestionPosition(), -1) === "c") {
917  $target_page++;
918  }
919  $this->ctrl->setParameterByClass("ilSurveyPageEditGUI", "pgov", $target_page);
920  $this->ctrl->redirectByClass("ilSurveyPageEditGUI", "renderpage");
921  }
922  } else {
923  $this->tpl->setOnScreenMessage('info', $this->lng->txt("insert_missing_questionblock"), true);
924  $this->ctrl->redirect($this, 'browseForQuestionblocks');
925  }
926  }
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:

◆ insertQuestions()

ilSurveyEditorGUI::insertQuestions ( int  $insert_mode)
protected

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

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

Referenced by insertQuestionsAfterObject(), and insertQuestionsBeforeObject().

412  : void {
413  $insert_id = null;
414  $ids = $this->request->getIds();
415  if (count($ids) > 0) {
416  $items = $this->gatherSelectedTableItems(true, true, false, false);
417 
418  // we are using POST id for original order
419  while (!$insert_id && count($ids) > 0) {
420  $target = array_shift($ids);
421  if (preg_match("/^cb_(\d+)$/", $target, $matches)) {
422  // questions in blocks are not allowed
423  if (in_array($matches[1], $items["questions"])) {
424  $insert_id = $matches[1];
425  }
426  }
427  if (!$insert_id && preg_match("/^cb_qb_(\d+)$/", $target, $matches)) {
428  $ids = $this->object->getQuestionblockQuestionIds($matches[1]);
429  if (count($ids)) {
430  if ($insert_mode === 0) {
431  $insert_id = $ids[0];
432  } elseif ($insert_mode === 1) {
433  $insert_id = $ids[count($ids) - 1];
434  }
435  }
436  }
437  }
438  }
439 
440  if (!$insert_id) {
441  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_target_selected_for_move"), true);
442  } else {
443  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
444  if ($this->edit_manager->getMoveSurveyId() === $this->object->getId()) {
445  $this->object->moveQuestions(
446  $this->edit_manager->getMoveSurveyQuestions(),
447  $insert_id,
448  $insert_mode
449  );
450  $this->edit_manager->clearMoveSurveyQuestions();
451  }
452  }
453 
454  $this->ctrl->redirect($this, "questions");
455  }
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:
+ Here is the caller graph for this function:

◆ insertQuestionsAfterObject()

ilSurveyEditorGUI::insertQuestionsAfterObject ( )

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

References insertQuestions().

405  : void
406  {
407  $this->insertQuestions(1);
408  }
insertQuestions(int $insert_mode)
+ Here is the call graph for this function:

◆ insertQuestionsBeforeObject()

ilSurveyEditorGUI::insertQuestionsBeforeObject ( )

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

References insertQuestions().

400  : void
401  {
402  $this->insertQuestions(0);
403  }
insertQuestions(int $insert_mode)
+ Here is the call graph for this function:

◆ insertQuestionsObject()

ilSurveyEditorGUI::insertQuestionsObject ( )

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

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

816  : void
817  {
818  $inserted_objects = 0;
819  $page_gui = null;
820  $qids = $this->request->getQuestionIds();
821  if (count($qids) > 0) {
822  if ($this->requested_pgov !== "") {
823  $page_gui = new ilSurveyPageEditGUI($this->object, $this);
824  $page_gui->determineCurrentPage();
825 
826  // as target position is predefined, insert in reverse order
827  $qids = array_reverse($qids);
828  }
829  foreach ($qids as $question_id) {
830  if ($this->requested_pgov === "") {
831  $this->object->insertQuestion($question_id);
832  } else {
833  // "pgov" must be set to 1 to land here
834  // target position in page (pgov_pos) is processed there
835  $page_gui->insertNewQuestion($question_id);
836  }
837  $inserted_objects++;
838  }
839  }
840  if ($inserted_objects) {
841  $this->object->saveCompletionStatus();
842  $this->tpl->setOnScreenMessage('success', $this->lng->txt("questions_inserted"), true);
843  if ($this->requested_pgov === "") {
844  $this->ctrl->redirect($this, "questions");
845  } else {
846  $target_page = $this->requested_pgov;
847  if (substr($this->request->getTargetQuestionPosition(), -1) === "c") {
848  // see ilSurveyPageEditGUI::insertNewQuestion()
849  if ((int) $this->request->getTargetQuestionPosition()) {
850  $target_page++;
851  } else {
852  $target_page = 1;
853  }
854  }
855  $this->ctrl->setParameterByClass("ilSurveyPageEditGUI", "pgov", $target_page);
856  $this->ctrl->redirectByClass("ilSurveyPageEditGUI", "renderpage");
857  }
858  } else {
859  $this->tpl->setOnScreenMessage('info', $this->lng->txt("insert_missing_question"), true);
860  $this->ctrl->redirect($this, 'browseForQuestions');
861  }
862  }
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:

◆ moveQuestionsObject()

ilSurveyEditorGUI::moveQuestionsObject ( )

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

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

380  : void
381  {
382  $items = $this->gatherSelectedTableItems(true, true, false, false);
383 
384  $move_questions = $items["questions"];
385  foreach ($items["blocks"] as $block_id) {
386  foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
387  $move_questions[] = $qid;
388  }
389  }
390  if (count($move_questions) === 0) {
391  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_move"), true);
392  $this->ctrl->redirect($this, "questions");
393  } else {
394  $this->edit_manager->setMoveSurveyQuestions($this->object->getId(), $move_questions);
395  $this->tpl->setOnScreenMessage('info', $this->lng->txt("select_target_position_for_move_question"));
396  $this->questionsObject();
397  }
398  }
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 1217 of file class.ilSurveyEditorGUI.php.

References ILIAS\Repository\object().

1217  : void
1218  {
1219  $print_view = $this->print->list($this->object->getRefId());
1220  $print_view->sendPrintView();
1221  }
+ Here is the call graph for this function:

◆ printListViewSelectionObject()

ilSurveyEditorGUI::printListViewSelectionObject ( )

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

References ILIAS\Repository\object().

1211  : void
1212  {
1213  $view = $this->print->list($this->object->getRefId());
1214  $view->sendForm();
1215  }
+ Here is the call graph for this function:

◆ printViewObject()

ilSurveyEditorGUI::printViewObject ( )

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

References ILIAS\Repository\object().

1205  : void
1206  {
1207  $print_view = $this->print->page($this->object->getRefId());
1208  $print_view->sendPrintView();
1209  }
+ Here is the call graph for this function:

◆ questionsObject()

ilSurveyEditorGUI::questionsObject ( )

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

References $data, $ilUser, $toolbar, $user, ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjSurvey\_hasDatasets(), ILIAS\Repository\ctrl(), ilSubmitButton\getInstance(), ilLinkButton\getInstance(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and questionsSubtabs().

Referenced by moveQuestionsObject().

206  : void
207  {
208  $ilToolbar = $this->toolbar;
210 
211  // insert new questions?
212  if ($this->request->getNewId() > 0) {
213  // add a question to the survey previous created in a questionpool
214  $existing = $this->object->getExistingQuestions();
215  if (!in_array($this->request->getNewId(), $existing)) {
216  $inserted = $this->object->insertQuestion($this->request->getNewId());
217  if (!$inserted) {
218  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("survey_error_insert_incomplete_question"));
219  } else {
220  // this ensures the status update of the survey, see #36162
221  $this->ctrl->redirect($this, "questions");
222  }
223  }
224  }
225  $this->questionsSubtabs("questions");
226 
227  $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
228  $read_only = $hasDatasets;
229 
230  // toolbar
231  if (!$read_only) {
232  $qtypes = array();
233  foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
234  $qtypes[$data["type_tag"]] = $translation;
235  }
236 
237  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
238  $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
239  $types->setOptions($qtypes);
240  $ilToolbar->addStickyItem($types, "");
241 
242  $button = ilSubmitButton::getInstance();
243  $button->setCaption("svy_create_question");
244  $button->setCommand("createQuestion");
245  $ilToolbar->addStickyItem($button);
246 
247  if ($this->object->getPoolUsage()) {
248  $cmd = ((int) $ilUser->getPref('svy_insert_type') === 1 ||
249  ($ilUser->getPref('svy_insert_type') ?? '') === '')
250  ? 'browseForQuestions'
251  : 'browseForQuestionblocks';
252 
253  $button = ilLinkButton::getInstance();
254  $button->setCaption("browse_for_questions");
255  $button->setUrl($this->ctrl->getLinkTarget($this, $cmd));
256  $ilToolbar->addStickyItem($button);
257  }
258 
259  $ilToolbar->addSeparator();
260 
261  $button = ilLinkButton::getInstance();
262  $button->setCaption("add_heading");
263  $button->setUrl($this->ctrl->getLinkTarget($this, "addHeading"));
264  $ilToolbar->addInputItem($button);
265 
266  $ilToolbar->addSeparator();
267  $print_view = $this->print->list($this->object->getRefId());
268  $modal_elements = $print_view->getModalElements(
269  $this->ctrl->getLinkTarget(
270  $this,
271  "printListViewSelection"
272  )
273  );
274  $ilToolbar->addComponent($modal_elements->button);
275  $ilToolbar->addComponent($modal_elements->modal);
276  }
277  $mess = "";
278  if ($hasDatasets) {
279  $mbox = new ilSurveyContainsDataMessageBoxGUI();
280  $mess = $mbox->getHTML();
281  }
282 
283  // table gui
284  $table = new ilSurveyQuestionTableGUI(
285  $this,
286  "questions",
287  $this->object,
288  $read_only
289  );
290  $this->tpl->setContent($mess . $table->getHTML());
291  }
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...
static _getQuestiontypes()
Get all available question types.
$ilUser
Definition: imgupload.php:34
+ 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 163 of file class.ilSurveyEditorGUI.php.

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

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

165  : void {
166  $ilTabs = $this->tabs;
167 
168  if ($a_cmd === "questions" && $this->requested_pgov !== "") {
169  $a_cmd = "page";
170  }
171 
172  $ilTabs->addSubTab(
173  "page",
174  $this->lng->txt("survey_per_page_view"),
175  $this->ctrl->getLinkTargetByClass("ilSurveyPageEditGUI", "renderPage")
176  );
177 
178  $this->ctrl->setParameter($this, "pgov", "");
179  $ilTabs->addSubTab(
180  "questions",
181  $this->lng->txt("survey_question_editor"),
182  $this->ctrl->getLinkTarget($this, "questions")
183  );
184  $this->ctrl->setParameter($this, "pgov", $this->requested_pgov);
185 
186  if ($this->object->getSurveyPages()) {
187  if ($a_cmd === "page") {
188  $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "pgov", max(1, $this->request->getPage()));
189  }
190  $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "prvw", 1);
191  $ilTabs->addSubTab(
192  "preview",
193  $this->lng->txt("preview"),
194  $this->ctrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyexecutiongui"), "preview")
195  );
196  }
197 
198  $ilTabs->activateSubTab($a_cmd);
199  }
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeHeadingObject()

ilSurveyEditorGUI::removeHeadingObject ( )

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

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

1173  : void
1174  {
1175  $q_id = $this->request->getQuestionId();
1176  $this->ctrl->setParameter($this, "q_id", $q_id);
1177 
1178  if (!$q_id) {
1179  $this->ctrl->redirect($this, "questions");
1180  }
1181 
1182  $this->questionsSubtabs("questions");
1183 
1184  $cgui = new ilConfirmationGUI();
1185  $cgui->setHeaderText($this->lng->txt("confirm_remove_heading"));
1186 
1187  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedRemoveHeading"));
1188  $cgui->setCancel($this->lng->txt("cancel"), "questions");
1189  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedRemoveHeading");
1190 
1191  $this->tpl->setContent($cgui->getHTML());
1192  }
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:

◆ removeQuestionsForm()

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

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

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

Referenced by removeQuestionsObject().

473  : void {
474  $cgui = new ilConfirmationGUI();
475  $cgui->setHeaderText($this->lng->txt("survey_sure_delete_questions"));
476  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
477  $cgui->setCancel($this->lng->txt("cancel"), "questions");
478  $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
479  $surveyquestions = $this->object->getSurveyQuestions();
480  foreach ($surveyquestions as $question_id => $data) {
481  if (in_array($data["question_id"], $checked_questions)) {
483 
484  $cgui->addItem(
485  "q_id[]",
486  $data["question_id"],
487  $type . ": " . $data["title"]
488  );
489  } elseif ((in_array($data["questionblock_id"], $checked_questionblocks))) {
491 
492  $cgui->addItem(
493  "cb[" . $data["questionblock_id"] . "]",
494  $data["questionblock_id"],
495  $data["questionblock_title"] . " - " . $type . ": " . $data["title"]
496  );
497  } elseif (in_array($data["question_id"], $checked_headings)) {
498  $cgui->addItem(
499  "heading[" . $data["question_id"] . "]",
500  $data["question_id"],
501  $data["heading"]
502  );
503  }
504  }
505 
506  $this->tpl->setContent($cgui->getHTML());
507  }
$type
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionsObject()

ilSurveyEditorGUI::removeQuestionsObject ( )

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

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

457  : void
458  {
459  $items = $this->gatherSelectedTableItems(true, true, true, true);
460  if (count($items["blocks"]) + count($items["questions"]) + count($items["headings"]) > 0) {
461  $this->tpl->setOnScreenMessage('question', $this->lng->txt("remove_questions"));
462  $this->removeQuestionsForm($items["blocks"], $items["questions"], $items["headings"]);
463  } else {
464  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_question_selected_for_removal"), true);
465  $this->ctrl->redirect($this, "questions");
466  }
467  }
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 880 of file class.ilSurveyEditorGUI.php.

References ILIAS\Repository\ctrl().

880  : void
881  {
882  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
883  $table_gui->resetFilter();
884  $this->ctrl->redirect($this, 'browseForQuestionblocks');
885  }
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 809 of file class.ilSurveyEditorGUI.php.

References ILIAS\Repository\ctrl().

809  : void
810  {
811  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
812  $table_gui->resetFilter();
813  $this->ctrl->redirect($this, 'browseForQuestions');
814  }
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 1026 of file class.ilSurveyEditorGUI.php.

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

1026  : void
1027  {
1028  $block_id = $this->request->getBlockId();
1029  $q_ids = $this->request->getQuestionIds();
1030 
1031  $this->ctrl->setParameter($this, "bl_id", $block_id);
1032 
1033  if (!$block_id && count($q_ids) === 0) {
1034  $this->ctrl->redirect($this, "questions");
1035  }
1036 
1037  $form = $this->initQuestionblockForm($block_id);
1038  if ($form->checkInput()) {
1039  $title = $form->getInput("title");
1040  $show_questiontext = $form->getInput("show_questiontext");
1041  $show_blocktitle = $form->getInput("show_blocktitle") ;
1042  $compress_view = $form->getInput("compress_view") ;
1043  if ($block_id) {
1044  $this->object->modifyQuestionblock(
1045  $block_id,
1046  $title,
1047  $show_questiontext,
1048  $show_blocktitle,
1049  $compress_view
1050  );
1051  } elseif ($q_ids) {
1052  $this->object->createQuestionblock(
1053  $title,
1054  $show_questiontext,
1055  $show_blocktitle,
1056  $q_ids,
1057  $compress_view
1058  );
1059  }
1060 
1061  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
1062  $this->ctrl->redirect($this, "questions");
1063  }
1064 
1065  $form->setValuesByPost();
1066  $this->editQuestionblockObject($form);
1067  }
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 1150 of file class.ilSurveyEditorGUI.php.

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

1150  : void
1151  {
1152  // #15474
1153  $q_id = $this->request->getQuestionId();
1154  $this->ctrl->setParameter($this, "q_id", $q_id);
1155 
1156  $form = $this->initHeadingForm($q_id);
1157  if ($form->checkInput()) {
1158  $this->object->saveHeading(
1160  $form->getInput("heading"),
1161  true,
1163  ),
1164  $form->getInput("insertbefore")
1165  );
1166  $this->ctrl->redirect($this, "questions");
1167  }
1168 
1169  $form->setValuesByPost();
1170  $this->addHeadingObject($form);
1171  }
initHeadingForm(?int $a_question_id=null)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
addHeadingObject(ilPropertyFormGUI $a_form=null)
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 335 of file class.ilSurveyEditorGUI.php.

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

335  : void
336  {
337  $req_order = $this->request->getOrder();
338  $req_block_order = $this->request->getBlockOrder();
339  if (count($req_order) > 0) {
340  $position = -1;
341  $order = array();
342  asort($req_order);
343  foreach (array_keys($req_order) as $id) {
344  // block items
345  if (strpos($id, "qb_") === 0) {
346  $block_id = substr($id, 3);
347  $block = $req_block_order[$block_id];
348  asort($block);
349  foreach (array_keys($block) as $question_id) {
350  $position++;
351  $order[$question_id] = $position;
352  }
353  } else {
354  $question_id = substr($id, 2);
355  $position++;
356  $order[$question_id] = $position;
357  }
358  }
359  $this->object->updateOrder($order);
360  }
361 
362  $obligatory = $this->request->getObligatory();
363  $this->object->setObligatoryStates($obligatory);
364  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
365  $this->ctrl->redirect($this, "questions");
366  }
$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 750 of file class.ilSurveyEditorGUI.php.

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

Referenced by browseForQuestionblocksObject(), and browseForQuestionsObject().

750  : void
751  {
752  $ilTabs = $this->tabs;
753  $ilToolbar = $this->toolbar;
755 
756  if ($this->requested_pgov === "") {
757  $link = $this->ctrl->getLinkTarget($this, "questions");
758  } else {
759  $link = $this->ctrl->getLinkTargetByClass("ilSurveyPageEditGUI", "renderpage");
760  }
761  $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $link);
762 
763  // type selector
764  $types = new ilSelectInputGUI($this->lng->txt("display_all_available"), "datatype");
765  $types->setOptions(array(
766  1 => $this->lng->txt("questions"),
767  2 => $this->lng->txt("questionblocks")
768  ));
769  $types->setValue($ilUser->getPref('svy_insert_type'));
770  $ilToolbar->addInputItem($types, true);
771  $ilToolbar->addFormButton($this->lng->txt("change"), "changeDatatype");
772  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "changeDatatype"));
773  }
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRequestedPgov()

ilSurveyEditorGUI::setRequestedPgov ( string  $pgov)

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

103  : void
104  {
105  $this->requested_pgov = $pgov;
106  }

◆ unfoldQuestionblockObject()

ilSurveyEditorGUI::unfoldQuestionblockObject ( )

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

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

368  : void
369  {
370  $items = $this->gatherSelectedTableItems(true, false, false, false);
371  if (count($items["blocks"])) {
372  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
373  $this->object->unfoldQuestionblocks($items["blocks"]);
374  } else {
375  $this->tpl->setOnScreenMessage('info', $this->lng->txt("qpl_unfold_select_none"), true);
376  }
377  $this->ctrl->redirect($this, "questions");
378  }
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 39 of file class.ilSurveyEditorGUI.php.

◆ $edit_manager

EditManager ilSurveyEditorGUI::$edit_manager
protected

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

◆ $help

ilHelpGUI ilSurveyEditorGUI::$help
protected

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

Referenced by executeCommand().

◆ $http

ILIAS HTTP Services ilSurveyEditorGUI::$http
protected

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

◆ $lng

ilLanguage ilSurveyEditorGUI::$lng
protected

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

◆ $object

ilObjSurvey ilSurveyEditorGUI::$object
protected

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

◆ $parent_gui

ilObjSurveyGUI ilSurveyEditorGUI::$parent_gui
protected

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

◆ $print

ILIAS Survey PrintView GUIService ilSurveyEditorGUI::$print
protected

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

◆ $print_options

array ilSurveyEditorGUI::$print_options
protected

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

◆ $request

EditingGUIRequest ilSurveyEditorGUI::$request
protected

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

◆ $requested_pgov

string ilSurveyEditorGUI::$requested_pgov
protected

◆ $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 44 of file class.ilSurveyEditorGUI.php.

Referenced by questionsObject(), and setBrowseForQuestionsSubtabs().

◆ $tpl

ilGlobalTemplateInterface ilSurveyEditorGUI::$tpl
protected

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

◆ $tree

ilTree ilSurveyEditorGUI::$tree
protected

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

Referenced by createQuestionPool().

◆ $ui

ILIAS DI UIServices ilSurveyEditorGUI::$ui
protected

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

◆ $user

ilObjUser ilSurveyEditorGUI::$user
protected

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