ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilSurveyEvaluationGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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)
 
 buildExportModal (string $a_id, string $a_cmd)
 get modal html More...
 
 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 27 of file class.ilSurveyEvaluationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyEvaluationGUI::__construct ( ilObjSurvey  $a_object)

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

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().

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

Member Function Documentation

◆ buildExportModal()

ilSurveyEvaluationGUI::buildExportModal ( string  $a_id,
string  $a_cmd 
)
protected

get modal html

Exceptions
ilCtrlException

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

References $tpl, ilGlobalTemplateInterface\addOnLoadCode(), ILIAS\Repository\ctrl(), ilModalGUI\getInstance(), ILIAS\Repository\lng(), ilSelectInputGUI\setOptions(), and TYPE_SPSS.

Referenced by evaluationuser(), and sumscore().

648  : string {
649  $tpl = $this->tpl;
650 
651  $form_id = "svymdfrm";
652 
653  // hide modal on form submit
654  $tpl->addOnLoadCode('$("#form_' . $form_id . '").submit(function() { $("#' . $a_id . '").modal("hide"); });');
655 
656  $modal = ilModalGUI::getInstance();
657  $modal->setId($a_id);
658  $modal->setHeading(($this->lng->txt("svy_export_format")));
659 
660  $form = new ilPropertyFormGUI();
661  $form->setId($form_id);
662  $form->setFormAction($this->ctrl->getFormAction($this, $a_cmd));
663 
664  $format = new ilSelectInputGUI($this->lng->txt("filetype"), "export_format");
665  $format->setOptions(array(
666  self::TYPE_XLS => $this->lng->txt('exp_type_excel'),
667  self::TYPE_SPSS => $this->lng->txt('exp_type_csv')
668  ));
669  $form->addItem($format);
670 
671  $label = new ilSelectInputGUI($this->lng->txt("title"), "export_label");
672  $label->setOptions(array(
673  'label_only' => $this->lng->txt('export_label_only'),
674  'title_only' => $this->lng->txt('export_title_only'),
675  'title_label' => $this->lng->txt('export_title_label')
676  ));
677  $form->addItem($label);
678 
679  $form->addCommandButton($a_cmd, $this->lng->txt("export"));
680  $form->setPreventDoubleSubmission(false);
681 
682  $modal->setBody($form->getHTML());
683 
684  return $modal->getHTML();
685  }
This class represents a selection list property in a property form.
setOptions(array $a_options)
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
static getInstance()
const TYPE_SPSS
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelEvaluationAccess()

ilSurveyEvaluationGUI::cancelEvaluationAccess ( )

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

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

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

Referenced by checkEvaluationAccess().

262  : void
263  {
264  $ilCtrl = $this->ctrl;
265  $tree = $this->tree;
266  $path = $tree->getPathFull($this->object->getRefId());
267  $ilCtrl->setParameterByClass(
268  "ilrepositorygui",
269  "ref_id",
270  $path[count($path) - 2]["child"]
271  );
272  $ilCtrl->redirectByClass("ilrepositorygui", "frameset");
273  }
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:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAnonymizedEvaluationAccess()

ilSurveyEvaluationGUI::checkAnonymizedEvaluationAccess ( )

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

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

Referenced by evaluation().

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

◆ checkEvaluationAccess()

ilSurveyEvaluationGUI::checkEvaluationAccess ( )

Checks the evaluation access after entering the survey access code.

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

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

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

◆ competenceEval()

ilSurveyEvaluationGUI::competenceEval ( )

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

References $ctrl, $id, $lng, $object, $tabs, $toolbar, $tpl, ILIAS\Repository\ctrl(), getAppraiseeId(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setContent(), ilSelectInputGUI\setOptions(), ilLanguage\txt(), and ILIAS\Repository\user().

Referenced by openEvaluation().

1120  : void
1121  {
1122  $lng = $this->lng;
1123  $ilCtrl = $this->ctrl;
1124  $ilToolbar = $this->toolbar;
1125  $tpl = $this->tpl;
1126  $ilTabs = $this->tabs;
1127 
1128  $survey = $this->object;
1129 
1130  $ilTabs->activateSubTab("svy_eval_competences");
1131  $ilTabs->activateTab("svy_results");
1132 
1133  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "competenceEval"));
1134 
1135  $appr_id = $this->getAppraiseeId();
1136 
1137  if ($appr_id === 0) {
1138  $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_no_appraisees_found"));
1139  return;
1140  }
1141 
1142  $this->ui_modifier->setResultsCompetenceToolbar(
1143  $this->object,
1144  $ilToolbar,
1145  $this->user->getId()
1146  );
1147 
1148  // evaluation modes
1149  $eval_modes = array();
1150 
1151  // get all competences of survey
1152  $sskill = new ilSurveySkill($survey);
1153  $opts = $sskill->getAllAssignedSkillsAsOptions();
1154  $skills = array();
1155  foreach ($opts as $id => $o) {
1156  $idarr = explode(":", $id);
1157  $skills[$id] = array("id" => $id, "title" => $o, "profiles" => array(),
1158  "base_skill" => $idarr[0], "tref_id" => $idarr[1]);
1159  }
1160 
1161  // get matching user competence profiles
1162  // -> add gap analysis to profile
1163  $profiles = $this->skill_profile_service->getProfilesOfUser($appr_id);
1164  foreach ($profiles as $p) {
1165  $prof_levels = $this->skill_profile_service->getSkillLevels($p->getId());
1166  foreach ($prof_levels as $pl) {
1167  if (isset($skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()])) {
1168  $skills[$pl->getBaseSkillId() . ":" . $pl->getTrefId()]["profiles"][] =
1169  $p->getId();
1170 
1171  $eval_modes["gap_" . $p->getId()] =
1172  $lng->txt("svy_gap_analysis") . ": " . $p->getTitle();
1173  }
1174  }
1175  }
1176 
1177  // if one competence does not match any profiles
1178  // -> add "competences of survey" alternative
1179  foreach ($skills as $sk) {
1180  if (count($sk["profiles"]) === 0) {
1181  $eval_modes["skills_of_survey"] = $lng->txt("svy_all_survey_competences");
1182  }
1183  }
1184 
1185  // final determination of current evaluation mode
1186  $comp_eval_mode = $this->request->getCompEvalMode();
1187 
1188  if (!isset($eval_modes[$comp_eval_mode])) {
1189  $comp_eval_mode = key($eval_modes);
1190  $ilCtrl->setParameter($this, "comp_eval_mode", $comp_eval_mode);
1191  }
1192 
1193  $ilCtrl->saveParameter($this, "comp_eval_mode");
1194 
1195  $mode_sel = new ilSelectInputGUI($lng->txt("svy_analysis"), "comp_eval_mode");
1196  $mode_sel->setOptions($eval_modes);
1197  $mode_sel->setValue($comp_eval_mode);
1198  $ilToolbar->addInputItem($mode_sel, true);
1199 
1200  $ilToolbar->addFormButton($lng->txt("select"), "competenceEval");
1201 
1202  $pskills_gui = new ilPersonalSkillsGUI();
1203  $rater = $this->evaluation_manager->getCurrentRater();
1204  if ($rater !== "") {
1205  if (strpos($rater ?? "", "u") === 0) {
1206  $rater = substr($rater, 1);
1207  }
1208  $pskills_gui->setTriggerUserFilter([$rater]);
1209  }
1210 
1211  if (strpos($comp_eval_mode ?? "", "gap_") === 0) {
1212  // gap analysis
1213  $profile_id = (int) substr($comp_eval_mode, 4);
1214 
1215  $pskills_gui->setProfileId($profile_id);
1216  $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1217  if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1218  $sskill = new ilSurveySkill($survey);
1219  $self_levels = array();
1220  foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1221  $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1222  }
1223  $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1224  }
1225  $html = $pskills_gui->getGapAnalysisHTML($appr_id);
1226  } else { // must be all survey competences
1227  $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), $lng->txt("skmg_eval_type_1"));
1228  if ($survey->getFinishedIdForAppraiseeIdAndRaterId($appr_id, $appr_id) > 0) {
1229  $sskill = new ilSurveySkill($survey);
1230  $self_levels = array();
1231  foreach ($sskill->determineSkillLevelsForAppraisee($appr_id, true) as $sl) {
1232  $self_levels[$sl["base_skill_id"]][$sl["tref_id"]] = $sl["new_level_id"] ?? 0;
1233  }
1234  $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
1235  }
1236  $sk = array();
1237  foreach ($skills as $skill) {
1238  $sk[] = array(
1239  "base_skill_id" => (int) $skill["base_skill"],
1240  "tref_id" => (int) $skill["tref_id"]
1241  );
1242  }
1243  $html = $pskills_gui->getGapAnalysisHTML($appr_id, $sk);
1244  }
1245  $tpl->setContent($html);
1246  }
This class represents a selection list property in a property form.
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...
setOptions(array $a_options)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Personal skills GUI class.
setContent(string $a_html)
Sets content for standard template.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evaluation()

ilSurveyEvaluationGUI::evaluation ( int  $details = 0)

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

References $appr_id, $data, ILIAS\LTI\ToolProvider\$details, ILIAS\LTI\ToolProvider\$key, $path, $request, $results, $toolbar, $tree, $ui, ilObjSurvey\_getQuestionblock(), ilLink\_getStaticLink(), SurveyQuestion\_instanciateQuestionEvaluation(), ILIAS\Repository\access(), checkAnonymizedEvaluationAccess(), ILIAS\Repository\ctrl(), ilObjSurvey\EVALUATION_ACCESS_ALL, ilObjSurvey\EVALUATION_ACCESS_OFF, ilObjSurvey\EVALUATION_ACCESS_PARTICIPANTS, ilDatePresentation\formatDate(), ilTree\getPathFull(), hasResultsAccess(), IL_CAL_UNIX, ILIAS\Repository\lng(), ilObjSurvey\MODE_IND_FEEDB, ILIAS\Repository\object(), ilDatePresentation\setUseRelativeDates(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

Referenced by checkEvaluationAccess(), evaluationdetails(), and openEvaluation().

703  : void {
704  $ilToolbar = $this->toolbar;
705  $tree = $this->tree;
706  $ui = $this->ui;
707 
708  $ui_factory = $ui->factory();
709  $ui_renderer = $ui->renderer();
710 
711  $this->lng->loadLanguageModule("survey");
712 
713  $this->log->debug("check access");
714 
715  // auth
716  if (!$this->hasResultsAccess()) {
717  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
718  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
719  return;
720  }
721 
722  switch ($this->object->getEvaluationAccess()) {
724  if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
725  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
726  return;
727  }
728  break;
729 
732  if (!$this->checkAnonymizedEvaluationAccess()) {
733  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"));
734  return;
735  }
736  break;
737  }
738  }
739 
740  $this->log->debug("check access ok");
741  // setup toolbar
742 
743  $appr_id = $this->evaluation_manager->getCurrentAppraisee();
744  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
745  $results = array();
746 
747  $eval_tpl = new ilTemplate("tpl.il_svy_svy_evaluation.html", true, true, "Modules/Survey");
748 
749 
750  if ($details) {
751  $this->ui_modifier->setResultsDetailToolbar(
752  $this->object,
753  $ilToolbar,
754  $this->user->getId()
755  );
756  } else {
757  $this->ui_modifier->setResultsOverviewToolbar(
758  $this->object,
759  $ilToolbar,
760  $this->user->getId()
761  );
762  }
763 
764  if (!$this->object->get360Mode() || $appr_id) {
765  if ($details) {
766  //templates: results, table of contents
767  $dtmpl = new ilTemplate("tpl.il_svy_svy_results_details.html", true, true, "Modules/Survey/Evaluation");
768  $toc_tpl = new ilTemplate("tpl.svy_results_table_contents.html", true, true, "Modules/Survey/Evaluation");
769  $this->lng->loadLanguageModule("content");
770  $toc_tpl->setVariable("TITLE_TOC", $this->lng->txt('cont_toc'));
771  }
772 
773  $finished_ids = $this->evaluation_manager->getFilteredFinishedIds();
774 
775  // parse answer data in evaluation results
776  $listing = $this->gui->listing();
777 
778  $panels = [];
779  foreach ($this->object->getSurveyQuestions() as $qdata) {
780  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $finished_ids);
781  $q_res = $q_eval->getResults();
782  $results[] = $q_res;
783 
784  if ($details) {
785  $panels = array_merge(
786  $panels,
787  $this->ui_modifier->getDetailPanels(
788  $this->object->getSurveyParticipants(),
790  $q_eval
791  )
792  );
793 
794  // TABLE OF CONTENTS
795  if ($qdata["questionblock_id"] &&
796  $qdata["questionblock_id"] != $this->last_questionblock_id) {
797  $qblock = ilObjSurvey::_getQuestionblock($qdata["questionblock_id"]);
798  if ($qblock["show_blocktitle"]) {
799  $listing->node(
800  $this->ui->factory()->legacy($qdata["questionblock_title"]),
801  "q" . $qdata["questionblock_id"]
802  );
803  } else {
804  $listing->node(
805  $this->ui->factory()->legacy(""),
806  "q" . $qdata["questionblock_id"]
807  );
808  }
809  $this->last_questionblock_id = $qdata["questionblock_id"];
810  }
811  $anchor_id = "svyrdq" . $qdata["question_id"];
812  $listing->node(
813  $this->ui->factory()->link()->standard($qdata["title"], "#" . $anchor_id),
814  (string) $qdata["question_id"],
815  $qdata["questionblock_id"] ? "q" . $qdata["questionblock_id"] : "0"
816  );
817  }
818  }
819 
820  if ($details) {
821  $toc_tpl->setVariable("LIST", $listing->render());
822 
823  //TABLE OF CONTENTS
824  $panel_toc = $ui_factory->panel()->standard("", $ui_factory->legacy($toc_tpl->get()));
825  $render_toc = $ui_renderer->render($panel_toc);
826  $dtmpl->setVariable("PANEL_TOC", $render_toc);
827 
828  //REPORT
829  $report_title = "";
830  $panel_report = $ui_factory->panel()->report($report_title, $panels);
831  $render_report = $ui_renderer->render($panel_report);
832  $dtmpl->setVariable("PANEL_REPORT", $render_report);
833 
834  //print the main template
835  $eval_tpl->setVariable('DETAIL', $dtmpl->get());
836  }
837  }
838 
839  //$eval_tpl->setVariable('MODAL', $modal);
840  if (!$details) {
841  $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $results);
842  $eval_tpl->setVariable('CUMULATED', $table_gui->getHTML());
843  }
844 
845  //
846  // print header
847  //
848 
849  $path = "";
850  $path_full = $tree->getPathFull($this->object->getRefId());
851  foreach ($path_full as $data) {
852  $path .= " » ";
853  $path .= $data['title'];
854  }
855 
857  $props = array(
858  $this->lng->txt("link") => ilLink::_getStaticLink($this->object->getRefId()),
859  $this->lng->txt("path") => $path,
860  $this->lng->txt("svy_results") => !$details
861  ? $this->lng->txt("svy_eval_cumulated")
862  : $this->lng->txt("svy_eval_detail"),
863  $this->lng->txt("date") => ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)),
864  );
865  $eval_tpl->setCurrentBlock("print_header_bl");
866  foreach ($props as $key => $value) {
867  $eval_tpl->setVariable("HEADER_PROP_KEY", $key);
868  $eval_tpl->setVariable("HEADER_PROP_VALUE", $value);
869  $eval_tpl->parseCurrentBlock();
870  }
871 
872  $this->log->debug("end");
873 
874  $this->tpl->setContent($eval_tpl->get());
875  }
const EVALUATION_ACCESS_OFF
const EVALUATION_ACCESS_PARTICIPANTS
static _getQuestionblock(int $questionblock_id)
get question block properties
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
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:32
static _instanciateQuestionEvaluation(int $question_id, array $a_finished_ids=null)
hasResultsAccess()
Check if user can view results granted by rbac or positions.
array $details
Details for error message relating to last request processed.
Definition: System.php:109
string $key
Consumer key/client ID value.
Definition: System.php:193
$results
ILIAS Survey Evaluation EvaluationGUIRequest $request
const EVALUATION_ACCESS_ALL
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setUseRelativeDates(bool $a_status)
set use relative dates
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evaluationdetails()

ilSurveyEvaluationGUI::evaluationdetails ( )
protected

Show the detailed evaluation.

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

References evaluation().

Referenced by openEvaluation().

278  : void
279  {
280  $this->evaluation(1);
281  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evaluationuser()

ilSurveyEvaluationGUI::evaluationuser ( )

Print the survey evaluation for a selected user.

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

References $appr_id, $data, $toolbar, buildExportModal(), ILIAS\Repository\ctrl(), getAppraiseeId(), hasResultsAccess(), ILIAS\Repository\lng(), ilObjSurvey\MODE_SELF_EVAL, and ILIAS\Repository\object().

1071  : void
1072  {
1073  $ilToolbar = $this->toolbar;
1074 
1075  if (!$this->hasResultsAccess() &&
1076  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1077  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1078  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1079  }
1080 
1081  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser"));
1082 
1083  $modal = "";
1084  $appr_id = null;
1085  $data = [];
1086 
1087  if ($this->object->get360Mode()) {
1088  $appr_id = $this->getAppraiseeId();
1089  }
1090 
1091  if (!$this->object->get360Mode() || $appr_id) {
1092  $modal_id = "svy_ev_exp";
1093  $modal = $this->buildExportModal($modal_id, "exportevaluationuser");
1094 
1095  $this->gui->button(
1096  $this->lng->txt("export"),
1097  "#"
1098  )->onClick('$(\'#' . $modal_id . '\').modal(\'show\')')->toToolbar();
1099 
1100  $ilToolbar->addSeparator();
1101 
1102  $pv = $this->print->resultsDetails($this->object->getRefId());
1103  $modal_elements = $pv->getModalElements(
1104  $this->ctrl->getLinkTargetByClass(
1105  "ilSurveyEvaluationGUI",
1106  "printResultsPerUserSelection"
1107  )
1108  );
1109  $ilToolbar->addComponent($modal_elements->button);
1110  $ilToolbar->addComponent($modal_elements->modal);
1111 
1112  $data = $this->evaluation_manager->getUserSpecificResults();
1113  }
1114 
1115  $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser');
1116  $table_gui->setData($data);
1117  $this->tpl->setContent($table_gui->getHTML() . $modal);
1118  }
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...
buildExportModal(string $a_id, string $a_cmd)
get modal html
+ Here is the call graph for this function:

◆ executeCommand()

ilSurveyEvaluationGUI::executeCommand ( )

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

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

119  : string
120  {
121  $skmg_set = new ilSkillManagementSettings();
122  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
123  $cmd = $this->ctrl->getCmd("competenceEval");
124  } else {
125  $cmd = $this->ctrl->getCmd("evaluation");
126  }
127 
128  $next_class = $this->ctrl->getNextClass($this);
129 
130  $this->log->debug($cmd);
131 
132  switch ($next_class) {
133  default:
134  $this->setEvalSubtabs();
135  $ret = (string) $this->$cmd();
136  break;
137  }
138  return $ret;
139  }
setEvalSubtabs()
Set the tabs for the evaluation output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ exportCumulatedResults()

ilSurveyEvaluationGUI::exportCumulatedResults ( int  $details = 0)

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

References ILIAS\LTI\ToolProvider\$details, SurveyQuestion\_instanciateQuestionEvaluation(), ILIAS\Repository\ctrl(), ilUtil\deliverData(), exit, exportResultsDetailsExcel(), ilFileUtils\getASCIIFilename(), ILIAS\Repository\lng(), ILIAS\Repository\object(), processCSVRow(), and TYPE_SPSS.

Referenced by exportData(), and exportDetailData().

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

◆ exportData()

ilSurveyEvaluationGUI::exportData ( )

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

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

617  : void
618  {
619  if ($this->request->getExportFormat() !== '') {
620  $this->exportCumulatedResults(0);
621  } else {
622  $this->ctrl->redirect($this, 'evaluation');
623  }
624  }
+ Here is the call graph for this function:

◆ exportDetailData()

ilSurveyEvaluationGUI::exportDetailData ( )

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

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

626  : void
627  {
628  if ($this->request->getExportFormat() !== '') {
629  $this->exportCumulatedResults(1);
630  } else {
631  $this->ctrl->redirect($this, 'evaluation');
632  }
633  }
+ Here is the call graph for this function:

◆ exportEvaluationUser()

ilSurveyEvaluationGUI::exportEvaluationUser ( )

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

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

919  : void
920  {
921  // build title row(s)
922 
923  $title_row = $title_row2 = array();
924  $title_row[] = $this->lng->txt("lastname"); // #12756
925  $title_row[] = $this->lng->txt("firstname");
926  $title_row[] = $this->lng->txt("login");
927  $title_row[] = $this->lng->txt('workingtime'); // #13622
928  $title_row[] = $this->lng->txt('survey_results_finished');
929  $title_row2[] = "";
930  $title_row2[] = "";
931  $title_row2[] = "";
932  $title_row2[] = "";
933  $title_row2[] = "";
934  if ($this->object->canExportSurveyCode()) {
935  $title_row[] = $this->lng->txt("codes");
936  $title_row2[] = "";
937  }
938 
939  $questions = array();
940 
941  foreach ($this->object->getSurveyQuestions() as $qdata) {
942  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], null);
943  $q_res = $q_eval->getResults();
944 
945  $questions[$qdata["question_id"]] = array($q_eval, $q_res);
946 
947  $question = is_array($q_res)
948  ? $q_res[0][1]->getQuestion()
949  : $q_res->getQuestion();
950 
951  $do_title = $do_label = true;
952  switch ($this->request->getExportLabel()) {
953  case "label_only":
954  $title_row[] = $question->label;
955  $title_row2[] = "";
956  $do_title = false;
957  break;
958 
959  case "title_only":
960  $title_row[] = $question->getTitle();
961  $title_row2[] = "";
962  $do_label = false;
963  break;
964 
965  default:
966  $title_row[] = $question->getTitle();
967  $title_row2[] = $question->label;
968  break;
969  }
970 
971  $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
972  }
973 
974  $rows = array();
975 
976  // add title row(s)
977  $rows[] = $title_row;
978  if (implode("", $title_row2)) {
979  $rows[] = $title_row2;
980  }
981 
982  // #13620
984 
985  $finished_ids = null;
986  if ($this->object->get360Mode()) {
987  $appr_id = $this->request->getAppraiseeId();
988  if (!$appr_id) {
989  $this->ctrl->redirect($this, "evaluationuser");
990  }
991  $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id);
992  if (!count($finished_ids)) {
993  $finished_ids = array(-1);
994  }
995  }
996 
997  //$participants = $this->object->getSurveyParticipants($finished_ids);
998  $participants = $this->access_manager->canReadResultOfParticipants($finished_ids);
999 
1000  foreach ($participants as $user) {
1001  $user_id = $user["active_id"];
1002 
1003  $row = array();
1004  $row[] = trim($user["lastname"] ?? "")
1005  ? $user["lastname"]
1006  : ($user["name"] ?? ""); // anonymous
1007  $row[] = $user["firstname"] ?? "";
1008  $row[] = $user["login"] ?? ""; // #10579
1009 
1010  if ($this->object->canExportSurveyCode()) {
1011  $row[] = $user_id;
1012  }
1013 
1014  $row[] = $this->object->getWorkingtimeForParticipant($user_id);
1015 
1016  if ($user["finished"] ?? false) {
1017  $dt = new ilDateTime($user["finished_tstamp"], IL_CAL_UNIX);
1018  $row[] = ($this->request->getExportFormat() === self::TYPE_XLS)
1019  ? $dt
1021  } else {
1022  $row[] = "-"; // :TODO:
1023  }
1024 
1025  foreach ($questions as $item) {
1026  $q_eval = $item[0];
1027  $q_res = $item[1];
1028 
1029  $q_eval->addUserSpecificResults($row, $user_id, $q_res);
1030  }
1031 
1032  $rows[] = $row;
1033  }
1034 
1035  // #11179
1036  $surveyname = $this->object->getTitle() . " " . $this->lng->txt("svy_eval_user") . " " . date("Y-m-d");
1037  $surveyname = preg_replace("/\s/", "_", trim($surveyname));
1038  $surveyname = ilFileUtils::getASCIIFilename($surveyname);
1039 
1040  switch ($this->request->getExportFormat()) {
1041  case self::TYPE_XLS:
1042  $excel = new ilExcel();
1043  $excel->addSheet($this->lng->txt("svy_eval_user"));
1044 
1045  foreach ($rows as $row_idx => $row) {
1046  foreach ($row as $col_idx => $col) {
1047  $excel->setCell($row_idx + 1, $col_idx, $col);
1048  }
1049  if (!$row_idx) {
1050  $excel->setBold("A1:" . $excel->getColumnCoord(count($row) - 1) . "1");
1051  }
1052  }
1053  $excel->sendToClient($surveyname);
1054 
1055  // no break
1056  case self::TYPE_SPSS:
1057  $csv = "";
1058  $separator = ";";
1059  foreach ($rows as $csvrow) {
1060  $csvrow = str_replace("\n", " ", $this->processCSVRow($csvrow, true, $separator));
1061  $csv .= implode($separator, $csvrow) . "\n";
1062  }
1063  ilUtil::deliverData($csv, "$surveyname.csv");
1064  exit();
1065  }
1066  }
exit
Definition: login.php:29
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
const IL_CAL_UNIX
static _instanciateQuestionEvaluation(int $question_id, array $a_finished_ids=null)
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.
static setUseRelativeDates(bool $a_status)
set use relative dates
const TYPE_SPSS
+ 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

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

References ILIAS\LTI\ToolProvider\$key, SurveyQuestion\_getQuestionTypeName(), ilExcel\addSheet(), ilExcel\getCoordByColumnAndRow(), SurveyQuestionEvaluation\getExportGrid(), SurveyQuestionEvaluation\getTextAnswers(), ILIAS\Repository\lng(), parseResultsToExcel(), ilExcel\setBold(), ilExcel\setCell(), and ilExcel\setColors().

Referenced by exportCumulatedResults().

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

◆ getAppraiseeId()

ilSurveyEvaluationGUI::getAppraiseeId ( )

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

References $appr_id.

Referenced by competenceEval(), and evaluationuser().

195  : int
196  {
197  return $this->appr_id;
198  }
+ Here is the caller graph for this function:

◆ getSumScores()

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

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

References SurveyQuestion\_instanciateQuestionEvaluation(), ILIAS\Repository\int(), and ILIAS\Repository\object().

Referenced by sumscore().

1295  : array {
1296  $sum_scores = [];
1297  foreach ($this->access_manager->canReadResultOfParticipants($a_finished_ids) as $p) {
1298  $sum_scores[$p["active_id"]] = [
1299  "username" => $p["sortname"],
1300  "score" => 0
1301  ];
1302  }
1303 
1304  foreach ($this->object->getSurveyQuestions() as $qdata) {
1305  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $a_finished_ids);
1306  foreach ($q_eval->getSumScores() as $finished_id => $sum_score) {
1307  if ($sum_score === null) {
1308  $sum_scores[$finished_id]["score"] = null;
1309  }
1310  if ($sum_scores[$finished_id]["score"] !== null) {
1311  $sum_scores[$finished_id]["score"] += (int) $sum_score;
1312  }
1313  }
1314  }
1315  return $sum_scores;
1316  }
static _instanciateQuestionEvaluation(int $question_id, array $a_finished_ids=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasResultsAccess()

ilSurveyEvaluationGUI::hasResultsAccess ( )
protected

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

Todo:
move to access manager

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

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

Referenced by evaluation(), evaluationuser(), setEvalSubtabs(), and sumscore().

1252  : bool
1253  {
1254  return $this->access->checkRbacOrPositionPermissionAccess('read_results', 'access_results', $this->object->getRefId());
1255  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openEvaluation()

ilSurveyEvaluationGUI::openEvaluation ( )
protected

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

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

687  : void
688  {
689  $skmg_set = new ilSkillManagementSettings();
690  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
691  $this->competenceEval();
692  } else {
693  if ($this->object->getMode() === ilObjSurvey::MODE_IND_FEEDB) {
694  $this->evaluationdetails();
695  } else {
696  $this->evaluation();
697  }
698  }
699  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
evaluationdetails()
Show the detailed evaluation.
+ 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 533 of file class.ilSurveyEvaluationGUI.php.

References ILIAS\LTI\ToolProvider\$key, ilSurveyEvaluationResults\getMean(), ilSurveyEvaluationResults\getMedian(), ilSurveyEvaluationResults\getMedianAsText(), ilSurveyEvaluationResults\getModeNrOfSelections(), ilSurveyEvaluationResults\getModeValue(), ilSurveyEvaluationResults\getModeValueAsText(), ILIAS\Repository\lng(), ilExcel\setCell(), and ilExcel\setColors().

Referenced by exportResultsDetailsExcel().

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

◆ printEvaluation()

ilSurveyEvaluationGUI::printEvaluation ( )

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

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

635  : void
636  {
637  $this->tpl->setOnScreenMessage('info', $this->lng->txt('use_browser_print_function'), true);
638  $this->ctrl->redirect($this, 'evaluation');
639  }
+ Here is the call graph for this function:

◆ printResultsDetails()

ilSurveyEvaluationGUI::printResultsDetails ( )

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

References ILIAS\Repository\object().

1346  : void
1347  {
1348  $view = $this->print->resultsDetails($this->object->getRefId());
1349  $view->sendPrintView();
1350  }
+ Here is the call graph for this function:

◆ printResultsDetailsSelection()

ilSurveyEvaluationGUI::printResultsDetailsSelection ( )
Exceptions

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

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

1330  : void
1331  {
1332  $this->ctrl->setParameterByClass(
1333  "ilSurveyEvaluationGUI",
1334  "vw",
1335  $this->request->getVW()
1336  );
1337  $this->ctrl->setParameterByClass(
1338  "ilSurveyEvaluationGUI",
1339  "cp",
1340  $this->request->getCP()
1341  );
1342  $view = $this->print->resultsDetails($this->object->getRefId());
1343  $view->sendForm();
1344  }
+ Here is the call graph for this function:

◆ printResultsOverviewSelection()

ilSurveyEvaluationGUI::printResultsOverviewSelection ( )
Exceptions

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

References ILIAS\Repository\object().

1321  : void
1322  {
1323  $view = $this->print->resultsOverview($this->object->getRefId());
1324  $view->sendForm();
1325  }
+ Here is the call graph for this function:

◆ printResultsPerUser()

ilSurveyEvaluationGUI::printResultsPerUser ( )

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

References ILIAS\Repository\object().

1361  : void
1362  {
1363  $view = $this->print->resultsPerUser($this->object->getRefId());
1364  $view->sendPrintView();
1365  }
+ Here is the call graph for this function:

◆ printResultsPerUserSelection()

ilSurveyEvaluationGUI::printResultsPerUserSelection ( )
Exceptions

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

References ILIAS\Repository\object().

1355  : void
1356  {
1357  $view = $this->print->resultsPerUser($this->object->getRefId());
1358  $view->sendForm();
1359  }
+ 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 885 of file class.ilSurveyEvaluationGUI.php.

Referenced by exportCumulatedResults(), and exportEvaluationUser().

889  : array {
890  $resultarray = array();
891  foreach ($row as $rowindex => $entry) {
892  if (is_array($entry)) {
893  $entry = implode("/", $entry);
894  }
895  $surround = false;
896  if ($quoteAll) {
897  $surround = true;
898  }
899  if (strpos($entry ?? "", "\"") !== false) {
900  $entry = str_replace("\"", "\"\"", (string) $entry);
901  $surround = true;
902  }
903  if (strpos($entry ?? "", $separator) !== false) {
904  $surround = true;
905  }
906  // replace all CR LF with LF (for Excel for Windows compatibility
907  $entry = str_replace(chr(13) . chr(10), chr(10), (string) $entry);
908  if ($surround) {
909  //$resultarray[$rowindex] = utf8_decode("\"" . $entry . "\"");
910  $resultarray[$rowindex] = "\"" . $entry . "\"";
911  } else {
912  //$resultarray[$rowindex] = utf8_decode($entry);
913  $resultarray[$rowindex] = $entry;
914  }
915  }
916  return $resultarray;
917  }
+ Here is the caller graph for this function:

◆ setAppraiseeId()

ilSurveyEvaluationGUI::setAppraiseeId ( int  $a_val)

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

Referenced by __construct().

191  : void {
192  $this->appr_id = $a_val;
193  }
+ Here is the caller graph for this function:

◆ setEvalSubtabs()

ilSurveyEvaluationGUI::setEvalSubtabs ( )

Set the tabs for the evaluation output.

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

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

Referenced by executeCommand().

144  : void
145  {
146  $ilTabs = $this->tabs;
147 
148  $skmg_set = new ilSkillManagementSettings();
149  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
150  $ilTabs->addSubTabTarget(
151  "svy_eval_competences",
152  $this->ctrl->getLinkTarget($this, "competenceEval"),
153  array("competenceEval")
154  );
155  }
156 
157  if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
158  $ilTabs->addSubTabTarget(
159  "svy_eval_cumulated",
160  $this->ctrl->getLinkTarget($this, "evaluation"),
161  array("evaluation", "checkEvaluationAccess")
162  );
163  }
164 
165  $ilTabs->addSubTabTarget(
166  "svy_eval_detail",
167  $this->ctrl->getLinkTarget($this, "evaluationdetails"),
168  array("evaluationdetails")
169  );
170 
171  if ($this->hasResultsAccess() && $this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
172  $ilTabs->addSubTabTarget(
173  "svy_eval_user",
174  $this->ctrl->getLinkTarget($this, "evaluationuser"),
175  array("evaluationuser")
176  );
177  }
178 
179  if ($this->object->getCalculateSumScore()) {
180  $ilTabs->addSubTabTarget(
181  "svy_sum_score",
182  $this->ctrl->getLinkTarget($this, "sumscore"),
183  array("sumscore")
184  );
185  }
186  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasResultsAccess()
Check if user can view results granted by rbac or positions.
+ 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 1260 of file class.ilSurveyEvaluationGUI.php.

References $toolbar, buildExportModal(), ILIAS\Repository\ctrl(), getSumScores(), hasResultsAccess(), ILIAS\Repository\lng(), ilObjSurvey\MODE_SELF_EVAL, ILIAS\Repository\object(), and ilSumScoreTableGUI\setSumScores().

1260  : void
1261  {
1262  $ilToolbar = $this->toolbar;
1263 
1264  if (!$this->hasResultsAccess() &&
1265  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1266  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1267  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1268  }
1269 
1270  $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_max_sum_score") . ": " . $this->object->getMaxSumScore());
1271 
1272  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser"));
1273 
1274  $modal_id = "svy_ev_exp";
1275  $modal = $this->buildExportModal($modal_id, "exportevaluationuser");
1276 
1277  $this->gui->button(
1278  $this->lng->txt("print"),
1279  "#"
1280  )->onClick("window.print(); return false;")->toToolbar();
1281 
1282  $finished_ids = null;
1283 
1284  $sum_scores = $this->getSumScores($finished_ids);
1285  $table_gui = new ilSumScoreTableGUI($this, 'sumscore', $this->object->hasAnonymizedResults());
1286  $table_gui->setSumScores($sum_scores);
1287  $this->tpl->setContent($table_gui->getHTML() . $modal);
1288  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasResultsAccess()
Check if user can view results granted by rbac or positions.
buildExportModal(string $a_id, string $a_cmd)
get modal html
getSumScores(?array $a_finished_ids=null)
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilSurveyEvaluationGUI::$access
protected

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

◆ $access_manager

ILIAS Survey Access AccessManager ilSurveyEvaluationGUI::$access_manager
protected

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

◆ $appr_id

int ilSurveyEvaluationGUI::$appr_id = null
protected

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

Referenced by evaluation(), evaluationuser(), and getAppraiseeId().

◆ $array_panels

array ilSurveyEvaluationGUI::$array_panels
protected

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

◆ $ctrl

ilCtrl ilSurveyEvaluationGUI::$ctrl
protected

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

Referenced by cancelEvaluationAccess(), and competenceEval().

◆ $evaluation_manager

ILIAS Survey Evaluation EvaluationManager ilSurveyEvaluationGUI::$evaluation_manager
protected

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

◆ $gui

ILIAS Survey InternalGUIService ilSurveyEvaluationGUI::$gui
protected

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

◆ $last_questionblock_id

ilSurveyEvaluationGUI::$last_questionblock_id
protected

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

◆ $lng

ilLanguage ilSurveyEvaluationGUI::$lng
protected

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

Referenced by __construct(), and competenceEval().

◆ $log

ilLogger ilSurveyEvaluationGUI::$log
protected

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

◆ $object

ilObjSurvey ilSurveyEvaluationGUI::$object
protected

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

Referenced by competenceEval().

◆ $print

ILIAS Survey PrintView GUIService ilSurveyEvaluationGUI::$print
protected

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

◆ $rbacsystem

ilRbacSystem ilSurveyEvaluationGUI::$rbacsystem
protected

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

◆ $request

ILIAS Survey Evaluation EvaluationGUIRequest ilSurveyEvaluationGUI::$request
protected

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

Referenced by evaluation().

◆ $skill_profile_service

ILIAS Skill Service SkillProfileService ilSurveyEvaluationGUI::$skill_profile_service
protected

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

◆ $tabs

ilTabsGUI ilSurveyEvaluationGUI::$tabs
protected

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

Referenced by competenceEval(), and setEvalSubtabs().

◆ $toolbar

ilToolbarGUI ilSurveyEvaluationGUI::$toolbar
protected

◆ $tpl

ilGlobalTemplateInterface ilSurveyEvaluationGUI::$tpl
protected

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

Referenced by __construct(), buildExportModal(), and competenceEval().

◆ $tree

ilTree ilSurveyEvaluationGUI::$tree
protected

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

Referenced by cancelEvaluationAccess(), and evaluation().

◆ $ui

ILIAS DI UIServices ilSurveyEvaluationGUI::$ui
protected

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

Referenced by evaluation().

◆ $ui_modifier

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

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

◆ $user

ilObjUser ilSurveyEvaluationGUI::$user
protected

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

Referenced by checkAnonymizedEvaluationAccess().

◆ EXCEL_SUBTITLE

const ilSurveyEvaluationGUI::EXCEL_SUBTITLE = "DDDDDD"

Definition at line 31 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: