Class ilBookingParticipant.
More...
◆ __construct()
ilBookingParticipant::__construct |
( |
|
$a_user_id, |
|
|
|
$a_booking_pool_id |
|
) |
| |
ilBookingParticipant constructor.
- Parameters
-
$a_user_id | integer |
$a_booking_pool_id | integer |
Definition at line 22 of file class.ilBookingParticipant.php.
References $DIC, ilObject\_exists(), read(), and save().
29 $this->lng = $DIC->language();
30 $this->db = $DIC->database();
31 $this->il_user = $DIC->user();
33 $this->participant_id = $a_user_id;
34 $this->booking_pool_id = $a_booking_pool_id;
41 $this->is_new =
false;
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
save()
Save booking participant in DB.
◆ getAssignableParticipants()
static ilBookingParticipant::getAssignableParticipants |
( |
|
$a_bp_object_id | ) |
|
|
static |
Get participants who can not have a reservation for this booking pool object id.
- Parameters
-
integer | $a_bp_object_id | booking pool object |
- Returns
- array formatted data to display in gui table.
Definition at line 96 of file class.ilBookingParticipant.php.
References $index, $name, $res, ilObjUser\_lookupName(), ilBookingReservation\getMembersWithoutReservation(), and ilBookingReservation\isBookingPoolLimitReachedByUser().
Referenced by ilBookingAssignParticipantsTableGUI\getItems().
99 $pool_id = $booking_object->getPoolId();
101 $overall_limit = (int) $pool->getOverallLimit();
107 foreach ($members as $member_id) {
111 if ($overall_limit == 0 || ($overall_limit > 0 && $total_reservations < $overall_limit)) {
113 $name = $user_name[
'lastname'] .
", " . $user_name[
'firstname'];
114 $index = $a_bp_object_id .
"_" . $member_id;
118 "user_id" => $member_id,
119 "object_title" => array($booking_object->getTitle()),
123 if (!in_array($booking_object->getTitle(),
$res[
$index][
'object_title'])) {
124 array_push(
$res[$index][
'object_title'], $booking_object->getTitle());
static _lookupName($a_user_id)
lookup user name
foreach($_POST as $key=> $value) $res
static getMembersWithoutReservation(int $a_object_id)
static isBookingPoolLimitReachedByUser(int $a_user_id, int $a_pool_id)
◆ getBookingPoolParticipants()
static ilBookingParticipant::getBookingPoolParticipants |
( |
integer |
$a_booking_pool_id | ) |
|
|
static |
Get all participants for a booking pool.
- Parameters
-
- Returns
- array
Definition at line 254 of file class.ilBookingParticipant.php.
References $DIC, $ilDB, $res, and $row.
257 $ilDB = $DIC->database();
258 $sql =
'SELECT * FROM booking_member WHERE booking_pool_id = ' .
$ilDB->quote($a_booking_pool_id,
'integer');
260 $set =
$ilDB->query($sql);
foreach($_POST as $key=> $value) $res
◆ getIsNew()
ilBookingParticipant::getIsNew |
( |
| ) |
|
◆ getList()
static ilBookingParticipant::getList |
( |
|
$a_booking_pool, |
|
|
array |
$a_filter = null , |
|
|
|
$a_object_id = null |
|
) |
| |
|
static |
Definition at line 133 of file class.ilBookingParticipant.php.
References $DIC, $ilDB, $index, $lng, $name, $query, $res, $row, ilObjUser\_lookupName(), ilBookingParticipantGUI\PARTICIPANT_VIEW, ilBookingReservation\STATUS_CANCELLED, ilObjBookingPool\TYPE_FIX_SCHEDULE, and ilObjBookingPool\TYPE_NO_SCHEDULE.
Referenced by ilBookingAssignParticipantsTableGUI\getItems(), and ilBookingParticipantsTableGUI\getItems().
137 $ilDB = $DIC->database();
138 $lng = $DIC->language();
139 $ctrl = $DIC->ctrl();
143 $query =
'SELECT bm.user_id, bm.booking_pool_id, br.object_id, bo.title, br.status' .
144 ' FROM booking_member bm' .
145 ' LEFT JOIN booking_reservation br ON (bm.user_id = br.user_id)' .
146 ' LEFT JOIN booking_object bo ON (br.object_id = bo.booking_object_id AND bo.pool_id = ' .
$ilDB->quote($a_booking_pool,
'integer') .
')';
148 $where = array(
'bm.booking_pool_id =' .
$ilDB->quote($a_booking_pool,
'integer'));
150 $where[] =
'br.object_id = ' .
$ilDB->quote($a_object_id,
'integer');
152 if ($a_filter[
'title']) {
153 $where[] =
'(' .
$ilDB->like(
'title',
'text',
'%' . $a_filter[
'title'] .
'%') .
154 ' OR ' .
$ilDB->like(
'description',
'text',
'%' . $a_filter[
'title'] .
'%') .
')';
156 if ($a_filter[
'user_id']) {
157 $where[] =
'bm.user_id = ' .
$ilDB->quote($a_filter[
'user_id'],
'integer');
160 $query .=
' WHERE ' . implode(
' AND ', $where);
165 $status =
$row[
'status'];
172 $name = $user_name[
'lastname'] .
", " . $user_name[
'firstname'];
173 $index = $a_booking_pool .
"_" .
$row[
'user_id'];
178 "object_title" => array(),
188 if (
$row[
'title'] !=
"" && (!in_array(
190 $res[$index][
'object_title']
192 array_push(
$res[$index][
'object_title'],
$row[
'title']);
202 foreach (
$res as $index => $val) {
209 $limit_reached = (!$has_schedule && $bp->getOverallLimit() <= $val[
'obj_count']);
210 if (!$limit_reached) {
211 $ctrl->setParameterByClass(
'ilbookingparticipantgui',
'bkusr', $val[
'user_id']);
213 'text' =>
$lng->txt(
"book_assign_object"),
214 'url' => $ctrl->getLinkTargetByClass(
"ilbookingparticipantgui",
'assignObjects')
216 $ctrl->setParameterByClass(
'ilbookingparticipantgui',
'bkusr',
'');
221 $ctrl->setParameterByClass(
'ilbookingobjectgui',
'bkusr', $val[
'user_id']);
222 $ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id', $val[
'object_ids'][0]);
226 'text' =>
$lng->txt(
"book_deassign"),
227 'url' => $ctrl->getLinkTargetByClass(
"ilbookingobjectgui",
'rsvConfirmCancelUser')
230 $ctrl->setParameterByClass(
'ilbookingparticipantgui',
'bkusr',
'');
231 $ctrl->setParameterByClass(
'ilbookingparticipantgui',
'object_id',
'');
232 $ctrl->setParameterByClass(
'ilbookingobjectgui',
'part_view',
'');
234 $ctrl->setParameterByClass(
'ilobjbookingpoolgui',
'user_id', $val[
'user_id']);
236 'text' =>
$lng->txt(
"book_deassign"),
237 'url' => $ctrl->getLinkTargetByClass(
"ilobjbookingpoolgui",
'log')
239 $ctrl->setParameterByClass(
'ilobjbookingpoolgui',
'user_id',
'');
static _lookupName($a_user_id)
lookup user name
foreach($_POST as $key=> $value) $res
◆ getUserFilter()
static ilBookingParticipant::getUserFilter |
( |
|
$a_pool_id | ) |
|
|
static |
Get user data from db for an specific pool id.
- Parameters
-
- Returns
- array
Definition at line 276 of file class.ilBookingParticipant.php.
References $DIC, $ilDB, $res, and $row.
Referenced by ilBookingParticipantsTableGUI\initFilter().
280 $ilDB = $DIC->database();
284 $sql =
"SELECT ud.usr_id,ud.lastname,ud.firstname,ud.login" .
285 " FROM usr_data ud " .
286 " RIGHT JOIN booking_member m ON (ud.usr_id = m.user_id)" .
287 " WHERE ud.usr_id <> " .
$ilDB->quote(ANONYMOUS_USER_ID,
"integer") .
288 " AND m.booking_pool_id = " .
$ilDB->quote($a_pool_id,
"integer") .
289 " ORDER BY ud.lastname,ud.firstname";
291 $set =
$ilDB->query($sql);
293 $res[
$row[
"usr_id"]] = $row[
"lastname"] .
", " . $row[
"firstname"] .
294 " (" . $row[
"login"] .
")";
foreach($_POST as $key=> $value) $res
◆ isParticipantAssigned()
ilBookingParticipant::isParticipantAssigned |
( |
|
$a_booking_object_id, |
|
|
|
$a_participant_id |
|
) |
| |
|
protected |
◆ read()
ilBookingParticipant::read |
( |
| ) |
|
|
protected |
Read from DB.
- Returns
- int|bool participant id if found.
Definition at line 49 of file class.ilBookingParticipant.php.
References $query, and $row.
Referenced by __construct().
51 $query =
'SELECT participant_id FROM booking_member' .
52 ' WHERE user_id = ' . $this->db->quote($this->participant_id,
'integer') .
53 ' AND booking_pool_id = ' . $this->db->quote($this->booking_pool_id,
'integer');
55 $set = $this->db->query(
$query);
56 $row = $this->db->fetchAssoc($set);
60 return $row[
'participant_id'];
◆ save()
ilBookingParticipant::save |
( |
| ) |
|
|
protected |
Save booking participant in DB.
Definition at line 67 of file class.ilBookingParticipant.php.
References $query.
Referenced by __construct().
69 $assigner_id = $this->il_user->getId();
70 $next_id = $this->db->nextId(
'booking_member');
72 $query =
'INSERT INTO booking_member' .
73 ' (participant_id, user_id, booking_pool_id, assigner_user_id)' .
74 ' VALUES (' . $this->db->quote($next_id,
'integer') .
75 ',' . $this->db->quote($this->participant_id,
'integer') .
76 ',' . $this->db->quote($this->booking_pool_id,
'integer') .
77 ',' . $this->db->quote($assigner_id,
'integer') .
')';
79 $this->db->manipulate(
$query);
◆ $booking_pool_id
ilBookingParticipant::$booking_pool_id |
|
protected |
◆ $db
ilBookingParticipant::$db |
|
protected |
◆ $is_new
ilBookingParticipant::$is_new |
|
protected |
◆ $lng
ilBookingParticipant::$lng |
|
protected |
◆ $participant_id
ilBookingParticipant::$participant_id |
|
protected |
The documentation for this class was generated from the following file: