ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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 (bool $fallback_to_first=false)
 
 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 207 of file class.EvaluationManager.php.

207  : void
208  {
209  $this->eval_repo->clearAnonEvaluationAccess();
210  }

◆ getAnonEvaluationAccess()

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

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

202  : int
203  {
204  return $this->eval_repo->getAnonEvaluationAccess();
205  }

◆ 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 ( bool  $fallback_to_first = false)

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

References 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): string {
186  return (string) $i["user_id"];
187  }, $this->getSelectableRaters());
188  if (in_array($req_rater_id, $valid, true)) {
189  return $req_rater_id;
190  }
191  if ($fallback_to_first && count($this->getSelectableRaters()) > 0) {
192  return $this->getSelectableRaters()[0]["user_id"];
193  }
194  return "";
195  }
$valid
getSelectableRaters()
Only the individual feedback mode allows to select raters and only, if the user cannot select apprais...
+ 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 216 of file class.EvaluationManager.php.

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

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

216  : ?array
217  {
218  $appr_id = $this->getCurrentAppraisee();
219  $finished_ids = null;
220 
221  $filter = false;
222  if ($appr_id > 0) {
223  $filter = true;
224  // see #36336
225  if ($this->survey->getMode() === \ilObjSurvey::MODE_SELF_EVAL &&
226  $this->survey->getSelfEvaluationResults() === \ilObjSurvey::RESULTS_SELF_EVAL_ALL) {
227  $filter = false;
228  }
229  // see #36336, #36378
230  if ($this->survey->getMode() !== \ilObjSurvey::MODE_IND_FEEDB &&
231  $this->access->canEditSettings()) {
232  $filter = false;
233  }
234  }
235 
236  if ($filter) {
237  $finished_ids = $this->survey->getFinishedIdsForAppraiseeId($appr_id);
238  if (!count($finished_ids)) {
239  $finished_ids = [];
240  }
241  }
242 
243  // @todo (from SM 2018)
244  // filter finished ids
245  /*
246  $finished_ids2 = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
247  'read_results',
248  'access_results',
249  $this->survey->getRefId(),
250  (array) $finished_ids
251  );*/
252 
253  return $finished_ids;
254  }
getCurrentAppraisee()
1) We have a set of selectable appraisees.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 256 of file class.EvaluationManager.php.

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

256  : array
257  {
258  $data = array();
259 
260  $finished_ids = $this->getFilteredFinishedIds();
261  $participants = $this->access->canReadResultOfParticipants($finished_ids);
262  foreach ($this->survey->getSurveyQuestions() as $qdata) {
263  $q_eval = \SurveyQuestion::_instanciateQuestionEvaluation((int) $qdata["question_id"], $finished_ids);
264  $q_res = $q_eval->getResults();
265 
266  // see #28507 (matrix question without a row)
267  if (is_array($q_res) && !is_object($q_res[0][1])) {
268  continue;
269  }
270 
271  $question = is_array($q_res)
272  ? $q_res[0][1]->getQuestion()
273  : $q_res->getQuestion();
274 
275  foreach ($participants as $user) {
276  $user_id = (int) $user["active_id"];
277 
278  $parsed_results = $q_eval->parseUserSpecificResults($q_res, $user_id);
279 
280  if (!array_key_exists($user_id, $data)) {
281  $wt = $this->survey->getWorkingtimeForParticipant($user_id);
282 
283  $finished = $user["finished"]
284  ? $user["finished_tstamp"]
285  : false;
286 
287  $data[$user_id] = array(
288  "username" => $user["sortname"],
289  "question" => $question->getTitle(),
290  "results" => $parsed_results,
291  "workingtime" => $wt,
292  "finished" => $finished,
293  "subitems" => array()
294  );
295  } else {
296  $data[$user_id]["subitems"][] = array(
297  "username" => " ",
298  "question" => $question->getTitle(),
299  "results" => $parsed_results,
300  "workingtime" => null,
301  "finished" => null
302  );
303  }
304  }
305  }
306 
307  return $data;
308  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 197 of file class.EvaluationManager.php.

197  : void
198  {
199  $this->eval_repo->setAnonEvaluationAccess($ref_id);
200  }
$ref_id
Definition: ltiauth.php:65

Field Documentation

◆ $access

◆ $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: