ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

 $parent_gui
 
 $object
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSurveyEditorGUI::__construct ( ilObjSurveyGUI  $a_parent_gui)

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

References $ilCtrl, $lng, $tpl, and array.

22  {
23  global $ilCtrl, $lng, $tpl;
24 
25  $this->parent_gui = $a_parent_gui;
26  $this->object = $this->parent_gui->object;
27 
28  $this->ctrl = $ilCtrl;
29  $this->lng = $lng;
30  $this->tpl = $tpl;
31 
32  $this->ctrl->saveParameter($this, array("pgov", "pgov_pos"));
33  }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17

Member Function Documentation

◆ addHeadingObject()

ilSurveyEditorGUI::addHeadingObject ( ilPropertyFormGUI  $a_form = null)

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

References initHeadingForm(), and questionsSubtabs().

Referenced by saveHeadingObject().

1167  {
1168  $q_id = $_REQUEST["q_id"];
1169  $this->ctrl->setParameter($this, "q_id", $q_id);
1170 
1171  $this->questionsSubtabs("questions");
1172 
1173  if(!$a_form)
1174  {
1175  $a_form = $this->initHeadingForm($q_id);
1176  }
1177 
1178  $this->tpl->setContent($a_form->getHTML());
1179  }
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 899 of file class.ilSurveyEditorGUI.php.

References setBrowseForQuestionsSubtabs().

900  {
902 
903  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
904  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object, true);
905  $table_gui->setEditable(true);
906  $this->tpl->setContent($table_gui->getHTML());
907  }
+ Here is the call graph for this function:

◆ browseForQuestionsObject()

ilSurveyEditorGUI::browseForQuestionsObject ( )

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

References setBrowseForQuestionsSubtabs().

812  {
814 
815  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
816  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object, true);
817  $table_gui->setEditable(true);
818  $this->tpl->setContent($table_gui->getHTML());
819  }
+ Here is the call graph for this function:

◆ changeDatatypeObject()

ilSurveyEditorGUI::changeDatatypeObject ( )

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

References $_POST, and $ilUser.

793  {
794  global $ilUser;
795 
796  $ilUser->writePref('svy_insert_type', $_POST['datatype']);
797 
798  switch ($_POST["datatype"])
799  {
800  case 2:
801  $this->ctrl->redirect($this, 'browseForQuestionblocks');
802  break;
803 
804  case 1:
805  default:
806  $this->ctrl->redirect($this, 'browseForQuestions');
807  break;
808  }
809  }
$ilUser
Definition: imgupload.php:18
$_POST["username"]

◆ confirmedRemoveHeadingObject()

ilSurveyEditorGUI::confirmedRemoveHeadingObject ( )

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

1241  {
1242  $q_id = (int)$_REQUEST["q_id"];
1243  if(!$q_id)
1244  {
1245  $this->ctrl->redirect($this, "questions");
1246  }
1247 
1248  $this->object->saveHeading("", $q_id);
1249  $this->ctrl->redirect($this, "questions");
1250  }

◆ confirmRemoveQuestionsObject()

ilSurveyEditorGUI::confirmRemoveQuestionsObject ( )

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

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

496  {
497  $checked_questions = array();
498  $checked_questionblocks = array();
499  $checked_headings = array();
500  foreach ($_POST as $key => $value)
501  {
502  if (preg_match("/id_(\d+)/", $key, $matches))
503  {
504  array_push($checked_questions, $matches[1]);
505  }
506  if (preg_match("/id_qb_(\d+)/", $key, $matches))
507  {
508  array_push($checked_questionblocks, $matches[1]);
509  }
510  if (preg_match("/id_tb_(\d+)/", $key, $matches))
511  {
512  array_push($checked_headings, $matches[1]);
513  }
514  }
515 
516  if(sizeof($checked_questions) || sizeof($checked_questionblocks))
517  {
518  $this->object->removeQuestions($checked_questions, $checked_questionblocks);
519  }
520  if($checked_headings)
521  {
522  foreach($checked_headings as $q_id)
523  {
524  $this->object->saveHeading("", $q_id);
525  }
526  }
527  $this->object->saveCompletionStatus();
528  ilUtil::sendSuccess($this->lng->txt("questions_removed"), true);
529  $this->ctrl->redirect($this, "questions");
530  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ copyQuestionsToPoolObject()

ilSurveyEditorGUI::copyQuestionsToPoolObject ( )

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

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

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

◆ createQuestionblockObject()

ilSurveyEditorGUI::createQuestionblockObject ( ilPropertyFormGUI  $a_form = null)

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

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

998  {
999  if(!$a_form)
1000  {
1001  // gather questions from table selected
1002  $items = $this->gatherSelectedTableItems(false, true, false, false);
1003  if(sizeof($_POST["qids"]))
1004  {
1005  $items["questions"] = $_POST["qids"];
1006  }
1007  if (count($items["questions"]) < 2)
1008  {
1009  ilUtil::sendInfo($this->lng->txt("qpl_define_questionblock_select_missing"), true);
1010  $this->ctrl->redirect($this, "questions");
1011  }
1012 
1013  $a_form = $this->initQuestionblockForm(null, $items["questions"]);
1014  }
1015 
1016  $this->questionsSubtabs("questions");
1017  $this->tpl->setContent($a_form->getHTML());
1018  }
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 616 of file class.ilSurveyEditorGUI.php.

References $_GET, $_POST, $_SESSION, executeCreateQuestionObject(), object, questionsSubtabs(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextInputGUI\setSize(), and ilRadioOption\setValue().

617  {
618  if(!$this->object->isPoolActive())
619  {
620  $_POST["usage"] = 1;
621  $_GET["sel_question_types"] = $_POST["sel_question_types"];
622  return $this->executeCreateQuestionObject();
623  }
624 
625  if(!$a_form)
626  {
627  $this->questionsSubtabs("questions");
628 
629  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
630  $form = new ilPropertyFormGUI();
631 
632  $sel_question_types = (strlen($_POST["sel_question_types"])) ? $_POST["sel_question_types"] : $_GET["sel_question_types"];
633  $this->ctrl->setParameter($this, "sel_question_types", $sel_question_types);
634  $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
635  }
636  else
637  {
638  $form = $a_form;
639  }
640 
641  $usage = new ilRadioGroupInputGUI($this->lng->txt("survey_pool_selection"), "usage");
642  $usage->setRequired(true);
643  $no_pool = new ilRadioOption($this->lng->txt("survey_no_pool"), 1);
644  $usage->addOption($no_pool);
645  $existing_pool = new ilRadioOption($this->lng->txt("survey_existing_pool"), 3);
646  $usage->addOption($existing_pool);
647  $new_pool = new ilRadioOption($this->lng->txt("survey_new_pool"), 2);
648  $usage->addOption($new_pool);
649  $form->addItem($usage);
650 
651  if(isset($_SESSION["svy_qpool_choice"]))
652  {
653  $usage->setValue($_SESSION["svy_qpool_choice"]);
654  }
655  else
656  {
657  // default: no pool
658  $usage->setValue(1);
659  }
660 
661  $questionpools =& $this->object->getAvailableQuestionpools(FALSE, TRUE, TRUE, "write");
662  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_spl");
663  $pools->setOptions($questionpools);
664  $existing_pool->addSubItem($pools);
665 
666  $name = new ilTextInputGUI($this->lng->txt("spl_new"), "name_spl"); // #11740
667  $name->setSize(50);
668  $name->setMaxLength(50);
669  $new_pool->addSubItem($name);
670 
671  if($a_form)
672  {
673  return $a_form;
674  }
675 
676  $form->addCommandButton("executeCreateQuestion", $this->lng->txt("submit"));
677  $form->addCommandButton("questions", $this->lng->txt("cancel"));
678 
679  return $this->tpl->setContent($form->getHTML());
680  }
This class represents an option in a radio group.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
This class represents a property form user interface.
$_GET["client_id"]
This class represents a property in a property form.
setValue($a_value)
Set Value.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
setOptions($a_options)
Set Options.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ createQuestionPool()

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

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

References object.

Referenced by executeCreateQuestionObject().

740  {
741  global $tree;
742 
743  $parent_ref = $tree->getParentId($this->object->getRefId());
744 
745  include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
746  $qpl = new ilObjSurveyQuestionPool();
747  $qpl->setType("spl");
748  $qpl->setTitle($name);
749  $qpl->setDescription("");
750  $qpl->create();
751  $qpl->createReference();
752  $qpl->putInTree($parent_ref);
753  $qpl->setPermissions($parent_ref);
754  $qpl->setOnline(1); // must be online to be available
755  $qpl->saveToDb();
756 
757  return $qpl->getId();
758  }
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ editHeadingObject()

ilSurveyEditorGUI::editHeadingObject ( ilPropertyFormGUI  $a_form = null)

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

References initHeadingForm(), and questionsSubtabs().

1182  {
1183  $q_id = $_REQUEST["q_id"];
1184  $this->ctrl->setParameter($this, "q_id", $q_id);
1185 
1186  $this->questionsSubtabs("questions");
1187 
1188  if(!$a_form)
1189  {
1190  $a_form = $this->initHeadingForm($q_id);
1191  }
1192 
1193  $this->tpl->setContent($a_form->getHTML());
1194  }
initHeadingForm($a_question_id=null)
+ Here is the call graph for this function:

◆ editQuestionblockObject()

ilSurveyEditorGUI::editQuestionblockObject ( ilPropertyFormGUI  $a_form = null)

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

References initQuestionblockForm(), and questionsSubtabs().

Referenced by saveDefineQuestionblockObject().

984  {
985  $block_id = (int)$_REQUEST["bl_id"];
986  $this->ctrl->setParameter($this, "bl_id", $block_id);
987 
988  if(!$a_form)
989  {
990  $a_form = $this->initQuestionblockForm($block_id);
991  }
992 
993  $this->questionsSubtabs("questions");
994  $this->tpl->setContent($a_form->getHTML());
995  }
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 35 of file class.ilSurveyEditorGUI.php.

References $cmd, SurveyQuestionGUI\_getQuestionGUI(), array, and questionsSubtabs().

36  {
37  global $ilTabs;
38 
39  $cmd = $this->ctrl->getCmd("questions");
40 
41  if($_REQUEST["pgov"])
42  {
43  if($cmd == "questions")
44  {
45  $this->ctrl->setCmdClass("ilsurveypagegui");
46  $this->ctrl->setCmd("renderpage");
47  }
48  else if($cmd == "confirmRemoveQuestions")
49  {
50  // #14324
51  $this->ctrl->setCmdClass("ilsurveypagegui");
52  $this->ctrl->setCmd("confirmRemoveQuestions");
53  }
54  }
55 
56  $next_class = $this->ctrl->getNextClass($this);
57  switch($next_class)
58  {
59  case 'ilsurveypagegui':
60  $this->questionsSubtabs("page");
61  include_once './Modules/Survey/classes/class.ilSurveyPageGUI.php';
62  $pg = new ilSurveyPageGUI($this->object, $this);
63  $this->ctrl->forwardCommand($pg);
64  break;
65 
66  default:
67  // question gui
68  if(stristr($next_class, "questiongui"))
69  {
70  $ilTabs->clearTargets();
71  $this->ctrl->saveParameter($this, array("new_for_survey"));
72 
73  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
74  $q_gui = SurveyQuestionGUI::_getQuestionGUI(null, $_REQUEST["q_id"]);
75  if (is_object($q_gui->object))
76  {
77  global $ilHelp;
78  $ilHelp->setScreenIdComponent("spl_qt".$q_gui->object->getQuestionTypeId());
79  }
80  // $q_gui->object->setObjId($this->object->getId());
81  $q_gui->setBackUrl($this->ctrl->getLinkTarget($this, "questions"));
82  $q_gui->setQuestionTabs();
83  $this->ctrl->forwardCommand($q_gui);
84 
85  if(!(int)$_REQUEST["new_for_survey"])
86  {
87  // not on create
88  $this->tpl->setTitle($this->lng->txt("question").": ".$q_gui->object->getTitle());
89  }
90  }
91  else
92  {
93  $cmd .= "Object";
94  $this->$cmd();
95  }
96  break;
97  }
98  }
$cmd
Definition: sahs_server.php:35
Survey per page view.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ executeCopyQuestionsToPoolObject()

ilSurveyEditorGUI::executeCopyQuestionsToPoolObject ( )

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

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

591  {
592  $question_ids = explode(";", $_POST["question_ids"]);
593  $pool_id = ilObject::_lookupObjId($_POST["sel_spl"]);
594 
595  foreach($question_ids as $qid)
596  {
597  // create copy (== pool "original")
598  $new_question = ilObjSurvey::_instanciateQuestion($qid);
599  $new_question->setId();
600  $new_question->setObjId($pool_id);
601  $new_question->saveToDb();
602 
603  // link "source" (survey) to copy (pool)
604  SurveyQuestion::_changeOriginalId($qid, $new_question->getId(), $pool_id);
605  }
606 
607  ilUtil::sendSuccess($this->lng->txt("survey_copy_to_questionpool_success"), true);
608  $this->ctrl->redirect($this, "questions");
609  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 682 of file class.ilSurveyEditorGUI.php.

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

Referenced by createQuestionObject().

683  {
684  $_SESSION["svy_qpool_choice"] = $_POST["usage"];
685 
686  $q_type = $_GET["sel_question_types"];
687 
688  // no pool
689  if ($_POST["usage"] == 1)
690  {
691  $obj_id = $this->object->getId();
692  }
693  // existing pool
694  else if ($_POST["usage"] == 3 && strlen($_POST["sel_spl"]))
695  {
696  $obj_id = ilObject::_lookupObjId($_POST["sel_spl"]);
697  }
698  // new pool
699  elseif ($_POST["usage"] == 2 && strlen($_POST["name_spl"]))
700  {
701  $obj_id = $this->createQuestionPool($_POST["name_spl"]);
702  }
703  else
704  {
705  if(!$_POST["usage"])
706  {
707  ilUtil::sendFailure($this->lng->txt("select_one"), true);
708  }
709  else
710  {
711  ilUtil::sendFailure($this->lng->txt("err_no_pool_name"), true);
712  }
713  $this->ctrl->setParameter($this, "sel_question_types", $q_type);
714  $this->ctrl->redirect($this, "createQuestion");
715  }
716 
717 
718  // create question and redirect to question form
719 
720  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
721  $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type);
722  $q_gui->object->setObjId($obj_id); // survey/pool!
723  $q_gui->object->createNewQuestion();
724  $q_gui_class = get_class($q_gui);
725 
726  if($_REQUEST["pgov"])
727  {
728  $this->ctrl->setParameterByClass($q_gui_class, "pgov", $_REQUEST["pgov"]);
729  $this->ctrl->setParameterByClass($q_gui_class, "pgov_pos",$_REQUEST["pgov_pos"]);
730  }
731 
732  $this->ctrl->setParameterByClass($q_gui_class, "ref_id", $this->object->getRefId());
733  $this->ctrl->setParameterByClass($q_gui_class, "new_for_survey", $this->object->getRefId());
734  $this->ctrl->setParameterByClass($q_gui_class, "q_id", $q_gui->object->getId());
735  $this->ctrl->setParameterByClass($q_gui_class, "sel_question_types", $q_gui->getQuestionType());
736  $this->ctrl->redirectByClass($q_gui_class, "editQuestion");
737  }
$_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.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filterQuestionblockBrowserObject()

ilSurveyEditorGUI::filterQuestionblockBrowserObject ( )

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

910  {
911  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
912  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
913  $table_gui->writeFilterToSession();
914  $this->ctrl->redirect($this, 'browseForQuestionblocks');
915  }

◆ filterQuestionBrowserObject()

ilSurveyEditorGUI::filterQuestionBrowserObject ( )

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

822  {
823  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
824  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
825  $table_gui->writeFilterToSession();
826  $this->ctrl->redirect($this, 'browseForQuestions');
827  }

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

References $_POST, array, and object.

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

256  {
257  $block_map = array();
258  foreach($this->object->getSurveyQuestions() as $item)
259  {
260  $block_map[$item["question_id"]] = $item["questionblock_id"];
261  }
262 
263  $questions = $blocks = $headings = array();
264  if($_POST["id"])
265  {
266  foreach ($_POST["id"] as $key)
267  {
268  // questions
269  if ($allow_questions && preg_match("/cb_(\d+)/", $key, $matches))
270  {
271  if(($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
272  !in_array($block_map[$matches[1]], $blocks))
273  {
274  array_push($questions, $matches[1]);
275  }
276  }
277  // blocks
278  if ($allow_blocks && preg_match("/cb_qb_(\d+)/", $key, $matches))
279  {
280  array_push($blocks, $matches[1]);
281  }
282  // headings
283  if ($allow_headings && preg_match("/cb_tb_(\d+)/", $key, $matches))
284  {
285  array_push($headings, $matches[1]);
286  }
287  }
288  }
289 
290  return array("questions" => $questions,
291  "blocks" => $blocks,
292  "headings" => $headings);
293  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the caller graph for this function:

◆ initHeadingForm()

ilSurveyEditorGUI::initHeadingForm (   $a_question_id = null)
protected

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

References $options, ilObjAdvancedEditing\_getUsedHTMLTags(), array, ilRTE\ILIAS_IMG_MANAGER_PLUGIN, object, ilSelectInputGUI\setOptions(), and ilTextAreaInputGUI\setRows().

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

1118  {
1119  $survey_questions = $this->object->getSurveyQuestions();
1120 
1121  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1122  $form = new ilPropertyFormGUI();
1123  $form->setFormAction($this->ctrl->getFormAction($this, ""));
1124 
1125  // heading
1126  $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
1127  $heading->setRows(10);
1128  $heading->setCols(80);
1129  $heading->setUseRte(TRUE);
1130  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1131  $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
1132  $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
1133  $heading->setRTESupport($this->object->getId(), "svy", "survey");
1134  $heading->setRequired(true);
1135  $form->addItem($heading);
1136 
1137  $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
1138  $options = array();
1139  foreach ($survey_questions as $key => $value)
1140  {
1141  $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
1142  }
1143  $insertbefore->setOptions($options);
1144  $insertbefore->setRequired(true);
1145  $form->addItem($insertbefore);
1146 
1147  $form->addCommandButton("saveHeading", $this->lng->txt("save"));
1148  $form->addCommandButton("questions", $this->lng->txt("cancel"));
1149 
1150  if ($a_question_id)
1151  {
1152  $form->setTitle($this->lng->txt("edit_heading"));
1153 
1154  $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"]));
1155  $insertbefore->setValue($a_question_id);
1156  $insertbefore->setDisabled(true);
1157  }
1158  else
1159  {
1160  $form->setTitle($this->lng->txt("add_heading"));
1161  }
1162 
1163  return $form;
1164  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
if(!is_array($argv)) $options
const ILIAS_IMG_MANAGER_PLUGIN
Definition: class.ilRTE.php:14
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
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 1020 of file class.ilSurveyEditorGUI.php.

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

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

1021  {
1022  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1023  $form = new ilPropertyFormGUI();
1024  $form->setFormAction($this->ctrl->getFormAction($this, "saveDefineQuestionblock"));
1025  $form->setTitle($this->lng->txt("define_questionblock"));
1026 
1027  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
1028  $title->setRequired(true);
1029  $form->addItem($title);
1030 
1031  $toggle_blocktitle = new ilCheckboxInputGUI($this->lng->txt("survey_show_blocktitle"), "show_blocktitle");
1032  $toggle_blocktitle->setInfo($this->lng->txt("survey_show_blocktitle_description"));
1033  $form->addItem($toggle_blocktitle);
1034 
1035  $toggle_questiontitle = new ilCheckboxInputGUI($this->lng->txt("show_questiontext"), "show_questiontext");
1036  $toggle_questiontitle->setInfo($this->lng->txt("show_questiontext_description"));
1037  $form->addItem($toggle_questiontitle);
1038 
1039  if($a_block_id)
1040  {
1041  $questionblock = ilObjSurvey::_getQuestionblock($a_block_id);
1042  $title->setValue($questionblock["title"]);
1043  $toggle_blocktitle->setChecked($questionblock["show_blocktitle"]);
1044  $toggle_questiontitle->setChecked($questionblock["show_questiontext"]);
1045  }
1046  else
1047  {
1048  $toggle_blocktitle->setChecked(true);
1049  $toggle_questiontitle->setChecked(true);
1050  }
1051 
1052  $form->addCommandButton("saveDefineQuestionblock", $this->lng->txt("save"));
1053  $form->addCommandButton("questions", $this->lng->txt("cancel"));
1054 
1055  // reload?
1056  if(!$a_question_ids && $_POST["qids"])
1057  {
1058  $a_question_ids = $_POST["qids"];
1059  }
1060 
1061  if ($a_question_ids)
1062  {
1063  foreach ($a_question_ids as $q_id)
1064  {
1065  $hidden = new ilHiddenInputGUI("qids[]");
1066  $hidden->setValue($q_id);
1067  $form->addItem($hidden);
1068  }
1069  }
1070 
1071  return $form;
1072  }
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.
This class represents a text 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 925 of file class.ilSurveyEditorGUI.php.

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

926  {
927  $inserted_objects = 0;
928  if (is_array($_POST['cb']))
929  {
930  if($_REQUEST["pgov"])
931  {
932  include_once "Modules/Survey/classes/class.ilSurveyPageGUI.php";
933  $page_gui = new ilSurveyPageGUI($this->object, $this);
934  $page_gui->determineCurrentPage();
935 
936  // as target position is predefined, insert in reverse order
937  $_POST['cb'] = array_reverse($_POST['cb']);
938  }
939  foreach ($_POST['cb'] as $questionblock_id)
940  {
941  if(!$_REQUEST["pgov"])
942  {
943  $this->object->insertQuestionblock($questionblock_id);
944  }
945  else
946  {
947  $page_gui->insertQuestionblock($questionblock_id);
948  }
949  $inserted_objects++;
950  }
951  }
952  if ($inserted_objects)
953  {
954  $this->object->saveCompletionStatus();
955  ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt("questionblock_inserted") : $this->lng->txt("questionblocks_inserted"), true);
956  if(!$_REQUEST["pgov"])
957  {
958  $this->ctrl->redirect($this, "questions");
959  }
960  else
961  {
962  $target_page = $_REQUEST["pgov"];
963  if(substr($_REQUEST["pgov_pos"], -1) == "c")
964  {
965  $target_page++;
966  }
967  $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
968  $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
969  }
970  }
971  else
972  {
973  ilUtil::sendInfo($this->lng->txt("insert_missing_questionblock"), true);
974  $this->ctrl->redirect($this, 'browseForQuestionblocks');
975  }
976  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 389 of file class.ilSurveyEditorGUI.php.

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

Referenced by insertQuestionsAfterObject(), and insertQuestionsBeforeObject().

390  {
391  $insert_id = null;
392  if($_POST["id"])
393  {
394  $items = $this->gatherSelectedTableItems(true, true, false, false);
395 
396  // we are using POST id for original order
397  while(!$insert_id && sizeof($_POST["id"]))
398  {
399  $target = array_shift($_POST["id"]);
400  if (preg_match("/^cb_(\d+)$/", $target, $matches))
401  {
402  // questions in blocks are not allowed
403  if(in_array($matches[1], $items["questions"]))
404  {
405  $insert_id = $matches[1];
406  }
407  }
408  if (!$insert_id && preg_match("/^cb_qb_(\d+)$/", $target, $matches))
409  {
410  $ids = $this->object->getQuestionblockQuestionIds($matches[1]);
411  if (count($ids))
412  {
413  if ($insert_mode == 0)
414  {
415  $insert_id = $ids[0];
416  }
417  else if ($insert_mode == 1)
418  {
419  $insert_id = $ids[count($ids)-1];
420  }
421  }
422  }
423  }
424  }
425 
426  if(!$insert_id)
427  {
428  ilUtil::sendInfo($this->lng->txt("no_target_selected_for_move"), true);
429  }
430  else
431  {
432  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
433  $this->object->moveQuestions($_SESSION["move_questions"], $insert_id, $insert_mode);
434  unset($_SESSION["move_questions"]);
435  }
436 
437  $this->ctrl->redirect($this, "questions");
438  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_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 384 of file class.ilSurveyEditorGUI.php.

References insertQuestions().

385  {
386  $this->insertQuestions(1);
387  }
+ Here is the call graph for this function:

◆ insertQuestionsBeforeObject()

ilSurveyEditorGUI::insertQuestionsBeforeObject ( )

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

References insertQuestions().

380  {
381  $this->insertQuestions(0);
382  }
+ Here is the call graph for this function:

◆ insertQuestionsObject()

ilSurveyEditorGUI::insertQuestionsObject ( )

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

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

838  {
839  $inserted_objects = 0;
840  if (is_array($_POST['q_id']))
841  {
842  if($_REQUEST["pgov"])
843  {
844  include_once "Modules/Survey/classes/class.ilSurveyPageGUI.php";
845  $page_gui = new ilSurveyPageGUI($this->object, $this);
846  $page_gui->determineCurrentPage();
847 
848  // as target position is predefined, insert in reverse order
849  $_POST['q_id'] = array_reverse($_POST['q_id']);
850  }
851  foreach ($_POST['q_id'] as $question_id)
852  {
853  if(!$_REQUEST["pgov"])
854  {
855  $this->object->insertQuestion($question_id);
856  }
857  else
858  {
859  // target position (pgov pos) is processed there
860  $page_gui->insertNewQuestion($question_id);
861  }
862  $inserted_objects++;
863  }
864  }
865  if ($inserted_objects)
866  {
867  $this->object->saveCompletionStatus();
868  ilUtil::sendSuccess($this->lng->txt("questions_inserted"), true);
869  if(!$_REQUEST["pgov"])
870  {
871  $this->ctrl->redirect($this, "questions");
872  }
873  else
874  {
875  $target_page = $_REQUEST["pgov"];
876  if(substr($_REQUEST["pgov_pos"], -1) == "c")
877  {
878  // see ilSurveyPageGUI::insertNewQuestion()
879  if((int)$_REQUEST["pgov_pos"])
880  {
881  $target_page++;
882  }
883  else
884  {
885  $target_page = 1;
886  }
887  }
888  $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
889  $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
890  }
891  }
892  else
893  {
894  ilUtil::sendInfo($this->lng->txt("insert_missing_question"), true);
895  $this->ctrl->redirect($this, 'browseForQuestions');
896  }
897  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 354 of file class.ilSurveyEditorGUI.php.

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

355  {
356  $items = $this->gatherSelectedTableItems(true, true, false, false);
357 
358  $move_questions = $items["questions"];
359  foreach ($items["blocks"] as $block_id)
360  {
361  foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid)
362  {
363  array_push($move_questions, $qid);
364  }
365  }
366  if (count($move_questions) == 0)
367  {
368  ilUtil::sendInfo($this->lng->txt("no_question_selected_for_move"), true);
369  $this->ctrl->redirect($this, "questions");
370  }
371  else
372  {
373  $_SESSION["move_questions"] = $move_questions;
374  ilUtil::sendInfo($this->lng->txt("select_target_position_for_move_question"));
375  $this->questionsObject();
376  }
377  }
$_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.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ printViewObject()

ilSurveyEditorGUI::printViewObject ( )

Creates a print view of the survey questions.

public

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

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

1265  {
1266  global $ilToolbar;
1267 
1268  $this->questionsSubtabs("print");
1269 
1270  #21023 and #19448
1271  if(!$current_title = (int) $_REQUEST['export_label']) {
1272  $current_title = $this->object->getShowQuestionTitles();
1273  }
1274  /*
1275  if(!isset($_POST["export_label"]))
1276  {
1277  $_POST["export_label"] = $this->object->getShowQuestionTitles();
1278  }
1279  $current_title = (int)$_POST["export_label"];
1280  */
1281 
1282  include_once "Services/Form/classes/class.ilSelectInputGUI.php";
1283  $label = new ilSelectInputGUI($this->lng->txt("title")."/".$this->lng->txt("label"), "export_label");
1284  $label->setOptions(array(
1285  #19448
1286  //0 => $this->lng->txt('none'),
1287  1 => $this->lng->txt('svy_print_title_only'),
1288  2 => $this->lng->txt('svy_print_label_only'),
1289  3 => $this->lng->txt('svy_print_title_label')
1290  ));
1291  $label->setValue($current_title);
1292  $ilToolbar->addStickyItem($label, true);
1293 
1294  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "printView"));
1295 
1296  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
1297  $button = ilSubmitButton::getInstance();
1298  $button->setCaption("show");
1299  $button->setCommand("printView");
1300  $ilToolbar->addStickyItem($button);
1301 
1302  $ilToolbar->addSeparator();
1303 
1304  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1305  $button = ilLinkButton::getInstance();
1306  $button->setCaption("print");
1307  $button->setOnClick("window.print(); return false;");
1308  $button->setOmitPreventDoubleSubmission(true);
1309  $ilToolbar->addButtonInstance($button);
1310 
1311  include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
1312  if(ilRPCServerSettings::getInstance()->isEnabled())
1313  {
1314  $this->ctrl->setParameter($this, "export_label", $current_title);
1315  $this->ctrl->setParameter($this, "pdf", "1");
1316  $pdf_url = $this->ctrl->getLinkTarget($this, "printView");
1317  $this->ctrl->setParameter($this, "pdf", "");
1318  $this->ctrl->setParameter($this, "export_label", "");
1319 
1320  $button = ilLinkButton::getInstance();
1321  $button->setCaption("pdf_export");
1322  $button->setUrl($pdf_url);
1323  $button->setOmitPreventDoubleSubmission(true);
1324  $ilToolbar->addButtonInstance($button);
1325  }
1326 
1327  // defer rendering of tex to fo processing
1328  if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1))
1329  {
1330  require_once('Services/MathJax/classes/class.ilMathJax.php');
1332  }
1333 
1334  $template = new ilTemplate("tpl.il_svy_svy_printview.html", TRUE, TRUE, "Modules/Survey");
1335 
1336  $pages =& $this->object->getSurveyPages();
1337  $required = false;
1338  foreach ($pages as $page)
1339  {
1340  if (count($page) > 0)
1341  {
1342  foreach ($page as $question)
1343  {
1344  $questionGUI = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
1345  if (is_object($questionGUI))
1346  {
1347  if (strlen($question["heading"]))
1348  {
1349  $template->setCurrentBlock("textblock");
1350  $template->setVariable("TEXTBLOCK", $question["heading"]);
1351  $template->parseCurrentBlock();
1352  }
1353  $template->setCurrentBlock("question");
1354  $template->setVariable("QUESTION_DATA", $questionGUI->getPrintView($current_title, $question["questionblock_show_questiontext"], $this->object->getSurveyId()));
1355  $template->parseCurrentBlock();
1356 
1357  if($question["obligatory"])
1358  {
1359  $required = true;
1360  }
1361  }
1362  }
1363  if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"])
1364  {
1365  $template->setCurrentBlock("page");
1366  $template->setVariable("BLOCKTITLE", $page[0]["questionblock_title"]);
1367  $template->parseCurrentBlock();
1368  }
1369  else
1370  {
1371  $template->setCurrentBlock("page");
1372  $template->parseCurrentBlock();
1373  }
1374  }
1375  }
1376 
1377  // #6412
1378  if($required)
1379  {
1380  $template->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
1381  }
1382 
1383  // $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
1384  if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1))
1385  {
1386  $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", TRUE, TRUE, "Modules/Test");
1387  $printbody->setVariable("TITLE", sprintf($this->lng->txt("tst_result_user_name"), $uname));
1388  $printbody->setVariable("ADM_CONTENT", $template->get());
1389  $printoutput = $printbody->get();
1390  $printoutput = preg_replace("/href=\".*?\"/", "", $printoutput);
1391  $fo = $this->object->processPrintoutput2FO($printoutput);
1392 
1393  // render tex as fo graphics
1394  require_once('Services/MathJax/classes/class.ilMathJax.php');
1395  $fo = ilMathJax::getInstance()
1396  ->init(ilMathJax::PURPOSE_PDF)
1397  ->setRendering(ilMathJax::RENDER_PNG_AS_FO_FILE)
1398  ->insertLatexImages($fo);
1399 
1400  // #11436
1401  if(!$fo || !$this->object->deliverPDFfromFO($fo))
1402  {
1403  ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
1404  $this->ctrl->redirect($this, "printView");
1405  }
1406  }
1407  else
1408  {
1409  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1410  }
1411  }
This class represents a selection list property in a property form.
$_GET["client_id"]
const PURPOSE_PDF
special template class to simplify handling of ITX/PEAR
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const RENDER_PNG_AS_FO_FILE
static getInstance()
Singleton: get instance.
Create new PHPExcel object
obj_idprivate
const PURPOSE_DEFERRED_PDF
static getInstance()
Get singelton instance.
+ Here is the call graph for this function:

◆ questionsObject()

ilSurveyEditorGUI::questionsObject ( )

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

References $_GET, $cmd, $data, $ilUser, ilObjSurveyQuestionPool\_getQuestiontypes(), ilObjSurvey\_hasDatasets(), array, ilSubmitButton\getInstance(), ilLinkButton\getInstance(), object, questionsSubtabs(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilSelectInputGUI\setOptions().

Referenced by moveQuestionsObject().

156  {
157  global $ilToolbar, $ilUser;
158 
159 
160  // insert new questions?
161  if ($_GET["new_id"] > 0)
162  {
163  // add a question to the survey previous created in a questionpool
164  $existing = $this->object->getExistingQuestions();
165  if (!in_array($_GET["new_id"], $existing))
166  {
167  $inserted = $this->object->insertQuestion($_GET["new_id"]);
168  if (!$inserted)
169  {
170  ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
171  }
172  }
173  }
174 
175 
176  $this->questionsSubtabs("questions");
177 
178  $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
179  $read_only = $hasDatasets;
180 
181 
182  // toolbar
183 
184  if (!$read_only)
185  {
186  $qtypes = array();
187  include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
188  foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data)
189  {
190  $qtypes[$data["type_tag"]] = $translation;
191  }
192 
193  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
194  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
195  $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
196  $types->setOptions($qtypes);
197  $ilToolbar->addStickyItem($types, "");
198 
199 
200  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
201  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
202 
203  $button = ilSubmitButton::getInstance();
204  $button->setCaption("svy_create_question");
205  $button->setCommand("createQuestion");
206  $ilToolbar->addStickyItem($button);
207 
208  if($this->object->isPoolActive())
209  {
210  $ilToolbar->addSeparator();
211 
212  $cmd = ($ilUser->getPref('svy_insert_type') == 1 ||
213  strlen($ilUser->getPref('svy_insert_type')) == 0)
214  ? 'browseForQuestions'
215  : 'browseForQuestionblocks';
216 
217  $button = ilLinkButton::getInstance();
218  $button->setCaption("browse_for_questions");
219  $button->setUrl($this->ctrl->getLinkTarget($this, $cmd));
220  $ilToolbar->addStickyItem($button);
221  }
222 
223  $ilToolbar->addSeparator();
224 
225  $button = ilLinkButton::getInstance();
226  $button->setCaption("add_heading");
227  $button->setUrl($this->ctrl->getLinkTarget($this, "addHeading"));
228  $ilToolbar->addInputItem($button);
229  }
230  if ($hasDatasets)
231  {
232  $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "maintenance");
233  $link = "<a href=\"".$link."\">".$this->lng->txt("survey_has_datasets_warning_page_view_link")."</a>";
234  ilUtil::sendInfo($this->lng->txt("survey_has_datasets_warning_page_view")." ".$link);
235  }
236 
237 
238  // table gui
239 
240  include_once "Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
241  $table = new ilSurveyQuestionTableGUI($this, "questions", $this->object,
242  $read_only);
243  $this->tpl->setContent($table->getHTML());
244  }
This class represents a selection list property in a property form.
$_GET["client_id"]
static _hasDatasets($survey_id)
$cmd
Definition: sahs_server.php:35
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$ilUser
Definition: imgupload.php:18
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
Survey question table GUI class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
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 100 of file class.ilSurveyEditorGUI.php.

