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;
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'];
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);
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());
133 public static function getList($a_booking_pool, array $a_filter = null, $a_object_id = null)
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']);
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',
'');
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);
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"] .
")";
static _lookupName($a_user_id)
lookup user name
Class ilBookingParticipant.
static getList($a_booking_pool, array $a_filter=null, $a_object_id=null)
static getUserFilter($a_pool_id)
Get user data from db for an specific pool id.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
foreach($_POST as $key=> $value) $res
static getMembersWithoutReservation(int $a_object_id)
save()
Save booking participant in DB.
isParticipantAssigned($a_booking_object_id, $a_participant_id)
Returns true if the participant has a reservation for this object.
static isBookingPoolLimitReachedByUser(int $a_user_id, int $a_pool_id)
static getBookingPoolParticipants(integer $a_booking_pool_id)
Get all participants for a booking pool.
static getAssignableParticipants($a_bp_object_id)
Get participants who can not have a reservation for this booking pool object id.
__construct($a_user_id, $a_booking_pool_id)
ilBookingParticipant constructor.