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();
98 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
100 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
101 $cmd = $this->ctrl->getCmd(
"competenceEval");
103 $cmd = $this->ctrl->getCmd(
"evaluation");
106 $next_class = $this->ctrl->getNextClass($this);
109 switch ($next_class) {
111 $this->setEvalSubTabs();
112 $ret = &$this->$cmd();
133 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
135 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
136 $ilTabs->addSubTabTarget(
137 "svy_eval_competences",
138 $this->ctrl->getLinkTarget($this,
"competenceEval"),
139 array(
"competenceEval")
143 $ilTabs->addSubTabTarget(
144 "svy_eval_cumulated",
145 $this->ctrl->getLinkTarget($this,
"evaluation"),
146 array(
"evaluation",
"checkEvaluationAccess")
149 $ilTabs->addSubTabTarget(
151 $this->ctrl->getLinkTarget($this,
"evaluationdetails"),
152 array(
"evaluationdetails")
156 $ilTabs->addSubTabTarget(
158 $this->ctrl->getLinkTarget($this,
"evaluationuser"),
159 array(
"evaluationuser")
172 $this->appr_id = $a_val;
196 if ($_REQUEST[
"appr_id"] ==
"") {
197 $req_appr_id =
$ilUser->getId();
199 $req_appr_id = (int) $_REQUEST[
"appr_id"];
203 if ($req_appr_id > 0 && $this->object->get360Mode()) {
207 foreach ($this->object->getAppraiseesData() as $item) {
208 if ($item[
"closed"] &&
209 ($item[
"user_id"] ==
$ilUser->getId() ||
210 $rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
212 $valid[] = $item[
"user_id"];
215 if (in_array($req_appr_id,
$valid)) {
225 $this->ctrl->setParameter($this,
"appr_id",
$appr_id);
241 if ($this->object->getAnonymize() == 1 &&
246 include_once
"Modules/Survey/classes/class.ilObjSurveyAccess.php";
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());
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"]) {
384 include_once
"Services/Excel/classes/class.ilExcel.php";
386 $excel->addSheet($this->lng->txt(
"svy_eval_cumulated"));
387 $excel->setCellArray(array($title_row),
"A1");
388 $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof($title_row) - 1) .
"1");
392 $csvfile = array($title_row);
399 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
400 foreach ($this->object->getSurveyQuestions() as $qdata) {
402 $q_res = $q_eval->getResults();
403 $ov_rows = $q_eval->exportResults($q_res, $do_title, $do_label);
405 switch (
$_POST[
"export_format"]) {
407 $excel->setActiveSheet(0);
408 foreach ($ov_rows as
$row) {
409 foreach (
$row as $col => $value) {
410 $excel->setCell($ov_row, $col, $value);
417 foreach ($ov_rows as
$row) {
424 switch (
$_POST[
"export_format"]) {
434 ? $this->lng->txt(
"svy_eval_cumulated")
435 : $this->lng->txt(
"svy_eval_detail");
437 $surveyname = $this->
object->getTitle() .
" " .
$type .
" " . date(
"Y-m-d");
438 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
442 switch (
$_POST[
"export_format"]) {
444 $excel->sendToClient($surveyname);
450 foreach ($csvfile as $csvrow) {
452 $csv .= join($separator, $csvrow) .
"\n";
471 $question_res = $a_results;
473 if (is_array($question_res)) {
474 $question_res = $question_res[0][1];
477 $question = $question_res->getQuestion();
479 $a_excel->
addSheet($question->getTitle());
487 $kv[$this->lng->txt(
"title")] = $question->getTitle();
490 $kv[$this->lng->txt(
"label")] = $question->label;
494 $kv[$this->lng->txt(
"question")] = $question->getQuestiontext();
502 $kv[$this->lng->txt(
"users_answered")] = (int) $question_res->getUsersAnswered();
503 $kv[$this->lng->txt(
"users_skipped")] = (int) $question_res->getUsersSkipped();
507 foreach ($kv as
$key => $value) {
509 $a_excel->
setCell($excel_row++, 1, $value);
534 foreach ($a_results as $row_results) {
535 $row_title = $row_results[0];
537 $a_excel->
setCell($excel_row, 0, $this->lng->txt(
"row"));
538 $a_excel->
setCell($excel_row++, 1, $row_title);
545 is_array($texts[$row_title])
546 ? array(
"" => $texts[$row_title])
554 $a_excel->
setCell($excel_row++, 0, $this->lng->txt(
"overview"));
558 $cats = $question->getColumns();
559 foreach ($cats->getCategories() as $cat) {
561 $a_excel->
setCell($excel_row, 1 + $counter, $cat->title);
566 foreach ($a_results as $row_results) {
567 $row_title = $row_results[0];
569 $a_excel->
setCell($excel_row, 0, $row_title);
571 $vars = $row_results[1]->getVariables();
573 foreach ($vars as $var) {
574 $a_excel->
setCell($excel_row, ++$counter, $var->abs);
582 $a_excel->
setBold(
"A1:A" . $excel_row);
589 if ($a_include_mode) {
592 $kv[$this->lng->txt(
"mode")] = is_array($a_results->
getModeValue())
604 if ($a_results->
getMean() !==
null) {
605 $kv[$this->lng->txt(
"arithmetic_mean")] = $a_results->
getMean();
609 foreach ($kv as
$key => $value) {
611 $a_excel->
setCell($a_excel_row++, 1, $value);
618 $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"categories"));
619 foreach ($a_grid[
"cols"] as $col_idx => $col) {
620 $a_excel->
setCell($a_excel_row, $col_idx + 1, $col);
625 foreach ($a_grid[
"rows"] as
$cols) {
626 foreach (
$cols as $col_idx => $col) {
627 $a_excel->
setCell($a_excel_row, $col_idx + 1, $col);
634 if ($a_text_answers) {
636 $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"freetext_answers"));
639 if (!is_array($a_text_answers[
""])) {
641 $a_excel->
setCell($a_excel_row, 1, $this->lng->txt(
"title"));
642 $a_excel->
setCell($a_excel_row++, 2, $this->lng->txt(
"answer"));
647 $a_excel->
setCell($a_excel_row++, 1, $this->lng->txt(
"answer"));
650 foreach ($a_text_answers as $var => $items) {
651 foreach ($items as $item) {
652 if (!is_array($a_text_answers[
""])) {
653 $a_excel->
setCell($a_excel_row, 1, $var);
654 $a_excel->
setCell($a_excel_row++, 2, $item);
656 $a_excel->
setCell($a_excel_row++, 1, $item);
665 if (strlen(
$_POST[
"export_format"])) {
669 $this->ctrl->redirect($this,
'evaluation');
675 if (strlen(
$_POST[
"export_format"])) {
679 $this->ctrl->redirect($this,
'evaluation');
686 $this->ctrl->redirect($this,
'evaluation');
693 $form_id =
"svymdfrm";
696 $tpl->addOnLoadCode(
'$("#form_' . $form_id .
'").submit(function() { $("#' . $a_id .
'").modal("hide"); });');
698 include_once
"Services/UIComponent/Modal/classes/class.ilModalGUI.php";
700 $modal->setId($a_id);
701 $modal->setHeading(($this->lng->txt(
"svy_export_format")));
703 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
705 $form->setId($form_id);
706 $form->setFormAction($this->ctrl->getFormAction($this, $a_cmd));
710 self::TYPE_XLS => $this->lng->txt(
'exp_type_excel'),
716 $label->setOptions(array(
717 'label_only' => $this->lng->txt(
'export_label_only'),
718 'title_only' => $this->lng->txt(
'export_title_only'),
719 'title_label' => $this->lng->txt(
'export_title_label')
721 $form->addItem($label);
723 $form->addCommandButton($a_cmd, $this->lng->txt(
"export"));
724 $form->setPreventDoubleSubmission(
false);
726 $modal->setBody(
$form->getHTML());
728 return $modal->getHTML();
738 $ui_factory = $ui->factory();
739 $ui_renderer = $ui->renderer();
743 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
748 switch ($this->object->getEvaluationAccess()) {
763 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
764 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
766 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation.html",
"Modules/Survey");
768 if ($this->object->get360Mode()) {
774 if (!$this->object->get360Mode() ||
$appr_id) {
776 $captions =
new ilSelectInputGUI($this->lng->txt(
"svy_eval_captions"),
"cp");
777 $captions->setOptions(array(
778 "ap" => $this->lng->txt(
"svy_eval_captions_abs_perc"),
779 "a" => $this->lng->txt(
"svy_eval_captions_abs"),
780 "p" => $this->lng->txt(
"svy_eval_captions_perc")
782 $captions->setValue(
$_POST[
"cp"]);
783 $ilToolbar->addInputItem($captions,
true);
786 $view->setOptions(array(
787 "tc" => $this->lng->txt(
"svy_eval_view_tables_charts"),
788 "t" => $this->lng->txt(
"svy_eval_view_tables"),
789 "c" => $this->lng->txt(
"svy_eval_view_charts")
791 $view->setValue(
$_POST[
"vw"]);
792 $ilToolbar->addInputItem($view,
true);
794 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
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'));
810 $modal_id =
"svy_ev_exp";
815 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
817 $button->setCaption(
"export");
818 $button->setOnClick(
'$(\'#' . $modal_id .
'\').modal(\
'show\')');
819 $ilToolbar->addButtonInstance($button);
821 $ilToolbar->addSeparator();
823 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
825 $button->setCaption(
"print");
826 $button->setOnClick(
"if(il.Accordion) { il.Accordion.preparePrint(); } window.print(); return false;");
827 $button->setOmitPreventDoubleSubmission(
true);
828 $ilToolbar->addButtonInstance($button);
830 $finished_ids =
null;
832 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
833 if (!
sizeof($finished_ids)) {
834 $finished_ids = array(-1);
838 $details_figure =
$_POST[
"cp"]
841 $details_view =
$_POST[
"vw"]
847 $finished_ids2 = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
850 $this->object->getRefId(),
851 (array) $finished_ids
855 include_once(
"./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
858 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
859 foreach ($this->object->getSurveyQuestions() as $qdata) {
861 $q_res = $q_eval->getResults();
866 $this->
renderDetails($details_view, $details_figure, $qdata, $q_eval, $q_res);
869 if ($qdata[
"questionblock_id"] &&
870 $qdata[
"questionblock_id"] != $this->last_questionblock_id) {
872 if ($qblock[
"show_blocktitle"]) {
873 $list->addListNode($qdata[
"questionblock_title"],
"q" . $qdata[
"questionblock_id"]);
875 $this->last_questionblock_id = $qdata[
"questionblock_id"];
877 $anchor_id =
"svyrdq" . $qdata[
"question_id"];
878 $list->addListNode(
"<a href='#" . $anchor_id .
"'>" . $qdata[
"title"] .
"</a>", $qdata[
"question_id"], $qdata[
"questionblock_id"] ?
879 "q" . $qdata[
"questionblock_id"] : 0);
884 $list->setListClass(
"il_Explorer");
885 $toc_tpl->setVariable(
"LIST",
$list->getHTML());
888 $panel_toc = $ui_factory->panel()->standard(
"", $ui_factory->legacy($toc_tpl->get()));
889 $render_toc = $ui_renderer->render($panel_toc);
890 $dtmpl->setVariable(
"PANEL_TOC", $render_toc);
894 $panel_report = $ui_factory->panel()->report($report_title, $this->array_panels);
895 $render_report = $ui_renderer->render($panel_report);
896 $dtmpl->setVariable(
"PANEL_REPORT", $render_report);
899 $this->tpl->setVariable(
'DETAIL', $dtmpl->get());
903 $this->tpl->setVariable(
'MODAL', $modal);
905 include_once
"./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
907 $this->tpl->setVariable(
'CUMULATED', $table_gui->getHTML());
917 $path_full =
$tree->getPathFull($this->object->getRefId());
918 foreach ($path_full as
$data) {
919 $path .=
" » ";
924 include_once
"Services/Link/classes/class.ilLink.php";
928 $this->lng->txt(
"path") =>
$path,
929 $this->lng->txt(
"svy_results") => !$details
930 ? $this->lng->txt(
"svy_eval_cumulated")
931 : $this->lng->txt(
"svy_eval_detail"),
935 $this->tpl->setCurrentBlock(
"print_header_bl");
936 foreach ($props as
$key => $value) {
937 $this->tpl->setVariable(
"HEADER_PROP_KEY",
$key);
938 $this->tpl->setVariable(
"HEADER_PROP_VALUE", $value);
939 $this->tpl->parseCurrentBlock();
958 $ui_factory = $this->ui->factory();
959 $a_tpl =
new ilTemplate(
"tpl.svy_results_details_panel.html",
true,
true,
"Modules/Survey");
961 $question_res = $a_results;
963 if (is_array($question_res)) {
964 $question_res = $question_res[0][1];
969 if (!is_object($question_res)) {
973 $question = $question_res->getQuestion();
982 $kv[
"users_answered"] = $question_res->getUsersAnswered();
983 $kv[
"users_skipped"] = $question_res->getUsersSkipped();
986 if ($question_res->getModeValue() !==
null) {
987 $kv[
"mode"] = wordwrap($question_res->getModeValueAsText(), 50,
"<br />");
988 $kv[
"mode_nr_of_selections"] = $question_res->getModeNrOfSelections();
990 if ($question_res->getMedian() !==
null) {
991 $kv[
"median"] = $question_res->getMedianAsText();
993 if ($question_res->getMean() !==
null) {
994 $kv[
"arithmetic_mean"] = $question_res->getMean();
999 $qst_title = $question->getTitle();
1000 $svy_text = nl2br($question->getQuestiontext());
1001 $card_table_tpl =
new ilTemplate(
"tpl.svy_results_details_card.html",
true,
true,
"Modules/Survey");
1002 foreach ($kv as
$key => $value) {
1003 $card_table_tpl->setCurrentBlock(
"question_statistics_card");
1004 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_KEY", $this->lng->txt(
$key));
1005 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_VALUE", $value);
1006 $card_table_tpl->parseCurrentBlock();
1009 $anchor_id =
"svyrdq" . $question->getId();
1010 $title =
"<span id='$anchor_id'>$qst_title</span>";
1011 $panel_qst_card = $ui_factory->panel()->sub(
$title, $ui_factory->legacy($svy_text))
1012 ->withCard($ui_factory->card()->standard($svy_type_title)->withSections(array($ui_factory->legacy($card_table_tpl->get()))));
1013 array_push($this->array_panels, $panel_qst_card);
1016 if ($a_details_parts ==
"t" ||
1017 $a_details_parts ==
"tc") {
1020 ($a_details_figure ==
"ap" || $a_details_figure ==
"a"),
1021 ($a_details_figure ==
"ap" || $a_details_figure ==
"p")
1024 foreach (
$grid[
"cols"] as $col) {
1025 $a_tpl->setCurrentBlock(
"grid_col_header_bl");
1026 $a_tpl->setVariable(
"COL_HEADER", $col);
1027 $a_tpl->parseCurrentBlock();
1030 foreach (
$cols as $idx => $col) {
1032 $a_tpl->touchBlock(
"grid_col_nowrap_bl");
1035 $a_tpl->setCurrentBlock(
"grid_col_bl");
1036 $a_tpl->setVariable(
"COL_CAPTION", trim($col));
1037 $a_tpl->parseCurrentBlock();
1040 $a_tpl->touchBlock(
"grid_row_bl");
1048 if (array_key_exists(
"", $texts)) {
1049 $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"given_answers"));
1050 foreach ($texts[
""] as $item) {
1051 $a_tpl->setCurrentBlock(
"text_direct_item_bl");
1052 $a_tpl->setVariable(
"TEXT_DIRECT", nl2br(htmlentities($item)));
1053 $a_tpl->parseCurrentBlock();
1056 include_once
"Services/Accordion/classes/class.ilAccordionGUI.php";
1058 $acc->setId(
"svyevaltxt" . $question->getId());
1060 $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"freetext_answers"));
1062 foreach ($texts as $var => $items) {
1063 $list = array(
"<ul class=\"small\">");
1064 foreach ($items as $item) {
1065 $list[] =
"<li>" . nl2br(htmlentities($item)) .
"</li>";
1068 $acc->addItem($var, implode(
"\n",
$list));
1071 $a_tpl->setVariable(
"TEXT_ACC", $acc->getHTML());
1076 if ($a_details_parts ==
"c" ||
1077 $a_details_parts ==
"tc") {
1078 $chart = $a_eval->
getChart($a_results);
1080 if (is_array($chart)) {
1082 if (is_array($chart[1])) {
1083 foreach ($chart[1] as $legend_item) {
1084 $r = hexdec(substr($legend_item[1], 1, 2));
1085 $g = hexdec(substr($legend_item[1], 3, 2));
1086 $b = hexdec(substr($legend_item[1], 5, 2));
1088 $a_tpl->setCurrentBlock(
"legend_bl");
1089 $a_tpl->setVariable(
"LEGEND_CAPTION", $legend_item[0]);
1090 $a_tpl->setVariable(
"LEGEND_COLOR", $legend_item[1]);
1091 $a_tpl->setVariable(
"LEGEND_COLOR_SVG",
$r .
"," . $g .
"," . $b);
1092 $a_tpl->parseCurrentBlock();
1098 $a_tpl->setVariable(
"CHART", $chart);
1101 $panel = $ui_factory->panel()->sub(
"", $ui_factory->legacy($a_tpl->get()));
1102 array_push($this->array_panels, $panel);
1116 $svy_mode = $this->
object->getMode();
1122 $options[
""] = $this->lng->txt(
"please_select");
1126 if ($this->object->get360Mode()) {
1127 foreach ($this->object->getAppraiseesData() as $item) {
1128 if ($item[
"closed"]) {
1129 $options[$item[
"user_id"]] = $item[
"login"];
1134 foreach ($this->object->getSurveyParticipants() as $item) {
1141 if (
$rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
1144 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1145 $appr =
new ilSelectInputGUI($this->lng->txt(
"svy_participant"),
"appr_id");
1148 $ilToolbar->addInputItem($appr,
true);
1150 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
1152 $button->setCaption(
"survey_360_select_appraisee");
1153 $button->setCommand($this->ctrl->getCmd());
1154 $ilToolbar->addButtonInstance($button);
1157 $ilToolbar->addSeparator();
1178 $resultarray = array();
1179 foreach (
$row as $rowindex => $entry) {
1180 if (is_array($entry)) {
1181 $entry = implode(
"/", $entry);
1187 if (strpos($entry,
"\"") !==
false) {
1188 $entry = str_replace(
"\"",
"\"\"", $entry);
1191 if (strpos($entry, $separator) !==
false) {
1195 $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
1197 $resultarray[$rowindex] = utf8_decode(
"\"" . $entry .
"\"");
1199 $resultarray[$rowindex] = utf8_decode($entry);
1202 return $resultarray;
1210 $title_row = $title_row2 = array();
1211 $title_row[] = $this->lng->txt(
"lastname");
1212 $title_row[] = $this->lng->txt(
"firstname");
1213 $title_row[] = $this->lng->txt(
"login");
1214 $title_row[] = $this->lng->txt(
'workingtime');
1215 $title_row[] = $this->lng->txt(
'survey_results_finished');
1221 if ($this->object->canExportSurveyCode()) {
1222 $title_row[] = $this->lng->txt(
"codes");
1226 $questions = array();
1228 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1229 foreach ($this->object->getSurveyQuestions() as $qdata) {
1231 $q_res = $q_eval->getResults();
1233 $questions[$qdata[
"question_id"]] = array($q_eval, $q_res);
1235 $question = is_array($q_res)
1236 ? $q_res[0][1]->getQuestion()
1237 : $q_res->getQuestion();
1239 $do_title = $do_label =
true;
1240 switch (
$_POST[
'export_label']) {
1242 $title_row[] = $question->label;
1248 $title_row[] = $question->getTitle();
1254 $title_row[] = $question->getTitle();
1255 $title_row2[] = $question->label;
1259 $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
1265 $rows[] = $title_row;
1266 if (implode(
"", $title_row2)) {
1267 $rows[] = $title_row2;
1273 $finished_ids =
null;
1274 if ($this->object->get360Mode()) {
1277 $this->ctrl->redirect($this,
"evaluationuser");
1279 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1280 if (!
sizeof($finished_ids)) {
1281 $finished_ids = array(-1);
1288 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1289 foreach ($participants as
$user) {
1290 $user_id =
$user[
"active_id"];
1299 if ($this->object->canExportSurveyCode()) {
1303 $row[] = $this->
object->getWorkingtimeForParticipant($user_id);
1305 if ((
bool)
$user[
"finished"]) {
1314 foreach ($questions as $item) {
1318 $q_eval->addUserSpecificResults(
$row, $user_id, $q_res);
1325 $surveyname = $this->
object->getTitle() .
" " . $this->lng->txt(
"svy_eval_user") .
" " . date(
"Y-m-d");
1326 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
1329 switch (
$_POST[
"export_format"]) {
1331 include_once
"Services/Excel/classes/class.ilExcel.php";
1333 $excel->addSheet($this->lng->txt(
"svy_eval_user"));
1336 foreach (
$row as $col_idx => $col) {
1337 $excel->setCell($row_idx + 1, $col_idx, $col);
1340 $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof(
$row) - 1) .
"1");
1343 $excel->sendToClient($surveyname);
1349 foreach (
$rows as $csvrow) {
1350 $csvrow = str_replace(
"\n",
" ", $this->
processCSVRow($csvrow,
true, $separator));
1351 $csv .= join($separator, $csvrow) .
"\n";
1373 $this->ctrl->redirectByClass(
"ilObjSurveyGUI",
"infoScreen");
1376 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
1377 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"evaluationuser"));
1379 if ($this->object->get360Mode()) {
1385 if (!$this->object->get360Mode() ||
$appr_id) {
1386 $modal_id =
"svy_ev_exp";
1389 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
1391 $button->setCaption(
"export");
1392 $button->setOnClick(
'$(\'#' . $modal_id .
'\').modal(\
'show\')');
1393 $ilToolbar->addButtonInstance($button);
1395 $ilToolbar->addSeparator();
1397 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
1399 $button->setCaption(
"print");
1400 $button->setOnClick(
"window.print(); return false;");
1401 $button->setOmitPreventDoubleSubmission(
true);
1402 $ilToolbar->addButtonInstance($button);
1404 $finished_ids =
null;
1406 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1407 if (!
sizeof($finished_ids)) {
1408 $finished_ids = array(-1);
1423 include_once
"./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
1425 $table_gui->setData(
$data);
1426 $this->tpl->setContent($table_gui->getHTML() . $modal);
1431 $all_participants = $this->
object->getSurveyParticipants($a_finished_ids);
1432 $participant_ids = [];
1433 foreach ($all_participants as $participant) {
1434 $participant_ids[] = $participant[
'usr_id'];
1438 $filtered_participant_ids = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
1441 $this->object->getRefId(),
1445 foreach ($all_participants as $username => $user_data) {
1446 if (!$user_data[
'usr_id']) {
1447 $participants[$username] = $user_data;
1449 if (in_array($user_data[
'usr_id'], $filtered_participant_ids)) {
1450 $participants[$username] = $user_data;
1453 return $participants;
1464 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1465 foreach ($this->object->getSurveyQuestions() as $qdata) {
1467 $q_res = $q_eval->getResults();
1470 if (is_array($q_res) && !is_object($q_res[0][1])) {
1474 $question = is_array($q_res)
1475 ? $q_res[0][1]->getQuestion()
1476 : $q_res->getQuestion();
1478 foreach ($participants as
$user) {
1479 $user_id =
$user[
"active_id"];
1481 $parsed_results = $q_eval->parseUserSpecificResults($q_res, $user_id);
1483 if (!array_key_exists($user_id,
$data)) {
1484 $wt = $this->
object->getWorkingtimeForParticipant($user_id);
1486 $finished =
$user[
"finished"]
1487 ?
$user[
"finished_tstamp"]
1490 $data[$user_id] = array(
1491 "username" =>
$user[
"sortname"],
1492 "question" => $question->getTitle(),
1493 "results" => $parsed_results,
1494 "workingtime" => $wt,
1495 "finished" => $finished,
1496 "subitems" => array()
1499 $data[$user_id][
"subitems"][] = array(
1501 "question" => $question->getTitle(),
1502 "results" => $parsed_results,
1503 "workingtime" =>
null,
1530 $ilTabs->activateSubtab(
"svy_eval_competences");
1531 $ilTabs->activateTab(
"svy_results");
1533 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"competenceEval"));
1545 $eval_modes = array();
1548 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
1550 $opts = $sskill->getAllAssignedSkillsAsOptions();
1552 foreach ($opts as
$id => $o) {
1553 $idarr = explode(
":",
$id);
1554 $skills[
$id] = array(
"id" =>
$id,
"title" => $o,
"profiles" => array(),
1555 "base_skill" => $idarr[0],
"tref_id" => $idarr[1]);
1561 include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
1563 foreach ($profiles as $p) {
1565 $prof_levels = $prof->getSkillLevels();
1566 foreach ($prof_levels as $pl) {
1567 if (isset($skills[$pl[
"base_skill_id"] .
":" . $pl[
"tref_id"]])) {
1568 $skills[$pl[
"base_skill_id"] .
":" . $pl[
"tref_id"]][
"profiles"][] =
1571 $eval_modes[
"gap_" . $p[
"id"]] =
1572 $lng->txt(
"svy_gap_analysis") .
": " . $prof->getTitle();
1582 foreach ($skills as $sk) {
1583 if (count($sk[
"profiles"]) == 0) {
1584 $eval_modes[
"skills_of_survey"] =
$lng->txt(
"svy_all_survey_competences");
1589 $comp_eval_mode =
$_GET[
"comp_eval_mode"];
1590 if (
$_POST[
"comp_eval_mode"] !=
"") {
1591 $comp_eval_mode =
$_POST[
"comp_eval_mode"];
1594 if (!isset($eval_modes[$comp_eval_mode])) {
1596 $comp_eval_mode = key($eval_modes);
1597 $ilCtrl->setParameter($this,
"comp_eval_mode", $comp_eval_mode);
1600 $ilCtrl->saveParameter($this,
"comp_eval_mode");
1602 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1604 $mode_sel->setOptions($eval_modes);
1605 $mode_sel->setValue($comp_eval_mode);
1606 $ilToolbar->addInputItem($mode_sel,
true);
1608 $ilToolbar->addFormButton(
$lng->txt(
"select"),
"competenceEval");
1610 if (substr($comp_eval_mode, 0, 4) ==
"gap_") {
1612 $profile_id = (int) substr($comp_eval_mode, 4);
1614 include_once(
"./Services/Skill/classes/class.ilPersonalSkillsGUI.php");
1616 $pskills_gui->setProfileId($profile_id);
1617 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(),
$lng->txt(
"skmg_eval_type_1"));
1618 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0) {
1620 $self_levels = array();
1621 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl) {
1622 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1624 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1630 include_once(
"./Services/Skill/classes/class.ilPersonalSkillsGUI.php");
1634 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(),
$lng->txt(
"skmg_eval_type_1"));
1636 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0) {
1638 $self_levels = array();
1639 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl) {
1640 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1642 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1645 foreach ($skills as $skill) {
1647 "base_skill_id" => (
int) $skill[
"base_skill"],
1648 "tref_id" => (
int) $skill[
"tref_id"]
1662 return $this->access->checkRbacOrPositionPermissionAccess(
'read_results',
'access_results', $this->object->getRefId());
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 _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
static _lookupId($a_user_str)
Lookup id by login.
static _lookupObjId($a_id)
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)
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.
renderDetails($a_details_parts, $a_details_figure, array $a_qdata, SurveyQuestionEvaluation $a_eval, $a_results)
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.
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(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_POST['submit'])) $form
if(isset($_REQUEST['delete'])) $list