ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\Survey\Participants\InvitationsDBRepository Class Reference

Survey invitations repository. More...

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

Public Member Functions

 __construct (InternalDataService $data, \ilDBInterface $db)
 
 remove (int $survey_id, int $user_id)
 Remove invitation. More...
 
 removeAll (int $survey_id)
 
 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

ilDBInterface $db
 
InternalDataService $data
 

Detailed Description

Survey invitations repository.

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Participants\InvitationsDBRepository::__construct ( InternalDataService  $data,
\ilDBInterface  $db 
)

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 81 of file class.InvitationsDBRepository.php.

References ILIAS\Survey\Participants\InvitationsDBRepository\$db, and ilDBInterface\replace().

81  : void
82  {
83  $db = $this->db;
84 
85  $db->replace(
86  "svy_invitation",
87  [ // pk
88  "survey_id" => ["integer", $survey_id],
89  "user_id" => ["integer", $user_id]
90  ],
91  []
92  );
93  }
replace(string $table, array $primary_keys, array $other_columns)
Replace into method.
+ Here is the call graph for this function:

◆ 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 101 of file class.InvitationsDBRepository.php.

References ILIAS\Survey\Participants\InvitationsDBRepository\$db, ILIAS\Repository\int(), and ilDBInterface\queryF().

101  : array
102  {
103  $db = $this->db;
104 
105  $items = [];
106  $set = $db->queryF(
107  "SELECT user_id FROM svy_invitation " .
108  " WHERE survey_id = %s ",
109  ["integer"],
110  [$survey_id]
111  );
112 
113  while ($rec = $db->fetchAssoc($set)) {
114  $items[] = (int) $rec["user_id"];
115  }
116  return $items;
117  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:

◆ 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 124 of file class.InvitationsDBRepository.php.

References ILIAS\Survey\Participants\InvitationsDBRepository\$db, ILIAS\Repository\int(), and ilDBInterface\queryF().

124  : array
125  {
126  $db = $this->db;
127 
128  $items = [];
129  $set = $db->queryF(
130  "SELECT survey_id FROM svy_invitation " .
131  " WHERE user_id = %s ",
132  ["integer"],
133  [$user_id]
134  );
135 
136  while ($rec = $db->fetchAssoc($set)) {
137  $items[] = (int) $rec["survey_id"];
138  }
139  return $items;
140  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:

◆ 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 50 of file class.InvitationsDBRepository.php.

References ILIAS\Survey\Participants\InvitationsDBRepository\$db, $user_id, and ilDBInterface\manipulateF().

50  : void
51  {
52  $db = $this->db;
53 
55  "DELETE FROM svy_invitation WHERE " .
56  " survey_id = %s AND user_id = %s",
57  ["integer", "integer"],
58  [$survey_id, $user_id]
59  );
60  }
manipulateF(string $query, array $types, array $values)
+ Here is the call graph for this function:

◆ removeAll()

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

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

References ILIAS\Survey\Participants\InvitationsDBRepository\$db, and ilDBInterface\manipulateF().

62  : void
63  {
64  $db = $this->db;
65 
67  "DELETE FROM svy_invitation WHERE " .
68  " survey_id = %s",
69  ["integer"],
70  [$survey_id]
71  );
72  }
manipulateF(string $query, array $types, array $values)
+ Here is the call graph for this function:

Field Documentation

◆ $data

InternalDataService ILIAS\Survey\Participants\InvitationsDBRepository::$data
protected

◆ $db


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