This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning
- Author
- Jesús López lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Definition at line 22 of file class.ilBookingParticipant.php.
◆ __construct()
| ilBookingParticipant::__construct |
( |
int |
$a_user_id, |
|
|
int |
$a_booking_pool_id |
|
) |
| |
Definition at line 31 of file class.ilBookingParticipant.php.
34 {
36
38 throw new ilException(
"User $a_user_id does not exist.");
39 }
41 throw new ilException(
"Booking Pool $a_booking_pool_id does not exist.");
42 }
43
44 $this->
lng = $DIC->language();
45 $this->db =
$DIC->database();
46 $this->
user = $DIC->user();
47
48 $this->participant_id = $a_user_id;
49 $this->booking_pool_id = $a_booking_pool_id;
50
51
54 $this->is_new = true;
55 } else {
56 $this->is_new = false;
57 }
58 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
References $DIC, ilObject\_exists(), ILIAS\Repository\lng(), read(), save(), and ILIAS\Repository\user().
◆ getAssignableParticipants()
| static ilBookingParticipant::getAssignableParticipants |
( |
int |
$a_bp_object_id | ) |
|
|
static |
Get participants who can not have a reservation for this booking pool object id.
- Parameters
-
| int | $a_bp_object_id | booking pool object |
- Returns
- array formatted data to display in gui table.
Definition at line 99 of file class.ilBookingParticipant.php.
101 : array {
103 $pool_id = $booking_object->getPoolId();
105 $overall_limit = (
int) $pool->getOverallLimit();
106
108
110
111 foreach ($members as $member_id) {
112
114
115 if ($overall_limit === 0 || ($overall_limit > 0 && $total_reservations < $overall_limit)) {
117 $name = $user_name[
'lastname'] .
", " . $user_name[
'firstname'];
118 $index = $a_bp_object_id .
"_" . $member_id;
119
122 "user_id" => $member_id,
123 "object_title" => array($booking_object->getTitle()),
125 );
126 } elseif (!in_array($booking_object->getTitle(),
$res[
$index][
'object_title'],
true)) {
127 $res[
$index][
'object_title'][] = $booking_object->getTitle();
128 }
129 }
130 }
131
133 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isBookingPoolLimitReachedByUser(int $a_user_id, int $a_pool_id)
static getMembersWithoutReservation(int $a_object_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupName(int $a_user_id)
lookup user name
Referenced by ilBookingAssignParticipantsTableGUI\getItems().
◆ getBookingPoolParticipants()
| static ilBookingParticipant::getBookingPoolParticipants |
( |
int |
$a_booking_pool_id | ) |
|
|
static |
Get all participants for a booking pool.
- Returns
- int[]
Definition at line 213 of file class.ilBookingParticipant.php.
215 : array {
218 $sql =
'SELECT * FROM booking_member WHERE booking_pool_id = ' .
$ilDB->quote($a_booking_pool_id,
'integer');
219
220 $set =
$ilDB->query($sql);
221
223 while ($row =
$ilDB->fetchAssoc($set)) {
224 $res[] = $row[
'user_id'];
225 }
226
228 }
◆ getIsNew()
| ilBookingParticipant::getIsNew |
( |
| ) |
|
◆ getList()
| static ilBookingParticipant::getList |
( |
int |
$a_booking_pool, |
|
|
array |
$a_filter = null, |
|
|
int |
$a_object_id = null |
|
) |
| |
|
static |
Definition at line 135 of file class.ilBookingParticipant.php.
139 : array {
141
143
145
146 $query =
'SELECT bm.user_id, bm.booking_pool_id, br.object_id, bo.title, br.status' .
147 ' FROM booking_member bm' .
148 ' LEFT JOIN booking_reservation br ON (bm.user_id = br.user_id)' .
149 ' LEFT JOIN booking_object bo ON (br.object_id = bo.booking_object_id AND bo.pool_id = ' .
$ilDB->quote($a_booking_pool,
'integer') .
')';
150
151 $where = array(
'bm.booking_pool_id =' .
$ilDB->quote($a_booking_pool,
'integer'));
152 if ($a_object_id) {
153 $where[] =
'br.object_id = ' .
$ilDB->quote($a_object_id,
'integer');
154 }
155 if ($a_filter['title'] ?? false) {
156 $where[] =
'(' .
$ilDB->like(
'title',
'text',
'%' . $a_filter[
'title'] .
'%') .
157 ' OR ' .
$ilDB->like(
'description',
'text',
'%' . $a_filter[
'title'] .
'%') .
')';
158 }
159 if ($a_filter['user_id'] ?? false) {
160 $where[] =
'bm.user_id = ' .
$ilDB->quote($a_filter[
'user_id'],
'integer');
161 }
162
163 $query .=
' WHERE ' . implode(
' AND ', $where);
164
166
167 while ($row =
$ilDB->fetchAssoc($set)) {
168 $status = $row['status'];
169
171 continue;
172 }
173
175 $name = $user_name[
'lastname'] .
", " . $user_name[
'firstname'];
176 $index = $a_booking_pool .
"_" . $row[
'user_id'];
177 $actions = array();
178
181 "object_title" => array(),
183 );
184
186 $res[
$index][
'object_title'] = array($row[
'title']);
188 $res[
$index][
'object_ids'][] = $row[
'object_id'];
189 }
191 $res[
$index][
'object_title'][] = $row[
'title'];
194 }
196 $res[
$index][
'object_ids'][] = $row[
'object_id'];
197 }
199 }
200
202 if (isset($row['object_id'])) {
203 $res[
$index][
'object_ids'][] = $row[
'object_id'];
204 }
205 }
207 }
Referenced by ilBookingAssignParticipantsTableGUI\getItems(), and ilBookingParticipantsTableGUI\getItems().
◆ getUserFilter()
| static ilBookingParticipant::getUserFilter |
( |
int |
$a_pool_id | ) |
|
|
static |
Get user data from db for an specific pool id.
- Returns
- string[]
Definition at line 234 of file class.ilBookingParticipant.php.
236 : array {
238
240
242
243 $sql = "SELECT ud.usr_id,ud.lastname,ud.firstname,ud.login" .
244 " FROM usr_data ud " .
245 " RIGHT JOIN booking_member m ON (ud.usr_id = m.user_id)" .
247 " AND m.booking_pool_id = " .
$ilDB->quote($a_pool_id,
"integer") .
248 " ORDER BY ud.lastname,ud.firstname";
249
250 $set =
$ilDB->query($sql);
251 while ($row =
$ilDB->fetchAssoc($set)) {
252 $res[$row[
"usr_id"]] = $row[
"lastname"] .
", " . $row[
"firstname"] .
253 " (" . $row["login"] . ")";
254 }
255
257 }
References $res.
Referenced by ilBookingParticipantsTableGUI\initFilter().
◆ isParticipantAssigned()
| ilBookingParticipant::isParticipantAssigned |
( |
int |
$a_booking_object_id, |
|
|
int |
$a_participant_id |
|
) |
| |
|
protected |
Returns true if the participant has a reservation for this object.
Definition at line 262 of file class.ilBookingParticipant.php.
265 : bool {
267 }
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
◆ read()
| ilBookingParticipant::read |
( |
| ) |
|
|
protected |
Definition at line 60 of file class.ilBookingParticipant.php.
60 : ?int
61 {
62 $query =
'SELECT participant_id FROM booking_member' .
63 ' WHERE user_id = ' . $this->db->quote($this->participant_id, 'integer') .
64 ' AND booking_pool_id = ' . $this->db->quote($this->booking_pool_id, 'integer');
65
66 $set = $this->db->query(
$query);
67 $row = $this->db->fetchAssoc($set);
68 if (empty($row)) {
69 return null;
70 }
71 return (int) $row['participant_id'];
72 }
References $query.
Referenced by __construct().
◆ save()
| ilBookingParticipant::save |
( |
| ) |
|
|
protected |
Definition at line 74 of file class.ilBookingParticipant.php.
74 : void
75 {
76 $assigner_id = $this->
user->getId();
77 $next_id = $this->db->nextId('booking_member');
78
79 $query =
'INSERT INTO booking_member' .
80 ' (participant_id, user_id, booking_pool_id, assigner_user_id)' .
81 ' VALUES (' . $this->db->quote($next_id, 'integer') .
82 ',' . $this->db->quote($this->participant_id, 'integer') .
83 ',' . $this->db->quote($this->booking_pool_id, 'integer') .
84 ',' . $this->db->quote($assigner_id, 'integer') . ')';
85
86 $this->db->manipulate(
$query);
87 }
References $query, and ILIAS\Repository\user().
Referenced by __construct().
◆ $booking_pool_id
| int ilBookingParticipant::$booking_pool_id |
|
protected |
◆ $db
◆ $is_new
| bool ilBookingParticipant::$is_new |
|
protected |
◆ $lng
◆ $participant_id
| int ilBookingParticipant::$participant_id |
|
protected |
◆ $user
The documentation for this class was generated from the following file: