ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Survey360Manager.php
Go to the documentation of this file.
1<?php
2
20
24
30{
34
35 public function __construct(
36 InternalRepoService $repo_service
37 ) {
38 $this->run_repo = $repo_service->execution()->run();
39
40 $this->appr_repo = new AppraiseeDBRepository();
41 $this->set_repo = $repo_service->settings();
42 }
43
49 public function getOpenSurveysForRater(
50 int $rater_user_id
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 }
85
91 int $appr_user_id
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 }
104}
Apraisee / Rater DB repository Tables: svy_360_rater, svy_360_appr.
getOpenSurveysForAppraisee(int $appr_user_id)
Get open surveys for rater.
__construct(InternalRepoService $repo_service)
getOpenSurveysForRater(int $rater_user_id)
Get open surveys for rater.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...