ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Survey\Survey360\Survey360Manager Class Reference
+ Collaboration diagram for ILIAS\Survey\Survey360\Survey360Manager:

Public Member Functions

 __construct (InternalRepoService $repo_service)
 
 getOpenSurveysForRater (int $rater_user_id)
 Get open surveys for rater. More...
 
 getOpenSurveysForAppraisee (int $appr_user_id)
 Get open surveys for rater. More...
 

Protected Attributes

RunDBRepository $run_repo
 
AppraiseeDBRepository $appr_repo
 
SettingsDBRepository $set_repo
 

Detailed Description

Todo:
this should be moved to a general appraisee/appraisal manager
Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file Survey360Manager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Survey360\Survey360Manager::__construct ( InternalRepoService  $repo_service)

Definition at line 35 of file Survey360Manager.php.

References ILIAS\Survey\InternalRepoService\execution(), and ILIAS\Survey\InternalRepoService\settings().

37  {
38  $this->run_repo = $repo_service->execution()->run();
39 
40  $this->appr_repo = new AppraiseeDBRepository();
41  $this->set_repo = $repo_service->settings();
42  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getOpenSurveysForAppraisee()

ILIAS\Survey\Survey360\Survey360Manager::getOpenSurveysForAppraisee ( int  $appr_user_id)

Get open surveys for rater.

Returns
int[]

Definition at line 90 of file Survey360Manager.php.

References $i.

92  : array {
93  // open surveys
94  $open_surveys = $this->appr_repo->getUnclosedSurveysForAppraisee($appr_user_id);
95 
96  // filter all surveys that have ended
97  $has_ended = $this->set_repo->hasEnded($open_surveys);
98  $open_surveys = array_filter($open_surveys, static function (int $i) use ($has_ended): bool {
99  return !($has_ended[$i] ?? false);
100  });
101 
102  return $open_surveys;
103  }
$i
Definition: metadata.php:41

◆ getOpenSurveysForRater()

ILIAS\Survey\Survey360\Survey360Manager::getOpenSurveysForRater ( int  $rater_user_id)

Get open surveys for rater.

Parameters
int$rater_user_id
Returns
int[]

Definition at line 49 of file Survey360Manager.php.

References $i.

51  : array {
52  // get all appraisees of the ratier
53  $appraisees = $this->appr_repo->getAppraiseesForRater($rater_user_id);
54 
55  // filter out finished appraisees
56  $finished_ids = array_map(static function (array $i): string {
57  return $i["survey_id"] . ":" . $i["appr_id"];
58  }, $this->run_repo->getFinishedAppraiseesForRater($rater_user_id));
59  $open_appraisees = array_filter($appraisees, static function (array $i) use ($finished_ids): bool {
60  return !in_array($i["survey_id"] . ":" . $i["appr_id"], $finished_ids, true);
61  });
62 
63  // filter out closed appraisees
64  $open_surveys = array_unique(array_column($open_appraisees, "survey_id"));
65 
66  // remove closed appraisees
67  $closed_appr = $this->appr_repo->getClosedAppraiseesForSurveys($open_surveys);
68  $closed_appr_ids = array_map(static function (array $i): string {
69  return $i["survey_id"] . ":" . $i["appr_id"];
70  }, $closed_appr);
71 
72  $open_appraisees = array_filter($open_appraisees, static function (array $i) use ($closed_appr_ids): bool {
73  return !in_array($i["survey_id"] . ":" . $i["appr_id"], $closed_appr_ids, true);
74  });
75  $open_surveys = array_unique(array_column($open_appraisees, "survey_id"));
76 
77  // filter all surveys that have ended
78  $has_ended = $this->set_repo->hasEnded($open_surveys);
79  $open_surveys = array_filter($open_surveys, static function (int $i) use ($has_ended): bool {
80  return !($has_ended[$i] ?? false);
81  });
82 
83  return $open_surveys;
84  }
$i
Definition: metadata.php:41

Field Documentation

◆ $appr_repo

AppraiseeDBRepository ILIAS\Survey\Survey360\Survey360Manager::$appr_repo
protected

Definition at line 32 of file Survey360Manager.php.

◆ $run_repo

RunDBRepository ILIAS\Survey\Survey360\Survey360Manager::$run_repo
protected

Definition at line 31 of file Survey360Manager.php.

◆ $set_repo

SettingsDBRepository ILIAS\Survey\Survey360\Survey360Manager::$set_repo
protected

Definition at line 33 of file Survey360Manager.php.


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