ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

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
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addHeadingObject()

ilSurveyEditorGUI::addHeadingObject ( ilPropertyFormGUI  $a_form = null)

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

1101 {
1102 $q_id = $_REQUEST["q_id"];
1103 $this->ctrl->setParameter($this, "q_id", $q_id);
1104
1105 $this->questionsSubtabs("questions");
1106
1107 if (!$a_form) {
1108 $a_form = $this->initHeadingForm($q_id);
1109 }
1110
1111 $this->tpl->setContent($a_form->getHTML());
1112 }
initHeadingForm($a_question_id=null)

References initHeadingForm(), and questionsSubtabs().

Referenced by saveHeadingObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browseForQuestionblocksObject()

ilSurveyEditorGUI::browseForQuestionblocksObject ( )

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

859 {
861
862 include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
863 $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object, true);
864 $table_gui->setEditable(true);
865 $this->tpl->setContent($table_gui->getHTML());
866 }

References setBrowseForQuestionsSubtabs().

+ Here is the call graph for this function:

◆ browseForQuestionsObject()

ilSurveyEditorGUI::browseForQuestionsObject ( )

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

787 {
789
790 include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
791 $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object, true);
792 $table_gui->setEditable(true);
793 $this->tpl->setContent($table_gui->getHTML());
794 }

References setBrowseForQuestionsSubtabs().

+ Here is the call graph for this function:

◆ changeDatatypeObject()

ilSurveyEditorGUI::changeDatatypeObject ( )

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

769 {
771
772 $ilUser->writePref('svy_insert_type', $_POST['datatype']);
773
774 switch ($_POST["datatype"]) {
775 case 2:
776 $this->ctrl->redirect($this, 'browseForQuestionblocks');
777 break;
778
779 case 1:
780 default:
781 $this->ctrl->redirect($this, 'browseForQuestions');
782 break;
783 }
784 }
$_POST["username"]
$ilUser
Definition: imgupload.php:18

References $_POST, $ilUser, and $user.

◆ confirmedRemoveHeadingObject()

ilSurveyEditorGUI::confirmedRemoveHeadingObject ( )

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

1175 {
1176 $q_id = (int) $_REQUEST["q_id"];
1177 if (!$q_id) {
1178 $this->ctrl->redirect($this, "questions");
1179 }
1180
1181 $this->object->saveHeading("", $q_id);
1182 $this->ctrl->redirect($this, "questions");
1183 }

◆ confirmRemoveQuestionsObject()

ilSurveyEditorGUI::confirmRemoveQuestionsObject ( )

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

507 {
508 $checked_questions = array();
509 $checked_questionblocks = array();
510 $checked_headings = array();
511 foreach ($_POST as $key => $value) {
512 if (preg_match("/id_(\d+)/", $key, $matches)) {
513 array_push($checked_questions, $matches[1]);
514 }
515 if (preg_match("/id_qb_(\d+)/", $key, $matches)) {
516 array_push($checked_questionblocks, $matches[1]);
517 }
518 if (preg_match("/id_tb_(\d+)/", $key, $matches)) {
519 array_push($checked_headings, $matches[1]);
520 }
521 }
522
523 if (sizeof($checked_questions) || sizeof($checked_questionblocks)) {
524 $this->object->removeQuestions($checked_questions, $checked_questionblocks);
525 }
526 if ($checked_headings) {
527 foreach ($checked_headings as $q_id) {
528 $this->object->saveHeading("", $q_id);
529 }
530 }
531 $this->object->saveCompletionStatus();
532 ilUtil::sendSuccess($this->lng->txt("questions_removed"), true);
533 $this->ctrl->redirect($this, "questions");
534 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$key
Definition: croninfo.php:18

References $_POST, $key, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ copyQuestionsToPoolObject()

ilSurveyEditorGUI::copyQuestionsToPoolObject ( )

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

537 {
538 $items = $this->gatherSelectedTableItems(true, true, false, true);
539
540 // gather questions from blocks
541 $copy_questions = $items["questions"];
542 foreach ($items["blocks"] as $block_id) {
543 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
544 array_push($copy_questions, $qid);
545 }
546 }
547 $copy_questions = array_unique($copy_questions);
548
549 // only if not already in pool
550 if (count($copy_questions)) {
551 foreach ($copy_questions as $idx => $question_id) {
552 $question = ilObjSurvey::_instanciateQuestion($question_id);
553 if ($question->getOriginalId()) {
554 unset($copy_questions[$idx]);
555 }
556 }
557 }
558 if (count($copy_questions) == 0) {
559 ilUtil::sendInfo($this->lng->txt("no_question_selected_for_copy_to_pool"), true);
560 $this->ctrl->redirect($this, "questions");
561 } else {
562 $this->questionsSubtabs("questions");
563
564 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
565 $form = new ilPropertyFormGUI();
566
567 $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
568
569 $ids = new ilHiddenInputGUI("question_ids");
570 $ids->setValue(implode(";", $copy_questions));
571 $form->addItem($ids);
572
573 $questionpools =&$this->object->getAvailableQuestionpools(false, false, true, "write");
574 $pools = new ilSelectInputGUI($this->lng->txt("survey_copy_select_questionpool"), "sel_spl");
575 $pools->setOptions($questionpools);
576 $form->addItem($pools);
577
578 $form->addCommandButton("executeCopyQuestionsToPool", $this->lng->txt("submit"));
579 $form->addCommandButton("questions", $this->lng->txt("cancel"));
580
581 return $this->tpl->setContent($form->getHTML());
582 }
583 }
This class represents a hidden form property in a property form.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
This class represents a property form user interface.
This class represents a selection list property in a property form.
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.
if(isset($_POST['submit'])) $form

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

+ Here is the call graph for this function:

◆ createQuestionblockObject()

ilSurveyEditorGUI::createQuestionblockObject ( ilPropertyFormGUI  $a_form = null)

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

943 {
944 if (!$a_form) {
945 // gather questions from table selected
946 $items = $this->gatherSelectedTableItems(false, true, false, false);
947 if (sizeof($_POST["qids"])) {
948 $items["questions"] = $_POST["qids"];
949 }
950 if (count($items["questions"]) < 2) {
951 ilUtil::sendInfo($this->lng->txt("qpl_define_questionblock_select_missing"), true);
952 $this->ctrl->redirect($this, "questions");
953 }
954
955 $a_form = $this->initQuestionblockForm(null, $items["questions"]);
956 }
957
958 $this->questionsSubtabs("questions");
959 $this->tpl->setContent($a_form->getHTML());
960 }
initQuestionblockForm($a_block_id=null, $a_question_ids=null)

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

+ Here is the call graph for this function:

◆ createQuestionObject()

ilSurveyEditorGUI::createQuestionObject ( ilPropertyFormGUI  $a_form = null)

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

611 {
612 if (!$this->object->isPoolActive()) {
613 $_POST["usage"] = 1;
614 $_GET["sel_question_types"] = $_POST["sel_question_types"];
615 return $this->executeCreateQuestionObject();
616 }
617
618 if (!$a_form) {
619 $this->questionsSubtabs("questions");
620
621 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
622 $form = new ilPropertyFormGUI();
623
624 $sel_question_types = (strlen($_POST["sel_question_types"])) ? $_POST["sel_question_types"] : $_GET["sel_question_types"];
625 $this->ctrl->setParameter($this, "sel_question_types", $sel_question_types);
626 $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
627 } else {
628 $form = $a_form;
629 }
630
631 $usage = new ilRadioGroupInputGUI($this->lng->txt("survey_pool_selection"), "usage");
632 $usage->setRequired(true);
633 $no_pool = new ilRadioOption($this->lng->txt("survey_no_pool"), 1);
634 $usage->addOption($no_pool);
635 $existing_pool = new ilRadioOption($this->lng->txt("survey_existing_pool"), 3);
636 $usage->addOption($existing_pool);
637 $new_pool = new ilRadioOption($this->lng->txt("survey_new_pool"), 2);
638 $usage->addOption($new_pool);
639 $form->addItem($usage);
640
641 if (isset($_SESSION["svy_qpool_choice"])) {
642 $usage->setValue($_SESSION["svy_qpool_choice"]);
643 } else {
644 // default: no pool
645 $usage->setValue(1);
646 }
647
648 $questionpools =&$this->object->getAvailableQuestionpools(false, true, true, "write");
649 $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_spl");
650 $pools->setOptions($questionpools);
651 $existing_pool->addSubItem($pools);
652
653 $name = new ilTextInputGUI($this->lng->txt("spl_new"), "name_spl"); // #11740
654 $name->setSize(50);
655 $name->setMaxLength(50);
656 $new_pool->addSubItem($name);
657
658 if ($a_form) {
659 return $a_form;
660 }
661
662 $form->addCommandButton("executeCreateQuestion", $this->lng->txt("submit"));
663 $form->addCommandButton("questions", $this->lng->txt("cancel"));
664
665 return $this->tpl->setContent($form->getHTML());
666 }
$_GET["client_id"]
$_SESSION["AccountId"]
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text property in a property form.
if($format !==null) $name
Definition: metadata.php:146

References $_GET, $_POST, $_SESSION, $form, $name, executeCreateQuestionObject(), and questionsSubtabs().

+ Here is the call graph for this function:

◆ createQuestionPool()

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

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

717 {
719
720 $parent_ref = $tree->getParentId($this->object->getRefId());
721
722 include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
723 $qpl = new ilObjSurveyQuestionPool();
724 $qpl->setType("spl");
725 $qpl->setTitle($name);
726 $qpl->setDescription("");
727 $qpl->create();
728 $qpl->createReference();
729 $qpl->putInTree($parent_ref);
730 $qpl->setPermissions($parent_ref);
731 $qpl->setOnline(1); // must be online to be available
732 $qpl->saveToDb();
733
734 return $qpl->getId();
735 }

References $name, and $tree.

Referenced by executeCreateQuestionObject().

+ Here is the caller graph for this function:

◆ editHeadingObject()

ilSurveyEditorGUI::editHeadingObject ( ilPropertyFormGUI  $a_form = null)

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

1115 {
1116 $q_id = $_REQUEST["q_id"];
1117 $this->ctrl->setParameter($this, "q_id", $q_id);
1118
1119 $this->questionsSubtabs("questions");
1120
1121 if (!$a_form) {
1122 $a_form = $this->initHeadingForm($q_id);
1123 }
1124
1125 $this->tpl->setContent($a_form->getHTML());
1126 }

References initHeadingForm(), and questionsSubtabs().

+ Here is the call graph for this function:

◆ editQuestionblockObject()

ilSurveyEditorGUI::editQuestionblockObject ( ilPropertyFormGUI  $a_form = null)

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

930 {
931 $block_id = (int) $_REQUEST["bl_id"];
932 $this->ctrl->setParameter($this, "bl_id", $block_id);
933
934 if (!$a_form) {
935 $a_form = $this->initQuestionblockForm($block_id);
936 }
937
938 $this->questionsSubtabs("questions");
939 $this->tpl->setContent($a_form->getHTML());
940 }

References initQuestionblockForm(), and questionsSubtabs().

Referenced by saveDefineQuestionblockObject().

+ 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.

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 include_once './Modules/Survey/classes/class.ilSurveyPageGUI.php';
118 $pg = new ilSurveyPageGUI($this->object, $this);
119 $this->ctrl->forwardCommand($pg);
120 break;
121
122 default:
123 // question gui
124 if (stristr($next_class, "questiongui")) {
125 $ilTabs->clearTargets();
126 $this->ctrl->saveParameter($this, array("new_for_survey"));
127
128 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
129 $q_gui = SurveyQuestionGUI::_getQuestionGUI(null, $_REQUEST["q_id"]);
130 if (is_object($q_gui->object)) {
131 $ilHelp = $this->help;
132 $ilHelp->setScreenIdComponent("spl_qt" . $q_gui->object->getQuestionTypeId());
133 }
134 // $q_gui->object->setObjId($this->object->getId());
135 $q_gui->setBackUrl($this->ctrl->getLinkTarget($this, "questions"));
136 $q_gui->setQuestionTabs();
137 $this->ctrl->forwardCommand($q_gui);
138
139 if (!(int) $_REQUEST["new_for_survey"]) {
140 // not on create
141 $this->tpl->setTitle($this->lng->txt("question") . ": " . $q_gui->object->getTitle());
142 }
143 } else {
144 $cmd .= "Object";
145 $this->$cmd();
146 }
147 break;
148 }
149 }
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
Survey per page view.

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

+ Here is the call graph for this function:

◆ executeCopyQuestionsToPoolObject()

ilSurveyEditorGUI::executeCopyQuestionsToPoolObject ( )

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

586 {
587 $question_ids = explode(";", $_POST["question_ids"]);
588 $pool_id = ilObject::_lookupObjId($_POST["sel_spl"]);
589
590 foreach ($question_ids as $qid) {
591 // create copy (== pool "original")
592 $new_question = ilObjSurvey::_instanciateQuestion($qid);
593 $new_question->setId();
594 $new_question->setObjId($pool_id);
595 $new_question->saveToDb();
596
597 // link "source" (survey) to copy (pool)
598 SurveyQuestion::_changeOriginalId($qid, $new_question->getId(), $pool_id);
599 }
600
601 ilUtil::sendSuccess($this->lng->txt("survey_copy_to_questionpool_success"), true);
602 $this->ctrl->redirect($this, "questions");
603 }
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
static _lookupObjId($a_id)

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

+ Here is the call graph for this function:

◆ executeCreateQuestionObject()

ilSurveyEditorGUI::executeCreateQuestionObject ( )

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

669 {
670 $_SESSION["svy_qpool_choice"] = $_POST["usage"];
671
672 $q_type = $_GET["sel_question_types"];
673
674 // no pool
675 if ($_POST["usage"] == 1) {
676 $obj_id = $this->object->getId();
677 }
678 // existing pool
679 elseif ($_POST["usage"] == 3 && strlen($_POST["sel_spl"])) {
680 $obj_id = ilObject::_lookupObjId($_POST["sel_spl"]);
681 }
682 // new pool
683 elseif ($_POST["usage"] == 2 && strlen($_POST["name_spl"])) {
684 $obj_id = $this->createQuestionPool($_POST["name_spl"]);
685 } else {
686 if (!$_POST["usage"]) {
687 ilUtil::sendFailure($this->lng->txt("select_one"), true);
688 } else {
689 ilUtil::sendFailure($this->lng->txt("err_no_pool_name"), true);
690 }
691 $this->ctrl->setParameter($this, "sel_question_types", $q_type);
692 $this->ctrl->redirect($this, "createQuestion");
693 }
694
695
696 // create question and redirect to question form
697
698 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
699 $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type);
700 $q_gui->object->setObjId($obj_id); // survey/pool!
701 $q_gui->object->createNewQuestion();
702 $q_gui_class = get_class($q_gui);
703
704 if ($_REQUEST["pgov"]) {
705 $this->ctrl->setParameterByClass($q_gui_class, "pgov", $_REQUEST["pgov"]);
706 $this->ctrl->setParameterByClass($q_gui_class, "pgov_pos", $_REQUEST["pgov_pos"]);
707 }
708
709 $this->ctrl->setParameterByClass($q_gui_class, "ref_id", $this->object->getRefId());
710 $this->ctrl->setParameterByClass($q_gui_class, "new_for_survey", $this->object->getRefId());
711 $this->ctrl->setParameterByClass($q_gui_class, "q_id", $q_gui->object->getId());
712 $this->ctrl->setParameterByClass($q_gui_class, "sel_question_types", $q_gui->getQuestionType());
713 $this->ctrl->redirectByClass($q_gui_class, "editQuestion");
714 }
createQuestionPool($name="dummy")
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

Referenced by createQuestionObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filterQuestionblockBrowserObject()

ilSurveyEditorGUI::filterQuestionblockBrowserObject ( )

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

869 {
870 include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
871 $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
872 $table_gui->writeFilterToSession();
873 $this->ctrl->redirect($this, 'browseForQuestionblocks');
874 }

◆ filterQuestionBrowserObject()

ilSurveyEditorGUI::filterQuestionBrowserObject ( )

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

797 {
798 include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
799 $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
800 $table_gui->writeFilterToSession();
801 $this->ctrl->redirect($this, 'browseForQuestions');
802 }

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

302 {
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 if ($_POST["id"]) {
310 foreach ($_POST["id"] as $key) {
311 // questions
312 if ($allow_questions && preg_match("/cb_(\d+)/", $key, $matches)) {
313 if (($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
314 !in_array($block_map[$matches[1]], $blocks)) {
315 array_push($questions, $matches[1]);
316 }
317 }
318 // blocks
319 if ($allow_blocks && preg_match("/cb_qb_(\d+)/", $key, $matches)) {
320 array_push($blocks, $matches[1]);
321 }
322 // headings
323 if ($allow_headings && preg_match("/cb_tb_(\d+)/", $key, $matches)) {
324 array_push($headings, $matches[1]);
325 }
326 }
327 }
328
329 return array("questions" => $questions,
330 "blocks" => $blocks,
331 "headings" => $headings);
332 }

References $_POST, and $key.

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

+ Here is the caller graph for this function:

◆ initHeadingForm()

ilSurveyEditorGUI::initHeadingForm (   $a_question_id = null)
protected

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

1056 {
1057 $survey_questions = $this->object->getSurveyQuestions();
1058
1059 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1060 $form = new ilPropertyFormGUI();
1061 $form->setFormAction($this->ctrl->getFormAction($this, ""));
1062
1063 // heading
1064 $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
1065 $heading->setRows(10);
1066 $heading->setCols(80);
1067 $heading->setUseRte(true);
1068 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1069 $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
1070 $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
1071 $heading->setRTESupport($this->object->getId(), "svy", "survey");
1072 $heading->setRequired(true);
1073 $form->addItem($heading);
1074
1075 $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
1076 $options = array();
1077 foreach ($survey_questions as $key => $value) {
1078 $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
1079 }
1080 $insertbefore->setOptions($options);
1081 $insertbefore->setRequired(true);
1082 $form->addItem($insertbefore);
1083
1084 $form->addCommandButton("saveHeading", $this->lng->txt("save"));
1085 $form->addCommandButton("questions", $this->lng->txt("cancel"));
1086
1087 if ($a_question_id) {
1088 $form->setTitle($this->lng->txt("edit_heading"));
1089
1090 $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"]));
1091 $insertbefore->setValue($a_question_id);
1092 $insertbefore->setDisabled(true);
1093 } else {
1094 $form->setTitle($this->lng->txt("add_heading"));
1095 }
1096
1097 return $form;
1098 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
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
This class represents a text area property in a property form.

References $form, $key, $options, ilObjAdvancedEditing\_getUsedHTMLTags(), and ilRTE\ILIAS_IMG_MANAGER_PLUGIN.

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

+ 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 962 of file class.ilSurveyEditorGUI.php.

963 {
964 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
965 $form = new ilPropertyFormGUI();
966 $form->setFormAction($this->ctrl->getFormAction($this, "saveDefineQuestionblock"));
967 $form->setTitle($this->lng->txt("define_questionblock"));
968
969 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
970 $title->setRequired(true);
971 $form->addItem($title);
972
973 $toggle_blocktitle = new ilCheckboxInputGUI($this->lng->txt("survey_show_blocktitle"), "show_blocktitle");
974 $toggle_blocktitle->setInfo($this->lng->txt("survey_show_blocktitle_description"));
975 $form->addItem($toggle_blocktitle);
976
977 $toggle_questiontitle = new ilCheckboxInputGUI($this->lng->txt("show_questiontext"), "show_questiontext");
978 $toggle_questiontitle->setInfo($this->lng->txt("show_questiontext_description"));
979 $form->addItem($toggle_questiontitle);
980
981 if ($a_block_id) {
982 $questionblock = ilObjSurvey::_getQuestionblock($a_block_id);
983 $title->setValue($questionblock["title"]);
984 $toggle_blocktitle->setChecked($questionblock["show_blocktitle"]);
985 $toggle_questiontitle->setChecked($questionblock["show_questiontext"]);
986 } else {
987 $toggle_blocktitle->setChecked(true);
988 $toggle_questiontitle->setChecked(true);
989 }
990
991 $form->addCommandButton("saveDefineQuestionblock", $this->lng->txt("save"));
992 $form->addCommandButton("questions", $this->lng->txt("cancel"));
993
994 // reload?
995 if (!$a_question_ids && $_POST["qids"]) {
996 $a_question_ids = $_POST["qids"];
997 }
998
999 if ($a_question_ids) {
1000 foreach ($a_question_ids as $q_id) {
1001 $hidden = new ilHiddenInputGUI("qids[]");
1002 $hidden->setValue($q_id);
1003 $form->addItem($hidden);
1004 }
1005 }
1006
1007 return $form;
1008 }
This class represents a checkbox property in a property form.
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.

References $_POST, $form, $title, and ilObjSurvey\_getQuestionblock().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestionblocksObject()

ilSurveyEditorGUI::insertQuestionblocksObject ( )

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

885 {
886 $inserted_objects = 0;
887 if (is_array($_POST['cb'])) {
888 if ($_REQUEST["pgov"]) {
889 include_once "Modules/Survey/classes/class.ilSurveyPageGUI.php";
890 $page_gui = new ilSurveyPageGUI($this->object, $this);
891 $page_gui->determineCurrentPage();
892
893 // as target position is predefined, insert in reverse order
894 $_POST['cb'] = array_reverse($_POST['cb']);
895 }
896 foreach ($_POST['cb'] as $questionblock_id) {
897 if (!$_REQUEST["pgov"]) {
898 $this->object->insertQuestionblock($questionblock_id);
899 } else {
900 $page_gui->insertQuestionblock($questionblock_id);
901 }
902 $inserted_objects++;
903 }
904 }
905 if ($inserted_objects) {
906 $this->object->saveCompletionStatus();
907 ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt("questionblock_inserted") : $this->lng->txt("questionblocks_inserted"), true);
908 if (!$_REQUEST["pgov"]) {
909 $this->ctrl->redirect($this, "questions");
910 } else {
911 $target_page = $_REQUEST["pgov"];
912 if (substr($_REQUEST["pgov_pos"], -1) == "c") {
913 $target_page++;
914 }
915 $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
916 $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
917 }
918 } else {
919 ilUtil::sendInfo($this->lng->txt("insert_missing_questionblock"), true);
920 $this->ctrl->redirect($this, 'browseForQuestionblocks');
921 }
922 }

References $_POST, ilUtil\sendInfo(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ insertQuestions()

ilSurveyEditorGUI::insertQuestions (   $insert_mode)
protected

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

413 {
414 $insert_id = null;
415 if ($_POST["id"]) {
416 $items = $this->gatherSelectedTableItems(true, true, false, false);
417
418 // we are using POST id for original order
419 while (!$insert_id && sizeof($_POST["id"])) {
420 $target = array_shift($_POST["id"]);
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 ilUtil::sendInfo($this->lng->txt("no_target_selected_for_move"), true);
442 } else {
443 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
444 $this->object->moveQuestions($_SESSION["move_questions"], $insert_id, $insert_mode);
445 unset($_SESSION["move_questions"]);
446 }
447
448 $this->ctrl->redirect($this, "questions");
449 }

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

Referenced by insertQuestionsAfterObject(), and insertQuestionsBeforeObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestionsAfterObject()

ilSurveyEditorGUI::insertQuestionsAfterObject ( )

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

408 {
409 $this->insertQuestions(1);
410 }

References insertQuestions().

+ Here is the call graph for this function:

◆ insertQuestionsBeforeObject()

ilSurveyEditorGUI::insertQuestionsBeforeObject ( )

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

403 {
404 $this->insertQuestions(0);
405 }

References insertQuestions().

+ Here is the call graph for this function:

◆ insertQuestionsObject()

ilSurveyEditorGUI::insertQuestionsObject ( )

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

813 {
814 $inserted_objects = 0;
815 if (is_array($_POST['q_id'])) {
816 if ($_REQUEST["pgov"]) {
817 include_once "Modules/Survey/classes/class.ilSurveyPageGUI.php";
818 $page_gui = new ilSurveyPageGUI($this->object, $this);
819 $page_gui->determineCurrentPage();
820
821 // as target position is predefined, insert in reverse order
822 $_POST['q_id'] = array_reverse($_POST['q_id']);
823 }
824 foreach ($_POST['q_id'] as $question_id) {
825 if (!$_REQUEST["pgov"]) {
826 $this->object->insertQuestion($question_id);
827 } else {
828 // target position (pgov pos) is processed there
829 $page_gui->insertNewQuestion($question_id);
830 }
831 $inserted_objects++;
832 }
833 }
834 if ($inserted_objects) {
835 $this->object->saveCompletionStatus();
836 ilUtil::sendSuccess($this->lng->txt("questions_inserted"), true);
837 if (!$_REQUEST["pgov"]) {
838 $this->ctrl->redirect($this, "questions");
839 } else {
840 $target_page = $_REQUEST["pgov"];
841 if (substr($_REQUEST["pgov_pos"], -1) == "c") {
842 // see ilSurveyPageGUI::insertNewQuestion()
843 if ((int) $_REQUEST["pgov_pos"]) {
844 $target_page++;
845 } else {
846 $target_page = 1;
847 }
848 }
849 $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
850 $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
851 }
852 } else {
853 ilUtil::sendInfo($this->lng->txt("insert_missing_question"), true);
854 $this->ctrl->redirect($this, 'browseForQuestions');
855 }
856 }

References $_POST, ilUtil\sendInfo(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ moveQuestionsObject()

ilSurveyEditorGUI::moveQuestionsObject ( )

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

383 {
384 $items = $this->gatherSelectedTableItems(true, true, false, false);
385
386 $move_questions = $items["questions"];
387 foreach ($items["blocks"] as $block_id) {
388 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
389 array_push($move_questions, $qid);
390 }
391 }
392 if (count($move_questions) == 0) {
393 ilUtil::sendInfo($this->lng->txt("no_question_selected_for_move"), true);
394 $this->ctrl->redirect($this, "questions");
395 } else {
396 $_SESSION["move_questions"] = $move_questions;
397 ilUtil::sendInfo($this->lng->txt("select_target_position_for_move_question"));
398 $this->questionsObject();
399 }
400 }

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

+ Here is the call graph for this function:

◆ printViewObject()

ilSurveyEditorGUI::printViewObject ( )

Creates a print view of the survey questions.

@access public

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

1191 {
1192 $ilToolbar = $this->toolbar;
1193
1194 $this->questionsSubtabs("print");
1195
1196 #21023 and #19448
1197 if (!$current_title = (int) $_REQUEST['export_label']) {
1198 $current_title = $this->object->getShowQuestionTitles();
1199 }
1200 /*if(!isset($_POST["export_label"]))
1201 {fir
1202 $_POST["export_label"] = $this->object->getShowQuestionTitles();
1203 }
1204 $current_title = (int)$_REQUEST["export_label"];
1205 */
1206
1207 include_once "Services/Form/classes/class.ilSelectInputGUI.php";
1208 $label = new ilSelectInputGUI($this->lng->txt("title") . "/" . $this->lng->txt("label"), "export_label");
1209
1210 #19448 comment none and label only options.
1211 $label->setOptions($this->print_options);
1212 $label->setValue($current_title);
1213
1214 $ilToolbar->addStickyItem($label, true);
1215
1216 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "printView"));
1217
1218 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
1219 $button = ilSubmitButton::getInstance();
1220 $button->setCaption("show");
1221 $button->setCommand("printView");
1222 $ilToolbar->addStickyItem($button);
1223
1224 $ilToolbar->addSeparator();
1225
1226 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1227 $button = ilLinkButton::getInstance();
1228 $button->setCaption("print");
1229 $button->setOnClick("window.print(); return false;");
1230 $button->setOmitPreventDoubleSubmission(true);
1231 $ilToolbar->addButtonInstance($button);
1232
1233 include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
1234 if (ilRPCServerSettings::getInstance()->isEnabled()) {
1235 $this->ctrl->setParameter($this, "export_label", $current_title);
1236 $this->ctrl->setParameter($this, "pdf", "1");
1237 $pdf_url = $this->ctrl->getLinkTarget($this, "printView");
1238 $this->ctrl->setParameter($this, "pdf", "");
1239 $this->ctrl->setParameter($this, "export_label", "");
1240
1241 $button = ilLinkButton::getInstance();
1242 $button->setCaption("pdf_export");
1243 $button->setUrl($pdf_url);
1244 $button->setOmitPreventDoubleSubmission(true);
1245 $ilToolbar->addButtonInstance($button);
1246 }
1247
1248 // defer rendering of tex to fo processing
1249 if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1)) {
1250 require_once('Services/MathJax/classes/class.ilMathJax.php');
1252 }
1253
1254 $template = new ilTemplate("tpl.il_svy_svy_printview.html", true, true, "Modules/Survey");
1255
1256 $pages =&$this->object->getSurveyPages();
1257 $required = false;
1258 foreach ($pages as $page) {
1259 if (count($page) > 0) {
1260 foreach ($page as $question) {
1261 $questionGUI = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
1262 if (is_object($questionGUI)) {
1263 if (strlen($question["heading"])) {
1264 $template->setCurrentBlock("textblock");
1265 $template->setVariable("TEXTBLOCK", $question["heading"]);
1266 $template->parseCurrentBlock();
1267 }
1268 $template->setCurrentBlock("question");
1269 $template->setVariable("QUESTION_DATA", $questionGUI->getPrintView($current_title, $question["questionblock_show_questiontext"], $this->object->getSurveyId()));
1270 $template->parseCurrentBlock();
1271
1272 if ($question["obligatory"]) {
1273 $required = true;
1274 }
1275 }
1276 }
1277 if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"]) {
1278 $template->setCurrentBlock("page");
1279 $template->setVariable("BLOCKTITLE", $page[0]["questionblock_title"]);
1280 $template->parseCurrentBlock();
1281 } else {
1282 $template->setCurrentBlock("page");
1283 $template->parseCurrentBlock();
1284 }
1285 }
1286 }
1287
1288 // #6412
1289 if ($required) {
1290 $template->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
1291 }
1292
1293 // $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
1294 if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1)) {
1295 $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", true, true, "Modules/Test");
1296 $printbody->setVariable("TITLE", sprintf($this->lng->txt("tst_result_user_name"), $uname));
1297 $printbody->setVariable("ADM_CONTENT", $template->get());
1298 $printoutput = $printbody->get();
1299 $printoutput = preg_replace("/href=\".*?\"/", "", $printoutput);
1300 $fo = $this->object->processPrintoutput2FO($printoutput);
1301
1302 // render tex as fo graphics
1303 require_once('Services/MathJax/classes/class.ilMathJax.php');
1306 ->setRendering(ilMathJax::RENDER_PNG_AS_FO_FILE)
1307 ->insertLatexImages($fo);
1308
1309 // #11436
1310 if (!$fo || !$this->object->deliverPDFfromFO($fo)) {
1311 ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
1312 $this->ctrl->redirect($this, "printView");
1313 }
1314 } else {
1315 $this->tpl->setVariable("ADM_CONTENT", $template->get());
1316 }
1317 }
sprintf('%.4f', $callTime)
static getInstance()
Factory.
static getInstance()
Singleton: get instance.
const PURPOSE_PDF
const PURPOSE_DEFERRED_PDF
const RENDER_PNG_AS_FO_FILE
static getInstance()
Get singelton instance.
static getInstance()
Factory.
special template class to simplify handling of ITX/PEAR
$template

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

+ Here is the call graph for this function:

◆ questionsObject()

ilSurveyEditorGUI::questionsObject ( )

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

210 {
211 $ilToolbar = $this->toolbar;
213
214 // insert new questions?
215 if ($_GET["new_id"] > 0) {
216 // add a question to the survey previous created in a questionpool
217 $existing = $this->object->getExistingQuestions();
218 if (!in_array($_GET["new_id"], $existing)) {
219 $inserted = $this->object->insertQuestion($_GET["new_id"]);
220 if (!$inserted) {
221 ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
222 }
223 }
224 }
225
226 $this->questionsSubtabs("questions");
227
228 $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
229 $read_only = $hasDatasets;
230
231 // toolbar
232 if (!$read_only) {
233 $qtypes = array();
234 include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
235 foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
236 $qtypes[$data["type_tag"]] = $translation;
237 }
238
239 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
240 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
241 $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
242 $types->setOptions($qtypes);
243 $ilToolbar->addStickyItem($types, "");
244
245 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
246 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
247
248 $button = ilSubmitButton::getInstance();
249 $button->setCaption("svy_create_question");
250 $button->setCommand("createQuestion");
251 $ilToolbar->addStickyItem($button);
252
253 if ($this->object->isPoolActive()) {
254 $ilToolbar->addSeparator();
255
256 $cmd = ($ilUser->getPref('svy_insert_type') == 1 ||
257 strlen($ilUser->getPref('svy_insert_type')) == 0)
258 ? 'browseForQuestions'
259 : 'browseForQuestionblocks';
260
261 $button = ilLinkButton::getInstance();
262 $button->setCaption("browse_for_questions");
263 $button->setUrl($this->ctrl->getLinkTarget($this, $cmd));
264 $ilToolbar->addStickyItem($button);
265 }
266
267 $ilToolbar->addSeparator();
268
269 $button = ilLinkButton::getInstance();
270 $button->setCaption("add_heading");
271 $button->setUrl($this->ctrl->getLinkTarget($this, "addHeading"));
272 $ilToolbar->addInputItem($button);
273 }
274 if ($hasDatasets) {
275 $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "maintenance");
276 $link = "<a href=\"" . $link . "\">" . $this->lng->txt("survey_has_datasets_warning_page_view_link") . "</a>";
277 ilUtil::sendInfo($this->lng->txt("survey_has_datasets_warning_page_view") . " " . $link);
278 }
279
280 // table gui
281
282 include_once "Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
284 $this,
285 "questions",
286 $this->object,
287 $read_only
288 );
289 $this->tpl->setContent($table->getHTML());
290 }
static _getQuestiontypes()
Creates a list of all available question types.
static _hasDatasets($survey_id)
Survey question table GUI class.
if(empty($password)) $table
Definition: pwgen.php:24

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

Referenced by moveQuestionsObject().

+ 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 151 of file class.ilSurveyEditorGUI.php.

152 {
153 $ilTabs = $this->tabs;
154
155 if ($a_cmd == "questions" && $_REQUEST["pgov"]) {
156 $a_cmd = "page";
157 }
158
159 $hidden_tabs = array();
160 $template = $this->object->getTemplate();
161 if ($template) {
162 include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
164 $hidden_tabs = $template->getHiddenTabs();
165 }
166
167 $ilTabs->addSubTab(
168 "page",
169 $this->lng->txt("survey_per_page_view"),
170 $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderPage")
171 );
172
173 if (!in_array("survey_question_editor", $hidden_tabs)) {
174 $this->ctrl->setParameter($this, "pgov", "");
175 $ilTabs->addSubTab(
176 "questions",
177 $this->lng->txt("survey_question_editor"),
178 $this->ctrl->getLinkTarget($this, "questions")
179 );
180 $this->ctrl->setParameter($this, "pgov", $_REQUEST["pgov"]);
181 }
182
183 $ilTabs->addSubTab(
184 "print",
185 $this->lng->txt("print_view"),
186 $this->ctrl->getLinkTarget($this, "printView")
187 );
188
189 if ($this->object->getSurveyPages()) {
190 if ($a_cmd == "page") {
191 $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "pgov", max(1, $_REQUEST["pg"]));
192 }
193 $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "prvw", 1);
194 $ilTabs->addSubTab(
195 "preview",
196 $this->lng->txt("preview"),
197 $this->ctrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyexecutiongui"), "preview")
198 );
199 }
200
201 $ilTabs->activateSubTab($a_cmd);
202 }
Settings template application class.

References $tabs, and $template.

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

+ Here is the caller graph for this function:

◆ removeHeadingObject()

ilSurveyEditorGUI::removeHeadingObject ( )

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

1153 {
1154 $q_id = (int) $_REQUEST["q_id"];
1155 $this->ctrl->setParameter($this, "q_id", $q_id);
1156
1157 if (!$q_id) {
1158 $this->ctrl->redirect($this, "questions");
1159 }
1160
1161 $this->questionsSubtabs("questions");
1162
1163 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1164 $cgui = new ilConfirmationGUI();
1165 $cgui->setHeaderText($this->lng->txt("confirm_remove_heading"));
1166
1167 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedRemoveHeading"));
1168 $cgui->setCancel($this->lng->txt("cancel"), "questions");
1169 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedRemoveHeading");
1170
1171 $this->tpl->setContent($cgui->getHTML());
1172 }
Confirmation screen class.

References questionsSubtabs().

+ Here is the call graph for this function:

◆ removeQuestionsForm()

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

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

465 {
466 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
467 $cgui = new ilConfirmationGUI();
468 $cgui->setHeaderText($this->lng->txt("survey_sure_delete_questions"));
469
470 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
471 $cgui->setCancel($this->lng->txt("cancel"), "questions");
472 $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
473
474 $counter = 0;
475 $surveyquestions =&$this->object->getSurveyQuestions();
476 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
477 foreach ($surveyquestions as $question_id => $data) {
478 if (in_array($data["question_id"], $checked_questions)) {
480
481 $cgui->addItem(
482 "id_" . $data["question_id"],
483 $data["question_id"],
484 $type . ": " . $data["title"]
485 );
486 } elseif ((in_array($data["questionblock_id"], $checked_questionblocks))) {
488
489 $cgui->addItem(
490 "id_qb_" . $data["questionblock_id"],
491 $data["questionblock_id"],
492 $data["questionblock_title"] . " - " . $type . ": " . $data["title"]
493 );
494 } elseif (in_array($data["question_id"], $checked_headings)) {
495 $cgui->addItem(
496 "id_tb_" . $data["question_id"],
497 $data["question_id"],
498 $data["heading"]
499 );
500 }
501 }
502
503 $this->tpl->setContent($cgui->getHTML());
504 }
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
$counter
$type

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

Referenced by removeQuestionsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionsObject()

ilSurveyEditorGUI::removeQuestionsObject ( )

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

452 {
453 $items = $this->gatherSelectedTableItems(true, true, true, true);
454 if (count($items["blocks"]) + count($items["questions"]) + count($items["headings"]) > 0) {
455 ilUtil::sendQuestion($this->lng->txt("remove_questions"));
456 $this->removeQuestionsForm($items["blocks"], $items["questions"], $items["headings"]);
457 return;
458 } else {
459 ilUtil::sendInfo($this->lng->txt("no_question_selected_for_removal"), true);
460 $this->ctrl->redirect($this, "questions");
461 }
462 }
removeQuestionsForm($checked_questionblocks, $checked_questions, $checked_headings)
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.

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

+ Here is the call graph for this function:

◆ resetfilterQuestionblockBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionblockBrowserObject ( )

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

877 {
878 include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
879 $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
880 $table_gui->resetFilter();
881 $this->ctrl->redirect($this, 'browseForQuestionblocks');
882 }

◆ resetfilterQuestionBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionBrowserObject ( )

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

805 {
806 include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
807 $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
808 $table_gui->resetFilter();
809 $this->ctrl->redirect($this, 'browseForQuestions');
810 }

◆ saveDefineQuestionblockObject()

ilSurveyEditorGUI::saveDefineQuestionblockObject ( )

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

1011 {
1012 $block_id = (int) $_REQUEST["bl_id"];
1013 $q_ids = $_POST["qids"];
1014
1015 $this->ctrl->setParameter($this, "bl_id", $block_id);
1016
1017 if (!$block_id && !is_array($q_ids)) {
1018 $this->ctrl->redirect($this, "questions");
1019 }
1020
1021 $form = $this->initQuestionblockForm($block_id);
1022 if ($form->checkInput()) {
1023 $title = $form->getInput("title");
1024 $show_questiontext = $form->getInput("show_questiontext");
1025 $show_blocktitle = $form->getInput("show_blocktitle") ;
1026 if ($block_id) {
1027 $this->object->modifyQuestionblock(
1028 $block_id,
1029 $title,
1030 $show_questiontext,
1031 $show_blocktitle
1032 );
1033 } elseif ($q_ids) {
1034 $this->object->createQuestionblock(
1035 $title,
1036 $show_questiontext,
1037 $show_blocktitle,
1038 $q_ids
1039 );
1040 }
1041
1042 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
1043 $this->ctrl->redirect($this, "questions");
1044 }
1045
1046 $form->setValuesByPost();
1048 }
editQuestionblockObject(ilPropertyFormGUI $a_form=null)

References $_POST, $form, $title, editQuestionblockObject(), initQuestionblockForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveHeadingObject()

ilSurveyEditorGUI::saveHeadingObject ( )

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

1129 {
1130 // #15474
1131 $q_id = (int) $_REQUEST["q_id"];
1132 $this->ctrl->setParameter($this, "q_id", $q_id);
1133
1134 $form = $this->initHeadingForm($q_id);
1135 if ($form->checkInput()) {
1136 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1137 $this->object->saveHeading(
1139 $form->getInput("heading"),
1140 true,
1142 ),
1143 $form->getInput("insertbefore")
1144 );
1145 $this->ctrl->redirect($this, "questions");
1146 }
1147
1148 $form->setValuesByPost();
1149 $this->addHeadingObject($form);
1150 }
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
addHeadingObject(ilPropertyFormGUI $a_form=null)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ saveObligatoryObject()

ilSurveyEditorGUI::saveObligatoryObject ( )

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

335 {
336 if (isset($_POST["order"])) {
337 $position = -1;
338 $order = array();
339 asort($_POST["order"]);
340 foreach (array_keys($_POST["order"]) as $id) {
341 // block items
342 if (substr($id, 0, 3) == "qb_") {
343 $block_id = substr($id, 3);
344 $block = $_POST["block_order"][$block_id];
345 asort($block);
346 foreach (array_keys($block) as $question_id) {
347 $position++;
348 $order[$question_id] = $position;
349 }
350 } else {
351 $question_id = substr($id, 2);
352 $position++;
353 $order[$question_id] = $position;
354 }
355 }
356 $this->object->updateOrder($order);
357 }
358
359 $obligatory = array();
360 foreach ($_POST as $key => $value) {
361 if (preg_match("/obligatory_(\d+)/", $key, $matches)) {
362 $obligatory[$matches[1]] = 1;
363 }
364 }
365 $this->object->setObligatoryStates($obligatory);
366 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
367 $this->ctrl->redirect($this, "questions");
368 }
if(!array_key_exists('StateId', $_REQUEST)) $id

References $_POST, $id, $key, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setBrowseForQuestionsSubtabs()

ilSurveyEditorGUI::setBrowseForQuestionsSubtabs ( )
protected

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

743 {
744 $ilTabs = $this->tabs;
745 $ilToolbar = $this->toolbar;
747
748 if (!isset($_REQUEST["pgov"])) {
749 $link = $this->ctrl->getLinkTarget($this, "questions");
750 } else {
751 $link = $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderpage");
752 }
753 $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $link);
754
755 // type selector
756 include_once "Services/Form/classes/class.ilSelectInputGUI.php";
757 $types = new ilSelectInputGUI($this->lng->txt("display_all_available"), "datatype");
758 $types->setOptions(array(
759 1 => $this->lng->txt("questions"),
760 2 => $this->lng->txt("questionblocks")
761 ));
762 $types->setValue($ilUser->getPref('svy_insert_type'));
763 $ilToolbar->addInputItem($types, true);
764 $ilToolbar->addFormButton($this->lng->txt("change"), "changeDatatype");
765 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "changeDatatype"));
766 }

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

Referenced by browseForQuestionblocksObject(), and browseForQuestionsObject().

+ Here is the caller graph for this function:

◆ unfoldQuestionblockObject()

ilSurveyEditorGUI::unfoldQuestionblockObject ( )

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

371 {
372 $items = $this->gatherSelectedTableItems(true, false, false, false);
373 if (count($items["blocks"])) {
374 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
375 $this->object->unfoldQuestionblocks($items["blocks"]);
376 } else {
377 ilUtil::sendInfo($this->lng->txt("qpl_unfold_select_none"), true);
378 }
379 $this->ctrl->redirect($this, "questions");
380 }

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

+ 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: