ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSurveyEvaluationGUI Class Reference

Survey evaluation graphical output. More...

+ Collaboration diagram for ilSurveyEvaluationGUI:

Public Member Functions

 __construct (ilObjSurvey $a_object)
 
 executeCommand ()
 
 setEvalSubtabs ()
 Set the tabs for the evaluation output. More...
 
 setAppraiseeId (int $a_val)
 
 getAppraiseeId ()
 
 checkAnonymizedEvaluationAccess ()
 
 checkEvaluationAccess ()
 Checks the evaluation access after entering the survey access code. More...
 
 cancelEvaluationAccess ()
 Cancels the input of the survey access code for evaluation access. More...
 
 exportCumulatedResults (int $details=0)
 
 exportData ()
 
 exportDetailData ()
 
 printEvaluation ()
 
 evaluation (int $details=0)
 
 processCSVRow (array $row, bool $quoteAll=false, string $separator=";")
 Processes an array as a CSV row and converts the array values to correct CSV values. More...
 
 exportEvaluationUser ()
 
 evaluationuser ()
 Print the survey evaluation for a selected user. More...
 
 competenceEval ()
 
 sumscore ()
 Show sum score table. More...
 
 printResultsOverviewSelection ()
 
 printResultsDetailsSelection ()
 
 printResultsDetails ()
 
 printResultsPerUserSelection ()
 
 printResultsPerUser ()
 

Data Fields

const TYPE_XLS = "excel"
 
const TYPE_SPSS = "csv"
 
const EXCEL_SUBTITLE = "DDDDDD"
 

Protected Member Functions

 evaluationdetails ()
 Show the detailed evaluation. More...
 
 exportResultsDetailsExcel (ilExcel $a_excel, SurveyQuestionEvaluation $a_eval, $a_results, bool $a_do_title, bool $a_do_label, int $question_index)
 Export details (excel only) More...
 
 parseResultsToExcel (ilExcel $a_excel, ilSurveyEvaluationResults $a_results, int &$a_excel_row, ?array $a_grid=null, ?array $a_text_answers=null, bool $a_include_mode=true)
 
 buildExportButtonAndModal (string $export_cmd)
 
 getExportModal ()
 
 validateAndSubmitExportForm ()
 
 openEvaluation ()
 
 hasResultsAccess ()
 Check if user can view results granted by rbac or positions. More...
 
 getSumScores (?array $a_finished_ids=null)
 

Protected Attributes

ILIAS Survey InternalGUIService $gui
 
ILIAS Survey Access AccessManager $access_manager
 
ILIAS Survey PrintView GUIService $print
 
 $last_questionblock_id
 
array $array_panels
 
ilLogger $log
 
ILIAS DI UIServices $ui
 
ILIAS Survey Evaluation EvaluationManager $evaluation_manager
 
ilTabsGUI $tabs
 
ilAccessHandler $access
 
ilObjUser $user
 
ilRbacSystem $rbacsystem
 
ilTree $tree
 
ilToolbarGUI $toolbar
 
ilObjSurvey $object
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
int $appr_id = null
 
ILIAS Survey Mode UIModifier $ui_modifier = null
 
ILIAS Survey Evaluation EvaluationGUIRequest $request
 
ILIAS Skill Service SkillProfileService $skill_profile_service
 

Detailed Description

Survey evaluation graphical output.

The ilSurveyEvaluationGUI class creates the evaluation output for the ilObjSurveyGUI class. This saves some heap space because the ilObjSurveyGUI class will be smaller.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m

Definition at line 30 of file class.ilSurveyEvaluationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyEvaluationGUI::__construct ( ilObjSurvey  $a_object)

Definition at line 62 of file class.ilSurveyEvaluationGUI.php.

64 {
65 global $DIC;
66
67 $this->tabs = $DIC->tabs();
68 $this->access = $DIC->access();
69 $this->user = $DIC->user();
70 $this->rbacsystem = $DIC->rbac()->system();
71 $this->tree = $DIC->repositoryTree();
72 $this->toolbar = $DIC->toolbar();
73 $this->ui = $DIC->ui();
74 $lng = $DIC->language();
75 $tpl = $DIC["tpl"];
76 $ilCtrl = $DIC->ctrl();
77
78 $this->lng = $lng;
79 $this->tpl = $tpl;
80 $this->ctrl = $ilCtrl;
81 $this->object = $a_object;
82 $this->log = ilLoggerFactory::getLogger("svy");
83 $this->array_panels = array();
84
85 $this->request = $DIC->survey()->internal()->gui()->evaluation($this->object)->request();
86
87 $this->ctrl->saveParameter($this, ["appr_id", "rater_id"]);
88 $this->evaluation_manager = $DIC
89 ->survey()
90 ->internal()
91 ->domain()
92 ->evaluation(
93 $this->object,
94 $DIC->user()->getId(),
95 $this->request->getAppraiseeId(),
96 $this->request->getRaterId()
97 );
98
99 $this->setAppraiseeId(
100 $this->evaluation_manager->getCurrentAppraisee()
101 );
102
103 $this->ui_modifier = $DIC->survey()
104 ->internal()
105 ->gui()
106 ->modeUIModifier($this->object->getMode());
107 $this->print = $DIC->survey()
108 ->internal()
109 ->gui()
110 ->print();
111 $this->access_manager = $DIC->survey()
112 ->internal()
113 ->domain()
114 ->access(
115 $this->object->getRefId(),
116 $DIC->user()->getId()
117 );
118 $this->skill_profile_service = $DIC->skills()->profile();
119 $this->gui = $DIC->survey()->internal()->gui();
120 }
static getLogger(string $a_component_id)
Get component logger.
ilGlobalTemplateInterface $tpl
global $DIC
Definition: shib_login.php:26

References $DIC, $lng, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), ILIAS\Repository\lng(), ILIAS\Repository\object(), setAppraiseeId(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildExportButtonAndModal()

ilSurveyEvaluationGUI::buildExportButtonAndModal ( string  $export_cmd)
protected

Definition at line 644 of file class.ilSurveyEvaluationGUI.php.

646 : void {
650 $ui_fac = $this->gui->ui()->factory();
651
652 $ctrl->setParameter($this, "export_cmd", $export_cmd);
653 $modal = $this->getExportModal();
654 $button = $ui_fac->button()->standard(
655 $lng->txt("export"),
656 "#"
657 )->withOnClick($modal->getShowSignal());
658
659 $toolbar->addComponent($button);
660 $toolbar->addComponent($modal);
661 }
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
addComponent(\ILIAS\UI\Component\Component $a_comp)

◆ cancelEvaluationAccess()

ilSurveyEvaluationGUI::cancelEvaluationAccess ( )

Cancels the input of the survey access code for evaluation access.

Definition at line 265 of file class.ilSurveyEvaluationGUI.php.

265 : void
266 {
267 $ilCtrl = $this->ctrl;
269 $path = $tree->getPathFull($this->object->getRefId());
270 $ilCtrl->setParameterByClass(
271 "ilrepositorygui",
272 "ref_id",
273 $path[count($path) - 2]["child"]
274 );
275 $ilCtrl->redirectByClass("ilrepositorygui", "frameset");
276 }
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
$path
Definition: ltiservices.php:30

References $path, ilTree\getPathFull(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ checkAnonymizedEvaluationAccess()

ilSurveyEvaluationGUI::checkAnonymizedEvaluationAccess ( )

Definition at line 203 of file class.ilSurveyEvaluationGUI.php.

203 : bool
204 {
205 $ilUser = $this->user;
206
207 if ($this->object->getAnonymize() === 1 &&
208 $this->evaluation_manager->getAnonEvaluationAccess() === $this->request->getRefId()) {
209 return true;
210 }
211
213 ilObject::_lookupObjId($this->request->getRefId()),
214 $ilUser->getId()
215 )) {
216 if ($this->object->getAnonymize() === 1) {
217 $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
218 }
219 return true;
220 }
221
222 if ($this->object->getAnonymize() === 1) {
223 // autocode
224 $surveycode = $this->object->getUserAccessCode($ilUser->getId());
225 if ($this->object->isAnonymizedParticipant($surveycode)) {
226 $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
227 return true;
228 }
229
230 // code needed
231 $this->tpl->setVariable("TABS", "");
232 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_checkaccess.html", "components/ILIAS/Survey");
233 $this->tpl->setCurrentBlock("adm_content");
234 $this->tpl->setVariable("AUTHENTICATION_NEEDED", $this->lng->txt("svy_check_evaluation_authentication_needed"));
235 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "checkEvaluationAccess"));
236 $this->tpl->setVariable("EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt("svy_check_evaluation_access_introduction"));
237 $this->tpl->setVariable("VALUE_CHECK", $this->lng->txt("ok"));
238 $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
239 $this->tpl->setVariable("TEXT_SURVEY_CODE", $this->lng->txt("survey_code"));
240 $this->tpl->parseCurrentBlock();
241 }
242
243 $this->evaluation_manager->clearAnonEvaluationAccess();
244 return false;
245 }
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
static _lookupObjId(int $ref_id)

References ilObjSurveyAccess\_hasEvaluationAccess(), ilObject\_lookupObjId(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ checkEvaluationAccess()

ilSurveyEvaluationGUI::checkEvaluationAccess ( )

Checks the evaluation access after entering the survey access code.

Definition at line 250 of file class.ilSurveyEvaluationGUI.php.

250 : void
251 {
252 $surveycode = $this->request->getSurveyCode();
253 if ($this->object->isAnonymizedParticipant($surveycode)) {
254 $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
255 $this->evaluation();
256 } else {
257 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("svy_check_evaluation_wrong_key", true));
258 $this->cancelEvaluationAccess();
259 }
260 }
cancelEvaluationAccess()
Cancels the input of the survey access code for evaluation access.

References ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ competenceEval()

ilSurveyEvaluationGUI::competenceEval ( )

Definition at line 1179 of file class.ilSurveyEvaluationGUI.php.

1179 : void
1180 {
1181 $lng = $this->lng;
1182 $ilCtrl = $this->ctrl;
1183 $ilToolbar = $this->toolbar;
1184 $tpl = $this->tpl;
1185 $ilTabs = $this->tabs;
1186
1187 $survey = $this->object;
1188
1189 $ilTabs->activateSubTab("svy_eval_competences");
1190 $ilTabs->activateTab("svy_results");
1191
1192 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "competenceEval"));
1193
1194 $appr_id = $this->getAppraiseeId();
1195
1196 if ($appr_id === 0) {
1197 $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_no_appraisees_found"));
1198 return;
1199 }
1200
1201 $this->ui_modifier->setResultsCompetenceToolbar(
1202 $this->object,
1203 $ilToolbar,
1204 $this->user->getId()
1205 );
1206
1207 // evaluation modes
1208 $eval_modes = array();
1209
1210 // get all competences of survey
1211 $sskill = new ilSurveySkill($survey);
1212 $opts = $sskill->getAllAssignedSkillsAsOptions();
1213 $skills = array();
1214 foreach ($opts as $id => $o) {
1215 $idarr = explode(":", $id);
1216 $skills[$id] = array("id" => $id, "title" => $o, "profiles" => array(),
1217 "base_skill" => $idarr[0], "tref_id" => $idarr[1]);
1218 }
1219
1220 // get matching user competence profiles
1221 // -> add gap analysis to profile
1222 $profiles = $this->skill_profile_service->getProfilesOfUser($appr_id);
1223 foreach ($profiles as $p) {
1224 $prof_levels = $this->skill_profile_service->getSkillLevels($p->getId());
1225 foreach ($prof_levels as $pl) {
1226 if (isset($skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()])) {
1227 $skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()]["profiles"][] =
1228 $p->getId();
1229
1230 $eval_modes["gap_" . $p->getId()] =
1231 $lng->txt("svy_gap_analysis") . ": " . $p->getTitle();
1232 }
1233 }
1234 }
1235
1236 // if one competence does not match any profiles
1237 // -> add "competences of survey" alternative
1238 foreach ($skills as $sk) {
1239 if (count($sk["profiles"]) === 0) {
1240 $eval_modes["skills_of_survey"] = $lng->txt("svy_all_survey_competences");
1241 }
1242 }
1243
1244 // final determination of current evaluation mode
1245 $comp_eval_mode = $this->request->getCompEvalMode();
1246
1247 if (!isset($eval_modes[$comp_eval_mode])) {
1248 $comp_eval_mode = key($eval_modes);
1249 $ilCtrl->setParameter($this, "comp_eval_mode", $comp_eval_mode);
1250 }
1251
1252 $ilCtrl->saveParameter($this, "comp_eval_mode");
1253
1254 $mode_sel = new ilSelectInputGUI($lng->txt("svy_analysis"), "comp_eval_mode");
1255 $mode_sel->setOptions($eval_modes);
1256 $mode_sel->setValue($comp_eval_mode);
1257 $ilToolbar->addInputItem($mode_sel, true);
1258
1259 $ilToolbar->addFormButton($lng->txt("select"), "competenceEval");
1260
1261 $pskills_gui = new ilPersonalSkillsGUI();
1262 $rater = $this->evaluation_manager->getCurrentRater(
1263 $this->object->getMode() === ilObjSurvey::MODE_IND_FEEDB
1264 );
1265 if ($rater !== "") {
1266 if (strpos($rater ?? "", "u") === 0) {
1267 $rater = substr($rater, 1);
1268 }
1269 $pskills_gui->setTriggerUserFilter($rater);
1270 $pskills_gui->setHistoryView(true);
1271 }
1272
1273 if (strpos($comp_eval_mode ?? "", "gap_") === 0) {
1274 // gap analysis
1275 $profile_id = (int) substr($comp_eval_mode, 4);
1276
1277 $pskills_gui->setProfileId($profile_id);
1278 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1279 if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1280 $sskill = new ilSurveySkill($survey);
1281 $self_levels = array();
1282 foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1283 $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1284 }
1285 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1286 }
1287 $html = $pskills_gui->getGapAnalysisHTML($appr_id);
1288 } else { // must be all survey competences
1289 $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1290 if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1291 $sskill = new ilSurveySkill($survey);
1292 $self_levels = array();
1293 foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1294 $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1295 }
1296 $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1297 }
1298 $sk = array();
1299 foreach ($skills as $skill) {
1300 $sk[] = array(
1301 "base_skill_id" => (int) $skill["base_skill"],
1302 "tref_id" => (int) $skill["tref_id"]
1303 );
1304 }
1305 $html = $pskills_gui->getGapAnalysisHTML($appr_id, $sk);
1306 }
1307 $tpl->setContent($html);
1308 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Personal skills GUI class.
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.

References $id, $lng, ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilObjSurvey\MODE_IND_FEEDB, ILIAS\Repository\object(), ILIAS\UICore\GlobalTemplate\setContent(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ evaluation()

ilSurveyEvaluationGUI::evaluation ( int  $details = 0)

Definition at line 767 of file class.ilSurveyEvaluationGUI.php.

769 : void {
770 $ilToolbar = $this->toolbar;
772 $ui = $this->ui;
773
774 $ui_factory = $ui->factory();
775 $ui_renderer = $ui->renderer();
776
777 $this->lng->loadLanguageModule("survey");
778
779 $this->log->debug("check access");
780
781 // auth
782 if (!$this->hasResultsAccess()) {
783 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
784 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
785 return;
786 }
787
788 switch ($this->object->getEvaluationAccess()) {
790 if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
791 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
792 return;
793 }
794 break;
795
798 if (!$this->checkAnonymizedEvaluationAccess()) {
799 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
800 return;
801 }
802 break;
803 }
804 }
805
806 $this->log->debug("check access ok");
807 // setup toolbar
808
809 $appr_id = $this->evaluation_manager->getCurrentAppraisee();
810 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
811 $results = array();
812
813 $eval_tpl = new ilTemplate("tpl.il_svy_svy_evaluation.html", true, true, "components/ILIAS/Survey");
814
815
816 if ($details) {
817 $this->ui_modifier->setResultsDetailToolbar(
818 $this->object,
819 $ilToolbar,
820 $this->user->getId(),
821 $eval_tpl
822 );
823 } else {
824 $this->ui_modifier->setResultsOverviewToolbar(
825 $this->object,
826 $ilToolbar,
827 $this->user->getId(),
828 $eval_tpl
829 );
830 }
831
832 if (!$this->object->get360Mode() || $appr_id) {
833 if ($details) {
834 //templates: results, table of contents
835 $dtmpl = new ilTemplate("tpl.il_svy_svy_results_details.html", true, true, "components/ILIAS/Survey/Evaluation");
836 $toc_tpl = new ilTemplate("tpl.svy_results_table_contents.html", true, true, "components/ILIAS/Survey/Evaluation");
837 $this->lng->loadLanguageModule("content");
838 $toc_tpl->setVariable("TITLE_TOC", $this->lng->txt('cont_toc'));
839 }
840
841 $finished_ids = $this->evaluation_manager->getFilteredFinishedIds();
842
843 // parse answer data in evaluation results
844 $listing = $this->gui->listing();
845
846 $panels = [];
847 foreach ($this->object->getSurveyQuestions() as $qdata) {
848 $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
849 $q_res = $q_eval->getResults();
850 $results[] = $q_res;
851
852 if ($details) {
853 $panels = array_merge(
854 $panels,
855 $this->ui_modifier->getDetailPanels(
856 $this->object->getSurveyParticipants(),
857 $this->request,
858 $q_eval
859 )
860 );
861
862 // TABLE OF CONTENTS
863 if ($qdata["questionblock_id"] &&
864 $qdata["questionblock_id"] != $this->last_questionblock_id) {
865 $qblock = ilObjSurvey::_getQuestionblock($qdata["questionblock_id"]);
866 if ($qblock["show_blocktitle"]) {
867 $listing->node(
868 $this->ui->factory()->legacy()->content($qdata["questionblock_title"]),
869 "q" . $qdata["questionblock_id"]
870 );
871 } else {
872 $listing->node(
873 $this->ui->factory()->legacy()->content(""),
874 "q" . $qdata["questionblock_id"]
875 );
876 }
877 $this->last_questionblock_id = $qdata["questionblock_id"];
878 }
879 $anchor_id = "svyrdq" . $qdata["question_id"];
880 $listing->node(
881 $this->ui->factory()->link()->standard($qdata["title"], "#" . $anchor_id),
882 (string) $qdata["question_id"],
883 $qdata["questionblock_id"] ? "q" . $qdata["questionblock_id"] : "0"
884 );
885 }
886 }
887
888 if ($details) {
889 $toc_tpl->setVariable("LIST", $listing->render());
890
891 //TABLE OF CONTENTS
892 $panel_toc = $ui_factory->panel()->standard("", $ui_factory->legacy()->content($toc_tpl->get()));
893 $render_toc = $ui_renderer->render($panel_toc);
894 $dtmpl->setVariable("PANEL_TOC", $render_toc);
895
896 //REPORT
897 $report_title = "";
898 $panel_report = $ui_factory->panel()->report($report_title, $panels);
899 $render_report = $ui_renderer->render($panel_report);
900 $dtmpl->setVariable("PANEL_REPORT", $render_report);
901
902 //print the main template
903 $eval_tpl->setVariable('DETAIL', $dtmpl->get());
904 }
905 }
906
907 //$eval_tpl->setVariable('MODAL', $modal);
908 if (!$details) {
909 $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $results);
910 $eval_tpl->setVariable('CUMULATED', $table_gui->getHTML());
911 }
912
913 //
914 // print header
915 //
916
917 $path = "";
918 $path_full = $tree->getPathFull($this->object->getRefId());
919 foreach ($path_full as $data) {
920 $path .= " » ";
921 $path .= $data['title'];
922 }
923
925 $props = array(
926 $this->lng->txt("link") => ilLink::_getStaticLink($this->object->getRefId()),
927 $this->lng->txt("path") => $path,
928 $this->lng->txt("svy_results") => !$details
929 ? $this->lng->txt("svy_eval_cumulated")
930 : $this->lng->txt("svy_eval_detail"),
931 $this->lng->txt("date") => ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)),
932 );
933 $eval_tpl->setCurrentBlock("print_header_bl");
934 foreach ($props as $key => $value) {
935 $eval_tpl->setVariable("HEADER_PROP_KEY", $key);
936 $eval_tpl->setVariable("HEADER_PROP_VALUE", $value);
937 $eval_tpl->parseCurrentBlock();
938 }
939
940 $this->log->debug("end");
941
942 $this->tpl->setContent($eval_tpl->get());
943 }
static _instanciateQuestionEvaluation(int $question_id, ?array $a_finished_ids=null)
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
const EVALUATION_ACCESS_PARTICIPANTS
static _getQuestionblock(int $questionblock_id)
get question block properties
const EVALUATION_ACCESS_ALL
const EVALUATION_ACCESS_OFF
hasResultsAccess()
Check if user can view results granted by rbac or positions.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
$results

References ILIAS\Repository\access(), ilObjSurvey\EVALUATION_ACCESS_ALL, ilObjSurvey\EVALUATION_ACCESS_OFF, ilObjSurvey\EVALUATION_ACCESS_PARTICIPANTS, ILIAS\Repository\lng(), ilObjSurvey\MODE_IND_FEEDB, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ evaluationdetails()

ilSurveyEvaluationGUI::evaluationdetails ( )
protected

Show the detailed evaluation.

Definition at line 281 of file class.ilSurveyEvaluationGUI.php.

281 : void
282 {
283 $this->evaluation(1);
284 }

◆ evaluationuser()

ilSurveyEvaluationGUI::evaluationuser ( )

Print the survey evaluation for a selected user.

Definition at line 1139 of file class.ilSurveyEvaluationGUI.php.

1139 : void
1140 {
1141 $ilToolbar = $this->toolbar;
1142
1143 if (!$this->hasResultsAccess() &&
1144 $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1145 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1146 $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1147 }
1148
1149 $appr_id = null;
1150 $data = [];
1151
1152 if ($this->object->get360Mode()) {
1153 $appr_id = $this->getAppraiseeId();
1154 }
1155
1156 if (!$this->object->get360Mode() || $appr_id) {
1157 $this->buildExportButtonAndModal("exportEvaluationUser");
1158
1159 $ilToolbar->addSeparator();
1160
1161 $pv = $this->print->resultsDetails($this->object->getRefId());
1162 $modal_elements = $pv->getModalElements(
1163 $this->ctrl->getLinkTargetByClass(
1164 "ilSurveyEvaluationGUI",
1165 "printResultsPerUserSelection"
1166 )
1167 );
1168 $ilToolbar->addComponent($modal_elements->button);
1169 $ilToolbar->addComponent($modal_elements->modal);
1170
1171 $data = $this->evaluation_manager->getUserSpecificResults();
1172 }
1173
1174 $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser');
1175 $table_gui->setData($data);
1176 $this->tpl->setContent($table_gui->getHTML());
1177 }
buildExportButtonAndModal(string $export_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $data, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilObjSurvey\MODE_SELF_EVAL, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ executeCommand()

ilSurveyEvaluationGUI::executeCommand ( )

Definition at line 122 of file class.ilSurveyEvaluationGUI.php.

122 : string
123 {
124 $skmg_set = new ilSkillManagementSettings();
125 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
126 $cmd = $this->ctrl->getCmd("competenceEval");
127 } else {
128 $cmd = $this->ctrl->getCmd("evaluation");
129 }
130
131 $next_class = $this->ctrl->getNextClass($this);
132
133 $this->log->debug($cmd);
134
135 switch ($next_class) {
136 default:
137 $this->setEvalSubtabs();
138 $ret = (string) $this->$cmd();
139 break;
140 }
141 return $ret;
142 }
setEvalSubtabs()
Set the tabs for the evaluation output.

References ILIAS\Repository\ctrl(), ILIAS\Repository\object(), and setEvalSubtabs().

+ Here is the call graph for this function:

◆ exportCumulatedResults()

ilSurveyEvaluationGUI::exportCumulatedResults ( int  $details = 0)

Definition at line 286 of file class.ilSurveyEvaluationGUI.php.

288 : void {
289 $finished_ids = null;
290 if ($this->object->get360Mode()) {
291 $appr_id = $this->request->getAppraiseeId();
292 if (!$appr_id) {
293 $this->ctrl->redirect($this, $details ? "evaluationdetails" : "evaluation");
294 }
295 $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
296 if (!count($finished_ids)) {
297 $finished_ids = array(-1);
298 }
299 }
300
301 // titles
302 $title_row = array();
303 $do_title = $do_label = true;
304 switch ($this->request->getExportLabel()) {
305 case 'label_only':
306 $title_row[] = $this->lng->txt("label");
307 $do_title = false;
308 break;
309
310 case 'title_only':
311 $title_row[] = $this->lng->txt("title");
312 $do_label = false;
313 break;
314
315 default:
316 $title_row[] = $this->lng->txt("title");
317 $title_row[] = $this->lng->txt("label");
318 break;
319 }
320 $title_row[] = $this->lng->txt("question");
321 $title_row[] = $this->lng->txt("question_type");
322 $title_row[] = $this->lng->txt("users_answered");
323 $title_row[] = $this->lng->txt("users_skipped");
324 $title_row[] = $this->lng->txt("mode");
325 $title_row[] = $this->lng->txt("mode_text");
326 $title_row[] = $this->lng->txt("mode_nr_of_selections");
327 $title_row[] = $this->lng->txt("median");
328 $title_row[] = $this->lng->txt("arithmetic_mean");
329
330 // creating container
331 $excel = null;
332 $csvfile = null;
333 switch ($this->request->getExportFormat()) {
334 case self::TYPE_XLS:
335 $excel = new ilExcel();
336 $excel->addSheet($this->lng->txt("svy_eval_cumulated"));
337 $excel->setCellArray(array($title_row), "A1");
338 $excel->setBold("A1:" . $excel->getColumnCoord(count($title_row) - 1) . "1");
339 break;
340
341 case self::TYPE_SPSS:
342 $csvfile = array($title_row);
343 break;
344 }
345
346
347 // parse answer data in evaluation results
348 $ov_row = 2;
349 $question_index = 1;
350 foreach ($this->object->getSurveyQuestions() as $qdata) {
351 $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
352 $q_res = $q_eval->getResults();
353 $ov_rows = $q_eval->exportResults($q_res, $do_title, $do_label);
354
355 switch ($this->request->getExportFormat()) {
356 case self::TYPE_XLS:
357 $excel->setActiveSheet(0);
358 foreach ($ov_rows as $row) {
359 foreach ($row as $col => $value) {
360 $excel->setCell($ov_row, $col, $value);
361 }
362 $ov_row++;
363 }
364 break;
365
366 case self::TYPE_SPSS:
367 foreach ($ov_rows as $row) {
368 $csvfile[] = $row;
369 }
370 break;
371 }
372
373 if ($details) {
374 switch ($this->request->getExportFormat()) {
375 case self::TYPE_XLS:
376 $this->exportResultsDetailsExcel($excel, $q_eval, $q_res, $do_title, $do_label, $question_index++);
377 break;
378 }
379 }
380 }
381
382 // #11179
383 $type = !$details
384 ? $this->lng->txt("svy_eval_cumulated")
385 : $this->lng->txt("svy_eval_detail");
386
387 $surveyname = $this->object->getTitle() . " " . $type . " " . date("Y-m-d");
388 $surveyname = preg_replace("/\s/", "_", trim($surveyname));
389 $surveyname = ilFileUtils::getASCIIFilename($surveyname);
390
391 // send to client
392 switch ($this->request->getExportFormat()) {
393 case self::TYPE_XLS:
394 $excel->sendToClient($surveyname);
395 break;
396
397 case self::TYPE_SPSS:
398 $csv = "";
399 $separator = ";";
400 foreach ($csvfile as $csvrow) {
401 $csvrow = $this->processCSVRow($csvrow, true, $separator);
402 $csv .= implode($separator, $csvrow) . "\n";
403 }
404 ilUtil::deliverData($csv, $surveyname . ".csv");
405 exit();
406 }
407 }
static getASCIIFilename(string $a_filename)
processCSVRow(array $row, bool $quoteAll=false, string $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
exportResultsDetailsExcel(ilExcel $a_excel, SurveyQuestionEvaluation $a_eval, $a_results, bool $a_do_title, bool $a_do_label, int $question_index)
Export details (excel only)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
exit

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ exportData()

ilSurveyEvaluationGUI::exportData ( )

Definition at line 620 of file class.ilSurveyEvaluationGUI.php.

620 : void
621 {
622 if ($this->request->getExportFormat() !== '') {
623 $this->exportCumulatedResults(0);
624 } else {
625 $this->ctrl->redirect($this, 'evaluation');
626 }
627 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ exportDetailData()

ilSurveyEvaluationGUI::exportDetailData ( )

Definition at line 629 of file class.ilSurveyEvaluationGUI.php.

629 : void
630 {
631 if ($this->request->getExportFormat() !== '') {
632 $this->exportCumulatedResults(1);
633 } else {
634 $this->ctrl->redirect($this, 'evaluation');
635 }
636 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ exportEvaluationUser()

ilSurveyEvaluationGUI::exportEvaluationUser ( )

Definition at line 987 of file class.ilSurveyEvaluationGUI.php.

987 : void
988 {
989 // build title row(s)
990
991 $title_row = $title_row2 = array();
992 $title_row[] = $this->lng->txt("lastname"); // #12756
993 $title_row[] = $this->lng->txt("firstname");
994 $title_row[] = $this->lng->txt("login");
995 $title_row[] = $this->lng->txt('workingtime'); // #13622
996 $title_row[] = $this->lng->txt('survey_results_finished');
997 $title_row2[] = "";
998 $title_row2[] = "";
999 $title_row2[] = "";
1000 $title_row2[] = "";
1001 $title_row2[] = "";
1002 if ($this->object->canExportSurveyCode()) {
1003 $title_row[] = $this->lng->txt("codes");
1004 $title_row2[] = "";
1005 }
1006
1007 $questions = array();
1008
1009 foreach ($this->object->getSurveyQuestions() as $qdata) {
1010 $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], null);
1011 $q_res = $q_eval->getResults();
1012
1013 $questions[$qdata["question_id"]] = array($q_eval, $q_res);
1014
1015 $question = is_array($q_res)
1016 ? $q_res[0][1]->getQuestion()
1017 : $q_res->getQuestion();
1018
1019 $do_title = $do_label = true;
1020 switch ($this->request->getExportLabel()) {
1021 case "label_only":
1022 $title_row[] = $question->label;
1023 $title_row2[] = "";
1024 $do_title = false;
1025 break;
1026
1027 case "title_only":
1028 $title_row[] = $question->getTitle();
1029 $title_row2[] = "";
1030 $do_label = false;
1031 break;
1032
1033 default:
1034 $title_row[] = $question->getTitle();
1035 $title_row2[] = $question->label;
1036 break;
1037 }
1038
1039 $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
1040 }
1041
1042 $rows = array();
1043
1044 // add title row(s)
1045 $rows[] = $title_row;
1046 if (implode("", $title_row2)) {
1047 $rows[] = $title_row2;
1048 }
1049
1050 // #13620
1052
1053 $finished_ids = null;
1054 if ($this->object->get360Mode()) {
1055 $appr_id = $this->request->getAppraiseeId();
1056 if (!$appr_id) {
1057 $this->ctrl->redirect($this, "evaluationuser");
1058 }
1059 $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
1060 if (!count($finished_ids)) {
1061 $finished_ids = array(-1);
1062 }
1063 }
1064
1065 //$participants = $this->object->getSurveyParticipants($finished_ids);
1066 $participants = $this->access_manager->canReadResultOfParticipants($finished_ids);
1067
1068 foreach ($participants as $user) {
1069 $user_id = $user["active_id"];
1070
1071 $row = array();
1072 $row[] = trim($user["lastname"] ?? "")
1073 ? $user["lastname"]
1074 : ($user["name"] ?? ""); // anonymous
1075 $row[] = $user["firstname"] ?? "";
1076 $row[] = $user["login"] ?? ""; // #10579
1077
1078 if ($this->object->canExportSurveyCode()) {
1079 $row[] = $user_id;
1080 }
1081
1082 $row[] = $this->object->getWorkingtimeForParticipant($user_id);
1083
1084 if ($user["finished"] ?? false) {
1085 $dt = new ilDateTime($user["finished_tstamp"], IL_CAL_UNIX);
1086 $row[] = ($this->request->getExportFormat() === self::TYPE_XLS)
1087 ? $dt
1089 } else {
1090 $row[] = "-"; // :TODO:
1091 }
1092
1093 foreach ($questions as $item) {
1094 $q_eval = $item[0];
1095 $q_res = $item[1];
1096
1097 $q_eval->addUserSpecificResults($row, $user_id, $q_res);
1098 }
1099
1100 $rows[] = $row;
1101 }
1102
1103 // #11179
1104 $surveyname = $this->object->getTitle() . " " . $this->lng->txt("svy_eval_user") . " " . date("Y-m-d");
1105 $surveyname = preg_replace("/\s/", "_", trim($surveyname));
1106 $surveyname = ilFileUtils::getASCIIFilename($surveyname);
1107
1108 switch ($this->request->getExportFormat()) {
1109 case self::TYPE_XLS:
1110 $excel = new ilExcel();
1111 $excel->addSheet($this->lng->txt("svy_eval_user"));
1112
1113 foreach ($rows as $row_idx => $row) {
1114 foreach ($row as $col_idx => $col) {
1115 $excel->setCell($row_idx + 1, $col_idx, $col);
1116 }
1117 if (!$row_idx) {
1118 $excel->setBold("A1:" . $excel->getColumnCoord(count($row) - 1) . "1");
1119 }
1120 }
1121 $excel->sendToClient($surveyname);
1122
1123 // no break
1124 case self::TYPE_SPSS:
1125 $csv = "";
1126 $separator = ";";
1127 foreach ($rows as $csvrow) {
1128 $csvrow = str_replace("\n", " ", $this->processCSVRow($csvrow, true, $separator));
1129 $csv .= implode($separator, $csvrow) . "\n";
1130 }
1131 ilUtil::deliverData($csv, "$surveyname.csv");
1132 exit();
1133 }
1134 }

References $user_id, SurveyQuestion\_instanciateQuestionEvaluation(), ILIAS\Repository\ctrl(), ilUtil\deliverData(), exit, ilDatePresentation\formatDate(), ilFileUtils\getASCIIFilename(), IL_CAL_UNIX, ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilDatePresentation\setUseRelativeDates().

+ Here is the call graph for this function:

◆ exportResultsDetailsExcel()

ilSurveyEvaluationGUI::exportResultsDetailsExcel ( ilExcel  $a_excel,
SurveyQuestionEvaluation  $a_eval,
  $a_results,
bool  $a_do_title,
bool  $a_do_label,
int  $question_index 
)
protected

Export details (excel only)

Parameters
ilSurveyEvaluationResults | array$a_results
Exceptions

PhpOffice\PhpSpreadsheet\Exception

Definition at line 414 of file class.ilSurveyEvaluationGUI.php.

421 : void {
422 $question_res = $a_results;
423 $matrix = false;
424 if (is_array($question_res)) {
425 $question_res = $question_res[0][1];
426 $matrix = true;
427 }
428 $question = $question_res->getQuestion();
429
430 $a_excel->addSheet($question_index . "_" . $question->getTitle());
431
432
433 // question "overview"
434
435 $kv = array();
436
437 if ($a_do_title) {
438 $kv[$this->lng->txt("title")] = $question->getTitle();
439 }
440 if ($a_do_label) {
441 $kv[$this->lng->txt("label")] = $question->label;
442 }
443
444 // question
445 $kv[$this->lng->txt("question")] = $question->getQuestiontext();
446
447 // question type
448 $kv[$this->lng->txt("question_type")] = SurveyQuestion::_getQuestionTypeName($question->getQuestionType());
449
450 // :TODO: present subtypes (hrz/vrt, mc/sc mtx, metric scale)?
451
452 // answered and skipped users
453 $kv[$this->lng->txt("users_answered")] = $question_res->getUsersAnswered();
454 $kv[$this->lng->txt("users_skipped")] = $question_res->getUsersSkipped(); // #0021671
455
456 $excel_row = 1;
457
458 foreach ($kv as $key => $value) {
459 $a_excel->setCell($excel_row, 0, $key);
460 $a_excel->setCell($excel_row++, 1, $value);
461 }
462
463 if (!$matrix) {
464 $this->parseResultsToExcel(
465 $a_excel,
466 $question_res,
467 $excel_row,
468 $a_eval->getExportGrid($a_results),
469 $a_eval->getTextAnswers($a_results)
470 );
471 } else {
472 // question
473 $this->parseResultsToExcel(
474 $a_excel,
475 $question_res,
476 $excel_row,
477 null,
478 null,
479 false
480 );
481
482 $texts = $a_eval->getTextAnswers($a_results);
483
484 // "rows"
485 foreach ($a_results as $row_results) {
486 $row_title = $row_results[0];
487
488 $a_excel->setCell($excel_row, 0, $this->lng->txt("row"));
489 $a_excel->setCell($excel_row++, 1, $row_title);
490
491 $this->parseResultsToExcel(
492 $a_excel,
493 $row_results[1],
494 $excel_row,
495 $a_eval->getExportGrid($row_results[1]),
496 is_array($texts[$row_title] ?? false)
497 ? array("" => $texts[$row_title])
498 : null
499 );
500 }
501 }
502
503 // matrix question: overview #21438
504 if ($matrix) {
505 $a_excel->setCell($excel_row++, 0, $this->lng->txt("overview"));
506
507 // title row with variables
508 $counter = 0;
509 $cats = $question->getColumns();
510 foreach ($cats->getCategories() as $cat) {
511 $a_excel->setColors($a_excel->getCoordByColumnAndRow(1 + $counter, $excel_row), self::EXCEL_SUBTITLE);
512 $a_excel->setCell($excel_row, 1 + $counter, $cat->title);
513 $counter++;
514 }
515 $excel_row++;
516
517 foreach ($a_results as $row_results) {
518 $row_title = $row_results[0];
519 $counter = 0;
520 $a_excel->setCell($excel_row, 0, $row_title);
521
522 $vars = $row_results[1]->getVariables();
523 if ($vars) {
524 foreach ($vars as $var) {
525 $a_excel->setCell($excel_row, ++$counter, $var->abs);
526 }
527 }
528 $excel_row++;
529 }
530 }
531
532 // 1st column is bold
533 $a_excel->setBold("A1:A" . $excel_row);
534 }
getExportGrid($a_results)
Get grid data.
getTextAnswers($a_results)
Get text answers.
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
setBold(string $a_coords)
Set cell(s) to bold.
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
addSheet(string $a_name, bool $a_activate=true)
Add sheet.
getCoordByColumnAndRow(int $pColumn=1, int $pRow=1)
Get cell coordinate (e.g.
setColors(string $a_coords, string $a_background, ?string $a_font=null)
Set cell(s) colors.
parseResultsToExcel(ilExcel $a_excel, ilSurveyEvaluationResults $a_results, int &$a_excel_row, ?array $a_grid=null, ?array $a_text_answers=null, bool $a_include_mode=true)
$counter

◆ getAppraiseeId()

ilSurveyEvaluationGUI::getAppraiseeId ( )

Definition at line 198 of file class.ilSurveyEvaluationGUI.php.

198 : int
199 {
200 return $this->appr_id;
201 }

◆ getExportModal()

ilSurveyEvaluationGUI::getExportModal ( )
protected

Definition at line 663 of file class.ilSurveyEvaluationGUI.php.

663 : Modal\RoundTrip | Form\Standard
664 {
667 $ui_fac = $this->gui->ui()->factory();
668
669 $post_url = $ctrl->getFormAction($this, "validateAndSubmitExportForm");
670
671 $inputs["export_format"] = $ui_fac->input()->field()->select(
672 $lng->txt("filetype"),
673 [
674 \ilSurveyEvaluationGUI::TYPE_XLS => $lng->txt("exp_type_excel"),
675 \ilSurveyEvaluationGUI::TYPE_SPSS => $lng->txt("exp_type_csv")
676 ]
677 )
678 //->withValue(\ilSurveyEvaluationGUI::TYPE_XLS)
679 ->withRequired(true);
680
681 $inputs["export_label"] = $ui_fac->input()->field()->select(
682 $lng->txt("title"),
683 [
684 "label_only" => $lng->txt("export_label_only"),
685 "title_only" => $lng->txt("export_title_only"),
686 "title_label" => $lng->txt("export_title_label")
687 ]
688 )
689 //->withValue("label_only")
690 ->withRequired(true);
691
692 $modal = $ui_fac->modal()->roundtrip(
693 $lng->txt("svy_export_format"),
694 null,
695 $inputs,
696 $post_url
697 )
698 ->withSubmitLabel($lng->txt("export"));
699
700 return $modal;
701 }
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc

References ILIAS\UI\Implementation\Component\Input\$inputs, $lng, ilCtrl\getFormAction(), TYPE_SPSS, and TYPE_XLS.

+ Here is the call graph for this function:

◆ getSumScores()

ilSurveyEvaluationGUI::getSumScores ( ?array  $a_finished_ids = null)
protected
Todo:
move to evaluation manager, use dto

Definition at line 1348 of file class.ilSurveyEvaluationGUI.php.

1350 : array {
1351 $sum_scores = [];
1352 foreach ($this->access_manager->canReadResultOfParticipants($a_finished_ids) as $p) {
1353 $sum_scores[$p["active_id"]] = [
1354 "username" => $p["sortname"],
1355 "score" => 0
1356 ];
1357 }
1358
1359 foreach ($this->object->getSurveyQuestions() as $qdata) {
1360 $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $a_finished_ids);
1361 foreach ($q_eval->getSumScores() as $finished_id => $sum_score) {
1362 if ($sum_score === null) {
1363 $sum_scores[$finished_id]["score"] = null;
1364 }
1365 if ($sum_scores[$finished_id]["score"] !== null) {
1366 $sum_scores[$finished_id]["score"] += (int) $sum_score;
1367 }
1368 }
1369 }
1370 return $sum_scores;
1371 }

◆ hasResultsAccess()

ilSurveyEvaluationGUI::hasResultsAccess ( )
protected

Check if user can view results granted by rbac or positions.

Todo:
move to access manager

Definition at line 1314 of file class.ilSurveyEvaluationGUI.php.

1314 : bool
1315 {
1316 return $this->access->checkRbacOrPositionPermissionAccess('read_results', 'access_results', $this->object->getRefId());
1317 }

References ILIAS\Repository\access(), and ILIAS\Repository\object().

Referenced by setEvalSubtabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openEvaluation()

ilSurveyEvaluationGUI::openEvaluation ( )
protected

Definition at line 753 of file class.ilSurveyEvaluationGUI.php.

753 : void
754 {
755 $skmg_set = new ilSkillManagementSettings();
756 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
757 $this->competenceEval();
758 } else {
759 if ($this->object->getMode() === ilObjSurvey::MODE_IND_FEEDB) {
760 $this->evaluationdetails();
761 } else {
762 $this->evaluation();
763 }
764 }
765 }
evaluationdetails()
Show the detailed evaluation.

References ilObjSurvey\MODE_IND_FEEDB, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ parseResultsToExcel()

ilSurveyEvaluationGUI::parseResultsToExcel ( ilExcel  $a_excel,
ilSurveyEvaluationResults  $a_results,
int &  $a_excel_row,
?array  $a_grid = null,
?array  $a_text_answers = null,
bool  $a_include_mode = true 
)
protected

Definition at line 536 of file class.ilSurveyEvaluationGUI.php.

543 : void {
544 $kv = array();
545
546 if ($a_include_mode) {
547 if ($a_results->getModeValue() !== null) {
548 // :TODO:
549 $kv[$this->lng->txt("mode")] = is_array($a_results->getModeValue())
550 ? implode(", ", $a_results->getModeValue())
551 : $a_results->getModeValue();
552
553 $kv[$this->lng->txt("mode_text")] = $a_results->getModeValueAsText();
554 $kv[$this->lng->txt("mode_nr_of_selections")] = $a_results->getModeNrOfSelections();
555 }
556
557 if ($a_results->getMedian() !== null) {
558 $kv[$this->lng->txt("median")] = $a_results->getMedianAsText();
559 }
560
561 if ($a_results->getMean() !== null) {
562 $kv[$this->lng->txt("arithmetic_mean")] = $a_results->getMean();
563 }
564 }
565
566 foreach ($kv as $key => $value) {
567 $a_excel->setCell($a_excel_row, 0, $key);
568 $a_excel->setCell($a_excel_row++, 1, $value);
569 }
570
571 // grid
572 if ($a_grid) {
573 // header
574 $a_excel->setColors("B" . $a_excel_row . ":E" . $a_excel_row, self::EXCEL_SUBTITLE);
575 $a_excel->setCell($a_excel_row, 0, $this->lng->txt("svy_categories"));
576 foreach ($a_grid["cols"] as $col_idx => $col) {
577 $a_excel->setCell($a_excel_row, $col_idx + 1, $col);
578 }
579 $a_excel_row++;
580
581 // rows
582 foreach ($a_grid["rows"] as $cols) {
583 foreach ($cols as $col_idx => $col) {
584 $a_excel->setCell($a_excel_row, $col_idx + 1, $col);
585 }
586 $a_excel_row++;
587 }
588 }
589
590 // text answers
591 if ($a_text_answers) {
592 // "given_answers" ?
593 $a_excel->setCell($a_excel_row, 0, $this->lng->txt("freetext_answers"));
594
595 // mc/sc
596 if (!is_array($a_text_answers[""] ?? null)) {
597 $a_excel->setColors("B" . $a_excel_row . ":C" . $a_excel_row, self::EXCEL_SUBTITLE);
598 $a_excel->setCell($a_excel_row, 1, $this->lng->txt("title"));
599 $a_excel->setCell($a_excel_row++, 2, $this->lng->txt("answer"));
600 }
601 // mtx (row), txt
602 else {
603 $a_excel->setColors("B" . $a_excel_row . ":B" . $a_excel_row, self::EXCEL_SUBTITLE);
604 $a_excel->setCell($a_excel_row++, 1, $this->lng->txt("answer"));
605 }
606
607 foreach ($a_text_answers as $var => $items) {
608 foreach ($items as $item) {
609 if (!is_array($a_text_answers[""] ?? null)) {
610 $a_excel->setCell($a_excel_row, 1, $var);
611 $a_excel->setCell($a_excel_row++, 2, $item);
612 } else {
613 $a_excel->setCell($a_excel_row++, 1, $item);
614 }
615 }
616 }
617 }
618 }

References ilSurveyEvaluationResults\getMean(), ilSurveyEvaluationResults\getMedian(), ilSurveyEvaluationResults\getMedianAsText(), ilSurveyEvaluationResults\getModeNrOfSelections(), ilSurveyEvaluationResults\getModeValue(), ilSurveyEvaluationResults\getModeValueAsText(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ printEvaluation()

ilSurveyEvaluationGUI::printEvaluation ( )

Definition at line 638 of file class.ilSurveyEvaluationGUI.php.

638 : void
639 {
640 $this->tpl->setOnScreenMessage('info', $this->lng->txt('use_browser_print_function'), true);
641 $this->ctrl->redirect($this, 'evaluation');
642 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ printResultsDetails()

ilSurveyEvaluationGUI::printResultsDetails ( )

Definition at line 1401 of file class.ilSurveyEvaluationGUI.php.

1401 : void
1402 {
1403 $view = $this->print->resultsDetails($this->object->getRefId());
1404 $view->sendPrintView();
1405 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printResultsDetailsSelection()

ilSurveyEvaluationGUI::printResultsDetailsSelection ( )
Exceptions

ILIAS\HTTP\Response\Sender\ResponseSendingException

Definition at line 1385 of file class.ilSurveyEvaluationGUI.php.

1385 : void
1386 {
1387 $this->ctrl->setParameterByClass(
1388 "ilSurveyEvaluationGUI",
1389 "vw",
1390 $this->request->getVW()
1391 );
1392 $this->ctrl->setParameterByClass(
1393 "ilSurveyEvaluationGUI",
1394 "cp",
1395 $this->request->getCP()
1396 );
1397 $view = $this->print->resultsDetails($this->object->getRefId());
1398 $view->sendForm();
1399 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printResultsOverviewSelection()

ilSurveyEvaluationGUI::printResultsOverviewSelection ( )
Exceptions

ILIAS\HTTP\Response\Sender\ResponseSendingException

Definition at line 1376 of file class.ilSurveyEvaluationGUI.php.

1376 : void
1377 {
1378 $view = $this->print->resultsOverview($this->object->getRefId());
1379 $view->sendForm();
1380 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printResultsPerUser()

ilSurveyEvaluationGUI::printResultsPerUser ( )

Definition at line 1416 of file class.ilSurveyEvaluationGUI.php.

1416 : void
1417 {
1418 $view = $this->print->resultsPerUser($this->object->getRefId());
1419 $view->sendPrintView();
1420 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ printResultsPerUserSelection()

ilSurveyEvaluationGUI::printResultsPerUserSelection ( )
Exceptions

ILIAS\HTTP\Response\Sender\ResponseSendingException

Definition at line 1410 of file class.ilSurveyEvaluationGUI.php.

1410 : void
1411 {
1412 $view = $this->print->resultsPerUser($this->object->getRefId());
1413 $view->sendForm();
1414 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ processCSVRow()

ilSurveyEvaluationGUI::processCSVRow ( array  $row,
bool  $quoteAll = false,
string  $separator = ";" 
)

Processes an array as a CSV row and converts the array values to correct CSV values.

The "converted" array is returned

Parameters
array$rowThe array containing the values for a CSV row
bool$quoteAllIndicates to quote every value (=TRUE) or only values containing quotes and separators (=FALSE, default)
string$separatorThe value separator in the CSV row (used for quoting) (; = default)
Returns
array The converted array ready for CSV use

Definition at line 953 of file class.ilSurveyEvaluationGUI.php.

957 : array {
958 $resultarray = array();
959 foreach ($row as $rowindex => $entry) {
960 if (is_array($entry)) {
961 $entry = implode("/", $entry);
962 }
963 $surround = false;
964 if ($quoteAll) {
965 $surround = true;
966 }
967 if (strpos($entry ?? "", "\"") !== false) {
968 $entry = str_replace("\"", "\"\"", (string) $entry);
969 $surround = true;
970 }
971 if (strpos($entry ?? "", $separator) !== false) {
972 $surround = true;
973 }
974 // replace all CR LF with LF (for Excel for Windows compatibility
975 $entry = str_replace(chr(13) . chr(10), chr(10), (string) $entry);
976 if ($surround) {
977 //$resultarray[$rowindex] = utf8_decode("\"" . $entry . "\"");
978 $resultarray[$rowindex] = "\"" . $entry . "\"";
979 } else {
980 //$resultarray[$rowindex] = utf8_decode($entry);
981 $resultarray[$rowindex] = $entry;
982 }
983 }
984 return $resultarray;
985 }

◆ setAppraiseeId()

ilSurveyEvaluationGUI::setAppraiseeId ( int  $a_val)

Definition at line 192 of file class.ilSurveyEvaluationGUI.php.

194 : void {
195 $this->appr_id = $a_val;
196 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setEvalSubtabs()

ilSurveyEvaluationGUI::setEvalSubtabs ( )

Set the tabs for the evaluation output.

Definition at line 147 of file class.ilSurveyEvaluationGUI.php.

147 : void
148 {
149 $ilTabs = $this->tabs;
150
151 $skmg_set = new ilSkillManagementSettings();
152 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
153 $ilTabs->addSubTabTarget(
154 "svy_eval_competences",
155 $this->ctrl->getLinkTarget($this, "competenceEval"),
156 array("competenceEval")
157 );
158 }
159
160 if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
161 $ilTabs->addSubTabTarget(
162 "svy_eval_cumulated",
163 $this->ctrl->getLinkTarget($this, "evaluation"),
164 array("evaluation", "checkEvaluationAccess")
165 );
166 }
167
168 $ilTabs->addSubTabTarget(
169 "svy_eval_detail",
170 $this->ctrl->getLinkTarget($this, "evaluationdetails"),
171 array("evaluationdetails")
172 );
173
174 if ($this->hasResultsAccess() && $this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
175 $ilTabs->addSubTabTarget(
176 "svy_eval_user",
177 $this->ctrl->getLinkTarget($this, "evaluationuser"),
178 array("evaluationuser")
179 );
180 }
181
182 if ($this->object->getCalculateSumScore()) {
183 $ilTabs->addSubTabTarget(
184 "svy_sum_score",
185 $this->ctrl->getLinkTarget($this, "sumscore"),
186 array("sumscore")
187 );
188 }
189 }

References $tabs, ILIAS\Repository\ctrl(), hasResultsAccess(), ilObjSurvey\MODE_IND_FEEDB, and ILIAS\Repository\object().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sumscore()

ilSurveyEvaluationGUI::sumscore ( )

Show sum score table.

Definition at line 1322 of file class.ilSurveyEvaluationGUI.php.

1322 : void
1323 {
1324 if (!$this->hasResultsAccess() &&
1325 $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1326 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1327 $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1328 }
1329
1330 $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_max_sum_score") . ": " . $this->object->getMaxSumScore());
1331
1332 $this->gui->button(
1333 $this->lng->txt("print"),
1334 "#"
1335 )->onClick("window.print(); return false;")->toToolbar();
1336
1337 $finished_ids = null;
1338
1339 $sum_scores = $this->getSumScores($finished_ids);
1340 $table_gui = new ilSumScoreTableGUI($this, 'sumscore', $this->object->hasAnonymizedResults());
1341 $table_gui->setSumScores($sum_scores);
1342 $this->tpl->setContent($table_gui->getHTML());
1343 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSumScores(?array $a_finished_ids=null)

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilObjSurvey\MODE_SELF_EVAL, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ validateAndSubmitExportForm()

ilSurveyEvaluationGUI::validateAndSubmitExportForm ( )
protected

Definition at line 703 of file class.ilSurveyEvaluationGUI.php.

703 : void
704 {
710 $ui_request = $this->gui->http()->request();
711
712 $export_cmd = $request->getExportCmd();
713 $ctrl->setParameter($this, "export_cmd", $export_cmd);
714 $modal = $this->getExportModal();
715 if ("POST" === $ui_request->getMethod()) {
716 $modal = $modal->withRequest($ui_request);
717 $data = $modal->getData();
718 if ($data) {
719 $ctrl->setParameter($this, "export_format", $data["export_format"]);
720 $ctrl->setParameter($this, "export_label", $data["export_label"]);
721 $ctrl->redirect($this, $export_cmd);
722 } else {
723 switch ($export_cmd) {
724 case "exportData":
725 $tabs->activateSubTab("svy_eval_cumulated");
726 $this->evaluation();
727 return;
728 case "exportDetailData":
729 $tabs->activateSubTab("svy_eval_detail");
730 $this->evaluationdetails();
731 return;
732 case "exportEvaluationUser":
733 $toolbar->addComponent($modal->withOnLoad($modal->getShowSignal()));
734 $tabs->activateSubTab("svy_eval_user");
735 $this->evaluationuser();
736 return;
737 }
738 }
739 }
740
741 switch ($export_cmd) {
742 case "exportData":
743 $ctrl->redirect($this, "evaluation");
744 // no break
745 case "exportDetailData":
746 $ctrl->redirect($this, "evaluationdetails");
747 // no break
748 case "exportEvaluationUser":
749 $ctrl->redirect($this, "evaluationuser");
750 }
751 }
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
evaluationuser()
Print the survey evaluation for a selected user.
ILIAS Survey Evaluation EvaluationGUIRequest $request
activateSubTab(string $a_id)

References $data, $lng, ilTabsGUI\activateSubTab(), ilToolbarGUI\addComponent(), ilCtrl\redirect(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilSurveyEvaluationGUI::$access
protected

Definition at line 48 of file class.ilSurveyEvaluationGUI.php.

◆ $access_manager

ILIAS Survey Access AccessManager ilSurveyEvaluationGUI::$access_manager
protected

Definition at line 36 of file class.ilSurveyEvaluationGUI.php.

◆ $appr_id

int ilSurveyEvaluationGUI::$appr_id = null
protected

Definition at line 57 of file class.ilSurveyEvaluationGUI.php.

◆ $array_panels

array ilSurveyEvaluationGUI::$array_panels
protected

Definition at line 42 of file class.ilSurveyEvaluationGUI.php.

◆ $ctrl

ilCtrl ilSurveyEvaluationGUI::$ctrl
protected

Definition at line 56 of file class.ilSurveyEvaluationGUI.php.

◆ $evaluation_manager

ILIAS Survey Evaluation EvaluationManager ilSurveyEvaluationGUI::$evaluation_manager
protected

Definition at line 46 of file class.ilSurveyEvaluationGUI.php.

◆ $gui

ILIAS Survey InternalGUIService ilSurveyEvaluationGUI::$gui
protected

Definition at line 35 of file class.ilSurveyEvaluationGUI.php.

◆ $last_questionblock_id

ilSurveyEvaluationGUI::$last_questionblock_id
protected

Definition at line 41 of file class.ilSurveyEvaluationGUI.php.

◆ $lng

ilLanguage ilSurveyEvaluationGUI::$lng
protected

Definition at line 54 of file class.ilSurveyEvaluationGUI.php.

Referenced by __construct().

◆ $log

ilLogger ilSurveyEvaluationGUI::$log
protected

Definition at line 44 of file class.ilSurveyEvaluationGUI.php.

◆ $object

ilObjSurvey ilSurveyEvaluationGUI::$object
protected

Definition at line 53 of file class.ilSurveyEvaluationGUI.php.

◆ $print

ILIAS Survey PrintView GUIService ilSurveyEvaluationGUI::$print
protected

Definition at line 37 of file class.ilSurveyEvaluationGUI.php.

◆ $rbacsystem

ilRbacSystem ilSurveyEvaluationGUI::$rbacsystem
protected

Definition at line 50 of file class.ilSurveyEvaluationGUI.php.

◆ $request

ILIAS Survey Evaluation EvaluationGUIRequest ilSurveyEvaluationGUI::$request
protected

Definition at line 59 of file class.ilSurveyEvaluationGUI.php.

◆ $skill_profile_service

ILIAS Skill Service SkillProfileService ilSurveyEvaluationGUI::$skill_profile_service
protected

Definition at line 60 of file class.ilSurveyEvaluationGUI.php.

◆ $tabs

ilTabsGUI ilSurveyEvaluationGUI::$tabs
protected

Definition at line 47 of file class.ilSurveyEvaluationGUI.php.

Referenced by setEvalSubtabs().

◆ $toolbar

ilToolbarGUI ilSurveyEvaluationGUI::$toolbar
protected

Definition at line 52 of file class.ilSurveyEvaluationGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilSurveyEvaluationGUI::$tpl
protected

Definition at line 55 of file class.ilSurveyEvaluationGUI.php.

Referenced by __construct().

◆ $tree

ilTree ilSurveyEvaluationGUI::$tree
protected

Definition at line 51 of file class.ilSurveyEvaluationGUI.php.

◆ $ui

ILIAS DI UIServices ilSurveyEvaluationGUI::$ui
protected

Definition at line 45 of file class.ilSurveyEvaluationGUI.php.

◆ $ui_modifier

ILIAS Survey Mode UIModifier ilSurveyEvaluationGUI::$ui_modifier = null
protected

Definition at line 58 of file class.ilSurveyEvaluationGUI.php.

◆ $user

ilObjUser ilSurveyEvaluationGUI::$user
protected

Definition at line 49 of file class.ilSurveyEvaluationGUI.php.

◆ EXCEL_SUBTITLE

const ilSurveyEvaluationGUI::EXCEL_SUBTITLE = "DDDDDD"

Definition at line 34 of file class.ilSurveyEvaluationGUI.php.

◆ TYPE_SPSS

const ilSurveyEvaluationGUI::TYPE_SPSS = "csv"

◆ TYPE_XLS

const ilSurveyEvaluationGUI::TYPE_XLS = "excel"

The documentation for this class was generated from the following file: