3 declare(strict_types=1);
    51         int $recurrence_weeks,
    57         $cycle = $recurrence_weeks * 7;
    58         $booked_out_slots = [];
    59         $check_slot_from = $slot_from;
    60         while ($cut < 1000 && $check_slot_from <= $end) {
    61             $check_slot_from = $this->
addDaysStamp($slot_from, $cycle * $cut);
    62             $check_slot_to = $this->
addDaysStamp($slot_to, $cycle * $cut);
    64             $available = $available[$obj_id] ?? 0;
    65             if ($available < $requested_nr) {
    66                 $booked_out_slots[] = [
    67                     "from" => $check_slot_from,
    68                     "to" => $check_slot_to,
    69                     "missing" => $requested_nr - $available
    74         return $booked_out_slots;
    81         $date = date_parse($a_date);
    82         $stamp = mktime(0, 0, 1, $date[
"month"], $date[
"day"] + $a_days, $date[
"year"]);
    83         return date(
"Y-m-d", $stamp);
    90         $date = getdate($a_stamp);
    96             $date[
"mday"] + $a_days,
   113         $reservation_repo = $this->repo->reservation();
   117         if (is_null($until)) {
   124             $cycle = $recurrence * 7;
   126         $booked_out_slots = [];
   127         $check_slot_from = $from;
   128         $group_id = $reservation_repo->getNewGroupId();
   129         while ($cut < 1000 && $check_slot_from <= $end) {
   130             $check_slot_from = $this->
addDaysStamp($from, $cycle * $cut);
   131             $check_slot_to = $this->
addDaysStamp($to, $cycle * $cut);
   133             $available = $available[$obj_id] ?? 0;
   134             $book_nr = min($nr, $available);
   135             for ($loop = 0; $loop < $book_nr; $loop++) {
   161         int $assigner_id = 0,
   162         int $context_obj_id = 0,
   165         int $a_group_id = null,
   168         $lng = $this->domain->lng();
   172         $this->domain->participants()->createIfNotExisting($user_to_book, $pool_id);
   175         $reservation = new \ilBookingReservation();
   176         $reservation->setObjectId($object_id);
   177         $reservation->setUserId($user_to_book);
   178         $reservation->setAssignerId($assigner_id);
   179         $reservation->setFrom((
int) $a_from);
   180         $reservation->setTo((
int) $a_to);
   181         $reservation->setGroupId((
int) $a_group_id);
   182         $reservation->setContextObjId($context_obj_id);
   184         $reservation->save();
   188             $lng->loadLanguageModule(
'dateplaner');
   192                 $lng->txt(
'cal_ch_personal_book'),
   196             $object = new \ilBookingObject($object_id);
   198             $entry = new \ilCalendarEntry();
   201             $entry->setTitle(
$lng->txt(
'book_cal_entry') . 
' ' . $object->getTitle());
   202             $entry->setContextId($reservation->getId());
   205             $assignment = new \ilCalendarCategoryAssignments($entry->getEntryId());
   206             if ($def_cat !== null) {
   207                 $assignment->addAssignment($def_cat->getCategoryID());
   211         return $reservation->getId();
 get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
get(int $a_format, string $a_format_str='', string $a_tz='')
 
static getAvailableObject(array $a_ids, int $a_from, int $a_to, bool $a_return_single=true, bool $a_return_counter=false)
Check if any of given objects are bookable. 
 
__construct(InternalDataService $data, InternalRepoService $repo, InternalDomainService $domain)
 
addDaysStamp(int $a_stamp, int $a_days)
 
static initDefaultCalendarByType(int $a_type_id, int $a_usr_id, string $a_title, bool $a_create=false)
Init the default calendar for given type and user. 
 
InternalDataService $data
 
InternalDomainService $domain
 
Repository internal repo service. 
 
Repository internal data service. 
 
getRecurrenceMissingAvailability(int $obj_id, int $slot_from, int $slot_to, int $recurrence_weeks, int $requested_nr, \ilDate $until)
Get missing availability of an object for a given weekly recurrence, object id, starting slot and req...
 
bookAvailableObjects(int $obj_id, int $user_to_book, int $assigner_id, int $context_obj_id, int $from, int $to, int $recurrence, int $nr, ?\ilDateTime $until, string $message="")
 
addDaysDate(string $a_date, int $a_days)
 
static lookupPoolId(int $object_id)
 
InternalRepoService $repo
 
bookSingle(int $object_id, int $user_to_book, int $assigner_id=0, int $context_obj_id=0, int $a_from=null, int $a_to=null, int $a_group_id=null, string $message="")
Book object for date.