81        $this->rbacsystem = 
$DIC->rbac()->system();
 
   82        $this->
user = $DIC->user();
 
   83        $this->help = 
$DIC[
"ilHelp"];
 
   84        $this->toolbar = 
$DIC->toolbar();
 
   93        $this->
object = $a_object;
 
   96        $this->external_rater_360 = 
false;
 
   97        if ($this->object->get360Mode() &&
 
   98            $_SESSION[
"anonymous_id"][$this->object->getId()] &&
 
  100                $this->object->getRefId(),
 
  101                $_SESSION[
"anonymous_id"][$this->object->getId()]
 
  103            $this->external_rater_360 = 
true;
 
  107        $this->
preview = (bool) $_REQUEST[
"prvw"];
 
  108        $this->ctrl->saveParameter($this, 
"prvw");
 
  109        $this->ctrl->saveParameter($this, 
"pgov");
 
  122            $this->object->getRefId(),
 
  123            $this->object->getId(),
 
  127        $cmd = $this->ctrl->getCmd();
 
  128        $next_class = $this->ctrl->getNextClass($this);
 
  132        $this->log->debug(
"- cmd= " . $cmd);
 
  134        if (strlen($cmd) == 0) {
 
  135            $this->ctrl->setParameter($this, 
"qid", 
$_GET[
"qid"]);
 
  136            $this->ctrl->redirect($this, 
"gotoPage");
 
  138        switch ($next_class) {
 
  140                $ret =&$this->$cmd();
 
  146    protected function checkAuth($a_may_start = 
false, $a_ignore_status = 
false)
 
  152            if (!
$rbacsystem->checkAccess(
"write", $this->object->ref_id)) {
 
  154                include_once 
"Modules/Survey/exceptions/class.ilSurveyException.php";
 
  161        if (!$this->external_rater_360 &&
 
  162            !
$rbacsystem->checkAccess(
"read", $this->object->ref_id)) {
 
  164            include_once 
"Modules/Survey/exceptions/class.ilSurveyException.php";
 
  172        $anonymous_id = $anonymous_code = 
null;
 
  173        if ($this->object->getAnonymize() || !$this->object->isAccessibleWithoutCode()) {
 
  174            $anonymous_code = 
$_SESSION[
"anonymous_id"][$this->
object->getId()];
 
  175            $anonymous_id = $this->
object->getAnonymousIdByCode($anonymous_code);
 
  176            if (!$anonymous_id) {
 
  178                $this->ctrl->redirectByClass(
"ilobjsurveygui", 
"infoScreen");
 
  184        if ($this->object->get360Mode()) {
 
  185            $appr_id = $_REQUEST[
"appr_id"];
 
  187                $appr_id = 
$_SESSION[
"appr_id"][$this->
object->getId()];
 
  191                $appraisees = $this->
object->getAppraiseesToRate(0, $anonymous_id);
 
  193            if (!$appraisees && $user_id != ANONYMOUS_USER_ID) {
 
  194                $appraisees = $this->
object->getAppraiseesToRate($user_id);
 
  196            if (!in_array($appr_id, $appraisees)) {
 
  198                $this->ctrl->redirectByClass(
"ilobjsurveygui", 
"infoScreen");
 
  201        $_SESSION[
"appr_id"][$this->
object->getId()] = $appr_id;
 
  203        if (!$a_ignore_status) {
 
  204            $status = $this->
object->isSurveyStarted($user_id, $anonymous_code, $appr_id);
 
  208                $this->ctrl->redirectByClass(
"ilobjsurveygui", 
"infoScreen");
 
  211            elseif ($status === 
false) {
 
  213                    $_SESSION[
"finished_id"][$this->
object->getId()] =
 
  214                        $this->
object->startSurvey($user_id, $anonymous_code, $appr_id);
 
  217                    $this->ctrl->redirectByClass(
"ilobjsurveygui", 
"infoScreen");
 
  227        if ($this->object->getActiveID($user_id, $anonymous_code, $appr_id) !=
 
  228            $_SESSION[
"finished_id"][$this->object->getId()]) {
 
  230            $this->ctrl->redirectByClass(
"ilobjsurveygui", 
"infoScreen");
 
  265    public function start($resume = 
false)
 
  276            $activepage = $this->
object->getLastActivePage(
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  279        if (strlen($activepage)) {
 
  280            $this->ctrl->setParameter($this, 
"qid", $activepage);
 
  282        $this->ctrl->setParameter($this, 
"activecommand", 
"default");
 
  283        $this->ctrl->redirect($this, 
"redirectQuestion");
 
  294        switch (
$_GET[
"activecommand"]) {
 
  332        $this->ctrl->setParameter($this, 
"activecommand", 
"previous");
 
  333        $this->ctrl->setParameter($this, 
"qid", 
$_GET[
"qid"]);
 
  334        if (strlen($has_error)) {
 
  335            $this->ctrl->setParameter($this, 
"direction", 
"0");
 
  337            $this->ctrl->setParameter($this, 
"direction", 
"-1");
 
  339        $this->ctrl->redirect($this, 
"redirectQuestion");
 
  350        $this->ctrl->setParameter($this, 
"activecommand", 
"next");
 
  351        $this->ctrl->setParameter($this, 
"qid", 
$_GET[
"qid"]);
 
  353            $this->ctrl->setParameter($this, 
"direction", 
"0");
 
  355            $this->ctrl->setParameter($this, 
"direction", 
"1");
 
  357        $this->ctrl->redirect($this, 
"redirectQuestion");
 
  367        $this->ctrl->setParameter($this, 
"activecommand", 
"gotoPage");
 
  368        $this->ctrl->setParameter($this, 
"qid", 
$_GET[
"qid"]);
 
  369        $this->ctrl->setParameter($this, 
"direction", 
"0");
 
  370        $this->ctrl->redirect($this, 
"redirectQuestion");
 
  386        $page = $this->
object->getNextPage($activepage, $direction);
 
  387        $constraint_true = 0;
 
  390        if (is_array($page[0][
"constraints"]) && count($page[0][
"constraints"])) {
 
  391            $this->log->debug(
"Page constraints= ", $page[0][
"constraints"]);
 
  393            while (is_array($page) and ($constraint_true == 0) and (count($page[0][
"constraints"]))) {
 
  394                $constraint_true = ($page[0][
'constraints'][0][
'conjunction'] == 0) ? 
true : 
false;
 
  395                foreach ($page[0][
"constraints"] as $constraint) {
 
  397                        $working_data = $this->
object->loadWorkingData($constraint[
"question"], 
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  399                        $working_data = 
$_SESSION[
"preview_data"][$this->
object->getId()][$constraint[
"question"]];
 
  401                    if ($constraint[
'conjunction'] == 0) {
 
  403                        $constraint_true = $constraint_true & $this->
object->checkConstraint($constraint, $working_data);
 
  406                        $constraint_true = $constraint_true | $this->
object->checkConstraint($constraint, $working_data);
 
  409                if ($constraint_true == 0) {
 
  411                    foreach ($page as $page_question) {
 
  412                        $qid = $page_question[
"question_id"];
 
  416                            $this->
object->deleteWorkingData($qid, 
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  418                            $_SESSION[
"preview_data"][$this->
object->getId()][$qid] = 
null;
 
  422                    $page = $this->
object->getNextPage($page[0][
"question_id"], $direction);
 
  427        $first_question = -1;
 
  429            $this->ctrl->redirectByClass(
"ilobjsurveygui", 
"infoScreen");
 
  430        } elseif ($page === 1) {
 
  431            $state = $this->
object->getUserSurveyExecutionStatus();
 
  433                !
$state[
"runs"][
$_SESSION[
"finished_id"][$this->object->getId()]][
"finished"]) {
 
  441            $ilHelp->setScreenIdComponent(
"svy");
 
  442            $ilHelp->setScreenId(
"quest_presentation");
 
  444            if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
 
  445                include_once 
"Services/Tracking/classes/class.ilLearningProgress.php";
 
  450            $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_content.html", 
"Modules/Survey");
 
  452            if ($this->object->get360Mode()) {
 
  453                $appr_id = 
$_SESSION[
"appr_id"][$this->
object->getId()];
 
  455                include_once 
"Services/User/classes/class.ilUserUtil.php";
 
  456                $this->tpl->setTitle($this->object->getTitle() . 
" (" .
 
  457                    $this->lng->txt(
"survey_360_appraisee") . 
": " .
 
  461            if (!($this->object->getAnonymize() && $this->object->isAccessibleWithoutCode() && (
$ilUser->getId() == ANONYMOUS_USER_ID))) {
 
  462                $this->tpl->setCurrentBlock(
"suspend_survey");
 
  465                    $this->tpl->setVariable(
"TEXT_SUSPEND", $this->lng->txt(
"cancel_survey"));
 
  466                    $this->tpl->setVariable(
"HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(
"ilObjSurveyGUI", 
"infoScreen"));
 
  468                    $this->ctrl->setParameterByClass(
"ilObjSurveyGUI", 
"pgov", $_REQUEST[
"pgov"]);
 
  469                    $this->tpl->setVariable(
"TEXT_SUSPEND", $this->lng->txt(
"survey_cancel_preview"));
 
  470                    $this->tpl->setVariable(
"HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(array(
"ilObjSurveyGUI", 
"ilSurveyEditorGUI"), 
"questions"));
 
  473                $this->tpl->setVariable(
"ALT_IMG_SUSPEND", $this->lng->txt(
"cancel_survey"));
 
  474                $this->tpl->setVariable(
"TITLE_IMG_SUSPEND", $this->lng->txt(
"cancel_survey"));
 
  475                $this->tpl->parseCurrentBlock();
 
  480            $this->tpl->setCurrentBlock(
"percentage");
 
  482            $percentage = (int) (($page[0][
"position"])*100);
 
  484            include_once 
"Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
 
  486            $pbar->setCurrent($percentage);
 
  487            $this->tpl->setVariable(
"NEW_PBAR", $pbar->render());
 
  489            $this->tpl->parseCurrentBlock();
 
  492            if (count($page) > 1 && $page[0][
"questionblock_show_blocktitle"]) {
 
  493                $this->tpl->setCurrentBlock(
"questionblock_title");
 
  494                $this->tpl->setVariable(
"TEXT_QUESTIONBLOCK_TITLE", $page[0][
"questionblock_title"]);
 
  495                $this->tpl->parseCurrentBlock();
 
  497            foreach ($page as 
$data) {
 
  498                $this->tpl->setCurrentBlock(
"survey_content");
 
  499                if (
$data[
"heading"]) {
 
  500                    $this->tpl->setVariable(
"QUESTION_HEADING", 
$data[
"heading"]);
 
  502                if ($first_question == -1) {
 
  503                    $first_question = 
$data[
"question_id"];
 
  505                $question_gui = $this->
object->getQuestionGUI($data[
"type_tag"], 
$data[
"question_id"]);
 
  507                    $working_data =&$question_gui->object->getWorkingDataFromUserInput(
$_SESSION[
"postdata"]);
 
  509                    $working_data = $this->
object->loadWorkingData($data[
"question_id"], 
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  511                $question_gui->object->setObligatory(
$data[
"obligatory"]);
 
  516                $show_questiontext = (
$data[
"questionblock_show_questiontext"]) ? 1 : 0;
 
  517                $question_output = $question_gui->getWorkingForm($working_data, $this->object->getShowQuestionTitles(), $show_questiontext, 
$error_messages[
$data[
"question_id"]], $this->
object->getSurveyId());
 
  518                $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
 
  519                $this->ctrl->setParameter($this, 
"qid", 
$data[
"question_id"]);
 
  520                $this->tpl->parse(
"survey_content");
 
  521                if (
$data[
"obligatory"]) {
 
  526                $this->tpl->setCurrentBlock(
"required");
 
  527                $this->tpl->setVariable(
"TEXT_REQUIRED", $this->lng->txt(
"required_field"));
 
  528                $this->tpl->parseCurrentBlock();
 
  533            $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"redirectQuestion"));
 
  537            $this->
object->setPage(
$_SESSION[
"finished_id"][$this->object->getId()], $page[0][
'question_id']);
 
  538            $this->
object->setStartTime(
$_SESSION[
"finished_id"][$this->object->getId()], $first_question);
 
  550            $this->
object->setEndTime(
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  557        $page = $this->
object->getNextPage(
$_GET[
"qid"], 0);
 
  558        foreach ($page as 
$data) {
 
  561        if ($page_error && (strcmp($navigationDirection, 
"previous") != 0)) {
 
  562            if ($page_error == 1) {
 
  643        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  645        $error = $question->checkUserInput(
$_POST, $this->object->getSurveyId());
 
  646        if (strlen(
$error) == 0) {
 
  649                $this->
object->deleteWorkingData(
$data[
"question_id"], 
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  651                $question->saveUserInput(
$_POST, 
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  653                $_SESSION[
"preview_data"][$this->
object->getId()][
$data[
"question_id"]] =
 
  654                    $question->saveUserInput(
$_POST, 
$_SESSION[
"finished_id"][$this->object->getId()], 
true);
 
  672        $this->ctrl->redirectByClass(
"ilobjsurveygui", 
"infoScreen");
 
  689        include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
  692            if ($this->object->hasViewOwnResults()) {
 
  694                $button->setCaption(
"svy_view_own_results");
 
  695                $button->setUrl($this->ctrl->getLinkTarget($this, 
"viewUserResults"));
 
  696                $ilToolbar->addButtonInstance($button);
 
  701            if ($this->object->hasMailConfirmation()) {
 
  703                    $ilToolbar->addSeparator();
 
  706                if (
$ilUser->getId() == ANONYMOUS_USER_ID ||
 
  708                    require_once 
"Services/Form/classes/class.ilTextInputGUI.php";
 
  711                    $ilToolbar->addInputItem($mail, 
true);
 
  714                $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 
"mailUserResults"));
 
  716                include_once 
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
 
  718                $button->setCaption(
"svy_mail_send_confirmation");
 
  719                $button->setCommand(
"mailUserResults");
 
  720                $ilToolbar->addButtonInstance($button);
 
  726            include_once 
"Modules/Survey/classes/class.ilObjSurveyAccess.php";
 
  729                $button->setCaption(
"svy_results");
 
  730                $button->setUrl($this->ctrl->getLinkTargetByClass(
"ilObjSurveyGUI", 
"evaluation"));
 
  731                $ilToolbar->addButtonInstance($button);
 
  738            strlen($this->object->getOutro()) == 0) {
 
  742                $ilToolbar->addSeparator();
 
  746            $button->setCaption(
"survey_execution_exit");
 
  747            $button->setUrl($this->ctrl->getLinkTarget($this, 
"exitSurvey"));
 
  748            $ilToolbar->addButtonInstance($button);
 
  750            if (strlen($this->object->getOutro())) {
 
  751                include_once 
"Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
 
  753                $panel->setBody($this->object->prepareTextareaOutput($this->object->getOutro()));
 
  754                $this->tpl->setContent($panel->getHTML());
 
  764        if ($this->object->get360Mode()) {
 
  765            $target_ref_id = $this->
object->getRefId();
 
  768            $target_ref_id = 
$tree->getParentId($this->object->getRefId());
 
  771        include_once 
"Services/Link/classes/class.ilLink.php";
 
  788            $this->ctrl->setParameterByClass(
"ilsurveyeditorgui", 
"pgov", $_REQUEST[
"pgov"]);
 
  789            $this->ctrl->redirectByClass(array(
"ilobjsurveygui", 
"ilsurveyeditorgui"), 
"questions");
 
  804        $prevpage = $this->
object->getNextPage($page[0][
"question_id"], -1);
 
  805        $this->tpl->setCurrentBlock($navigationblock . 
"_prev");
 
  806        if ($prevpage === 0) {
 
  807            $this->tpl->setVariable(
"BTN_PREV", $this->lng->txt(
"survey_start"));
 
  809            $this->tpl->setVariable(
"BTN_PREV", $this->lng->txt(
"survey_previous"));
 
  811        $this->tpl->parseCurrentBlock();
 
  812        $nextpage = $this->
object->getNextPage($page[0][
"question_id"], 1);
 
  813        $this->tpl->setCurrentBlock($navigationblock . 
"_next");
 
  814        if ($nextpage === 1) {
 
  815            $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"survey_finish"));
 
  817            $this->tpl->setVariable(
"BTN_NEXT", $this->lng->txt(
"survey_next"));
 
  819        $this->tpl->parseCurrentBlock();
 
  831        if (!$this->object->hasViewOwnResults()) {
 
  837        include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
  839        $button->setCaption(
"btn_back");
 
  840        $button->setUrl($this->ctrl->getLinkTarget($this, 
"runShowFinishedPage"));
 
  841        $ilToolbar->addButtonInstance($button);
 
  844        $html = $survey_gui->getUserResultsTable(
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  845        $this->tpl->setContent(
$html);
 
  852        if (!$this->object->hasMailConfirmation()) {
 
  858        $recipient = 
$_POST[
"mail"];
 
  860            $recipient = 
$ilUser->getEmail();
 
  863            $this->ctrl->redirect($this, 
"runShowFinishedPage");
 
  867        $survey_gui->sendUserResultsMail(
 
  868            $_SESSION[
"finished_id"][$this->object->getId()],
 
  873        $this->ctrl->redirect($this, 
"runShowFinishedPage");
 
  880        include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  882        $cgui->setHeaderText($this->lng->txt(
"survey_execution_sure_finish"));
 
  884        $cgui->setFormAction($this->ctrl->getFormAction($this, 
"confirmedFinish"));
 
  885        $cgui->setCancel($this->lng->txt(
"cancel"), 
"previousNoSave");
 
  886        $cgui->setConfirm($this->lng->txt(
"confirm"), 
"confirmedFinish");
 
  888        $tpl->setContent($cgui->getHTML());
 
  896            $this->
object->finishSurvey(
$_SESSION[
"finished_id"][$this->object->getId()]);
 
  898            if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
 
  899                include_once 
"Services/Tracking/classes/class.ilLPStatusWrapper.php";
 
  903            if ($this->object->getMailNotification()) {
 
  904                $this->
object->sendNotificationMail(
 
  906                    $_SESSION[
"anonymous_id"][$this->object->getId()],
 
  907                    $_SESSION[
"appr_id"][$this->object->getId()]
 
  918        $this->ctrl->redirect($this, 
"runShowFinishedPage");
 
sprintf('%.4f', $callTime)
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
An exception for terminatinating execution or to throw for unit testing.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
Confirmation screen class.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static getLogger($a_component_id)
Get component logger.
static _hasEvaluationAccess($a_obj_id, $user_id)
static validateExternalRaterCode($a_ref_id, $a_code)
static getInstance()
Get instance.
static getInstance()
Factory.
Survey execution graphical output.
previous($a_save_input=true)
Navigates to the previous pages.
outNavigationButtons($navigationblock="top", $page)
Creates the navigation buttons for a survey.
getCommand($cmd)
Retrieves the ilCtrl command.
exitSurvey()
Exits the survey after finishing it.
saveUserInput($navigationDirection="next")
Save the user's input.
resume()
Resumes the survey.
cancel()
Called on cancel.
outSurveyPage($activepage=null, $direction=null)
Output of the active survey question to the screen.
redirectQuestion()
Called when a user answered a page to perform a redirect after POST.
saveActiveQuestionData(&$data)
Survey navigation.
next()
Navigates to the next pages.
checkAuth($a_may_start=false, $a_ignore_status=false)
gotoPage()
Go to a specific page without saving.
__construct($a_object)
ilSurveyExecutionGUI constructor
runShowFinishedPage()
Creates the finished page for a running survey.
executeCommand()
execute command
start($resume=false)
Starts the survey.
This class represents a text property in a property form.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.