ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\Survey\Execution\RunDBRepository Class Reference

DB repo for survey run. More...

+ Collaboration diagram for ILIAS\Survey\Execution\RunDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db=null)
 Constructor. More...
 
 getFinishedSurveysOfUser (int $user_id)
 Get all finished surveys of a user. More...
 
 getUnfinishedSurveysOfUser (int $user_id)
 Get all unfinished surveys of a user. More...
 
 getFinishedAppraiseesForRater (int $rater_id)
 Get finished appraisees for a rater. More...
 

Protected Attributes

 $db
 

Detailed Description

DB repo for survey run.

Table svy_finished.

Please note that there are lots of accesses to svy_finished in other classes.

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

Definition at line 15 of file class.RunDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Execution\RunDBRepository::__construct ( \ilDBInterface  $db = null)

Constructor.

Definition at line 25 of file class.RunDBRepository.php.

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

References ILIAS\Survey\Execution\RunDBRepository\$db, and $DIC.

Member Function Documentation

◆ getFinishedAppraiseesForRater()

ILIAS\Survey\Execution\RunDBRepository::getFinishedAppraiseesForRater ( int  $rater_id)

Get finished appraisees for a rater.

Parameters
int$rater_id
Returns
array

Definition at line 87 of file class.RunDBRepository.php.

87 : array
88 {
89 $db = $this->db;
90
91 $set = $db->queryF(
92 "SELECT survey_fi, appr_id FROM svy_finished " .
93 " WHERE user_fi = %s AND state = %s",
94 ["integer", "integer"],
95 [$rater_id, 1]
96 );
97 $appraisee = [];
98 while ($rec = $db->fetchAssoc($set)) {
99 $appraisee[] = [
100 "survey_id" => $rec["survey_fi"],
101 "appr_id" => $rec["appr_id"]
102 ];
103 }
104 return $appraisee;
105 }

References ILIAS\Survey\Execution\RunDBRepository\$db.

◆ getFinishedSurveysOfUser()

ILIAS\Survey\Execution\RunDBRepository::getFinishedSurveysOfUser ( int  $user_id)

Get all finished surveys of a user.

Parameters
int$user_iduser id
Returns
int[] survey ids

Definition at line 41 of file class.RunDBRepository.php.

41 : array
42 {
43 $db = $this->db;
44
45 $set = $db->queryF(
46 "SELECT survey_fi FROM svy_finished " .
47 " WHERE user_fi = %s AND state = %s",
48 ["integer", "integer"],
49 [$user_id, 1]
50 );
51 $items = [];
52 while ($rec = $db->fetchAssoc($set)) {
53 $items[] = (int) $rec["survey_fi"];
54 }
55 return $items;
56 }

References ILIAS\Survey\Execution\RunDBRepository\$db.

◆ getUnfinishedSurveysOfUser()

ILIAS\Survey\Execution\RunDBRepository::getUnfinishedSurveysOfUser ( int  $user_id)

Get all unfinished surveys of a user.

Parameters
int$user_iduser id
Returns
int[] survey ids

Definition at line 64 of file class.RunDBRepository.php.

64 : array
65 {
66 $db = $this->db;
67
68 $set = $db->queryF(
69 "SELECT survey_fi FROM svy_finished " .
70 " WHERE user_fi = %s AND state = %s",
71 ["integer", "integer"],
72 [$user_id, 0]
73 );
74 $items = [];
75 while ($rec = $db->fetchAssoc($set)) {
76 $items[] = $rec["survey_fi"];
77 }
78 return $items;
79 }

References ILIAS\Survey\Execution\RunDBRepository\$db.

Field Documentation

◆ $db


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