ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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)
 Constructor. More...
 
 getAppraiseesForRater (int $rater_id)
 Get surveys for Rater. More...
 
 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

 $db
 

Detailed Description

Apraisee / Rater DB repository Tables: svy_360_rater, svy_360_appr.

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

Definition at line 13 of file AppraiseeDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Definition at line 23 of file AppraiseeDBRepository.php.

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

24  {
25  global $DIC;
26 
27  $this->db = (is_null($db))
28  ? $DIC->database()
29  : $db;
30  }
$DIC
Definition: xapitoken.php:46

Member Function Documentation

◆ getAppraiseesForRater()

ILIAS\Survey\Survey360\AppraiseeDBRepository::getAppraiseesForRater ( int  $rater_id)

Get surveys for Rater.

Parameters
int$rater_id
Returns
array

Definition at line 38 of file AppraiseeDBRepository.php.

References ILIAS\Survey\Survey360\AppraiseeDBRepository\$db.

38  : array
39  {
40  $db = $this->db;
41 
42  $set = $db->queryF(
43  "SELECT obj_id, appr_id FROM svy_360_rater " .
44  " WHERE user_id = %s ",
45  ["integer"],
46  [$rater_id]
47  );
48  $appraisee = [];
49  while ($rec = $db->fetchAssoc($set)) {
50  $appraisee[] = [
51  "survey_id" => $rec["obj_id"],
52  "appr_id" => $rec["appr_id"]
53  ];
54  }
55  return $appraisee;
56  }

◆ getClosedAppraiseesForSurveys()

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

Get closed appraisees for a number of surveys.

Parameters
int[]$survey_ids
Returns
array

Definition at line 65 of file AppraiseeDBRepository.php.

References ILIAS\Survey\Survey360\AppraiseeDBRepository\$db.

66  {
67  $db = $this->db;
68 
69  $set = $db->queryF(
70  "SELECT obj_id, user_id FROM svy_360_appr " .
71  " WHERE " . $db->in("obj_id", $survey_ids, false, "integer") .
72  "AND has_closed = %s",
73  ["integer"],
74  [1]
75  );
76  $closed_appraisees = [];
77  while ($rec = $db->fetchAssoc($set)) {
78  $closed_appraisees[] = [
79  "survey_id" => $rec["obj_id"],
80  "appr_id" => $rec["user_id"]
81  ];
82  }
83  return $closed_appraisees;
84  }

◆ getUnclosedSurveysForAppraisee()

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

Get all unclosed surveys of an appraisee.

Parameters
int$appr_user_id
Returns
int[]

Definition at line 92 of file AppraiseeDBRepository.php.

References ILIAS\Survey\Survey360\AppraiseeDBRepository\$db.

92  : array
93  {
94  $db = $this->db;
95 
96  $set = $db->queryF(
97  "SELECT DISTINCT obj_id FROM svy_360_appr " .
98  "WHERE user_id = %s " .
99  "AND has_closed = %s",
100  ["integer", "integer"],
101  [$appr_user_id, 0]
102  );
103  $unclosed_surveys = [];
104  while ($rec = $db->fetchAssoc($set)) {
105  $unclosed_surveys[] = $rec["obj_id"];
106  }
107  return $unclosed_surveys;
108  }

Field Documentation

◆ $db


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