ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilSurveyExecutionGUI.php
Go to the documentation of this file.
1<?php
2 /*
3 +----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +----------------------------------------------------------------------------+
22*/
23
36{
38 var $lng;
39 var $tpl;
40 var $ctrl;
41 var $ilias;
42 var $tree;
44
53 function ilSurveyExecutionGUI($a_object)
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 }
78
82 function &executeCommand()
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 }
101
102 protected function checkAuth($a_may_start = false, $a_ignore_status = false)
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 if(!$a_ignore_status)
167 {
168 $status = $this->object->isSurveyStarted($user_id, $anonymous_code, $appr_id);
169 // completed
170 if($status === 1)
171 {
172 ilUtil::sendFailure($this->lng->txt("already_completed_survey"), true);
173 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
174 }
175 // starting
176 else if ($status === false)
177 {
178 if($a_may_start)
179 {
180 $_SESSION["finished_id"][$this->object->getId()] =
181 $this->object->startSurvey($user_id, $anonymous_code, $appr_id);
182 }
183 else
184 {
185 ilUtil::sendFailure($this->lng->txt("survey_use_start_button"), true);
186 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
187 }
188 }
189 // resuming
190 else
191 {
192 // nothing todo
193 }
194 }
195
196 // validate finished id
197 if($this->object->getActiveID($user_id, $anonymous_code, $appr_id) !=
198 $_SESSION["finished_id"][$this->object->getId()])
199 {
200 ilUtil::sendFailure($this->lng->txt("cannot_read_survey"), true);
201 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
202 }
203 }
204
212 function getCommand($cmd)
213 {
214 return $cmd;
215 }
216
224 function resume()
225 {
226 $this->start(true);
227 }
228
236 function start($resume = false)
237 {
238 if($this->preview)
239 {
240 unset($_SESSION["preview_data"]);
241 }
242 unset($_SESSION["svy_errors"]);
243
244 $this->checkAuth(!$resume);
245
246 $activepage = "";
247 if ($resume)
248 {
249 $activepage = $this->object->getLastActivePage($_SESSION["finished_id"][$this->object->getId()]);
250 }
251
252 if (strlen($activepage))
253 {
254 $this->ctrl->setParameter($this, "qid", $activepage);
255 }
256 $this->ctrl->setParameter($this, "activecommand", "default");
257 $this->ctrl->redirect($this, "redirectQuestion");
258 }
259
267 {
268 switch ($_GET["activecommand"])
269 {
270 case "next":
271 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
272 break;
273 case "previous":
274 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
275 break;
276 case "gotoPage":
277 $this->outSurveyPage($_GET["qid"], $_GET["direction"]);
278 break;
279 case "default":
280 $this->outSurveyPage($_GET["qid"]);
281 break;
282 default:
283 // don't save input, go to the first page
284 $this->outSurveyPage();
285 break;
286 }
287 }
288
289 function previousNoSave()
290 {
291 $this->previous(false);
292 }
293
301 function previous($a_save_input = true)
302 {
303 if($a_save_input)
304 {
305 // #16209
306 $has_error = $this->saveUserInput("previous");
307 }
308 $this->ctrl->setParameter($this, "activecommand", "previous");
309 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
310 if (strlen($has_error))
311 {
312 $this->ctrl->setParameter($this, "direction", "0");
313 }
314 else
315 {
316 $this->ctrl->setParameter($this, "direction", "-1");
317 }
318 $this->ctrl->redirect($this, "redirectQuestion");
319 }
320
326 function next()
327 {
328 $result = $this->saveUserInput("next");
329 $this->ctrl->setParameter($this, "activecommand", "next");
330 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
331 if (strlen($result))
332 {
333 $this->ctrl->setParameter($this, "direction", "0");
334 }
335 else
336 {
337 $this->ctrl->setParameter($this, "direction", "1");
338 }
339 $this->ctrl->redirect($this, "redirectQuestion");
340 }
341
347 function gotoPage()
348 {
349 $this->ctrl->setParameter($this, "activecommand", "gotoPage");
350 $this->ctrl->setParameter($this, "qid", $_GET["qid"]);
351 $this->ctrl->setParameter($this, "direction", "0");
352 $this->ctrl->redirect($this, "redirectQuestion");
353 }
354
362 function outSurveyPage($activepage = NULL, $direction = NULL)
363 {
364 global $ilUser;
365
366 $this->checkAuth();
367
368 $page = $this->object->getNextPage($activepage, $direction);
369 $constraint_true = 0;
370
371 // check for constraints
372 if (count($page[0]["constraints"]))
373 {
374 while (is_array($page) and ($constraint_true == 0) and (count($page[0]["constraints"])))
375 {
376 $constraint_true = ($page[0]['constraints'][0]['conjunction'] == 0) ? true : false;
377 foreach ($page[0]["constraints"] as $constraint)
378 {
379 if(!$this->preview)
380 {
381 $working_data = $this->object->loadWorkingData($constraint["question"], $_SESSION["finished_id"][$this->object->getId()]);
382 }
383 else
384 {
385 $working_data = $_SESSION["preview_data"][$this->object->getId()][$constraint["question"]];
386 }
387 if ($constraint['conjunction'] == 0)
388 {
389 // and
390 $constraint_true = $constraint_true & $this->object->checkConstraint($constraint, $working_data);
391 }
392 else
393 {
394 // or
395 $constraint_true = $constraint_true | $this->object->checkConstraint($constraint, $working_data);
396 }
397 }
398 if ($constraint_true == 0)
399 {
400 // #11047 - we are skipping the page, so we have to get rid of existing answers for that question(s)
401 foreach($page as $page_question)
402 {
403 $qid = $page_question["question_id"];
404
405 // see saveActiveQuestionData()
406 if(!$this->preview)
407 {
408 $this->object->deleteWorkingData($qid, $_SESSION["finished_id"][$this->object->getId()]);
409 }
410 else
411 {
412 $_SESSION["preview_data"][$this->object->getId()][$qid] = null;
413 }
414 }
415
416 $page = $this->object->getNextPage($page[0]["question_id"], $direction);
417 }
418 }
419 }
420
421 $first_question = -1;
422 if ($page === 0)
423 {
424 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
425 }
426 else if ($page === 1)
427 {
428 $state = $this->object->getUserSurveyExecutionStatus();
429 if($this->preview ||
430 !$state["runs"][$_SESSION["finished_id"][$this->object->getId()]]["finished"])
431 {
432 $this->showFinishConfirmation();
433 }
434 else
435 {
436 $this->runShowFinishedPage();
437 }
438 return;
439 }
440 else
441 {
442 global $ilHelp;
443 $ilHelp->setScreenIdComponent("svy");
444 $ilHelp->setScreenId("quest_presentation");
445
446 $required = false;
447 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_content.html", "Modules/Survey");
448
449 if($this->object->get360Mode())
450 {
451 $appr_id = $_SESSION["appr_id"][$this->object->getId()];
452
453 include_once "Services/User/classes/class.ilUserUtil.php";
454 $this->tpl->setTitle($this->object->getTitle()." (".
455 $this->lng->txt("survey_360_appraisee").": ".
456 ilUserUtil::getNamePresentation($appr_id).")");
457 }
458
459 if (!($this->object->getAnonymize() && $this->object->isAccessibleWithoutCode() && ($ilUser->getId() == ANONYMOUS_USER_ID)))
460 {
461 $this->tpl->setCurrentBlock("suspend_survey");
462
463 if(!$this->preview)
464 {
465 $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("cancel_survey"));
466 $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass("ilObjSurveyGUI", "infoScreen"));
467 }
468 else
469 {
470 $this->ctrl->setParameterByClass("ilObjSurveyGUI", "pgov", $_REQUEST["pgov"]);
471 $this->tpl->setVariable("TEXT_SUSPEND", $this->lng->txt("survey_cancel_preview"));
472 $this->tpl->setVariable("HREF_SUSPEND", $this->ctrl->getLinkTargetByClass(array("ilObjSurveyGUI", "ilSurveyEditorGUI"), "questions"));
473 }
474
475 $this->tpl->setVariable("ALT_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
476 $this->tpl->setVariable("TITLE_IMG_SUSPEND", $this->lng->txt("cancel_survey"));
477 $this->tpl->parseCurrentBlock();
478 }
479 $this->outNavigationButtons("top", $page);
480
481
482 $this->tpl->setCurrentBlock("percentage");
483
484 $percentage = (int)(($page[0]["position"])*100);
485
486 include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
488 $pbar->setCurrent($percentage);
489 $this->tpl->setVariable("NEW_PBAR", $pbar->render());
490
491 $this->tpl->parseCurrentBlock();
492
493
494 if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"])
495 {
496 $this->tpl->setCurrentBlock("questionblock_title");
497 $this->tpl->setVariable("TEXT_QUESTIONBLOCK_TITLE", $page[0]["questionblock_title"]);
498 $this->tpl->parseCurrentBlock();
499 }
500 foreach ($page as $data)
501 {
502 $this->tpl->setCurrentBlock("survey_content");
503 if ($data["heading"])
504 {
505 $this->tpl->setVariable("QUESTION_HEADING", $data["heading"]);
506 }
507 if ($first_question == -1) $first_question = $data["question_id"];
508 $question_gui = $this->object->getQuestionGUI($data["type_tag"], $data["question_id"]);
509 if (is_array($_SESSION["svy_errors"]))
510 {
511 $working_data =& $question_gui->object->getWorkingDataFromUserInput($_SESSION["postdata"]);
512 }
513 else
514 {
515 $working_data = $this->object->loadWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
516 }
517 $question_gui->object->setObligatory($data["obligatory"]);
518 $error_messages = array();
519 if (is_array($_SESSION["svy_errors"]))
520 {
521 $error_messages = $_SESSION["svy_errors"];
522 }
523 $show_questiontext = ($data["questionblock_show_questiontext"]) ? 1 : 0;
524 $question_output = $question_gui->getWorkingForm($working_data, $this->object->getShowQuestionTitles(), $show_questiontext, $error_messages[$data["question_id"]], $this->object->getSurveyId());
525 $this->tpl->setVariable("QUESTION_OUTPUT", $question_output);
526 $this->ctrl->setParameter($this, "qid", $data["question_id"]);
527 $this->tpl->parse("survey_content");
528 if ($data["obligatory"]) $required = true;
529 }
530 if ($required)
531 {
532 $this->tpl->setCurrentBlock("required");
533 $this->tpl->setVariable("TEXT_REQUIRED", $this->lng->txt("required_field"));
534 $this->tpl->parseCurrentBlock();
535 }
536
537 $this->outNavigationButtons("bottom", $page);
538
539 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "redirectQuestion"));
540 }
541
542 if(!$this->preview)
543 {
544 $this->object->setPage($_SESSION["finished_id"][$this->object->getId()], $page[0]['question_id']);
545 $this->object->setStartTime($_SESSION["finished_id"][$this->object->getId()], $first_question);
546 }
547 }
548
554 function saveUserInput($navigationDirection = "next")
555 {
556 if(!$this->preview)
557 {
558 $this->object->setEndTime($_SESSION["finished_id"][$this->object->getId()]);
559 }
560
561 // check users input when it is a metric question
562 unset($_SESSION["svy_errors"]);
563 $_SESSION["postdata"] = $_POST;
564 $page_error = 0;
565 $page = $this->object->getNextPage($_GET["qid"], 0);
566 foreach ($page as $data)
567 {
568 $page_error += $this->saveActiveQuestionData($data);
569 }
570 if ($page_error && (strcmp($navigationDirection, "previous") != 0))
571 {
572 if ($page_error == 1)
573 {
574 ilUtil::sendFailure($this->lng->txt("svy_page_error"), TRUE);
575 }
576 else
577 {
578 ilUtil::sendFailure($this->lng->txt("svy_page_errors"), TRUE);
579 }
580 }
581 else
582 {
583 $page_error = "";
584 unset($_SESSION["svy_errors"]);
585 }
586 return $page_error;
587 }
588
596 /*
597 function navigate($navigationDirection = "next")
598 {
599 // check users input when it is a metric question
600 unset($_SESSION["svy_errors"]);
601 $page_error = 0;
602 $page = $this->object->getNextPage($_GET["qid"], 0);
603 foreach ($page as $data)
604 {
605 $page_error += $this->saveActiveQuestionData($data);
606 }
607 if ($page_error && (strcmp($navigationDirection, "previous") != 0))
608 {
609 if ($page_error == 1)
610 {
611 ilUtil::sendFailure($this->lng->txt("svy_page_error"));
612 }
613 else
614 {
615 ilUtil::sendFailure($this->lng->txt("svy_page_errors"));
616 }
617 }
618 else
619 {
620 $page_error = "";
621 unset($_SESSION["svy_errors"]);
622 }
623
624 $direction = 0;
625 switch ($navigationDirection)
626 {
627 case "next":
628 default:
629 $activepage = $_GET["qid"];
630 if (!$page_error)
631 {
632 $direction = 1;
633 }
634 break;
635 case "previous":
636 $activepage = $_GET["qid"];
637 if (!$page_error)
638 {
639 $direction = -1;
640 }
641 break;
642 }
643 $this->outSurveyPage($activepage, $direction);
644 }
645*/
646
655 {
656 global $ilUser;
657
658 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
659 $question =& SurveyQuestion::_instanciateQuestion($data["question_id"]);
660 $error = $question->checkUserInput($_POST, $this->object->getSurveyId());
661 if (strlen($error) == 0)
662 {
663 if(!$this->preview)
664 {
665 // delete old answers
666 $this->object->deleteWorkingData($data["question_id"], $_SESSION["finished_id"][$this->object->getId()]);
667
668 $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()]);
669 }
670 else
671 {
672 $_SESSION["preview_data"][$this->object->getId()][$data["question_id"]] =
673 $question->saveUserInput($_POST, $_SESSION["finished_id"][$this->object->getId()], true);
674 }
675 return 0;
676 }
677 else
678 {
679 $_SESSION["svy_errors"][$question->getId()] = $error;
680 return 1;
681 }
682 }
683
691 function cancel()
692 {
693 $this->ctrl->redirectByClass("ilobjsurveygui", "infoScreen");
694 }
695
704 {
705 global $ilToolbar, $ilUser;
706
707 $has_button = false;
708
709 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
710
711 if(!$this->preview)
712 {
713 if($this->object->hasViewOwnResults())
714 {
715 $button = ilLinkButton::getInstance();
716 $button->setCaption("svy_view_own_results");
717 $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
718 $ilToolbar->addButtonInstance($button);
719
720 $has_button = true;
721 }
722
723 if($this->object->hasMailOwnResults())
724 {
725 if($has_button)
726 {
727 $ilToolbar->addSeparator();
728 }
729
730 require_once "Services/Form/classes/class.ilTextInputGUI.php";
731 $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
732 $mail->setSize(25);
733 if($ilUser->getId() != ANONYMOUS_USER_ID)
734 {
735 $mail->setValue($ilUser->getEmail());
736 }
737 $ilToolbar->addInputItem($mail, true);
738
739 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
740
741 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
742 $button = ilSubmitButton::getInstance();
743 $button->setCaption("svy_mail_own_results");
744 $button->setCommand("mailUserResults");
745 $ilToolbar->addButtonInstance($button);
746
747 $has_button = true;
748 }
749 }
750
751 if (!$has_button &&
752 strlen($this->object->getOutro()) == 0)
753 {
754 $this->exitSurvey();
755 }
756 else
757 {
758 if($has_button)
759 {
760 $ilToolbar->addSeparator();
761 }
762
763 $button = ilLinkButton::getInstance();
764 $button->setCaption("survey_execution_exit");
765 $button->setUrl($this->ctrl->getLinkTarget($this, "exitSurvey"));
766 $ilToolbar->addButtonInstance($button);
767
768 if(strlen($this->object->getOutro()))
769 {
770 include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
771 $panel = ilPanelGUI::getInstance();
772 $panel->setBody($this->object->prepareTextareaOutput($this->object->getOutro()));
773 $this->tpl->setContent($panel->getHTML());
774 }
775 }
776 }
777
779 {
780 global $tree;
781
782 // #14971
783 if($this->object->get360Mode())
784 {
785 $target_ref_id = $this->object->getRefId();
786 }
787 else
788 {
789 // #11534
790 $target_ref_id = $tree->getParentId($this->object->getRefId());
791 }
792
793 include_once "Services/Link/classes/class.ilLink.php";
794 ilUtil::redirect(ilLink::_getLink($target_ref_id));
795 }
796
804 function exitSurvey()
805 {
806 if(!$this->preview)
807 {
808 $this->backToRepository();
809 }
810 else
811 {
812 // #12841
813 $this->ctrl->setParameterByClass("ilsurveyeditorgui", "pgov", $_REQUEST["pgov"]);
814 $this->ctrl->redirectByClass(array("ilobjsurveygui", "ilsurveyeditorgui"), "questions");
815 }
816 }
817
827 function outNavigationButtons($navigationblock = "top", $page)
828 {
829 $prevpage = $this->object->getNextPage($page[0]["question_id"], -1);
830 $this->tpl->setCurrentBlock($navigationblock . "_prev");
831 if ($prevpage === 0)
832 {
833 $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_start"));
834 }
835 else
836 {
837 $this->tpl->setVariable("BTN_PREV", $this->lng->txt("survey_previous"));
838 }
839 $this->tpl->parseCurrentBlock();
840 $nextpage = $this->object->getNextPage($page[0]["question_id"], 1);
841 $this->tpl->setCurrentBlock($navigationblock . "_next");
842 if ($nextpage === 1)
843 {
844 $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_finish"));
845 }
846 else
847 {
848 $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("survey_next"));
849 }
850 $this->tpl->parseCurrentBlock();
851 }
852
853 function preview()
854 {
855 $this->outSurveyPage();
856 }
857
859 {
860 global $ilToolbar;
861
862 if(!$this->object->hasViewOwnResults())
863 {
864 $this->backToRepository();
865 }
866
867 $this->checkAuth(false, true);
868
869 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
870 $button = ilLinkButton::getInstance();
871 $button->setCaption("btn_back");
872 $button->setUrl($this->ctrl->getLinkTarget($this, "runShowFinishedPage"));
873 $ilToolbar->addButtonInstance($button);
874
875 $survey_gui = new ilObjSurveyGUI();
876 $html = $survey_gui->getUserResultsTable($_SESSION["finished_id"][$this->object->getId()]);
877 $this->tpl->setContent($html);
878 }
879
881 {
882 if(!$this->object->hasMailOwnResults())
883 {
884 $this->backToRepository();
885 }
886
887 $this->checkAuth(false, true);
888
889 $recipient = $_POST["mail"];
890 if(!ilUtil::is_email($recipient))
891 {
892 $this->ctrl->redirect($this, "runShowFinishedPage");
893 }
894
895 $survey_gui = new ilObjSurveyGUI();
896 $survey_gui->sendUserResultsMail(
897 $_SESSION["finished_id"][$this->object->getId()],
898 $recipient
899 );
900
901 ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
902 $this->ctrl->redirect($this, "runShowFinishedPage");
903 }
904
906 {
907 global $tpl;
908
909 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
910 $cgui = new ilConfirmationGUI();
911 $cgui->setHeaderText($this->lng->txt("survey_execution_sure_finish"));
912
913 $cgui->setFormAction($this->ctrl->getFormAction($this, "confirmedFinish"));
914 $cgui->setCancel($this->lng->txt("cancel"), "previousNoSave");
915 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedFinish");
916
917 $tpl->setContent($cgui->getHTML());
918 }
919
921 {
922 global $ilUser;
923
924 if(!$this->preview)
925 {
926 $this->object->finishSurvey($_SESSION["finished_id"][$this->object->getId()]);
927
928 if ($this->object->getMailNotification())
929 {
930 $this->object->sendNotificationMail($ilUser->getId(),
931 $_SESSION["anonymous_id"][$this->object->getId()],
932 $_SESSION["appr_id"][$this->object->getId()]);
933 }
934 }
935
936 /*
937 unset($_SESSION["anonymous_id"][$this->object->getId()]);
938 unset($_SESSION["appr_id"][$this->object->getId()]);
939 unset($_SESSION["finished_id"][$this->object->getId()]);
940 */
941
942 $this->ctrl->redirect($this, "runShowFinishedPage");
943 }
944}
945?>
$result
$_GET["client_id"]
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
Confirmation screen class.
static getInstance()
Factory.
Class ilObjSurveyGUI.
static validateExternalRaterCode($a_ref_id, $a_code)
static getInstance()
Get instance.
static getInstance()
Factory.
static getInstance()
Factory.
Survey execution graphical output.
outSurveyPage($activepage=NULL, $direction=NULL)
Output of the active survey question to the screen.
previous($a_save_input=true)
Navigates to the previous pages.
ilSurveyExecutionGUI($a_object)
ilSurveyExecutionGUI constructor
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.
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.
runShowFinishedPage()
Creates the finished page for a running survey.
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)
Default behaviour is:
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12
< 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']
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
$error_messages
global $ilUser
Definition: imgupload.php:15