ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\Survey\Participants\InvitationsDBRepository Class Reference

Survey invitations repository. More...

+ Collaboration diagram for ILIAS\Survey\Participants\InvitationsDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db=null)
 Constructor. More...
 
 remove (int $survey_id, int $user_id)
 Remove invitation. More...
 
 add (int $survey_id, int $user_id)
 Add invitation. More...
 
 getAllForSurvey (int $survey_id)
 Get invitations for survey. More...
 
 getAllForUser (int $user_id)
 Get surveys where user is invited. More...
 

Protected Attributes

 $db
 

Detailed Description

Survey invitations repository.

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

Definition at line 12 of file class.InvitationsDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Participants\InvitationsDBRepository::__construct ( \ilDBInterface  $db = null)

Constructor.

Definition at line 22 of file class.InvitationsDBRepository.php.

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

References ILIAS\Survey\Participants\InvitationsDBRepository\$db, and $DIC.

Member Function Documentation

◆ add()

ILIAS\Survey\Participants\InvitationsDBRepository::add ( int  $survey_id,
int  $user_id 
)

Add invitation.

Parameters
int$survey_idSurvey ID not object ID!
int$user_id

Definition at line 57 of file class.InvitationsDBRepository.php.

58 {
59 $db = $this->db;
60
61 $db->replace(
62 "svy_invitation",
63 [ // pk
64 "survey_id" => ["integer", $survey_id],
65 "user_id" => ["integer", $user_id]
66 ],
67 []
68 );
69 }

References ILIAS\Survey\Participants\InvitationsDBRepository\$db.

◆ getAllForSurvey()

ILIAS\Survey\Participants\InvitationsDBRepository::getAllForSurvey ( int  $survey_id)

Get invitations for survey.

Parameters
int$survey_idSurvey ID not object ID!
Returns
int[]

Definition at line 77 of file class.InvitationsDBRepository.php.

77 : array
78 {
79 $db = $this->db;
80
81 $items = [];
82 $set = $db->queryF(
83 "SELECT user_id FROM svy_invitation " .
84 " WHERE survey_id = %s ",
85 ["integer"],
86 [$survey_id]
87 );
88
89 while ($rec = $db->fetchAssoc($set)) {
90 $items[] = $rec["user_id"];
91 }
92 return $items;
93 }

References ILIAS\Survey\Participants\InvitationsDBRepository\$db.

◆ getAllForUser()

ILIAS\Survey\Participants\InvitationsDBRepository::getAllForUser ( int  $user_id)

Get surveys where user is invited.

Parameters
int$user_iduser id
Returns
int[] survey IDs

Definition at line 101 of file class.InvitationsDBRepository.php.

101 : array
102 {
103 $db = $this->db;
104
105 $items = [];
106 $set = $db->queryF(
107 "SELECT survey_id FROM svy_invitation " .
108 " WHERE user_id = %s ",
109 ["integer"],
110 [$user_id]
111 );
112
113 while ($rec = $db->fetchAssoc($set)) {
114 $items[] = (int) $rec["survey_id"];
115 }
116 return $items;
117 }

References ILIAS\Survey\Participants\InvitationsDBRepository\$db.

◆ remove()

ILIAS\Survey\Participants\InvitationsDBRepository::remove ( int  $survey_id,
int  $user_id 
)

Remove invitation.

Parameters
int$survey_idSurvey ID not object ID!
int$user_id

Definition at line 38 of file class.InvitationsDBRepository.php.

39 {
40 $db = $this->db;
41
42 $db->manipulateF(
43 "DELETE FROM svy_invitation WHERE " .
44 " survey_id = %s AND user_id = %s",
45 ["integer", "integer"],
46 [$survey_id, $user_id]
47 );
48 }

References ILIAS\Survey\Participants\InvitationsDBRepository\$db.

Field Documentation

◆ $db


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