32     protected \ILIAS\Survey\InternalGUIService 
$gui;
    37     protected \ILIAS\Survey\Execution\ExecutionGUIRequest 
$request;
    59         $this->rbacsystem = $DIC->rbac()->system();
    60         $this->
user = $DIC->user();
    61         $this->
help = $DIC[
"ilHelp"];
    62         $this->
toolbar = $DIC->toolbar();
    63         $lng = $DIC->language();
    65         $ilCtrl = $DIC->ctrl();
    66         $tree = $DIC->repositoryTree();
    70         $this->
ctrl = $ilCtrl;
    71         $this->
object = $a_object;
    73         $this->
user = $DIC->user();
    75         $this->request = $DIC->survey()
    80         $this->gui = $DIC->survey()
    85         $this->
preview = (bool) $this->request->getPreview();
    86         $this->requested_appr_id = $this->request->getAppraiseeId();
    87         $this->
ctrl->saveParameter($this, 
"prvw");
    88         $this->
ctrl->saveParameter($this, 
"appr_id");
    89         $this->
ctrl->saveParameter($this, 
"pgov");
    93         $domain_service = $DIC->survey()->internal();
    95             ? $this->
user->getId()
    97         $this->run_manager = $domain_service->domain()->execution()->run(
   102         $this->participant_manager = $domain_service->domain()->participants()->status(
   106         $this->access_manager = $domain_service->domain()->access(
   111         $this->feature_config = $domain_service->domain()->modeFeatureConfig($a_object->
getMode());
   116         $this->raw_post_data = $DIC->http()->request()->getParsedBody() ?? [];
   124             $this->
object->getRefId(),
   125             $this->
object->getId(),
   129         $cmd = $this->
ctrl->getCmd();
   130         $next_class = $this->
ctrl->getNextClass($this);
   132         $this->log->debug(
"- cmd= " . $cmd);
   134         if ($cmd === null || $cmd === 
'') {
   135             $this->
ctrl->setParameter(
   138                 $this->request->getQuestionId()
   140             $this->
ctrl->redirect($this, 
"gotoPage");
   142         switch ($next_class) {
   144                 $ret = $this->$cmd();
   147         return (
string) $ret;
   151         bool $a_may_start = 
false,
   152         bool $a_ignore_status = 
false   158             if (!$rbacsystem->
checkAccess(
"write", $this->object->getRefId())) {
   166         if (!$this->access_manager->canStartSurvey()) {
   175         $anonymous_id = null;
   176         $anonymous_code = 
"";
   177         if ($this->access_manager->isCodeInputAllowed()) {
   178             $anonymous_code = $this->run_manager->getCode();
   179             $anonymous_id = $this->
object->getAnonymousIdByCode($anonymous_code);
   180             if (!$anonymous_id) {
   181                 $this->tpl->setOnScreenMessage(
'failure', sprintf($this->
lng->txt(
"error_retrieving_anonymous_survey"), $anonymous_code, 
true));
   182                 $this->
ctrl->redirectByClass(
"ilobjsurveygui", 
"run");
   189         if ($this->feature_config->usesAppraisees()) {
   196                 $appraisees = $this->
object->getAppraiseesToRate(0, $anonymous_id);
   199                 $appraisees = $this->
object->getAppraiseesToRate($user_id);
   201             if (!in_array($appr_id, $appraisees)) {
   202                 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_360_execution_invalid_appraisee"), 
true);
   203                 $this->
ctrl->redirectByClass(
"ilobjsurveygui", 
"run");
   207         #23575 in self eval the appraisee is the current user.   209             $appr_id = $ilUser->getId();
   214         if (!$a_ignore_status) {
   216             if ($this->run_manager->hasFinished()) {
   217                 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"already_completed_survey"), 
true);
   218                 $this->
ctrl->redirectByClass(
"ilobjsurveygui", 
"run");
   221             elseif (!$this->run_manager->hasStarted()) {
   225                     $this->run_manager->start($appr_id);
   227                     $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_use_start_button"), 
true);
   228                     $this->
ctrl->redirectByClass(
"ilobjsurveygui", 
"run");
   238         if ($this->
object->getActiveID($user_id, $anonymous_code, $appr_id) !==
   239             $this->run_manager->getCurrentRunId()) {
   249     public function start(
bool $resume = 
false): void
   252             $this->run_manager->clearAllPreviewData();
   254         $this->run_manager->clearErrors();
   260             $activepage = $this->
object->getLastActivePage(
   265         if ((
string) $activepage !== 
'') {
   266             $this->
ctrl->setParameter($this, 
"qid", (
string) $activepage);
   268         $this->
ctrl->setParameter($this, 
"activecommand", 
"default");
   269         $this->
ctrl->redirect($this, 
"redirectQuestion");
   278         switch ($this->request->getActiveCommand()) {
   283                     $this->request->getQuestionId(),
   284                     $this->request->getDirection()
   303         bool $a_save_input = 
true   310         $this->
ctrl->setParameter($this, 
"activecommand", 
"previous");
   311         $this->
ctrl->setParameter($this, 
"qid", $this->request->getQuestionId());
   312         if ($has_error > 0) {
   313             $this->
ctrl->setParameter($this, 
"direction", 
"0");
   315             $this->
ctrl->setParameter($this, 
"direction", 
"-1");
   317         $this->
ctrl->redirect($this, 
"redirectQuestion");
   326         $this->
ctrl->setParameter($this, 
"activecommand", 
"next");
   327         $this->
ctrl->setParameter($this, 
"qid", $this->request->getQuestionId());
   329             $this->
ctrl->setParameter($this, 
"direction", 
"0");
   331             $this->
ctrl->setParameter($this, 
"direction", 
"1");
   333         $this->
ctrl->redirect($this, 
"redirectQuestion");
   341         $this->
ctrl->setParameter($this, 
"activecommand", 
"gotoPage");
   342         $this->
ctrl->setParameter($this, 
"qid", $this->request->getQuestionId());
   343         $this->
ctrl->setParameter($this, 
"direction", 
"0");
   344         $this->
ctrl->redirect($this, 
"redirectQuestion");
   359         $page = $this->
object->getNextPage($activepage, $direction);
   360         $constraint_true = 0;
   363         if (!is_null($page) && is_array($page[0][
"constraints"]) && count($page[0][
"constraints"])) {
   364             $this->log->debug(
"Page constraints= ", $page[0][
"constraints"]);
   366             while (!is_null($page) and ($constraint_true == 0) and (count($page[0][
"constraints"]))) {
   367                 $constraint_true = $page[0][
'constraints'][0][
'conjunction'] == 0;
   368                 foreach ($page[0][
"constraints"] as $constraint) {
   370                         $working_data = $this->
object->loadWorkingData($constraint[
"question"], $this->
getCurrentRunId());
   372                         $working_data = $this->run_manager->getPreviewData($constraint[
"question"]);
   374                     if ($constraint[
'conjunction'] == 0) {
   376                         $constraint_true &= $this->
object->checkConstraint($constraint, $working_data);
   379                         $constraint_true |= $this->
object->checkConstraint($constraint, $working_data);
   382                 if ($constraint_true == 0) {
   384                     foreach ($page as $page_question) {
   385                         $qid = $page_question[
"question_id"];
   391                             $this->run_manager->clearPreviewData($qid);
   395                     $page = $this->
object->getNextPage($page[0][
"question_id"], $direction);
   399         $first_question = -1;
   400         if (is_null($page) && $direction === -1) {
   401             $this->
ctrl->redirectByClass(
"ilobjsurveygui", 
"run");
   402         } elseif (is_null($page) && $direction === 1) {
   403             $state = $this->
object->getUserSurveyExecutionStatus();
   414             $ilHelp->setScreenId(
"quest_presentation");
   422             $stpl = 
new ilTemplate(
"tpl.il_svy_svy_content.html", 
true, 
true, 
"components/ILIAS/Survey");
   425             if ($this->feature_config->usesAppraisees()) {
   428                 $this->tpl->setTitle($this->
object->getTitle() . 
" (" .
   429                     $this->
lng->txt(
"survey_360_appraisee") . 
": " .
   434             if (!($this->
object->getAnonymize() && $this->
object->isAccessibleWithoutCode() && ($ilUser->getId() === 
ANONYMOUS_USER_ID))) {
   435                 $stpl->setCurrentBlock(
"suspend_survey");
   438                     $stpl->setVariable(
"TEXT_SUSPEND", $this->
lng->txt(
"cancel_survey"));
   439                     $stpl->setVariable(
"HREF_SUSPEND", $this->
ctrl->getLinkTargetByClass(
"ilObjSurveyGUI", 
"run"));
   441                     $this->
ctrl->setParameterByClass(
"ilObjSurveyGUI", 
"pgov", $this->request->getTargetPosition());
   442                     $stpl->setVariable(
"TEXT_SUSPEND", $this->
lng->txt(
"survey_cancel_preview"));
   443                     $stpl->setVariable(
"HREF_SUSPEND", $this->
ctrl->getLinkTargetByClass(array(
"ilObjSurveyGUI", 
"ilSurveyEditorGUI"), 
"questions"));
   446                 $stpl->setVariable(
"ALT_IMG_SUSPEND", $this->
lng->txt(
"cancel_survey"));
   447                 $stpl->setVariable(
"TITLE_IMG_SUSPEND", $this->
lng->txt(
"cancel_survey"));
   448                 $stpl->parseCurrentBlock();
   454             $stpl->setCurrentBlock(
"percentage");
   455             $percentage = (
int) (($page[0][
"position"]) * 100);
   457             $pbar->setCurrent($percentage);
   458             $stpl->setVariable(
"NEW_PBAR", $pbar->render());
   459             $stpl->parseCurrentBlock();
   463             $errors = $this->run_manager->getErrors();
   464             foreach ($page as 
$data) {
   465                 if ($first_question === -1) {
   466                     $first_question = $data[
"question_id"];
   468                 $question_gui = $this->
object->getQuestionGUI($data[
"type_tag"], $data[
"question_id"]);
   470                 if (count($errors) > 0) {
   471                     $working_data[$data[
"question_id"]] = $question_gui->object->getWorkingDataFromUserInput(
   472                         $this->run_manager->getPostData()
   476                         $working_data[$data[
"question_id"]] = $this->
object->loadWorkingData(
   477                             $data[
"question_id"],
   478                             $this->run_manager->getCurrentRunId()
   481                         $working_data[$data[
"question_id"]] =
   482                             $this->run_manager->getPreviewData($data[
"question_id"]);
   487             $page_renderer = new \ILIAS\Survey\Page\PageRenderer(
   494             $stpl->setVariable(
"PAGE", $page_renderer->render());
   496             $this->
ctrl->setParameter($this, 
"qid", $first_question);
   497             $stpl->setVariable(
"FORM_ACTION", $this->
ctrl->getFormAction($this, 
"redirectQuestion"));
   498             $this->tpl->setContent($stpl->get());
   502             $this->
object->setPage($this->
getCurrentRunId(), $page[0][
'question_id']);
   503             $this->run_manager->setStartTime($first_question);
   509         return $this->run_manager->getCurrentRunId();
   516         string $navigationDirection = 
"next"   519             $this->run_manager->setEndTime();
   523         $this->run_manager->clearErrors();
   524         $this->run_manager->setPostData($this->raw_post_data);
   527         $page = $this->
object->getNextPage($this->request->getQuestionId(), 0);
   528         foreach ($page as 
$data) {
   531         if ($page_error && (strcmp($navigationDirection, 
"previous") !== 0)) {
   532             if ($page_error === 1) {
   533                 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"svy_page_error"), 
true);
   535                 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"svy_page_errors"), 
true);
   539             $this->run_manager->clearErrors();
   550         $error = $question->checkUserInput($this->raw_post_data, $this->
object->getSurveyId());
   551         if (strlen($error) === 0) {
   554                 $this->
object->deleteWorkingData($data[
"question_id"], $this->
getCurrentRunId());
   556                 $question->saveUserInput($this->raw_post_data, $this->
getCurrentRunId());
   558                 $this->run_manager->setPreviewData(
   559                     $data[
"question_id"],
   560                     $question->saveUserInput($this->raw_post_data, 0, 
true)
   565             $errors = $this->run_manager->getErrors();
   566             $errors[$question->getId()] = $error;
   567             $this->run_manager->setErrors($errors);
   574         $this->
ctrl->redirectByClass(
"ilobjsurveygui", 
"run");
   589             if ($this->
object->hasViewOwnResults()) {
   591                     $this->
lng->txt(
"svy_view_own_results"),
   592                     $this->
ctrl->getLinkTarget($this, 
"viewUserResults")
   598             if ($this->
object->hasMailConfirmation()) {
   600                     $ilToolbar->addSeparator();
   604                     !$ilUser->getEmail()) {
   607                     $ilToolbar->addInputItem($mail, 
true);
   610                 $ilToolbar->setFormAction($this->
ctrl->getFormAction($this, 
"mailUserResults"));
   613                     $this->
lng->txt(
"svy_mail_send_confirmation"),
   615                 )->submit()->toToolbar();
   623                     $this->
lng->txt(
"svy_results"),
   624                     $this->
ctrl->getLinkTargetByClass(
"ilObjSurveyGUI", 
"evaluation")
   632             $this->
object->getOutro() === 
'') {
   636                 $ilToolbar->addSeparator();
   640                 $txt = $this->
lng->txt(
"survey_execution_exit_360");
   642                 $txt = $this->
lng->txt(
"survey_execution_exit");
   646                 $this->
ctrl->getLinkTarget($this, 
"exitSurvey")
   649             if ($this->
object->getOutro() !== 
'') {
   650                 $f = $this->gui->ui()->factory();
   651                 $r = $this->gui->ui()->renderer();
   652                 $p = 
$f->panel()->standard(
   654                     $f->legacy($this->object->prepareTextareaOutput($this->object->getOutro()))
   657                 $this->tpl->setContent(
$r->render($p));
   668             $target_ref_id = $this->
object->getRefId();
   686             $this->
ctrl->setParameterByClass(
"ilsurveyeditorgui", 
"pgov", $this->request->getTargetPosition());
   687             $this->
ctrl->redirectByClass(array(
"ilobjsurveygui", 
"ilsurveyeditorgui"), 
"questions");
   692         string $navigationblock,
   696         $prevpage = $this->
object->getNextPage($page[0][
"question_id"], -1);
   698         if (is_null($prevpage)) {
   701             $stpl->
setVariable(
"BTN_PREV", $this->
lng->txt(
"survey_previous"));
   704         $nextpage = $this->
object->getNextPage($page[0][
"question_id"], 1);
   706         if (is_null($nextpage)) {
   723         if (!$this->
object->hasViewOwnResults()) {
   730             $this->
lng->txt(
"btn_back"),
   731             $this->
ctrl->getLinkTarget($this, 
"runShowFinishedPage")
   736         $this->tpl->setContent($html);
   743         if (!$this->
object->hasMailConfirmation()) {
   749         $recipient = $this->request->getMail();
   751             $recipient = $ilUser->getEmail();
   754             $this->
ctrl->redirect($this, 
"runShowFinishedPage");
   758         $survey_gui->sendUserResultsMail(
   763         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"mail_sent"), 
true);
   764         $this->
ctrl->redirect($this, 
"runShowFinishedPage");
   772         $cgui->setHeaderText($this->
lng->txt(
"survey_execution_sure_finish"));
   774         $cgui->setFormAction($this->
ctrl->getFormAction($this, 
"confirmedFinish"));
   775         $cgui->setCancel($this->
lng->txt(
"cancel"), 
"previousNoSave");
   776         $cgui->setConfirm($this->
lng->txt(
"confirm"), 
"confirmedFinish");
   786             $this->
object->finishSurvey($this->
getCurrentRunId(), $this->requested_appr_id);
   793             if ($this->
object->getMailNotification()) {
   794                 $this->
object->sendNotificationMail(
   796                     $this->run_manager->getCode(),
   802         $this->
ctrl->redirect($this, 
"runShowFinishedPage");
 
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
Mode FeatureConfig $feature_config
 
ILIAS Survey Participants StatusManager $participant_manager
 
static getLogger(string $a_component_id)
Get component logger. 
 
outSurveyPage(int $activepage=0, int $direction=0)
Output of the active survey question to the screen. 
 
static is_email(string $a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid. 
 
exitSurvey()
Exits the survey after finishing it. 
 
outNavigationButtons(string $navigationblock, array $page, ilTemplate $stpl)
 
redirectQuestion()
Called when a user answered a page to perform a redirect after POST. 
 
saveActiveQuestionData(array $data)
Saves the users input of the active page. 
 
ilGlobalTemplateInterface $tpl
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
 
ilObjSurveyGUI: ilSurveyEvaluationGUI, ilSurveyExecutionGUI  ilObjSurveyGUI: ilObjectMetaDataGUI, ilPermissionGUI  ilObjSurveyGUI: ilInfoScreenGUI, ilObjectCopyGUI  ilObjSurveyGUI: ilSurveySkillDeterminationGUI  ilObjSurveyGUI: ilCommonActionDispatcherGUI, ilSurveySkillGUI  ilObjSurveyGUI: ilSurveyEditorGUI, ilSurveyConstraintsGUI  ilObjSurveyGUI: ilSurveyParticipantsGUI, ilLearningProgressGUI  ilObjSurveyGUI: ilExportGUI, ilLTIProviderObjectSettingGUI  ilObjSurveyGUI: ILIAS 
 
__construct(ilObjSurvey $a_object)
 
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 ...
 
next()
Navigates to the next page. 
 
setVariable($variable, $value='')
Sets a variable value. 
 
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: 
 
ILIAS Survey Execution RunManager $run_manager
 
setContent(string $a_html)
Sets content for standard template. 
 
checkAuth(bool $a_may_start=false, bool $a_ignore_status=false)
 
gotoPage()
Go to a specific page without saving. 
 
setScreenIdComponent(string $a_comp)
 
ILIAS Survey Access AccessManager $access_manager
 
Survey execution graphical output. 
 
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)
 
runShowFinishedPage()
Show finish page. 
 
ILIAS Survey Execution ExecutionGUIRequest $request
 
getParentId(int $a_node_id)
get parent id of given node 
 
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
 
static redirect(string $a_script)
 
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
ILIAS Survey InternalGUIService $gui
 
previous(bool $a_save_input=true)
 
saveUserInput(string $navigationDirection="next")
Save the user's input. 
 
static _instanciateQuestion(int $question_id)
Get question object. 
 
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
 
start(bool $resume=false)