ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 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 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 58 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().

60  {
61  global $DIC;
62 
63  $this->tabs = $DIC->tabs();
64  $this->access = $DIC->access();
65  $this->user = $DIC->user();
66  $this->rbacsystem = $DIC->rbac()->system();
67  $this->tree = $DIC->repositoryTree();
68  $this->toolbar = $DIC->toolbar();
69  $this->ui = $DIC->ui();
70  $lng = $DIC->language();
71  $tpl = $DIC["tpl"];
72  $ilCtrl = $DIC->ctrl();
73 
74  $this->lng = $lng;
75  $this->tpl = $tpl;
76  $this->ctrl = $ilCtrl;
77  $this->object = $a_object;
78  $this->log = ilLoggerFactory::getLogger("svy");
79  $this->array_panels = array();
80 
81  $this->request = $DIC->survey()->internal()->gui()->evaluation($this->object)->request();
82 
83  $this->ctrl->saveParameter($this, ["appr_id", "rater_id"]);
84  $this->evaluation_manager = $DIC
85  ->survey()
86  ->internal()
87  ->domain()
88  ->evaluation(
89  $this->object,
90  $DIC->user()->getId(),
91  $this->request->getAppraiseeId(),
92  $this->request->getRaterId()
93  );
94 
95  $this->setAppraiseeId(
96  $this->evaluation_manager->getCurrentAppraisee()
97  );
98 
99  $this->ui_modifier = $DIC->survey()
100  ->internal()
101  ->gui()
102  ->modeUIModifier($this->object->getMode());
103  $this->print = $DIC->survey()
104  ->internal()
105  ->gui()
106  ->print();
107  $this->access_manager = $DIC->survey()
108  ->internal()
109  ->domain()
110  ->access(
111  $this->object->getRefId(),
112  $DIC->user()->getId()
113  );
114  $this->skill_profile_service = $DIC->skills()->profile();
115  }
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 649 of file class.ilSurveyEvaluationGUI.php.

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

Referenced by evaluationuser(), and sumscore().

652  : string {
653  $tpl = $this->tpl;
654 
655  $form_id = "svymdfrm";
656 
657  // hide modal on form submit
658  $tpl->addOnLoadCode('$("#form_' . $form_id . '").submit(function() { $("#' . $a_id . '").modal("hide"); });');
659 
660  $modal = ilModalGUI::getInstance();
661  $modal->setId($a_id);
662  $modal->setHeading(($this->lng->txt("svy_export_format")));
663 
664  $form = new ilPropertyFormGUI();
665  $form->setId($form_id);
666  $form->setFormAction($this->ctrl->getFormAction($this, $a_cmd));
667 
668  $format = new ilSelectInputGUI($this->lng->txt("filetype"), "export_format");
669  $format->setOptions(array(
670  self::TYPE_XLS => $this->lng->txt('exp_type_excel'),
671  self::TYPE_SPSS => $this->lng->txt('exp_type_csv')
672  ));
673  $form->addItem($format);
674 
675  $label = new ilSelectInputGUI($this->lng->txt("title"), "export_label");
676  $label->setOptions(array(
677  'label_only' => $this->lng->txt('export_label_only'),
678  'title_only' => $this->lng->txt('export_title_only'),
679  'title_label' => $this->lng->txt('export_title_label')
680  ));
681  $form->addItem($label);
682 
683  $form->addCommandButton($a_cmd, $this->lng->txt("export"));
684  $form->setPreventDoubleSubmission(false);
685 
686  $modal->setBody($form->getHTML());
687 
688  return $modal->getHTML();
689  }
$format
Definition: metadata.php:235
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 268 of file class.ilSurveyEvaluationGUI.php.

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

Referenced by checkEvaluationAccess().

268  : void
269  {
270  $ilCtrl = $this->ctrl;
271  $tree = $this->tree;
272  $path = $tree->getPathFull($this->object->getRefId());
273  $ilCtrl->setParameterByClass(
274  "ilrepositorygui",
275  "ref_id",
276  $path[count($path) - 2]["child"]
277  );
278  $ilCtrl->redirectByClass("ilrepositorygui", "frameset");
279  }
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 198 of file class.ilSurveyEvaluationGUI.php.

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

Referenced by evaluation().

198  : bool
199  {
201 
202  if ($this->object->getAnonymize() === 1 &&
203  $this->evaluation_manager->getAnonEvaluationAccess() === $this->request->getRefId()) {
204  return true;
205  }
206 
208  ilObject::_lookupObjId($this->request->getRefId()),
209  $ilUser->getId()
210  )) {
211  if ($this->object->getAnonymize() === 1) {
212  $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
213  }
214  return true;
215  }
216 
217  if ($this->object->getAnonymize() === 1) {
218  // autocode
219  $surveycode = $this->object->getUserAccessCode($ilUser->getId());
220  if ($this->object->isAnonymizedParticipant($surveycode)) {
221  $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
222  return true;
223  }
224 
225  /* try to find code for current (registered) user from existing run
226  if($this->object->findCodeForUser($ilUser->getId()))
227  {
228  $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
229  return true;
230  }
231  */
232 
233  // code needed
234  $this->tpl->setVariable("TABS", "");
235  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_checkaccess.html", "Modules/Survey");
236  $this->tpl->setCurrentBlock("adm_content");
237  $this->tpl->setVariable("AUTHENTICATION_NEEDED", $this->lng->txt("svy_check_evaluation_authentication_needed"));
238  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "checkEvaluationAccess"));
239  $this->tpl->setVariable("EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt("svy_check_evaluation_access_introduction"));
240  $this->tpl->setVariable("VALUE_CHECK", $this->lng->txt("ok"));
241  $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
242  $this->tpl->setVariable("TEXT_SURVEY_CODE", $this->lng->txt("survey_code"));
243  $this->tpl->parseCurrentBlock();
244  }
245 
246  $this->evaluation_manager->clearAnonEvaluationAccess();
247  return false;
248  }
static _lookupObjId(int $ref_id)
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
$ilUser
Definition: imgupload.php:34
+ 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 253 of file class.ilSurveyEvaluationGUI.php.

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

253  : void
254  {
255  $surveycode = $this->request->getSurveyCode();
256  if ($this->object->isAnonymizedParticipant($surveycode)) {
257  $this->evaluation_manager->setAnonEvaluationAccess($this->request->getRefId());
258  $this->evaluation();
259  } else {
260  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("svy_check_evaluation_wrong_key", true));
261  $this->cancelEvaluationAccess();
262  }
263  }
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 1114 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(), ilLanguage\txt(), and ILIAS\Repository\user().

Referenced by openEvaluation().

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

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

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

References evaluation().

Referenced by openEvaluation().

284  : void
285  {
286  $this->evaluation(1);
287  }
+ 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 1065 of file class.ilSurveyEvaluationGUI.php.

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

1065  : void
1066  {
1067  $ilToolbar = $this->toolbar;
1068 
1069  if (!$this->hasResultsAccess() &&
1070  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1071  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1072  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1073  }
1074 
1075  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser"));
1076 
1077  $modal = "";
1078  $appr_id = null;
1079  $data = [];
1080 
1081  if ($this->object->get360Mode()) {
1082  $appr_id = $this->getAppraiseeId();
1083  }
1084 
1085  if (!$this->object->get360Mode() || $appr_id) {
1086  $modal_id = "svy_ev_exp";
1087  $modal = $this->buildExportModal($modal_id, "exportevaluationuser");
1088 
1089  $button = ilLinkButton::getInstance();
1090  $button->setCaption("export");
1091  $button->setOnClick('$(\'#' . $modal_id . '\').modal(\'show\')');
1092  $ilToolbar->addButtonInstance($button);
1093 
1094  $ilToolbar->addSeparator();
1095 
1096  $pv = $this->print->resultsDetails($this->object->getRefId());
1097  $modal_elements = $pv->getModalElements(
1098  $this->ctrl->getLinkTargetByClass(
1099  "ilSurveyEvaluationGUI",
1100  "printResultsPerUserSelection"
1101  )
1102  );
1103  $ilToolbar->addComponent($modal_elements->button);
1104  $ilToolbar->addComponent($modal_elements->modal);
1105 
1106  $data = $this->evaluation_manager->getUserSpecificResults();
1107  }
1108 
1109  $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser');
1110  $table_gui->setData($data);
1111  $this->tpl->setContent($table_gui->getHTML() . $modal);
1112  }
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 117 of file class.ilSurveyEvaluationGUI.php.

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

117  : string
118  {
119  $skmg_set = new ilSkillManagementSettings();
120  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
121  $cmd = $this->ctrl->getCmd("competenceEval");
122  } else {
123  $cmd = $this->ctrl->getCmd("evaluation");
124  }
125 
126  $next_class = $this->ctrl->getNextClass($this);
127 
128  $this->log->debug($cmd);
129 
130  switch ($next_class) {
131  default:
132  $this->setEvalSubtabs();
133  $ret = (string) $this->$cmd();
134  break;
135  }
136  return $ret;
137  }
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 289 of file class.ilSurveyEvaluationGUI.php.

References ILIAS\LTI\ToolProvider\$details, $type, 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().

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

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

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

◆ exportDetailData()

ilSurveyEvaluationGUI::exportDetailData ( )

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

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

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

◆ exportEvaluationUser()

ilSurveyEvaluationGUI::exportEvaluationUser ( )

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

References $rows, 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.

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

Export details (excel only)

Parameters
ilSurveyEvaluationResults | array$a_results
Exceptions

Definition at line 416 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().

422  : void {
423  $question_res = $a_results;
424  $matrix = false;
425  if (is_array($question_res)) {
426  $question_res = $question_res[0][1];
427  $matrix = true;
428  }
429  $question = $question_res->getQuestion();
430 
431  $a_excel->addSheet($question->getTitle());
432 
433 
434  // question "overview"
435 
436  $kv = array();
437 
438  if ($a_do_title) {
439  $kv[$this->lng->txt("title")] = $question->getTitle();
440  }
441  if ($a_do_label) {
442  $kv[$this->lng->txt("label")] = $question->label;
443  }
444 
445  // question
446  $kv[$this->lng->txt("question")] = $question->getQuestiontext();
447 
448  // question type
449  $kv[$this->lng->txt("question_type")] = SurveyQuestion::_getQuestionTypeName($question->getQuestionType());
450 
451  // :TODO: present subtypes (hrz/vrt, mc/sc mtx, metric scale)?
452 
453  // answered and skipped users
454  $kv[$this->lng->txt("users_answered")] = $question_res->getUsersAnswered();
455  $kv[$this->lng->txt("users_skipped")] = $question_res->getUsersSkipped(); // #0021671
456 
457  $excel_row = 1;
458 
459  foreach ($kv as $key => $value) {
460  $a_excel->setCell($excel_row, 0, $key);
461  $a_excel->setCell($excel_row++, 1, $value);
462  }
463 
464  if (!$matrix) {
465  $this->parseResultsToExcel(
466  $a_excel,
467  $question_res,
468  $excel_row,
469  $a_eval->getExportGrid($a_results),
470  $a_eval->getTextAnswers($a_results)
471  );
472  } else {
473  // question
474  $this->parseResultsToExcel(
475  $a_excel,
476  $question_res,
477  $excel_row,
478  null,
479  null,
480  false
481  );
482 
483  $texts = $a_eval->getTextAnswers($a_results);
484 
485  // "rows"
486  foreach ($a_results as $row_results) {
487  $row_title = $row_results[0];
488 
489  $a_excel->setCell($excel_row, 0, $this->lng->txt("row"));
490  $a_excel->setCell($excel_row++, 1, $row_title);
491 
492  $this->parseResultsToExcel(
493  $a_excel,
494  $row_results[1],
495  $excel_row,
496  $a_eval->getExportGrid($row_results[1]),
497  is_array($texts[$row_title] ?? false)
498  ? array("" => $texts[$row_title])
499  : null
500  );
501  }
502  }
503 
504  // matrix question: overview #21438
505  if ($matrix) {
506  $a_excel->setCell($excel_row++, 0, $this->lng->txt("overview"));
507 
508  // title row with variables
509  $counter = 0;
510  $cats = $question->getColumns();
511  foreach ($cats->getCategories() as $cat) {
512  $a_excel->setColors($a_excel->getCoordByColumnAndRow(1 + $counter, $excel_row), self::EXCEL_SUBTITLE);
513  $a_excel->setCell($excel_row, 1 + $counter, $cat->title);
514  $counter++;
515  }
516  $excel_row++;
517 
518  foreach ($a_results as $row_results) {
519  $row_title = $row_results[0];
520  $counter = 0;
521  $a_excel->setCell($excel_row, 0, $row_title);
522 
523  $vars = $row_results[1]->getVariables();
524  if ($vars) {
525  foreach ($vars as $var) {
526  $a_excel->setCell($excel_row, ++$counter, $var->abs);
527  }
528  }
529  $excel_row++;
530  }
531  }
532 
533  // 1st column is bold
534  $a_excel->setBold("A1:A" . $excel_row);
535  }
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 193 of file class.ilSurveyEvaluationGUI.php.

References $appr_id.

Referenced by competenceEval(), and evaluationuser().

193  : int
194  {
195  return $this->appr_id;
196  }
+ 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 1289 of file class.ilSurveyEvaluationGUI.php.

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

Referenced by sumscore().

1291  : array {
1292  $sum_scores = [];
1293  foreach ($this->access_manager->canReadResultOfParticipants($a_finished_ids) as $p) {
1294  $sum_scores[$p["active_id"]] = [
1295  "username" => $p["sortname"],
1296  "score" => 0
1297  ];
1298  }
1299 
1300  foreach ($this->object->getSurveyQuestions() as $qdata) {
1301  $q_eval = SurveyQuestion::_instanciateQuestionEvaluation($qdata["question_id"], $a_finished_ids);
1302  foreach ($q_eval->getSumScores() as $finished_id => $sum_score) {
1303  if ($sum_score === null) {
1304  $sum_scores[$finished_id]["score"] = null;
1305  }
1306  if ($sum_scores[$finished_id]["score"] !== null) {
1307  $sum_scores[$finished_id]["score"] += (int) $sum_score;
1308  }
1309  }
1310  }
1311  return $sum_scores;
1312  }
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 1247 of file class.ilSurveyEvaluationGUI.php.

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

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

1247  : bool
1248  {
1249  return $this->access->checkRbacOrPositionPermissionAccess('read_results', 'access_results', $this->object->getRefId());
1250  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openEvaluation()

ilSurveyEvaluationGUI::openEvaluation ( )
protected

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

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

691  : void
692  {
693  $skmg_set = new ilSkillManagementSettings();
694  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
695  $this->competenceEval();
696  } else {
697  if ($this->object->getMode() === ilObjSurvey::MODE_IND_FEEDB) {
698  $this->evaluationdetails();
699  } else {
700  $this->evaluation();
701  }
702  }
703  }
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 537 of file class.ilSurveyEvaluationGUI.php.

References $cols, 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().

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

◆ printEvaluation()

ilSurveyEvaluationGUI::printEvaluation ( )

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

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

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

◆ printResultsDetails()

ilSurveyEvaluationGUI::printResultsDetails ( )

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

References ILIAS\Repository\object().

1342  : void
1343  {
1344  $view = $this->print->resultsDetails($this->object->getRefId());
1345  $view->sendPrintView();
1346  }
+ Here is the call graph for this function:

◆ printResultsDetailsSelection()

ilSurveyEvaluationGUI::printResultsDetailsSelection ( )
Exceptions

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

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

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

◆ printResultsOverviewSelection()

ilSurveyEvaluationGUI::printResultsOverviewSelection ( )
Exceptions

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

References ILIAS\Repository\object().

1317  : void
1318  {
1319  $view = $this->print->resultsOverview($this->object->getRefId());
1320  $view->sendForm();
1321  }
+ Here is the call graph for this function:

◆ printResultsPerUser()

ilSurveyEvaluationGUI::printResultsPerUser ( )

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

References ILIAS\Repository\object().

1357  : void
1358  {
1359  $view = $this->print->resultsPerUser($this->object->getRefId());
1360  $view->sendPrintView();
1361  }
+ Here is the call graph for this function:

◆ printResultsPerUserSelection()

ilSurveyEvaluationGUI::printResultsPerUserSelection ( )
Exceptions

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

References ILIAS\Repository\object().

1351  : void
1352  {
1353  $view = $this->print->resultsPerUser($this->object->getRefId());
1354  $view->sendForm();
1355  }
+ 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 881 of file class.ilSurveyEvaluationGUI.php.

Referenced by exportCumulatedResults(), and exportEvaluationUser().

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

◆ setAppraiseeId()

ilSurveyEvaluationGUI::setAppraiseeId ( int  $a_val)

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

Referenced by __construct().

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

◆ setEvalSubtabs()

ilSurveyEvaluationGUI::setEvalSubtabs ( )

Set the tabs for the evaluation output.

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

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

Referenced by executeCommand().

142  : void
143  {
144  $ilTabs = $this->tabs;
145 
146  $skmg_set = new ilSkillManagementSettings();
147  if ($this->object->getSkillService() && $skmg_set->isActivated()) {
148  $ilTabs->addSubTabTarget(
149  "svy_eval_competences",
150  $this->ctrl->getLinkTarget($this, "competenceEval"),
151  array("competenceEval")
152  );
153  }
154 
155  if ($this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
156  $ilTabs->addSubTabTarget(
157  "svy_eval_cumulated",
158  $this->ctrl->getLinkTarget($this, "evaluation"),
159  array("evaluation", "checkEvaluationAccess")
160  );
161  }
162 
163  $ilTabs->addSubTabTarget(
164  "svy_eval_detail",
165  $this->ctrl->getLinkTarget($this, "evaluationdetails"),
166  array("evaluationdetails")
167  );
168 
169  if ($this->hasResultsAccess() && $this->object->getMode() !== ilObjSurvey::MODE_IND_FEEDB) {
170  $ilTabs->addSubTabTarget(
171  "svy_eval_user",
172  $this->ctrl->getLinkTarget($this, "evaluationuser"),
173  array("evaluationuser")
174  );
175  }
176 
177  if ($this->object->getCalculateSumScore()) {
178  $ilTabs->addSubTabTarget(
179  "svy_sum_score",
180  $this->ctrl->getLinkTarget($this, "sumscore"),
181  array("sumscore")
182  );
183  }
184  }
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 1255 of file class.ilSurveyEvaluationGUI.php.

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

1255  : void
1256  {
1257  $ilToolbar = $this->toolbar;
1258 
1259  if (!$this->hasResultsAccess() &&
1260  $this->object->getMode() !== ilObjSurvey::MODE_SELF_EVAL) {
1261  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
1262  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
1263  }
1264 
1265  $this->tpl->setOnScreenMessage('info', $this->lng->txt("svy_max_sum_score") . ": " . $this->object->getMaxSumScore());
1266 
1267  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser"));
1268 
1269  $modal_id = "svy_ev_exp";
1270  $modal = $this->buildExportModal($modal_id, "exportevaluationuser");
1271 
1272  $button = ilLinkButton::getInstance();
1273  $button->setCaption("print");
1274  $button->setOnClick("window.print(); return false;");
1275  $button->setOmitPreventDoubleSubmission(true);
1276  $ilToolbar->addButtonInstance($button);
1277 
1278  $finished_ids = null;
1279 
1280  $sum_scores = $this->getSumScores($finished_ids);
1281  $table_gui = new ilSumScoreTableGUI($this, 'sumscore', $this->object->hasAnonymizedResults());
1282  $table_gui->setSumScores($sum_scores);
1283  $this->tpl->setContent($table_gui->getHTML() . $modal);
1284  }
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 44 of file class.ilSurveyEvaluationGUI.php.

◆ $access_manager

ILIAS Survey Access AccessManager ilSurveyEvaluationGUI::$access_manager
protected

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

◆ $appr_id

int ilSurveyEvaluationGUI::$appr_id = null
protected

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

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

◆ $array_panels

array ilSurveyEvaluationGUI::$array_panels
protected

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

◆ $ctrl

ilCtrl ilSurveyEvaluationGUI::$ctrl
protected

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

Referenced by cancelEvaluationAccess(), and competenceEval().

◆ $evaluation_manager

ILIAS Survey Evaluation EvaluationManager ilSurveyEvaluationGUI::$evaluation_manager
protected

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

◆ $last_questionblock_id

ilSurveyEvaluationGUI::$last_questionblock_id
protected

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

◆ $lng

ilLanguage ilSurveyEvaluationGUI::$lng
protected

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

Referenced by __construct(), and competenceEval().

◆ $log

ilLogger ilSurveyEvaluationGUI::$log
protected

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

◆ $object

ilObjSurvey ilSurveyEvaluationGUI::$object
protected

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

Referenced by competenceEval().

◆ $print

ILIAS Survey PrintView GUIService ilSurveyEvaluationGUI::$print
protected

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

◆ $rbacsystem

ilRbacSystem ilSurveyEvaluationGUI::$rbacsystem
protected

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

◆ $request

ILIAS Survey Evaluation EvaluationGUIRequest ilSurveyEvaluationGUI::$request
protected

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

Referenced by evaluation().

◆ $skill_profile_service

ILIAS Skill Service SkillProfileService ilSurveyEvaluationGUI::$skill_profile_service
protected

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

◆ $tabs

ilTabsGUI ilSurveyEvaluationGUI::$tabs
protected

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

Referenced by competenceEval(), and setEvalSubtabs().

◆ $toolbar

ilToolbarGUI ilSurveyEvaluationGUI::$toolbar
protected

◆ $tpl

ilGlobalTemplateInterface ilSurveyEvaluationGUI::$tpl
protected

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

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

◆ $tree

ilTree ilSurveyEvaluationGUI::$tree
protected

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

Referenced by cancelEvaluationAccess(), and evaluation().

◆ $ui

ILIAS DI UIServices ilSurveyEvaluationGUI::$ui
protected

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

Referenced by evaluation().

◆ $ui_modifier

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

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

◆ $user

ilObjUser ilSurveyEvaluationGUI::$user
protected

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