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');
367 if (!$rbacsystem->checkAccess(
"read",
$_GET[
"ref_id"]))
373 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
375 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
377 $format->setOptions(array(
378 "excel" => $this->lng->txt(
'exp_type_excel'),
379 "csv" => $this->lng->txt(
'exp_type_csv')
381 $ilToolbar->addInputItem($format);
383 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
385 $label->setOptions(array(
386 'label_only' => $this->lng->txt(
'export_label_only'),
387 'title_only' => $this->lng->txt(
'export_title_only'),
388 'title_label'=> $this->lng->txt(
'export_title_label')
390 $ilToolbar->addInputItem($label);
394 $ilToolbar->addFormButton($this->lng->txt(
"export"),
'exportDetailData');
398 $ilToolbar->addFormButton($this->lng->txt(
"export"),
'exportData');
401 switch ($this->object->getEvaluationAccess())
404 if (!$rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
411 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
419 if (($this->object->getAnonymize() == 1) && (
$_SESSION[
"anon_evaluation_access"] !=
$_GET[
"ref_id"]))
427 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation.html",
"Modules/Survey");
428 $questions =& $this->
object->getSurveyQuestions();
431 $last_questionblock_id = null;
432 foreach ($questions as $qdata)
434 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
436 $question = $question_gui->object;
437 $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter);
442 array_push(
$data, $a);
447 array_push(
$data, $c);
453 if($qdata[
"questionblock_id"] && $qdata[
"questionblock_id"] != $last_questionblock_id)
455 $qblock = $this->
object->getQuestionblock($qdata[
"questionblock_id"]);
456 if($qblock[
"show_blocktitle"])
458 $this->tpl->setCurrentBlock(
"detail_qblock");
459 $this->tpl->setVariable(
"BLOCKTITLE", $qdata[
"questionblock_title"]);
460 $this->tpl->parseCurrentBlock();
463 $last_questionblock_id = $qdata[
"questionblock_id"];
466 $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter-1);
467 $this->tpl->setCurrentBlock(
"detail");
468 $this->tpl->setVariable(
"DETAIL", $detail);
469 $this->tpl->parseCurrentBlock();
473 include_once
"./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
475 $table_gui->setData(
$data);
476 $this->tpl->setVariable(
'CUMULATED', $table_gui->getHTML());
477 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
478 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this,
'evaluation'));
494 $questions = array();
495 $questions =& $this->
object->getSurveyQuestions(
true);
496 array_push($csvrow, $this->lng->txt(
"username"));
497 array_push($csvrow, $this->lng->txt(
"login"));
498 if ($this->object->canExportSurveyCode())
500 array_push($csvrow, $this->lng->txt(
"codes"));
504 array_push($csvrow, $this->lng->txt(
"gender"));
507 foreach ($questions as $question_id => $question_data)
509 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
511 $question->addUserSpecificResultsExportTitles($csvrow, $export_label);
512 $questions[$question_data[
"question_id"]] = $question;
514 array_push($csvfile, $csvrow);
515 $participants =& $this->
object->getSurveyFinishedIds();
516 foreach ($participants as $user_id)
518 $resultset =& $this->
object->getEvaluationByUser($questions, $user_id);
520 array_push($csvrow, $resultset[
"name"]);
521 array_push($csvrow, $resultset[
"login"]);
522 if ($this->object->canExportSurveyCode())
524 array_push($csvrow, $user_id);
528 array_push($csvrow, $resultset[
"gender"]);
530 foreach ($questions as $question_id => $question)
532 $question->addUserSpecificResultsData($csvrow, $resultset);
534 $wt = $this->
object->getWorkingtimeForParticipant($user_id);
535 array_push($csvrow, $wt);
536 array_push($csvfile, $csvrow);
538 switch ($export_format)
541 include_once
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
544 $workbook = $adapter->getWorkbook();
545 $workbook->setVersion(8);
547 $format_bold =& $workbook->addFormat();
548 $format_bold->setBold();
549 $format_percent =& $workbook->addFormat();
550 $format_percent->setNumFormat(
"0.00%");
551 $format_datetime =& $workbook->addFormat();
552 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
553 $format_title =& $workbook->addFormat();
554 $format_title->setBold();
555 $format_title->setColor(
'black');
556 $format_title->setPattern(1);
557 $format_title->setFgColor(
'silver');
558 $format_title_plain =& $workbook->addFormat();
559 $format_title_plain->setColor(
'black');
560 $format_title_plain->setPattern(1);
561 $format_title_plain->setFgColor(
'silver');
563 $pages = floor((count($csvfile[0])) / 250) + 1;
564 $worksheets = array();
565 for ($i = 0; $i < $pages; $i++)
567 $worksheets[$i] =& $workbook->addWorksheet();
570 include_once
"./Services/Excel/classes/class.ilExcelUtils.php";
571 $contentstartrow = 0;
572 foreach ($csvfile as $csvrow)
578 $mainworksheet =& $worksheets[$worksheet];
579 foreach ($csvrow as $text)
584 foreach ($text as $string)
588 $contentstartrow = max($contentstartrow, $textcount);
600 $mainworksheet =& $worksheets[$worksheet];
605 $row = $contentstartrow;
610 $mainworksheet =& $worksheets[$worksheet];
611 foreach ($csvrow as $text)
613 if (is_numeric($text))
615 $mainworksheet->writeNumber(
$row, $col++, $text);
625 $mainworksheet =& $worksheets[$worksheet];
639 foreach ($csvfile as $csvrow)
641 $csvrow =& str_replace(
"\n",
" ", $this->object->processCSVRow($csvrow, TRUE,
$separator));
644 include_once
"./Services/Utilities/classes/class.ilUtil.php";
660 global $ilAccess,
$ilLog, $ilToolbar;
662 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
665 $this->ctrl->redirectByClass(
"ilObjSurveyGUI",
"infoScreen");
671 if (array_key_exists(
"export_format",
$_POST))
676 $userResults =& $this->
object->getUserSpecificResults();
677 $questions =& $this->
object->getSurveyQuestions(
true);
678 $participants =& $this->
object->getSurveyParticipants();
679 $tabledata = array();
680 foreach ($participants as
$data)
682 $questioncounter = 1;
686 foreach ($questions as $question_id => $question_data)
688 $found = $userResults[$question_id][$data[
"active_id"]];
690 if (is_array($found))
692 $text = implode(
"<br />", $found);
698 if (strlen($text) == 0) $text = $this->lng->txt(
"skipped");
699 $wt = $this->
object->getWorkingtimeForParticipant($data[
'active_id']);
702 array_push($tabledata, array(
703 'username' => $data[
"sortname"],
704 'gender' => $data[
"gender"],
705 'question' => $questioncounter++ .
". " . $question_data[
"title"],
713 array_push($tabledata, array(
716 'question' => $questioncounter++ .
". " . $question_data[
"title"],
718 'workingtime' => null
724 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
725 $this->tpl->setCurrentBlock(
"generic_css");
726 $this->tpl->setVariable(
"LOCATION_GENERIC_STYLESHEET",
"./Modules/Survey/templates/default/evaluation_print.css");
727 $this->tpl->setVariable(
"MEDIA_GENERIC_STYLESHEET",
"print");
728 $this->tpl->parseCurrentBlock();
730 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"evaluationuser"));
732 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
734 $format->setOptions(array(
735 "excel" => $this->lng->txt(
'exp_type_excel'),
736 "csv" => $this->lng->txt(
'exp_type_csv')
738 $ilToolbar->addInputItem($format);
740 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
742 $label->setOptions(array(
743 'label_only' => $this->lng->txt(
'export_label_only'),
744 'title_only' => $this->lng->txt(
'export_title_only'),
745 'title_label'=> $this->lng->txt(
'export_title_label')
747 $ilToolbar->addInputItem($label);
749 $ilToolbar->addFormButton($this->lng->txt(
"export"),
'evaluationuser');
751 $ilToolbar->addSeparator();
753 $ilToolbar->addButton($this->lng->txt(
"print"),
"#",
"",
"",
"onclick=\"javascript:window.print()\"");
755 include_once
"./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
757 $table_gui->
setData($tabledata);
758 $this->tpl->setContent($table_gui->getHTML());