ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSurveyExecutionGUI Class Reference

Survey execution graphical output. More...

+ Collaboration diagram for ilSurveyExecutionGUI:

Public Member Functions

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

Data Fields

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

Protected Member Functions

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

Detailed Description

Survey execution graphical output.

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

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
Id:
class.ilSurveyExecutionGUI.php 59989 2015-07-17 09:31:15Z gitmgr

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

Member Function Documentation

ilSurveyExecutionGUI::backToRepository ( )

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

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

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

{
global $tree;
// #14971
if($this->object->get360Mode())
{
$target_ref_id = $this->object->getRefId();
}
else
{
// #11534
$target_ref_id = $tree->getParentId($this->object->getRefId());
}
include_once "Services/Link/classes/class.ilLink.php";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::cancel ( )

Called on cancel.

Called on cancel

private

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

{
$this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
}
ilSurveyExecutionGUI::checkAuth (   $a_may_start = false,
  $a_ignore_status = false 
)
protected

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

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

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

{
global $rbacsystem, $ilUser;
if($this->preview)
{
if(!$rbacsystem->checkAccess("write", $this->object->ref_id))
{
// only with write access it is possible to preview the survey
$this->ilias->raiseError($this->lng->txt("survey_cannot_preview_survey"),$this->ilias->error_obj->MESSAGE);
}
return true;
}
if (!$this->external_rater_360 &&
!$rbacsystem->checkAccess("read", $this->object->ref_id))
{
// only with read access it is possible to run the test
$this->ilias->raiseError($this->lng->txt("cannot_read_survey"),$this->ilias->error_obj->MESSAGE);
}
$user_id = $ilUser->getId();
// check existing code
// see ilObjSurveyGUI::infoScreen()
$anonymous_id = $anonymous_code = null;
if ($this->object->getAnonymize() || !$this->object->isAccessibleWithoutCode())
{
$anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
$anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
if(!$anonymous_id)
{
ilUtil::sendFailure(sprintf($this->lng->txt("error_retrieving_anonymous_survey"), $anonymous_code, true));
$this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
}
}
// appraisee validation
$appr_id = 0;
if($this->object->get360Mode())
{
$appr_id = $_REQUEST["appr_id"];
if(!$appr_id)
{
$appr_id = $_SESSION["appr_id"][$this->object->getId()];
}
// check if appraisee is valid
if($anonymous_id)
{
$appraisees = $this->object->getAppraiseesToRate(0, $anonymous_id);
}
if(!$appraisees && $user_id != ANONYMOUS_USER_ID)
{
$appraisees = $this->object->getAppraiseesToRate($user_id);
}
if(!in_array($appr_id, $appraisees))
{
ilUtil::sendFailure($this->lng->txt("survey_360_execution_invalid_appraisee"), true);
$this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
}
}
$_SESSION["appr_id"][$this->object->getId()] = $appr_id;
if(!$a_ignore_status)
{
$status = $this->object->isSurveyStarted($user_id, $anonymous_code, $appr_id);
// completed
if($status === 1)
{
ilUtil::sendFailure($this->lng->txt("already_completed_survey"), true);
$this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
}
// starting
else if ($status === false)
{
if($a_may_start)
{
$_SESSION["finished_id"][$this->object->getId()] =
$this->object->startSurvey($user_id, $anonymous_code, $appr_id);
}
else
{
ilUtil::sendFailure($this->lng->txt("survey_use_start_button"), true);
$this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
}
}
// resuming
else
{
// nothing todo
}
}
// validate finished id
if($this->object->getActiveID($user_id, $anonymous_code, $appr_id) !=
$_SESSION["finished_id"][$this->object->getId()])
{
ilUtil::sendFailure($this->lng->txt("cannot_read_survey"), true);
$this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::confirmedFinish ( )

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

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

{
global $ilUser;
if(!$this->preview)
{
$this->object->finishSurvey($_SESSION["finished_id"][$this->object->getId()]);
if ($this->object->getMailNotification())
{
$this->object->sendNotificationMail($ilUser->getId(),
$_SESSION["anonymous_id"][$this->object->getId()],
$_SESSION["appr_id"][$this->object->getId()]);
}
}
/*
unset($_SESSION["anonymous_id"][$this->object->getId()]);
unset($_SESSION["appr_id"][$this->object->getId()]);
unset($_SESSION["finished_id"][$this->object->getId()]);
*/
$this->ctrl->redirect($this, "runShowFinishedPage");
}

+ Here is the call graph for this function:

& ilSurveyExecutionGUI::executeCommand ( )

execute command

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

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

{
$cmd = $this->ctrl->getCmd();
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->getCommand($cmd);
if (strlen($cmd) == 0)
{
$this->ctrl->setParameter($this, "qid", $_GET["qid"]);
$this->ctrl->redirect($this, "gotoPage");
}
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}

+ Here is the call graph for this function:

ilSurveyExecutionGUI::exitSurvey ( )

Exits the survey after finishing it.

Exits the survey after finishing it

public

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

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

Referenced by runShowFinishedPage().

{
if(!$this->preview)
{
$this->backToRepository();
}
else
{
// #12841
$this->ctrl->setParameterByClass("ilsurveyeditorgui", "pgov", $_REQUEST["pgov"]);
$this->ctrl->redirectByClass(array("ilobjsurveygui", "ilsurveyeditorgui"), "questions");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::getCommand (   $cmd)

Retrieves the ilCtrl command.

Retrieves the ilCtrl command

public

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

References $cmd.

Referenced by executeCommand().

{
return $cmd;
}

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::gotoPage ( )

Go to a specific page without saving.

private

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

References $_GET.

{
$this->ctrl->setParameter($this, "activecommand", "gotoPage");
$this->ctrl->setParameter($this, "qid", $_GET["qid"]);
$this->ctrl->setParameter($this, "direction", "0");
$this->ctrl->redirect($this, "redirectQuestion");
}
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().

{
$this->lng =& $lng;
$this->tpl =& $tpl;
$this->ctrl =& $ilCtrl;
$this->ilias =& $ilias;
$this->object =& $a_object;
$this->tree =& $tree;
$this->external_rater_360 = false;
if($this->object->get360Mode() &&
$_SESSION["anonymous_id"][$this->object->getId()] &&
ilObjSurvey::validateExternalRaterCode($this->object->getRefId(),
$_SESSION["anonymous_id"][$this->object->getId()]))
{
$this->external_rater_360 = true;
}
// stay in preview mode
$this->preview = (bool)$_REQUEST["prvw"];
$this->ctrl->saveParameter($this, "prvw");
$this->ctrl->saveParameter($this, "pgov");
}

+ Here is the call graph for this function:

ilSurveyExecutionGUI::mailUserResults ( )

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

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

{
if(!$this->object->hasMailOwnResults())
{
$this->backToRepository();
}
$this->checkAuth(false, true);
$recipient = $_POST["mail"];
if(!ilUtil::is_email($recipient))
{
$this->ctrl->redirect($this, "runShowFinishedPage");
}
$survey_gui = new ilObjSurveyGUI();
$survey_gui->sendUserResultsMail(
$_SESSION["finished_id"][$this->object->getId()],
$recipient
);
ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
$this->ctrl->redirect($this, "runShowFinishedPage");
}

+ Here is the call graph for this function:

ilSurveyExecutionGUI::next ( )

Navigates to the next pages.

private

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

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

{
$result = $this->saveUserInput("next");
$this->ctrl->setParameter($this, "activecommand", "next");
$this->ctrl->setParameter($this, "qid", $_GET["qid"]);
if (strlen($result))
{
$this->ctrl->setParameter($this, "direction", "0");
}
else
{
$this->ctrl->setParameter($this, "direction", "1");
}
$this->ctrl->redirect($this, "redirectQuestion");
}

+ Here is the call graph for this function:

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

Referenced by outSurveyPage().

{
$prevpage = $this->object->getNextPage($page[0]["question_id"], -1);
$this->tpl->setCurrentBlock($navigationblock . "_prev");
if ($prevpage === 0)
{
$this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_start"));
}
else
{
$this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_previous"));
}
$this->tpl->parseCurrentBlock();
$nextpage = $this->object->getNextPage($page[0]["question_id"], 1);
$this->tpl->setCurrentBlock($navigationblock . "_next");
if ($nextpage === 1)
{
$this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_finish"));
}
else
{
$this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_next"));
}
$this->tpl->parseCurrentBlock();
}

+ Here is the caller graph for this function:

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

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

Referenced by preview(), and redirectQuestion().

{
global $ilUser;
$this->checkAuth();
$page = $this->object->getNextPage($activepage, $direction);
$constraint_true = 0;
// check for constraints
if (count($page[0]["constraints"]))
{
while (is_array($page) and ($constraint_true == 0) and (count($page[0]["constraints"])))
{
$constraint_true = ($page[0]['constraints'][0]['conjunction'] == 0) ? true : false;
foreach ($page[0]["constraints"] as $constraint)
{
if(!$this->preview)
{
$working_data = $this->object->loadWorkingData($constraint["question"], $_SESSION["finished_id"][$this->object->getId()]);
}
else
{
$working_data = $_SESSION["preview_data"][$this->object->getId()][$constraint["question"]];
}
if ($constraint['conjunction'] == 0)
{
// and
$constraint_true = $constraint_true & $this->object->checkConstraint($constraint, $working_data);
}
else
{
// or
$constraint_true = $constraint_true | $this->object->checkConstraint($constraint, $working_data);
}
}
if ($constraint_true == 0)
{
// #11047 - we are skipping the page, so we have to get rid of existing answers for that question(s)
foreach($page as $page_question)
{
$qid = $page_question["question_id"];
// see saveActiveQuestionData()
if(!$this->preview)
{
$this->object->deleteWorkingData($qid, $_SESSION["finished_id"][$this->object->getId()]);
}
else
{
$_SESSION["preview_data"][$this->object->getId()][$qid] = null;
}
}
$page = $this->object->getNextPage($page[0]["question_id"], $direction);
}
}
}
$first_question = -1;
if ($page === 0)
{
$this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
}
else if ($page === 1)
{
$state = $this->object->getUserSurveyExecutionStatus();
if($this->preview ||
!$state["runs"][$_SESSION["finished_id"][$this->object->getId()]]["finished"])
{
}
else
{
}
return;
}
else
{
global $ilHelp;
$ilHelp->setScreenIdComponent("svy");
$ilHelp->setScreenId("quest_presentation");
$required = false;
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_content.html", "Modules/Survey");
if($this->object->get360Mode())
{
$appr_id = $_SESSION["appr_id"][$this->object->getId()];
include_once "Services/User/classes/class.ilUserUtil.php";
$this->tpl->setTitle($this->object->getTitle()." (".
$this->lng->txt("survey_360_appraisee").": ".
}
if (!($this->object->getAnonymize() && $this->object->isAccessibleWithoutCode() && ($ilUser->getId() == ANONYMOUS_USER_ID)))
{
$this->tpl->setCurrentBlock("suspend_survey");
if(!$this->preview)
{
$this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("cancel_survey"));
$this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "infoScreen"));
}
else
{
$this->ctrl->setParameterByClass("ilObjSurveyGUI", "pgov", $_REQUEST["pgov"]);
$this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("survey_cancel_preview"));
$this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(array("ilObjSurveyGUI", "ilSurveyEditorGUI"), "questions"));
}
$this->tpl->setVariable("ALT_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
$this->tpl->setVariable("TITLE_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
$this->tpl->parseCurrentBlock();
}
$this->outNavigationButtons("top", $page);
$this->tpl->setCurrentBlock("percentage");
$percentage = (int)(($page[0]["position"])*100);
include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
$pbar->setCurrent($percentage);
$this->tpl->setVariable("NEW_PBAR", $pbar->render());
$this->tpl->parseCurrentBlock();
if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"])
{
$this->tpl->setCurrentBlock("questionblock_title");
$this->tpl->setVariable("TEXT_QUESTIONBLOCK_TITLE", $page[0]["questionblock_title"]);
$this->tpl->parseCurrentBlock();
}
foreach ($page as $data)
{
$this->tpl->setCurrentBlock("survey_content");
if ($data["heading"])
{
$this->tpl->setVariable("QUESTION_HEADING", $data["heading"]);
}
if ($first_question == -1) $first_question = $data["question_id"];
$question_gui = $this->object->getQuestionGUI($data["type_tag"], $data["question_id"]);
if (is_array($_SESSION["svy_errors"]))
{
$working_data =& $question_gui->object->getWorkingDataFromUserInput($_SESSION["postdata"]);
}
else
{
$working_data = $this->object->loadWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
}
$question_gui->object->setObligatory($data["obligatory"]);
$error_messages = array();
if (is_array($_SESSION["svy_errors"]))
{
$error_messages = $_SESSION["svy_errors"];
}
$show_questiontext = ($data["questionblock_show_questiontext"]) ? 1 : 0;
$question_output = $question_gui->getWorkingForm($working_data, $this->object->getShowQuestionTitles(), $show_questiontext, $error_messages[$data["question_id"]], $this->object->getSurveyId());
$this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
$this->ctrl->setParameter($this, "qid", $data["question_id"]);
$this->tpl->parse("survey_content");
if ($data["obligatory"]) $required = true;
}
if ($required)
{
$this->tpl->setCurrentBlock("required");
$this->tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
$this->tpl->parseCurrentBlock();
}
$this->outNavigationButtons("bottom", $page);
$this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "redirectQuestion"));
}
if(!$this->preview)
{
$this->object->setPage($_SESSION["finished_id"][$this->object->getId()], $page[0]['question_id']);
$this->object->setStartTime($_SESSION["finished_id"][$this->object->getId()], $first_question);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::preview ( )

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

References outSurveyPage().

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

{
$this->outSurveyPage();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::previous (   $a_save_input = true)

Navigates to the previous pages.

Navigates to the previous pages

private

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

References $_GET, and saveUserInput().

Referenced by previousNoSave().

{
if($a_save_input)
{
// #16209
$has_error = $this->saveUserInput("previous");
}
$this->ctrl->setParameter($this, "activecommand", "previous");
$this->ctrl->setParameter($this, "qid", $_GET["qid"]);
if (strlen($has_error))
{
$this->ctrl->setParameter($this, "direction", "0");
}
else
{
$this->ctrl->setParameter($this, "direction", "-1");
}
$this->ctrl->redirect($this, "redirectQuestion");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::previousNoSave ( )

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

References previous().

{
$this->previous(false);
}

+ Here is the call graph for this function:

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

References $_GET, and outSurveyPage().

{
switch ($_GET["activecommand"])
{
case "next":
$this->outSurveyPage($_GET["qid"], $_GET["direction"]);
break;
case "previous":
$this->outSurveyPage($_GET["qid"], $_GET["direction"]);
break;
case "gotoPage":
$this->outSurveyPage($_GET["qid"], $_GET["direction"]);
break;
case "default":
$this->outSurveyPage($_GET["qid"]);
break;
default:
// don't save input, go to the first page
$this->outSurveyPage();
break;
}
}

+ Here is the call graph for this function:

ilSurveyExecutionGUI::resume ( )

Resumes the survey.

Resumes the survey

private

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

References start().

{
$this->start(true);
}

+ Here is the call graph for this function:

ilSurveyExecutionGUI::runShowFinishedPage ( )

Creates the finished page for a running survey.

Creates the finished page for a running survey

public

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

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

Referenced by outSurveyPage().

{
global $ilToolbar, $ilUser;
$has_button = false;
include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
if(!$this->preview)
{
if($this->object->hasViewOwnResults())
{
$button->setCaption("svy_view_own_results");
$button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
$ilToolbar->addButtonInstance($button);
$has_button = true;
}
if($this->object->hasMailOwnResults())
{
if($has_button)
{
$ilToolbar->addSeparator();
}
require_once "Services/Form/classes/class.ilTextInputGUI.php";
$mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
$mail->setSize(25);
if($ilUser->getId() != ANONYMOUS_USER_ID)
{
$mail->setValue($ilUser->getEmail());
}
$ilToolbar->addInputItem($mail, true);
$ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
$button->setCaption("svy_mail_own_results");
$button->setCommand("mailUserResults");
$ilToolbar->addButtonInstance($button);
$has_button = true;
}
}
if (!$has_button &&
strlen($this->object->getOutro()) == 0)
{
$this->exitSurvey();
}
else
{
if($has_button)
{
$ilToolbar->addSeparator();
}
$button->setCaption("survey_execution_exit");
$button->setUrl($this->ctrl->getLinkTarget($this, "exitSurvey"));
$ilToolbar->addButtonInstance($button);
if(strlen($this->object->getOutro()))
{
include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
$panel->setBody($this->object->prepareTextareaOutput($this->object->getOutro()));
$this->tpl->setContent($panel->getHTML());
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Referenced by saveUserInput().

{
global $ilUser;
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$question =& SurveyQuestion::_instanciateQuestion($data["question_id"]);
$error = $question->checkUserInput($_POST, $this->object->getSurveyId());
if (strlen($error) == 0)
{
if(!$this->preview)
{
// delete old answers
$this->object->deleteWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
$question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()]);
}
else
{
$_SESSION["preview_data"][$this->object->getId()][$data["question_id"]] =
$question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()], true);
}
return 0;
}
else
{
$_SESSION["svy_errors"][$question->getId()] = $error;
return 1;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Save the user's input.

private

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

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

Referenced by next(), and previous().

{
if(!$this->preview)
{
$this->object->setEndTime($_SESSION["finished_id"][$this->object->getId()]);
}
// check users input when it is a metric question
unset($_SESSION["svy_errors"]);
$_SESSION["postdata"] = $_POST;
$page_error = 0;
$page = $this->object->getNextPage($_GET["qid"], 0);
foreach ($page as $data)
{
$page_error += $this->saveActiveQuestionData($data);
}
if ($page_error && (strcmp($navigationDirection, "previous") != 0))
{
if ($page_error == 1)
{
ilUtil::sendFailure($this->lng->txt("svy_page_error"), TRUE);
}
else
{
ilUtil::sendFailure($this->lng->txt("svy_page_errors"), TRUE);
}
}
else
{
$page_error = "";
unset($_SESSION["svy_errors"]);
}
return $page_error;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::showFinishConfirmation ( )

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

References $tpl.

Referenced by outSurveyPage().

{
global $tpl;
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setHeaderText($this->lng->txt("survey_execution_sure_finish"));
$cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedFinish"));
$cgui->setCancel($this->lng->txt("cancel"), "previousNoSave");
$cgui->setConfirm($this->lng->txt("confirm"), "confirmedFinish");
$tpl->setContent($cgui->getHTML());
}

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::start (   $resume = false)

Starts the survey.

Starts the survey

private

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

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

Referenced by resume().

{
if($this->preview)
{
unset($_SESSION["preview_data"]);
}
unset($_SESSION["svy_errors"]);
$this->checkAuth(!$resume);
$activepage = "";
if ($resume)
{
$activepage = $this->object->getLastActivePage($_SESSION["finished_id"][$this->object->getId()]);
}
if (strlen($activepage))
{
$this->ctrl->setParameter($this, "qid", $activepage);
}
$this->ctrl->setParameter($this, "activecommand", "default");
$this->ctrl->redirect($this, "redirectQuestion");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSurveyExecutionGUI::viewUserResults ( )

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

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

{
global $ilToolbar;
if(!$this->object->hasViewOwnResults())
{
$this->backToRepository();
}
$this->checkAuth(false, true);
include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
$button->setCaption("btn_back");
$button->setUrl($this->ctrl->getLinkTarget($this, "runShowFinishedPage"));
$ilToolbar->addButtonInstance($button);
$survey_gui = new ilObjSurveyGUI();
$html = $survey_gui->getUserResultsTable($_SESSION["finished_id"][$this->object->getId()]);
$this->tpl->setContent($html);
}

+ Here is the call graph for this function:

Field Documentation

ilSurveyExecutionGUI::$ctrl

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

ilSurveyExecutionGUI::$ilias

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

Referenced by ilSurveyExecutionGUI().

ilSurveyExecutionGUI::$lng

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

Referenced by ilSurveyExecutionGUI().

ilSurveyExecutionGUI::$object

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

ilSurveyExecutionGUI::$preview

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

ilSurveyExecutionGUI::$tpl

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

Referenced by ilSurveyExecutionGUI(), and showFinishConfirmation().

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: