70 $this->tabs =
$DIC->tabs();
71 $this->access =
$DIC->access();
72 $this->
user = $DIC->user();
73 $this->rbacsystem =
$DIC->rbac()->system();
74 $this->tree =
$DIC->repositoryTree();
75 $this->toolbar =
$DIC->toolbar();
76 $this->
ui = $DIC->ui();
84 $this->
object = $a_object;
86 $this->array_panels = array();
99 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
100 $cmd = $this->ctrl->getCmd(
"competenceEval");
102 $cmd = $this->ctrl->getCmd(
"evaluation");
105 $next_class = $this->ctrl->getNextClass($this);
109 $this->log->debug($cmd);
111 switch ($next_class) {
113 $this->setEvalSubTabs();
114 $ret = &$this->$cmd();
136 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
137 $ilTabs->addSubTabTarget(
138 "svy_eval_competences",
139 $this->ctrl->getLinkTarget($this,
"competenceEval"),
140 array(
"competenceEval")
144 $ilTabs->addSubTabTarget(
145 "svy_eval_cumulated",
146 $this->ctrl->getLinkTarget($this,
"evaluation"),
147 array(
"evaluation",
"checkEvaluationAccess")
150 $ilTabs->addSubTabTarget(
152 $this->ctrl->getLinkTarget($this,
"evaluationdetails"),
153 array(
"evaluationdetails")
157 $ilTabs->addSubTabTarget(
159 $this->ctrl->getLinkTarget($this,
"evaluationuser"),
160 array(
"evaluationuser")
173 $this->appr_id = $a_val;
197 if ($_REQUEST[
"appr_id"] ==
"") {
198 $req_appr_id =
$ilUser->getId();
200 $req_appr_id = (int) $_REQUEST[
"appr_id"];
204 if ($req_appr_id > 0 && $this->object->get360Mode()) {
208 foreach ($this->object->getAppraiseesData() as $item) {
209 if ($item[
"closed"] &&
210 ($item[
"user_id"] ==
$ilUser->getId() ||
211 $rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
213 $valid[] = $item[
"user_id"];
216 if (in_array($req_appr_id,
$valid)) {
226 $this->ctrl->setParameter($this,
"appr_id",
$appr_id);
242 if ($this->object->getAnonymize() == 1 &&
248 if ($this->object->getAnonymize() == 1) {
254 if ($this->object->getAnonymize() == 1) {
256 $surveycode = $this->
object->getUserAccessCode(
$ilUser->getId());
257 if ($this->object->isAnonymizedParticipant($surveycode)) {
271 $this->tpl->setVariable(
"TABS",
"");
272 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation_checkaccess.html",
"Modules/Survey");
273 $this->tpl->setCurrentBlock(
"adm_content");
274 $this->tpl->setVariable(
"AUTHENTICATION_NEEDED", $this->lng->txt(
"svy_check_evaluation_authentication_needed"));
275 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"checkEvaluationAccess"));
276 $this->tpl->setVariable(
"EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt(
"svy_check_evaluation_access_introduction"));
277 $this->tpl->setVariable(
"VALUE_CHECK", $this->lng->txt(
"ok"));
278 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
279 $this->tpl->setVariable(
"TEXT_SURVEY_CODE", $this->lng->txt(
"survey_code"));
280 $this->tpl->parseCurrentBlock();
283 $_SESSION[
"anon_evaluation_access"] =
null;
296 $surveycode =
$_POST[
"surveycode"];
297 if ($this->object->isAnonymizedParticipant($surveycode)) {
317 $path =
$tree->getPathFull($this->object->getRefID());
321 $path[count($path) - 2][
"child"]
323 $ilCtrl->redirectByClass(
"ilrepositorygui",
"frameset");
340 $finished_ids =
null;
341 if ($this->object->get360Mode()) {
344 $this->ctrl->redirect($this, $details ?
"evaluationdetails" :
"evaluation");
346 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
347 if (!
sizeof($finished_ids)) {
348 $finished_ids = array(-1);
353 $title_row = array();
354 $do_title = $do_label =
true;
355 switch (
$_POST[
'export_label']) {
357 $title_row[] = $this->lng->txt(
"label");
362 $title_row[] = $this->lng->txt(
"title");
367 $title_row[] = $this->lng->txt(
"title");
368 $title_row[] = $this->lng->txt(
"label");
371 $title_row[] = $this->lng->txt(
"question");
372 $title_row[] = $this->lng->txt(
"question_type");
373 $title_row[] = $this->lng->txt(
"users_answered");
374 $title_row[] = $this->lng->txt(
"users_skipped");
375 $title_row[] = $this->lng->txt(
"mode");
376 $title_row[] = $this->lng->txt(
"mode_text");
377 $title_row[] = $this->lng->txt(
"mode_nr_of_selections");
378 $title_row[] = $this->lng->txt(
"median");
379 $title_row[] = $this->lng->txt(
"arithmetic_mean");
382 switch (
$_POST[
"export_format"]) {
385 $excel->addSheet($this->lng->txt(
"svy_eval_cumulated"));
386 $excel->setCellArray(array($title_row),
"A1");
387 $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof($title_row) - 1) .
"1");
391 $csvfile = array($title_row);
398 foreach ($this->object->getSurveyQuestions() as $qdata) {
400 $q_res = $q_eval->getResults();
401 $ov_rows = $q_eval->exportResults($q_res, $do_title, $do_label);
403 switch (
$_POST[
"export_format"]) {
405 $excel->setActiveSheet(0);
406 foreach ($ov_rows as $row) {
407 foreach ($row as $col => $value) {
408 $excel->setCell($ov_row, $col, $value);
415 foreach ($ov_rows as $row) {
422 switch (
$_POST[
"export_format"]) {
432 ? $this->lng->txt(
"svy_eval_cumulated")
433 : $this->lng->txt(
"svy_eval_detail");
435 $surveyname = $this->
object->getTitle() .
" " .
$type .
" " . date(
"Y-m-d");
436 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
440 switch (
$_POST[
"export_format"]) {
442 $excel->sendToClient($surveyname);
448 foreach ($csvfile as $csvrow) {
450 $csv .= join($separator, $csvrow) .
"\n";
469 $question_res = $a_results;
471 if (is_array($question_res)) {
472 $question_res = $question_res[0][1];
475 $question = $question_res->getQuestion();
477 $a_excel->
addSheet($question->getTitle());
485 $kv[$this->lng->txt(
"title")] = $question->getTitle();
488 $kv[$this->lng->txt(
"label")] = $question->label;
492 $kv[$this->lng->txt(
"question")] = $question->getQuestiontext();
500 $kv[$this->lng->txt(
"users_answered")] = (int) $question_res->getUsersAnswered();
501 $kv[$this->lng->txt(
"users_skipped")] = (int) $question_res->getUsersSkipped();
505 foreach ($kv as $key => $value) {
506 $a_excel->
setCell($excel_row, 0, $key);
507 $a_excel->
setCell($excel_row++, 1, $value);
532 foreach ($a_results as $row_results) {
533 $row_title = $row_results[0];
535 $a_excel->
setCell($excel_row, 0, $this->lng->txt(
"row"));
536 $a_excel->
setCell($excel_row++, 1, $row_title);
543 is_array($texts[$row_title])
544 ? array(
"" => $texts[$row_title])
552 $a_excel->
setCell($excel_row++, 0, $this->lng->txt(
"overview"));
556 $cats = $question->getColumns();
557 foreach ($cats->getCategories() as $cat) {
559 $a_excel->
setCell($excel_row, 1 + $counter, $cat->title);
564 foreach ($a_results as $row_results) {
565 $row_title = $row_results[0];
567 $a_excel->
setCell($excel_row, 0, $row_title);
569 $vars = $row_results[1]->getVariables();
571 foreach ($vars as $var) {
572 $a_excel->
setCell($excel_row, ++$counter, $var->abs);
580 $a_excel->
setBold(
"A1:A" . $excel_row);
587 if ($a_include_mode) {
590 $kv[$this->lng->txt(
"mode")] = is_array($a_results->
getModeValue())
602 if ($a_results->
getMean() !==
null) {
603 $kv[$this->lng->txt(
"arithmetic_mean")] = $a_results->
getMean();
607 foreach ($kv as $key => $value) {
608 $a_excel->
setCell($a_excel_row, 0, $key);
609 $a_excel->
setCell($a_excel_row++, 1, $value);
616 $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"categories"));
617 foreach ($a_grid[
"cols"] as $col_idx => $col) {
618 $a_excel->
setCell($a_excel_row, $col_idx + 1, $col);
623 foreach ($a_grid[
"rows"] as
$cols) {
624 foreach (
$cols as $col_idx => $col) {
625 $a_excel->
setCell($a_excel_row, $col_idx + 1, $col);
632 if ($a_text_answers) {
634 $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"freetext_answers"));
637 if (!is_array($a_text_answers[
""])) {
639 $a_excel->
setCell($a_excel_row, 1, $this->lng->txt(
"title"));
640 $a_excel->
setCell($a_excel_row++, 2, $this->lng->txt(
"answer"));
645 $a_excel->
setCell($a_excel_row++, 1, $this->lng->txt(
"answer"));
648 foreach ($a_text_answers as $var => $items) {
649 foreach ($items as $item) {
650 if (!is_array($a_text_answers[
""])) {
651 $a_excel->
setCell($a_excel_row, 1, $var);
652 $a_excel->
setCell($a_excel_row++, 2, $item);
654 $a_excel->
setCell($a_excel_row++, 1, $item);
663 if (strlen(
$_POST[
"export_format"])) {
667 $this->ctrl->redirect($this,
'evaluation');
673 if (strlen(
$_POST[
"export_format"])) {
677 $this->ctrl->redirect($this,
'evaluation');
684 $this->ctrl->redirect($this,
'evaluation');
691 $form_id =
"svymdfrm";
694 $tpl->addOnLoadCode(
'$("#form_' . $form_id .
'").submit(function() { $("#' . $a_id .
'").modal("hide"); });');
697 $modal->setId($a_id);
698 $modal->setHeading(($this->lng->txt(
"svy_export_format")));
701 $form->setId($form_id);
702 $form->setFormAction($this->ctrl->getFormAction($this, $a_cmd));
706 self::TYPE_XLS => $this->lng->txt(
'exp_type_excel'),
712 $label->setOptions(array(
713 'label_only' => $this->lng->txt(
'export_label_only'),
714 'title_only' => $this->lng->txt(
'export_title_only'),
715 'title_label' => $this->lng->txt(
'export_title_label')
717 $form->addItem($label);
719 $form->addCommandButton($a_cmd, $this->lng->txt(
"export"));
720 $form->setPreventDoubleSubmission(
false);
722 $modal->setBody($form->getHTML());
724 return $modal->getHTML();
727 public function evaluation($details = 0, $pdf =
false, $return_pdf =
false)
734 $ui_factory = $ui->factory();
735 $ui_renderer = $ui->renderer();
737 $this->log->debug(
"check access");
741 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
746 switch ($this->object->getEvaluationAccess()) {
761 $this->log->debug(
"check access ok");
764 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
767 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation.html",
"Modules/Survey");
769 if ($this->object->get360Mode()) {
775 if (!$this->object->get360Mode() ||
$appr_id) {
777 $captions =
new ilSelectInputGUI($this->lng->txt(
"svy_eval_captions"),
"cp");
778 $captions->setOptions(array(
779 "ap" => $this->lng->txt(
"svy_eval_captions_abs_perc"),
780 "a" => $this->lng->txt(
"svy_eval_captions_abs"),
781 "p" => $this->lng->txt(
"svy_eval_captions_perc")
783 $captions->setValue(
$_POST[
"cp"]);
784 $ilToolbar->addInputItem($captions,
true);
787 $view->setOptions(array(
788 "tc" => $this->lng->txt(
"svy_eval_view_tables_charts"),
789 "t" => $this->lng->txt(
"svy_eval_view_tables"),
790 "c" => $this->lng->txt(
"svy_eval_view_charts")
792 $view->setValue(
$_POST[
"vw"]);
793 $ilToolbar->addInputItem($view,
true);
796 $button->setCaption(
"ok");
797 $button->setCommand(
"evaluationdetails");
798 $button->setOmitPreventDoubleSubmission(
true);
799 $ilToolbar->addButtonInstance($button);
801 $ilToolbar->addSeparator();
804 $dtmpl =
new ilTemplate(
"tpl.il_svy_svy_results_details.html",
true,
true,
"Modules/Survey");
805 $toc_tpl =
new ilTemplate(
"tpl.svy_results_table_contents.html",
true,
true,
"Modules/Survey");
806 $this->lng->loadLanguageModule(
"content");
807 $toc_tpl->setVariable(
"TITLE_TOC", $this->lng->txt(
'cont_toc'));
811 $modal_id =
"svy_ev_exp";
817 $button->setCaption(
"export");
818 $button->setOnClick(
'$(\'#' . $modal_id .
'\').modal(\
'show\')');
819 $ilToolbar->addButtonInstance($button);
821 $ilToolbar->addSeparator();
824 $button->setCaption(
"print");
825 $button->setOnClick(
"if(il.Accordion) { il.Accordion.preparePrint(); } window.print(); return false;");
826 $button->setOmitPreventDoubleSubmission(
true);
827 $ilToolbar->addButtonInstance($button);
830 $this->ctrl->setParameter($this,
"cp",
$_POST[
"cp"]);
831 $this->ctrl->setParameter($this,
"vw",
$_POST[
"vw"]);
832 $url = $this->ctrl->getLinkTarget($this, $details
833 ?
"evaluationdetailspdf"
835 $this->ctrl->setParameter($this,
"cp",
"");
836 $this->ctrl->setParameter($this,
"vw",
"");
838 $button->setCaption(
"svy_export_pdf");
839 $button->setUrl(
$url);
840 $button->setOmitPreventDoubleSubmission(
true);
841 $ilToolbar->addButtonInstance($button);
844 $finished_ids =
null;
846 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
847 if (!
sizeof($finished_ids)) {
848 $finished_ids = array(-1);
852 $details_figure =
$_POST[
"cp"]
855 $details_view =
$_POST[
"vw"]
861 $finished_ids2 = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
864 $this->object->getRefId(),
865 (array) $finished_ids
871 foreach ($this->object->getSurveyQuestions() as $qdata) {
873 $q_res = $q_eval->getResults();
878 $this->
renderDetails($details_view, $details_figure, $qdata, $q_eval, $q_res, $pdf);
881 if ($qdata[
"questionblock_id"] &&
882 $qdata[
"questionblock_id"] != $this->last_questionblock_id) {
884 if ($qblock[
"show_blocktitle"]) {
885 $list->addListNode($qdata[
"questionblock_title"],
"q" . $qdata[
"questionblock_id"]);
887 $list->addListNode(
"",
"q" . $qdata[
"questionblock_id"]);
889 $this->last_questionblock_id = $qdata[
"questionblock_id"];
891 $anchor_id =
"svyrdq" . $qdata[
"question_id"];
892 $list->addListNode(
"<a href='#" . $anchor_id .
"'>" . $qdata[
"title"] .
"</a>", $qdata[
"question_id"], $qdata[
"questionblock_id"] ?
893 "q" . $qdata[
"questionblock_id"] : 0);
898 $list->setListClass(
"il_Explorer");
899 $toc_tpl->setVariable(
"LIST", $list->getHTML());
902 $panel_toc = $ui_factory->panel()->standard(
"", $ui_factory->legacy($toc_tpl->get()));
903 $render_toc = $ui_renderer->render($panel_toc);
904 $dtmpl->setVariable(
"PANEL_TOC", $render_toc);
908 $panel_report = $ui_factory->panel()->report($report_title, $this->array_panels);
909 $render_report = $ui_renderer->render($panel_report);
910 $dtmpl->setVariable(
"PANEL_REPORT", $render_report);
913 $this->tpl->setVariable(
'DETAIL', $dtmpl->get());
917 $this->tpl->setVariable(
'MODAL', $modal);
920 $this->tpl->setVariable(
'CUMULATED', $table_gui->getHTML());
930 $path_full =
$tree->getPathFull($this->object->getRefId());
931 foreach ($path_full as
$data) {
932 $path .=
" » ";
933 $path .=
$data[
'title'];
940 $this->lng->txt(
"path") => $path,
941 $this->lng->txt(
"svy_results") => !$details
942 ? $this->lng->txt(
"svy_eval_cumulated")
943 : $this->lng->txt(
"svy_eval_detail"),
947 $this->tpl->setCurrentBlock(
"print_header_bl");
948 foreach ($props as $key => $value) {
949 $this->tpl->setVariable(
"HEADER_PROP_KEY", $key);
950 $this->tpl->setVariable(
"HEADER_PROP_VALUE", $value);
951 $this->tpl->parseCurrentBlock();
954 $this->log->debug(
"end");
956 $html = $this->tpl->printToString();
980 $ui_factory = $this->
ui->factory();
981 $a_tpl =
new ilTemplate(
"tpl.svy_results_details_panel.html",
true,
true,
"Modules/Survey");
983 $question_res = $a_results;
985 if (is_array($question_res)) {
986 $question_res = $question_res[0][1];
991 if (!is_object($question_res)) {
995 $question = $question_res->getQuestion();
1004 $kv[
"users_answered"] = $question_res->getUsersAnswered();
1005 $kv[
"users_skipped"] = $question_res->getUsersSkipped();
1008 if ($question_res->getModeValue() !==
null) {
1009 $kv[
"mode"] = wordwrap($question_res->getModeValueAsText(), 50,
"<br />");
1010 $kv[
"mode_nr_of_selections"] = $question_res->getModeNrOfSelections();
1012 if ($question_res->getMedian() !==
null) {
1013 $kv[
"median"] = $question_res->getMedianAsText();
1015 if ($question_res->getMean() !==
null) {
1016 $kv[
"arithmetic_mean"] = $question_res->getMean();
1021 $qst_title = $question->getTitle();
1022 $svy_text = nl2br($question->getQuestiontext());
1023 $card_table_tpl =
new ilTemplate(
"tpl.svy_results_details_card.html",
true,
true,
"Modules/Survey");
1024 foreach ($kv as $key => $value) {
1025 $card_table_tpl->setCurrentBlock(
"question_statistics_card");
1026 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_KEY", $this->lng->txt($key));
1027 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_VALUE", $value);
1028 $card_table_tpl->parseCurrentBlock();
1032 $anchor_id =
"svyrdq" . $question->getId();
1033 $title =
"<span id='$anchor_id'>$qst_title</span>";
1034 $panel_qst_card = $ui_factory->panel()->sub($title, $ui_factory->legacy($svy_text))
1035 ->withCard($ui_factory->card()->standard($svy_type_title)->withSections(array($ui_factory->legacy($card_table_tpl->get()))));
1042 array_push($this->array_panels, $panel_qst_card);
1045 if ($a_details_parts ==
"t" ||
1046 $a_details_parts ==
"tc") {
1049 ($a_details_figure ==
"ap" || $a_details_figure ==
"a"),
1050 ($a_details_figure ==
"ap" || $a_details_figure ==
"p")
1053 foreach ($grid[
"cols"] as $col) {
1054 $a_tpl->setCurrentBlock(
"grid_col_header_bl");
1055 $a_tpl->setVariable(
"COL_HEADER", $col);
1056 $a_tpl->parseCurrentBlock();
1058 foreach ($grid[
"rows"] as
$cols) {
1059 foreach (
$cols as $idx => $col) {
1061 $a_tpl->touchBlock(
"grid_col_nowrap_bl");
1064 $a_tpl->setCurrentBlock(
"grid_col_bl");
1065 $a_tpl->setVariable(
"COL_CAPTION", trim($col));
1066 $a_tpl->parseCurrentBlock();
1069 $a_tpl->touchBlock(
"grid_row_bl");
1077 if (array_key_exists(
"", $texts)) {
1078 $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"given_answers"));
1079 foreach ($texts[
""] as $item) {
1080 $a_tpl->setCurrentBlock(
"text_direct_item_bl");
1081 $a_tpl->setVariable(
"TEXT_DIRECT", nl2br(htmlentities($item)));
1082 $a_tpl->parseCurrentBlock();
1087 if (
$_GET[
"pdf"] == 1) {
1090 $acc->setId(
"svyevaltxt" . $question->getId());
1092 $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"freetext_answers"));
1094 foreach ($texts as $var => $items) {
1095 $list = array(
"<ul class=\"small\">");
1096 foreach ($items as $item) {
1097 $list[] =
"<li>" . nl2br(htmlentities($item)) .
"</li>";
1100 $acc->addItem($var, implode(
"\n", $list));
1103 $a_tpl->setVariable(
"TEXT_ACC", $acc->getHTML());
1108 if ($a_details_parts ==
"c" ||
1109 $a_details_parts ==
"tc") {
1110 $chart = $a_eval->
getChart($a_results);
1112 if (is_array($chart)) {
1114 if (is_array($chart[1])) {
1115 foreach ($chart[1] as $legend_item) {
1116 $r = hexdec(substr($legend_item[1], 1, 2));
1117 $g = hexdec(substr($legend_item[1], 3, 2));
1118 $b = hexdec(substr($legend_item[1], 5, 2));
1120 $a_tpl->setCurrentBlock(
"legend_bl");
1121 $a_tpl->setVariable(
"LEGEND_CAPTION", $legend_item[0]);
1122 $a_tpl->setVariable(
"LEGEND_COLOR", $legend_item[1]);
1123 $a_tpl->setVariable(
"LEGEND_COLOR_SVG", $r .
"," . $g .
"," .
$b);
1124 $a_tpl->parseCurrentBlock();
1133 $this->ctrl->setParameter($this,
"qid", $question->getId());
1134 $url = $this->ctrl->getLinkTarget($this,
"downloadChart");
1135 $this->ctrl->setParameter($this,
"qid",
"");
1138 $a_tpl->setVariable(
"CHART", $chart);
1139 $a_tpl->setVariable(
"CHART_DL_URL",
$url);
1140 $a_tpl->setVariable(
"CHART_DL_TXT", $this->lng->txt(
"svy_chart_download"));
1144 $panel = $ui_factory->panel()->sub(
"", $ui_factory->legacy($a_tpl->get()));
1145 array_push($this->array_panels, $panel);
1159 $svy_mode = $this->
object->getMode();
1165 $options[
""] = $this->lng->txt(
"please_select");
1169 if ($this->object->get360Mode()) {
1170 foreach ($this->object->getAppraiseesData() as $item) {
1171 if ($item[
"closed"]) {
1172 $options[$item[
"user_id"]] = $item[
"login"];
1177 foreach ($this->object->getSurveyParticipants() as $item) {
1184 if (
$rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
1187 $appr =
new ilSelectInputGUI($this->lng->txt(
"svy_participant"),
"appr_id");
1188 $appr->setOptions($options);
1190 $ilToolbar->addInputItem($appr,
true);
1193 $button->setCaption(
"survey_360_select_appraisee");
1194 $button->setCommand($this->ctrl->getCmd());
1195 $ilToolbar->addButtonInstance($button);
1198 $ilToolbar->addSeparator();
1219 $resultarray = array();
1220 foreach ($row as $rowindex => $entry) {
1221 if (is_array($entry)) {
1222 $entry = implode(
"/", $entry);
1228 if (strpos($entry,
"\"") !==
false) {
1229 $entry = str_replace(
"\"",
"\"\"", $entry);
1232 if (strpos($entry, $separator) !==
false) {
1236 $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
1238 $resultarray[$rowindex] = utf8_decode(
"\"" . $entry .
"\"");
1240 $resultarray[$rowindex] = utf8_decode($entry);
1243 return $resultarray;
1251 $title_row = $title_row2 = array();
1252 $title_row[] = $this->lng->txt(
"lastname");
1253 $title_row[] = $this->lng->txt(
"firstname");
1254 $title_row[] = $this->lng->txt(
"login");
1255 $title_row[] = $this->lng->txt(
'workingtime');
1256 $title_row[] = $this->lng->txt(
'survey_results_finished');
1262 if ($this->object->canExportSurveyCode()) {
1263 $title_row[] = $this->lng->txt(
"codes");
1267 $questions = array();
1269 foreach ($this->object->getSurveyQuestions() as $qdata) {
1271 $q_res = $q_eval->getResults();
1273 $questions[$qdata[
"question_id"]] = array($q_eval, $q_res);
1275 $question = is_array($q_res)
1276 ? $q_res[0][1]->getQuestion()
1277 : $q_res->getQuestion();
1279 $do_title = $do_label =
true;
1280 switch (
$_POST[
'export_label']) {
1282 $title_row[] = $question->label;
1288 $title_row[] = $question->getTitle();
1294 $title_row[] = $question->getTitle();
1295 $title_row2[] = $question->label;
1299 $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
1305 $rows[] = $title_row;
1306 if (implode(
"", $title_row2)) {
1307 $rows[] = $title_row2;
1313 $finished_ids =
null;
1314 if ($this->object->get360Mode()) {
1317 $this->ctrl->redirect($this,
"evaluationuser");
1319 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1320 if (!
sizeof($finished_ids)) {
1321 $finished_ids = array(-1);
1328 foreach ($participants as
$user) {
1329 $user_id =
$user[
"active_id"];
1332 $row[] = trim(
$user[
"lastname"])
1335 $row[] =
$user[
"firstname"];
1336 $row[] =
$user[
"login"];
1338 if ($this->object->canExportSurveyCode()) {
1342 $row[] = $this->
object->getWorkingtimeForParticipant($user_id);
1344 if ((
bool)
$user[
"finished"]) {
1353 foreach ($questions as $item) {
1357 $q_eval->addUserSpecificResults($row, $user_id, $q_res);
1364 $surveyname = $this->
object->getTitle() .
" " . $this->lng->txt(
"svy_eval_user") .
" " . date(
"Y-m-d");
1365 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
1368 switch (
$_POST[
"export_format"]) {
1371 $excel->addSheet($this->lng->txt(
"svy_eval_user"));
1373 foreach (
$rows as $row_idx => $row) {
1374 foreach ($row as $col_idx => $col) {
1375 $excel->setCell($row_idx + 1, $col_idx, $col);
1378 $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof($row) - 1) .
"1");
1381 $excel->sendToClient($surveyname);
1387 foreach (
$rows as $csvrow) {
1388 $csvrow = str_replace(
"\n",
" ", $this->
processCSVRow($csvrow,
true, $separator));
1389 $csv .= join($separator, $csvrow) .
"\n";
1411 $this->ctrl->redirectByClass(
"ilObjSurveyGUI",
"infoScreen");
1414 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"evaluationuser"));
1416 if ($this->object->get360Mode()) {
1422 if (!$this->object->get360Mode() ||
$appr_id) {
1423 $modal_id =
"svy_ev_exp";
1427 $button->setCaption(
"export");
1428 $button->setOnClick(
'$(\'#' . $modal_id .
'\').modal(\
'show\')');
1429 $ilToolbar->addButtonInstance($button);
1431 $ilToolbar->addSeparator();
1434 $button->setCaption(
"print");
1435 $button->setOnClick(
"window.print(); return false;");
1436 $button->setOmitPreventDoubleSubmission(
true);
1437 $ilToolbar->addButtonInstance($button);
1439 $finished_ids =
null;
1441 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1442 if (!
sizeof($finished_ids)) {
1443 $finished_ids = array(-1);
1451 $table_gui->setData(
$data);
1452 $this->tpl->setContent($table_gui->getHTML() . $modal);
1457 $all_participants = $this->
object->getSurveyParticipants($a_finished_ids);
1458 $participant_ids = [];
1459 foreach ($all_participants as $participant) {
1460 $participant_ids[] = $participant[
'usr_id'];
1464 $filtered_participant_ids = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
1467 $this->object->getRefId(),
1471 foreach ($all_participants as $username => $user_data) {
1472 if (!$user_data[
'usr_id']) {
1473 $participants[$username] = $user_data;
1475 if (in_array($user_data[
'usr_id'], $filtered_participant_ids)) {
1476 $participants[$username] = $user_data;
1479 return $participants;
1490 foreach ($this->object->getSurveyQuestions() as $qdata) {
1492 $q_res = $q_eval->getResults();
1495 if (is_array($q_res) && !is_object($q_res[0][1])) {
1499 $question = is_array($q_res)
1500 ? $q_res[0][1]->getQuestion()
1501 : $q_res->getQuestion();
1503 foreach ($participants as
$user) {
1504 $user_id =
$user[
"active_id"];
1506 $parsed_results = $q_eval->parseUserSpecificResults($q_res, $user_id);
1508 if (!array_key_exists($user_id,
$data)) {
1509 $wt = $this->
object->getWorkingtimeForParticipant($user_id);
1511 $finished =
$user[
"finished"]
1512 ?
$user[
"finished_tstamp"]
1515 $data[$user_id] = array(
1516 "username" =>
$user[
"sortname"],
1517 "question" => $question->getTitle(),
1518 "results" => $parsed_results,
1519 "workingtime" => $wt,
1520 "finished" => $finished,
1521 "subitems" => array()
1524 $data[$user_id][
"subitems"][] = array(
1526 "question" => $question->getTitle(),
1527 "results" => $parsed_results,
1528 "workingtime" =>
null,
1555 $ilTabs->activateSubtab(
"svy_eval_competences");
1556 $ilTabs->activateTab(
"svy_results");
1558 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"competenceEval"));
1570 $eval_modes = array();
1574 $opts = $sskill->getAllAssignedSkillsAsOptions();
1576 foreach ($opts as $id => $o) {
1577 $idarr = explode(
":", $id);
1578 $skills[$id] = array(
"id" => $id,
"title" => $o,
"profiles" => array(),
1579 "base_skill" => $idarr[0],
"tref_id" => $idarr[1]);
1585 foreach ($profiles as $p) {
1587 $prof_levels = $prof->getSkillLevels();
1588 foreach ($prof_levels as $pl) {
1589 if (isset($skills[$pl[
"base_skill_id"] .
":" . $pl[
"tref_id"]])) {
1590 $skills[$pl[
"base_skill_id"] .
":" . $pl[
"tref_id"]][
"profiles"][] =
1593 $eval_modes[
"gap_" . $p[
"id"]] =
1594 $lng->txt(
"svy_gap_analysis") .
": " . $prof->getTitle();
1604 foreach ($skills as $sk) {
1605 if (count($sk[
"profiles"]) == 0) {
1606 $eval_modes[
"skills_of_survey"] =
$lng->txt(
"svy_all_survey_competences");
1611 $comp_eval_mode =
$_GET[
"comp_eval_mode"];
1612 if (
$_POST[
"comp_eval_mode"] !=
"") {
1613 $comp_eval_mode =
$_POST[
"comp_eval_mode"];
1616 if (!isset($eval_modes[$comp_eval_mode])) {
1618 $comp_eval_mode = key($eval_modes);
1619 $ilCtrl->setParameter($this,
"comp_eval_mode", $comp_eval_mode);
1622 $ilCtrl->saveParameter($this,
"comp_eval_mode");
1625 $mode_sel->setOptions($eval_modes);
1626 $mode_sel->setValue($comp_eval_mode);
1627 $ilToolbar->addInputItem($mode_sel,
true);
1629 $ilToolbar->addFormButton(
$lng->txt(
"select"),
"competenceEval");
1631 if (substr($comp_eval_mode, 0, 4) ==
"gap_") {
1633 $profile_id = (int) substr($comp_eval_mode, 4);
1636 $pskills_gui->setProfileId($profile_id);
1637 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(),
$lng->txt(
"skmg_eval_type_1"));
1638 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0) {
1640 $self_levels = array();
1641 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl) {
1642 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1644 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1646 $html = $pskills_gui->getGapAnalysisHTML(
$appr_id);
1648 $tpl->setContent($html);
1653 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(),
$lng->txt(
"skmg_eval_type_1"));
1655 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0) {
1657 $self_levels = array();
1658 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl) {
1659 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1661 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1664 foreach ($skills as $skill) {
1666 "base_skill_id" => (
int) $skill[
"base_skill"],
1667 "tref_id" => (
int) $skill[
"tref_id"]
1670 $html = $pskills_gui->getGapAnalysisHTML(
$appr_id, $sk);
1672 $tpl->setContent($html);
1681 return $this->access->checkRbacOrPositionPermissionAccess(
'read_results',
'access_results', $this->object->getRefId());
1696 $qid = (int)
$_GET[
"qid"];
1708 $qid = (int)
$_GET[
"qid"];
1713 $finished_ids =
null;
1714 if ($this->object->get360Mode()) {
1716 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1717 if (!
sizeof($finished_ids)) {
1718 $finished_ids = array(-1);
1723 foreach ($this->object->getSurveyQuestions() as $qdata) {
1724 if ($qid == $qdata[
"question_id"]) {
1726 $q_res = $q_eval->getResults();
1728 $chart = $q_eval->getChart($q_res);
1730 $dtmpl =
new ilTemplate(
"tpl.il_svy_svy_results_details_single.html",
true,
true,
"Modules/Survey");
1732 if (is_array($chart)) {
1734 if (is_array($chart[1])) {
1735 foreach ($chart[1] as $legend_item) {
1736 $dtmpl->setCurrentBlock(
"legend_bl");
1737 $dtmpl->setVariable(
"LEGEND_CAPTION", $legend_item[0]);
1738 $dtmpl->setVariable(
"LEGEND_COLOR", $legend_item[1]);
1739 $dtmpl->parseCurrentBlock();
1745 $dtmpl->setVariable(
"CHART", $chart);
1751 $this->tpl->setContent($dtmpl->get());
1753 $html = $this->tpl->printToString();
1766 $html = preg_replace(
"/\?dummy\=[0-9]+/",
"", $html);
1767 $html = preg_replace(
"/\?vers\=[0-9A-Za-z\-]+/",
"", $html);
1768 $html = str_replace(
'.css$Id$',
".css", $html);
1769 $html = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" .
ILIAS_HTTP_PATH .
"/", $html);
1770 $html = preg_replace(
"/href=\"\\.\\//ims",
"href=\"" .
ILIAS_HTTP_PATH .
"/", $html);
1775 $filename = $this->
object->getTitle() .
".pdf";
1783 $script = ILIAS_ABSOLUTE_PATH .
"/Modules/Survey/js/phantom.js";
1786 ? ILIAS_ABSOLUTE_PATH .
"/libs/composer/vendor/jakoch/phantomjs/bin/phantomjs.exe"
1787 : ILIAS_ABSOLUTE_PATH .
"/libs/composer/vendor/jakoch/phantomjs/bin/phantomjs";
1792 $path = $parts[
"path"];
1800 $parts[
"path"] ? $parts[
"path"] :
'/',
1808 $output = $return =
"";
1810 exec($executable_string = $bin .
" " . $script .
" " . implode(
" ", $args), $output, $return);
1813 $log->debug($executable_string);
1818 if (substr($a_filename, -3) ==
'pdf') {
1819 $mime_type =
'application/pdf';
1820 } elseif (substr($a_filename, -3) ==
'png') {
1821 $mime_type =
'image/png';
An exception for terminatinating execution or to throw for unit testing.
Survey question evaluation.
getChart($a_results)
Get chart.
getExportGrid($a_results)
Get grid data.
getGrid($a_results, $a_abs=true, $a_perc=true)
Get grid data.
getTextAnswers($a_results)
Get text answers.
static _getTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _instanciateQuestionEvaluation($question_id, array $a_finished_ids=null)
Creates an instance of a question evaluation with a given question id.
Accordion user interface class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
@classDescription Date and time handling
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
setColors($a_coords, $a_background, $a_font=null)
Set cell(s) colors.
setBold($a_coords)
Set cell(s) to bold.
addSheet($a_name, $a_activate=true)
Add sheet.
getCoordByColumnAndRow($pColumn=1, $pRow=1)
Get cell coordinate (e.g.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static getRootLogger()
The unique root logger has a fixed error level.
static getLogger($a_component_id)
Get component logger.
static getInstance()
Get instance.
static _hasEvaluationAccess($a_obj_id, $user_id)
const EVALUATION_ACCESS_PARTICIPANTS
const RESULTS_SELF_EVAL_ALL
const EVALUATION_ACCESS_ALL
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.
const EVALUATION_ACCESS_OFF
static _lookupId($a_user_str)
Lookup id by login.
static _lookupObjId($a_id)
Personal skills GUI class.
static _writeData($a_session_id, $a_data)
Write session data.
Skill management settings.
static getProfilesOfUser($a_user_id)
Get profiles of a user.
Survey evaluation graphical output.
exportCumulatedResults($details=0)
exportResultsDetailsExcel(ilExcel $a_excel, SurveyQuestionEvaluation $a_eval, $a_results, $a_do_title, $a_do_label)
Export details (excel only)
callPdfGeneration($a_url, $a_suffix, $a_filename, $a_return=false)
setEvalSubtabs()
Set the tabs for the evaluation output.
filterSurveyParticipantsByAccess($a_finished_ids)
__construct($a_object)
ilSurveyEvaluationGUI constructor
cancelEvaluationAccess()
Cancels the input of the survey access code for evaluation access.
addApprSelectionToToolbar()
Add appraisee selection to toolbar.
checkAnonymizedEvaluationAccess()
Show the detailed evaluation.
generateAndSendPDF($html, $filename="")
renderDetails($a_details_parts, $a_details_figure, array $a_qdata, SurveyQuestionEvaluation $a_eval, $a_results, $pdf)
Render details.
buildExportModal($a_id, $a_cmd)
setAppraiseeId($a_val)
Set appraisee id.
processCSVRow($row, $quoteAll=false, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
evaluationdetails()
Show the detailed evaluation.
hasResultsAccess()
Check if user can view results granted by rbac or positions.
determineAppraiseeId()
Determine appraisee id.
parseResultsToExcel(ilExcel $a_excel, ilSurveyEvaluationResults $a_results, &$a_excel_row, array $a_grid=null, array $a_text_answers=null, $a_include_mode=true)
checkEvaluationAccess()
Checks the evaluation access after entering the survey access code.
getAppraiseeId()
Get appraisee id.
competenceEval()
Competence Evaluation.
parseUserSpecificResults(array $a_finished_ids=null)
evaluationuser()
Print the survey evaluation for a selected user.
evaluation($details=0, $pdf=false, $return_pdf=false)
executeCommand()
execute command
Survey evaluation answers.
Skill/Competence handling in surveys.
special template class to simplify handling of ITX/PEAR
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static isWindows()
check wether the current client system is a windows system
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.