References array, and object.

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

101  {
102  global $ilTabs;
103 
104  if($a_cmd == "questions" && $_REQUEST["pgov"])
105  {
106  $a_cmd = "page";
107  }
108 
109  $hidden_tabs = array();
110  $template = $this->object->getTemplate();
111  if($template)
112  {
113  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
114  $template = new ilSettingsTemplate($template);
115  $hidden_tabs = $template->getHiddenTabs();
116  }
117 
118  $ilTabs->addSubTab("page",
119  $this->lng->txt("survey_per_page_view"),
120  $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderPage"));
121 
122  if(!in_array("survey_question_editor", $hidden_tabs))
123  {
124  $this->ctrl->setParameter($this, "pgov", "");
125  $ilTabs->addSubTab("questions",
126  $this->lng->txt("survey_question_editor"),
127  $this->ctrl->getLinkTarget($this, "questions"));
128  $this->ctrl->setParameter($this, "pgov", $_REQUEST["pgov"]);
129  }
130 
131  $ilTabs->addSubTab("print",
132  $this->lng->txt("print_view"),
133  $this->ctrl->getLinkTarget($this, "printView"));
134 
135  if($this->object->getSurveyPages())
136  {
137  if($a_cmd == "page")
138  {
139  $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "pgov", max(1, $_REQUEST["pg"]));
140  }
141  $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "prvw", 1);
142  $ilTabs->addSubTab("preview",
143  $this->lng->txt("preview"),
144  $this->ctrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyexecutiongui"), "preview"));
145  }
146 
147  $ilTabs->activateSubTab($a_cmd);
148  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
Settings template application class.
+ Here is the caller graph for this function:

◆ removeHeadingObject()

ilSurveyEditorGUI::removeHeadingObject ( )

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

References questionsSubtabs().

1217  {
1218  $q_id = (int)$_REQUEST["q_id"];
1219  $this->ctrl->setParameter($this, "q_id", $q_id);
1220 
1221  if(!$q_id)
1222  {
1223  $this->ctrl->redirect($this, "questions");
1224  }
1225 
1226  $this->questionsSubtabs("questions");
1227 
1228  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1229  $cgui = new ilConfirmationGUI();
1230  $cgui->setHeaderText($this->lng->txt("confirm_remove_heading"));
1231 
1232  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedRemoveHeading"));
1233  $cgui->setCancel($this->lng->txt("cancel"), "questions");
1234  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedRemoveHeading");
1235 
1236  $this->tpl->setContent($cgui->getHTML());
1237  }
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 $counter, $data, and SurveyQuestion\_getQuestionTypeName().

Referenced by removeQuestionsObject().

457  {
458  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
459  $cgui = new ilConfirmationGUI();
460  $cgui->setHeaderText($this->lng->txt("survey_sure_delete_questions"));
461 
462  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
463  $cgui->setCancel($this->lng->txt("cancel"), "questions");
464  $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
465 
466  $counter = 0;
467  $surveyquestions =& $this->object->getSurveyQuestions();
468  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
469  foreach ($surveyquestions as $question_id => $data)
470  {
471  if (in_array($data["question_id"], $checked_questions))
472  {
473  $type = SurveyQuestion::_getQuestionTypeName($data["type_tag"]);
474 
475  $cgui->addItem("id_".$data["question_id"], $data["question_id"],
476  $type.": ".$data["title"]);
477  }
478  else if((in_array($data["questionblock_id"], $checked_questionblocks)))
479  {
480  $type = SurveyQuestion::_getQuestionTypeName($data["type_tag"]);
481 
482  $cgui->addItem("id_qb_".$data["questionblock_id"], $data["questionblock_id"],
483  $data["questionblock_title"]." - ".$type.": ".$data["title"]);
484  }
485  else if (in_array($data["question_id"], $checked_headings))
486  {
487  $cgui->addItem("id_tb_".$data["question_id"], $data["question_id"],
488  $data["heading"]);
489  }
490  }
491 
492  $this->tpl->setContent($cgui->getHTML());
493  }
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
$counter
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 440 of file class.ilSurveyEditorGUI.php.

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

441  {
442  $items = $this->gatherSelectedTableItems(true, true, true, true);
443  if (count($items["blocks"]) + count($items["questions"]) + count($items["headings"]) > 0)
444  {
445  ilUtil::sendQuestion($this->lng->txt("remove_questions"));
446  $this->removeQuestionsForm($items["blocks"], $items["questions"], $items["headings"]);
447  return;
448  }
449  else
450  {
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 917 of file class.ilSurveyEditorGUI.php.

918  {
919  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
920  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
921  $table_gui->resetFilter();
922  $this->ctrl->redirect($this, 'browseForQuestionblocks');
923  }

◆ resetfilterQuestionBrowserObject()

ilSurveyEditorGUI::resetfilterQuestionBrowserObject ( )

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

830  {
831  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
832  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
833  $table_gui->resetFilter();
834  $this->ctrl->redirect($this, 'browseForQuestions');
835  }

◆ saveDefineQuestionblockObject()

ilSurveyEditorGUI::saveDefineQuestionblockObject ( )

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

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

1075  {
1076  $block_id = (int)$_REQUEST["bl_id"];
1077  $q_ids = $_POST["qids"];
1078 
1079  $this->ctrl->setParameter($this, "bl_id", $block_id);
1080 
1081  if(!$block_id && !is_array($q_ids))
1082  {
1083  $this->ctrl->redirect($this, "questions");
1084  }
1085 
1086  $form = $this->initQuestionblockForm($block_id);
1087  if($form->checkInput())
1088  {
1089  $title = $form->getInput("title");
1090  $show_questiontext = $form->getInput("show_questiontext");
1091  $show_blocktitle = $form->getInput("show_blocktitle") ;
1092  if ($block_id)
1093  {
1094 
1095  $this->object->modifyQuestionblock($block_id, $title,
1096  $show_questiontext, $show_blocktitle);
1097  }
1098  else if($q_ids)
1099  {
1100  $this->object->createQuestionblock($title, $show_questiontext,
1101  $show_blocktitle, $q_ids);
1102  }
1103 
1104  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
1105  $this->ctrl->redirect($this, "questions");
1106  }
1107 
1108  $form->setValuesByPost();
1109  $this->editQuestionblockObject($form);
1110  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 1196 of file class.ilSurveyEditorGUI.php.

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

1197  {
1198  // #15474
1199  $q_id = (int)$_REQUEST["q_id"];
1200  $this->ctrl->setParameter($this, "q_id", $q_id);
1201 
1202  $form = $this->initHeadingForm($q_id);
1203  if ($form->checkInput())
1204  {
1205  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1206  $this->object->saveHeading(ilUtil::stripSlashes($form->getInput("heading"),
1208  $form->getInput("insertbefore"));
1209  $this->ctrl->redirect($this, "questions");
1210  }
1211 
1212  $form->setValuesByPost();
1213  $this->addHeadingObject($form);
1214  }
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 295 of file class.ilSurveyEditorGUI.php.

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

296  {
297  if(isset($_POST["order"]))
298  {
299  $position = -1;
300  $order = array();
301  asort($_POST["order"]);
302  foreach(array_keys($_POST["order"]) as $id)
303  {
304  // block items
305  if(substr($id, 0, 3) == "qb_")
306  {
307  $block_id = substr($id, 3);
308  $block = $_POST["block_order"][$block_id];
309  asort($block);
310  foreach(array_keys($block) as $question_id)
311  {
312  $position++;
313  $order[$question_id] = $position;
314  }
315  }
316  else
317  {
318  $question_id = substr($id, 2);
319  $position++;
320  $order[$question_id] = $position;
321  }
322  }
323  $this->object->updateOrder($order);
324  }
325 
326  $obligatory = array();
327  foreach ($_POST as $key => $value)
328  {
329  if (preg_match("/obligatory_(\d+)/", $key, $matches))
330  {
331  $obligatory[$matches[1]] = 1;
332  }
333  }
334  $this->object->setObligatoryStates($obligatory);
335  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
336  $this->ctrl->redirect($this, "questions");
337  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ setBrowseForQuestionsSubtabs()

ilSurveyEditorGUI::setBrowseForQuestionsSubtabs ( )
protected

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

References $ilUser, array, and ilSelectInputGUI\setOptions().

Referenced by browseForQuestionblocksObject(), and browseForQuestionsObject().

766  {
767  global $ilTabs, $ilToolbar, $ilUser;
768 
769  if(!isset($_REQUEST["pgov"]))
770  {
771  $link = $this->ctrl->getLinkTarget($this, "questions");
772  }
773  else
774  {
775  $link = $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderpage");
776  }
777  $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $link);
778 
779  // type selector
780  include_once "Services/Form/classes/class.ilSelectInputGUI.php";
781  $types = new ilSelectInputGUI($this->lng->txt("display_all_available"), "datatype");
782  $types->setOptions(array(
783  1 => $this->lng->txt("questions"),
784  2 => $this->lng->txt("questionblocks")
785  ));
786  $types->setValue($ilUser->getPref('svy_insert_type'));
787  $ilToolbar->addInputItem($types, true);
788  $ilToolbar->addFormButton($this->lng->txt("change"), "changeDatatype");
789  $ilToolbar->setFormAction( $this->ctrl->getFormAction($this, "changeDatatype"));
790  }
This class represents a selection list property in a property form.
$ilUser
Definition: imgupload.php:18
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unfoldQuestionblockObject()

ilSurveyEditorGUI::unfoldQuestionblockObject ( )

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

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

340  {
341  $items = $this->gatherSelectedTableItems(true, false, false, false);
342  if (count($items["blocks"]))
343  {
344  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
345  $this->object->unfoldQuestionblocks($items["blocks"]);
346  }
347  else
348  {
349  ilUtil::sendInfo($this->lng->txt("qpl_unfold_select_none"), true);
350  }
351  $this->ctrl->redirect($this, "questions");
352  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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

◆ $object

ilSurveyEditorGUI::$object
protected

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

◆ $parent_gui

ilSurveyEditorGUI::$parent_gui
protected

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


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