ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 previous ()
 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 ()
 

Data Fields

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

Protected Member Functions

 checkAuth ($a_may_start=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 712 of file class.ilSurveyExecutionGUI.php.

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

Referenced by exitSurvey(), and runShowFinishedPage().

713  {
714  global $tree;
715 
716  // #14971
717  if($this->object->get360Mode())
718  {
719  $target_ref_id = $this->object->getRefId();
720  }
721  else
722  {
723  // #11534
724  $target_ref_id = $tree->getParentId($this->object->getRefId());
725  }
726 
727  include_once "Services/Link/classes/class.ilLink.php";
728  ilUtil::redirect(ilLink::_getLink($target_ref_id));
729  }
static redirect($a_script)
http redirect to other script
+ 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

private

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

686  {
687  $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
688  }

◆ checkAuth()

ilSurveyExecutionGUI::checkAuth (   $a_may_start = false)
protected

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

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

Referenced by outSurveyPage(), and start().

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  $status = $this->object->isSurveyStarted($user_id, $anonymous_code, $appr_id);
167  // completed
168  if($status === 1)
169  {
170  ilUtil::sendFailure($this->lng->txt("already_completed_survey"), true);
171  $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
172  }
173  // starting
174  else if ($status === false)
175  {
176  if($a_may_start)
177  {
178  $_SESSION["finished_id"][$this->object->getId()] =
179  $this->object->startSurvey($user_id, $anonymous_code, $appr_id);
180  }
181  else
182  {
183  ilUtil::sendFailure($this->lng->txt("survey_use_start_button"), true);
184  $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
185  }
186  }
187  // resuming
188  else
189  {
190  // nothing todo
191  }
192 
193  // validate finished id
194  if($this->object->getActiveID($user_id, $anonymous_code, $appr_id) !=
195  $_SESSION["finished_id"][$this->object->getId()])
196  {
197  ilUtil::sendFailure($this->lng->txt("cannot_read_survey"), true);
198  $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
199  }
200  }
< 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) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& ilSurveyExecutionGUI::executeCommand ( )

execute command

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

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

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  }
getCommand($cmd)
Retrieves the ilCtrl command.
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ exitSurvey()

ilSurveyExecutionGUI::exitSurvey ( )

Exits the survey after finishing it.

Exits the survey after finishing it

public

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

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

739  {
740  if(!$this->preview)
741  {
742  $this->backToRepository();
743  }
744  else
745  {
746  // #12841
747  $this->ctrl->setParameterByClass("ilsurveyeditorgui", "pgov", $_REQUEST["pgov"]);
748  $this->ctrl->redirectByClass(array("ilobjsurveygui", "ilsurveyeditorgui"), "questions");
749  }
750  }
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ getCommand()

ilSurveyExecutionGUI::getCommand (   $cmd)

Retrieves the ilCtrl command.

Retrieves the ilCtrl command

public

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

References $cmd.

Referenced by executeCommand().

210  {
211  return $cmd;
212  }
$cmd
Definition: sahs_server.php:35
+ Here is the caller graph for this function:

◆ gotoPage()

ilSurveyExecutionGUI::gotoPage ( )

Go to a specific page without saving.

private

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

References $_GET.

337  {
338  $this->ctrl->setParameter($this, "activecommand", "gotoPage");
339  $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
340  $this->ctrl->setParameter($this, "direction", "0");
341  $this->ctrl->redirect($this, "redirectQuestion");
342  }
$_GET["client_id"]

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

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

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

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  }
< 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']
static validateExternalRaterCode($a_ref_id, $a_code)
global $ilCtrl
Definition: ilias.php:18
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
+ Here is the call graph for this function:

◆ next()

ilSurveyExecutionGUI::next ( )

Navigates to the next pages.

private

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

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

316  {
317  $result = $this->saveUserInput("next");
318  $this->ctrl->setParameter($this, "activecommand", "next");
319  $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
320  if (strlen($result))
321  {
322  $this->ctrl->setParameter($this, "direction", "0");
323  }
324  else
325  {
326  $this->ctrl->setParameter($this, "direction", "1");
327  }
328  $this->ctrl->redirect($this, "redirectQuestion");
329  }
$result
$_GET["client_id"]
saveUserInput($navigationDirection="next")
Save the user&#39;s input.
+ 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.

public

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

Referenced by outSurveyPage().

762  {
763  $prevpage = $this->object->getNextPage($page[0]["question_id"], -1);
764  $this->tpl->setCurrentBlock($navigationblock . "_prev");
765  if ($prevpage === 0)
766  {
767  $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_start"));
768  }
769  else
770  {
771  $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_previous"));
772  }
773  $this->tpl->parseCurrentBlock();
774  $nextpage = $this->object->getNextPage($page[0]["question_id"], 1);
775  $this->tpl->setCurrentBlock($navigationblock . "_next");
776  if ($nextpage === 1)
777  {
778  $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_finish"));
779  }
780  else
781  {
782  $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_next"));
783  }
784  $this->tpl->parseCurrentBlock();
785  }
+ 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

private

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

References $_REQUEST, $_SESSION, $data, $error_messages, $ilUser, checkAuth(), ilUtil\getImagePath(), ilUserUtil\getNamePresentation(), outNavigationButtons(), preview(), and runShowFinishedPage().

Referenced by preview(), and redirectQuestion().

352  {
353  global $ilUser;
354 
355  $this->checkAuth();
356 
357  $page = $this->object->getNextPage($activepage, $direction);
358  $constraint_true = 0;
359 
360  // check for constraints
361  if (count($page[0]["constraints"]))
362  {
363  while (is_array($page) and ($constraint_true == 0) and (count($page[0]["constraints"])))
364  {
365  $constraint_true = ($page[0]['constraints'][0]['conjunction'] == 0) ? true : false;
366  foreach ($page[0]["constraints"] as $constraint)
367  {
368  if(!$this->preview)
369  {
370  $working_data = $this->object->loadWorkingData($constraint["question"], $_SESSION["finished_id"][$this->object->getId()]);
371  }
372  else
373  {
374  $working_data = $_SESSION["preview_data"][$this->object->getId()][$constraint["question"]];
375  }
376  if ($constraint['conjunction'] == 0)
377  {
378  // and
379  $constraint_true = $constraint_true & $this->object->checkConstraint($constraint, $working_data);
380  }
381  else
382  {
383  // or
384  $constraint_true = $constraint_true | $this->object->checkConstraint($constraint, $working_data);
385  }
386  }
387  if ($constraint_true == 0)
388  {
389  // #11047 - we are skipping the page, so we have to get rid of existing answers for that question(s)
390  foreach($page as $page_question)
391  {
392  $qid = $page_question["question_id"];
393 
394  // see saveActiveQuestionData()
395  if(!$this->preview)
396  {
397  $this->object->deleteWorkingData($qid, $_SESSION["finished_id"][$this->object->getId()]);
398  }
399  else
400  {
401  $_SESSION["preview_data"][$this->object->getId()][$qid] = null;
402  }
403  }
404 
405  $page = $this->object->getNextPage($page[0]["question_id"], $direction);
406  }
407  }
408  }
409 
410  $first_question = -1;
411  if ($page === 0)
412  {
413  $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
414  }
415  else if ($page === 1)
416  {
417  $this->object->finishSurvey($_SESSION["finished_id"][$this->object->getId()]);
418 
419  if ($this->object->getMailNotification())
420  {
421  $this->object->sendNotificationMail($ilUser->getId(),
422  $_SESSION["anonymous_id"][$this->object->getId()],
423  $_SESSION["appr_id"][$this->object->getId()]);
424  }
425 
426  /*
427  unset($_SESSION["anonymous_id"][$this->object->getId()]);
428  unset($_SESSION["appr_id"][$this->object->getId()]);
429  unset($_SESSION["finished_id"][$this->object->getId()]);
430  */
431 
432  $this->runShowFinishedPage();
433  return;
434  }
435  else
436  {
437  global $ilHelp;
438  $ilHelp->setScreenIdComponent("svy");
439  $ilHelp->setScreenId("quest_presentation");
440 
441  $required = false;
442  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_content.html", "Modules/Survey");
443 
444  if($this->object->get360Mode())
445  {
446  $appr_id = $_SESSION["appr_id"][$this->object->getId()];
447 
448  include_once "Services/User/classes/class.ilUserUtil.php";
449  $this->tpl->setTitle($this->object->getTitle()." (".
450  $this->lng->txt("survey_360_appraisee").": ".
451  ilUserUtil::getNamePresentation($appr_id).")");
452  }
453 
454  if (!($this->object->getAnonymize() && $this->object->isAccessibleWithoutCode() && ($ilUser->getId() == ANONYMOUS_USER_ID)))
455  {
456  $this->tpl->setCurrentBlock("suspend_survey");
457 
458  if(!$this->preview)
459  {
460  $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("cancel_survey"));
461  $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "infoScreen"));
462  $this->tpl->setVariable("HREF_IMG_SUSPEND", $this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "infoScreen"));
463  }
464  else
465  {
466  $this->ctrl->setParameterByClass("ilObjSurveyGUI", "pgov", $_REQUEST["pgov"]);
467  $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("survey_cancel_preview"));
468  $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(array("ilObjSurveyGUI", "ilSurveyEditorGUI"), "questions"));
469  $this->tpl->setVariable("HREF_IMG_SUSPEND", $this->ctrl->getLinkTargetByClass(array("ilObjSurveyGUI", "ilSurveyEditorGUI"), "questions"));
470  }
471 
472  $this->tpl->setVariable("ALT_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
473  $this->tpl->setVariable("TITLE_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
474  $this->tpl->setVariable("IMG_SUSPEND", ilUtil::getImagePath("cancel.png"));
475  $this->tpl->parseCurrentBlock();
476  }
477  $this->outNavigationButtons("top", $page);
478  $this->tpl->setCurrentBlock("percentage");
479  $percentage = (int)(($page[0]["position"])*100);
480  $this->tpl->setVariable("PERCENT_BAR_START", ilUtil::getImagePath("bar_start.png"));
481  $this->tpl->setVariable("PERCENT_BAR_FILLED", ilUtil::getImagePath("bar_filled.png"));
482  $this->tpl->setVariable("PERCENT_BAR_EMPTY", ilUtil::getImagePath("bar_empty.png"));
483  $this->tpl->setVariable("PERCENT_BAR_END", ilUtil::getImagePath("bar_end.png"));
484  $this->tpl->setVariable("PERCENTAGE_ALT", $this->lng->txt("percentage"));
485  $this->tpl->setVariable("PERCENTAGE_VALUE", $percentage);
486  $this->tpl->setVariable("PERCENTAGE_UNFINISHED", 100-$percentage);
487  $this->tpl->parseCurrentBlock();
488  if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"])
489  {
490  $this->tpl->setCurrentBlock("questionblock_title");
491  $this->tpl->setVariable("TEXT_QUESTIONBLOCK_TITLE", $page[0]["questionblock_title"]);
492  $this->tpl->parseCurrentBlock();
493  }
494  foreach ($page as $data)
495  {
496  $this->tpl->setCurrentBlock("survey_content");
497  if ($data["heading"])
498  {
499  $this->tpl->setVariable("QUESTION_HEADING", $data["heading"]);
500  }
501  if ($first_question == -1) $first_question = $data["question_id"];
502  $question_gui = $this->object->getQuestionGUI($data["type_tag"], $data["question_id"]);
503  if (is_array($_SESSION["svy_errors"]))
504  {
505  $working_data =& $question_gui->object->getWorkingDataFromUserInput($_SESSION["postdata"]);
506  }
507  else
508  {
509  $working_data = $this->object->loadWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
510  }
511  $question_gui->object->setObligatory($data["obligatory"]);
512  $error_messages = array();
513  if (is_array($_SESSION["svy_errors"]))
514  {
515  $error_messages = $_SESSION["svy_errors"];
516  }
517  $show_questiontext = ($data["questionblock_show_questiontext"]) ? 1 : 0;
518  $question_output = $question_gui->getWorkingForm($working_data, $this->object->getShowQuestionTitles(), $show_questiontext, $error_messages[$data["question_id"]], $this->object->getSurveyId());
519  $this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
520  $this->ctrl->setParameter($this, "qid", $data["question_id"]);
521  $this->tpl->parse("survey_content");
522  if ($data["obligatory"]) $required = true;
523  }
524  if ($required)
525  {
526  $this->tpl->setCurrentBlock("required");
527  $this->tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
528  $this->tpl->parseCurrentBlock();
529  }
530 
531  $this->outNavigationButtons("bottom", $page);
532 
533  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "redirectQuestion"));
534  }
535 
536  if(!$this->preview)
537  {
538  $this->object->setPage($_SESSION["finished_id"][$this->object->getId()], $page[0]['question_id']);
539  $this->object->setStartTime($_SESSION["finished_id"][$this->object->getId()], $first_question);
540  }
541  }
< 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']
outNavigationButtons($navigationblock="top", $page)
Creates the navigation buttons for a survey.
$error_messages
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:
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
runShowFinishedPage()
Creates the finished page for a running survey.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preview()

ilSurveyExecutionGUI::preview ( )

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

References outSurveyPage().

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

788  {
789  $this->outSurveyPage();
790  }
outSurveyPage($activepage=NULL, $direction=NULL)
Output of the active survey question to the screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ previous()

ilSurveyExecutionGUI::previous ( )

Navigates to the previous pages.

Navigates to the previous pages

private

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

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

295  {
296  $result = $this->saveUserInput("previous");
297  $this->ctrl->setParameter($this, "activecommand", "previous");
298  $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
299  if (strlen($result))
300  {
301  $this->ctrl->setParameter($this, "direction", "0");
302  }
303  else
304  {
305  $this->ctrl->setParameter($this, "direction", "-1");
306  }
307  $this->ctrl->redirect($this, "redirectQuestion");
308  }
$result
$_GET["client_id"]
saveUserInput($navigationDirection="next")
Save the user&#39;s input.
+ 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.

public

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

References $_GET, and outSurveyPage().

264  {
265  switch ($_GET["activecommand"])
266  {
267  case "next":
268  $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
269  break;
270  case "previous":
271  $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
272  break;
273  case "gotoPage":
274  $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
275  break;
276  case "default":
277  $this->outSurveyPage($_GET["qid"]);
278  break;
279  default:
280  // don't save input, go to the first page
281  $this->outSurveyPage();
282  break;
283  }
284  }
$_GET["client_id"]
outSurveyPage($activepage=NULL, $direction=NULL)
Output of the active survey question to the screen.
+ Here is the call graph for this function:

◆ resume()

ilSurveyExecutionGUI::resume ( )

Resumes the survey.

Resumes the survey

private

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

References start().

222  {
223  $this->start(true);
224  }
start($resume=false)
Starts the survey.
+ 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

public

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

References backToRepository().

Referenced by outSurveyPage().

698  {
699  if (strlen($this->object->getOutro()) == 0)
700  {
701  $this->backToRepository();
702  }
703  else
704  {
705  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_finished.html", "Modules/Survey");
706  $this->tpl->setVariable("TEXT_FINISHED", $this->object->prepareTextareaOutput($this->object->getOutro()));
707  $this->tpl->setVariable("BTN_EXIT", $this->lng->txt("exit"));
708  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "runShowFinishedPage"));
709  }
710  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveActiveQuestionData()

ilSurveyExecutionGUI::saveActiveQuestionData ( $data)

Survey navigation.

Survey navigation

private Saves the users input of the active page

Saves the users input of the active page

private

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

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

Referenced by saveUserInput().

649  {
650  global $ilUser;
651 
652  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
653  $question =& SurveyQuestion::_instanciateQuestion($data["question_id"]);
654  $error = $question->checkUserInput($_POST, $this->object->getSurveyId());
655  if (strlen($error) == 0)
656  {
657  if(!$this->preview)
658  {
659  // delete old answers
660  $this->object->deleteWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
661 
662  $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()]);
663  }
664  else
665  {
666  $_SESSION["preview_data"][$this->object->getId()][$data["question_id"]] =
667  $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()], true);
668  }
669  return 0;
670  }
671  else
672  {
673  $_SESSION["svy_errors"][$question->getId()] = $error;
674  return 1;
675  }
676  }
< 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']
$_POST['username']
Definition: cron.php:12
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
+ 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.

private

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

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

Referenced by next(), and previous().

549  {
550  if(!$this->preview)
551  {
552  $this->object->setEndTime($_SESSION["finished_id"][$this->object->getId()]);
553  }
554 
555  // check users input when it is a metric question
556  unset($_SESSION["svy_errors"]);
557  $_SESSION["postdata"] = $_POST;
558  $page_error = 0;
559  $page = $this->object->getNextPage($_GET["qid"], 0);
560  foreach ($page as $data)
561  {
562  $page_error += $this->saveActiveQuestionData($data);
563  }
564  if ($page_error && (strcmp($navigationDirection, "previous") != 0))
565  {
566  if ($page_error == 1)
567  {
568  ilUtil::sendFailure($this->lng->txt("svy_page_error"), TRUE);
569  }
570  else
571  {
572  ilUtil::sendFailure($this->lng->txt("svy_page_errors"), TRUE);
573  }
574  }
575  else
576  {
577  $page_error = "";
578  unset($_SESSION["svy_errors"]);
579  }
580  return $page_error;
581  }
< 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']
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
saveActiveQuestionData(&$data)
Survey navigation.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

ilSurveyExecutionGUI::start (   $resume = false)

Starts the survey.

Starts the survey

private

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

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

Referenced by resume().

234  {
235  if($this->preview)
236  {
237  unset($_SESSION["preview_data"]);
238  }
239  unset($_SESSION["svy_errors"]);
240 
241  $this->checkAuth(!$resume);
242 
243  $activepage = "";
244  if ($resume)
245  {
246  $activepage = $this->object->getLastActivePage($_SESSION["finished_id"][$this->object->getId()]);
247  }
248 
249  if (strlen($activepage))
250  {
251  $this->ctrl->setParameter($this, "qid", $activepage);
252  }
253  $this->ctrl->setParameter($this, "activecommand", "default");
254  $this->ctrl->redirect($this, "redirectQuestion");
255  }
< 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']
+ Here is the call graph for this function:
+ Here is the caller 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().

◆ $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: