ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSurveyExecutionGUI Class Reference

Survey execution graphical output. More...

+ Collaboration diagram for ilSurveyExecutionGUI:

Public Member Functions

 __construct ($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
 
 $tree
 
 $preview
 

Protected Member Functions

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

Protected Attributes

 $rbacsystem
 
 $user
 
 $help
 
 $toolbar
 
 $log
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyExecutionGUI::__construct (   $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 77 of file class.ilSurveyExecutionGUI.php.

78 {
79 global $DIC;
80
81 $this->rbacsystem = $DIC->rbac()->system();
82 $this->user = $DIC->user();
83 $this->help = $DIC["ilHelp"];
84 $this->toolbar = $DIC->toolbar();
85 $lng = $DIC->language();
86 $tpl = $DIC["tpl"];
87 $ilCtrl = $DIC->ctrl();
88 $tree = $DIC->repositoryTree();
89
90 $this->lng = $lng;
91 $this->tpl = $tpl;
92 $this->ctrl = $ilCtrl;
93 $this->object = $a_object;
94 $this->tree = $tree;
95
96 $this->external_rater_360 = false;
97 if ($this->object->get360Mode() &&
98 $_SESSION["anonymous_id"][$this->object->getId()] &&
100 $this->object->getRefId(),
101 $_SESSION["anonymous_id"][$this->object->getId()]
102 )) {
103 $this->external_rater_360 = true;
104 }
105
106 // stay in preview mode
107 $this->preview = (bool) $_REQUEST["prvw"];
108 $this->ctrl->saveParameter($this, "prvw");
109 $this->ctrl->saveParameter($this, "pgov");
110
111 $this->log = ilLoggerFactory::getLogger("svy");
112 }
user()
Definition: user.php:4
$_SESSION["AccountId"]
static getLogger($a_component_id)
Get component logger.
static validateExternalRaterCode($a_ref_id, $a_code)
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $_SESSION, $DIC, $ilCtrl, $lng, $tpl, $tree, ilLoggerFactory\getLogger(), preview(), user(), and ilObjSurvey\validateExternalRaterCode().

+ Here is the call graph for this function:

Member Function Documentation

◆ backToRepository()

ilSurveyExecutionGUI::backToRepository ( )

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

766 {
768
769 // #14971
770 if ($this->object->get360Mode()) {
771 $target_ref_id = $this->object->getRefId();
772 } else {
773 // #11534
774 $target_ref_id = $tree->getParentId($this->object->getRefId());
775 }
776
777 include_once "Services/Link/classes/class.ilLink.php";
778 ilUtil::redirect(ilLink::_getLink($target_ref_id));
779 }
static redirect($a_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 676 of file class.ilSurveyExecutionGUI.php.

677 {
678 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
679 }

◆ checkAuth()

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

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

147 {
150
151 if ($this->preview) {
152 if (!$rbacsystem->checkAccess("write", $this->object->ref_id)) {
153 // only with write access it is possible to preview the survey
154 include_once "Modules/Survey/exceptions/class.ilSurveyException.php";
155 throw new ilSurveyException($this->lng->txt("survey_cannot_preview_survey"));
156 }
157
158 return true;
159 }
160
161 if (!$this->external_rater_360 &&
162 !$rbacsystem->checkAccess("read", $this->object->ref_id)) {
163 // only with read access it is possible to run the test
164 include_once "Modules/Survey/exceptions/class.ilSurveyException.php";
165 throw new ilSurveyException($this->lng->txt("cannot_read_survey"));
166 }
167
168 $user_id = $ilUser->getId();
169
170 // check existing code
171 // see ilObjSurveyGUI::infoScreen()
172 $anonymous_id = $anonymous_code = null;
173 if ($this->object->getAnonymize() || !$this->object->isAccessibleWithoutCode()) {
174 $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
175 $anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
176 if (!$anonymous_id) {
177 ilUtil::sendFailure(sprintf($this->lng->txt("error_retrieving_anonymous_survey"), $anonymous_code, true));
178 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
179 }
180 }
181
182 // appraisee validation
183 $appr_id = 0;
184 if ($this->object->get360Mode()) {
185 $appr_id = $_REQUEST["appr_id"];
186 if (!$appr_id) {
187 $appr_id = $_SESSION["appr_id"][$this->object->getId()];
188 }
189 // check if appraisee is valid
190 if ($anonymous_id) {
191 $appraisees = $this->object->getAppraiseesToRate(0, $anonymous_id);
192 }
193 if (!$appraisees && $user_id != ANONYMOUS_USER_ID) {
194 $appraisees = $this->object->getAppraiseesToRate($user_id);
195 }
196 if (!in_array($appr_id, $appraisees)) {
197 ilUtil::sendFailure($this->lng->txt("survey_360_execution_invalid_appraisee"), true);
198 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
199 }
200 }
201 //Self evaluation mode
202 #23575 in self eval the appraisee is the current user.
203 if ($this->object->getMode() == ilObjSurvey::MODE_SELF_EVAL) {
204 $appr_id = $ilUser->getId();
205 }
206
207 $_SESSION["appr_id"][$this->object->getId()] = $appr_id;
208
209 if (!$a_ignore_status) {
210 $status = $this->object->isSurveyStarted($user_id, $anonymous_code, $appr_id);
211 // completed
212 if ($status === 1) {
213 ilUtil::sendFailure($this->lng->txt("already_completed_survey"), true);
214 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
215 }
216 // starting
217 elseif ($status === false) {
218 if ($a_may_start) {
219 $_SESSION["finished_id"][$this->object->getId()] =
220 $this->object->startSurvey($user_id, $anonymous_code, $appr_id);
221 } else {
222 ilUtil::sendFailure($this->lng->txt("survey_use_start_button"), true);
223 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
224 }
225 }
226 // resuming
227 else {
228 // nothing todo
229 }
230 }
231
232 // validate finished id
233 if ($this->object->getActiveID($user_id, $anonymous_code, $appr_id) !=
234 $_SESSION["finished_id"][$this->object->getId()]) {
235 ilUtil::sendFailure($this->lng->txt("cannot_read_survey"), true);
236 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
237 }
238 }
Survey exception class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ilUser
Definition: imgupload.php:18

References $_SESSION, $ilUser, $rbacsystem, $user, ilObjSurvey\MODE_SELF_EVAL, 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 897 of file class.ilSurveyExecutionGUI.php.

898 {
900
901 if (!$this->preview) {
902 $this->object->finishSurvey($_SESSION["finished_id"][$this->object->getId()]);
903
904 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
905 include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
906 ilLPStatusWrapper::_updateStatus($this->object->getId(), $ilUser->getId());
907 }
908
909 if ($this->object->getMailNotification()) {
910 $this->object->sendNotificationMail(
911 $ilUser->getId(),
912 $_SESSION["anonymous_id"][$this->object->getId()],
913 $_SESSION["appr_id"][$this->object->getId()]
914 );
915 }
916 }
917
918 /*
919 unset($_SESSION["anonymous_id"][$this->object->getId()]);
920 unset($_SESSION["appr_id"][$this->object->getId()]);
921 unset($_SESSION["finished_id"][$this->object->getId()]);
922 */
923
924 $this->ctrl->redirect($this, "runShowFinishedPage");
925 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.

References $_SESSION, $ilUser, $user, ilLPStatusWrapper\_updateStatus(), and preview().

+ Here is the call graph for this function:

◆ executeCommand()

ilSurveyExecutionGUI::executeCommand ( )

execute command

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

118 {
119 // record read event for lp
121 'svy',
122 $this->object->getRefId(),
123 $this->object->getId(),
124 $GLOBALS['DIC']->user()->getId()
125 );
126
127 $cmd = $this->ctrl->getCmd();
128 $next_class = $this->ctrl->getNextClass($this);
129
130 $cmd = $this->getCommand($cmd);
131
132 $this->log->debug("- cmd= " . $cmd);
133
134 if (strlen($cmd) == 0) {
135 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
136 $this->ctrl->redirect($this, "gotoPage");
137 }
138 switch ($next_class) {
139 default:
140 $ret = &$this->$cmd();
141 break;
142 }
143 return $ret;
144 }
$_GET["client_id"]
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
getCommand($cmd)
Retrieves the ilCtrl command.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
$ret
Definition: parser.php:6

References $_GET, $GLOBALS, $ret, ilChangeEvent\_recordReadEvent(), 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 788 of file class.ilSurveyExecutionGUI.php.

789 {
790 if (!$this->preview) {
791 $this->backToRepository();
792 } else {
793 // #12841
794 $this->ctrl->setParameterByClass("ilsurveyeditorgui", "pgov", $_REQUEST["pgov"]);
795 $this->ctrl->redirectByClass(array("ilobjsurveygui", "ilsurveyeditorgui"), "questions");
796 }
797 }

References 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 247 of file class.ilSurveyExecutionGUI.php.

248 {
249 return $cmd;
250 }

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 371 of file class.ilSurveyExecutionGUI.php.

372 {
373 $this->ctrl->setParameter($this, "activecommand", "gotoPage");
374 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
375 $this->ctrl->setParameter($this, "direction", "0");
376 $this->ctrl->redirect($this, "redirectQuestion");
377 }

References $_GET.

◆ mailUserResults()

ilSurveyExecutionGUI::mailUserResults ( )

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

855 {
857
858 if (!$this->object->hasMailConfirmation()) {
859 $this->backToRepository();
860 }
861
862 $this->checkAuth(false, true);
863
864 $recipient = $_POST["mail"];
865 if (!$recipient) {
866 $recipient = $ilUser->getEmail();
867 }
868 if (!ilUtil::is_email($recipient)) {
869 $this->ctrl->redirect($this, "runShowFinishedPage");
870 }
871
872 $survey_gui = new ilObjSurveyGUI();
873 $survey_gui->sendUserResultsMail(
874 $_SESSION["finished_id"][$this->object->getId()],
875 $recipient
876 );
877
878 ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
879 $this->ctrl->redirect($this, "runShowFinishedPage");
880 }
$_POST["username"]
Class ilObjSurveyGUI.
checkAuth($a_may_start=false, $a_ignore_status=false)
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.

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

+ Here is the call graph for this function:

◆ next()

ilSurveyExecutionGUI::next ( )

Navigates to the next pages.

@access private

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

354 {
355 $result = $this->saveUserInput("next");
356 $this->ctrl->setParameter($this, "activecommand", "next");
357 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
358 if (strlen($result)) {
359 $this->ctrl->setParameter($this, "direction", "0");
360 } else {
361 $this->ctrl->setParameter($this, "direction", "1");
362 }
363 $this->ctrl->redirect($this, "redirectQuestion");
364 }
$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 808 of file class.ilSurveyExecutionGUI.php.

809 {
810 $prevpage = $this->object->getNextPage($page[0]["question_id"], -1);
811 $this->tpl->setCurrentBlock($navigationblock . "_prev");
812 if ($prevpage === 0) {
813 $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_start"));
814 } else {
815 $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_previous"));
816 }
817 $this->tpl->parseCurrentBlock();
818 $nextpage = $this->object->getNextPage($page[0]["question_id"], 1);
819 $this->tpl->setCurrentBlock($navigationblock . "_next");
820 if ($nextpage === 1) {
821 $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_finish"));
822 } else {
823 $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_next"));
824 }
825 $this->tpl->parseCurrentBlock();
826 }

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 386 of file class.ilSurveyExecutionGUI.php.

387 {
389
390 $this->checkAuth();
391
392 $page = $this->object->getNextPage($activepage, $direction);
393 $constraint_true = 0;
394
395 // check for constraints
396 if (is_array($page[0]["constraints"]) && count($page[0]["constraints"])) {
397 $this->log->debug("Page constraints= ", $page[0]["constraints"]);
398
399 while (is_array($page) and ($constraint_true == 0) and (count($page[0]["constraints"]))) {
400 $constraint_true = ($page[0]['constraints'][0]['conjunction'] == 0) ? true : false;
401 foreach ($page[0]["constraints"] as $constraint) {
402 if (!$this->preview) {
403 $working_data = $this->object->loadWorkingData($constraint["question"], $_SESSION["finished_id"][$this->object->getId()]);
404 } else {
405 $working_data = $_SESSION["preview_data"][$this->object->getId()][$constraint["question"]];
406 }
407 if ($constraint['conjunction'] == 0) {
408 // and
409 $constraint_true = $constraint_true & $this->object->checkConstraint($constraint, $working_data);
410 } else {
411 // or
412 $constraint_true = $constraint_true | $this->object->checkConstraint($constraint, $working_data);
413 }
414 }
415 if ($constraint_true == 0) {
416 // #11047 - we are skipping the page, so we have to get rid of existing answers for that question(s)
417 foreach ($page as $page_question) {
418 $qid = $page_question["question_id"];
419
420 // see saveActiveQuestionData()
421 if (!$this->preview) {
422 $this->object->deleteWorkingData($qid, $_SESSION["finished_id"][$this->object->getId()]);
423 } else {
424 $_SESSION["preview_data"][$this->object->getId()][$qid] = null;
425 }
426 }
427
428 $page = $this->object->getNextPage($page[0]["question_id"], $direction);
429 }
430 }
431 }
432
433 $first_question = -1;
434 if ($page === 0) {
435 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
436 } elseif ($page === 1) {
437 $state = $this->object->getUserSurveyExecutionStatus();
438 if ($this->preview ||
439 !$state["runs"][$_SESSION["finished_id"][$this->object->getId()]]["finished"]) {
440 $this->showFinishConfirmation();
441 } else {
442 $this->runShowFinishedPage();
443 }
444 return;
445 } else {
446 $ilHelp = $this->help;
447 $ilHelp->setScreenIdComponent("svy");
448 $ilHelp->setScreenId("quest_presentation");
449
450 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
451 include_once "Services/Tracking/classes/class.ilLearningProgress.php";
452 ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(), $this->object->ref_id, "svy");
453 }
454
455 $required = false;
456 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_content.html", "Modules/Survey");
457
458 if ($this->object->get360Mode()) {
459 $appr_id = $_SESSION["appr_id"][$this->object->getId()];
460
461 include_once "Services/User/classes/class.ilUserUtil.php";
462 $this->tpl->setTitle($this->object->getTitle() . " (" .
463 $this->lng->txt("survey_360_appraisee") . ": " .
464 ilUserUtil::getNamePresentation($appr_id) . ")");
465 }
466
467 if (!($this->object->getAnonymize() && $this->object->isAccessibleWithoutCode() && ($ilUser->getId() == ANONYMOUS_USER_ID))) {
468 $this->tpl->setCurrentBlock("suspend_survey");
469
470 if (!$this->preview) {
471 $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("cancel_survey"));
472 $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "infoScreen"));
473 } else {
474 $this->ctrl->setParameterByClass("ilObjSurveyGUI", "pgov", $_REQUEST["pgov"]);
475 $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("survey_cancel_preview"));
476 $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(array("ilObjSurveyGUI", "ilSurveyEditorGUI"), "questions"));
477 }
478
479 $this->tpl->setVariable("ALT_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
480 $this->tpl->setVariable("TITLE_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
481 $this->tpl->parseCurrentBlock();
482 }
483 $this->outNavigationButtons("top", $page);
484
485
486 $this->tpl->setCurrentBlock("percentage");
487
488 $percentage = (int) (($page[0]["position"]) * 100);
489
490 include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
492 $pbar->setCurrent($percentage);
493 $this->tpl->setVariable("NEW_PBAR", $pbar->render());
494
495 $this->tpl->parseCurrentBlock();
496
497
498 if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"]) {
499 $this->tpl->setCurrentBlock("questionblock_title");
500 $this->tpl->setVariable("TEXT_QUESTIONBLOCK_TITLE", $page[0]["questionblock_title"]);
501 $this->tpl->parseCurrentBlock();
502 }
503 foreach ($page as $data) {
504 $this->tpl->setCurrentBlock("survey_content");
505 if ($data["heading"]) {
506 $this->tpl->setVariable("QUESTION_HEADING", $data["heading"]);
507 }
508 if ($first_question == -1) {
509 $first_question = $data["question_id"];
510 }
511 $question_gui = $this->object->getQuestionGUI($data["type_tag"], $data["question_id"]);
512 if (is_array($_SESSION["svy_errors"])) {
513 $working_data = &$question_gui->object->getWorkingDataFromUserInput($_SESSION["postdata"]);
514 } else {
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 $error_messages = $_SESSION["svy_errors"];
521 }
522 $show_questiontext = ($data["questionblock_show_questiontext"]) ? 1 : 0;
523 $question_output = $question_gui->getWorkingForm($working_data, $this->object->getShowQuestionTitles(), $show_questiontext, $error_messages[$data["question_id"]], $this->object->getSurveyId());
524 $this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
525 $this->ctrl->setParameter($this, "qid", $data["question_id"]);
526 $this->tpl->parse("survey_content");
527 if ($data["obligatory"]) {
528 $required = true;
529 }
530 }
531 if ($required) {
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 $this->object->setPage($_SESSION["finished_id"][$this->object->getId()], $page[0]['question_id']);
544 $this->object->setStartTime($_SESSION["finished_id"][$this->object->getId()], $first_question);
545 }
546 }
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
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, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
$error_messages
$data
Definition: bench.php:6

