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();
79 $ilCtrl =
$DIC->ctrl();
83 $this->ctrl = $ilCtrl;
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")
164 if ($this->object->getCalculateSumScore()) {
165 $ilTabs->addSubTabTarget(
167 $this->ctrl->getLinkTarget($this,
"sumscore"),
181 $this->appr_id = $a_val;
205 if ($_REQUEST[
"appr_id"] ==
"") {
206 $req_appr_id =
$ilUser->getId();
208 $req_appr_id = (int) $_REQUEST[
"appr_id"];
212 if ($req_appr_id > 0 && $this->object->get360Mode()) {
216 foreach ($this->object->getAppraiseesData() as $item) {
217 if ($item[
"closed"] &&
218 ($item[
"user_id"] ==
$ilUser->getId() ||
219 $rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
221 $valid[] = $item[
"user_id"];
224 if (in_array($req_appr_id,
$valid)) {
234 $this->ctrl->setParameter($this,
"appr_id",
$appr_id);
250 if ($this->object->getAnonymize() == 1 &&
256 if ($this->object->getAnonymize() == 1) {
262 if ($this->object->getAnonymize() == 1) {
264 $surveycode = $this->
object->getUserAccessCode(
$ilUser->getId());
265 if ($this->object->isAnonymizedParticipant($surveycode)) {
279 $this->tpl->setVariable(
"TABS",
"");
280 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation_checkaccess.html",
"Modules/Survey");
281 $this->tpl->setCurrentBlock(
"adm_content");
282 $this->tpl->setVariable(
"AUTHENTICATION_NEEDED", $this->lng->txt(
"svy_check_evaluation_authentication_needed"));
283 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"checkEvaluationAccess"));
284 $this->tpl->setVariable(
"EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt(
"svy_check_evaluation_access_introduction"));
285 $this->tpl->setVariable(
"VALUE_CHECK", $this->lng->txt(
"ok"));
286 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
287 $this->tpl->setVariable(
"TEXT_SURVEY_CODE", $this->lng->txt(
"survey_code"));
288 $this->tpl->parseCurrentBlock();
291 $_SESSION[
"anon_evaluation_access"] =
null;
304 $surveycode =
$_POST[
"surveycode"];
305 if ($this->object->isAnonymizedParticipant($surveycode)) {
325 $path =
$tree->getPathFull($this->object->getRefID());
326 $ilCtrl->setParameterByClass(
329 $path[count($path) - 2][
"child"]
331 $ilCtrl->redirectByClass(
"ilrepositorygui",
"frameset");
348 $finished_ids =
null;
349 if ($this->object->get360Mode()) {
352 $this->ctrl->redirect($this, $details ?
"evaluationdetails" :
"evaluation");
354 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
355 if (!
sizeof($finished_ids)) {
356 $finished_ids = array(-1);
361 $title_row = array();
362 $do_title = $do_label =
true;
363 switch (
$_POST[
'export_label']) {
365 $title_row[] = $this->lng->txt(
"label");
370 $title_row[] = $this->lng->txt(
"title");
375 $title_row[] = $this->lng->txt(
"title");
376 $title_row[] = $this->lng->txt(
"label");
379 $title_row[] = $this->lng->txt(
"question");
380 $title_row[] = $this->lng->txt(
"question_type");
381 $title_row[] = $this->lng->txt(
"users_answered");
382 $title_row[] = $this->lng->txt(
"users_skipped");
383 $title_row[] = $this->lng->txt(
"mode");
384 $title_row[] = $this->lng->txt(
"mode_text");
385 $title_row[] = $this->lng->txt(
"mode_nr_of_selections");
386 $title_row[] = $this->lng->txt(
"median");
387 $title_row[] = $this->lng->txt(
"arithmetic_mean");
390 switch (
$_POST[
"export_format"]) {
393 $excel->addSheet($this->lng->txt(
"svy_eval_cumulated"));
394 $excel->setCellArray(array($title_row),
"A1");
395 $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof($title_row) - 1) .
"1");
399 $csvfile = array($title_row);
406 foreach ($this->object->getSurveyQuestions() as $qdata) {
408 $q_res = $q_eval->getResults();
409 $ov_rows = $q_eval->exportResults($q_res, $do_title, $do_label);
411 switch (
$_POST[
"export_format"]) {
413 $excel->setActiveSheet(0);
414 foreach ($ov_rows as $row) {
415 foreach ($row as $col => $value) {
416 $excel->setCell($ov_row, $col, $value);
423 foreach ($ov_rows as $row) {
430 switch (
$_POST[
"export_format"]) {
440 ? $this->lng->txt(
"svy_eval_cumulated")
441 : $this->lng->txt(
"svy_eval_detail");
443 $surveyname = $this->
object->getTitle() .
" " .
$type .
" " . date(
"Y-m-d");
444 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
448 switch (
$_POST[
"export_format"]) {
450 $excel->sendToClient($surveyname);
456 foreach ($csvfile as $csvrow) {
458 $csv .= join($separator, $csvrow) .
"\n";
477 $question_res = $a_results;
479 if (is_array($question_res)) {
480 $question_res = $question_res[0][1];
483 $question = $question_res->getQuestion();
485 $a_excel->
addSheet($question->getTitle());
493 $kv[$this->lng->txt(
"title")] = $question->getTitle();
496 $kv[$this->lng->txt(
"label")] = $question->label;
500 $kv[$this->lng->txt(
"question")] = $question->getQuestiontext();
508 $kv[$this->lng->txt(
"users_answered")] = (int) $question_res->getUsersAnswered();
509 $kv[$this->lng->txt(
"users_skipped")] = (int) $question_res->getUsersSkipped();
513 foreach ($kv as $key => $value) {
514 $a_excel->
setCell($excel_row, 0, $key);
515 $a_excel->
setCell($excel_row++, 1, $value);
540 foreach ($a_results as $row_results) {
541 $row_title = $row_results[0];
543 $a_excel->
setCell($excel_row, 0, $this->lng->txt(
"row"));
544 $a_excel->
setCell($excel_row++, 1, $row_title);
551 is_array($texts[$row_title])
552 ? array(
"" => $texts[$row_title])
560 $a_excel->
setCell($excel_row++, 0, $this->lng->txt(
"overview"));
564 $cats = $question->getColumns();
565 foreach ($cats->getCategories() as $cat) {
567 $a_excel->
setCell($excel_row, 1 + $counter, $cat->title);
572 foreach ($a_results as $row_results) {
573 $row_title = $row_results[0];
575 $a_excel->
setCell($excel_row, 0, $row_title);
577 $vars = $row_results[1]->getVariables();
579 foreach ($vars as $var) {
580 $a_excel->
setCell($excel_row, ++$counter, $var->abs);
588 $a_excel->
setBold(
"A1:A" . $excel_row);
595 if ($a_include_mode) {
598 $kv[$this->lng->txt(
"mode")] = is_array($a_results->
getModeValue())
610 if ($a_results->
getMean() !==
null) {
611 $kv[$this->lng->txt(
"arithmetic_mean")] = $a_results->
getMean();
615 foreach ($kv as $key => $value) {
616 $a_excel->
setCell($a_excel_row, 0, $key);
617 $a_excel->
setCell($a_excel_row++, 1, $value);
624 $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"categories"));
625 foreach ($a_grid[
"cols"] as $col_idx => $col) {
626 $a_excel->
setCell($a_excel_row, $col_idx + 1, $col);
631 foreach ($a_grid[
"rows"] as
$cols) {
632 foreach (
$cols as $col_idx => $col) {
633 $a_excel->
setCell($a_excel_row, $col_idx + 1, $col);
640 if ($a_text_answers) {
642 $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"freetext_answers"));
645 if (!is_array($a_text_answers[
""])) {
647 $a_excel->
setCell($a_excel_row, 1, $this->lng->txt(
"title"));
648 $a_excel->
setCell($a_excel_row++, 2, $this->lng->txt(
"answer"));
653 $a_excel->
setCell($a_excel_row++, 1, $this->lng->txt(
"answer"));
656 foreach ($a_text_answers as $var => $items) {
657 foreach ($items as $item) {
658 if (!is_array($a_text_answers[
""])) {
659 $a_excel->
setCell($a_excel_row, 1, $var);
660 $a_excel->
setCell($a_excel_row++, 2, $item);
662 $a_excel->
setCell($a_excel_row++, 1, $item);
671 if (strlen(
$_POST[
"export_format"])) {
675 $this->ctrl->redirect($this,
'evaluation');
681 if (strlen(
$_POST[
"export_format"])) {
685 $this->ctrl->redirect($this,
'evaluation');
692 $this->ctrl->redirect($this,
'evaluation');
699 $form_id =
"svymdfrm";
702 $tpl->addOnLoadCode(
'$("#form_' . $form_id .
'").submit(function() { $("#' . $a_id .
'").modal("hide"); });');
705 $modal->setId($a_id);
706 $modal->setHeading(($this->lng->txt(
"svy_export_format")));
709 $form->setId($form_id);
710 $form->setFormAction($this->ctrl->getFormAction($this, $a_cmd));
714 self::TYPE_XLS => $this->lng->txt(
'exp_type_excel'),
720 $label->setOptions(array(
721 'label_only' => $this->lng->txt(
'export_label_only'),
722 'title_only' => $this->lng->txt(
'export_title_only'),
723 'title_label' => $this->lng->txt(
'export_title_label')
725 $form->addItem($label);
727 $form->addCommandButton($a_cmd, $this->lng->txt(
"export"));
728 $form->setPreventDoubleSubmission(
false);
730 $modal->setBody($form->getHTML());
732 return $modal->getHTML();
735 public function evaluation($details = 0, $pdf =
false, $return_pdf =
false)
741 $ui_factory = $ui->factory();
742 $ui_renderer = $ui->renderer();
744 $this->lng->loadLanguageModule(
"survey");
746 $this->log->debug(
"check access");
750 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
754 switch ($this->object->getEvaluationAccess()) {
769 $this->log->debug(
"check access ok");
774 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
775 if ($this->object->get360Mode()) {
782 $eval_tpl =
new ilTemplate(
"tpl.il_svy_svy_evaluation.html",
true,
true,
"Modules/Survey");
784 if (!$this->object->get360Mode() ||
$appr_id) {
786 $captions =
new ilSelectInputGUI($this->lng->txt(
"svy_eval_captions"),
"cp");
787 $captions->setOptions(array(
788 "ap" => $this->lng->txt(
"svy_eval_captions_abs_perc"),
789 "a" => $this->lng->txt(
"svy_eval_captions_abs"),
790 "p" => $this->lng->txt(
"svy_eval_captions_perc")
792 $captions->setValue(
$_POST[
"cp"]);
793 $ilToolbar->addInputItem($captions,
true);
796 $view->setOptions(array(
797 "tc" => $this->lng->txt(
"svy_eval_view_tables_charts"),
798 "t" => $this->lng->txt(
"svy_eval_view_tables"),
799 "c" => $this->lng->txt(
"svy_eval_view_charts")
801 $view->setValue(
$_POST[
"vw"]);
802 $ilToolbar->addInputItem($view,
true);
805 $button->setCaption(
"ok");
806 $button->setCommand(
"evaluationdetails");
807 $button->setOmitPreventDoubleSubmission(
true);
808 $ilToolbar->addButtonInstance($button);
810 $ilToolbar->addSeparator();
813 $dtmpl =
new ilTemplate(
"tpl.il_svy_svy_results_details.html",
true,
true,
"Modules/Survey");
814 $toc_tpl =
new ilTemplate(
"tpl.svy_results_table_contents.html",
true,
true,
"Modules/Survey");
815 $this->lng->loadLanguageModule(
"content");
816 $toc_tpl->setVariable(
"TITLE_TOC", $this->lng->txt(
'cont_toc'));
820 $modal_id =
"svy_ev_exp";
826 $button->setCaption(
"export");
827 $button->setOnClick(
'$(\'#' . $modal_id .
'\').modal(\
'show\')');
828 $ilToolbar->addButtonInstance($button);
830 $ilToolbar->addSeparator();
833 $button->setCaption(
"print");
834 $button->setOnClick(
"if(il.Accordion) { il.Accordion.preparePrint(); } window.print(); return false;");
835 $button->setOmitPreventDoubleSubmission(
true);
836 $ilToolbar->addButtonInstance($button);
839 $this->ctrl->setParameter($this,
"cp",
$_POST[
"cp"]);
840 $this->ctrl->setParameter($this,
"vw",
$_POST[
"vw"]);
841 $url = $this->ctrl->getLinkTarget($this, $details
842 ?
"evaluationdetailspdf"
844 $this->ctrl->setParameter($this,
"cp",
"");
845 $this->ctrl->setParameter($this,
"vw",
"");
847 $button->setCaption(
"svy_export_pdf");
848 $button->setUrl(
$url);
849 $button->setOmitPreventDoubleSubmission(
true);
850 $ilToolbar->addButtonInstance($button);
853 $finished_ids =
null;
855 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
856 if (!
sizeof($finished_ids)) {
857 $finished_ids = array(-1);
862 if (!$this->access->checkAccess(
'write',
'', $this->object->getRefId())
865 $finished_ids = $this->
object->getFinishedIdsForSelfEval($this->
user->getId());
868 $details_figure =
$_POST[
"cp"]
871 $details_view =
$_POST[
"vw"]
877 $finished_ids2 = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
880 $this->object->getRefId(),
881 (array) $finished_ids
887 foreach ($this->object->getSurveyQuestions() as $qdata) {
889 $q_res = $q_eval->getResults();
893 $this->
renderDetails($details_view, $details_figure, $qdata, $q_eval, $q_res, $pdf);
896 if ($qdata[
"questionblock_id"] &&
897 $qdata[
"questionblock_id"] != $this->last_questionblock_id) {
899 if ($qblock[
"show_blocktitle"]) {
900 $list->addListNode($qdata[
"questionblock_title"],
"q" . $qdata[
"questionblock_id"]);
902 $list->addListNode(
"",
"q" . $qdata[
"questionblock_id"]);
904 $this->last_questionblock_id = $qdata[
"questionblock_id"];
906 $anchor_id =
"svyrdq" . $qdata[
"question_id"];
907 $list->addListNode(
"<a href='#" . $anchor_id .
"'>" . $qdata[
"title"] .
"</a>", $qdata[
"question_id"], $qdata[
"questionblock_id"] ?
908 "q" . $qdata[
"questionblock_id"] : 0);
913 $list->setListClass(
"il_Explorer");
914 $toc_tpl->setVariable(
"LIST", $list->getHTML());
917 $panel_toc = $ui_factory->panel()->standard(
"", $ui_factory->legacy($toc_tpl->get()));
918 $render_toc = $ui_renderer->render($panel_toc);
919 $dtmpl->setVariable(
"PANEL_TOC", $render_toc);
923 $panel_report = $ui_factory->panel()->report($report_title, $this->array_panels);
924 $render_report = $ui_renderer->render($panel_report);
925 $dtmpl->setVariable(
"PANEL_REPORT", $render_report);
928 $eval_tpl->setVariable(
'DETAIL', $dtmpl->get());
932 $eval_tpl->setVariable(
'MODAL', $modal);
935 $eval_tpl->setVariable(
'CUMULATED', $table_gui->getHTML());
947 $path_full =
$tree->getPathFull($this->object->getRefId());
948 foreach ($path_full as
$data) {
949 $path .=
" » ";
950 $path .=
$data[
'title'];
956 $this->lng->txt(
"path") => $path,
957 $this->lng->txt(
"svy_results") => !$details
958 ? $this->lng->txt(
"svy_eval_cumulated")
959 : $this->lng->txt(
"svy_eval_detail"),
962 $eval_tpl->setCurrentBlock(
"print_header_bl");
963 foreach ($props as $key => $value) {
964 $eval_tpl->setVariable(
"HEADER_PROP_KEY", $key);
965 $eval_tpl->setVariable(
"HEADER_PROP_VALUE", $value);
966 $eval_tpl->parseCurrentBlock();
969 $this->log->debug(
"end");
971 $this->tpl->setContent($eval_tpl->get());
974 $this->tpl->setTitle($this->object->getTitle());
975 $this->tpl->setTitleIcon(
977 $this->lng->txt(
"obj_" . $this->object->getType())
979 $this->tpl->setDescription($this->object->getDescription());
982 $html = $this->tpl->printToString();
1007 $ui_factory = $this->
ui->factory();
1008 $a_tpl =
new ilTemplate(
"tpl.svy_results_details_panel.html",
true,
true,
"Modules/Survey");
1010 $question_res = $a_results;
1012 if (is_array($question_res)) {
1013 $question_res = $question_res[0][1];
1018 if (!is_object($question_res)) {
1022 $question = $question_res->getQuestion();
1031 $kv[
"users_answered"] = $question_res->getUsersAnswered();
1032 $kv[
"users_skipped"] = $question_res->getUsersSkipped();
1035 if ($question_res->getModeValue() !==
null) {
1036 $kv[
"mode"] = wordwrap($question_res->getModeValueAsText(), 50,
"<br />");
1037 $kv[
"mode_nr_of_selections"] = $question_res->getModeNrOfSelections();
1039 if ($question_res->getMedian() !==
null) {
1040 $kv[
"median"] = $question_res->getMedianAsText();
1042 if ($question_res->getMean() !==
null) {
1043 $kv[
"arithmetic_mean"] = $question_res->getMean();
1048 $qst_title = $question->getTitle();
1049 $svy_text = nl2br($question->getQuestiontext());
1050 $card_table_tpl =
new ilTemplate(
"tpl.svy_results_details_card.html",
true,
true,
"Modules/Survey");
1051 foreach ($kv as $key => $value) {
1052 $card_table_tpl->setCurrentBlock(
"question_statistics_card");
1053 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_KEY", $this->lng->txt($key));
1054 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_VALUE", $value);
1055 $card_table_tpl->parseCurrentBlock();
1059 $anchor_id =
"svyrdq" . $question->getId();
1060 $title =
"<span id='$anchor_id'>$qst_title</span>";
1061 $panel_qst_card = $ui_factory->panel()->sub($title, $ui_factory->legacy($svy_text))
1062 ->withCard($ui_factory->card()->standard($svy_type_title)->withSections(array($ui_factory->legacy($card_table_tpl->get()))));
1064 array_push($this->array_panels, $panel_qst_card);
1067 if ($a_details_parts ==
"t" ||
1068 $a_details_parts ==
"tc") {
1071 ($a_details_figure ==
"ap" || $a_details_figure ==
"a"),
1072 ($a_details_figure ==
"ap" || $a_details_figure ==
"p")
1075 foreach ($grid[
"cols"] as $col) {
1076 $a_tpl->setCurrentBlock(
"grid_col_header_bl");
1077 $a_tpl->setVariable(
"COL_HEADER", $col);
1078 $a_tpl->parseCurrentBlock();
1080 foreach ($grid[
"rows"] as
$cols) {
1081 foreach (
$cols as $idx => $col) {
1083 $a_tpl->touchBlock(
"grid_col_nowrap_bl");
1086 $a_tpl->setCurrentBlock(
"grid_col_bl");
1087 $a_tpl->setVariable(
"COL_CAPTION", trim($col));
1088 $a_tpl->parseCurrentBlock();
1091 $a_tpl->touchBlock(
"grid_row_bl");
1099 if (array_key_exists(
"", $texts)) {
1100 $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"given_answers"));
1101 foreach ($texts[
""] as $item) {
1102 $a_tpl->setCurrentBlock(
"text_direct_item_bl");
1103 $a_tpl->setVariable(
"TEXT_DIRECT", nl2br(htmlentities($item)));
1104 $a_tpl->parseCurrentBlock();
1109 if (
$_GET[
"pdf"] == 1) {
1112 $acc->setId(
"svyevaltxt" . $question->getId());
1114 $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"freetext_answers"));
1116 foreach ($texts as $var => $items) {
1117 $list = array(
"<ul class=\"small\">");
1118 foreach ($items as $item) {
1119 $list[] =
"<li>" . nl2br(htmlentities($item)) .
"</li>";
1122 $acc->addItem($var, implode(
"\n", $list));
1125 $a_tpl->setVariable(
"TEXT_ACC", $acc->getHTML());
1130 if ($a_details_parts ==
"c" ||
1131 $a_details_parts ==
"tc") {
1132 $chart = $a_eval->
getChart($a_results);
1134 if (is_array($chart)) {
1136 if (is_array($chart[1])) {
1137 foreach ($chart[1] as $legend_item) {
1138 $r = hexdec(substr($legend_item[1], 1, 2));
1139 $g = hexdec(substr($legend_item[1], 3, 2));
1140 $b = hexdec(substr($legend_item[1], 5, 2));
1142 $a_tpl->setCurrentBlock(
"legend_bl");
1143 $a_tpl->setVariable(
"LEGEND_CAPTION", $legend_item[0]);
1144 $a_tpl->setVariable(
"LEGEND_COLOR", $legend_item[1]);
1145 $a_tpl->setVariable(
"LEGEND_COLOR_SVG", $r .
"," . $g .
"," .
$b);
1146 $a_tpl->parseCurrentBlock();
1155 $this->ctrl->setParameter($this,
"qid", $question->getId());
1156 $url = $this->ctrl->getLinkTarget($this,
"downloadChart");
1157 $this->ctrl->setParameter($this,
"qid",
"");
1160 $a_tpl->setVariable(
"CHART", $chart);
1161 $a_tpl->setVariable(
"CHART_DL_URL",
$url);
1162 $a_tpl->setVariable(
"CHART_DL_TXT", $this->lng->txt(
"svy_chart_download"));
1166 $panel = $ui_factory->panel()->sub(
"", $ui_factory->legacy($a_tpl->get()));
1167 array_push($this->array_panels,
$panel);
1181 $svy_mode = $this->
object->getMode();
1187 $options[
""] = $this->lng->txt(
"please_select");
1191 if ($this->object->get360Mode()) {
1192 foreach ($this->object->getAppraiseesData() as $item) {
1193 if ($item[
"closed"]) {
1194 $options[$item[
"user_id"]] = $item[
"login"];
1199 foreach ($this->object->getSurveyParticipants() as $item) {
1206 if (
$rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
1209 $appr =
new ilSelectInputGUI($this->lng->txt(
"svy_participant"),
"appr_id");
1210 $appr->setOptions($options);
1212 $ilToolbar->addInputItem($appr,
true);
1215 $button->setCaption(
"survey_360_select_appraisee");
1216 $button->setCommand($this->ctrl->getCmd());
1217 $ilToolbar->addButtonInstance($button);
1220 $ilToolbar->addSeparator();
1241 $resultarray = array();
1242 foreach ($row as $rowindex => $entry) {
1243 if (is_array($entry)) {
1244 $entry = implode(
"/", $entry);
1250 if (strpos($entry,
"\"") !==
false) {
1251 $entry = str_replace(
"\"",
"\"\"", $entry);
1254 if (strpos($entry, $separator) !==
false) {
1258 $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
1260 $resultarray[$rowindex] = utf8_decode(
"\"" . $entry .
"\"");
1262 $resultarray[$rowindex] = utf8_decode($entry);
1265 return $resultarray;
1273 $title_row = $title_row2 = array();
1274 $title_row[] = $this->lng->txt(
"lastname");
1275 $title_row[] = $this->lng->txt(
"firstname");
1276 $title_row[] = $this->lng->txt(
"login");
1277 $title_row[] = $this->lng->txt(
'workingtime');
1278 $title_row[] = $this->lng->txt(
'survey_results_finished');
1284 if ($this->object->canExportSurveyCode()) {
1285 $title_row[] = $this->lng->txt(
"codes");
1289 $questions = array();
1291 foreach ($this->object->getSurveyQuestions() as $qdata) {
1293 $q_res = $q_eval->getResults();
1295 $questions[$qdata[
"question_id"]] = array($q_eval, $q_res);
1297 $question = is_array($q_res)
1298 ? $q_res[0][1]->getQuestion()
1299 : $q_res->getQuestion();
1301 $do_title = $do_label =
true;
1302 switch (
$_POST[
'export_label']) {
1304 $title_row[] = $question->label;
1310 $title_row[] = $question->getTitle();
1316 $title_row[] = $question->getTitle();
1317 $title_row2[] = $question->label;
1321 $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
1327 $rows[] = $title_row;
1328 if (implode(
"", $title_row2)) {
1329 $rows[] = $title_row2;
1335 $finished_ids =
null;
1336 if ($this->object->get360Mode()) {
1339 $this->ctrl->redirect($this,
"evaluationuser");
1341 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1342 if (!
sizeof($finished_ids)) {
1343 $finished_ids = array(-1);
1350 foreach ($participants as
$user) {
1351 $user_id =
$user[
"active_id"];
1354 $row[] = trim(
$user[
"lastname"])
1357 $row[] =
$user[
"firstname"];
1358 $row[] =
$user[
"login"];
1360 if ($this->object->canExportSurveyCode()) {
1364 $row[] = $this->
object->getWorkingtimeForParticipant($user_id);
1366 if ((
bool)
$user[
"finished"]) {
1375 foreach ($questions as $item) {
1379 $q_eval->addUserSpecificResults($row, $user_id, $q_res);
1386 $surveyname = $this->
object->getTitle() .
" " . $this->lng->txt(
"svy_eval_user") .
" " . date(
"Y-m-d");
1387 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
1390 switch (
$_POST[
"export_format"]) {
1393 $excel->addSheet($this->lng->txt(
"svy_eval_user"));
1395 foreach (
$rows as $row_idx => $row) {
1396 foreach ($row as $col_idx => $col) {
1397 $excel->setCell($row_idx + 1, $col_idx, $col);
1400 $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof($row) - 1) .
"1");
1403 $excel->sendToClient($surveyname);
1409 foreach (
$rows as $csvrow) {
1410 $csvrow = str_replace(
"\n",
" ", $this->
processCSVRow($csvrow,
true, $separator));
1411 $csv .= join($separator, $csvrow) .
"\n";
1433 $this->ctrl->redirectByClass(
"ilObjSurveyGUI",
"infoScreen");
1436 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"evaluationuser"));
1438 if ($this->object->get360Mode()) {
1444 if (!$this->object->get360Mode() ||
$appr_id) {
1445 $modal_id =
"svy_ev_exp";
1449 $button->setCaption(
"export");
1450 $button->setOnClick(
'$(\'#' . $modal_id .
'\').modal(\
'show\')');
1451 $ilToolbar->addButtonInstance($button);
1453 $ilToolbar->addSeparator();
1456 $button->setCaption(
"print");
1457 $button->setOnClick(
"window.print(); return false;");
1458 $button->setOmitPreventDoubleSubmission(
true);
1459 $ilToolbar->addButtonInstance($button);
1461 $finished_ids =
null;
1463 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1464 if (!
sizeof($finished_ids)) {
1465 $finished_ids = array(-1);
1473 $table_gui->setData(
$data);
1474 $this->tpl->setContent($table_gui->getHTML() . $modal);
1479 $all_participants = $this->
object->getSurveyParticipants($a_finished_ids);
1480 $participant_ids = [];
1481 foreach ($all_participants as $participant) {
1482 $participant_ids[] = $participant[
'usr_id'];
1486 $filtered_participant_ids = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
1489 $this->object->getRefId(),
1493 foreach ($all_participants as $username => $user_data) {
1494 if (!$user_data[
'usr_id']) {
1495 $participants[$username] = $user_data;
1497 if (in_array($user_data[
'usr_id'], $filtered_participant_ids)) {
1498 $participants[$username] = $user_data;
1501 return $participants;
1512 foreach ($this->object->getSurveyQuestions() as $qdata) {
1514 $q_res = $q_eval->getResults();
1517 if (is_array($q_res) && !is_object($q_res[0][1])) {
1521 $question = is_array($q_res)
1522 ? $q_res[0][1]->getQuestion()
1523 : $q_res->getQuestion();
1525 foreach ($participants as
$user) {
1526 $user_id =
$user[
"active_id"];
1528 $parsed_results = $q_eval->parseUserSpecificResults($q_res, $user_id);
1530 if (!array_key_exists($user_id,
$data)) {
1531 $wt = $this->
object->getWorkingtimeForParticipant($user_id);
1533 $finished =
$user[
"finished"]
1534 ?
$user[
"finished_tstamp"]
1537 $data[$user_id] = array(
1538 "username" =>
$user[
"sortname"],
1539 "question" => $question->getTitle(),
1540 "results" => $parsed_results,
1541 "workingtime" => $wt,
1542 "finished" => $finished,
1543 "subitems" => array()
1546 $data[$user_id][
"subitems"][] = array(
1548 "question" => $question->getTitle(),
1549 "results" => $parsed_results,
1550 "workingtime" =>
null,
1577 $ilTabs->activateSubtab(
"svy_eval_competences");
1578 $ilTabs->activateTab(
"svy_results");
1580 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"competenceEval"));
1592 $eval_modes = array();
1596 $opts = $sskill->getAllAssignedSkillsAsOptions();
1598 foreach ($opts as $id => $o) {
1599 $idarr = explode(
":", $id);
1600 $skills[$id] = array(
"id" => $id,
"title" => $o,
"profiles" => array(),
1601 "base_skill" => $idarr[0],
"tref_id" => $idarr[1]);
1607 foreach ($profiles as $p) {
1609 $prof_levels = $prof->getSkillLevels();
1610 foreach ($prof_levels as $pl) {
1611 if (isset($skills[$pl[
"base_skill_id"] .
":" . $pl[
"tref_id"]])) {
1612 $skills[$pl[
"base_skill_id"] .
":" . $pl[
"tref_id"]][
"profiles"][] =
1615 $eval_modes[
"gap_" . $p[
"id"]] =
1616 $lng->txt(
"svy_gap_analysis") .
": " . $prof->getTitle();
1626 foreach ($skills as $sk) {
1627 if (count($sk[
"profiles"]) == 0) {
1628 $eval_modes[
"skills_of_survey"] =
$lng->txt(
"svy_all_survey_competences");
1633 $comp_eval_mode =
$_GET[
"comp_eval_mode"];
1634 if (
$_POST[
"comp_eval_mode"] !=
"") {
1635 $comp_eval_mode =
$_POST[
"comp_eval_mode"];
1638 if (!isset($eval_modes[$comp_eval_mode])) {
1640 $comp_eval_mode = key($eval_modes);
1641 $ilCtrl->setParameter($this,
"comp_eval_mode", $comp_eval_mode);
1644 $ilCtrl->saveParameter($this,
"comp_eval_mode");
1647 $mode_sel->setOptions($eval_modes);
1648 $mode_sel->setValue($comp_eval_mode);
1649 $ilToolbar->addInputItem($mode_sel,
true);
1651 $ilToolbar->addFormButton(
$lng->txt(
"select"),
"competenceEval");
1653 if (substr($comp_eval_mode, 0, 4) ==
"gap_") {
1655 $profile_id = (int) substr($comp_eval_mode, 4);
1658 $pskills_gui->setProfileId($profile_id);
1659 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(),
$lng->txt(
"skmg_eval_type_1"));
1660 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0) {
1662 $self_levels = array();
1663 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl) {
1664 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1666 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1668 $html = $pskills_gui->getGapAnalysisHTML(
$appr_id);
1670 $tpl->setContent($html);
1675 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(),
$lng->txt(
"skmg_eval_type_1"));
1677 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0) {
1679 $self_levels = array();
1680 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl) {
1681 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1683 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1686 foreach ($skills as $skill) {
1688 "base_skill_id" => (
int) $skill[
"base_skill"],
1689 "tref_id" => (
int) $skill[
"tref_id"]
1692 $html = $pskills_gui->getGapAnalysisHTML(
$appr_id, $sk);
1694 $tpl->setContent($html);
1703 return $this->access->checkRbacOrPositionPermissionAccess(
'read_results',
'access_results', $this->object->getRefId());
1718 $qid = (int)
$_GET[
"qid"];
1730 $qid = (int)
$_GET[
"qid"];
1735 $finished_ids =
null;
1736 if ($this->object->get360Mode()) {
1738 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1739 if (!
sizeof($finished_ids)) {
1740 $finished_ids = array(-1);
1745 foreach ($this->object->getSurveyQuestions() as $qdata) {
1746 if ($qid == $qdata[
"question_id"]) {
1748 $q_res = $q_eval->getResults();
1750 $chart = $q_eval->getChart($q_res);
1752 $dtmpl =
new ilTemplate(
"tpl.il_svy_svy_results_details_single.html",
true,
true,
"Modules/Survey");
1754 if (is_array($chart)) {
1756 if (is_array($chart[1])) {
1757 foreach ($chart[1] as $legend_item) {
1758 $dtmpl->setCurrentBlock(
"legend_bl");
1759 $dtmpl->setVariable(
"LEGEND_CAPTION", $legend_item[0]);
1760 $dtmpl->setVariable(
"LEGEND_COLOR", $legend_item[1]);
1761 $dtmpl->parseCurrentBlock();
1767 $dtmpl->setVariable(
"CHART", $chart);
1773 $this->tpl->setContent($dtmpl->get());
1775 $html = $this->tpl->printToString();
1788 $html = preg_replace(
"/\?dummy\=[0-9]+/",
"", $html);
1789 $html = preg_replace(
"/\?vers\=[0-9A-Za-z\-]+/",
"", $html);
1790 $html = preg_replace(
"/\&version\=[0-9A-Za-z\-\._]+/",
"", $html);
1791 $html = str_replace(
'.css$Id$',
".css", $html);
1792 $html = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $html);
1793 $html = preg_replace(
"/href=\"\\.\\//ims",
"href=\"" . ILIAS_HTTP_PATH .
"/", $html);
1798 $filename = $this->
object->getTitle() .
".pdf";
1815 $this->ctrl->redirectByClass(
"ilObjSurveyGUI",
"infoScreen");
1818 ilUtil::sendInfo($this->lng->txt(
"svy_max_sum_score") .
": " . $this->object->getMaxSumScore());
1820 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"evaluationuser"));
1822 $modal_id =
"svy_ev_exp";
1826 $button->setCaption(
"print");
1827 $button->setOnClick(
"window.print(); return false;");
1828 $button->setOmitPreventDoubleSubmission(
true);
1829 $ilToolbar->addButtonInstance($button);
1831 $finished_ids =
null;
1834 $table_gui =
new ilSumScoreTableGUI($this,
'sumscore', $this->object->hasAnonymizedResults());
1835 $table_gui->setSumScores($sum_scores);
1836 $this->tpl->setContent($table_gui->getHTML() . $modal);
1843 $sum_scores[$p[
"active_id"]] = [
1844 "username" => $p[
"sortname"],
1849 foreach ($this->object->getSurveyQuestions() as $qdata) {
1851 foreach ($q_eval->getSumScores() as $finished_id => $sum_score) {
1852 if ($sum_score ===
null) {
1853 $sum_scores[$finished_id][
"score"] =
null;
1855 if ($sum_scores[$finished_id][
"score"] !==
null) {
1856 $sum_scores[$finished_id][
"score"] += (int) $sum_score;
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 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
const RESULTS_SELF_EVAL_OWN
static _lookupId($a_user_str)
Lookup id by login.
static _lookupObjId($a_id)
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
Personal skills GUI class.
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)
sumscore()
Show sum score table.
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="")
getSumScores(array $a_finished_ids=null)
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 getASCIIFilename($a_filename)
convert utf8 to ascii filename
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel