ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSurveyEditorGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
17 {
21  protected $ctrl;
22 
26  protected $lng;
27 
31  protected $tpl;
32 
36  protected $tabs;
37 
41  protected $help;
42 
46  protected $toolbar;
47 
51  protected $user;
52 
56  protected $tree;
57 
58  protected $parent_gui; // [ilObjSurveyGUI]
59  protected $object; // [ilObjSurvey]
60 
64  protected $print_options;
65 
66  public function __construct(ilObjSurveyGUI $a_parent_gui)
67  {
68  global $DIC;
69 
70  $this->tabs = $DIC->tabs();
71  $this->help = $DIC["ilHelp"];
72  $this->toolbar = $DIC->toolbar();
73  $this->user = $DIC->user();
74  $this->tree = $DIC->repositoryTree();
75  $ilCtrl = $DIC->ctrl();
76  $lng = $DIC->language();
77  $tpl = $DIC["tpl"];
78 
79  $this->parent_gui = $a_parent_gui;
80  $this->object = $this->parent_gui->object;
81 
82  $this->ctrl = $ilCtrl;
83  $this->lng = $lng;
84  $this->tpl = $tpl;
85 
86  $this->ctrl->saveParameter($this, array("pgov", "pgov_pos"));
87 
88  $this->print_options = array(
89  //0 => $this->lng->txt('none'),
90  ilObjSurvey::PRINT_HIDE_LABELS => $this->lng->txt('svy_print_hide_labels'),
91  //2 => $this->lng->txt('svy_print_label_only'),
92  ilObjSurvey::PRINT_SHOW_LABELS => $this->lng->txt('svy_print_show_labels')
93  );
94  }
95 
96  public function executeCommand()
97  {
98  $ilTabs = $this->tabs;
99 
100  $cmd = $this->ctrl->getCmd("questions");
101 
102  if ($_REQUEST["pgov"]) {
103  if ($cmd == "questions") {
104  $this->ctrl->setCmdClass("ilsurveypagegui");
105  $this->ctrl->setCmd("renderpage");
106  } elseif ($cmd == "confirmRemoveQuestions") {
107  // #14324
108  $this->ctrl->setCmdClass("ilsurveypagegui");
109  $this->ctrl->setCmd("confirmRemoveQuestions");
110  }
111  }
112 
113  $next_class = $this->ctrl->getNextClass($this);
114  switch ($next_class) {
115  case 'ilsurveypagegui':
116  $this->questionsSubtabs("page");
117  include_once './Modules/Survey/classes/class.ilSurveyPageGUI.php';
118  $pg = new ilSurveyPageGUI($this->object, $this);
119  $this->ctrl->forwardCommand($pg);
120  break;
121 
122  default:
123  // question gui
124  if (stristr($next_class, "questiongui")) {
125  $ilTabs->clearTargets();
126  $this->ctrl->saveParameter($this, array("new_for_survey"));
127 
128  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
129  $q_gui = SurveyQuestionGUI::_getQuestionGUI(null, $_REQUEST["q_id"]);
130  if (is_object($q_gui->object)) {
131  $ilHelp = $this->help;
132  $ilHelp->setScreenIdComponent("spl_qt" . $q_gui->object->getQuestionTypeId());
133  }
134  // $q_gui->object->setObjId($this->object->getId());
135  $q_gui->setBackUrl($this->ctrl->getLinkTarget($this, "questions"));
136  $q_gui->setQuestionTabs();
137  $this->ctrl->forwardCommand($q_gui);
138 
139  if (!(int) $_REQUEST["new_for_survey"]) {
140  // not on create
141  $this->tpl->setTitle($this->lng->txt("question") . ": " . $q_gui->object->getTitle());
142  }
143  } else {
144  $cmd .= "Object";
145  $this->$cmd();
146  }
147  break;
148  }
149  }
150 
151  protected function questionsSubtabs($a_cmd)
152  {
153  $ilTabs = $this->tabs;
154 
155  if ($a_cmd == "questions" && $_REQUEST["pgov"]) {
156  $a_cmd = "page";
157  }
158 
159  $hidden_tabs = array();
160  $template = $this->object->getTemplate();
161  if ($template) {
162  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
164  $hidden_tabs = $template->getHiddenTabs();
165  }
166 
167  $ilTabs->addSubTab(
168  "page",
169  $this->lng->txt("survey_per_page_view"),
170  $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderPage")
171  );
172 
173  if (!in_array("survey_question_editor", $hidden_tabs)) {
174  $this->ctrl->setParameter($this, "pgov", "");
175  $ilTabs->addSubTab(
176  "questions",
177  $this->lng->txt("survey_question_editor"),
178  $this->ctrl->getLinkTarget($this, "questions")
179  );
180  $this->ctrl->setParameter($this, "pgov", $_REQUEST["pgov"]);
181  }
182 
183  $ilTabs->addSubTab(
184  "print",
185  $this->lng->txt("print_view"),
186  $this->ctrl->getLinkTarget($this, "printView")
187  );
188 
189  if ($this->object->getSurveyPages()) {
190  if ($a_cmd == "page") {
191  $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "pgov", max(1, $_REQUEST["pg"]));
192  }
193  $this->ctrl->setParameterByClass("ilsurveyexecutiongui", "prvw", 1);
194  $ilTabs->addSubTab(
195  "preview",
196  $this->lng->txt("preview"),
197  $this->ctrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyexecutiongui"), "preview")
198  );
199  }
200 
201  $ilTabs->activateSubTab($a_cmd);
202  }
203 
204 
205  //
206  // QUESTIONS BROWSER INCL. MULTI-ACTIONS
207  //
208 
209  public function questionsObject()
210  {
211  $ilToolbar = $this->toolbar;
213 
214  // insert new questions?
215  if ($_GET["new_id"] > 0) {
216  // add a question to the survey previous created in a questionpool
217  $existing = $this->object->getExistingQuestions();
218  if (!in_array($_GET["new_id"], $existing)) {
219  $inserted = $this->object->insertQuestion($_GET["new_id"]);
220  if (!$inserted) {
221  ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
222  }
223  }
224  }
225 
226  $this->questionsSubtabs("questions");
227 
228  $hasDatasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
229  $read_only = $hasDatasets;
230 
231  // toolbar
232  if (!$read_only) {
233  $qtypes = array();
234  include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
235  foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
236  $qtypes[$data["type_tag"]] = $translation;
237  }
238 
239  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
240  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
241  $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
242  $types->setOptions($qtypes);
243  $ilToolbar->addStickyItem($types, "");
244 
245  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
246  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
247 
248  $button = ilSubmitButton::getInstance();
249  $button->setCaption("svy_create_question");
250  $button->setCommand("createQuestion");
251  $ilToolbar->addStickyItem($button);
252 
253  if ($this->object->isPoolActive()) {
254  $ilToolbar->addSeparator();
255 
256  $cmd = ($ilUser->getPref('svy_insert_type') == 1 ||
257  strlen($ilUser->getPref('svy_insert_type')) == 0)
258  ? 'browseForQuestions'
259  : 'browseForQuestionblocks';
260 
261  $button = ilLinkButton::getInstance();
262  $button->setCaption("browse_for_questions");
263  $button->setUrl($this->ctrl->getLinkTarget($this, $cmd));
264  $ilToolbar->addStickyItem($button);
265  }
266 
267  $ilToolbar->addSeparator();
268 
269  $button = ilLinkButton::getInstance();
270  $button->setCaption("add_heading");
271  $button->setUrl($this->ctrl->getLinkTarget($this, "addHeading"));
272  $ilToolbar->addInputItem($button);
273  }
274  $mess = "";
275  if ($hasDatasets) {
276  $mbox = new ilSurveyContainsDataMessageBoxGUI();
277  $mess = $mbox->getHTML();
278  }
279 
280  // table gui
281 
282  include_once "Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
284  $this,
285  "questions",
286  $this->object,
287  $read_only
288  );
289  $this->tpl->setContent($mess . $table->getHTML());
290  }
291 
301  protected function gatherSelectedTableItems($allow_blocks = true, $allow_questions = true, $allow_headings = false, $allow_questions_in_blocks = false)
302  {
303  $block_map = array();
304  foreach ($this->object->getSurveyQuestions() as $item) {
305  $block_map[$item["question_id"]] = $item["questionblock_id"];
306  }
307 
308  $questions = $blocks = $headings = array();
309  if ($_POST["id"]) {
310  foreach ($_POST["id"] as $key) {
311  // questions
312  if ($allow_questions && preg_match("/cb_(\d+)/", $key, $matches)) {
313  if (($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
314  !in_array($block_map[$matches[1]], $blocks)) {
315  array_push($questions, $matches[1]);
316  }
317  }
318  // blocks
319  if ($allow_blocks && preg_match("/cb_qb_(\d+)/", $key, $matches)) {
320  array_push($blocks, $matches[1]);
321  }
322  // headings
323  if ($allow_headings && preg_match("/cb_tb_(\d+)/", $key, $matches)) {
324  array_push($headings, $matches[1]);
325  }
326  }
327  }
328 
329  return array("questions" => $questions,
330  "blocks" => $blocks,
331  "headings" => $headings);
332  }
333 
334  public function saveObligatoryObject()
335  {
336  if (isset($_POST["order"])) {
337  $position = -1;
338  $order = array();
339  asort($_POST["order"]);
340  foreach (array_keys($_POST["order"]) as $id) {
341  // block items
342  if (substr($id, 0, 3) == "qb_") {
343  $block_id = substr($id, 3);
344  $block = $_POST["block_order"][$block_id];
345  asort($block);
346  foreach (array_keys($block) as $question_id) {
347  $position++;
348  $order[$question_id] = $position;
349  }
350  } else {
351  $question_id = substr($id, 2);
352  $position++;
353  $order[$question_id] = $position;
354  }
355  }
356  $this->object->updateOrder($order);
357  }
358 
359  $obligatory = array();
360  foreach ($_POST as $key => $value) {
361  if (preg_match("/obligatory_(\d+)/", $key, $matches)) {
362  $obligatory[$matches[1]] = 1;
363  }
364  }
365  $this->object->setObligatoryStates($obligatory);
366  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
367  $this->ctrl->redirect($this, "questions");
368  }
369 
370  public function unfoldQuestionblockObject()
371  {
372  $items = $this->gatherSelectedTableItems(true, false, false, false);
373  if (count($items["blocks"])) {
374  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
375  $this->object->unfoldQuestionblocks($items["blocks"]);
376  } else {
377  ilUtil::sendInfo($this->lng->txt("qpl_unfold_select_none"), true);
378  }
379  $this->ctrl->redirect($this, "questions");
380  }
381 
382  public function moveQuestionsObject()
383  {
384  $items = $this->gatherSelectedTableItems(true, true, false, false);
385 
386  $move_questions = $items["questions"];
387  foreach ($items["blocks"] as $block_id) {
388  foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid) {
389  array_push($move_questions, $qid);
390  }
391  }
392  if (count($move_questions) == 0) {
393  ilUtil::sendInfo($this->lng->txt("no_question_selected_for_move"), true);
394  $this->ctrl->redirect($this, "questions");
395  } else {
396  $_SESSION["move_questions"] = $move_questions;
397  $_SESSION["move_questions_survey_id"] = $this->object->getId();
398  ilUtil::sendInfo($this->lng->txt("select_target_position_for_move_question"));
399  $this->questionsObject();
400  }
401  }
402 
403  public function insertQuestionsBeforeObject()
404  {
405  $this->insertQuestions(0);
406  }
407 
408  public function insertQuestionsAfterObject()
409  {
410  $this->insertQuestions(1);
411  }
412 
413  protected function insertQuestions($insert_mode)
414  {
415  $insert_id = null;
416  if ($_POST["id"]) {
417  $items = $this->gatherSelectedTableItems(true, true, false, false);
418 
419  // we are using POST id for original order
420  while (!$insert_id && sizeof($_POST["id"])) {
421  $target = array_shift($_POST["id"]);
422  if (preg_match("/^cb_(\d+)$/", $target, $matches)) {
423  // questions in blocks are not allowed
424  if (in_array($matches[1], $items["questions"])) {
425  $insert_id = $matches[1];
426  }
427  }
428  if (!$insert_id && preg_match("/^cb_qb_(\d+)$/", $target, $matches)) {
429  $ids = $this->object->getQuestionblockQuestionIds($matches[1]);
430  if (count($ids)) {
431  if ($insert_mode == 0) {
432  $insert_id = $ids[0];
433  } elseif ($insert_mode == 1) {
434  $insert_id = $ids[count($ids) - 1];
435  }
436  }
437  }
438  }
439  }
440 
441  if (!$insert_id) {
442  ilUtil::sendInfo($this->lng->txt("no_target_selected_for_move"), true);
443  } else {
444  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
445  $this->object->moveQuestions($_SESSION["move_questions"], $insert_id, $insert_mode);
446  unset($_SESSION["move_questions"]);
447  unset($_SESSION["move_questions_survey_id"]);
448  }
449 
450  $this->ctrl->redirect($this, "questions");
451  }
452 
453  public function removeQuestionsObject()
454  {
455  $items = $this->gatherSelectedTableItems(true, true, true, true);
456  if (count($items["blocks"]) + count($items["questions"]) + count($items["headings"]) > 0) {
457  ilUtil::sendQuestion($this->lng->txt("remove_questions"));
458  $this->removeQuestionsForm($items["blocks"], $items["questions"], $items["headings"]);
459  return;
460  } else {
461  ilUtil::sendInfo($this->lng->txt("no_question_selected_for_removal"), true);
462  $this->ctrl->redirect($this, "questions");
463  }
464  }
465 
466  public function removeQuestionsForm($checked_questionblocks, $checked_questions, $checked_headings)
467  {
468  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
469  $cgui = new ilConfirmationGUI();
470  $cgui->setHeaderText($this->lng->txt("survey_sure_delete_questions"));
471 
472  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmRemoveQuestions"));
473  $cgui->setCancel($this->lng->txt("cancel"), "questions");
474  $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
475 
476  $counter = 0;
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)) {
482 
483  $cgui->addItem(
484  "id_" . $data["question_id"],
485  $data["question_id"],
486  $type . ": " . $data["title"]
487  );
488  } elseif ((in_array($data["questionblock_id"], $checked_questionblocks))) {
490 
491  $cgui->addItem(
492  "id_qb_" . $data["questionblock_id"],
493  $data["questionblock_id"],
494  $data["questionblock_title"] . " - " . $type . ": " . $data["title"]
495  );
496  } elseif (in_array($data["question_id"], $checked_headings)) {
497  $cgui->addItem(
498  "id_tb_" . $data["question_id"],
499  $data["question_id"],
500  $data["heading"]
501  );
502  }
503  }
504 
505  $this->tpl->setContent($cgui->getHTML());
506  }
507 
509  {
510  $checked_questions = array();
511  $checked_questionblocks = array();
512  $checked_headings = array();
513  foreach ($_POST as $key => $value) {
514  if (preg_match("/id_(\d+)/", $key, $matches)) {
515  array_push($checked_questions, $matches[1]);
516  }
517  if (preg_match("/id_qb_(\d+)/", $key, $matches)) {
518  array_push($checked_questionblocks, $matches[1]);
519  }
520  if (preg_match("/id_tb_(\d+)/", $key, $matches)) {
521  array_push($checked_headings, $matches[1]);
522  }
523  }
524 
525  if (sizeof($checked_questions) || sizeof($checked_questionblocks)) {
526  $this->object->removeQuestions($checked_questions, $checked_questionblocks);
527  }
528  if ($checked_headings) {
529  foreach ($checked_headings as $q_id) {
530  $this->object->saveHeading("", $q_id);
531  }
532  }
533  $this->object->saveCompletionStatus();
534  ilUtil::sendSuccess($this->lng->txt("questions_removed"), true);
535  $this->ctrl->redirect($this, "questions");
536  }
537 
538  public function copyQuestionsToPoolObject()
539  {
540  $items = $this->gatherSelectedTableItems(true, true, false, true);
541 
542  // gather questions from blocks
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);
547  }
548  }
549  $copy_questions = array_unique($copy_questions);
550 
551  // only if not already in pool
552  if (count($copy_questions)) {
553  foreach ($copy_questions as $idx => $question_id) {
554  $question = ilObjSurvey::_instanciateQuestion($question_id);
555  if ($question->getOriginalId()) {
556  unset($copy_questions[$idx]);
557  }
558  }
559  }
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");
563  } else {
564  $this->questionsSubtabs("questions");
565 
566  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
567  $form = new ilPropertyFormGUI();
568 
569  $form->setFormAction($this->ctrl->getFormAction($this, "executeCreateQuestion"));
570 
571  $ids = new ilHiddenInputGUI("question_ids");
572  $ids->setValue(implode(";", $copy_questions));
573  $form->addItem($ids);
574 
575  $questionpools = &$this->object->getAvailableQuestionpools(false, false, true, "write");
576  $pools = new ilSelectInputGUI($this->lng->txt("survey_copy_select_questionpool"), "sel_spl");
577  $pools->setOptions($questionpools);
578  $form->addItem($pools);
579 
580  $form->addCommandButton("executeCopyQuestionsToPool", $this->lng->txt("submit"));
581  $form->addCommandButton("questions", $this->lng->txt("cancel"));
582 
583  return $this->tpl->setContent($form->getHTML());
584  }
585  }
586 
588  {
589  $question_ids = explode(";", $_POST["question_ids"]);
590  $pool_id = ilObject::_lookupObjId($_POST["sel_spl"]);
591 
592  foreach ($question_ids as $qid) {
593  // create copy (== pool "original")
594  $new_question = ilObjSurvey::_instanciateQuestion($qid);
595  $new_question->setId();
596  $new_question->setObjId($pool_id);
597  $new_question->saveToDb();
598 
599  // link "source" (survey) to copy (pool)
600  SurveyQuestion::_changeOriginalId($qid, $new_question->getId(), $pool_id);
601  }
602 
603  ilUtil::sendSuccess($this->lng->txt("survey_copy_to_questionpool_success"), true);
604  $this->ctrl->redirect($this, "questions");
605  }
606 
607 
608  //
609  // QUESTION CREATION
610  //
611 
612  public function createQuestionObject(ilPropertyFormGUI $a_form = null)
613  {
614  if (!$this->object->isPoolActive()) {
615  $_POST["usage"] = 1;
616  $_GET["sel_question_types"] = $_POST["sel_question_types"];
617  return $this->executeCreateQuestionObject();
618  }
619 
620  if (!$a_form) {
621  $this->questionsSubtabs("questions");
622 
623  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
624  $form = new ilPropertyFormGUI();
625 
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"));
629  } else {
630  $form = $a_form;
631  }
632 
633  $usage = new ilRadioGroupInputGUI($this->lng->txt("survey_pool_selection"), "usage");
634  $usage->setRequired(true);
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);
642 
643  if (isset($_SESSION["svy_qpool_choice"])) {
644  $usage->setValue($_SESSION["svy_qpool_choice"]);
645  } else {
646  // default: no pool
647  $usage->setValue(1);
648  }
649 
650  $questionpools = &$this->object->getAvailableQuestionpools(false, true, true, "write");
651  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_spl");
652  $pools->setOptions($questionpools);
653  $existing_pool->addSubItem($pools);
654 
655  $name = new ilTextInputGUI($this->lng->txt("spl_new"), "name_spl"); // #11740
656  $name->setSize(50);
657  $name->setMaxLength(50);
658  $new_pool->addSubItem($name);
659 
660  if ($a_form) {
661  return $a_form;
662  }
663 
664  $form->addCommandButton("executeCreateQuestion", $this->lng->txt("submit"));
665  $form->addCommandButton("questions", $this->lng->txt("cancel"));
666 
667  return $this->tpl->setContent($form->getHTML());
668  }
669 
670  public function executeCreateQuestionObject()
671  {
672  $_SESSION["svy_qpool_choice"] = $_POST["usage"];
673 
674  $q_type = $_GET["sel_question_types"];
675 
676  // no pool
677  if ($_POST["usage"] == 1) {
678  $obj_id = $this->object->getId();
679  }
680  // existing pool
681  elseif ($_POST["usage"] == 3 && strlen($_POST["sel_spl"])) {
682  $obj_id = ilObject::_lookupObjId($_POST["sel_spl"]);
683  }
684  // new pool
685  elseif ($_POST["usage"] == 2 && strlen($_POST["name_spl"])) {
686  $obj_id = $this->createQuestionPool($_POST["name_spl"]);
687  } else {
688  if (!$_POST["usage"]) {
689  ilUtil::sendFailure($this->lng->txt("select_one"), true);
690  } else {
691  ilUtil::sendFailure($this->lng->txt("err_no_pool_name"), true);
692  }
693  $this->ctrl->setParameter($this, "sel_question_types", $q_type);
694  $this->ctrl->redirect($this, "createQuestion");
695  }
696 
697 
698  // create question and redirect to question form
699 
700  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
701  $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type);
702  $q_gui->object->setObjId($obj_id); // survey/pool!
703  $q_gui->object->createNewQuestion();
704  $q_gui_class = get_class($q_gui);
705 
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"]);
709  }
710 
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");
716  }
717 
718  protected function createQuestionPool($name = "dummy")
719  {
720  $tree = $this->tree;
721 
722  $parent_ref = $tree->getParentId($this->object->getRefId());
723 
724  include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
725  $qpl = new ilObjSurveyQuestionPool();
726  $qpl->setType("spl");
727  $qpl->setTitle($name);
728  $qpl->setDescription("");
729  $qpl->create();
730  $qpl->createReference();
731  $qpl->putInTree($parent_ref);
732  $qpl->setPermissions($parent_ref);
733  $qpl->setOnline(1); // must be online to be available
734  $qpl->saveToDb();
735 
736  return $qpl->getId();
737  }
738 
739 
740  //
741  // ADD FROM POOL
742  //
743 
744  protected function setBrowseForQuestionsSubtabs()
745  {
746  $ilTabs = $this->tabs;
747  $ilToolbar = $this->toolbar;
749 
750  if (!isset($_REQUEST["pgov"])) {
751  $link = $this->ctrl->getLinkTarget($this, "questions");
752  } else {
753  $link = $this->ctrl->getLinkTargetByClass("ilsurveypagegui", "renderpage");
754  }
755  $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), $link);
756 
757  // type selector
758  include_once "Services/Form/classes/class.ilSelectInputGUI.php";
759  $types = new ilSelectInputGUI($this->lng->txt("display_all_available"), "datatype");
760  $types->setOptions(array(
761  1 => $this->lng->txt("questions"),
762  2 => $this->lng->txt("questionblocks")
763  ));
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"));
768  }
769 
770  public function changeDatatypeObject()
771  {
773 
774  $ilUser->writePref('svy_insert_type', $_POST['datatype']);
775 
776  switch ($_POST["datatype"]) {
777  case 2:
778  $this->ctrl->redirect($this, 'browseForQuestionblocks');
779  break;
780 
781  case 1:
782  default:
783  $this->ctrl->redirect($this, 'browseForQuestions');
784  break;
785  }
786  }
787 
788  public function browseForQuestionsObject()
789  {
791 
792  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
793  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object, true);
794  $table_gui->setEditable(true);
795  $this->tpl->setContent($table_gui->getHTML());
796  }
797 
798  public function filterQuestionBrowserObject()
799  {
800  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
801  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
802  $table_gui->writeFilterToSession();
803  $this->ctrl->redirect($this, 'browseForQuestions');
804  }
805 
807  {
808  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
809  $table_gui = new ilSurveyQuestionbrowserTableGUI($this, 'browseForQuestions', $this->object);
810  $table_gui->resetFilter();
811  $this->ctrl->redirect($this, 'browseForQuestions');
812  }
813 
814  public function insertQuestionsObject()
815  {
816  $inserted_objects = 0;
817  if (is_array($_POST['q_id'])) {
818  if ($_REQUEST["pgov"]) {
819  include_once "Modules/Survey/classes/class.ilSurveyPageGUI.php";
820  $page_gui = new ilSurveyPageGUI($this->object, $this);
821  $page_gui->determineCurrentPage();
822 
823  // as target position is predefined, insert in reverse order
824  $_POST['q_id'] = array_reverse($_POST['q_id']);
825  }
826  foreach ($_POST['q_id'] as $question_id) {
827  if (!$_REQUEST["pgov"]) {
828  $this->object->insertQuestion($question_id);
829  } else {
830  // target position (pgov pos) is processed there
831  $page_gui->insertNewQuestion($question_id);
832  }
833  $inserted_objects++;
834  }
835  }
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");
841  } else {
842  $target_page = $_REQUEST["pgov"];
843  if (substr($_REQUEST["pgov_pos"], -1) == "c") {
844  // see ilSurveyPageGUI::insertNewQuestion()
845  if ((int) $_REQUEST["pgov_pos"]) {
846  $target_page++;
847  } else {
848  $target_page = 1;
849  }
850  }
851  $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
852  $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
853  }
854  } else {
855  ilUtil::sendInfo($this->lng->txt("insert_missing_question"), true);
856  $this->ctrl->redirect($this, 'browseForQuestions');
857  }
858  }
859 
861  {
863 
864  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
865  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object, true);
866  $table_gui->setEditable(true);
867  $this->tpl->setContent($table_gui->getHTML());
868  }
869 
871  {
872  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
873  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
874  $table_gui->writeFilterToSession();
875  $this->ctrl->redirect($this, 'browseForQuestionblocks');
876  }
877 
879  {
880  include_once "./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
881  $table_gui = new ilSurveyQuestionblockbrowserTableGUI($this, 'browseForQuestionblocks', $this->object);
882  $table_gui->resetFilter();
883  $this->ctrl->redirect($this, 'browseForQuestionblocks');
884  }
885 
886  public function insertQuestionblocksObject()
887  {
888  $inserted_objects = 0;
889  if (is_array($_POST['cb'])) {
890  if ($_REQUEST["pgov"]) {
891  include_once "Modules/Survey/classes/class.ilSurveyPageGUI.php";
892  $page_gui = new ilSurveyPageGUI($this->object, $this);
893  $page_gui->determineCurrentPage();
894 
895  // as target position is predefined, insert in reverse order
896  $_POST['cb'] = array_reverse($_POST['cb']);
897  }
898  foreach ($_POST['cb'] as $questionblock_id) {
899  if (!$_REQUEST["pgov"]) {
900  $this->object->insertQuestionblock($questionblock_id);
901  } else {
902  $page_gui->insertQuestionblock($questionblock_id);
903  }
904  $inserted_objects++;
905  }
906  }
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");
912  } else {
913  $target_page = $_REQUEST["pgov"];
914  if (substr($_REQUEST["pgov_pos"], -1) == "c") {
915  $target_page++;
916  }
917  $this->ctrl->setParameterByClass("ilsurveypagegui", "pgov", $target_page);
918  $this->ctrl->redirectByClass("ilsurveypagegui", "renderpage");
919  }
920  } else {
921  ilUtil::sendInfo($this->lng->txt("insert_missing_questionblock"), true);
922  $this->ctrl->redirect($this, 'browseForQuestionblocks');
923  }
924  }
925 
926 
927  //
928  // BLOCKS
929  //
930 
931  public function editQuestionblockObject(ilPropertyFormGUI $a_form = null)
932  {
933  $block_id = (int) $_REQUEST["bl_id"];
934  $this->ctrl->setParameter($this, "bl_id", $block_id);
935 
936  if (!$a_form) {
937  $a_form = $this->initQuestionblockForm($block_id);
938  }
939 
940  $this->questionsSubtabs("questions");
941  $this->tpl->setContent($a_form->getHTML());
942  }
943 
944  public function createQuestionblockObject(ilPropertyFormGUI $a_form = null)
945  {
946  if (!$a_form) {
947  // gather questions from table selected
948  $items = $this->gatherSelectedTableItems(false, true, false, false);
949 
950  if (is_array($_POST["qids"]) && sizeof($_POST["qids"])) {
951  $items["questions"] = $_POST["qids"];
952  }
953  if (count($items["questions"]) < 2) {
954  ilUtil::sendInfo($this->lng->txt("qpl_define_questionblock_select_missing"), true);
955  $this->ctrl->redirect($this, "questions");
956  }
957 
958  $a_form = $this->initQuestionblockForm(null, $items["questions"]);
959  }
960 
961  $this->questionsSubtabs("questions");
962  $this->tpl->setContent($a_form->getHTML());
963  }
964 
965  protected function initQuestionblockForm($a_block_id = null, $a_question_ids = null)
966  {
967  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
968  $form = new ilPropertyFormGUI();
969  $form->setFormAction($this->ctrl->getFormAction($this, "saveDefineQuestionblock"));
970  $form->setTitle($this->lng->txt("define_questionblock"));
971 
972  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
973  $title->setRequired(true);
974  $form->addItem($title);
975 
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);
979 
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);
983 
984  if ($a_block_id) {
985  $questionblock = ilObjSurvey::_getQuestionblock($a_block_id);
986  $title->setValue($questionblock["title"]);
987  $toggle_blocktitle->setChecked($questionblock["show_blocktitle"]);
988  $toggle_questiontitle->setChecked($questionblock["show_questiontext"]);
989  } else {
990  $toggle_blocktitle->setChecked(true);
991  $toggle_questiontitle->setChecked(true);
992  }
993 
994  $form->addCommandButton("saveDefineQuestionblock", $this->lng->txt("save"));
995  $form->addCommandButton("questions", $this->lng->txt("cancel"));
996 
997  // reload?
998  if (!$a_question_ids && $_POST["qids"]) {
999  $a_question_ids = $_POST["qids"];
1000  }
1001 
1002  if ($a_question_ids) {
1003  foreach ($a_question_ids as $q_id) {
1004  $hidden = new ilHiddenInputGUI("qids[]");
1005  $hidden->setValue($q_id);
1006  $form->addItem($hidden);
1007  }
1008  }
1009 
1010  return $form;
1011  }
1012 
1014  {
1015  $block_id = (int) $_REQUEST["bl_id"];
1016  $q_ids = $_POST["qids"];
1017 
1018  $this->ctrl->setParameter($this, "bl_id", $block_id);
1019 
1020  if (!$block_id && !is_array($q_ids)) {
1021  $this->ctrl->redirect($this, "questions");
1022  }
1023 
1024  $form = $this->initQuestionblockForm($block_id);
1025  if ($form->checkInput()) {
1026  $title = $form->getInput("title");
1027  $show_questiontext = $form->getInput("show_questiontext");
1028  $show_blocktitle = $form->getInput("show_blocktitle") ;
1029  if ($block_id) {
1030  $this->object->modifyQuestionblock(
1031  $block_id,
1032  $title,
1033  $show_questiontext,
1034  $show_blocktitle
1035  );
1036  } elseif ($q_ids) {
1037  $this->object->createQuestionblock(
1038  $title,
1039  $show_questiontext,
1040  $show_blocktitle,
1041  $q_ids
1042  );
1043  }
1044 
1045  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
1046  $this->ctrl->redirect($this, "questions");
1047  }
1048 
1049  $form->setValuesByPost();
1051  }
1052 
1053 
1054  //
1055  // HEADING
1056  //
1057 
1058  protected function initHeadingForm($a_question_id = null)
1059  {
1060  $survey_questions = $this->object->getSurveyQuestions();
1061 
1062  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1063  $form = new ilPropertyFormGUI();
1064  $form->setFormAction($this->ctrl->getFormAction($this, ""));
1065 
1066  // heading
1067  $heading = new ilTextAreaInputGUI($this->lng->txt("heading"), "heading");
1068  $heading->setRows(10);
1069  $heading->setCols(80);
1070  $heading->setUseRte(true);
1071  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1072  $heading->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
1073  $heading->removePlugin(ilRTE::ILIAS_IMG_MANAGER_PLUGIN);
1074  $heading->setRTESupport($this->object->getId(), "svy", "survey");
1075  $heading->setRequired(true);
1076  $form->addItem($heading);
1077 
1078  $insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
1079  $options = array();
1080  foreach ($survey_questions as $key => $value) {
1081  $options[$key] = $this->lng->txt("before") . ": \"" . $value["title"] . "\"";
1082  }
1083  $insertbefore->setOptions($options);
1084  $insertbefore->setRequired(true);
1085  $form->addItem($insertbefore);
1086 
1087  $form->addCommandButton("saveHeading", $this->lng->txt("save"));
1088  $form->addCommandButton("questions", $this->lng->txt("cancel"));
1089 
1090  if ($a_question_id) {
1091  $form->setTitle($this->lng->txt("edit_heading"));
1092 
1093  $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id]["heading"]));
1094  $insertbefore->setValue($a_question_id);
1095  $insertbefore->setDisabled(true);
1096  } else {
1097  $form->setTitle($this->lng->txt("add_heading"));
1098  }
1099 
1100  return $form;
1101  }
1102 
1103  public function addHeadingObject(ilPropertyFormGUI $a_form = null)
1104  {
1105  $q_id = $_REQUEST["q_id"];
1106  $this->ctrl->setParameter($this, "q_id", $q_id);
1107 
1108  $this->questionsSubtabs("questions");
1109 
1110  if (!$a_form) {
1111  $a_form = $this->initHeadingForm($q_id);
1112  }
1113 
1114  $this->tpl->setContent($a_form->getHTML());
1115  }
1116 
1117  public function editHeadingObject(ilPropertyFormGUI $a_form = null)
1118  {
1119  $q_id = $_REQUEST["q_id"];
1120  $this->ctrl->setParameter($this, "q_id", $q_id);
1121 
1122  $this->questionsSubtabs("questions");
1123 
1124  if (!$a_form) {
1125  $a_form = $this->initHeadingForm($q_id);
1126  }
1127 
1128  $this->tpl->setContent($a_form->getHTML());
1129  }
1130 
1131  public function saveHeadingObject()
1132  {
1133  // #15474
1134  $q_id = (int) $_REQUEST["q_id"];
1135  $this->ctrl->setParameter($this, "q_id", $q_id);
1136 
1137  $form = $this->initHeadingForm($q_id);
1138  if ($form->checkInput()) {
1139  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1140  $this->object->saveHeading(
1142  $form->getInput("heading"),
1143  true,
1145  ),
1146  $form->getInput("insertbefore")
1147  );
1148  $this->ctrl->redirect($this, "questions");
1149  }
1150 
1151  $form->setValuesByPost();
1152  $this->addHeadingObject($form);
1153  }
1154 
1155  public function removeHeadingObject()
1156  {
1157  $q_id = (int) $_REQUEST["q_id"];
1158  $this->ctrl->setParameter($this, "q_id", $q_id);
1159 
1160  if (!$q_id) {
1161  $this->ctrl->redirect($this, "questions");
1162  }
1163 
1164  $this->questionsSubtabs("questions");
1165 
1166  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1167  $cgui = new ilConfirmationGUI();
1168  $cgui->setHeaderText($this->lng->txt("confirm_remove_heading"));
1169 
1170  $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedRemoveHeading"));
1171  $cgui->setCancel($this->lng->txt("cancel"), "questions");
1172  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedRemoveHeading");
1173 
1174  $this->tpl->setContent($cgui->getHTML());
1175  }
1176 
1178  {
1179  $q_id = (int) $_REQUEST["q_id"];
1180  if (!$q_id) {
1181  $this->ctrl->redirect($this, "questions");
1182  }
1183 
1184  $this->object->saveHeading("", $q_id);
1185  $this->ctrl->redirect($this, "questions");
1186  }
1187 
1193  public function printViewObject()
1194  {
1195  $ilToolbar = $this->toolbar;
1196 
1197  $this->questionsSubtabs("print");
1198 
1199  #21023 and #19448
1200  if (!$current_title = (int) $_REQUEST['export_label']) {
1201  $current_title = $this->object->getShowQuestionTitles();
1202  }
1203  /*if(!isset($_POST["export_label"]))
1204  {fir
1205  $_POST["export_label"] = $this->object->getShowQuestionTitles();
1206  }
1207  $current_title = (int)$_REQUEST["export_label"];
1208  */
1209 
1210  include_once "Services/Form/classes/class.ilSelectInputGUI.php";
1211  $label = new ilSelectInputGUI($this->lng->txt("title") . "/" . $this->lng->txt("label"), "export_label");
1212 
1213  #19448 comment none and label only options.
1214  $label->setOptions($this->print_options);
1215  $label->setValue($current_title);
1216 
1217  $ilToolbar->addStickyItem($label, true);
1218 
1219  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "printView"));
1220 
1221  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
1222  $button = ilSubmitButton::getInstance();
1223  $button->setCaption("show");
1224  $button->setCommand("printView");
1225  $ilToolbar->addStickyItem($button);
1226 
1227  $ilToolbar->addSeparator();
1228 
1229  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1230  $button = ilLinkButton::getInstance();
1231  $button->setCaption("print");
1232  $button->setOnClick("window.print(); return false;");
1233  $button->setOmitPreventDoubleSubmission(true);
1234  $ilToolbar->addButtonInstance($button);
1235 
1236  include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
1237  if (ilRPCServerSettings::getInstance()->isEnabled()) {
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", "");
1243 
1244  $button = ilLinkButton::getInstance();
1245  $button->setCaption("pdf_export");
1246  $button->setUrl($pdf_url);
1247  $button->setOmitPreventDoubleSubmission(true);
1248  $ilToolbar->addButtonInstance($button);
1249  }
1250 
1251  // defer rendering of tex to fo processing
1252  if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1)) {
1253  require_once('Services/MathJax/classes/class.ilMathJax.php');
1255  }
1256 
1257  $template = new ilTemplate("tpl.il_svy_svy_printview.html", true, true, "Modules/Survey");
1258 
1259  $pages = &$this->object->getSurveyPages();
1260  $required = false;
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"]);
1269  $template->parseCurrentBlock();
1270  }
1271  $template->setCurrentBlock("question");
1272  $template->setVariable("QUESTION_DATA", $questionGUI->getPrintView($current_title, $question["questionblock_show_questiontext"], $this->object->getSurveyId()));
1273  $template->parseCurrentBlock();
1274 
1275  if ($question["obligatory"]) {
1276  $required = true;
1277  }
1278  }
1279  }
1280  if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"]) {
1281  $template->setCurrentBlock("page");
1282  $template->setVariable("BLOCKTITLE", $page[0]["questionblock_title"]);
1283  $template->parseCurrentBlock();
1284  } else {
1285  $template->setCurrentBlock("page");
1286  $template->parseCurrentBlock();
1287  }
1288  }
1289  }
1290 
1291  // #6412
1292  if ($required) {
1293  $template->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
1294  }
1295 
1296  // $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
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);
1304 
1305  // render tex as fo graphics
1306  require_once('Services/MathJax/classes/class.ilMathJax.php');
1307  $fo = ilMathJax::getInstance()
1308  ->init(ilMathJax::PURPOSE_PDF)
1309  ->setRendering(ilMathJax::RENDER_PNG_AS_FO_FILE)
1310  ->insertLatexImages($fo);
1311 
1312  // #11436
1313  if (!$fo || !$this->object->deliverPDFfromFO($fo)) {
1314  ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
1315  $this->ctrl->redirect($this, "printView");
1316  }
1317  } else {
1318  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1319  }
1320  }
1321 }
This class represents an option in a radio group.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
editHeadingObject(ilPropertyFormGUI $a_form=null)
Class ilSurveyEditorGUI.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
$template
This class represents a property form user interface.
$type
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _hasDatasets($survey_id)
addHeadingObject(ilPropertyFormGUI $a_form=null)
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
if(!array_key_exists('StateId', $_REQUEST)) $id
const PURPOSE_PDF
Survey per page view.
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
This class represents a checkbox property in a property form.
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.
user()
Definition: user.php:4
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)
global $ilCtrl
Definition: ilias.php:18
createQuestionObject(ilPropertyFormGUI $a_form=null)
setInfo($a_info)
Set Information Text.
Class ilObjSurveyGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
createQuestionPool($name="dummy")
initQuestionblockForm($a_block_id=null, $a_question_ids=null)
This class represents a hidden form property in a property form.
This class represents a property in a property form.
if(isset($_POST['submit'])) $form
const ILIAS_IMG_MANAGER_PLUGIN
Definition: class.ilRTE.php:14
Message box for survey, when data is alrady available.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
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.
setOptions($a_options)
Set Options.
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)
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.
printViewObject()
Creates a print view of the survey questions.
if(empty($password)) $table
Definition: pwgen.php:24
$target
Definition: test.php:19
$key
Definition: croninfo.php:18
$_POST["username"]
Settings template application class.
setRequired($a_required)
Set Required.
const PURPOSE_DEFERRED_PDF
Confirmation screen class.
$data
Definition: bench.php:6
static getInstance()
Get singelton instance.