ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\Survey\Survey360\Survey360Manager Class Reference

Survey 360. More...

+ Collaboration diagram for ILIAS\Survey\Survey360\Survey360Manager:

Public Member Functions

 __construct (AppraiseeDBRepository $appr_repo=null, RunDBRepository $run_rep=null, SettingsDBRepository $set_repo=null)
 Constructor. More...
 
 getOpenSurveysForRater (int $rater_user_id)
 Get open surveys for rater. More...
 
 getOpenSurveysForAppraisee (int $appr_user_id)
 Get open surveys for rater. More...
 

Protected Attributes

 $run_repo
 
 $appr_repo
 
 $set_repo
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Survey360\Survey360Manager::__construct ( AppraiseeDBRepository  $appr_repo = null,
RunDBRepository  $run_rep = null,
SettingsDBRepository  $set_repo = null 
)

Constructor.

Definition at line 35 of file Survey360Manager.php.

References ILIAS\Survey\Survey360\Survey360Manager\$appr_repo, and ILIAS\Survey\Survey360\Survey360Manager\$set_repo.

39  {
40  $this->run_repo = (is_null($run_rep))
41  ? new RunDBRepository()
42  : $run_rep;
43 
44  $this->appr_repo = (is_null($appr_repo))
45  ? new AppraiseeDBRepository()
46  : $appr_repo;
47 
48  $this->set_repo = (is_null($set_repo))
49  ? new SettingsDBRepository()
50  : $set_repo;
51  }

Member Function Documentation

◆ getOpenSurveysForAppraisee()

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

Get open surveys for rater.

Parameters
int$rater_user_id
Returns
int[]

Definition at line 101 of file Survey360Manager.php.

References $i.

102  {
103  // open surveys
104  $open_surveys = $this->appr_repo->getUnclosedSurveysForAppraisee($appr_user_id);
105 
106  // filter all surveys that have ended
107  $has_ended = $this->set_repo->hasEnded($open_surveys);
108  $open_surveys = array_filter($open_surveys, function ($i) use ($has_ended) {
109  return !$has_ended[$i];
110  });
111 
112  return $open_surveys;
113  }
$i
Definition: metadata.php:24

◆ 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 59 of file Survey360Manager.php.

References $i.

60  {
61  // get all appraisees of the ratier
62  $appraisees = $this->appr_repo->getAppraiseesForRater($rater_user_id);
63 
64  // filter out finished appraisees
65  $finished_ids = array_map(function ($i) {
66  return $i["survey_id"] . ":" . $i["appr_id"];
67  }, $this->run_repo->getFinishedAppraiseesForRater($rater_user_id));
68  $open_appraisees = array_filter($appraisees, function ($i) use ($finished_ids) {
69  return !in_array($i["survey_id"] . ":" . $i["appr_id"], $finished_ids);
70  });
71 
72  // filter out closed appraisees
73  $open_surveys = array_unique(array_column($open_appraisees, "survey_id"));
74 
75  // remove closed appraisees
76  $closed_appr = $this->appr_repo->getClosedAppraiseesForSurveys($open_surveys);
77  $closed_appr_ids = array_map(function ($i) {
78  return $i["survey_id"] . ":" . $i["appr_id"];
79  }, $closed_appr);
80 
81  $open_appraisees = array_filter($open_appraisees, function ($i) use ($closed_appr_ids) {
82  return !in_array($i["survey_id"] . ":" . $i["appr_id"], $closed_appr_ids);
83  });
84  $open_surveys = array_unique(array_column($open_appraisees, "survey_id"));
85 
86  // filter all surveys that have ended
87  $has_ended = $this->set_repo->hasEnded($open_surveys);
88  $open_surveys = array_filter($open_surveys, function ($i) use ($has_ended) {
89  return !$has_ended[$i];
90  });
91 
92  return $open_surveys;
93  }
$i
Definition: metadata.php:24

Field Documentation

◆ $appr_repo

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

◆ $run_repo

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

Definition at line 20 of file Survey360Manager.php.

◆ $set_repo

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

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