24 include_once 
"./Modules/Survey/classes/inc.SurveyConstants.php";
 
   59                 $this->
object =& $a_object;
 
   67                 $cmd = $this->ctrl->getCmd();
 
   68                 $next_class = $this->ctrl->getNextClass($this);
 
   97                 if ($rbacsystem->checkAccess(
"write", 
$_GET[
"ref_id"]))
 
  109                 $surveycode = $this->
object->getUserAccessCode($ilUser->getId());
 
  110                 if ($this->object->isAnonymizedParticipant($surveycode))
 
  115                 $this->tpl->setVariable(
"TABS", 
"");
 
  116                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_evaluation_checkaccess.html", 
"Modules/Survey");
 
  117                 $this->tpl->setCurrentBlock(
"adm_content");
 
  118                 $this->tpl->setVariable(
"AUTHENTICATION_NEEDED", $this->lng->txt(
"svy_check_evaluation_authentication_needed"));
 
  119                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"checkAnonymizedEvaluationAccess"));
 
  120                 $this->tpl->setVariable(
"EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt(
"svy_check_evaluation_access_introduction"));
 
  121                 $this->tpl->setVariable(
"VALUE_CHECK", $this->lng->txt(
"ok"));
 
  122                 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
 
  123                 $this->tpl->setVariable(
"TEXT_SURVEY_CODE", $this->lng->txt(
"survey_code"));
 
  124                 $this->tpl->parseCurrentBlock();
 
  136                 $surveycode = 
$_POST[
"surveycode"];
 
  137                 if ($this->object->isAnonymizedParticipant($surveycode))
 
  158                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  160                 $path = $tree->getPathFull($this->object->getRefID());
 
  179                 $format_percent = 
"";
 
  180                 $format_datetime = 
"";
 
  184                 switch (
$_POST[
"export_format"])
 
  187                                 include_once 
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
 
  190                                 $workbook = $adapter->getWorkbook();
 
  191                                 $workbook->setVersion(8); 
 
  193                                 $format_bold =& $workbook->addFormat();
 
  194                                 $format_bold->setBold();
 
  195                                 $format_percent =& $workbook->addFormat();
 
  196                                 $format_percent->setNumFormat(
"0.00%");
 
  197                                 $format_datetime =& $workbook->addFormat();
 
  198                                 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
 
  199                                 $format_title =& $workbook->addFormat();
 
  200                                 $format_title->setBold();
 
  201                                 $format_title->setColor(
'black');
 
  202                                 $format_title->setPattern(1);
 
  203                                 $format_title->setFgColor(
'silver');
 
  204                                 $format_title->setAlign(
'center');
 
  206                                 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
 
  207                                 $mainworksheet =& $workbook->addWorksheet();
 
  209                                 switch (
$_POST[
'export_label'])
 
  245                                 switch (
$_POST[
'export_label'])
 
  248                                                 array_push($csvrow, $this->lng->txt(
"label"));
 
  251                                                 array_push($csvrow, $this->lng->txt(
"title"));
 
  254                                                 array_push($csvrow, $this->lng->txt(
"title"));
 
  255                                                 array_push($csvrow, $this->lng->txt(
"label"));
 
  258                                 array_push($csvrow, $this->lng->txt(
"question"));
 
  259                                 array_push($csvrow, $this->lng->txt(
"question_type"));
 
  260                                 array_push($csvrow, $this->lng->txt(
"users_answered"));
 
  261                                 array_push($csvrow, $this->lng->txt(
"users_skipped"));
 
  262                                 array_push($csvrow, $this->lng->txt(
"mode"));
 
  267                                 array_push($csvrow, $this->lng->txt(
"mode_nr_of_selections"));
 
  268                                 array_push($csvrow, $this->lng->txt(
"median"));
 
  269                                 array_push($csvrow, $this->lng->txt(
"arithmetic_mean"));
 
  270                                 array_push($csvfile, $csvrow);
 
  273                 $questions =& $this->
object->getSurveyQuestions();
 
  275                 foreach ($questions as 
$data)
 
  277                         include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  280                         $eval = $this->
object->getCumulatedResults($question);
 
  281                         switch (
$_POST[
"export_format"])
 
  284                                         $counter = $question->setExportCumulatedXLS($mainworksheet, $format_title, $format_bold, $eval, $counter, 
$_POST[
'export_label']);
 
  287                                         $csvrows =& $question->setExportCumulatedCVS($eval, 
$_POST[
'export_label']);
 
  288                                         foreach ($csvrows as $csvrow)
 
  290                                                 array_push($csvfile, $csvrow);
 
  296                                 switch (
$_POST[
"export_format"])
 
  299                                                 $question->setExportDetailsXLS($workbook, $format_title, $format_bold, $eval, 
$_POST[
'export_label']);
 
  305                 switch (
$_POST[
"export_format"])
 
  316                                 foreach ($csvfile as $csvrow)
 
  318                                         $csvrow =& $this->
object->processCSVRow($csvrow, TRUE, 
$separator);
 
  321                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  330                 if (strlen(
$_POST[
"export_format"]))
 
  337                         $this->ctrl->redirect($this, 
'evaluation');
 
  343                 if (strlen(
$_POST[
"export_format"]))
 
  350                         $this->ctrl->redirect($this, 
'evaluation');
 
  357                 $this->ctrl->redirect($this, 
'evaluation');
 
  366                 if (!$rbacsystem->checkAccess(
"read",
$_GET[
"ref_id"]))
 
  371                 switch ($this->object->getEvaluationAccess())
 
  374                                 if (!$rbacsystem->checkAccess(
"write", 
$_GET[
"ref_id"]))
 
  381                                 include_once 
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
 
  389                                 if (($this->object->getAnonymize() == 1) && (
$_SESSION[
"anon_evaluation_access"] != 
$_GET[
"ref_id"]))
 
  397                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_evaluation.html", 
"Modules/Survey");
 
  398                 $questions =& $this->
object->getSurveyQuestions();
 
  401                 foreach ($questions as $qdata)
 
  403                         include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  405                         $question = $question_gui->object;
 
  406                         $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter);
 
  411                                         array_push(
$data, $a);
 
  416                                 array_push(
$data, $c);
 
  421                                 $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter-1);
 
  422                                 $this->tpl->setCurrentBlock(
"detail");
 
  423                                 $this->tpl->setVariable(
"DETAIL", $detail);
 
  424                                 $this->tpl->parseCurrentBlock();
 
  428                 $exporttypes = array(
 
  429                         "excel" => $this->lng->txt(
'exp_type_excel'),
 
  430                         "csv" => $this->lng->txt(
'exp_type_csv')
 
  432                 foreach ($exporttypes as $key => $value)
 
  434                         $this->tpl->setCurrentBlock(
'exportoption');
 
  435                         $this->tpl->setVariable(
'OPTION_VALUE', $key);
 
  437                         $this->tpl->parseCurrentBlock();
 
  440                         array(
"title" => $this->lng->txt(
'export_label_only'), 
'value' => 
'label_only'),
 
  441                         array(
"title" => $this->lng->txt(
'export_title_only'), 
'value' => 
'title_only'),
 
  442                         array(
"title" => $this->lng->txt(
'export_title_label'), 
'value' => 
'title_label')
 
  444                 foreach ($labeldata as $label)
 
  446                         $this->tpl->setCurrentBlock(
"label_option");
 
  447                         $this->tpl->setVariable(
"LABEL_VALUE", $label[
'value']);
 
  449                         $this->tpl->parseCurrentBlock();
 
  453                         $this->tpl->setVariable(
'SUBMIT_CMD', 
'exportDetailData');
 
  457                         $this->tpl->setVariable(
'SUBMIT_CMD', 
'exportData');
 
  459                 $this->tpl->setVariable(
'SUBMIT_VALUE', $this->lng->txt(
"export"));
 
  461                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
 
  463                 $table_gui->setData(
$data);
 
  464                 $this->tpl->setVariable(
'CUMULATED', $table_gui->getHTML());    
 
  465                 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css", 
"print");
 
  466                 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this, 
