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();
76 $lng = $DIC->language();
79 $this->parent_gui = $a_parent_gui;
80 $this->
object = $this->parent_gui->object;
86 $this->ctrl->saveParameter($this, array(
"pgov",
"pgov_pos"));
88 $this->print_options = array(
100 $cmd = $this->ctrl->getCmd(
"questions");
102 if ($_REQUEST[
"pgov"]) {
103 if ($cmd ==
"questions") {
104 $this->ctrl->setCmdClass(
"ilsurveypagegui");
105 $this->ctrl->setCmd(
"renderpage");
106 } elseif ($cmd ==
"confirmRemoveQuestions") {
108 $this->ctrl->setCmdClass(
"ilsurveypagegui");
109 $this->ctrl->setCmd(
"confirmRemoveQuestions");
113 $next_class = $this->ctrl->getNextClass($this);
114 switch ($next_class) {
115 case 'ilsurveypagegui':
117 include_once
'./Modules/Survey/classes/class.ilSurveyPageGUI.php';
119 $this->ctrl->forwardCommand($pg);
124 if (stristr($next_class,
"questiongui")) {
125 $ilTabs->clearTargets();
126 $this->ctrl->saveParameter($this, array(
"new_for_survey"));
128 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
130 if (is_object($q_gui->object)) {
132 $ilHelp->setScreenIdComponent(
"spl_qt" . $q_gui->object->getQuestionTypeId());
135 $q_gui->setBackUrl($this->ctrl->getLinkTarget($this,
"questions"));
136 $q_gui->setQuestionTabs();
137 $this->ctrl->forwardCommand($q_gui);
139 if (!(
int) $_REQUEST[
"new_for_survey"]) {
141 $this->tpl->setTitle($this->lng->txt(
"question") .
": " . $q_gui->object->getTitle());
155 if ($a_cmd ==
"questions" && $_REQUEST[
"pgov"]) {
159 $hidden_tabs = array();
160 $template = $this->
object->getTemplate();
162 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
164 $hidden_tabs =
$template->getHiddenTabs();
169 $this->lng->txt(
"survey_per_page_view"),
170 $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderPage")
173 if (!in_array(
"survey_question_editor", $hidden_tabs)) {
174 $this->ctrl->setParameter($this,
"pgov",
"");
177 $this->lng->txt(
"survey_question_editor"),
178 $this->ctrl->getLinkTarget($this,
"questions")
180 $this->ctrl->setParameter($this,
"pgov", $_REQUEST[
"pgov"]);
185 $this->lng->txt(
"print_view"),
186 $this->ctrl->getLinkTarget($this,
"printView")
189 if ($this->object->getSurveyPages()) {
190 if ($a_cmd ==
"page") {
191 $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"pgov", max(1, $_REQUEST[
"pg"]));
193 $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui",
"prvw", 1);
196 $this->lng->txt(
"preview"),
197 $this->ctrl->getLinkTargetByClass(array(
"ilobjsurveygui",
"ilsurveyexecutiongui"),
"preview")
201 $ilTabs->activateSubTab($a_cmd);
215 if (
$_GET[
"new_id"] > 0) {
217 $existing = $this->
object->getExistingQuestions();
218 if (!in_array(
$_GET[
"new_id"], $existing)) {
219 $inserted = $this->
object->insertQuestion(
$_GET[
"new_id"]);
229 $read_only = $hasDatasets;
234 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
236 $qtypes[
$data[
"type_tag"]] = $translation;
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");
243 $ilToolbar->addStickyItem($types,
"");
245 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
246 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
249 $button->setCaption(
"svy_create_question");
250 $button->setCommand(
"createQuestion");
251 $ilToolbar->addStickyItem($button);
253 if ($this->object->isPoolActive()) {
254 $ilToolbar->addSeparator();
256 $cmd = (
$ilUser->getPref(
'svy_insert_type') == 1 ||
257 strlen(
$ilUser->getPref(
'svy_insert_type')) == 0)
258 ?
'browseForQuestions' 259 :
'browseForQuestionblocks';
262 $button->setCaption(
"browse_for_questions");
263 $button->setUrl($this->ctrl->getLinkTarget($this, $cmd));
264 $ilToolbar->addStickyItem($button);
267 $ilToolbar->addSeparator();
270 $button->setCaption(
"add_heading");
271 $button->setUrl($this->ctrl->getLinkTarget($this,
"addHeading"));
272 $ilToolbar->addInputItem($button);
277 $mess = $mbox->getHTML();
282 include_once
"Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
289 $this->tpl->setContent($mess .
$table->getHTML());
301 protected function gatherSelectedTableItems($allow_blocks =
true, $allow_questions =
true, $allow_headings =
false, $allow_questions_in_blocks =
false)
303 $block_map = array();
304 foreach ($this->object->getSurveyQuestions() as $item) {
305 $block_map[$item[
"question_id"]] = $item[
"questionblock_id"];
308 $questions = $blocks = $headings = array();
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]);
319 if ($allow_blocks && preg_match(
"/cb_qb_(\d+)/", $key, $matches)) {
320 array_push($blocks, $matches[1]);
323 if ($allow_headings && preg_match(
"/cb_tb_(\d+)/", $key, $matches)) {
324 array_push($headings, $matches[1]);
329 return array(
"questions" => $questions,
331 "headings" => $headings);
336 if (isset(
$_POST[
"order"])) {
340 foreach (array_keys(
$_POST[
"order"]) as
$id) {
342 if (substr($id, 0, 3) ==
"qb_") {
343 $block_id = substr($id, 3);
344 $block =
$_POST[
"block_order"][$block_id];
346 foreach (array_keys($block) as $question_id) {
348 $order[$question_id] = $position;
351 $question_id = substr($id, 2);
353 $order[$question_id] = $position;
356 $this->
object->updateOrder($order);
359 $obligatory = array();
361 if (preg_match(
"/obligatory_(\d+)/",
$key, $matches)) {
362 $obligatory[$matches[1]] = 1;
365 $this->
object->setObligatoryStates($obligatory);
366 ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'),
true);
367 $this->ctrl->redirect($this,
"questions");
373 if (count($items[
"blocks"])) {
374 ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'),
true);
375 $this->
object->unfoldQuestionblocks($items[
"blocks"]);
379 $this->ctrl->redirect($this,
"questions");
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);
392 if (count($move_questions) == 0) {
394 $this->ctrl->redirect($this,
"questions");
396 $_SESSION[
"move_questions"] = $move_questions;
397 $_SESSION[
"move_questions_survey_id"] = $this->
object->getId();
398 ilUtil::sendInfo($this->lng->txt(
"select_target_position_for_move_question"));
420 while (!$insert_id &&
sizeof(
$_POST[
"id"])) {
422 if (preg_match(
"/^cb_(\d+)$/",
$target, $matches)) {
424 if (in_array($matches[1], $items[
"questions"])) {
425 $insert_id = $matches[1];
428 if (!$insert_id && preg_match(
"/^cb_qb_(\d+)$/",
$target, $matches)) {
429 $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
431 if ($insert_mode == 0) {
432 $insert_id = $ids[0];
433 } elseif ($insert_mode == 1) {
434 $insert_id = $ids[count($ids) - 1];
444 ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'),
true);
445 $this->
object->moveQuestions(
$_SESSION[
"move_questions"], $insert_id, $insert_mode);
447 unset(
$_SESSION[
"move_questions_survey_id"]);
450 $this->ctrl->redirect($this,
"questions");
456 if (count($items[
"blocks"]) + count($items[
"questions"]) + count($items[
"headings"]) > 0) {
461 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_removal"),
true);
462 $this->ctrl->redirect($this,
"questions");
468 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
470 $cgui->setHeaderText($this->lng->txt(
"survey_sure_delete_questions"));
472 $cgui->setFormAction($this->ctrl->getFormAction($this,
"confirmRemoveQuestions"));
473 $cgui->setCancel($this->lng->txt(
"cancel"),
"questions");
474 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmRemoveQuestions");
477 $surveyquestions = &$this->
object->getSurveyQuestions();
478 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
479 foreach ($surveyquestions as $question_id =>
$data) {
480 if (in_array(
$data[
"question_id"], $checked_questions)) {
484 "id_" .
$data[
"question_id"],
485 $data[
"question_id"],
488 } elseif ((in_array(
$data[
"questionblock_id"], $checked_questionblocks))) {
492 "id_qb_" .
$data[
"questionblock_id"],
493 $data[
"questionblock_id"],
496 } elseif (in_array(
$data[
"question_id"], $checked_headings)) {
498 "id_tb_" .
$data[
"question_id"],
499 $data[
"question_id"],
505 $this->tpl->setContent($cgui->getHTML());
510 $checked_questions = array();
511 $checked_questionblocks = array();
512 $checked_headings = array();
514 if (preg_match(
"/id_(\d+)/",
$key, $matches)) {
515 array_push($checked_questions, $matches[1]);
517 if (preg_match(
"/id_qb_(\d+)/",
$key, $matches)) {
518 array_push($checked_questionblocks, $matches[1]);
520 if (preg_match(
"/id_tb_(\d+)/",
$key, $matches)) {
521 array_push($checked_headings, $matches[1]);
525 if (
sizeof($checked_questions) ||
sizeof($checked_questionblocks)) {
526 $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
528 if ($checked_headings) {
529 foreach ($checked_headings as $q_id) {
530 $this->
object->saveHeading(
"", $q_id);
533 $this->
object->saveCompletionStatus();
534 ilUtil::sendSuccess($this->lng->txt(
"questions_removed"),
true);
535 $this->ctrl->redirect($this,
"questions");
543 $copy_questions = $items[
"questions"];
544 foreach ($items[
"blocks"] as $block_id) {
545 foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
546 array_push($copy_questions, $qid);
549 $copy_questions = array_unique($copy_questions);
552 if (count($copy_questions)) {
553 foreach ($copy_questions as $idx => $question_id) {
555 if ($question->getOriginalId()) {
556 unset($copy_questions[$idx]);
560 if (count($copy_questions) == 0) {
561 ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_copy_to_pool"),
true);
562 $this->ctrl->redirect($this,
"questions");
566 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
569 $form->setFormAction($this->ctrl->getFormAction($this,
"executeCreateQuestion"));
572 $ids->setValue(implode(
";", $copy_questions));
573 $form->addItem($ids);
575 $questionpools = &$this->
object->getAvailableQuestionpools(
false,
false,
true,
"write");
576 $pools =
new ilSelectInputGUI($this->lng->txt(
"survey_copy_select_questionpool"),
"sel_spl");
578 $form->addItem($pools);
580 $form->addCommandButton(
"executeCopyQuestionsToPool", $this->lng->txt(
"submit"));
581 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
583 return $this->tpl->setContent(
$form->getHTML());
589 $question_ids = explode(
";",
$_POST[
"question_ids"]);
592 foreach ($question_ids as $qid) {
595 $new_question->setId();
596 $new_question->setObjId($pool_id);
597 $new_question->saveToDb();
603 ilUtil::sendSuccess($this->lng->txt(
"survey_copy_to_questionpool_success"),
true);
604 $this->ctrl->redirect($this,
"questions");
614 if (!$this->object->isPoolActive()) {
616 $_GET[
"sel_question_types"] =
$_POST[
"sel_question_types"];
623 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
626 $sel_question_types = (strlen(
$_POST[
"sel_question_types"])) ?
$_POST[
"sel_question_types"] :
$_GET[
"sel_question_types"];
627 $this->ctrl->setParameter($this,
"sel_question_types", $sel_question_types);
628 $form->setFormAction($this->ctrl->getFormAction($this,
"executeCreateQuestion"));
635 $no_pool =
new ilRadioOption($this->lng->txt(
"survey_no_pool"), 1);
636 $usage->addOption($no_pool);
637 $existing_pool =
new ilRadioOption($this->lng->txt(
"survey_existing_pool"), 3);
638 $usage->addOption($existing_pool);
639 $new_pool =
new ilRadioOption($this->lng->txt(
"survey_new_pool"), 2);
640 $usage->addOption($new_pool);
641 $form->addItem($usage);
643 if (isset(
$_SESSION[
"svy_qpool_choice"])) {
644 $usage->setValue(
$_SESSION[
"svy_qpool_choice"]);
650 $questionpools = &$this->
object->getAvailableQuestionpools(
false,
true,
true,
"write");
651 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_spl");
653 $existing_pool->addSubItem($pools);
657 $name->setMaxLength(50);
658 $new_pool->addSubItem(
$name);
664 $form->addCommandButton(
"executeCreateQuestion", $this->lng->txt(
"submit"));
665 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
667 return $this->tpl->setContent(
$form->getHTML());
674 $q_type =
$_GET[
"sel_question_types"];
677 if (
$_POST[
"usage"] == 1) {
678 $obj_id = $this->
object->getId();
681 elseif (
$_POST[
"usage"] == 3 && strlen(
$_POST[
"sel_spl"])) {
685 elseif (
$_POST[
"usage"] == 2 && strlen(
$_POST[
"name_spl"])) {
693 $this->ctrl->setParameter($this,
"sel_question_types", $q_type);
694 $this->ctrl->redirect($this,
"createQuestion");
700 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
702 $q_gui->object->setObjId($obj_id);
703 $q_gui->object->createNewQuestion();
704 $q_gui_class = get_class($q_gui);
706 if ($_REQUEST[
"pgov"]) {
707 $this->ctrl->setParameterByClass($q_gui_class,
"pgov", $_REQUEST[
"pgov"]);
708 $this->ctrl->setParameterByClass($q_gui_class,
"pgov_pos", $_REQUEST[
"pgov_pos"]);
711 $this->ctrl->setParameterByClass($q_gui_class,
"ref_id", $this->object->getRefId());
712 $this->ctrl->setParameterByClass($q_gui_class,
"new_for_survey", $this->object->getRefId());
713 $this->ctrl->setParameterByClass($q_gui_class,
"q_id", $q_gui->object->getId());
714 $this->ctrl->setParameterByClass($q_gui_class,
"sel_question_types", $q_gui->getQuestionType());
715 $this->ctrl->redirectByClass($q_gui_class,
"editQuestion");
722 $parent_ref =
$tree->getParentId($this->object->getRefId());
724 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
726 $qpl->setType(
"spl");
727 $qpl->setTitle(
$name);
728 $qpl->setDescription(
"");
730 $qpl->createReference();
731 $qpl->putInTree($parent_ref);
732 $qpl->setPermissions($parent_ref);
736 return $qpl->getId();
750 if (!isset($_REQUEST[
"pgov"])) {
751 $link = $this->ctrl->getLinkTarget($this,
"questions");
753 $link = $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui",
"renderpage");
755 $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $link);
758 include_once
"Services/Form/classes/class.ilSelectInputGUI.php";
759 $types =
new ilSelectInputGUI($this->lng->txt(
"display_all_available"),
"datatype");
761 1 => $this->lng->txt(
"questions"),
762 2 => $this->lng->txt(
"questionblocks")
764 $types->setValue(
$ilUser->getPref(
'svy_insert_type'));
765 $ilToolbar->addInputItem($types,
true);
766 $ilToolbar->addFormButton($this->lng->txt(
"change"),
"changeDatatype");
767 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"changeDatatype"));
776 switch (
$_POST[
"datatype"]) {
778 $this->ctrl->redirect($this,
'browseForQuestionblocks');
783 $this->ctrl->redirect($this,
'browseForQuestions');
792 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
794 $table_gui->setEditable(
true);
795 $this->tpl->setContent($table_gui->getHTML());
800 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
802 $table_gui->writeFilterToSession();
803 $this->ctrl->redirect($this,
'browseForQuestions');
808 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
810 $table_gui->resetFilter();
811 $this->ctrl->redirect($this,
'browseForQuestions');
816 $inserted_objects = 0;
817 if (is_array(
$_POST[
'q_id'])) {
818 if ($_REQUEST[
"pgov"]) {
819 include_once
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
821 $page_gui->determineCurrentPage();
826 foreach (
$_POST[
'q_id'] as $question_id) {
827 if (!$_REQUEST[
"pgov"]) {
828 $this->
object->insertQuestion($question_id);
831 $page_gui->insertNewQuestion($question_id);
836 if ($inserted_objects) {
837 $this->
object->saveCompletionStatus();
838 ilUtil::sendSuccess($this->lng->txt(
"questions_inserted"),
true);
839 if (!$_REQUEST[
"pgov"]) {
840 $this->ctrl->redirect($this,
"questions");
842 $target_page = $_REQUEST[
"pgov"];
843 if (substr($_REQUEST[
"pgov_pos"], -1) ==
"c") {
845 if ((
int) $_REQUEST[
"pgov_pos"]) {
851 $this->ctrl->setParameterByClass(
"ilsurveypagegui",
"pgov", $target_page);
852 $this->ctrl->redirectByClass(
"ilsurveypagegui",
"renderpage");
856 $this->ctrl->redirect($this,
'browseForQuestions');
864 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
866 $table_gui->setEditable(
true);
867 $this->tpl->setContent($table_gui->getHTML());
872 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
874 $table_gui->writeFilterToSession();
875 $this->ctrl->redirect($this,
'browseForQuestionblocks');
880 include_once
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
882 $table_gui->resetFilter();
883 $this->ctrl->redirect($this,
'browseForQuestionblocks');
888 $inserted_objects = 0;
889 if (is_array(
$_POST[
'cb'])) {
890 if ($_REQUEST[
"pgov"]) {
891 include_once
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
893 $page_gui->determineCurrentPage();
898 foreach (
$_POST[
'cb'] as $questionblock_id) {
899 if (!$_REQUEST[
"pgov"]) {
900 $this->
object->insertQuestionblock($questionblock_id);
902 $page_gui->insertQuestionblock($questionblock_id);
907 if ($inserted_objects) {
908 $this->
object->saveCompletionStatus();
909 ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt(
"questionblock_inserted") : $this->lng->txt(
"questionblocks_inserted"),
true);
910 if (!$_REQUEST[
"pgov"]) {
911 $this->ctrl->redirect($this,
"questions");
913 $target_page = $_REQUEST[
"pgov"];
914 if (substr($_REQUEST[
"pgov_pos"], -1) ==
"c") {
917 $this->ctrl->setParameterByClass(
"ilsurveypagegui",
"pgov", $target_page);
918 $this->ctrl->redirectByClass(
"ilsurveypagegui",
"renderpage");
922 $this->ctrl->redirect($this,
'browseForQuestionblocks');
933 $block_id = (int) $_REQUEST[
"bl_id"];
934 $this->ctrl->setParameter($this,
"bl_id", $block_id);
941 $this->tpl->setContent($a_form->getHTML());
950 if (is_array(
$_POST[
"qids"]) &&
sizeof(
$_POST[
"qids"])) {
951 $items[
"questions"] =
$_POST[
"qids"];
953 if (count($items[
"questions"]) < 2) {
954 ilUtil::sendInfo($this->lng->txt(
"qpl_define_questionblock_select_missing"),
true);
955 $this->ctrl->redirect($this,
"questions");
962 $this->tpl->setContent($a_form->getHTML());
967 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
969 $form->setFormAction($this->ctrl->getFormAction($this,
"saveDefineQuestionblock"));
970 $form->setTitle($this->lng->txt(
"define_questionblock"));
973 $title->setRequired(
true);
976 $toggle_blocktitle =
new ilCheckboxInputGUI($this->lng->txt(
"survey_show_blocktitle"),
"show_blocktitle");
977 $toggle_blocktitle->
setInfo($this->lng->txt(
"survey_show_blocktitle_description"));
978 $form->addItem($toggle_blocktitle);
980 $toggle_questiontitle =
new ilCheckboxInputGUI($this->lng->txt(
"show_questiontext"),
"show_questiontext");
981 $toggle_questiontitle->
setInfo($this->lng->txt(
"show_questiontext_description"));
982 $form->addItem($toggle_questiontitle);
986 $title->setValue($questionblock[
"title"]);
987 $toggle_blocktitle->setChecked($questionblock[
"show_blocktitle"]);
988 $toggle_questiontitle->setChecked($questionblock[
"show_questiontext"]);
990 $toggle_blocktitle->setChecked(
true);
991 $toggle_questiontitle->setChecked(
true);
994 $form->addCommandButton(
"saveDefineQuestionblock", $this->lng->txt(
"save"));
995 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
998 if (!$a_question_ids &&
$_POST[
"qids"]) {
999 $a_question_ids =
$_POST[
"qids"];
1002 if ($a_question_ids) {
1003 foreach ($a_question_ids as $q_id) {
1005 $hidden->setValue($q_id);
1006 $form->addItem($hidden);
1015 $block_id = (int) $_REQUEST[
"bl_id"];
1018 $this->ctrl->setParameter($this,
"bl_id", $block_id);
1020 if (!$block_id && !is_array($q_ids)) {
1021 $this->ctrl->redirect($this,
"questions");
1025 if (
$form->checkInput()) {
1027 $show_questiontext =
$form->getInput(
"show_questiontext");
1028 $show_blocktitle =
$form->getInput(
"show_blocktitle") ;
1030 $this->
object->modifyQuestionblock(
1037 $this->
object->createQuestionblock(
1045 ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'),
true);
1046 $this->ctrl->redirect($this,
"questions");
1049 $form->setValuesByPost();
1060 $survey_questions = $this->
object->getSurveyQuestions();
1062 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1064 $form->setFormAction($this->ctrl->getFormAction($this,
""));
1069 $heading->setCols(80);
1070 $heading->setUseRte(
true);
1071 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1074 $heading->setRTESupport($this->object->getId(),
"svy",
"survey");
1075 $heading->setRequired(
true);
1076 $form->addItem($heading);
1078 $insertbefore =
new ilSelectInputGUI($this->lng->txt(
"insert"),
"insertbefore");
1080 foreach ($survey_questions as
$key => $value) {
1081 $options[
$key] = $this->lng->txt(
"before") .
": \"" . $value[
"title"] .
"\"";
1084 $insertbefore->setRequired(
true);
1085 $form->addItem($insertbefore);
1087 $form->addCommandButton(
"saveHeading", $this->lng->txt(
"save"));
1088 $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
1090 if ($a_question_id) {
1091 $form->setTitle($this->lng->txt(
"edit_heading"));
1093 $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id][
"heading"]));
1094 $insertbefore->setValue($a_question_id);
1095 $insertbefore->setDisabled(
true);
1097 $form->setTitle($this->lng->txt(
"add_heading"));
1105 $q_id = $_REQUEST[
"q_id"];
1106 $this->ctrl->setParameter($this,
"q_id", $q_id);
1114 $this->tpl->setContent($a_form->getHTML());
1119 $q_id = $_REQUEST[
"q_id"];
1120 $this->ctrl->setParameter($this,
"q_id", $q_id);
1128 $this->tpl->setContent($a_form->getHTML());
1134 $q_id = (int) $_REQUEST[
"q_id"];
1135 $this->ctrl->setParameter($this,
"q_id", $q_id);
1138 if (
$form->checkInput()) {
1139 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1140 $this->
object->saveHeading(
1142 $form->getInput(
"heading"),
1146 $form->getInput(
"insertbefore")
1148 $this->ctrl->redirect($this,
"questions");
1151 $form->setValuesByPost();
1157 $q_id = (int) $_REQUEST[
"q_id"];
1158 $this->ctrl->setParameter($this,
"q_id", $q_id);
1161 $this->ctrl->redirect($this,
"questions");
1166 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1168 $cgui->setHeaderText($this->lng->txt(
"confirm_remove_heading"));
1170 $cgui->setFormAction($this->ctrl->getFormAction($this,
"confirmedRemoveHeading"));
1171 $cgui->setCancel($this->lng->txt(
"cancel"),
"questions");
1172 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedRemoveHeading");
1174 $this->tpl->setContent($cgui->getHTML());
1179 $q_id = (int) $_REQUEST[
"q_id"];
1181 $this->ctrl->redirect($this,
"questions");
1184 $this->
object->saveHeading(
"", $q_id);
1185 $this->ctrl->redirect($this,
"questions");
1200 if (!$current_title = (
int) $_REQUEST[
'export_label']) {
1201 $current_title = $this->
object->getShowQuestionTitles();
1210 include_once
"Services/Form/classes/class.ilSelectInputGUI.php";
1211 $label =
new ilSelectInputGUI($this->lng->txt(
"title") .
"/" . $this->lng->txt(
"label"),
"export_label");
1213 #19448 comment none and label only options. 1215 $label->setValue($current_title);
1217 $ilToolbar->addStickyItem($label,
true);
1219 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"printView"));
1221 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
1223 $button->setCaption(
"show");
1224 $button->setCommand(
"printView");
1225 $ilToolbar->addStickyItem($button);
1227 $ilToolbar->addSeparator();
1229 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
1231 $button->setCaption(
"print");
1232 $button->setOnClick(
"window.print(); return false;");
1233 $button->setOmitPreventDoubleSubmission(
true);
1234 $ilToolbar->addButtonInstance($button);
1236 include_once
'./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
1238 $this->ctrl->setParameter($this,
"export_label", $current_title);
1239 $this->ctrl->setParameter($this,
"pdf",
"1");
1240 $pdf_url = $this->ctrl->getLinkTarget($this,
"printView");
1241 $this->ctrl->setParameter($this,
"pdf",
"");
1242 $this->ctrl->setParameter($this,
"export_label",
"");
1245 $button->setCaption(
"pdf_export");
1246 $button->setUrl($pdf_url);
1247 $button->setOmitPreventDoubleSubmission(
true);
1248 $ilToolbar->addButtonInstance($button);
1252 if (array_key_exists(
"pdf",
$_GET) && (
$_GET[
"pdf"] == 1)) {
1253 require_once(
'Services/MathJax/classes/class.ilMathJax.php');
1257 $template =
new ilTemplate(
"tpl.il_svy_svy_printview.html",
true,
true,
"Modules/Survey");
1259 $pages = &$this->
object->getSurveyPages();
1261 foreach ($pages as $page) {
1262 if (count($page) > 0) {
1263 foreach ($page as $question) {
1264 $questionGUI = $this->
object->getQuestionGUI($question[
"type_tag"], $question[
"question_id"]);
1265 if (is_object($questionGUI)) {
1266 if (strlen($question[
"heading"])) {
1267 $template->setCurrentBlock(
"textblock");
1268 $template->setVariable(
"TEXTBLOCK", $question[
"heading"]);
1272 $template->setVariable(
"QUESTION_DATA", $questionGUI->getPrintView($current_title, $question[
"questionblock_show_questiontext"], $this->object->getSurveyId()));
1275 if ($question[
"obligatory"]) {
1280 if (count($page) > 1 && $page[0][
"questionblock_show_blocktitle"]) {
1282 $template->setVariable(
"BLOCKTITLE", $page[0][
"questionblock_title"]);
1293 $template->setVariable(
"TEXT_REQUIRED", $this->lng->txt(
"required_field"));
1297 if (array_key_exists(
"pdf",
$_GET) && (
$_GET[
"pdf"] == 1)) {
1298 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html",
true,
true,
"Modules/Test");
1299 $printbody->setVariable(
"TITLE", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
1300 $printbody->setVariable(
"ADM_CONTENT",
$template->get());
1301 $printoutput = $printbody->get();
1302 $printoutput = preg_replace(
"/href=\".*?\"/",
"", $printoutput);
1303 $fo = $this->
object->processPrintoutput2FO($printoutput);
1306 require_once(
'Services/MathJax/classes/class.ilMathJax.php');
1310 ->insertLatexImages($fo);
1313 if (!$fo || !$this->object->deliverPDFfromFO($fo)) {
1315 $this->ctrl->redirect($this,
"printView");
1318 $this->tpl->setVariable(
"ADM_CONTENT",
$template->get());
resetfilterQuestionBrowserObject()
copyQuestionsToPoolObject()
confirmedRemoveHeadingObject()
This class represents an option in a radio group.
confirmRemoveQuestionsObject()
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
editHeadingObject(ilPropertyFormGUI $a_form=null)
insertQuestionsBeforeObject()
setBrowseForQuestionsSubtabs()
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
insertQuestionsAfterObject()
resetfilterQuestionblockBrowserObject()
static _hasDatasets($survey_id)
addHeadingObject(ilPropertyFormGUI $a_form=null)
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
executeCopyQuestionsToPoolObject()
if(!array_key_exists('StateId', $_REQUEST)) $id
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
initHeadingForm($a_question_id=null)
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
editQuestionblockObject(ilPropertyFormGUI $a_form=null)
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
createQuestionblockObject(ilPropertyFormGUI $a_form=null)
createQuestionObject(ilPropertyFormGUI $a_form=null)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
createQuestionPool($name="dummy")
initQuestionblockForm($a_block_id=null, $a_question_ids=null)
if(isset($_POST['submit'])) $form
const ILIAS_IMG_MANAGER_PLUGIN
Message box for survey, when data is alrady available.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
saveDefineQuestionblockObject()
This class represents a text property in a property form.
insertQuestions($insert_mode)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.
removeQuestionsForm($checked_questionblocks, $checked_questions, $checked_headings)
Survey question table GUI class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const RENDER_PNG_AS_FO_FILE
__construct(ilObjSurveyGUI $a_parent_gui)
browseForQuestionsObject()
unfoldQuestionblockObject()
setRows($a_rows)
Set Rows.
static getInstance()
Singleton: get instance.
This class represents a text area property in a property form.
static _getQuestiontypes()
Creates a list of all available question types.
browseForQuestionblocksObject()
printViewObject()
Creates a print view of the survey questions.
insertQuestionblocksObject()
executeCreateQuestionObject()
if(empty($password)) $table
filterQuestionBrowserObject()
Settings template application class.
const PURPOSE_DEFERRED_PDF
filterQuestionblockBrowserObject()
Confirmation screen class.
static getInstance()
Get singelton instance.