ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilSurveyExecutionGUI Class Reference

Survey execution graphical output. More...

+ Collaboration diagram for ilSurveyExecutionGUI:

Public Member Functions

 ilSurveyExecutionGUI ($a_object)
 ilSurveyExecutionGUI constructor More...
 
executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 Retrieves the ilCtrl command. More...
 
 resume ()
 Resumes the survey. More...
 
 start ($resume=false)
 Starts the survey. More...
 
 redirectQuestion ()
 Called when a user answered a page to perform a redirect after POST. More...
 
 previousNoSave ()
 
 previous ($a_save_input=true)
 Navigates to the previous pages. More...
 
 next ()
 Navigates to the next pages. More...
 
 gotoPage ()
 Go to a specific page without saving. More...
 
 outSurveyPage ($activepage=NULL, $direction=NULL)
 Output of the active survey question to the screen. More...
 
 saveUserInput ($navigationDirection="next")
 Save the user's input. More...
 
 saveActiveQuestionData (&$data)
 Survey navigation. More...
 
 cancel ()
 Called on cancel. More...
 
 runShowFinishedPage ()
 Creates the finished page for a running survey. More...
 
 backToRepository ()
 
 exitSurvey ()
 Exits the survey after finishing it. More...
 
 outNavigationButtons ($navigationblock="top", $page)
 Creates the navigation buttons for a survey. More...
 
 preview ()
 
 viewUserResults ()
 
 mailUserResults ()
 
 showFinishConfirmation ()
 
 confirmedFinish ()
 

Data Fields

 $object
 
 $lng
 
 $tpl
 
 $ctrl
 
 $ilias
 
 $tree
 
 $preview
 

Protected Member Functions

 checkAuth ($a_may_start=false, $a_ignore_status=false)
 

Detailed Description

Survey execution graphical output.

The ilSurveyExecutionGUI class creates the execution output for the ilObjSurveyGUI class. This saves some heap space because the ilObjSurveyGUI class will be smaller.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 35 of file class.ilSurveyExecutionGUI.php.

Member Function Documentation

◆ backToRepository()

ilSurveyExecutionGUI::backToRepository ( )

Definition at line 778 of file class.ilSurveyExecutionGUI.php.

779 {
780 global $tree;
781
782 // #14971
783 if($this->object->get360Mode())
784 {
785 $target_ref_id = $this->object->getRefId();
786 }
787 else
788 {
789 // #11534
790 $target_ref_id = $tree->getParentId($this->object->getRefId());
791 }
792
793 include_once "Services/Link/classes/class.ilLink.php";
794 ilUtil::redirect(ilLink::_getLink($target_ref_id));
795 }
static redirect($a_script)
http redirect to other script

References $tree, ilLink\_getLink(), and ilUtil\redirect().

Referenced by exitSurvey(), mailUserResults(), and viewUserResults().

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

◆ cancel()

ilSurveyExecutionGUI::cancel ( )

Called on cancel.

Called on cancel

@access private

Definition at line 691 of file class.ilSurveyExecutionGUI.php.

692 {
693 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
694 }

◆ checkAuth()

ilSurveyExecutionGUI::checkAuth (   $a_may_start = false,
  $a_ignore_status = false 
)
protected

Definition at line 102 of file class.ilSurveyExecutionGUI.php.

103 {
104 global $rbacsystem, $ilUser;
105
106 if($this->preview)
107 {
108 if(!$rbacsystem->checkAccess("write", $this->object->ref_id))
109 {
110 // only with write access it is possible to preview the survey
111 $this->ilias->raiseError($this->lng->txt("survey_cannot_preview_survey"),$this->ilias->error_obj->MESSAGE);
112 }
113
114 return true;
115 }
116
117 if (!$this->external_rater_360 &&
118 !$rbacsystem->checkAccess("read", $this->object->ref_id))
119 {
120 // only with read access it is possible to run the test
121 $this->ilias->raiseError($this->lng->txt("cannot_read_survey"),$this->ilias->error_obj->MESSAGE);
122 }
123
124 $user_id = $ilUser->getId();
125
126 // check existing code
127 // see ilObjSurveyGUI::infoScreen()
128 $anonymous_id = $anonymous_code = null;
129 if ($this->object->getAnonymize() || !$this->object->isAccessibleWithoutCode())
130 {
131 $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
132 $anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
133 if(!$anonymous_id)
134 {
135 ilUtil::sendFailure(sprintf($this->lng->txt("error_retrieving_anonymous_survey"), $anonymous_code, true));
136 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
137 }
138 }
139
140 // appraisee validation
141 $appr_id = 0;
142 if($this->object->get360Mode())
143 {
144 $appr_id = $_REQUEST["appr_id"];
145 if(!$appr_id)
146 {
147 $appr_id = $_SESSION["appr_id"][$this->object->getId()];
148 }
149 // check if appraisee is valid
150 if($anonymous_id)
151 {
152 $appraisees = $this->object->getAppraiseesToRate(0, $anonymous_id);
153 }
154 if(!$appraisees && $user_id != ANONYMOUS_USER_ID)
155 {
156 $appraisees = $this->object->getAppraiseesToRate($user_id);
157 }
158 if(!in_array($appr_id, $appraisees))
159 {
160 ilUtil::sendFailure($this->lng->txt("survey_360_execution_invalid_appraisee"), true);
161 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
162 }
163 }
164 $_SESSION["appr_id"][$this->object->getId()] = $appr_id;
165
166 if(!$a_ignore_status)
167 {
168 $status = $this->object->isSurveyStarted($user_id, $anonymous_code, $appr_id);
169 // completed
170 if($status === 1)
171 {
172 ilUtil::sendFailure($this->lng->txt("already_completed_survey"), true);
173 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
174 }
175 // starting
176 else if ($status === false)
177 {
178 if($a_may_start)
179 {
180 $_SESSION["finished_id"][$this->object->getId()] =
181 $this->object->startSurvey($user_id, $anonymous_code, $appr_id);
182 }
183 else
184 {
185 ilUtil::sendFailure($this->lng->txt("survey_use_start_button"), true);
186 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
187 }
188 }
189 // resuming
190 else
191 {
192 // nothing todo
193 }
194 }
195
196 // validate finished id
197 if($this->object->getActiveID($user_id, $anonymous_code, $appr_id) !=
198 $_SESSION["finished_id"][$this->object->getId()])
199 {
200 ilUtil::sendFailure($this->lng->txt("cannot_read_survey"), true);
201 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
202 }
203 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
redirection script todo: (a better solution should control the processing via a xml file)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15

References $_REQUEST, $_SESSION, $ilUser, preview(), and ilUtil\sendFailure().

Referenced by mailUserResults(), outSurveyPage(), start(), and viewUserResults().

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

◆ confirmedFinish()

ilSurveyExecutionGUI::confirmedFinish ( )

Definition at line 920 of file class.ilSurveyExecutionGUI.php.

921 {
922 global $ilUser;
923
924 if(!$this->preview)
925 {
926 $this->object->finishSurvey($_SESSION["finished_id"][$this->object->getId()]);
927
928 if ($this->object->getMailNotification())
929 {
930 $this->object->sendNotificationMail($ilUser->getId(),
931 $_SESSION["anonymous_id"][$this->object->getId()],
932 $_SESSION["appr_id"][$this->object->getId()]);
933 }
934 }
935
936 /*
937 unset($_SESSION["anonymous_id"][$this->object->getId()]);
938 unset($_SESSION["appr_id"][$this->object->getId()]);
939 unset($_SESSION["finished_id"][$this->object->getId()]);
940 */
941
942 $this->ctrl->redirect($this, "runShowFinishedPage");
943 }

References $_SESSION, $ilUser, and preview().

+ Here is the call graph for this function:

◆ executeCommand()

& ilSurveyExecutionGUI::executeCommand ( )

execute command

Definition at line 82 of file class.ilSurveyExecutionGUI.php.

83 {
84 $cmd = $this->ctrl->getCmd();
85 $next_class = $this->ctrl->getNextClass($this);
86
87 $cmd = $this->getCommand($cmd);
88 if (strlen($cmd) == 0)
89 {
90 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
91 $this->ctrl->redirect($this, "gotoPage");
92 }
93 switch($next_class)
94 {
95 default:
96 $ret =& $this->$cmd();
97 break;
98 }
99 return $ret;
100 }
$_GET["client_id"]
getCommand($cmd)
Retrieves the ilCtrl command.
$cmd
Definition: sahs_server.php:35

References $_GET, $cmd, $ret, and getCommand().

+ Here is the call graph for this function:

◆ exitSurvey()

ilSurveyExecutionGUI::exitSurvey ( )

Exits the survey after finishing it.

Exits the survey after finishing it

@access public

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

805 {
806 if(!$this->preview)
807 {
808 $this->backToRepository();
809 }
810 else
811 {
812 // #12841
813 $this->ctrl->setParameterByClass("ilsurveyeditorgui", "pgov", $_REQUEST["pgov"]);
814 $this->ctrl->redirectByClass(array("ilobjsurveygui", "ilsurveyeditorgui"), "questions");
815 }
816 }

References $_REQUEST, backToRepository(), and preview().

Referenced by runShowFinishedPage().

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

◆ getCommand()

ilSurveyExecutionGUI::getCommand (   $cmd)

Retrieves the ilCtrl command.

Retrieves the ilCtrl command

@access public

Definition at line 212 of file class.ilSurveyExecutionGUI.php.

213 {
214 return $cmd;
215 }

References $cmd.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ gotoPage()

ilSurveyExecutionGUI::gotoPage ( )

Go to a specific page without saving.

@access private

Definition at line 347 of file class.ilSurveyExecutionGUI.php.

348 {
349 $this->ctrl->setParameter($this, "activecommand", "gotoPage");
350 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
351 $this->ctrl->setParameter($this, "direction", "0");
352 $this->ctrl->redirect($this, "redirectQuestion");
353 }

References $_GET.

◆ ilSurveyExecutionGUI()

ilSurveyExecutionGUI::ilSurveyExecutionGUI (   $a_object)

ilSurveyExecutionGUI constructor

The constructor takes possible arguments an creates an instance of the ilSurveyExecutionGUI object.

Parameters
object$a_objectAssociated ilObjSurvey class @access public

Definition at line 53 of file class.ilSurveyExecutionGUI.php.

54 {
55 global $lng, $tpl, $ilCtrl, $ilias, $tree;
56
57 $this->lng =& $lng;
58 $this->tpl =& $tpl;
59 $this->ctrl =& $ilCtrl;
60 $this->ilias =& $ilias;
61 $this->object =& $a_object;
62 $this->tree =& $tree;
63
64 $this->external_rater_360 = false;
65 if($this->object->get360Mode() &&
66 $_SESSION["anonymous_id"][$this->object->getId()] &&
67 ilObjSurvey::validateExternalRaterCode($this->object->getRefId(),
68 $_SESSION["anonymous_id"][$this->object->getId()]))
69 {
70 $this->external_rater_360 = true;
71 }
72
73 // stay in preview mode
74 $this->preview = (bool)$_REQUEST["prvw"];
75 $this->ctrl->saveParameter($this, "prvw");
76 $this->ctrl->saveParameter($this, "pgov");
77 }
static validateExternalRaterCode($a_ref_id, $a_code)
global $ilCtrl
Definition: ilias.php:18

References $_REQUEST, $_SESSION, $ilCtrl, $ilias, $lng, $tpl, $tree, preview(), and ilObjSurvey\validateExternalRaterCode().

+ Here is the call graph for this function:

◆ mailUserResults()

ilSurveyExecutionGUI::mailUserResults ( )

Definition at line 880 of file class.ilSurveyExecutionGUI.php.

881 {
882 if(!$this->object->hasMailOwnResults())
883 {
884 $this->backToRepository();
885 }
886
887 $this->checkAuth(false, true);
888
889 $recipient = $_POST["mail"];
890 if(!ilUtil::is_email($recipient))
891 {
892 $this->ctrl->redirect($this, "runShowFinishedPage");
893 }
894
895 $survey_gui = new ilObjSurveyGUI();
896 $survey_gui->sendUserResultsMail(
897 $_SESSION["finished_id"][$this->object->getId()],
898 $recipient
899 );
900
901 ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
902 $this->ctrl->redirect($this, "runShowFinishedPage");
903 }
Class ilObjSurveyGUI.
checkAuth($a_may_start=false, $a_ignore_status=false)
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, $_SESSION, backToRepository(), checkAuth(), ilUtil\is_email(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ next()

ilSurveyExecutionGUI::next ( )

Navigates to the next pages.

@access private

Definition at line 326 of file class.ilSurveyExecutionGUI.php.

327 {
328 $result = $this->saveUserInput("next");
329 $this->ctrl->setParameter($this, "activecommand", "next");
330 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
331 if (strlen($result))
332 {
333 $this->ctrl->setParameter($this, "direction", "0");
334 }
335 else
336 {
337 $this->ctrl->setParameter($this, "direction", "1");
338 }
339 $this->ctrl->redirect($this, "redirectQuestion");
340 }
$result
saveUserInput($navigationDirection="next")
Save the user's input.

References $_GET, $result, and saveUserInput().

+ Here is the call graph for this function:

◆ outNavigationButtons()

ilSurveyExecutionGUI::outNavigationButtons (   $navigationblock = "top",
  $page 
)

Creates the navigation buttons for a survey.

Creates the navigation buttons for a survey. Runs twice to generate a top and a bottom navigation to ease the use of long forms.

@access public

Definition at line 827 of file class.ilSurveyExecutionGUI.php.

828 {
829 $prevpage = $this->object->getNextPage($page[0]["question_id"], -1);
830 $this->tpl->setCurrentBlock($navigationblock . "_prev");
831 if ($prevpage === 0)
832 {
833 $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_start"));
834 }
835 else
836 {
837 $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_previous"));
838 }
839 $this->tpl->parseCurrentBlock();
840 $nextpage = $this->object->getNextPage($page[0]["question_id"], 1);
841 $this->tpl->setCurrentBlock($navigationblock . "_next");
842 if ($nextpage === 1)
843 {
844 $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_finish"));
845 }
846 else
847 {
848 $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_next"));
849 }
850 $this->tpl->parseCurrentBlock();
851 }

Referenced by outSurveyPage().

+ Here is the caller graph for this function:

◆ outSurveyPage()

ilSurveyExecutionGUI::outSurveyPage (   $activepage = NULL,
  $direction = NULL 
)

Output of the active survey question to the screen.

Output of the active survey question to the screen

@access private

Definition at line 362 of file class.ilSurveyExecutionGUI.php.

363 {
364 global $ilUser;
365
366 $this->checkAuth();
367
368 $page = $this->object->getNextPage($activepage, $direction);
369 $constraint_true = 0;
370
371 // check for constraints
372 if (count($page[0]["constraints"]))
373 {
374 while (is_array($page) and ($constraint_true == 0) and (count($page[0]["constraints"])))
375 {
376 $constraint_true = ($page[0]['constraints'][0]['conjunction'] == 0) ? true : false;
377 foreach ($page[0]["constraints"] as $constraint)
378 {
379 if(!$this->preview)
380 {
381 $working_data = $this->object->loadWorkingData($constraint["question"], $_SESSION["finished_id"][$this->object->getId()]);
382 }
383 else
384 {
385 $working_data = $_SESSION["preview_data"][$this->object->getId()][$constraint["question"]];
386 }
387 if ($constraint['conjunction'] == 0)
388 {
389 // and
390 $constraint_true = $constraint_true & $this->object->checkConstraint($constraint, $working_data);
391 }
392 else
393 {
394 // or
395 $constraint_true = $constraint_true | $this->object->checkConstraint($constraint, $working_data);
396 }
397 }
398 if ($constraint_true == 0)
399 {
400 // #11047 - we are skipping the page, so we have to get rid of existing answers for that question(s)
401 foreach($page as $page_question)
402 {
403 $qid = $page_question["question_id"];
404
405 // see saveActiveQuestionData()
406 if(!$this->preview)
407 {
408 $this->object->deleteWorkingData($qid, $_SESSION["finished_id"][$this->object->getId()]);
409 }
410 else
411 {
412 $_SESSION["preview_data"][$this->object->getId()][$qid] = null;
413 }
414 }
415
416 $page = $this->object->getNextPage($page[0]["question_id"], $direction);
417 }
418 }
419 }
420
421 $first_question = -1;
422 if ($page === 0)
423 {
424 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
425 }
426 else if ($page === 1)
427 {
428 $state = $this->object->getUserSurveyExecutionStatus();
429 if($this->preview ||
430 !$state["runs"][$_SESSION["finished_id"][$this->object->getId()]]["finished"])
431 {
432 $this->showFinishConfirmation();
433 }
434 else
435 {
436 $this->runShowFinishedPage();
437 }
438 return;
439 }
440 else
441 {
442 global $ilHelp;
443 $ilHelp->setScreenIdComponent("svy");
444 $ilHelp->setScreenId("quest_presentation");
445
446 $required = false;
447 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_content.html", "Modules/Survey");
448
449 if($this->object->get360Mode())
450 {
451 $appr_id = $_SESSION["appr_id"][$this->object->getId()];
452
453 include_once "Services/User/classes/class.ilUserUtil.php";
454 $this->tpl->setTitle($this->object->getTitle()." (".
455 $this->lng->txt("survey_360_appraisee").": ".
456 ilUserUtil::getNamePresentation($appr_id).")");
457 }
458
459 if (!($this->object->getAnonymize() && $this->object->isAccessibleWithoutCode() && ($ilUser->getId() == ANONYMOUS_USER_ID)))
460 {
461 $this->tpl->setCurrentBlock("suspend_survey");
462
463 if(!$this->preview)
464 {
465 $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("cancel_survey"));
466 $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "infoScreen"));
467 }
468 else
469 {
470 $this->ctrl->setParameterByClass("ilObjSurveyGUI", "pgov", $_REQUEST["pgov"]);
471 $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("survey_cancel_preview"));
472 $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(array("ilObjSurveyGUI", "ilSurveyEditorGUI"), "questions"));
473 }
474
475 $this->tpl->setVariable("ALT_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
476 $this->tpl->setVariable("TITLE_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
477 $this->tpl->parseCurrentBlock();
478 }
479 $this->outNavigationButtons("top", $page);
480
481
482 $this->tpl->setCurrentBlock("percentage");
483
484 $percentage = (int)(($page[0]["position"])*100);
485
486 include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
488 $pbar->setCurrent($percentage);
489 $this->tpl->setVariable("NEW_PBAR", $pbar->render());
490
491 $this->tpl->parseCurrentBlock();
492
493
494 if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"])
495 {
496 $this->tpl->setCurrentBlock("questionblock_title");
497 $this->tpl->setVariable("TEXT_QUESTIONBLOCK_TITLE", $page[0]["questionblock_title"]);
498 $this->tpl->parseCurrentBlock();
499 }
500 foreach ($page as $data)
501 {
502 $this->tpl->setCurrentBlock("survey_content");
503 if ($data["heading"])
504 {
505 $this->tpl->setVariable("QUESTION_HEADING", $data["heading"]);
506 }
507 if ($first_question == -1) $first_question = $data["question_id"];
508 $question_gui = $this->object->getQuestionGUI($data["type_tag"], $data["question_id"]);
509 if (is_array($_SESSION["svy_errors"]))
510 {
511 $working_data =& $question_gui->object->getWorkingDataFromUserInput($_SESSION["postdata"]);
512 }
513 else
514 {
515 $working_data = $this->object->loadWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
516 }
517 $question_gui->object->setObligatory($data["obligatory"]);
518 $error_messages = array();
519 if (is_array($_SESSION["svy_errors"]))
520 {
521 $error_messages = $_SESSION["svy_errors"];
522 }
523 $show_questiontext = ($data["questionblock_show_questiontext"]) ? 1 : 0;
524 $question_output = $question_gui->getWorkingForm($working_data, $this->object->getShowQuestionTitles(), $show_questiontext, $error_messages[$data["question_id"]], $this->object->getSurveyId());
525 $this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
526 $this->ctrl->setParameter($this, "qid", $data["question_id"]);
527 $this->tpl->parse("survey_content");
528 if ($data["obligatory"]) $required = true;
529 }
530 if ($required)
531 {
532 $this->tpl->setCurrentBlock("required");
533 $this->tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
534 $this->tpl->parseCurrentBlock();
535 }
536
537 $this->outNavigationButtons("bottom", $page);
538
539 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "redirectQuestion"));
540 }
541
542 if(!$this->preview)
543 {
544 $this->object->setPage($_SESSION["finished_id"][$this->object->getId()], $page[0]['question_id']);
545 $this->object->setStartTime($_SESSION["finished_id"][$this->object->getId()], $first_question);
546 }
547 }
static getInstance()
Factory.
outNavigationButtons($navigationblock="top", $page)
Creates the navigation buttons for a survey.
runShowFinishedPage()
Creates the finished page for a running survey.
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true)
Default behaviour is:
$error_messages

References $_REQUEST, $_SESSION, $data, $error_messages, $ilUser, checkAuth(), ilProgressBar\getInstance(), ilUserUtil\getNamePresentation(), outNavigationButtons(), preview(), runShowFinishedPage(), and showFinishConfirmation().

Referenced by preview(), and redirectQuestion().

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

◆ preview()

ilSurveyExecutionGUI::preview ( )

Definition at line 853 of file class.ilSurveyExecutionGUI.php.

854 {
855 $this->outSurveyPage();
856 }
outSurveyPage($activepage=NULL, $direction=NULL)
Output of the active survey question to the screen.

References outSurveyPage().

Referenced by checkAuth(), confirmedFinish(), exitSurvey(), ilSurveyExecutionGUI(), outSurveyPage(), runShowFinishedPage(), saveActiveQuestionData(), saveUserInput(), and start().

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

◆ previous()

ilSurveyExecutionGUI::previous (   $a_save_input = true)

Navigates to the previous pages.

Navigates to the previous pages

@access private

Definition at line 301 of file class.ilSurveyExecutionGUI.php.

302 {
303 if($a_save_input)
304 {
305 // #16209
306 $has_error = $this->saveUserInput("previous");
307 }
308 $this->ctrl->setParameter($this, "activecommand", "previous");
309 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
310 if (strlen($has_error))
311 {
312 $this->ctrl->setParameter($this, "direction", "0");
313 }
314 else
315 {
316 $this->ctrl->setParameter($this, "direction", "-1");
317 }
318 $this->ctrl->redirect($this, "redirectQuestion");
319 }

References $_GET, and saveUserInput().

Referenced by previousNoSave().

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

◆ previousNoSave()

ilSurveyExecutionGUI::previousNoSave ( )

Definition at line 289 of file class.ilSurveyExecutionGUI.php.

290 {
291 $this->previous(false);
292 }
previous($a_save_input=true)
Navigates to the previous pages.

References previous().

+ Here is the call graph for this function:

◆ redirectQuestion()

ilSurveyExecutionGUI::redirectQuestion ( )

Called when a user answered a page to perform a redirect after POST.

This is called for security reasons to prevent users sending a form twice.

@access public

Definition at line 266 of file class.ilSurveyExecutionGUI.php.

267 {
268 switch ($_GET["activecommand"])
269 {
270 case "next":
271 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
272 break;
273 case "previous":
274 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
275 break;
276 case "gotoPage":
277 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
278 break;
279 case "default":
280 $this->outSurveyPage($_GET["qid"]);
281 break;
282 default:
283 // don't save input, go to the first page
284 $this->outSurveyPage();
285 break;
286 }
287 }

References $_GET, and outSurveyPage().

+ Here is the call graph for this function:

◆ resume()

ilSurveyExecutionGUI::resume ( )

Resumes the survey.

Resumes the survey

@access private

Definition at line 224 of file class.ilSurveyExecutionGUI.php.

225 {
226 $this->start(true);
227 }
start($resume=false)
Starts the survey.

References start().

+ Here is the call graph for this function:

◆ runShowFinishedPage()

ilSurveyExecutionGUI::runShowFinishedPage ( )

Creates the finished page for a running survey.

Creates the finished page for a running survey

@access public

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

704 {
705 global $ilToolbar, $ilUser;
706
707 $has_button = false;
708
709 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
710
711 if(!$this->preview)
712 {
713 if($this->object->hasViewOwnResults())
714 {
715 $button = ilLinkButton::getInstance();
716 $button->setCaption("svy_view_own_results");
717 $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
718 $ilToolbar->addButtonInstance($button);
719
720 $has_button = true;
721 }
722
723 if($this->object->hasMailOwnResults())
724 {
725 if($has_button)
726 {
727 $ilToolbar->addSeparator();
728 }
729
730 require_once "Services/Form/classes/class.ilTextInputGUI.php";
731 $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
732 $mail->setSize(25);
733 if($ilUser->getId() != ANONYMOUS_USER_ID)
734 {
735 $mail->setValue($ilUser->getEmail());
736 }
737 $ilToolbar->addInputItem($mail, true);
738
739 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
740
741 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
742 $button = ilSubmitButton::getInstance();
743 $button->setCaption("svy_mail_own_results");
744 $button->setCommand("mailUserResults");
745 $ilToolbar->addButtonInstance($button);
746
747 $has_button = true;
748 }
749 }
750
751 if (!$has_button &&
752 strlen($this->object->getOutro()) == 0)
753 {
754 $this->exitSurvey();
755 }
756 else
757 {
758 if($has_button)
759 {
760 $ilToolbar->addSeparator();
761 }
762
763 $button = ilLinkButton::getInstance();
764 $button->setCaption("survey_execution_exit");
765 $button->setUrl($this->ctrl->getLinkTarget($this, "exitSurvey"));
766 $ilToolbar->addButtonInstance($button);
767
768 if(strlen($this->object->getOutro()))
769 {
770 include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
771 $panel = ilPanelGUI::getInstance();
772 $panel->setBody($this->object->prepareTextareaOutput($this->object->getOutro()));
773 $this->tpl->setContent($panel->getHTML());
774 }
775 }
776 }
static getInstance()
Factory.
static getInstance()
Get instance.
static getInstance()
Factory.
exitSurvey()
Exits the survey after finishing it.
This class represents a text property in a property form.

References $ilUser, exitSurvey(), ilLinkButton\getInstance(), ilSubmitButton\getInstance(), ilPanelGUI\getInstance(), and preview().

Referenced by outSurveyPage().

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

◆ saveActiveQuestionData()

ilSurveyExecutionGUI::saveActiveQuestionData ( $data)

Survey navigation.

Survey navigation

@access private Saves the users input of the active page

Saves the users input of the active page

@access private

Definition at line 654 of file class.ilSurveyExecutionGUI.php.

655 {
656 global $ilUser;
657
658 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
659 $question =& SurveyQuestion::_instanciateQuestion($data["question_id"]);
660 $error = $question->checkUserInput($_POST, $this->object->getSurveyId());
661 if (strlen($error) == 0)
662 {
663 if(!$this->preview)
664 {
665 // delete old answers
666 $this->object->deleteWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
667
668 $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()]);
669 }
670 else
671 {
672 $_SESSION["preview_data"][$this->object->getId()][$data["question_id"]] =
673 $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()], true);
674 }
675 return 0;
676 }
677 else
678 {
679 $_SESSION["svy_errors"][$question->getId()] = $error;
680 return 1;
681 }
682 }
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.

References $_POST, $_SESSION, $data, $ilUser, SurveyQuestion\_instanciateQuestion(), and preview().

Referenced by saveUserInput().

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

◆ saveUserInput()

ilSurveyExecutionGUI::saveUserInput (   $navigationDirection = "next")

Save the user's input.

@access private

Definition at line 554 of file class.ilSurveyExecutionGUI.php.

555 {
556 if(!$this->preview)
557 {
558 $this->object->setEndTime($_SESSION["finished_id"][$this->object->getId()]);
559 }
560
561 // check users input when it is a metric question
562 unset($_SESSION["svy_errors"]);
563 $_SESSION["postdata"] = $_POST;
564 $page_error = 0;
565 $page = $this->object->getNextPage($_GET["qid"], 0);
566 foreach ($page as $data)
567 {
568 $page_error += $this->saveActiveQuestionData($data);
569 }
570 if ($page_error && (strcmp($navigationDirection, "previous") != 0))
571 {
572 if ($page_error == 1)
573 {
574 ilUtil::sendFailure($this->lng->txt("svy_page_error"), TRUE);
575 }
576 else
577 {
578 ilUtil::sendFailure($this->lng->txt("svy_page_errors"), TRUE);
579 }
580 }
581 else
582 {
583 $page_error = "";
584 unset($_SESSION["svy_errors"]);
585 }
586 return $page_error;
587 }
saveActiveQuestionData(&$data)
Survey navigation.

References $_GET, $_POST, $_SESSION, $data, preview(), saveActiveQuestionData(), and ilUtil\sendFailure().

Referenced by next(), and previous().

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

◆ showFinishConfirmation()

ilSurveyExecutionGUI::showFinishConfirmation ( )

Definition at line 905 of file class.ilSurveyExecutionGUI.php.

906 {
907 global $tpl;
908
909 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
910 $cgui = new ilConfirmationGUI();
911 $cgui->setHeaderText($this->lng->txt("survey_execution_sure_finish"));
912
913 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedFinish"));
914 $cgui->setCancel($this->lng->txt("cancel"), "previousNoSave");
915 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedFinish");
916
917 $tpl->setContent($cgui->getHTML());
918 }
Confirmation screen class.

References $tpl.

Referenced by outSurveyPage().

+ Here is the caller graph for this function:

◆ start()

ilSurveyExecutionGUI::start (   $resume = false)

Starts the survey.

Starts the survey

@access private

Definition at line 236 of file class.ilSurveyExecutionGUI.php.

237 {
238 if($this->preview)
239 {
240 unset($_SESSION["preview_data"]);
241 }
242 unset($_SESSION["svy_errors"]);
243
244 $this->checkAuth(!$resume);
245
246 $activepage = "";
247 if ($resume)
248 {
249 $activepage = $this->object->getLastActivePage($_SESSION["finished_id"][$this->object->getId()]);
250 }
251
252 if (strlen($activepage))
253 {
254 $this->ctrl->setParameter($this, "qid", $activepage);
255 }
256 $this->ctrl->setParameter($this, "activecommand", "default");
257 $this->ctrl->redirect($this, "redirectQuestion");
258 }

References $_SESSION, checkAuth(), and preview().

Referenced by resume().

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

◆ viewUserResults()

ilSurveyExecutionGUI::viewUserResults ( )

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

859 {
860 global $ilToolbar;
861
862 if(!$this->object->hasViewOwnResults())
863 {
864 $this->backToRepository();
865 }
866
867 $this->checkAuth(false, true);
868
869 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
870 $button = ilLinkButton::getInstance();
871 $button->setCaption("btn_back");
872 $button->setUrl($this->ctrl->getLinkTarget($this, "runShowFinishedPage"));
873 $ilToolbar->addButtonInstance($button);
874
875 $survey_gui = new ilObjSurveyGUI();
876 $html = $survey_gui->getUserResultsTable($_SESSION["finished_id"][$this->object->getId()]);
877 $this->tpl->setContent($html);
878 }

References $_SESSION, backToRepository(), checkAuth(), and ilLinkButton\getInstance().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilSurveyExecutionGUI::$ctrl

Definition at line 40 of file class.ilSurveyExecutionGUI.php.

◆ $ilias

ilSurveyExecutionGUI::$ilias

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

Referenced by ilSurveyExecutionGUI().

◆ $lng

ilSurveyExecutionGUI::$lng

Definition at line 38 of file class.ilSurveyExecutionGUI.php.

Referenced by ilSurveyExecutionGUI().

◆ $object

ilSurveyExecutionGUI::$object

Definition at line 37 of file class.ilSurveyExecutionGUI.php.

◆ $preview

ilSurveyExecutionGUI::$preview

Definition at line 43 of file class.ilSurveyExecutionGUI.php.

◆ $tpl

ilSurveyExecutionGUI::$tpl

Definition at line 39 of file class.ilSurveyExecutionGUI.php.

Referenced by ilSurveyExecutionGUI(), and showFinishConfirmation().

◆ $tree

ilSurveyExecutionGUI::$tree

Definition at line 42 of file class.ilSurveyExecutionGUI.php.

Referenced by backToRepository(), and ilSurveyExecutionGUI().


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