'evaluation'));
 
  482                 $questions = array();
 
  483                 $questions =& $this->
object->getSurveyQuestions(
true);
 
  484                 array_push($csvrow, $this->lng->txt(
"username"));
 
  485                 if ($this->object->canExportSurveyCode())
 
  487                         array_push($csvrow, $this->lng->txt(
"codes"));
 
  491                         array_push($csvrow, $this->lng->txt(
"gender"));
 
  494                 foreach ($questions as $question_id => $question_data)
 
  496                         include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  498                         $question->addUserSpecificResultsExportTitles($csvrow, $export_label);
 
  499                         $questions[$question_data[
"question_id"]] = $question;
 
  501                 array_push($csvfile, $csvrow);
 
  502                 $participants =& $this->
object->getSurveyFinishedIds();
 
  503                 foreach ($participants as $user_id)
 
  505                         $resultset =& $this->
object->getEvaluationByUser($questions, $user_id);
 
  507                         array_push($csvrow, $resultset[
"name"]);
 
  508                         if ($this->object->canExportSurveyCode())
 
  510                                 array_push($csvrow, $user_id);
 
  514                                 array_push($csvrow, $resultset[
"gender"]);
 
  516                         foreach ($questions as $question_id => $question)
 
  518                                 $question->addUserSpecificResultsData($csvrow, $resultset);
 
  520                         $wt = $this->
object->getWorkingtimeForParticipant($user_id);
 
  521                         array_push($csvrow, $wt);
 
  522                         array_push($csvfile, $csvrow);
 
  524                 switch ($export_format)
 
  527                                 include_once 
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
 
  530                                 $workbook = $adapter->getWorkbook();
 
  531                                 $workbook->setVersion(8); 
 
  533                                 $format_bold =& $workbook->addFormat();
 
  534                                 $format_bold->setBold();
 
  535                                 $format_percent =& $workbook->addFormat();
 
  536                                 $format_percent->setNumFormat(
"0.00%");
 
  537                                 $format_datetime =& $workbook->addFormat();
 
  538                                 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
 
  539                                 $format_title =& $workbook->addFormat();
 
  540                                 $format_title->setBold();
 
  541                                 $format_title->setColor(
'black');
 
  542                                 $format_title->setPattern(1);
 
  543                                 $format_title->setFgColor(
'silver');
 
  544                                 $format_title_plain =& $workbook->addFormat();
 
  545                                 $format_title_plain->setColor(
'black');
 
  546                                 $format_title_plain->setPattern(1);
 
  547                                 $format_title_plain->setFgColor(
'silver');
 
  549                                 $pages = floor((count($csvfile[0])) / 250) + 1;
 
  550                                 $worksheets = array();
 
  551                                 for ($i = 0; $i < $pages; $i++)
 
  553                                         $worksheets[$i] =& $workbook->addWorksheet();
 
  556                                 include_once 
"./Services/Excel/classes/class.ilExcelUtils.php";
 
  557                                 $contentstartrow = 0;
 
  558                                 foreach ($csvfile as $csvrow)
 
  564                                                 $mainworksheet =& $worksheets[$worksheet];
 
  565                                                 foreach ($csvrow as $text)
 
  570                                                                 foreach ($text as $string)
 
  574                                                                         $contentstartrow = max($contentstartrow, $textcount);
 
  586                                                                 $mainworksheet =& $worksheets[$worksheet];
 
  591                                                 $row = $contentstartrow;
 
  596                                                 $mainworksheet =& $worksheets[$worksheet];
 
  597                                                 foreach ($csvrow as $text)
 
  599                                                         if (is_numeric($text))
 
  601                                                                 $mainworksheet->writeNumber(
$row, $col++, $text);
 
  611                                                                 $mainworksheet =& $worksheets[$worksheet];
 
  625                                 foreach ($csvfile as $csvrow)
 
  627                                         $csvrow =& str_replace(
"\n", 
" ", $this->object->processCSVRow($csvrow, TRUE, 
$separator));
 
  630                                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  648                 if (!$ilAccess->checkAccess(
"write", 
"", $this->object->getRefId()))
 
  651                         $this->ctrl->redirectByClass(
"ilObjSurveyGUI", 
"infoScreen");
 
  657                 if (array_key_exists(
"export_format", 
$_POST))
 
  662                 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css", 
"print");
 
  663                 $userResults =& $this->
object->getUserSpecificResults();
 
  665                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_evaluation_user.html", 
"Modules/Survey");
 
  666                 $questions =& $this->
object->getSurveyQuestions(
true);
 
  667                 $participants =& $this->
object->getSurveyParticipants();
 
  668                 $tabledata = array();
 
  669                 foreach ($participants as 
$data)
 
  671                         $questioncounter = 1;
 
  675                         foreach ($questions as $question_id => $question_data)
 
  677                                 $found = $userResults[$question_id][$data[
"active_id"]];
 
  679                                 if (is_array($found))
 
  681                                         $text = implode(
"<br />", $found);
 
  687                                 if (strlen($text) == 0) $text = $this->lng->txt(
"skipped");
 
  688                                 $wt = $this->
object->getWorkingtimeForParticipant($data[
'active_id']);
 
  691                                         array_push($tabledata, array(
 
  692                                                         'username' => $data[
"sortname"],
 
  693                                                         'gender' => $data[
"gender"],
 
  694                                                         'question' => $questioncounter++ . 
". " . $question_data[
"title"],
 
  702                                         array_push($tabledata, array(
 
  705                                                         'question' => $questioncounter++ . 
". " . $question_data[
"title"],
 
  707                                                         'workingtime' => null
 
  712                 $this->tpl->setCurrentBlock(
"generic_css");
 
  713                 $this->tpl->setVariable(
"LOCATION_GENERIC_STYLESHEET", 
"./Modules/Survey/templates/default/evaluation_print.css");
 
  714                 $this->tpl->setVariable(
"MEDIA_GENERIC_STYLESHEET", 
"print");
 
  715                 $this->tpl->parseCurrentBlock();
 
  717                         array(
"title" => $this->lng->txt(
'export_label_only'), 
'value' => 
'label_only'),
 
  718                         array(
"title" => $this->lng->txt(
'export_title_only'), 
'value' => 
'title_only'),
 
  719                         array(
"title" => $this->lng->txt(
'export_title_label'), 
'value' => 
'title_label')
 
  721                 foreach ($labeldata as $label)
 
  723                         $this->tpl->setCurrentBlock(
"label_option");
 
  724                         $this->tpl->setVariable(
"LABEL_VALUE", $label[
'value']);
 
  726                         $this->tpl->parseCurrentBlock();
 
  728                 $this->tpl->setCurrentBlock(
"adm_content");
 
  729                 $this->tpl->setVariable(
"EXPORT_DATA", $this->lng->txt(
"export_data_as"));
 
  730                 $this->tpl->setVariable(
"TEXT_EXCEL", $this->lng->txt(
"exp_type_excel"));
 
  731                 $this->tpl->setVariable(
"TEXT_CSV", $this->lng->txt(
"exp_type_csv"));
 
  732                 $this->tpl->setVariable(
"BTN_EXPORT", $this->lng->txt(
"export"));
 
  733                 $this->tpl->setVariable(
"BTN_PRINT", $this->lng->txt(
"print"));
 
  734                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"evaluationuser"));
 
  735                 $this->tpl->setVariable(
"PRINT_ACTION", $this->ctrl->getFormAction($this, 
"evaluationuser"));
 
  736                 $this->tpl->setVariable(
"CMD_EXPORT", 
"evaluationuser");
 
  737                 include_once 
"./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
 
  739                 $table_gui->
setData($tabledata);
 
  740                 $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());        
 
  741                 $this->tpl->parseCurrentBlock();
 
  751                 $survey_id = 
$_GET[
"survey"];
 
  752                 $question_id = 
$_GET[
"question"];
 
  753                 $type = (strlen(
$_GET[
"type"])) ? 
$_GET[
"type"] : 
"";
 
  754                 $question =& $this->
object->_instanciateQuestion($question_id);
 
  755                 $question->outChart($survey_id, $type);