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)
 
  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);
 
  164        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  165            $status = $row[
'status'];
 
  172            $name = $user_name[
'lastname'] . 
", " . $user_name[
'firstname'];
 
  173            $index = $a_booking_pool . 
"_" . $row[
'user_id'];
 
  178                    "object_title" => array(),
 
  183                    $res[
$index][
'object_title'] = array($row[
'title']);
 
  185                    $res[
$index][
'object_ids'][] = $row[
'object_id'];
 
  188                if ($row[
'title'] != 
"" && (!in_array(
 
  192                    array_push(
$res[
$index][
'object_title'], $row[
'title']);
 
  194                    $res[
$index][
'object_ids'][] = $row[
'object_id'];
 
  210            $limit_reached = (!$has_schedule && $bp->getOverallLimit() <= $val[
'obj_count']);
 
  211            if (!$limit_reached) {
 
  212                $ctrl->setParameterByClass(
'ilbookingparticipantgui', 
'bkusr', $val[
'user_id']);
 
  214                    'text' => 
$lng->txt(
"book_assign_object"),
 
  215                    'url' => $ctrl->getLinkTargetByClass([
"ilobjbookingpoolgui", 
"ilbookingparticipantgui"], 
'assignObjects')
 
  217                $ctrl->setParameterByClass(
'ilbookingparticipantgui', 
'bkusr', 
'');
 
  222                $ctrl->setParameterByClass(
'ilbookingreservationsgui', 
'bkusr', $val[
'user_id']);
 
  223                $ctrl->setParameterByClass(
'ilbookingreservationsgui', 
'object_id', $val[
'object_ids'][0]);
 
  227                    'text' => 
$lng->txt(
"book_deassign"),
 
  228                    'url' => $ctrl->getLinkTargetByClass(
"ilbookingreservationsgui", 
'rsvConfirmCancelUser')
 
  231                $ctrl->setParameterByClass(
'ilbookingreservationsgui', 
'bkusr', 
'');
 
  232                $ctrl->setParameterByClass(
'ilbookingreservationsgui', 
'object_id', 
'');
 
  233                $ctrl->setParameterByClass(
'ilbookingreservationsgui', 
'part_view', 
'');
 
  235                $ctrl->setParameterByClass(
'ilobjbookingpoolgui', 
'user_id', $val[
'user_id']);
 
  237                    'text' => 
$lng->txt(
"book_deassign"),
 
  238                    'url' => $ctrl->getLinkTargetByClass(
"ilobjbookingpoolgui", 
'log')
 
  240                $ctrl->setParameterByClass(
'ilobjbookingpoolgui', 
'user_id', 
'');
 
  245            $res[
$index][
'object_ids'][] = $row[
'object_id'];
 
  260        $sql = 
'SELECT * FROM booking_member WHERE booking_pool_id = ' . 
$ilDB->quote($a_booking_pool_id, 
'integer');
 
  262        $set = 
$ilDB->query($sql);
 
  265        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  266            $res[] = $row[
'user_id'];
 
  286        $sql = 
"SELECT ud.usr_id,ud.lastname,ud.firstname,ud.login" .
 
  287            " FROM usr_data ud " .
 
  288            " RIGHT JOIN booking_member m ON (ud.usr_id = m.user_id)" .
 
  290            " AND m.booking_pool_id = " . 
$ilDB->quote($a_pool_id, 
"integer") .
 
  291            " ORDER BY ud.lastname,ud.firstname";
 
  293        $set = 
$ilDB->query($sql);
 
  294        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  295            $res[$row[
"usr_id"]] = $row[
"lastname"] . 
", " . $row[
"firstname"] .
 
  296                " (" . $row[
"login"] . 
")";
 
An exception for terminatinating execution or to throw for unit testing.
Class ilBookingParticipant.
static getUserFilter($a_pool_id)
Get user data from db for an specific pool id.
static getBookingPoolParticipants(int $a_booking_pool_id)
Get all participants for a booking pool.
isParticipantAssigned($a_booking_object_id, $a_participant_id)
Returns true if the participant has a reservation for this object.
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.
save()
Save booking participant in DB.
static getList($a_booking_pool, array $a_filter=null, $a_object_id=null)
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static isBookingPoolLimitReachedByUser(int $a_user_id, int $a_pool_id)
static getMembersWithoutReservation(int $a_object_id)
static _lookupName($a_user_id)
lookup user name
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
foreach($_POST as $key=> $value) $res