ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSurveyEditorGUI Class Reference

Class ilSurveyEditorGUI. More...

+ Collaboration diagram for ilSurveyEditorGUI:

Public Member Functions

 __construct (ilObjSurveyGUI $a_parent_gui)
 
 executeCommand ()
 
 questionsObject ()
 
 saveObligatoryObject ()
 
 unfoldQuestionblockObject ()
 
 moveQuestionsObject ()
 
 insertQuestionsBeforeObject ()
 
 insertQuestionsAfterObject ()
 
 removeQuestionsObject ()
 
 removeQuestionsForm ($checked_questionblocks, $checked_questions, $checked_headings)
 
 confirmRemoveQuestionsObject ()
 
 copyQuestionsToPoolObject ()
 
 executeCopyQuestionsToPoolObject ()
 
 createQuestionObject (ilPropertyFormGUI $a_form=null)
 
 executeCreateQuestionObject ()
 
 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 ()
 Creates a print view of the survey questions. More...
 

Protected Member Functions

 questionsSubtabs ($a_cmd)
 
 gatherSelectedTableItems ($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
 Gather (and filter) selected items from table gui. More...
 
 insertQuestions ($insert_mode)
 
 createQuestionPool ($name="dummy")
 
 setBrowseForQuestionsSubtabs ()
 
 initQuestionblockForm ($a_block_id=null, $a_question_ids=null)
 
 initHeadingForm ($a_question_id=null)
 

Protected Attributes

 $ctrl
 
 $lng
 
 $tpl
 
 $tabs
 
 $help
 
 $toolbar
 
 $user
 
 $tree
 
 $parent_gui
 
 $object
 
 $print_options
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSurveyEditorGUI::__construct ( ilObjSurveyGUI  $a_parent_gui)

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

References $DIC, $ilCtrl, $lng, $tpl, help(), ilObjSurvey\PRINT_HIDE_LABELS, ilObjSurvey\PRINT_SHOW_LABELS, and user().

67  {
68  global $DIC;
69 
70  $this->tabs = $DIC->tabs();
71  $this->help = $DIC["ilHelp"];
72  $this->toolbar = $DIC->toolbar();
73  $this->user = $DIC->user();
74  $this->tree = $DIC->repositoryTree();
75  $ilCtrl = $DIC->ctrl();
76  $lng = $DIC->language();
77  $tpl = $DIC["tpl"];
78 
79  $this->parent_gui = $a_parent_gui;
80  $this->object = $this->parent_gui->object;
81 
82  $this->ctrl = $ilCtrl;
83  $this->lng = $lng;
84  $this->tpl = $tpl;
85 
86  $this->ctrl->saveParameter($this, array("pgov", "pgov_pos"));
87 
88  $this->print_options = array(
89  //0 => $this->lng->txt('none'),
90  ilObjSurvey::PRINT_HIDE_LABELS => $this->lng->txt('svy_print_hide_labels'),
91  //2 => $this->lng->txt('svy_print_label_only'),
92  ilObjSurvey::PRINT_SHOW_LABELS => $this->lng->txt('svy_print_show_labels')
93  );
94  }
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
help()
Definition: help.php:2
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ addHeadingObject()

ilSurveyEditorGUI::addHeadingObject ( ilPropertyFormGUI  $a_form = null)

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

References initHeadingForm(), and questionsSubtabs().

Referenced by saveHeadingObject().

1078  {
1079  $q_id = $_REQUEST["q_id"];
1080  $this->ctrl->setParameter($this, "q_id", $q_id);
1081 
1082  $this->questionsSubtabs("questions");
1083 
1084  if (!$a_form) {
1085  $a_form = $this->initHeadingForm($q_id);
1086  }
1087 
1088  $this->tpl->setContent($a_form->getHTML());
1089  }
initHeadingForm($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 839 of file class.ilSurveyEditorGUI.php.

References setBrowseForQuestionsSubtabs().

840  {
842 
843  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object, true);
844  $table_gui->setEditable(true);
845  $this->tpl->setContent($table_gui->getHTML());
846  }
+ Here is the call graph for this function:

◆ browseForQuestionsObject()

ilSurveyEditorGUI::browseForQuestionsObject ( )

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

References setBrowseForQuestionsSubtabs().

772  {
774 
775  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object, true);
776  $table_gui->setEditable(true);
777  $this->tpl->setContent($table_gui->getHTML());
778  }
+ Here is the call graph for this function:

◆ changeDatatypeObject()

ilSurveyEditorGUI::changeDatatypeObject ( )

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

References $_POST, $ilUser, and $user.

754  {
756 
757  $ilUser->writePref('svy_insert_type', $_POST['datatype']);
758 
759  switch ($_POST["datatype"]) {
760  case 2:
761  $this->ctrl->redirect($this, 'browseForQuestionblocks');
762  break;
763 
764  case 1:
765  default:
766  $this->ctrl->redirect($this, 'browseForQuestions');
767  break;
768  }
769  }
$ilUser
Definition: imgupload.php:18
$_POST["username"]

◆ confirmedRemoveHeadingObject()

ilSurveyEditorGUI::confirmedRemoveHeadingObject ( )

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

1150  {
1151  $q_id = (int) $_REQUEST["q_id"];
1152  if (!$q_id) {
1153  $this->ctrl->redirect($this, "questions");
1154  }
1155 
1156  $this->object->saveHeading("", $q_id);
1157  $this->ctrl->redirect($this, "questions");
1158  }

◆ confirmRemoveQuestionsObject()

ilSurveyEditorGUI::confirmRemoveQuestionsObject ( )

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

References $_POST.

497  {
498  $checked_questions = array();
499  $checked_questionblocks = array();
500  $checked_headings = array();
501  foreach ($_POST as $key => $value) {
502  if (preg_match("/id_(\d+)/", $key, $matches)) {
503  array_push($checked_questions, $matches[1]);
504  }
505  if (preg_match("/id_qb_(\d+)/", $key, $matches)) {
506  array_push($checked_questionblocks, $matches[1]);
507  }
508  if (preg_match("/id_tb_(\d+)/", $key, $matches)) {
509  array_push($checked_headings, $matches[1]);
510  }
511  }
512 
513  if (sizeof($checked_questions) || sizeof($checked_questionblocks)) {
514  $this->object->removeQuestions($checked_questions, $checked_questionblocks);
515  }
516  if ($checked_headings) {
517  foreach ($checked_headings as $q_id) {
518  $this->object->saveHeading("", $q_id);
519  }
520  }
521  $this->object->saveCompletionStatus();
522  ilUtil::sendSuccess($this->lng->txt("questions_removed"), true);
523  $this->ctrl->redirect($this, "questions");
524  }
$_POST["username"]

◆ copyQuestionsToPoolObject()

ilSurveyEditorGUI::copyQuestionsToPoolObject ( )

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

References ilObjSurvey\_instanciateQuestion(), gatherSelectedTableItems(), questionsSubtabs(), and ilUtil\sendInfo().

527  {
528  $items = $this->gatherSelectedTableItems(true, true, false, true);
529 
530  // gather questions from blocks
531  $copy_questions = $items["questions"];
532  foreach ($items["blocks"] as $block_id) {
533  foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
534  array_push($copy_questions, $qid);
535  }
536  }
537  $copy_questions = array_unique($copy_questions);
538 
539  // only if not already in pool
540  if (count($copy_questions)) {
541  foreach ($copy_questions as $idx => $question_id) {
542  $question = ilObjSurvey::_instanciateQuestion($question_id);
543  if ($question->getOriginalId()) {
544  unset($copy_questions[$idx]);
545  }
546  }
547  }
548  if (count($copy_questions) == 0) {
549  ilUtil::sendInfo($this->lng->txt("no_question_selected_for_copy_to_pool"), true);
550  $this->ctrl->redirect($this, "questions");
551  } else {
552  $this->questionsSubtabs("questions");
553 
554  $form = new ilPropertyFormGUI();
555 
556  $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
557 
558  $ids = new ilHiddenInputGUI("question_ids");
559  $ids->setValue(implode(";", $copy_questions));
560  $form->addItem($ids);
561 
562  $questionpools = &$this->object->getAvailableQuestionpools(false, false, true, "write");
563  $pools = new ilSelectInputGUI($this->lng->txt("survey_copy_select_questionpool"), "sel_spl");
564  $pools->setOptions($questionpools);
565  $form->addItem($pools);
566 
567  $form->addCommandButton("executeCopyQuestionsToPool", $this->lng->txt("submit"));
568  $form->addCommandButton("questions", $this->lng->txt("cancel"));
569 
570  return $this->tpl->setContent($form->getHTML());
571  }
572  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
This class represents a property form user interface.
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents a hidden form property in a property form.
+ Here is the call graph for this function:

◆ createQuestionblockObject()

ilSurveyEditorGUI::createQuestionblockObject ( ilPropertyFormGUI  $a_form = null)

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

References $_POST, gatherSelectedTableItems(), initQuestionblockForm(), questionsSubtabs(), and ilUtil\sendInfo().

920  {
921  if (!$a_form) {
922  // gather questions from table selected
923  $items = $this->gatherSelectedTableItems(false, true, false, false);
924 
925  if (is_array($_POST["qids"]) && sizeof($_POST["qids"])) {
926  $items["questions"] = $_POST["qids"];
927  }
928  if (count($items["questions"]) < 2) {
929  ilUtil::sendInfo($this->lng->txt("qpl_define_questionblock_select_missing"), true);
930  $this->ctrl->redirect($this, "questions");
931  }
932 
933  $a_form = $this->initQuestionblockForm(null, $items["questions"]);
934  }
935 
936  $this->questionsSubtabs("questions");
937  $this->tpl->setContent($a_form->getHTML());
938  }
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initQuestionblockForm($a_block_id=null, $a_question_ids=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ createQuestionObject()

ilSurveyEditorGUI::createQuestionObject ( ilPropertyFormGUI  $a_form = null)

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

References $_GET, $_POST, $_SESSION, $name, executeCreateQuestionObject(), questionsSubtabs(), ilFormPropertyGUI\setRequired(), and ilRadioOption\setValue().

600  {
601  if (!$this->object->isPoolActive()) {
602  $_POST["usage"] = 1;
603  $_GET["sel_question_types"] = $_POST["sel_question_types"];
604  return $this->executeCreateQuestionObject();
605  }
606 
607  if (!$a_form) {
608  $this->questionsSubtabs("questions");
609 
610  $form = new ilPropertyFormGUI();
611 
612  $sel_question_types = (strlen($_POST["sel_question_types"])) ? $_POST["sel_question_types"] : $_GET["sel_question_types"];
613  $this->ctrl->setParameter($this, "sel_question_types", $sel_question_types);
614  $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
615  } else {
616  $form = $a_form;
617  }
618 
619  $usage = new ilRadioGroupInputGUI($this->lng->txt("survey_pool_selection"), "usage");
620  $usage->setRequired(true);
621  $no_pool = new ilRadioOption($this->lng->txt("survey_no_pool"), 1);
622  $usage->addOption($no_pool);
623  $existing_pool = new ilRadioOption($this->lng->txt("survey_existing_pool"), 3);
624  $usage->addOption($existing_pool);
625  $new_pool = new ilRadioOption($this->lng->txt("survey_new_pool"), 2);
626  $usage->addOption($new_pool);
627  $form->addItem($usage);
628 
629  if (isset($_SESSION["svy_qpool_choice"])) {
630  $usage->setValue($_SESSION["svy_qpool_choice"]);
631  } else {
632  // default: no pool
633  $usage->setValue(1);
634  }
635 
636  $questionpools = &$this->object->getAvailableQuestionpools(false, true, true, "write");
637  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_spl");
638  $pools->setOptions($questionpools);
639  $existing_pool->addSubItem($pools);
640 
641  $name = new ilTextInputGUI($this->lng->txt("spl_new"), "name_spl"); // #11740
642  $name->setSize(50);
643  $name->setMaxLength(50);
644  $new_pool->addSubItem($name);
645 
646  if ($a_form) {
647  return $a_form;
648  }
649 
650  $form->addCommandButton("executeCreateQuestion", $this->lng->txt("submit"));
651  $form->addCommandButton("questions", $this->lng->txt("cancel"));
652 
653  return $this->tpl->setContent($form->getHTML());
654  }
This class represents an option in a radio group.
$_SESSION["AccountId"]
This class represents a property form user interface.
$_GET["client_id"]
if($format !==null) $name
Definition: metadata.php:230
This class represents a property in a property form.
setValue($a_value)
Set Value.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
$_POST["username"]
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ createQuestionPool()

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

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

References $name, and $tree.

Referenced by executeCreateQuestionObject().

704  {
705  $tree = $this->tree;
706 
707  $parent_ref = $tree->getParentId($this->object->getRefId());
708 
709  $qpl = new ilObjSurveyQuestionPool();
710  $qpl->setType("spl");
711  $qpl->setTitle($name);
712  $qpl->setDescription("");
713  $qpl->create();
714  $qpl->createReference();
715  $qpl->putInTree($parent_ref);
716  $qpl->setPermissions($parent_ref);
717  $qpl->setOnline(1); // must be online to be available
718  $qpl->saveToDb();
719 
720  return $qpl->getId();
721  }
Class ilObjSurveyQuestionPool.
if($format !==null) $name
Definition: metadata.php:230
+ Here is the caller graph for this function:

◆ editHeadingObject()

ilSurveyEditorGUI::editHeadingObject ( ilPropertyFormGUI  $a_form = null)

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

References initHeadingForm(), and questionsSubtabs().

1092  {
1093  $q_id = $_REQUEST["q_id"];
1094  $this->ctrl->setParameter($this, "q_id", $q_id);
1095 
1096  $this->questionsSubtabs("questions");
1097 
1098  if (!$a_form) {
1099  $a_form = $this->initHeadingForm($q_id);
1100  }
1101 
1102  $this->tpl->setContent($a_form->getHTML());
1103  }
initHeadingForm($a_question_id=null)
+ Here is the call graph for this function:

◆ editQuestionblockObject()

ilSurveyEditorGUI::editQuestionblockObject ( ilPropertyFormGUI  $a_form = null)

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

References initQuestionblockForm(), and questionsSubtabs().

Referenced by saveDefineQuestionblockObject().

907  {
908  $block_id = (int) $_REQUEST["bl_id"];
909  $this->ctrl->setParameter($this, "bl_id", $block_id);
910 
911  if (!$a_form) {
912  $a_form = $this->initQuestionblockForm($block_id);
913  }
914 
915  $this->questionsSubtabs("questions");
916  $this->tpl->setContent($a_form->getHTML());
917  }
initQuestionblockForm($a_block_id=null, $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 96 of file class.ilSurveyEditorGUI.php.

References $help, $tabs, SurveyQuestionGUI\_getQuestionGUI(), and questionsSubtabs().

97  {
98  $ilTabs = $this->tabs;
99 
100  $cmd = $this->ctrl->getCmd("questions");
101 
102  if ($_REQUEST["pgov"]) {
103  if ($cmd == "questions") {
104  $this->ctrl->setCmdClass("ilsurveypagegui");
105  $this->ctrl->setCmd("renderpage");
106  } elseif ($cmd == "confirmRemoveQuestions") {
107  // #14324
108  $this->ctrl->setCmdClass("ilsurveypagegui");
109  $this->ctrl->setCmd("confirmRemoveQuestions");
110  }
111  }
112 
113  $next_class = $this->ctrl->getNextClass($this);
114  switch ($next_class) {
115  case 'ilsurveypagegui':
116  $this->questionsSubtabs("page");
117  $pg = new ilSurveyPageGUI($this->object, $this);
118  $this->ctrl->forwardCommand($pg);
119  break;
120 
121  default:
122  // question gui
123  if (stristr($next_class, "questiongui")) {
124  $ilTabs->clearTargets();
125  $this->ctrl->saveParameter($this, array("new_for_survey"));
126 
127  $q_gui = SurveyQuestionGUI::_getQuestionGUI(null, $_REQUEST["q_id"]);
128  if (is_object($q_gui->object)) {
129  $ilHelp = $this->help;
130  $ilHelp->setScreenIdComponent("spl_qt" . $q_gui->object->getQuestionTypeId());
131  }
132  // $q_gui->object->setObjId($this->object->getId());
133  $q_gui->setBackUrl($this->ctrl->getLinkTarget($this, "questions"));
134  $q_gui->setQuestionTabs();
135  $this->ctrl->forwardCommand($q_gui);
136 
137  if (!(int) $_REQUEST["new_for_survey"]) {
138  // not on create
139  $this->tpl->setTitle($this->lng->txt("question") . ": " . $q_gui->object->getTitle());
140  }
141  } else {
142  $cmd .= "Object";
143  $this->$cmd();
144  }
145  break;
146  }
147  }
Survey per page view.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
+ Here is the call graph for this function:

◆ executeCopyQuestionsToPoolObject()

ilSurveyEditorGUI::executeCopyQuestionsToPoolObject ( )

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

References $_POST, SurveyQuestion\_changeOriginalId(), ilObjSurvey\_instanciateQuestion(), and ilObject\_lookupObjId().

575  {
576  $question_ids = explode(";", $_POST["question_ids"]);
577  $pool_id = ilObject::_lookupObjId($_POST["sel_spl"]);
578 
579  foreach ($question_ids as $qid) {
580  // create copy (== pool "original")
581  $new_question = ilObjSurvey::_instanciateQuestion($qid);
582  $new_question->setId();
583  $new_question->setObjId($pool_id);
584  $new_question->saveToDb();
585 
586  // link "source" (survey) to copy (pool)
587  SurveyQuestion::_changeOriginalId($qid, $new_question->getId(), $pool_id);
588  }
589 
590  ilUtil::sendSuccess($this->lng->txt("survey_copy_to_questionpool_success"), true);
591  $this->ctrl->redirect($this, "questions");
592  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
static _lookupObjId($a_id)
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCreateQuestionObject()

ilSurveyEditorGUI::executeCreateQuestionObject ( )

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

References $_GET, $_POST, $_SESSION, SurveyQuestionGUI\_getQuestionGUI(), ilObject\_lookupObjId(), createQuestionPool(), and ilUtil\sendFailure().

Referenced by createQuestionObject().

657  {
658  $_SESSION["svy_qpool_choice"] = $_POST["usage"];
659 
660  $q_type = $_GET["sel_question_types"];
661 
662  // no pool
663  if ($_POST["usage"] == 1) {
664  $obj_id = $this->object->getId();
665  }
666  // existing pool
667  elseif ($_POST["usage"] == 3 && strlen($_POST["sel_spl"])) {
668  $obj_id = ilObject::_lookupObjId($_POST["sel_spl"]);
669  }
670  // new pool
671  elseif ($_POST["usage"] == 2 && strlen($_POST["name_spl"])) {
672  $obj_id = $this->createQuestionPool($_POST["name_spl"]);
673  } else {
674  if (!$_POST["usage"]) {
675  ilUtil::sendFailure($this->lng->txt("select_one"), true);
676  } else {
677  ilUtil::sendFailure($this->lng->txt("err_no_pool_name"), true);
678  }
679  $this->ctrl->setParameter($this, "sel_question_types", $q_type);
680  $this->ctrl->redirect($this, "createQuestion");
681  }
682 
683 
684  // create question and redirect to question form
685 
686  $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type);
687  $q_gui->object->setObjId($obj_id); // survey/pool!
688  $q_gui->object->createNewQuestion();
689  $q_gui_class = get_class($q_gui);
690 
691  if ($_REQUEST["pgov"]) {
692  $this->ctrl->setParameterByClass($q_gui_class, "pgov", $_REQUEST["pgov"]);
693  $this->ctrl->setParameterByClass($q_gui_class, "pgov_pos", $_REQUEST["pgov_pos"]);
694  }
695 
696  $this->ctrl->setParameterByClass($q_gui_class, "ref_id", $this->object->getRefId());
697  $this->ctrl->setParameterByClass($q_gui_class, "new_for_survey", $this->object->getRefId());
698  $this->ctrl->setParameterByClass($q_gui_class, "q_id", $q_gui->object->getId());
699  $this->ctrl->setParameterByClass($q_gui_class, "sel_question_types", $q_gui->getQuestionType());
700  $this->ctrl->redirectByClass($q_gui_class, "editQuestion");
701  }
$_SESSION["AccountId"]
$_GET["client_id"]
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
createQuestionPool($name="dummy")
static _lookupObjId($a_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filterQuestionblockBrowserObject()

ilSurveyEditorGUI::filterQuestionblockBrowserObject ( )

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

849  {
850  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
851  $table_gui->writeFilterToSession();
852  $this->ctrl->redirect($this, 'browseForQuestionblocks');
853  }

◆ filterQuestionBrowserObject()

ilSurveyEditorGUI::filterQuestionBrowserObject ( )

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

781  {
782  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
783  $table_gui->writeFilterToSession();
784  $this->ctrl->redirect($this, 'browseForQuestions');
785  }

◆ gatherSelectedTableItems()

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

Gather (and filter) selected items from table gui.

Parameters
bool$allow_blocks
bool$allow_questions
bool$allow_headings
bool$allow_questions_in_blocks
Returns
array (questions, blocks, headings)

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

References $_POST.

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

292  {
293  $block_map = array();
294  foreach ($this->object->getSurveyQuestions() as $item) {
295  $block_map[$item["question_id"]] = $item["questionblock_id"];
296  }
297 
298  $questions = $blocks = $headings = array();
299  if ($_POST["id"]) {
300  foreach ($_POST["id"] as $key) {
301  // questions
302  if ($allow_questions && preg_match("/cb_(\d+)/", $key, $matches)) {
303  if (($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
304  !in_array($block_map[$matches[1]], $blocks)) {
305  array_push($questions, $matches[1]);
306  }
307  }
308  // blocks
309  if ($allow_blocks && preg_match("/cb_qb_(\d+)/", $key, $matches)) {
310  array_push($blocks, $matches[1]);
311  }
312  // headings
313  if ($allow_headings && preg_match("/cb_tb_(\d+)/", $key, $matches)) {
314  array_push($headings, $matches[1]);
315  }
316  }
317  }
318 
319  return array("questions" => $questions,
320  "blocks" => $blocks,
321  "headings" => $headings);
322  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ initHeadingForm()

ilSurveyEditorGUI::initHeadingForm (   $a_question_id = null)
protected

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

References ilObjAdvancedEditing\_getRichTextEditor(), ilObjAdvancedEditing\_getUsedHTMLTags(), ilRTE\ILIAS_IMG_MANAGER_PLUGIN, ilSelectInputGUI\setOptions(), and ilTextAreaInputGUI\setRows().

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

1033  {
1034  $survey_questions = $this->object->getSurveyQuestions();
1035 
1036  $form = new ilPropertyFormGUI();
1037  $form->setFormAction($this->ctrl->getFormAction($this, ""));
1038 
1039  // heading
1040  $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
1041  $heading->setRows(10);
1042  $heading->setCols(80);
1043  if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
1044  $heading->setUseRte(true);
1045  $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
1046  $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
1047  $heading->setRTESupport($this->object->getId(), "svy", "survey");
1048  }
1049  $heading->setRequired(true);
1050  $form->addItem($heading);
1051 
1052  $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
1053  $options = array();
1054  foreach ($survey_questions as $key => $value) {
1055  $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
1056  }
1057  $insertbefore->setOptions($options);
1058  $insertbefore->setRequired(true);
1059  $form->addItem($insertbefore);
1060 
1061  $form->addCommandButton("saveHeading", $this->lng->txt("save"));
1062  $form->addCommandButton("questions", $this->lng->txt("cancel"));
1063 
1064  if ($a_question_id) {
1065  $form->setTitle($this->lng->txt("edit_heading"));
1066 
1067  $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"]));
1068  $insertbefore->setValue($a_question_id);
1069  $insertbefore->setDisabled(true);
1070  } else {
1071  $form->setTitle($this->lng->txt("add_heading"));
1072  }
1073 
1074  return $form;
1075  }
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
This class represents a property form user interface.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
const ILIAS_IMG_MANAGER_PLUGIN
Definition: class.ilRTE.php:14
setOptions($a_options)
Set Options.
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 (   $a_block_id = null,
  $a_question_ids = null 
)
protected

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

References $_POST, ilObjSurvey\_getQuestionblock(), and ilFormPropertyGUI\setInfo().

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

941  {
942  $form = new ilPropertyFormGUI();
943  $form->setFormAction($this->ctrl->getFormAction($this, "saveDefineQuestionblock"));
944  $form->setTitle($this->lng->txt("define_questionblock"));
945 
946  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
947  $title->setRequired(true);
948  $form->addItem($title);
949 
950  $toggle_blocktitle = new ilCheckboxInputGUI($this->lng->txt("survey_show_blocktitle"), "show_blocktitle");
951  $toggle_blocktitle->setInfo($this->lng->txt("survey_show_blocktitle_description"));
952  $form->addItem($toggle_blocktitle);
953 
954  $toggle_questiontitle = new ilCheckboxInputGUI($this->lng->txt("show_questiontext"), "show_questiontext");
955  $toggle_questiontitle->setInfo($this->lng->txt("show_questiontext_description"));
956  $form->addItem($toggle_questiontitle);
957 
958  if ($a_block_id) {
959  $questionblock = ilObjSurvey::_getQuestionblock($a_block_id);
960  $title->setValue($questionblock["title"]);
961  $toggle_blocktitle->setChecked($questionblock["show_blocktitle"]);
962  $toggle_questiontitle->setChecked($questionblock["show_questiontext"]);
963  } else {
964  $toggle_blocktitle->setChecked(true);
965  $toggle_questiontitle->setChecked(true);
966  }
967 
968  $form->addCommandButton("saveDefineQuestionblock", $this->lng->txt("save"));
969  $form->addCommandButton("questions", $this->lng->txt("cancel"));
970 
971  // reload?
972  if (!$a_question_ids && $_POST["qids"]) {
973  $a_question_ids = $_POST["qids"];
974  }
975 
976  if ($a_question_ids) {
977  foreach ($a_question_ids as $q_id) {
978  $hidden = new ilHiddenInputGUI("qids[]");
979  $hidden->setValue($q_id);
980  $form->addItem($hidden);
981  }
982  }
983 
984  return $form;
985  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
This class represents a hidden form property in a property form.
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestionblocksObject()

ilSurveyEditorGUI::insertQuestionblocksObject ( )

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

References $_POST, and ilUtil\sendInfo().

863  {
864  $inserted_objects = 0;
865  if (is_array($_POST['cb'])) {
866  if ($_REQUEST["pgov"]) {
867  $page_gui = new ilSurveyPageGUI($this->object, $this);
868  $page_gui->determineCurrentPage();
869 
870  // as target position is predefined, insert in reverse order
871  $_POST['cb'] = array_reverse($_POST['cb']);
872  }
873  foreach ($_POST['cb'] as $questionblock_id) {
874  if (!$_REQUEST["pgov"]) {
875  $this->object->insertQuestionblock($questionblock_id);
876  } else {
877  $page_gui->insertQuestionblock($questionblock_id);
878  }
879  $inserted_objects++;
880  }
881  }
882  if ($inserted_objects) {
883  $this->object->saveCompletionStatus();
884  ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt("questionblock_inserted") : $this->lng->txt("questionblocks_inserted"), true);
885  if (!$_REQUEST["pgov"]) {
886  $this->ctrl->redirect($this, "questions");
887  } else {
888  $target_page = $_REQUEST["pgov"];
889  if (substr($_REQUEST["pgov_pos"], -1) == "c") {
890  $target_page++;
891  }
892  $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
893  $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
894  }
895  } else {
896  ilUtil::sendInfo($this->lng->txt("insert_missing_questionblock"), true);
897  $this->ctrl->redirect($this, 'browseForQuestionblocks');
898  }
899  }
Survey per page view.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ insertQuestions()

ilSurveyEditorGUI::insertQuestions (   $insert_mode)
protected

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

References $_POST, $_SESSION, gatherSelectedTableItems(), and ilUtil\sendInfo().

Referenced by insertQuestionsAfterObject(), and insertQuestionsBeforeObject().

404  {
405  $insert_id = null;
406  if ($_POST["id"]) {
407  $items = $this->gatherSelectedTableItems(true, true, false, false);
408 
409  // we are using POST id for original order
410  while (!$insert_id && sizeof($_POST["id"])) {
411  $target = array_shift($_POST["id"]);
412  if (preg_match("/^cb_(\d+)$/", $target, $matches)) {
413  // questions in blocks are not allowed
414  if (in_array($matches[1], $items["questions"])) {
415  $insert_id = $matches[1];
416  }
417  }
418  if (!$insert_id && preg_match("/^cb_qb_(\d+)$/", $target, $matches)) {
419  $ids = $this->object->getQuestionblockQuestionIds($matches[1]);
420  if (count($ids)) {
421  if ($insert_mode == 0) {
422  $insert_id = $ids[0];
423  } elseif ($insert_mode == 1) {
424  $insert_id = $ids[count($ids) - 1];
425  }
426  }
427  }
428  }
429  }
430 
431  if (!$insert_id) {
432  ilUtil::sendInfo($this->lng->txt("no_target_selected_for_move"), true);
433  } else {
434  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
435  $this->object->moveQuestions($_SESSION["move_questions"], $insert_id, $insert_mode);
436  unset($_SESSION["move_questions"]);
437  unset($_SESSION["move_questions_survey_id"]);
438  }
439 
440  $this->ctrl->redirect($this, "questions");
441  }
$_SESSION["AccountId"]
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestionsAfterObject()

ilSurveyEditorGUI::insertQuestionsAfterObject ( )

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

References insertQuestions().

399  {
400  $this->insertQuestions(1);
401  }
+ Here is the call graph for this function:

◆ insertQuestionsBeforeObject()

ilSurveyEditorGUI::insertQuestionsBeforeObject ( )

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

References insertQuestions().

394  {
395  $this->insertQuestions(0);
396  }
+ Here is the call graph for this function:

◆ insertQuestionsObject()

ilSurveyEditorGUI::insertQuestionsObject ( )

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

References $_POST, and ilUtil\sendInfo().

795  {
796  $inserted_objects = 0;
797  if (is_array($_POST['q_id'])) {
798  if ($_REQUEST["pgov"]) {
799  $page_gui = new ilSurveyPageGUI($this->object, $this);
800  $page_gui->determineCurrentPage();
801 
802  // as target position is predefined, insert in reverse order
803  $_POST['q_id'] = array_reverse($_POST['q_id']);
804  }
805  foreach ($_POST['q_id'] as $question_id) {
806  if (!$_REQUEST["pgov"]) {
807  $this->object->insertQuestion($question_id);
808  } else {
809  // target position (pgov pos) is processed there
810  $page_gui->insertNewQuestion($question_id);
811  }
812  $inserted_objects++;
813  }
814  }
815  if ($inserted_objects) {
816  $this->object->saveCompletionStatus();
817  ilUtil::sendSuccess($this->lng->txt("questions_inserted"), true);
818  if (!$_REQUEST["pgov"]) {
819  $this->ctrl->redirect($this, "questions");
820  } else {
821  $target_page = $_REQUEST["pgov"];
822  if (substr($_REQUEST["pgov_pos"], -1) == "c") {
823  // see ilSurveyPageGUI::insertNewQuestion()
824  if ((int) $_REQUEST["pgov_pos"]) {
825  $target_page++;
826  } else {
827  $target_page = 1;
828  }
829  }
830  $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
831  $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
832  }
833  } else {
834  ilUtil::sendInfo($this->lng->txt("insert_missing_question"), true);
835  $this->ctrl->redirect($this, 'browseForQuestions');
836  }
837  }
Survey per page view.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ moveQuestionsObject()

ilSurveyEditorGUI::moveQuestionsObject ( )

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

References $_SESSION, gatherSelectedTableItems(), questionsObject(), and ilUtil\sendInfo().

373  {
374  $items = $this->gatherSelectedTableItems(true, true, false, false);
375 
376  $move_questions = $items["questions"];
377  foreach ($items["blocks"] as $block_id) {
378  foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
379  array_push($move_questions, $qid);
380  }
381  }
382  if (count($move_questions) == 0) {
383  ilUtil::sendInfo($this->lng->txt("no_question_selected_for_move"), true);
384  $this->ctrl->redirect($this, "questions");
385  } else {
386  $_SESSION["move_questions"] = $move_questions;
387  $_SESSION["move_questions_survey_id"] = $this->object->getId();
388  ilUtil::sendInfo($this->lng->txt("select_target_position_for_move_question"));
389  $this->questionsObject();
390  }
391  }
$_SESSION["AccountId"]
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ printViewObject()

ilSurveyEditorGUI::printViewObject ( )

Creates a print view of the survey questions.

public

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

References $_GET, $toolbar, ilSubmitButton\getInstance(), ilLinkButton\getInstance(), ilRPCServerSettings\getInstance(), ilMathJax\getInstance(), ilMathJax\PURPOSE_DEFERRED_PDF, ilMathJax\PURPOSE_PDF, questionsSubtabs(), ilMathJax\RENDER_PNG_AS_FO_FILE, and ilUtil\sendFailure().

1166  {
1167  $ilToolbar = $this->toolbar;
1168 
1169  $this->questionsSubtabs("print");
1170 
1171  #21023 and #19448
1172  if (!$current_title = (int) $_REQUEST['export_label']) {
1173  $current_title = $this->object->getShowQuestionTitles();
1174  }
1175 
1176  $label = new ilSelectInputGUI($this->lng->txt("title") . "/" . $this->lng->txt("label"), "export_label");
1177 
1178  #19448 comment none and label only options.
1179  $label->setOptions($this->print_options);
1180  $label->setValue($current_title);
1181 
1182  $ilToolbar->addStickyItem($label, true);
1183 
1184  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "printView"));
1185 
1186  $button = ilSubmitButton::getInstance();
1187  $button->setCaption("show");
1188  $button->setCommand("printView");
1189  $ilToolbar->addStickyItem($button);
1190 
1191  $ilToolbar->addSeparator();
1192 
1193  $button = ilLinkButton::getInstance();
1194  $button->setCaption("print");
1195  $button->setOnClick("window.print(); return false;");
1196  $button->setOmitPreventDoubleSubmission(true);
1197  $ilToolbar->addButtonInstance($button);
1198 
1199  if (ilRPCServerSettings::getInstance()->isEnabled()) {
1200  $this->ctrl->setParameter($this, "export_label", $current_title);
1201  $this->ctrl->setParameter($this, "pdf", "1");
1202  $pdf_url = $this->ctrl->getLinkTarget($this, "printView");
1203  $this->ctrl->setParameter($this, "pdf", "");
1204  $this->ctrl->setParameter($this, "export_label", "");
1205 
1206  $button = ilLinkButton::getInstance();
1207  $button->setCaption("pdf_export");
1208  $button->setUrl($pdf_url);
1209  $button->setOmitPreventDoubleSubmission(true);
1210  $ilToolbar->addButtonInstance($button);
1211  }
1212 
1213  // defer rendering of tex to fo processing
1214  if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1)) {
1215  require_once('Services/MathJax/classes/class.ilMathJax.php');
1217  }
1218 
1219  $template = new ilTemplate("tpl.il_svy_svy_printview.html", true, true, "Modules/Survey");
1220 
1221  $pages = &$this->object->getSurveyPages();
1222  $required = false;
1223  foreach ($pages as $page) {
1224  if (count($page) > 0) {
1225  foreach ($page as $question) {
1226  $questionGUI = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
1227  if (is_object($questionGUI)) {
1228  if (strlen($question["heading"])) {
1229  $template->setCurrentBlock("textblock");
1230  $template->setVariable("TEXTBLOCK", $question["heading"]);
1231  $template->parseCurrentBlock();
1232  }
1233  $template->setCurrentBlock("question");
1234  $template->setVariable("QUESTION_DATA", $questionGUI->getPrintView($current_title, $question["questionblock_show_questiontext"], $this->object->getSurveyId()));
1235  $template->parseCurrentBlock();
1236 
1237  if ($question["obligatory"]) {
1238  $required = true;
1239  }
1240  }
1241  }
1242  if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"]) {
1243  $template->setCurrentBlock("page");
1244  $template->setVariable("BLOCKTITLE", $page[0]["questionblock_title"]);
1245  $template->parseCurrentBlock();
1246  } else {
1247  $template->setCurrentBlock("page");
1248  $template->parseCurrentBlock();
1249  }
1250  }
1251  }
1252 
1253  // #6412
1254  if ($required) {
1255  $template->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
1256  }
1257 
1258  // $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
1259  if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1)) {
1260  $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", true, true, "Modules/Test");
1261  $printbody->setVariable("TITLE", sprintf($this->lng->txt("tst_result_user_name"), $uname));
1262  $printbody->setVariable("ADM_CONTENT", $template->get());
1263  $printoutput = $printbody->get();
1264  $printoutput = preg_replace("/href=\".*?\"/", "", $printoutput);
1265  $fo = $this->object->processPrintoutput2FO($printoutput);
1266 
1267  // render tex as fo graphics
1268  require_once('Services/MathJax/classes/class.ilMathJax.php');
1269  $fo = ilMathJax::getInstance()
1270  ->init(ilMathJax::PURPOSE_PDF)
1271  ->setRendering(ilMathJax::RENDER_PNG_AS_FO_FILE)
1272  ->insertLatexImages($fo);
1273 
1274  // #11436
1275  if (!$fo || !$this->object->deliverPDFfromFO($fo)) {
1276  ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
1277  $this->ctrl->redirect($this, "printView");
1278  }
1279  } else {
1280  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1281  }
1282  }
$_GET["client_id"]
const PURPOSE_PDF
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const RENDER_PNG_AS_FO_FILE
static getInstance()
Singleton: get instance.
const PURPOSE_DEFERRED_PDF
static getInstance()
Get singelton instance.
+ Here is the call graph for this function:

◆ questionsObject()

ilSurveyEditorGUI::questionsObject ( )

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

References $_GET, $data, $ilUser, $toolbar, $user, ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjSurvey\_hasDatasets(), ilSubmitButton\getInstance(), ilLinkButton\getInstance(), questionsSubtabs(), and ilUtil\sendFailure().

Referenced by moveQuestionsObject().

207  {
208  $ilToolbar = $this->toolbar;
210 
211  // insert new questions?
212  if ($_GET["new_id"] > 0) {
213  // add a question to the survey previous created in a questionpool
214  $existing = $this->object->getExistingQuestions();
215  if (!in_array($_GET["new_id"], $existing)) {
216  $inserted = $this->object->insertQuestion($_GET["new_id"]);
217  if (!$inserted) {
218  ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
219  }
220  }
221  }
222 
223  $this->questionsSubtabs("questions");
224 
225  $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
226  $read_only = $hasDatasets;
227 
228  // toolbar
229  if (!$read_only) {
230  $qtypes = array();
231  foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
232  $qtypes[$data["type_tag"]] = $translation;
233  }
234 
235  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
236  $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
237  $types->setOptions($qtypes);
238  $ilToolbar->addStickyItem($types, "");
239 
240  $button = ilSubmitButton::getInstance();
241  $button->setCaption("svy_create_question");
242  $button->setCommand("createQuestion");
243  $ilToolbar->addStickyItem($button);
244 
245  if ($this->object->isPoolActive()) {
246  $ilToolbar->addSeparator();
247 
248  $cmd = ($ilUser->getPref('svy_insert_type') == 1 ||
249  strlen($ilUser->getPref('svy_insert_type')) == 0)
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  $mess = "";
267  if ($hasDatasets) {
268  $mbox = new ilSurveyContainsDataMessageBoxGUI();
269  $mess = $mbox->getHTML();
270  }
271 
272  // table gui
273  $table = new ilSurveyQuestionTableGUI(
274  $this,
275  "questions",
276  $this->object,
277  $read_only
278  );
279  $this->tpl->setContent($mess . $table->getHTML());
280  }
$data
Definition: storeScorm.php:23
$_GET["client_id"]
static _hasDatasets($survey_id)
Message box for survey, when data is alrady available.
$ilUser
Definition: imgupload.php:18
Survey question table GUI class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _getQuestiontypes()
Creates a list of all available question types.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ questionsSubtabs()

ilSurveyEditorGUI::questionsSubtabs (   $a_cmd)
protected

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

References $tabs.

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

150  {
151  $ilTabs = $this->tabs;
152 
153  if ($a_cmd == "questions" && $_REQUEST["pgov"]) {
154  $a_cmd = "page";
155  }
156 
157  $hidden_tabs = array();
158  $template = $this->object->getTemplate();
159  if ($template) {
160  $template = new ilSettingsTemplate($template);
161  $hidden_tabs = $template->getHiddenTabs();
162  }
163 
164  $ilTabs->addSubTab(
165  "page",
166  $this->lng->txt("survey_per_page_view"),
167  $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderPage")
168  );
169 
170  if (!in_array("survey_question_editor", $hidden_tabs)) {
171  $this->ctrl->setParameter($this, "pgov", "");
172  $ilTabs->addSubTab(
173  "questions",
174  $this->lng->txt("survey_question_editor"),
175  $this->ctrl->getLinkTarget($this, "questions")
176  );
177  $this->ctrl->setParameter($this, "pgov", $_REQUEST["pgov"]);
178  }
179 
180  $ilTabs->addSubTab(
181  "print",
182  $this->lng->txt("print_view"),
183  $this->ctrl->getLinkTarget($this, "printView")
184  );
185 
186  if ($this->object->getSurveyPages()) {
187  if ($a_cmd == "page") {
188  $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "pgov", max(1, $_REQUEST["pg"]));
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  }
Settings template application class.
+ Here is the caller graph for this function:

◆ removeHeadingObject()

ilSurveyEditorGUI::removeHeadingObject ( )

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

References questionsSubtabs().

1129  {
1130  $q_id = (int) $_REQUEST["q_id"];
1131  $this->ctrl->setParameter($this, "q_id", $q_id);
1132 
1133  if (!$q_id) {
1134  $this->ctrl->redirect($this, "questions");
1135  }
1136 
1137  $this->questionsSubtabs("questions");
1138 
1139  $cgui = new ilConfirmationGUI();
1140  $cgui->setHeaderText($this->lng->txt("confirm_remove_heading"));
1141 
1142  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedRemoveHeading"));
1143  $cgui->setCancel($this->lng->txt("cancel"), "questions");
1144  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedRemoveHeading");
1145 
1146  $this->tpl->setContent($cgui->getHTML());
1147  }
Confirmation screen class.
+ Here is the call graph for this function:

◆ removeQuestionsForm()

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

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

References $data, $type, and SurveyQuestion\_getQuestionTypeName().

Referenced by removeQuestionsObject().

457  {
458  $cgui = new ilConfirmationGUI();
459  $cgui->setHeaderText($this->lng->txt("survey_sure_delete_questions"));
460 
461  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
462  $cgui->setCancel($this->lng->txt("cancel"), "questions");
463  $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
464 
465  $counter = 0;
466  $surveyquestions = &$this->object->getSurveyQuestions();
467  foreach ($surveyquestions as $question_id => $data) {
468  if (in_array($data["question_id"], $checked_questions)) {
470 
471  $cgui->addItem(
472  "id_" . $data["question_id"],
473  $data["question_id"],
474  $type . ": " . $data["title"]
475  );
476  } elseif ((in_array($data["questionblock_id"], $checked_questionblocks))) {
478 
479  $cgui->addItem(
480  "id_qb_" . $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  "id_tb_" . $data["question_id"],
487  $data["question_id"],
488  $data["heading"]
489  );
490  }
491  }
492 
493  $this->tpl->setContent($cgui->getHTML());
494  }
$data
Definition: storeScorm.php:23
$type
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionsObject()

ilSurveyEditorGUI::removeQuestionsObject ( )

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

References gatherSelectedTableItems(), removeQuestionsForm(), ilUtil\sendInfo(), and ilUtil\sendQuestion().

444  {
445  $items = $this->gatherSelectedTableItems(true, true, true, true);
446  if (count($items["blocks"]) + count($items["questions"]) + count($items["headings"]) > 0) {
447  ilUtil::sendQuestion($this->lng->txt("remove_questions"));
448  $this->removeQuestionsForm($items["blocks"], $items["questions"], $items["headings"]);
449  return;
450  } else {
451  ilUtil::sendInfo($this->lng->txt("no_question_selected_for_removal"), true);
452  $this->ctrl->redirect($this, "questions");
453  }
454  }
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
removeQuestionsForm($checked_questionblocks, $checked_questions, $checked_headings)
+ Here is the call graph for this function:

◆ resetfilterQuestionblockBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionblockBrowserObject ( )

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

856  {
857  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
858  $table_gui->resetFilter();
859  $this->ctrl->redirect($this, 'browseForQuestionblocks');
860  }

◆ resetfilterQuestionBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionBrowserObject ( )

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

788  {
789  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
790  $table_gui->resetFilter();
791  $this->ctrl->redirect($this, 'browseForQuestions');
792  }

◆ saveDefineQuestionblockObject()

ilSurveyEditorGUI::saveDefineQuestionblockObject ( )

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

References $_POST, editQuestionblockObject(), and initQuestionblockForm().

988  {
989  $block_id = (int) $_REQUEST["bl_id"];
990  $q_ids = $_POST["qids"];
991 
992  $this->ctrl->setParameter($this, "bl_id", $block_id);
993 
994  if (!$block_id && !is_array($q_ids)) {
995  $this->ctrl->redirect($this, "questions");
996  }
997 
998  $form = $this->initQuestionblockForm($block_id);
999  if ($form->checkInput()) {
1000  $title = $form->getInput("title");
1001  $show_questiontext = $form->getInput("show_questiontext");
1002  $show_blocktitle = $form->getInput("show_blocktitle") ;
1003  if ($block_id) {
1004  $this->object->modifyQuestionblock(
1005  $block_id,
1006  $title,
1007  $show_questiontext,
1008  $show_blocktitle
1009  );
1010  } elseif ($q_ids) {
1011  $this->object->createQuestionblock(
1012  $title,
1013  $show_questiontext,
1014  $show_blocktitle,
1015  $q_ids
1016  );
1017  }
1018 
1019  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
1020  $this->ctrl->redirect($this, "questions");
1021  }
1022 
1023  $form->setValuesByPost();
1024  $this->editQuestionblockObject($form);
1025  }
editQuestionblockObject(ilPropertyFormGUI $a_form=null)
initQuestionblockForm($a_block_id=null, $a_question_ids=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ saveHeadingObject()

ilSurveyEditorGUI::saveHeadingObject ( )

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

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

1106  {
1107  // #15474
1108  $q_id = (int) $_REQUEST["q_id"];
1109  $this->ctrl->setParameter($this, "q_id", $q_id);
1110 
1111  $form = $this->initHeadingForm($q_id);
1112  if ($form->checkInput()) {
1113  $this->object->saveHeading(
1115  $form->getInput("heading"),
1116  true,
1118  ),
1119  $form->getInput("insertbefore")
1120  );
1121  $this->ctrl->redirect($this, "questions");
1122  }
1123 
1124  $form->setValuesByPost();
1125  $this->addHeadingObject($form);
1126  }
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
addHeadingObject(ilPropertyFormGUI $a_form=null)
initHeadingForm($a_question_id=null)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ saveObligatoryObject()

ilSurveyEditorGUI::saveObligatoryObject ( )

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

References $_POST.

325  {
326  if (isset($_POST["order"])) {
327  $position = -1;
328  $order = array();
329  asort($_POST["order"]);
330  foreach (array_keys($_POST["order"]) as $id) {
331  // block items
332  if (substr($id, 0, 3) == "qb_") {
333  $block_id = substr($id, 3);
334  $block = $_POST["block_order"][$block_id];
335  asort($block);
336  foreach (array_keys($block) as $question_id) {
337  $position++;
338  $order[$question_id] = $position;
339  }
340  } else {
341  $question_id = substr($id, 2);
342  $position++;
343  $order[$question_id] = $position;
344  }
345  }
346  $this->object->updateOrder($order);
347  }
348 
349  $obligatory = array();
350  foreach ($_POST as $key => $value) {
351  if (preg_match("/obligatory_(\d+)/", $key, $matches)) {
352  $obligatory[$matches[1]] = 1;
353  }
354  }
355  $this->object->setObligatoryStates($obligatory);
356  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
357  $this->ctrl->redirect($this, "questions");
358  }
$_POST["username"]

◆ setBrowseForQuestionsSubtabs()

ilSurveyEditorGUI::setBrowseForQuestionsSubtabs ( )
protected

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

References $ilUser, $tabs, $toolbar, and $user.

Referenced by browseForQuestionblocksObject(), and browseForQuestionsObject().

729  {
730  $ilTabs = $this->tabs;
731  $ilToolbar = $this->toolbar;
733 
734  if (!isset($_REQUEST["pgov"])) {
735  $link = $this->ctrl->getLinkTarget($this, "questions");
736  } else {
737  $link = $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderpage");
738  }
739  $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $link);
740 
741  // type selector
742  $types = new ilSelectInputGUI($this->lng->txt("display_all_available"), "datatype");
743  $types->setOptions(array(
744  1 => $this->lng->txt("questions"),
745  2 => $this->lng->txt("questionblocks")
746  ));
747  $types->setValue($ilUser->getPref('svy_insert_type'));
748  $ilToolbar->addInputItem($types, true);
749  $ilToolbar->addFormButton($this->lng->txt("change"), "changeDatatype");
750  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "changeDatatype"));
751  }
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ unfoldQuestionblockObject()

ilSurveyEditorGUI::unfoldQuestionblockObject ( )

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

References gatherSelectedTableItems(), and ilUtil\sendInfo().

361  {
362  $items = $this->gatherSelectedTableItems(true, false, false, false);
363  if (count($items["blocks"])) {
364  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
365  $this->object->unfoldQuestionblocks($items["blocks"]);
366  } else {
367  ilUtil::sendInfo($this->lng->txt("qpl_unfold_select_none"), true);
368  }
369  $this->ctrl->redirect($this, "questions");
370  }
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilSurveyEditorGUI::$ctrl
protected

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

◆ $help

ilSurveyEditorGUI::$help
protected

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

Referenced by executeCommand().

◆ $lng

ilSurveyEditorGUI::$lng
protected

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

Referenced by __construct().

◆ $object

ilSurveyEditorGUI::$object
protected

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

◆ $parent_gui

ilSurveyEditorGUI::$parent_gui
protected

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

◆ $print_options

ilSurveyEditorGUI::$print_options
protected

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

◆ $tabs

ilSurveyEditorGUI::$tabs
protected

◆ $toolbar

ilSurveyEditorGUI::$toolbar
protected

◆ $tpl

ilSurveyEditorGUI::$tpl
protected

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

Referenced by __construct().

◆ $tree

ilSurveyEditorGUI::$tree
protected

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

Referenced by createQuestionPool().

◆ $user

ilSurveyEditorGUI::$user
protected

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