ILIAS  release_8 Revision v8.24
ilSurveyExecutionGUI Class Reference

Survey execution graphical output. More...

+ Collaboration diagram for ilSurveyExecutionGUI:

Public Member Functions

 __construct (ilObjSurvey $a_object)
 
 executeCommand ()
 
 resume ()
 
 start (bool $resume=false)
 
 redirectQuestion ()
 Called when a user answered a page to perform a redirect after POST. More...
 
 previousNoSave ()
 
 previous (bool $a_save_input=true)
 
 next ()
 Navigates to the next page. More...
 
 gotoPage ()
 Go to a specific page without saving. More...
 
 outSurveyPage (int $activepage=0, int $direction=0)
 Output of the active survey question to the screen. More...
 
 saveUserInput (string $navigationDirection="next")
 Save the user's input. More...
 
 saveActiveQuestionData (array $data)
 Saves the users input of the active page. More...
 
 cancel ()
 
 runShowFinishedPage ()
 Show finish page. More...
 
 backToRepository ()
 
 exitSurvey ()
 Exits the survey after finishing it. More...
 
 outNavigationButtons (string $navigationblock, array $page, ilTemplate $stpl)
 
 preview ()
 
 viewUserResults ()
 
 mailUserResults ()
 
 showFinishConfirmation ()
 
 confirmedFinish ()
 

Protected Member Functions

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

Protected Attributes

array $raw_post_data
 
ILIAS Survey Execution ExecutionGUIRequest $request
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilHelpGUI $help
 
ilToolbarGUI $toolbar
 
ilObjSurvey $object
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilTree $tree
 
bool $preview
 
ilLogger $log
 
ILIAS Survey Execution RunManager $run_manager
 
ILIAS Survey Participants StatusManager $participant_manager
 
ILIAS Survey Access AccessManager $access_manager
 
int $requested_appr_id
 
Mode FeatureConfig $feature_config
 

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

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

Constructor & Destructor Documentation

◆ __construct()

ilSurveyExecutionGUI::__construct ( ilObjSurvey  $a_object)

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

55 {
56 global $DIC;
57
58 $this->rbacsystem = $DIC->rbac()->system();
59 $this->user = $DIC->user();
60 $this->help = $DIC["ilHelp"];
61 $this->toolbar = $DIC->toolbar();
62 $lng = $DIC->language();
63 $tpl = $DIC["tpl"];
64 $ilCtrl = $DIC->ctrl();
65 $tree = $DIC->repositoryTree();
66
67 $this->lng = $lng;
68 $this->tpl = $tpl;
69 $this->ctrl = $ilCtrl;
70 $this->object = $a_object;
71 $this->tree = $tree;
72 $this->user = $DIC->user();
73
74 $this->request = $DIC->survey()
75 ->internal()
76 ->gui()
77 ->execution()
78 ->request();
79
80 // stay in preview mode
81 $this->preview = (bool) $this->request->getPreview();
82 $this->requested_appr_id = $this->request->getAppraiseeId();
83 $this->ctrl->saveParameter($this, "prvw");
84 $this->ctrl->saveParameter($this, "appr_id");
85 $this->ctrl->saveParameter($this, "pgov");
86
87 $this->log = ilLoggerFactory::getLogger("svy");
88
89 $domain_service = $DIC->survey()->internal();
90 $appraisee_id = ($a_object->getMode() === ilObjSurvey::MODE_SELF_EVAL)
91 ? $this->user->getId()
93 $this->run_manager = $domain_service->domain()->execution()->run(
94 $a_object,
95 $this->user->getId(),
96 $appraisee_id
97 );
98 $this->participant_manager = $domain_service->domain()->participants()->status(
99 $a_object,
100 $this->user->getId()
101 );
102 $this->access_manager = $domain_service->domain()->access(
103 $a_object->getRefId(),
104 $this->user->getId()
105 );
106
107 $this->feature_config = $domain_service->domain()->modeFeatureConfig($a_object->getMode());
108
109
110 // @todo this is used to store answers in the session, but should
111 // be refactored somehow to avoid the use of the complete post body
112 $this->raw_post_data = $DIC->http()->request()->getParsedBody() ?? [];
113 }
static getLogger(string $a_component_id)
Get component logger.
ilGlobalTemplateInterface $tpl
global $DIC
Definition: feed.php:28

References $DIC, $lng, $requested_appr_id, $tpl, $tree, ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), ilObjSurvey\getMode(), ilObject\getRefId(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilObjSurvey\MODE_SELF_EVAL, preview(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ backToRepository()

ilSurveyExecutionGUI::backToRepository ( )

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

652 : void
653 {
655
656 // #14971
657 if ($this->object->getMode() === ilObjSurvey::MODE_360) {
658 $target_ref_id = $this->object->getRefId();
659 } else {
660 // #11534
661 $target_ref_id = $tree->getParentId($this->object->getRefId());
662 }
663
664 ilUtil::redirect(ilLink::_getLink($target_ref_id));
665 }
getParentId(int $a_node_id)
get parent id of given node
static redirect(string $a_script)

References ilLink\_getLink(), ilTree\getParentId(), ilObjSurvey\MODE_360, ILIAS\Repository\object(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ cancel()

ilSurveyExecutionGUI::cancel ( )

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

568 : void
569 {
570 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
571 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ checkAuth()

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

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

149 : void {
152
153 if ($this->preview) {
154 if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
155 // only with write access it is possible to preview the survey
156 throw new ilSurveyException($this->lng->txt("survey_cannot_preview_survey"));
157 }
158 return;
159 }
160
161
162 if (!$this->access_manager->canStartSurvey()) {
163 // only with read access it is possible to run the test
164 throw new ilSurveyException($this->lng->txt("cannot_read_survey"));
165 }
166
167 $user_id = $ilUser->getId();
168
169 // check existing code
170 // see ilObjSurveyGUI::infoScreen()
171 $anonymous_id = null;
172 $anonymous_code = "";
173 if ($this->access_manager->isCodeInputAllowed()) {
174 $anonymous_code = $this->run_manager->getCode();
175 $anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
176 if (!$anonymous_id) {
177 $this->tpl->setOnScreenMessage('failure', 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 $appraisees = [];
185 if ($this->feature_config->usesAppraisees()) {
186 $appr_id = $this->requested_appr_id;
187 //if (!$appr_id) {
188 // $appr_id = $_SESSION["appr_id"][$this->object->getId()];
189 //}
190 // check if appraisee is valid
191 if ($anonymous_id) {
192 $appraisees = $this->object->getAppraiseesToRate(0, $anonymous_id);
193 }
194 if (!$appraisees && $user_id !== ANONYMOUS_USER_ID) {
195 $appraisees = $this->object->getAppraiseesToRate($user_id);
196 }
197 if (!in_array($appr_id, $appraisees)) {
198 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("survey_360_execution_invalid_appraisee"), true);
199 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
200 }
201 }
202 //Self evaluation mode
203 #23575 in self eval the appraisee is the current user.
204 if ($this->object->getMode() === ilObjSurvey::MODE_SELF_EVAL) {
205 $appr_id = $ilUser->getId();
206 }
207
208 //$_SESSION["appr_id"][$this->object->getId()] = $appr_id;
209
210 if (!$a_ignore_status) {
211 // completed
212 if ($this->run_manager->hasFinished()) {
213 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("already_completed_survey"), true);
214 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
215 }
216 // starting
217 elseif (!$this->run_manager->hasStarted()) {
218 if ($a_may_start) {
219 //$_SESSION["finished_id"][$this->object->getId()] =
220 // $this->object->startSurvey($user_id, $anonymous_code, $appr_id);
221 $this->run_manager->start($appr_id);
222 } else {
223 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("survey_use_start_button"), true);
224 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
225 }
226 }
227 // resuming
228 else {
229 // nothing todo
230 }
231 }
232
233 // validate finished id
234 if ($this->object->getActiveID($user_id, $anonymous_code, $appr_id) !==
235 $this->run_manager->getCurrentRunId()) {
236 throw new ilSurveyException("Run ID mismatch");
237 }
238 }
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
$ilUser
Definition: imgupload.php:34

References ilRbacSystem\checkAccess(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmedFinish()

ilSurveyExecutionGUI::confirmedFinish ( )

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

771 : void
772 {
774
775 if (!$this->preview) {
776 $this->object->finishSurvey($this->getCurrentRunId(), $this->requested_appr_id);
777
778 if ($ilUser->getId() !== ANONYMOUS_USER_ID) {
779 ilLPStatusWrapper::_updateStatus($this->object->getId(), $ilUser->getId());
780 }
781
782 // send "single participant has finished" mail to tutors
783 if ($this->object->getMailNotification()) {
784 $this->object->sendNotificationMail(
785 $ilUser->getId(),
786 $this->run_manager->getCode(),
787 $this->requested_appr_id
788 );
789 }
790 }
791
792 $this->ctrl->redirect($this, "runShowFinishedPage");
793 }
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)

References $ilUser, ilLPStatusWrapper\_updateStatus(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ executeCommand()

ilSurveyExecutionGUI::executeCommand ( )

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

115 : string
116 {
117 // record read event for lp
119 'svy',
120 $this->object->getRefId(),
121 $this->object->getId(),
122 $GLOBALS['DIC']->user()->getId()
123 );
124
125 $cmd = $this->ctrl->getCmd();
126 $next_class = $this->ctrl->getNextClass($this);
127
128 $this->log->debug("- cmd= " . $cmd);
129
130 if ($cmd === null || $cmd === '') {
131 $this->ctrl->setParameter(
132 $this,
133 "qid",
134 $this->request->getQuestionId()
135 );
136 $this->ctrl->redirect($this, "gotoPage");
137 }
138 switch ($next_class) {
139 default:
140 $ret = $this->$cmd();
141 break;
142 }
143 return (string) $ret;
144 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)

References $GLOBALS, ilChangeEvent\_recordReadEvent(), ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ exitSurvey()

ilSurveyExecutionGUI::exitSurvey ( )

Exits the survey after finishing it.

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

670 : void
671 {
672 if (!$this->preview) {
673 $this->backToRepository();
674 } else {
675 // #12841
676 $this->ctrl->setParameterByClass("ilsurveyeditorgui", "pgov", $this->request->getTargetPosition());
677 $this->ctrl->redirectByClass(array("ilobjsurveygui", "ilsurveyeditorgui"), "questions");
678 }
679 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getCurrentRunId()

ilSurveyExecutionGUI::getCurrentRunId ( )
protected

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

503 : int
504 {
505 return $this->run_manager->getCurrentRunId();
506 }

◆ gotoPage()

ilSurveyExecutionGUI::gotoPage ( )

Go to a specific page without saving.

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

335 : void
336 {
337 $this->ctrl->setParameter($this, "activecommand", "gotoPage");
338 $this->ctrl->setParameter($this, "qid", $this->request->getQuestionId());
339 $this->ctrl->setParameter($this, "direction", "0");
340 $this->ctrl->redirect($this, "redirectQuestion");
341 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ mailUserResults()

ilSurveyExecutionGUI::mailUserResults ( )

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

729 : void
730 {
732
733 if (!$this->object->hasMailConfirmation()) {
734 $this->backToRepository();
735 }
736
737 $this->checkAuth(false, true);
738
739 $recipient = $this->request->getMail();
740 if (!$recipient) {
741 $recipient = $ilUser->getEmail();
742 }
743 if (!ilUtil::is_email($recipient)) {
744 $this->ctrl->redirect($this, "runShowFinishedPage");
745 }
746
747 $survey_gui = new ilObjSurveyGUI();
748 $survey_gui->sendUserResultsMail(
749 $this->getCurrentRunId(),
750 $recipient
751 );
752
753 $this->tpl->setOnScreenMessage('success', $this->lng->txt("mail_sent"), true);
754 $this->ctrl->redirect($this, "runShowFinishedPage");
755 }
Class ilObjSurveyGUI.
checkAuth(bool $a_may_start=false, bool $a_ignore_status=false)
static is_email(string $a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.

References $ilUser, ILIAS\Repository\ctrl(), ilUtil\is_email(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ next()

ilSurveyExecutionGUI::next ( )

Navigates to the next page.

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

319 : void
320 {
321 $result = $this->saveUserInput("next");
322 $this->ctrl->setParameter($this, "activecommand", "next");
323 $this->ctrl->setParameter($this, "qid", $this->request->getQuestionId());
324 if ($result > 0) {
325 $this->ctrl->setParameter($this, "direction", "0");
326 } else {
327 $this->ctrl->setParameter($this, "direction", "1");
328 }
329 $this->ctrl->redirect($this, "redirectQuestion");
330 }
saveUserInput(string $navigationDirection="next")
Save the user's input.

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ outNavigationButtons()

ilSurveyExecutionGUI::outNavigationButtons ( string  $navigationblock,
array  $page,
ilTemplate  $stpl 
)

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

685 : void {
686 $prevpage = $this->object->getNextPage($page[0]["question_id"], -1);
687 $stpl->setCurrentBlock($navigationblock . "_prev");
688 if (is_null($prevpage)) {
689 $stpl->setVariable("BTN_PREV", $this->lng->txt("survey_start"));
690 } else {
691 $stpl->setVariable("BTN_PREV", $this->lng->txt("survey_previous"));
692 }
693 $stpl->parseCurrentBlock();
694 $nextpage = $this->object->getNextPage($page[0]["question_id"], 1);
695 $stpl->setCurrentBlock($navigationblock . "_next");
696 if (is_null($nextpage)) {
697 $stpl->setVariable("BTN_NEXT", $this->lng->txt("survey_finish"));
698 } else {
699 $stpl->setVariable("BTN_NEXT", $this->lng->txt("survey_next"));
700 }
701 $stpl->parseCurrentBlock();
702 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ outSurveyPage()

ilSurveyExecutionGUI::outSurveyPage ( int  $activepage = 0,
int  $direction = 0 
)

Output of the active survey question to the screen.

Exceptions
ilCtrlException
ilSurveyException

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

351 : void {
353
354 $this->checkAuth();
355 $page = $this->object->getNextPage($activepage, $direction);
356 $constraint_true = 0;
357
358 // check for constraints
359 if (!is_null($page) && is_array($page[0]["constraints"]) && count($page[0]["constraints"])) {
360 $this->log->debug("Page constraints= ", $page[0]["constraints"]);
361
362 while (!is_null($page) and ($constraint_true == 0) and (count($page[0]["constraints"]))) {
363 $constraint_true = $page[0]['constraints'][0]['conjunction'] == 0;
364 foreach ($page[0]["constraints"] as $constraint) {
365 if (!$this->preview) {
366 $working_data = $this->object->loadWorkingData($constraint["question"], $this->getCurrentRunId());
367 } else {
368 $working_data = $this->run_manager->getPreviewData($constraint["question"]);
369 }
370 if ($constraint['conjunction'] == 0) {
371 // and
372 $constraint_true &= $this->object->checkConstraint($constraint, $working_data);
373 } else {
374 // or
375 $constraint_true |= $this->object->checkConstraint($constraint, $working_data);
376 }
377 }
378 if ($constraint_true == 0) {
379 // #11047 - we are skipping the page, so we have to get rid of existing answers for that question(s)
380 foreach ($page as $page_question) {
381 $qid = $page_question["question_id"];
382
383 // see saveActiveQuestionData()
384 if (!$this->preview) {
385 $this->object->deleteWorkingData($qid, $this->getCurrentRunId());
386 } else {
387 $this->run_manager->clearPreviewData($qid);
388 }
389 }
390
391 $page = $this->object->getNextPage($page[0]["question_id"], $direction);
392 }
393 }
394 }
395 $first_question = -1;
396 if (is_null($page) && $direction === -1) {
397 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
398 } elseif (is_null($page) && $direction === 1) {
399 $state = $this->object->getUserSurveyExecutionStatus();
400 if ($this->preview ||
401 !($state["runs"][$this->getCurrentRunId()]["finished"] ?? false)) {
402 $this->showFinishConfirmation();
403 } else {
404 $this->runShowFinishedPage();
405 }
406 return;
407 } else {
408 $ilHelp = $this->help;
409 $ilHelp->setScreenIdComponent("svy");
410 $ilHelp->setScreenId("quest_presentation");
411
412 if ($ilUser->getId() !== ANONYMOUS_USER_ID) {
413 ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(), $this->object->getRefId(), "svy");
414 }
415
416 $required = false;
417 //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_content.html", "Modules/Survey");
418 $stpl = new ilTemplate("tpl.il_svy_svy_content.html", true, true, "Modules/Survey");
419
420 // title / appraisee
421 if ($this->feature_config->usesAppraisees()) {
422 $appr_id = $this->requested_appr_id;
423
424 $this->tpl->setTitle($this->object->getTitle() . " (" .
425 $this->lng->txt("survey_360_appraisee") . ": " .
426 ilUserUtil::getNamePresentation($appr_id) . ")");
427 }
428
429 // top / bottom nav
430 if (!($this->object->getAnonymize() && $this->object->isAccessibleWithoutCode() && ($ilUser->getId() === ANONYMOUS_USER_ID))) {
431 $stpl->setCurrentBlock("suspend_survey");
432
433 if (!$this->preview) {
434 $stpl->setVariable("TEXT_SUSPEND", $this->lng->txt("cancel_survey"));
435 $stpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "infoScreen"));
436 } else {
437 $this->ctrl->setParameterByClass("ilObjSurveyGUI", "pgov", $this->request->getTargetPosition());
438 $stpl->setVariable("TEXT_SUSPEND", $this->lng->txt("survey_cancel_preview"));
439 $stpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(array("ilObjSurveyGUI", "ilSurveyEditorGUI"), "questions"));
440 }
441
442 $stpl->setVariable("ALT_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
443 $stpl->setVariable("TITLE_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
444 $stpl->parseCurrentBlock();
445 }
446 $this->outNavigationButtons("top", $page, $stpl);
447 $this->outNavigationButtons("bottom", $page, $stpl);
448
449 // progress
450 $stpl->setCurrentBlock("percentage");
451 $percentage = (int) (($page[0]["position"]) * 100);
453 $pbar->setCurrent($percentage);
454 $stpl->setVariable("NEW_PBAR", $pbar->render());
455 $stpl->parseCurrentBlock();
456
457 // questions
458 $working_data = [];
459 $errors = $this->run_manager->getErrors();
460 foreach ($page as $data) {
461 if ($first_question === -1) {
462 $first_question = $data["question_id"];
463 }
464 $question_gui = $this->object->getQuestionGUI($data["type_tag"], $data["question_id"]);
465
466 if (count($errors) > 0) {
467 $working_data[$data["question_id"]] = $question_gui->object->getWorkingDataFromUserInput(
468 $this->run_manager->getPostData()
469 );
470 } else {
471 if (!$this->preview) {
472 $working_data[$data["question_id"]] = $this->object->loadWorkingData(
473 $data["question_id"],
474 $this->run_manager->getCurrentRunId()
475 );
476 } else {
477 $working_data[$data["question_id"]] =
478 $this->run_manager->getPreviewData($data["question_id"]);
479 }
480 }
481 }
482
483 $page_renderer = new \ILIAS\Survey\Page\PageRenderer(
484 $this->object,
485 $page,
486 $working_data,
487 $errors
488 );
489
490 $stpl->setVariable("PAGE", $page_renderer->render());
491
492 $this->ctrl->setParameter($this, "qid", $first_question);
493 $stpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "redirectQuestion"));
494 $this->tpl->setContent($stpl->get());
495 }
496
497 if (!$this->preview) {
498 $this->object->setPage($this->getCurrentRunId(), $page[0]['question_id']);
499 $this->run_manager->setStartTime($first_question);
500 }
501 }
setScreenIdComponent(string $a_comp)
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
outNavigationButtons(string $navigationblock, array $page, ilTemplate $stpl)
runShowFinishedPage()
Show finish page.
special template class to simplify handling of ITX/PEAR
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
$errors
Definition: imgupload.php:65

◆ preview()

ilSurveyExecutionGUI::preview ( )

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

704 : void
705 {
706 $this->outSurveyPage();
707 }
outSurveyPage(int $activepage=0, int $direction=0)
Output of the active survey question to the screen.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ previous()

ilSurveyExecutionGUI::previous ( bool  $a_save_input = true)

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

300 : void {
301 $has_error = "";
302 if ($a_save_input) {
303 // #16209
304 $has_error = $this->saveUserInput("previous");
305 }
306 $this->ctrl->setParameter($this, "activecommand", "previous");
307 $this->ctrl->setParameter($this, "qid", $this->request->getQuestionId());
308 if ($has_error > 0) {
309 $this->ctrl->setParameter($this, "direction", "0");
310 } else {
311 $this->ctrl->setParameter($this, "direction", "-1");
312 }
313 $this->ctrl->redirect($this, "redirectQuestion");
314 }

◆ previousNoSave()

ilSurveyExecutionGUI::previousNoSave ( )

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

293 : void
294 {
295 $this->previous(false);
296 }
previous(bool $a_save_input=true)

◆ 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.

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

272 : void
273 {
274 switch ($this->request->getActiveCommand()) {
275 case "previous":
276 case "gotoPage":
277 case "next":
278 $this->outSurveyPage(
279 $this->request->getQuestionId(),
280 $this->request->getDirection()
281 );
282 break;
283 case "default":
284 $this->outSurveyPage($this->request->getQuestionId());
285 break;
286 default:
287 // don't save input, go to the first page
288 $this->outSurveyPage();
289 break;
290 }
291 }

◆ resume()

ilSurveyExecutionGUI::resume ( )

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

240 : void
241 {
242 $this->start(true);
243 }

◆ runShowFinishedPage()

ilSurveyExecutionGUI::runShowFinishedPage ( )

Show finish page.

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

576 : void
577 {
578 $ilToolbar = $this->toolbar;
580
581 $has_button = false;
582
583
584 if (!$this->preview) {
585 if ($this->object->hasViewOwnResults()) {
586 $button = ilLinkButton::getInstance();
587 $button->setCaption("svy_view_own_results");
588 $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
589 $ilToolbar->addButtonInstance($button);
590
591 $has_button = true;
592 }
593
594 if ($this->object->hasMailConfirmation()) {
595 if ($has_button) {
596 $ilToolbar->addSeparator();
597 }
598
599 if ($ilUser->getId() === ANONYMOUS_USER_ID ||
600 !$ilUser->getEmail()) {
601 $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
602 $mail->setSize(25);
603 $ilToolbar->addInputItem($mail, true);
604 }
605
606 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
607
608 $button = ilSubmitButton::getInstance();
609 $button->setCaption("svy_mail_send_confirmation");
610 $button->setCommand("mailUserResults");
611 $ilToolbar->addButtonInstance($button);
612
613 $has_button = true;
614 }
615
616 // #6307
617 if (ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())) {
618 $button = ilLinkButton::getInstance();
619 $button->setCaption("svy_results");
620 $button->setUrl($this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "evaluation"));
621 $ilToolbar->addButtonInstance($button);
622
623 $has_button = true;
624 }
625 }
626
627 if (!$has_button &&
628 $this->object->getOutro() === '') {
629 $this->exitSurvey();
630 } else {
631 if ($has_button) {
632 $ilToolbar->addSeparator();
633 }
634
635 $button = ilLinkButton::getInstance();
636 if ($this->object->getMode() === ilObjSurvey::MODE_360) {
637 $button->setCaption("survey_execution_exit_360");
638 } else {
639 $button->setCaption("survey_execution_exit");
640 }
641 $button->setUrl($this->ctrl->getLinkTarget($this, "exitSurvey"));
642 $ilToolbar->addButtonInstance($button);
643
644 if ($this->object->getOutro() !== '') {
646 $panel->setBody($this->object->prepareTextareaOutput($this->object->getOutro()));
647 $this->tpl->setContent($panel->getHTML());
648 }
649 }
650 }
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
static getInstance()
exitSurvey()
Exits the survey after finishing it.
This class represents a text property in a property form.
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198

References $ilUser, $panel, ilObjSurveyAccess\_hasEvaluationAccess(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), ilSubmitButton\getInstance(), ilPanelGUI\getInstance(), ILIAS\Repository\lng(), ilObjSurvey\MODE_360, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ saveActiveQuestionData()

ilSurveyExecutionGUI::saveActiveQuestionData ( array  $data)

Saves the users input of the active page.

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

543 : int
544 {
545 $question = SurveyQuestion::_instanciateQuestion($data["question_id"]);
546 $error = $question->checkUserInput($this->raw_post_data, $this->object->getSurveyId());
547 if (strlen($error) === 0) {
548 if (!$this->preview) {
549 // delete old answers
550 $this->object->deleteWorkingData($data["question_id"], $this->getCurrentRunId());
551
552 $question->saveUserInput($this->raw_post_data, $this->getCurrentRunId());
553 } else {
554 $this->run_manager->setPreviewData(
555 $data["question_id"],
556 $question->saveUserInput($this->raw_post_data, 0, true)
557 );
558 }
559 return 0;
560 } else {
561 $errors = $this->run_manager->getErrors();
562 $errors[$question->getId()] = $error;
563 $this->run_manager->setErrors($errors);
564 return 1;
565 }
566 }
static _instanciateQuestion(int $question_id)
Get question object.

References $data, $errors, SurveyQuestion\_instanciateQuestion(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ saveUserInput()

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

Save the user's input.

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

513 : int {
514 if (!$this->preview) {
515 $this->run_manager->setEndTime();
516 }
517
518 // check users input when it is a metric question
519 $this->run_manager->clearErrors();
520 $this->run_manager->setPostData($this->raw_post_data);
521
522 $page_error = 0;
523 $page = $this->object->getNextPage($this->request->getQuestionId(), 0);
524 foreach ($page as $data) {
525 $page_error += $this->saveActiveQuestionData($data);
526 }
527 if ($page_error && (strcmp($navigationDirection, "previous") !== 0)) {
528 if ($page_error === 1) {
529 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("svy_page_error"), true);
530 } else {
531 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("svy_page_errors"), true);
532 }
533 } else {
534 $page_error = 0;
535 $this->run_manager->clearErrors();
536 }
537 return $page_error;
538 }
saveActiveQuestionData(array $data)
Saves the users input of the active page.

◆ showFinishConfirmation()

ilSurveyExecutionGUI::showFinishConfirmation ( )

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

757 : void
758 {
760
761 $cgui = new ilConfirmationGUI();
762 $cgui->setHeaderText($this->lng->txt("survey_execution_sure_finish"));
763
764 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedFinish"));
765 $cgui->setCancel($this->lng->txt("cancel"), "previousNoSave");
766 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedFinish");
767
768 $tpl->setContent($cgui->getHTML());
769 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.

References $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setContent().

+ Here is the call graph for this function:

◆ start()

ilSurveyExecutionGUI::start ( bool  $resume = false)

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

245 : void
246 {
247 if ($this->preview) {
248 $this->run_manager->clearAllPreviewData();
249 }
250 $this->run_manager->clearErrors();
251
252 $this->checkAuth(!$resume);
253
254 $activepage = "";
255 if ($resume) {
256 $activepage = $this->object->getLastActivePage(
257 $this->getCurrentRunId()
258 );
259 }
260
261 if ((string) $activepage !== '') {
262 $this->ctrl->setParameter($this, "qid", (string) $activepage);
263 }
264 $this->ctrl->setParameter($this, "activecommand", "default");
265 $this->ctrl->redirect($this, "redirectQuestion");
266 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ viewUserResults()

ilSurveyExecutionGUI::viewUserResults ( )

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

709 : void
710 {
711 $ilToolbar = $this->toolbar;
712
713 if (!$this->object->hasViewOwnResults()) {
714 $this->backToRepository();
715 }
716
717 $this->checkAuth(false, true);
718
719 $button = ilLinkButton::getInstance();
720 $button->setCaption("btn_back");
721 $button->setUrl($this->ctrl->getLinkTarget($this, "runShowFinishedPage"));
722 $ilToolbar->addButtonInstance($button);
723
724 $survey_gui = new ilObjSurveyGUI();
725 $html = $survey_gui->getUserResultsTable($this->getCurrentRunId());
726 $this->tpl->setContent($html);
727 }

References ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

Field Documentation

◆ $access_manager

ILIAS Survey Access AccessManager ilSurveyExecutionGUI::$access_manager
protected

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

◆ $ctrl

ilCtrl ilSurveyExecutionGUI::$ctrl
protected

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

◆ $feature_config

Mode FeatureConfig ilSurveyExecutionGUI::$feature_config
protected

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

◆ $help

ilHelpGUI ilSurveyExecutionGUI::$help
protected

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

◆ $lng

ilLanguage ilSurveyExecutionGUI::$lng
protected

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

Referenced by __construct().

◆ $log

ilLogger ilSurveyExecutionGUI::$log
protected

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

◆ $object

ilObjSurvey ilSurveyExecutionGUI::$object
protected

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

◆ $participant_manager

ILIAS Survey Participants StatusManager ilSurveyExecutionGUI::$participant_manager
protected

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

◆ $preview

bool ilSurveyExecutionGUI::$preview
protected

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

◆ $raw_post_data

array ilSurveyExecutionGUI::$raw_post_data
protected

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

◆ $rbacsystem

ilRbacSystem ilSurveyExecutionGUI::$rbacsystem
protected

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

◆ $request

ILIAS Survey Execution ExecutionGUIRequest ilSurveyExecutionGUI::$request
protected

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

◆ $requested_appr_id

int ilSurveyExecutionGUI::$requested_appr_id
protected

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

Referenced by __construct().

◆ $run_manager

ILIAS Survey Execution RunManager ilSurveyExecutionGUI::$run_manager
protected

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

◆ $toolbar

ilToolbarGUI ilSurveyExecutionGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilSurveyExecutionGUI::$tpl
protected

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

Referenced by __construct().

◆ $tree

ilTree ilSurveyExecutionGUI::$tree
protected

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

Referenced by __construct().

◆ $user

ilObjUser ilSurveyExecutionGUI::$user
protected

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


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