References $_SESSION, $data, $error_messages, $help, $ilUser, $state, $user, ilLearningProgress\_tracProgress(), 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 828 of file class.ilSurveyExecutionGUI.php.

829 {
830 $this->outSurveyPage();
831 }
outSurveyPage($activepage=null, $direction=null)
Output of the active survey question to the screen.

References outSurveyPage().

Referenced by __construct(), checkAuth(), confirmedFinish(), exitSurvey(), 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 332 of file class.ilSurveyExecutionGUI.php.

333 {
334 if ($a_save_input) {
335 // #16209
336 $has_error = $this->saveUserInput("previous");
337 }
338 $this->ctrl->setParameter($this, "activecommand", "previous");
339 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
340 if (strlen($has_error)) {
341 $this->ctrl->setParameter($this, "direction", "0");
342 } else {
343 $this->ctrl->setParameter($this, "direction", "-1");
344 }
345 $this->ctrl->redirect($this, "redirectQuestion");
346 }

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 320 of file class.ilSurveyExecutionGUI.php.

321 {
322 $this->previous(false);
323 }
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 298 of file class.ilSurveyExecutionGUI.php.

299 {
300 switch ($_GET["activecommand"]) {
301 case "next":
302 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
303 break;
304 case "previous":
305 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
306 break;
307 case "gotoPage":
308 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
309 break;
310 case "default":
311 $this->outSurveyPage($_GET["qid"]);
312 break;
313 default:
314 // don't save input, go to the first page
315 $this->outSurveyPage();
316 break;
317 }
318 }

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 259 of file class.ilSurveyExecutionGUI.php.

260 {
261 $this->start(true);
262 }
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 688 of file class.ilSurveyExecutionGUI.php.

689 {
690 $ilToolbar = $this->toolbar;
692
693 $has_button = false;
694
695 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
696
697 if (!$this->preview) {
698 if ($this->object->hasViewOwnResults()) {
699 $button = ilLinkButton::getInstance();
700 $button->setCaption("svy_view_own_results");
701 $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
702 $ilToolbar->addButtonInstance($button);
703
704 $has_button = true;
705 }
706
707 if ($this->object->hasMailConfirmation()) {
708 if ($has_button) {
709 $ilToolbar->addSeparator();
710 }
711
712 if ($ilUser->getId() == ANONYMOUS_USER_ID ||
713 !$ilUser->getEmail()) {
714 require_once "Services/Form/classes/class.ilTextInputGUI.php";
715 $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
716 $mail->setSize(25);
717 $ilToolbar->addInputItem($mail, true);
718 }
719
720 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
721
722 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
723 $button = ilSubmitButton::getInstance();
724 $button->setCaption("svy_mail_send_confirmation");
725 $button->setCommand("mailUserResults");
726 $ilToolbar->addButtonInstance($button);
727
728 $has_button = true;
729 }
730
731 // #6307
732 include_once "Modules/Survey/classes/class.ilObjSurveyAccess.php";
733 if (ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())) {
734 $button = ilLinkButton::getInstance();
735 $button->setCaption("svy_results");
736 $button->setUrl($this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "evaluation"));
737 $ilToolbar->addButtonInstance($button);
738
739 $has_button = true;
740 }
741 }
742
743 if (!$has_button &&
744 strlen($this->object->getOutro()) == 0) {
745 $this->exitSurvey();
746 } else {
747 if ($has_button) {
748 $ilToolbar->addSeparator();
749 }
750
751 $button = ilLinkButton::getInstance();
752 $button->setCaption("survey_execution_exit");
753 $button->setUrl($this->ctrl->getLinkTarget($this, "exitSurvey"));
754 $ilToolbar->addButtonInstance($button);
755
756 if (strlen($this->object->getOutro())) {
757 include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
758 $panel = ilPanelGUI::getInstance();
759 $panel->setBody($this->object->prepareTextareaOutput($this->object->getOutro()));
760 $this->tpl->setContent($panel->getHTML());
761 }
762 }
763 }
static getInstance()
Factory.
static _hasEvaluationAccess($a_obj_id, $user_id)
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, $toolbar, $user, ilObjSurveyAccess\_hasEvaluationAccess(), 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 645 of file class.ilSurveyExecutionGUI.php.

646 {
648
649 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
650 $question = &SurveyQuestion::_instanciateQuestion($data["question_id"]);
651 $error = $question->checkUserInput($_POST, $this->object->getSurveyId());
652 if (strlen($error) == 0) {
653 if (!$this->preview) {
654 // delete old answers
655 $this->object->deleteWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
656
657 $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()]);
658 } else {
659 $_SESSION["preview_data"][$this->object->getId()][$data["question_id"]] =
660 $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()], true);
661 }
662 return 0;
663 } else {
664 $_SESSION["svy_errors"][$question->getId()] = $error;
665 return 1;
666 }
667 }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.

References $_POST, $_SESSION, $data, $ilUser, $user, 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 553 of file class.ilSurveyExecutionGUI.php.

554 {
555 if (!$this->preview) {
556 $this->object->setEndTime($_SESSION["finished_id"][$this->object->getId()]);
557 }
558
559 // check users input when it is a metric question
560 unset($_SESSION["svy_errors"]);
561 $_SESSION["postdata"] = $_POST;
562 $page_error = 0;
563 $page = $this->object->getNextPage($_GET["qid"], 0);
564 foreach ($page as $data) {
565 $page_error += $this->saveActiveQuestionData($data);
566 }
567 if ($page_error && (strcmp($navigationDirection, "previous") != 0)) {
568 if ($page_error == 1) {
569 ilUtil::sendFailure($this->lng->txt("svy_page_error"), true);
570 } else {
571 ilUtil::sendFailure($this->lng->txt("svy_page_errors"), true);
572 }
573 } else {
574 $page_error = "";
575 unset($_SESSION["svy_errors"]);
576 }
577 return $page_error;
578 }
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 882 of file class.ilSurveyExecutionGUI.php.

883 {
885
886 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
887 $cgui = new ilConfirmationGUI();
888 $cgui->setHeaderText($this->lng->txt("survey_execution_sure_finish"));
889
890 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedFinish"));
891 $cgui->setCancel($this->lng->txt("cancel"), "previousNoSave");
892 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedFinish");
893
894 $tpl->setContent($cgui->getHTML());
895 }
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 271 of file class.ilSurveyExecutionGUI.php.

272 {
273 if ($this->preview) {
274 unset($_SESSION["preview_data"]);
275 }
276 unset($_SESSION["svy_errors"]);
277
278 $this->checkAuth(!$resume);
279
280 $activepage = "";
281 if ($resume) {
282 $activepage = $this->object->getLastActivePage($_SESSION["finished_id"][$this->object->getId()]);
283 }
284
285 if (strlen($activepage)) {
286 $this->ctrl->setParameter($this, "qid", $activepage);
287 }
288 $this->ctrl->setParameter($this, "activecommand", "default");
289 $this->ctrl->redirect($this, "redirectQuestion");
290 }

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 833 of file class.ilSurveyExecutionGUI.php.

834 {
835 $ilToolbar = $this->toolbar;
836
837 if (!$this->object->hasViewOwnResults()) {
838 $this->backToRepository();
839 }
840
841 $this->checkAuth(false, true);
842
843 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
844 $button = ilLinkButton::getInstance();
845 $button->setCaption("btn_back");
846 $button->setUrl($this->ctrl->getLinkTarget($this, "runShowFinishedPage"));
847 $ilToolbar->addButtonInstance($button);
848
849 $survey_gui = new ilObjSurveyGUI();
850 $html = $survey_gui->getUserResultsTable($_SESSION["finished_id"][$this->object->getId()]);
851 $this->tpl->setContent($html);
852 }
$html
Definition: example_001.php:87

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilSurveyExecutionGUI::$ctrl

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

◆ $help

ilSurveyExecutionGUI::$help
protected

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

Referenced by outSurveyPage().

◆ $lng

ilSurveyExecutionGUI::$lng

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

Referenced by __construct().

◆ $log

ilSurveyExecutionGUI::$log
protected

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

◆ $object

ilSurveyExecutionGUI::$object

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

◆ $preview

ilSurveyExecutionGUI::$preview

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

◆ $rbacsystem

ilSurveyExecutionGUI::$rbacsystem
protected

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

Referenced by checkAuth().

◆ $toolbar

ilSurveyExecutionGUI::$toolbar
protected

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

Referenced by runShowFinishedPage(), and viewUserResults().

◆ $tpl

ilSurveyExecutionGUI::$tpl

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

Referenced by __construct(), and showFinishConfirmation().

◆ $tree

ilSurveyExecutionGUI::$tree

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

Referenced by __construct(), and backToRepository().

◆ $user

ilSurveyExecutionGUI::$user
protected

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