41 $this->
object =& $a_object;
42 if ($this->object->get360Mode())
53 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
55 if ($this->object->get360SkillService() && $skmg_set->isActivated())
57 $cmd = $this->ctrl->getCmd(
"competenceEval");
61 $cmd = $this->ctrl->getCmd(
"evaluation");
64 $next_class = $this->ctrl->getNextClass($this);
70 $this->setEvalSubTabs();
92 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
94 if ($this->object->get360SkillService() && $skmg_set->isActivated())
96 $ilTabs->addSubTabTarget(
97 "svy_eval_competences",
98 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"competenceEval"),
99 array(
"competenceEval"),
104 $ilTabs->addSubTabTarget(
105 "svy_eval_cumulated",
106 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluation"),
107 array(
"evaluation",
"checkEvaluationAccess"),
111 $ilTabs->addSubTabTarget(
113 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationdetails"),
114 array(
"evaluationdetails"),
118 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
120 $ilTabs->addSubTabTarget(
122 $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui",
"evaluationuser"),
123 array(
"evaluationuser"),
137 $this->appr_id = $a_val;
162 $req_appr_id = $ilUser->getId();
166 $req_appr_id = (int)
$_REQUEST[
"appr_id"];
170 if ($req_appr_id > 0)
175 foreach($this->object->getAppraiseesData() as $item)
177 if ($item[
"closed"] &&
178 ($item[
"user_id"] == $ilUser->getId() ||
179 $rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
182 $valid[] = $item[
"user_id"];
185 if(in_array($req_appr_id,
$valid))
196 $this->ctrl->setParameter($this,
"appr_id",
$appr_id);
212 if($this->object->getAnonymize() == 1 &&
218 include_once
"Modules/Survey/classes/class.ilObjSurveyAccess.php";
221 if($this->object->getAnonymize() == 1)
228 if($this->object->getAnonymize() == 1)
231 $surveycode = $this->
object->getUserAccessCode($ilUser->getId());
232 if ($this->object->isAnonymizedParticipant($surveycode))
247 $this->tpl->setVariable(
"TABS",
"");
248 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation_checkaccess.html",
"Modules/Survey");
249 $this->tpl->setCurrentBlock(
"adm_content");
250 $this->tpl->setVariable(
"AUTHENTICATION_NEEDED", $this->lng->txt(
"svy_check_evaluation_authentication_needed"));
251 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"checkEvaluationAccess"));
252 $this->tpl->setVariable(
"EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt(
"svy_check_evaluation_access_introduction"));
253 $this->tpl->setVariable(
"VALUE_CHECK", $this->lng->txt(
"ok"));
254 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
255 $this->tpl->setVariable(
"TEXT_SURVEY_CODE", $this->lng->txt(
"survey_code"));
256 $this->tpl->parseCurrentBlock();
259 $_SESSION[
"anon_evaluation_access"] = null;
272 $surveycode =
$_POST[
"surveycode"];
273 if ($this->object->isAnonymizedParticipant($surveycode))
296 include_once
"./Services/Utilities/classes/class.ilUtil.php";
298 $path = $tree->getPathFull($this->object->getRefID());
299 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
301 $ilCtrl->redirectByClass(
"ilrepositorygui",
"frameset");
319 $format_percent =
"";
320 $format_datetime =
"";
323 switch (
$_POST[
"export_format"])
326 include_once
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
329 $workbook = $adapter->getWorkbook();
330 $workbook->setVersion(8);
332 $format_bold =& $workbook->addFormat();
333 $format_bold->setBold();
334 $format_percent =& $workbook->addFormat();
335 $format_percent->setNumFormat(
"0.00%");
336 $format_datetime =& $workbook->addFormat();
337 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
338 $format_title =& $workbook->addFormat();
339 $format_title->setBold();
340 $format_title->setColor(
'black');
341 $format_title->setPattern(1);
342 $format_title->setFgColor(
'silver');
343 $format_title->setAlign(
'center');
345 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
346 $mainworksheet =& $workbook->addWorksheet();
348 switch (
$_POST[
'export_label'])
385 switch (
$_POST[
'export_label'])
388 array_push($csvrow, $this->lng->txt(
"label"));
391 array_push($csvrow, $this->lng->txt(
"title"));
394 array_push($csvrow, $this->lng->txt(
"title"));
395 array_push($csvrow, $this->lng->txt(
"label"));
398 array_push($csvrow, $this->lng->txt(
"question"));
399 array_push($csvrow, $this->lng->txt(
"question_type"));
400 array_push($csvrow, $this->lng->txt(
"users_answered"));
401 array_push($csvrow, $this->lng->txt(
"users_skipped"));
402 array_push($csvrow, $this->lng->txt(
"mode"));
407 array_push($csvrow, $this->lng->txt(
"mode_nr_of_selections"));
408 array_push($csvrow, $this->lng->txt(
"median"));
409 array_push($csvrow, $this->lng->txt(
"arithmetic_mean"));
410 array_push($csvfile, $csvrow);
414 $finished_ids = null;
415 if($this->object->get360Mode())
420 $this->ctrl->redirect($this, $details ?
"evaluationdetails" :
"evaluation");
422 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
423 if(!
sizeof($finished_ids))
425 $finished_ids = array(-1);
429 $questions =& $this->
object->getSurveyQuestions();
431 foreach ($questions as $data)
433 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
435 $eval = $this->
object->getCumulatedResults($question, $finished_ids);
436 switch (
$_POST[
"export_format"])
439 $counter = $question->setExportCumulatedXLS($mainworksheet, $format_title, $format_bold, $eval, $counter,
$_POST[
'export_label']);
443 $csvrows =& $question->setExportCumulatedCVS($eval,
$_POST[
'export_label']);
444 foreach ($csvrows as $csvrow)
446 array_push($csvfile, $csvrow);
452 switch (
$_POST[
"export_format"])
455 $question->setExportDetailsXLS($workbook, $format_title, $format_bold, $eval,
$_POST[
'export_label']);
464 $type = $this->lng->txt(
"svy_eval_cumulated");
468 $type = $this->lng->txt(
"svy_eval_detail");
470 $surveyname = $this->
object->getTitle().
" ".$type.
" ".date(
"Y-m-d");
471 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
474 switch (
$_POST[
"export_format"])
486 foreach ($csvfile as $csvrow)
488 $csvrow =& $this->
object->processCSVRow($csvrow, TRUE,
$separator);
491 include_once
"./Services/Utilities/classes/class.ilUtil.php";
500 if (strlen(
$_POST[
"export_format"]))
507 $this->ctrl->redirect($this,
'evaluation');
513 if (strlen(
$_POST[
"export_format"]))
520 $this->ctrl->redirect($this,
'evaluation');
527 $this->ctrl->redirect($this,
'evaluation');
537 if (!$rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
539 if (!$rbacsystem->checkAccess(
"read",
$_GET[
"ref_id"]))
545 switch ($this->object->getEvaluationAccess())
562 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
563 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
565 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation.html",
"Modules/Survey");
569 if($this->object->get360Mode())
575 if(!$this->object->get360Mode() ||
$appr_id)
578 $format->setOptions(array(
579 self::TYPE_XLS => $this->lng->txt(
'exp_type_excel'),
582 $ilToolbar->addInputItem($format);
585 $label->setOptions(array(
586 'label_only' => $this->lng->txt(
'export_label_only'),
587 'title_only' => $this->lng->txt(
'export_title_only'),
588 'title_label'=> $this->lng->txt(
'export_title_label')
590 $ilToolbar->addInputItem($label);
594 $ilToolbar->addFormButton($this->lng->txt(
"export"),
'exportDetailData');
598 $ilToolbar->addFormButton($this->lng->txt(
"export"),
'exportData');
601 $finished_ids = null;
604 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
605 if(!
sizeof($finished_ids))
607 $finished_ids = array(-1);
611 $questions =& $this->
object->getSurveyQuestions();
614 $last_questionblock_id = null;
615 foreach ($questions as $qdata)
617 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
619 $question = $question_gui->object;
620 $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter, $finished_ids);
625 $main = array_shift($c);
626 $main[
"subitems"] = $c;
627 array_push($data, $main);
631 array_push($data, $c);
637 if($qdata[
"questionblock_id"] && $qdata[
"questionblock_id"] != $last_questionblock_id)
639 $qblock = $this->
object->getQuestionblock($qdata[
"questionblock_id"]);
640 if($qblock[
"show_blocktitle"])
642 $this->tpl->setCurrentBlock(
"detail_qblock");
643 $this->tpl->setVariable(
"BLOCKTITLE", $qdata[
"questionblock_title"]);
644 $this->tpl->parseCurrentBlock();
647 $last_questionblock_id = $qdata[
"questionblock_id"];
650 $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter-1, $finished_ids);
651 $this->tpl->setCurrentBlock(
"detail");
652 $this->tpl->setVariable(
"DETAIL", $detail);
653 $this->tpl->parseCurrentBlock();
658 include_once
"./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
660 $table_gui->setData($data);
661 $this->tpl->setVariable(
'CUMULATED', $table_gui->getHTML());
662 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
663 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this,
'evaluation'));
674 global $ilToolbar, $rbacsystem;
676 if($this->object->get360Mode())
683 $options[
""] = $this->lng->txt(
"please_select");
686 foreach($this->object->getAppraiseesData() as $item)
690 $options[$item[
"user_id"]] = $item[
"login"];
697 if ($rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
700 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
701 $appr =
new ilSelectInputGUI($this->lng->txt(
"survey_360_appraisee"),
"appr_id");
704 $ilToolbar->addInputItem($appr,
true);
706 $ilToolbar->addFormButton($this->lng->txt(
"survey_360_select_appraisee"),
707 $this->ctrl->getCmd());
711 $ilToolbar->addSeparator();
738 $questions = array();
739 $questions =& $this->
object->getSurveyQuestions(
true);
740 array_push($csvrow, $this->lng->txt(
"lastname"));
741 array_push($csvrow, $this->lng->txt(
"firstname"));
742 array_push($csvrow, $this->lng->txt(
"login"));
743 array_push($csvrow2,
"");
744 array_push($csvrow2,
"");
745 array_push($csvrow2,
"");
746 if ($this->object->canExportSurveyCode())
748 array_push($csvrow, $this->lng->txt(
"codes"));
749 array_push($csvrow2,
"");
759 foreach ($questions as $question_id => $question_data)
761 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
763 switch ($export_label)
766 $question->addUserSpecificResultsExportTitles($csvrow,
true);
770 $question->addUserSpecificResultsExportTitles($csvrow,
false);
774 $question->addUserSpecificResultsExportTitles($csvrow,
false);
775 $question->addUserSpecificResultsExportTitles($csvrow2,
true,
false);
779 $questions[$question_data[
"question_id"]] = $question;
781 array_push($csvfile, $csvrow);
782 if(
sizeof($csvrow2) && implode(
"", $csvrow2))
784 array_push($csvfile, $csvrow2);
788 $participants =& $this->
object->getSurveyFinishedIds();
792 $participants = $finished_ids;
794 foreach ($participants as $user_id)
801 $resultset =& $this->
object->getEvaluationByUser($questions, $user_id);
805 array_push($csvrow, (trim($resultset[
"lastname"]))
806 ? $resultset[
"lastname"]
807 : $resultset[
"name"]);
808 array_push($csvrow, $resultset[
"firstname"]);
810 array_push($csvrow, $resultset[
"login"]);
811 if ($this->object->canExportSurveyCode())
813 array_push($csvrow, $user_id);
821 foreach ($questions as $question_id => $question)
823 $question->addUserSpecificResultsData($csvrow, $resultset);
825 $wt = $this->
object->getWorkingtimeForParticipant($user_id);
826 array_push($csvrow, $wt);
827 array_push($csvfile, $csvrow);
831 $surveyname = $this->
object->getTitle().
" ".$this->lng->txt(
"svy_eval_user").
" ".date(
"Y-m-d");
832 $surveyname = preg_replace(
"/\s/",
"_", trim($surveyname));
835 switch ($export_format)
838 include_once
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
841 $workbook = $adapter->getWorkbook();
842 $workbook->setVersion(8);
844 $format_bold =& $workbook->addFormat();
845 $format_bold->setBold();
846 $format_percent =& $workbook->addFormat();
847 $format_percent->setNumFormat(
"0.00%");
848 $format_datetime =& $workbook->addFormat();
849 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
850 $format_title =& $workbook->addFormat();
851 $format_title->setBold();
852 $format_title->setColor(
'black');
853 $format_title->setPattern(1);
854 $format_title->setFgColor(
'silver');
855 $format_title_plain =& $workbook->addFormat();
856 $format_title_plain->setColor(
'black');
857 $format_title_plain->setPattern(1);
858 $format_title_plain->setFgColor(
'silver');
860 $pages = floor((count($csvfile[0])) / 250) + 1;
861 $worksheets = array();
862 for ($i = 0; $i < $pages; $i++)
864 $worksheets[$i] =& $workbook->addWorksheet();
867 include_once
"./Services/Excel/classes/class.ilExcelUtils.php";
868 $contentstartrow = 0;
869 foreach ($csvfile as $csvrow)
875 $mainworksheet =& $worksheets[$worksheet];
876 foreach ($csvrow as $text)
881 foreach ($text as $string)
885 $contentstartrow = max($contentstartrow, $textcount);
897 $mainworksheet =& $worksheets[$worksheet];
902 $row = $contentstartrow;
907 $mainworksheet =& $worksheets[$worksheet];
908 foreach ($csvrow as $text)
910 if (is_numeric($text))
912 $mainworksheet->writeNumber(
$row, $col++, $text);
922 $mainworksheet =& $worksheets[$worksheet];
937 foreach ($csvfile as $csvrow)
939 $csvrow =& str_replace(
"\n",
" ", $this->object->processCSVRow($csvrow, TRUE,
$separator));
942 include_once
"./Services/Utilities/classes/class.ilUtil.php";
951 $finished_ids = null;
952 if($this->object->get360Mode())
957 $this->ctrl->redirect($this,
"evaluationuser");
959 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
960 if(!
sizeof($finished_ids))
962 $finished_ids = array(-1);
978 global $ilAccess,
$ilLog, $ilToolbar;
980 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
983 $this->ctrl->redirectByClass(
"ilObjSurveyGUI",
"infoScreen");
986 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
987 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"evaluationuser"));
989 if($this->object->get360Mode())
996 if(!$this->object->get360Mode() ||
$appr_id)
999 $format->setOptions(array(
1000 self::TYPE_XLS => $this->lng->txt(
'exp_type_excel'),
1003 $ilToolbar->addInputItem($format);
1006 $label->setOptions(array(
1007 'label_only' => $this->lng->txt(
'export_label_only'),
1008 'title_only' => $this->lng->txt(
'export_title_only'),
1009 'title_label'=> $this->lng->txt(
'export_title_label')
1011 $ilToolbar->addInputItem($label);
1013 $ilToolbar->addFormButton($this->lng->txt(
"export"),
'exportevaluationuser');
1015 $ilToolbar->addSeparator();
1017 $ilToolbar->addButton($this->lng->txt(
"print"),
"#",
"",
"",
"onclick=\"javascript:window.print()\"");
1019 $finished_ids = null;
1022 $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
1023 if(!
sizeof($finished_ids))
1025 $finished_ids = array(-1);
1029 $userResults =& $this->
object->getUserSpecificResults($finished_ids);
1030 $questions =& $this->
object->getSurveyQuestions(
true);
1031 $participants =& $this->
object->getSurveyParticipants($finished_ids);
1032 $tabledata = array();
1034 foreach ($participants as $data)
1036 $questioncounter = 1;
1040 foreach ($questions as $question_id => $question_data)
1042 $found = $userResults[$question_id][$data[
"active_id"]];
1044 if (is_array($found))
1046 $text = implode(
"<br />", $found);
1053 $wt = $this->
object->getWorkingtimeForParticipant($data[
'active_id']);
1056 $tabledata[++$counter] = array(
1057 'username' => $data[
"sortname"],
1059 'question' => $questioncounter++ .
". " . $question_data[
"title"],
1061 'workingtime' => $wt
1067 $tabledata[$counter][
"subitems"][] = array(
1070 'question' => $questioncounter++ .
". " . $question_data[
"title"],
1072 'workingtime' => null
1079 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
1080 $this->tpl->setCurrentBlock(
"generic_css");
1081 $this->tpl->setVariable(
"LOCATION_GENERIC_STYLESHEET",
"./Modules/Survey/templates/default/evaluation_print.css");
1082 $this->tpl->setVariable(
"MEDIA_GENERIC_STYLESHEET",
"print");
1083 $this->tpl->parseCurrentBlock();
1085 include_once
"./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
1087 $table_gui->
setData($tabledata);
1088 $this->tpl->setContent($table_gui->getHTML());
1103 $ilTabs->activateSubtab(
"svy_eval_competences");
1104 $ilTabs->activateTab(
"svy_results");
1106 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"competenceEval"));
1108 if($this->object->get360Mode())
1120 $eval_modes = array();
1123 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
1125 $opts = $sskill->getAllAssignedSkillsAsOptions();
1127 foreach ($opts as $id => $o)
1129 $idarr = explode(
":", $id);
1130 $skills[$id] = array(
"id" => $id,
"title" => $o,
"profiles" => array(),
1131 "base_skill" => $idarr[0],
"tref_id" => $idarr[1]);
1137 include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
1139 foreach ($profiles as $p)
1142 $prof_levels = $prof->getSkillLevels();
1143 foreach ($prof_levels as $pl)
1145 if (isset($skills[$pl[
"base_skill_id"].
":".$pl[
"tref_id"]]))
1147 $skills[$pl[
"base_skill_id"].
":".$pl[
"tref_id"]][
"profiles"][] =
1150 $eval_modes[
"gap_".$p[
"id"]] =
1151 $lng->txt(
"svy_gap_analysis").
": ".$prof->getTitle();
1161 foreach ($skills as $sk)
1163 if (count($sk[
"profiles"]) == 0)
1165 $eval_modes[
"skills_of_survey"] = $lng->txt(
"svy_all_survey_competences");
1170 $comp_eval_mode =
$_GET[
"comp_eval_mode"];
1171 if (
$_POST[
"comp_eval_mode"] !=
"")
1173 $comp_eval_mode =
$_POST[
"comp_eval_mode"];
1176 if (!isset($eval_modes[$comp_eval_mode]))
1179 $comp_eval_mode = key($eval_modes);
1180 $ilCtrl->setParameter($this,
"comp_eval_mode", $comp_eval_mode);
1183 $ilCtrl->saveParameter($this,
"comp_eval_mode");
1185 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1186 $mode_sel =
new ilSelectInputGUI($lng->txt(
"svy_analysis"),
"comp_eval_mode");
1188 $mode_sel->setValue($comp_eval_mode);
1189 $ilToolbar->addInputItem($mode_sel,
true);
1191 $ilToolbar->addFormButton($lng->txt(
"select"),
"competenceEval");
1193 if (substr($comp_eval_mode, 0, 4) ==
"gap_")
1196 $profile_id = (int) substr($comp_eval_mode, 4);
1198 include_once(
"./Services/Skill/classes/class.ilPersonalSkillsGUI.php");
1200 $pskills_gui->setProfileId($profile_id);
1201 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt(
"survey_360_raters"));
1202 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0)
1205 $self_levels = array();
1206 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl)
1208 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1210 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1212 $html = $pskills_gui->getGapAnalysisHTML(
$appr_id);
1214 $tpl->setContent($html);
1218 include_once(
"./Services/Skill/classes/class.ilPersonalSkillsGUI.php");
1220 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt(
"survey_360_raters"));
1221 if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id,
$appr_id) > 0)
1224 $self_levels = array();
1225 foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id,
true) as $sl)
1227 $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
1229 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1232 foreach ($skills as $skill)
1235 "base_skill_id" => (
int) $skill[
"base_skill"],
1236 "tref_id" => (
int) $skill[
"tref_id"]
1239 $html = $pskills_gui->getGapAnalysisHTML(
$appr_id, $sk);
1241 $tpl->setContent($html);