ILIAS  release_8 Revision v8.23
ILIAS\Survey\Evaluation\EvaluationManager Class Reference

Evaluation manager. More...

+ Collaboration diagram for ILIAS\Survey\Evaluation\EvaluationManager:

Public Member Functions

 __construct (InternalDomainService $domain_service, InternalRepoService $repo_service, \ilObjSurvey $survey, int $user_id, int $requested_appr_id, string $requested_rater_id)
 
 isMultiParticipantsView ()
 Can the current user switch between participants and see their results? More...
 
 getSelectableAppraisees ()
 Get all participants the current user may see results from, including itself. More...
 
 getCurrentAppraisee ()
 1) We have a set of selectable appraisees. More...
 
 getSelectableRaters ()
 Only the individual feedback mode allows to select raters and only, if the user cannot select appraisees on top level. More...
 
 getCurrentRater ()
 
 setAnonEvaluationAccess (int $ref_id)
 
 getAnonEvaluationAccess ()
 
 clearAnonEvaluationAccess ()
 
 getFilteredFinishedIds ()
 
 getUserSpecificResults ()
 

Protected Attributes

EvaluationSessionRepo $eval_repo
 
int $requested_appr_id
 
InternalDomainService $domain_service
 
ilObjSurvey $survey
 
int $user_id
 
ILIAS Survey Access AccessManager $access
 
ILIAS Survey Mode FeatureConfig $feature_config
 
InternalRepoService $repo_service
 
string $requested_rater_id
 

Detailed Description

Evaluation manager.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 31 of file class.EvaluationManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Evaluation\EvaluationManager::__construct ( InternalDomainService  $domain_service,
InternalRepoService  $repo_service,
\ilObjSurvey  $survey,
int  $user_id,
int  $requested_appr_id,
string  $requested_rater_id 
)

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

References ILIAS\Survey\Evaluation\EvaluationManager\$domain_service, ILIAS\Survey\Evaluation\EvaluationManager\$repo_service, ILIAS\Survey\Evaluation\EvaluationManager\$requested_appr_id, ILIAS\Survey\Evaluation\EvaluationManager\$requested_rater_id, ILIAS\Survey\Evaluation\EvaluationManager\$survey, ILIAS\Survey\Evaluation\EvaluationManager\$user_id, ILIAS\Repository\access(), ilObjSurvey\getMode(), and ilObject\getRefId().

50  {
51  $this->domain_service = $domain_service;
52  $this->repo_service = $repo_service;
53  $this->access = $this->domain_service->access($survey->getRefId(), $user_id);
54  $this->feature_config = $this->domain_service->modeFeatureConfig($survey->getMode());
55  $this->survey = $survey;
56  $this->user_id = $user_id;
57  $this->requested_appr_id = $requested_appr_id;
58  $this->requested_rater_id = $requested_rater_id;
59  $this->eval_repo = $this->repo_service->evaluation();
60  }
+ Here is the call graph for this function:

Member Function Documentation

◆ clearAnonEvaluationAccess()

ILIAS\Survey\Evaluation\EvaluationManager::clearAnonEvaluationAccess ( )

Definition at line 204 of file class.EvaluationManager.php.

204  : void
205  {
206  $this->eval_repo->clearAnonEvaluationAccess();
207  }

◆ getAnonEvaluationAccess()

ILIAS\Survey\Evaluation\EvaluationManager::getAnonEvaluationAccess ( )

Definition at line 199 of file class.EvaluationManager.php.

199  : int
200  {
201  return $this->eval_repo->getAnonEvaluationAccess();
202  }

◆ getCurrentAppraisee()

ILIAS\Survey\Evaluation\EvaluationManager::getCurrentAppraisee ( )

1) We have a set of selectable appraisees.

  • If the requested appraisee is within this set, the requested apraisee will be returned.
  • If no appraisee is requested and the current user is part of the set, the current user will be returned.
  • Otherwise the first selectable appraisee will be returned. In all other cases 0 will be returned.

Definition at line 133 of file class.EvaluationManager.php.

References ILIAS\Survey\Evaluation\EvaluationManager\$requested_appr_id, ILIAS\Survey\Evaluation\EvaluationManager\$user_id, $valid, and ILIAS\Survey\Evaluation\EvaluationManager\getSelectableAppraisees().

Referenced by ILIAS\Survey\Evaluation\EvaluationManager\getFilteredFinishedIds(), and ILIAS\Survey\Evaluation\EvaluationManager\getSelectableRaters().

133  : int
134  {
135  $req_appr_id = $this->requested_appr_id;
136 
137  // if no user is requested, request current user
139  if ($req_appr_id === 0) {
140  $req_appr_id = $user_id;
141  }
142 
143 
144  // requested appraisee is valid -> return appraisee
145  $valid = $this->getSelectableAppraisees();
146  if (in_array($req_appr_id, $valid)) {
147  return $req_appr_id;
148  }
149 
150  // we have at least one selectable appraisee -> return appraisee
151  if (count($valid) > 0) {
152  return current($valid);
153  }
154 
155  return 0;
156  }
$valid
getSelectableAppraisees()
Get all participants the current user may see results from, including itself.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentRater()

ILIAS\Survey\Evaluation\EvaluationManager::getCurrentRater ( )

Definition at line 181 of file class.EvaluationManager.php.

References $i, ILIAS\Survey\Evaluation\EvaluationManager\$requested_rater_id, $valid, and ILIAS\Survey\Evaluation\EvaluationManager\getSelectableRaters().

181  : string
182  {
183  $req_rater_id = $this->requested_rater_id;
184 
185  $valid = array_map(static function ($i): int {
186  return (int) $i["user_id"];
187  }, $this->getSelectableRaters());
188  if (in_array($req_rater_id, $valid, true)) {
189  return $req_rater_id;
190  }
191  return "";
192  }
$valid
getSelectableRaters()
Only the individual feedback mode allows to select raters and only, if the user cannot select apprais...
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ getFilteredFinishedIds()

ILIAS\Survey\Evaluation\EvaluationManager::getFilteredFinishedIds ( )
Parameters
int$appr_id
Returns
array|null : null means, nothing is filtered (=all), [] means "no finish id"

Definition at line 213 of file class.EvaluationManager.php.

References ILIAS\Repository\access(), ILIAS\Survey\Evaluation\EvaluationManager\getCurrentAppraisee(), ilObjSurvey\MODE_IND_FEEDB, ilObjSurvey\MODE_SELF_EVAL, and ilObjSurvey\RESULTS_SELF_EVAL_ALL.

Referenced by ILIAS\Survey\Evaluation\EvaluationManager\getUserSpecificResults().

213  : ?array
214  {
215  $appr_id = $this->getCurrentAppraisee();
216  $finished_ids = null;
217 
218  $filter = false;
219  if ($appr_id > 0) {
220  $filter = true;
221  // see #36336
222  if ($this->survey->getMode() === \ilObjSurvey::MODE_SELF_EVAL &&
223  $this->survey->getSelfEvaluationResults() === \ilObjSurvey::RESULTS_SELF_EVAL_ALL) {
224  $filter = false;
225  }
226  // see #36336, #36378
227  if ($this->survey->getMode() !== \ilObjSurvey::MODE_IND_FEEDB &&
228  $this->access->canEditSettings()) {
229  $filter = false;
230  }
231  }
232 
233  if ($filter) {
234  $finished_ids = $this->survey->getFinishedIdsForAppraiseeId($appr_id);
235  if (!count($finished_ids)) {
236  $finished_ids = [];
237  }
238  }
239 
240  // @todo (from SM 2018)
241  // filter finished ids
242  /*
243  $finished_ids2 = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
244  'read_results',
245  'access_results',
246  $this->survey->getRefId(),
247  (array) $finished_ids
248  );*/
249 
250  return $finished_ids;
251  }
getCurrentAppraisee()
1) We have a set of selectable appraisees.
const RESULTS_SELF_EVAL_ALL
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableAppraisees()

ILIAS\Survey\Evaluation\EvaluationManager::getSelectableAppraisees ( )

Get all participants the current user may see results from, including itself.

Returns
int[]

Definition at line 97 of file class.EvaluationManager.php.

References ILIAS\Survey\Evaluation\EvaluationManager\$access, ILIAS\Survey\Evaluation\EvaluationManager\$feature_config, ILIAS\Survey\Evaluation\EvaluationManager\$survey, ILIAS\Survey\Evaluation\EvaluationManager\$user_id, ilObjUser\_lookupId(), ILIAS\Repository\int(), ILIAS\Survey\Evaluation\EvaluationManager\isMultiParticipantsView(), and ilObjSurvey\MODE_SELF_EVAL.

Referenced by ILIAS\Survey\Evaluation\EvaluationManager\getCurrentAppraisee().

97  : array
98  {
103 
104  $appraisee_ids = [];
105  if ($this->isMultiParticipantsView()) { // the user may see results of "others"
106  if ($feature_config->usesAppraisees()) {
107  foreach ($survey->getAppraiseesData() as $item) {
108  if (!$survey->get360Mode() || $item["closed"]) {
109  $appraisee_ids[] = (int) $item["user_id"];
110  }
111  }
112  } elseif ($survey->getMode() === \ilObjSurvey::MODE_SELF_EVAL) {
113  foreach ($survey->getSurveyParticipants() as $item) {
114  $appraisee_ids[] = (int) \ilObjUser::_lookupId($item['login']);
115  }
116  }
117  } elseif ($feature_config->usesAppraisees() ||
119  $appraisee_ids[] = $user_id;
120  }
121  return $appraisee_ids;
122  }
ILIAS Survey Access AccessManager $access
static _lookupId($a_user_str)
getSurveyParticipants(?array $finished_ids=null, bool $force_non_anonymous=false, bool $include_invites=false)
ILIAS Survey Mode FeatureConfig $feature_config
isMultiParticipantsView()
Can the current user switch between participants and see their results?
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableRaters()

ILIAS\Survey\Evaluation\EvaluationManager::getSelectableRaters ( )

Only the individual feedback mode allows to select raters and only, if the user cannot select appraisees on top level.

Definition at line 162 of file class.EvaluationManager.php.

References ILIAS\Survey\Evaluation\EvaluationManager\$survey, ILIAS\Survey\Evaluation\EvaluationManager\getCurrentAppraisee(), ILIAS\Survey\Evaluation\EvaluationManager\isMultiParticipantsView(), and ilObjSurvey\MODE_IND_FEEDB.

Referenced by ILIAS\Survey\Evaluation\EvaluationManager\getCurrentRater().

162  : array
163  {
164  $raters = [];
166 
167  $appr_id = $this->getCurrentAppraisee();
168 
170  && !$this->isMultiParticipantsView()) {
171  foreach ($survey->getRatersData($appr_id) as $rater) {
172  if ($rater["finished"]) {
173  $raters[] = $rater;
174  }
175  }
176  }
177 
178  return $raters;
179  }
getCurrentAppraisee()
1) We have a set of selectable appraisees.
isMultiParticipantsView()
Can the current user switch between participants and see their results?
getRatersData(int $a_appraisee_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserSpecificResults()

ILIAS\Survey\Evaluation\EvaluationManager::getUserSpecificResults ( )

Definition at line 253 of file class.EvaluationManager.php.

References $data, ILIAS\Survey\Evaluation\EvaluationManager\$user_id, SurveyQuestion\_instanciateQuestionEvaluation(), ILIAS\Repository\access(), ILIAS\Survey\Evaluation\EvaluationManager\getFilteredFinishedIds(), and ILIAS\Repository\int().

253  : array
254  {
255  $data = array();
256 
257  $finished_ids = $this->getFilteredFinishedIds();
258  $participants = $this->access->canReadResultOfParticipants($finished_ids);
259  foreach ($this->survey->getSurveyQuestions() as $qdata) {
260  $q_eval = \SurveyQuestion::_instanciateQuestionEvaluation((int) $qdata["question_id"], $finished_ids);
261  $q_res = $q_eval->getResults();
262 
263  // see #28507 (matrix question without a row)
264  if (is_array($q_res) && !is_object($q_res[0][1])) {
265  continue;
266  }
267 
268  $question = is_array($q_res)
269  ? $q_res[0][1]->getQuestion()
270  : $q_res->getQuestion();
271 
272  foreach ($participants as $user) {
273  $user_id = (int) $user["active_id"];
274 
275  $parsed_results = $q_eval->parseUserSpecificResults($q_res, $user_id);
276 
277  if (!array_key_exists($user_id, $data)) {
278  $wt = $this->survey->getWorkingtimeForParticipant($user_id);
279 
280  $finished = $user["finished"]
281  ? $user["finished_tstamp"]
282  : false;
283 
284  $data[$user_id] = array(
285  "username" => $user["sortname"],
286  "question" => $question->getTitle(),
287  "results" => $parsed_results,
288  "workingtime" => $wt,
289  "finished" => $finished,
290  "subitems" => array()
291  );
292  } else {
293  $data[$user_id]["subitems"][] = array(
294  "username" => " ",
295  "question" => $question->getTitle(),
296  "results" => $parsed_results,
297  "workingtime" => null,
298  "finished" => null
299  );
300  }
301  }
302  }
303 
304  return $data;
305  }
static _instanciateQuestionEvaluation(int $question_id, array $a_finished_ids=null)
+ Here is the call graph for this function:

◆ isMultiParticipantsView()

ILIAS\Survey\Evaluation\EvaluationManager::isMultiParticipantsView ( )

Can the current user switch between participants and see their results?

This is true for tutors (can edit settings) or normal users, if the mode supports to see the results of others.

Definition at line 68 of file class.EvaluationManager.php.

References ILIAS\Survey\Evaluation\EvaluationManager\$access, ILIAS\Survey\Evaluation\EvaluationManager\$survey, ilObjSurvey\RESULTS_360_ALL, and ilObjSurvey\RESULTS_SELF_EVAL_ALL.

Referenced by ILIAS\Survey\Evaluation\EvaluationManager\getSelectableAppraisees(), and ILIAS\Survey\Evaluation\EvaluationManager\getSelectableRaters().

68  : bool
69  {
72 
73  switch ($survey->getMode()) {
74  case \ilObjSurvey::MODE_360:
75  return ($access->canEditSettings() ||
77  // tutors can switch appraisees on detailed evaluation screen
78  case \ilObjSurvey::MODE_IND_FEEDB:
79  return ($access->canEditSettings());
80  case \ilObjSurvey::MODE_SELF_EVAL:
81  return ($access->canEditSettings() ||
83  }
84  return false;
85 
86  /*
87  return ($access->canEditSettings() ||
88  $survey->get360Results() === \ilObjSurvey::RESULTS_360_ALL ||
89  $survey->getSelfEvaluationResults() === \ilObjSurvey::RESULTS_SELF_EVAL_ALL);*/
90  }
ILIAS Survey Access AccessManager $access
const RESULTS_SELF_EVAL_ALL
+ Here is the caller graph for this function:

◆ setAnonEvaluationAccess()

ILIAS\Survey\Evaluation\EvaluationManager::setAnonEvaluationAccess ( int  $ref_id)

Definition at line 194 of file class.EvaluationManager.php.

194  : void
195  {
196  $this->eval_repo->setAnonEvaluationAccess($ref_id);
197  }
$ref_id
Definition: ltiauth.php:67

Field Documentation

◆ $access

ILIAS Survey Access AccessManager ILIAS\Survey\Evaluation\EvaluationManager::$access
protected

◆ $domain_service

InternalDomainService ILIAS\Survey\Evaluation\EvaluationManager::$domain_service
protected

◆ $eval_repo

EvaluationSessionRepo ILIAS\Survey\Evaluation\EvaluationManager::$eval_repo
protected

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

◆ $feature_config

ILIAS Survey Mode FeatureConfig ILIAS\Survey\Evaluation\EvaluationManager::$feature_config
protected

◆ $repo_service

InternalRepoService ILIAS\Survey\Evaluation\EvaluationManager::$repo_service
protected

◆ $requested_appr_id

int ILIAS\Survey\Evaluation\EvaluationManager::$requested_appr_id
protected

◆ $requested_rater_id

string ILIAS\Survey\Evaluation\EvaluationManager::$requested_rater_id
protected

◆ $survey

◆ $user_id


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