function evaluation($details = 0)
 {
     global $rbacsystem, $ilToolbar;
     // auth
     if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
         if (!$rbacsystem->checkAccess("read", $_GET["ref_id"])) {
             ilUtil::sendFailure($this->lng->txt("permission_denied"));
             return;
         }
         switch ($this->object->getEvaluationAccess()) {
             case ilObjSurvey::EVALUATION_ACCESS_OFF:
                 ilUtil::sendFailure($this->lng->txt("permission_denied"));
                 return;
             case ilObjSurvey::EVALUATION_ACCESS_ALL:
             case ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS:
                 if (!$this->checkAnonymizedEvaluationAccess()) {
                     ilUtil::sendFailure($this->lng->txt("permission_denied"));
                     return;
                 }
                 break;
         }
     }
     $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", "Modules/Survey");
     $data = null;
     if ($this->object->get360Mode()) {
         $appr_id = $this->getAppraiseeId();
         $this->addApprSelectionToToolbar();
     }
     if (!$this->object->get360Mode() || $appr_id) {
         $format = new ilSelectInputGUI("", "export_format");
         $format->setOptions(array(self::TYPE_XLS => $this->lng->txt('exp_type_excel'), self::TYPE_SPSS => $this->lng->txt('exp_type_csv')));
         $ilToolbar->addInputItem($format);
         $label = new ilSelectInputGUI("", "export_label");
         $label->setOptions(array('label_only' => $this->lng->txt('export_label_only'), 'title_only' => $this->lng->txt('export_title_only'), 'title_label' => $this->lng->txt('export_title_label')));
         $ilToolbar->addInputItem($label);
         include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
         $button = ilSubmitButton::getInstance();
         $button->setCaption("export");
         if ($details) {
             $button->setCommand('exportDetailData');
         } else {
             $button->setCommand('exportData');
         }
         $button->setOmitPreventDoubleSubmission(true);
         $ilToolbar->addButtonInstance($button);
         $finished_ids = null;
         if ($appr_id) {
             $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
             if (!sizeof($finished_ids)) {
                 $finished_ids = array(-1);
             }
         }
         $questions =& $this->object->getSurveyQuestions();
         $data = array();
         $counter = 1;
         $last_questionblock_id = null;
         foreach ($questions as $qdata) {
             include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
             $question_gui = SurveyQuestion::_instanciateQuestionGUI($qdata["question_id"]);
             $question = $question_gui->object;
             $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter, $finished_ids);
             if (is_array($c[0])) {
                 // keep only "main" entry - sub-items will be handled in tablegui
                 // this will enable proper sorting
                 $main = array_shift($c);
                 $main["subitems"] = $c;
                 array_push($data, $main);
             } else {
                 array_push($data, $c);
             }
             $counter++;
             if ($details) {
                 // questionblock title handling
                 if ($qdata["questionblock_id"] && $qdata["questionblock_id"] != $last_questionblock_id) {
                     $qblock = $this->object->getQuestionblock($qdata["questionblock_id"]);
                     if ($qblock["show_blocktitle"]) {
                         $this->tpl->setCurrentBlock("detail_qblock");
                         $this->tpl->setVariable("BLOCKTITLE", $qdata["questionblock_title"]);
                         $this->tpl->parseCurrentBlock();
                     }
                     $last_questionblock_id = $qdata["questionblock_id"];
                 }
                 $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter - 1, $finished_ids);
                 $this->tpl->setCurrentBlock("detail");
                 $this->tpl->setVariable("DETAIL", $detail);
                 $this->tpl->parseCurrentBlock();
             }
         }
     }
     include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
     $table_gui = new ilSurveyResultsCumulatedTableGUI($this, $details ? 'evaluationdetails' : 'evaluation', $detail);
     $table_gui->setData($data);
     $this->tpl->setVariable('CUMULATED', $table_gui->getHTML());
     $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
     $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'evaluation'));
 }
 function evaluation($details = 0)
 {
     global $ilUser;
     global $rbacsystem;
     global $ilias;
     global $ilToolbar;
     if (!$rbacsystem->checkAccess("read", $_GET["ref_id"])) {
         ilUtil::sendFailure($this->lng->txt("permission_denied"));
         return;
     }
     $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $format = new ilSelectInputGUI("", "export_format");
     $format->setOptions(array("excel" => $this->lng->txt('exp_type_excel'), "csv" => $this->lng->txt('exp_type_csv')));
     $ilToolbar->addInputItem($format);
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $label = new ilSelectInputGUI("", "export_label");
     $label->setOptions(array('label_only' => $this->lng->txt('export_label_only'), 'title_only' => $this->lng->txt('export_title_only'), 'title_label' => $this->lng->txt('export_title_label')));
     $ilToolbar->addInputItem($label);
     if ($details) {
         $ilToolbar->addFormButton($this->lng->txt("export"), 'exportDetailData');
     } else {
         $ilToolbar->addFormButton($this->lng->txt("export"), 'exportData');
     }
     switch ($this->object->getEvaluationAccess()) {
         case EVALUATION_ACCESS_OFF:
             if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
                 ilUtil::sendFailure($this->lng->txt("permission_denied"));
                 return;
             }
             break;
         case EVALUATION_ACCESS_ALL:
             include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
             if (!($rbacsystem->checkAccess("write", $_GET["ref_id"]) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId()))) {
                 ilUtil::sendFailure($this->lng->txt("permission_denied"));
                 return;
             }
             break;
         case EVALUATION_ACCESS_PARTICIPANTS:
             if ($this->object->getAnonymize() == 1 && $_SESSION["anon_evaluation_access"] != $_GET["ref_id"]) {
                 $this->checkAnonymizedEvaluationAccess();
                 return;
             }
             break;
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", "Modules/Survey");
     $questions =& $this->object->getSurveyQuestions();
     $data = array();
     $counter = 1;
     $last_questionblock_id = null;
     foreach ($questions as $qdata) {
         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
         $question_gui = SurveyQuestion::_instanciateQuestionGUI($qdata["question_id"]);
         $question = $question_gui->object;
         $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter);
         if (is_array($c[0])) {
             foreach ($c as $a) {
                 array_push($data, $a);
             }
         } else {
             array_push($data, $c);
         }
         $counter++;
         if ($details) {
             // questionblock title handling
             if ($qdata["questionblock_id"] && $qdata["questionblock_id"] != $last_questionblock_id) {
                 $qblock = $this->object->getQuestionblock($qdata["questionblock_id"]);
                 if ($qblock["show_blocktitle"]) {
                     $this->tpl->setCurrentBlock("detail_qblock");
                     $this->tpl->setVariable("BLOCKTITLE", $qdata["questionblock_title"]);
                     $this->tpl->parseCurrentBlock();
                 }
                 $last_questionblock_id = $qdata["questionblock_id"];
             }
             $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter - 1);
             $this->tpl->setCurrentBlock("detail");
             $this->tpl->setVariable("DETAIL", $detail);
             $this->tpl->parseCurrentBlock();
         }
     }
     include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
     $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $detail);
     $table_gui->setData($data);
     $this->tpl->setVariable('CUMULATED', $table_gui->getHTML());
     $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
     $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'evaluation'));
 }