ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
AppraiseeDBRepository.php
Go to the documentation of this file.
1<?php
2
20
27{
28 protected \ilDBInterface $db;
29
30 public function __construct(
31 ?\ilDBInterface $db = null
32 ) {
33 global $DIC;
34
35 $this->db = (is_null($db))
36 ? $DIC->database()
37 : $db;
38 }
39
44 public function getAppraiseesForRater(
45 int $rater_id
46 ): array {
47 $db = $this->db;
48
49 $set = $db->queryF(
50 "SELECT obj_id, appr_id FROM svy_360_rater " .
51 " WHERE user_id = %s ",
52 ["integer"],
53 [$rater_id]
54 );
55 $appraisee = [];
56 while ($rec = $db->fetchAssoc($set)) {
57 $appraisee[] = [
58 "survey_id" => (int) $rec["obj_id"],
59 "appr_id" => (int) $rec["appr_id"]
60 ];
61 }
62 return $appraisee;
63 }
64
65
72 array $survey_ids
73 ): array {
74 $db = $this->db;
75
76 $set = $db->queryF(
77 "SELECT obj_id, user_id FROM svy_360_appr " .
78 " WHERE " . $db->in("obj_id", $survey_ids, false, "integer") .
79 "AND has_closed = %s",
80 ["integer"],
81 [1]
82 );
83 $closed_appraisees = [];
84 while ($rec = $db->fetchAssoc($set)) {
85 $closed_appraisees[] = [
86 "survey_id" => (int) $rec["obj_id"],
87 "appr_id" => (int) $rec["user_id"]
88 ];
89 }
90 return $closed_appraisees;
91 }
92
98 int $appr_user_id
99 ): array {
100 $db = $this->db;
101
102 $set = $db->queryF(
103 "SELECT DISTINCT obj_id FROM svy_360_appr " .
104 "WHERE user_id = %s " .
105 "AND has_closed = %s",
106 ["integer", "integer"],
107 [$appr_user_id, 0]
108 );
109 $unclosed_surveys = [];
110 while ($rec = $db->fetchAssoc($set)) {
111 $unclosed_surveys[] = (int) $rec["obj_id"];
112 }
113 return $unclosed_surveys;
114 }
115}
Apraisee / Rater DB repository Tables: svy_360_rater, svy_360_appr.
getUnclosedSurveysForAppraisee(int $appr_user_id)
Get all unclosed surveys of an appraisee.
getClosedAppraiseesForSurveys(array $survey_ids)
Get closed appraisees for a number of surveys.
Interface ilDBInterface.
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26