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
- Todo:
- split up to manager and repo class
- Author
- Jesús López lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Definition at line 23 of file class.ilBookingParticipant.php.
◆ __construct()
| ilBookingParticipant::__construct |
( |
int |
$a_user_id, |
|
|
int |
$a_booking_pool_id |
|
) |
| |
◆ 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 102 of file class.ilBookingParticipant.php.
References $res, ilObjUser\_lookupName(), ilBookingReservation\getMembersWithoutReservation(), ILIAS\Repository\int(), and ilBookingReservation\isBookingPoolLimitReachedByUser().
Referenced by ilBookingAssignParticipantsTableGUI\getItems().
106 $pool_id = $booking_object->getPoolId();
108 $overall_limit = (
int) $pool->getOverallLimit();
114 foreach ($members as $member_id) {
118 if ($overall_limit === 0 || ($overall_limit > 0 && $total_reservations < $overall_limit)) {
120 $name = $user_name[
'lastname'] .
", " . $user_name[
'firstname'];
121 $index = $a_bp_object_id .
"_" . $member_id;
123 if (!isset(
$res[$index])) {
124 $res[$index] = array(
125 "user_id" => $member_id,
126 "object_title" => array($booking_object->getTitle()),
129 } elseif (!in_array($booking_object->getTitle(),
$res[$index][
'object_title'],
true)) {
130 $res[$index][
'object_title'][] = $booking_object->getTitle();
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getMembersWithoutReservation(int $a_object_id)
static isBookingPoolLimitReachedByUser(int $a_user_id, int $a_pool_id)
◆ getBookingPoolParticipants()
| static ilBookingParticipant::getBookingPoolParticipants |
( |
int |
$a_booking_pool_id | ) |
|
|
static |
Get all participants for a booking pool.
- Returns
- int[]
Definition at line 224 of file class.ilBookingParticipant.php.
References $DIC, $ilDB, and $res.
228 $ilDB = $DIC->database();
229 $sql =
'SELECT * FROM booking_member WHERE booking_pool_id = ' .
$ilDB->quote($a_booking_pool_id,
'integer');
231 $set =
$ilDB->query($sql);
234 while ($row =
$ilDB->fetchAssoc($set)) {
235 $res[] = $row[
'user_id'];
◆ getIsNew()
| ilBookingParticipant::getIsNew |
( |
| ) |
|
◆ getList()
| static ilBookingParticipant::getList |
( |
int |
$a_booking_pool, |
|
|
array |
$a_filter = null, |
|
|
int |
$a_object_id = null |
|
) |
| |
|
static |
Definition at line 138 of file class.ilBookingParticipant.php.
References $DIC, $ilDB, $res, ilObjUser\_lookupName(), ILIAS\Repository\int(), and ilBookingReservation\STATUS_CANCELLED.
Referenced by ilBookingAssignParticipantsTableGUI\getItems(), and ilBookingParticipantsTableGUI\getItems().
145 $ilDB = $DIC->database();
146 $domain = $DIC->bookingManager()->internal()->domain();
150 $query =
'SELECT bm.user_id, bm.booking_pool_id, br.object_id, bo.title, br.status' .
151 ' FROM booking_member bm' .
152 ' LEFT JOIN booking_reservation br ON (bm.user_id = br.user_id)' .
153 ' LEFT JOIN booking_object bo ON (br.object_id = bo.booking_object_id AND bo.pool_id = ' .
$ilDB->quote($a_booking_pool,
'integer') .
')';
155 $where = array(
'bm.booking_pool_id =' .
$ilDB->quote($a_booking_pool,
'integer'));
157 $where[] =
'br.object_id = ' .
$ilDB->quote($a_object_id,
'integer');
159 if ($a_filter[
'title'] ??
false) {
160 $where[] =
'(' .
$ilDB->like(
'title',
'text',
'%' . $a_filter[
'title'] .
'%') .
161 ' OR ' .
$ilDB->like(
'description',
'text',
'%' . $a_filter[
'title'] .
'%') .
')';
163 if ($a_filter[
'user_id'] ??
false) {
164 $where[] =
'bm.user_id = ' .
$ilDB->quote($a_filter[
'user_id'],
'integer');
167 $query .=
' WHERE ' . implode(
' AND ', $where);
169 $set =
$ilDB->query($query);
171 while ($row =
$ilDB->fetchAssoc($set)) {
172 $status = $row[
'status'];
178 if (!
$domain->profile()->exists((
int) $row[
'user_id'])) {
183 $name = $user_name[
'lastname'] .
", " . $user_name[
'firstname'];
184 $index = $a_booking_pool .
"_" . $row[
'user_id'];
186 $title = (string) ($row[
'title'] ??
'');
187 $object_id = (
int) ($row[
'object_id'] ?? -1);
188 if (!isset(
$res[$index])) {
189 $res[$index] = [
'object_title' => [],
'obj_count' => 0,
'object_ids' => [],
'name' => $name];
196 $res[$index][
'object_title'] = [$title];
197 $res[$index][
'obj_count'] = 1;
198 $res[$index][
'object_ids'][] = $object_id;
201 $res[$index][
'object_title'][] = $title;
202 if (!isset(
$res[$index][
'obj_count'])) {
203 $res[$index][
'obj_count'] = 0;
205 $res[$index][
'obj_count'] += 1;
206 $res[$index][
'object_ids'][] = $object_id;
208 $res[$index][
'user_id'] = $row[
'user_id'];
211 foreach (
$res as $index => $val) {
212 if (isset($row[
'object_id'])) {
213 $res[$index][
'object_ids'][] = $row[
'object_id'];
static _lookupName(int $a_user_id)
lookup user name
ILIAS BookingManager InternalDomainService $domain
◆ getUserFilter()
| static ilBookingParticipant::getUserFilter |
( |
int |
$a_pool_id | ) |
|
|
static |
Get user data from db for an specific pool id.
- Returns
- string[]
Definition at line 245 of file class.ilBookingParticipant.php.
References $DIC, $ilDB, $res, and ANONYMOUS_USER_ID.
Referenced by ilBookingParticipantsTableGUI\initFilter().
250 $ilDB = $DIC->database();
254 $sql =
"SELECT ud.usr_id,ud.lastname,ud.firstname,ud.login" .
255 " FROM usr_data ud " .
256 " RIGHT JOIN booking_member m ON (ud.usr_id = m.user_id)" .
258 " AND m.booking_pool_id = " .
$ilDB->quote($a_pool_id,
"integer") .
259 " ORDER BY ud.lastname,ud.firstname";
261 $set =
$ilDB->query($sql);
262 while ($row =
$ilDB->fetchAssoc($set)) {
263 $res[$row[
"usr_id"]] = $row[
"lastname"] .
", " . $row[
"firstname"] .
264 " (" . $row[
"login"] .
")";
◆ isParticipantAssigned()
| ilBookingParticipant::isParticipantAssigned |
( |
int |
$a_booking_object_id, |
|
|
int |
$a_participant_id |
|
) |
| |
|
protected |
◆ read()
| ilBookingParticipant::read |
( |
| ) |
|
|
protected |
Definition at line 63 of file class.ilBookingParticipant.php.
Referenced by __construct().
65 $query =
'SELECT participant_id FROM booking_member' .
66 ' WHERE user_id = ' . $this->db->quote($this->participant_id,
'integer') .
67 ' AND booking_pool_id = ' . $this->db->quote($this->booking_pool_id,
'integer');
69 $set = $this->db->query($query);
70 $row = $this->db->fetchAssoc($set);
74 return (
int) $row[
'participant_id'];
◆ save()
| ilBookingParticipant::save |
( |
| ) |
|
|
protected |
Definition at line 77 of file class.ilBookingParticipant.php.
References ILIAS\Repository\user().
Referenced by __construct().
79 $assigner_id = $this->
user->getId();
80 $next_id = $this->db->nextId(
'booking_member');
82 $query =
'INSERT INTO booking_member' .
83 ' (participant_id, user_id, booking_pool_id, assigner_user_id)' .
84 ' VALUES (' . $this->db->quote($next_id,
'integer') .
85 ',' . $this->db->quote($this->participant_id,
'integer') .
86 ',' . $this->db->quote($this->booking_pool_id,
'integer') .
87 ',' . $this->db->quote($assigner_id,
'integer') .
')';
89 $this->db->manipulate($query);
◆ $booking_pool_id
| int ilBookingParticipant::$booking_pool_id |
|
protected |
◆ $db
◆ $domain
| ILIAS BookingManager InternalDomainService ilBookingParticipant::$domain |
|
protected |
◆ $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: