ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Survey\Survey360\AppraiseeDBRepository Class Reference

Apraisee / Rater DB repository Tables: svy_360_rater, svy_360_appr. More...

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

Public Member Functions

 __construct (\ilDBInterface $db=null)
 
 getAppraiseesForRater (int $rater_id)
 
 getClosedAppraiseesForSurveys (array $survey_ids)
 Get closed appraisees for a number of surveys. More...
 
 getUnclosedSurveysForAppraisee (int $appr_user_id)
 Get all unclosed surveys of an appraisee. More...
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Apraisee / Rater DB repository Tables: svy_360_rater, svy_360_appr.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file AppraiseeDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Survey360\AppraiseeDBRepository::__construct ( \ilDBInterface  $db = null)

Definition at line 30 of file AppraiseeDBRepository.php.

References ILIAS\Survey\Survey360\AppraiseeDBRepository\$db, and $DIC.

32  {
33  global $DIC;
34 
35  $this->db = (is_null($db))
36  ? $DIC->database()
37  : $db;
38  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ getAppraiseesForRater()

ILIAS\Survey\Survey360\AppraiseeDBRepository::getAppraiseesForRater ( int  $rater_id)
Parameters
int$rater_id
Returns
array{survey_id: int, appr_id: int}[]

Definition at line 44 of file AppraiseeDBRepository.php.

References ILIAS\Survey\Survey360\AppraiseeDBRepository\$db, ILIAS\Repository\int(), and ilDBInterface\queryF().

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  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:

◆ getClosedAppraiseesForSurveys()

ILIAS\Survey\Survey360\AppraiseeDBRepository::getClosedAppraiseesForSurveys ( array  $survey_ids)

Get closed appraisees for a number of surveys.

Parameters
int[]$survey_ids
Returns
array{survey_id: int, appr_id: int}[]

Definition at line 71 of file AppraiseeDBRepository.php.

References ILIAS\Survey\Survey360\AppraiseeDBRepository\$db, ILIAS\Repository\int(), and ilDBInterface\queryF().

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  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
in(string $field, array $values, bool $negate=false, string $type="")
+ Here is the call graph for this function:

◆ getUnclosedSurveysForAppraisee()

ILIAS\Survey\Survey360\AppraiseeDBRepository::getUnclosedSurveysForAppraisee ( int  $appr_user_id)

Get all unclosed surveys of an appraisee.

Returns
int[]

Definition at line 97 of file AppraiseeDBRepository.php.

References ILIAS\Survey\Survey360\AppraiseeDBRepository\$db, ILIAS\Repository\int(), and ilDBInterface\queryF().

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  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:

Field Documentation

◆ $db


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