19 declare(strict_types=1);
29 array $ctrl_class_structure
34 $logger = $DIC->logger()->cal();
35 $ctrl->setParameterByClass(end($ctrl_class_structure),
'seed',
'');
36 $ctrl->setParameterByClass(end($ctrl_class_structure),
'category_id',
'');
40 $candidates = array_unique(array_merge(
41 $participants->getAdmins(),
42 $participants->getTutors()
47 foreach ($users as $user_id) {
51 foreach ($appointments as $entry) {
58 if (count($booking_entry->getTargetObjIds()) > 0 && !in_array($obj_id, $booking_entry->getTargetObjIds())) {
61 if (!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(), $current_user_id)) {
68 $ctrl->setParameterByClass(end($ctrl_class_structure),
'ch_user_id', $user_id);
69 if ($category_id > 0) {
70 $ctrl->setParameterByClass(end($ctrl_class_structure),
'category_id', $category_id);
73 $arr = explode(
"-", $next_entry->getStart()->get(
IL_CAL_DATE));
75 $seed = implode(
"-", $arr);
76 $ctrl->setParameterByClass(
77 end($ctrl_class_structure),
83 'link' => $ctrl->getLinkTargetByClass($ctrl_class_structure,
'selectCHCalendarOfUser'),
86 $links[] = $current_link;
89 $ctrl->setParameterByClass(end($ctrl_class_structure),
'seed',
'');
90 $ctrl->setParameterByClass(end($ctrl_class_structure),
'ch_user_id',
'');
91 $ctrl->setParameterByClass(end($ctrl_class_structure),
'category_id',
'');
105 $db = $DIC->database();
107 $query =
'select ce.cal_id from cal_entries ce ' .
108 'join cal_cat_assignments cca on ce.cal_id = cca.cal_id ' .
109 'join cal_categories cc on cca.cat_id = cc.cat_id ' .
110 'where context_id = ' . $db->quote($booking->
getId(),
'integer') .
' ' .
111 'and starta = ' . $db->quote(
115 'and enda = ' . $db->quote(
122 $calendar_apppointments = [];
124 $calendar_apppointments[] = (
int) $row->cal_id;
126 return $calendar_apppointments;
139 $lng = $DIC->language();
143 $cal_lang->loadLanguageModule(
'dateplaner');
148 $cal_lang->txt(
'cal_ch_personal_ch'),
154 $personal_app = clone
$app;
155 $personal_app->save();
163 $booking->
book($app->getEntryId(), $a_usr_id);
170 public static function cancelBooking(
int $a_usr_id,
int $a_app_id,
bool $a_send_notification =
true): bool
177 $app->getContextId(),
182 foreach ($user_apps as $uapp_id) {
194 if ($a_send_notification) {
197 $booking->deleteBooking($a_app_id, $a_usr_id);
210 $ilDB = $DIC->database();
211 $query =
'SELECT user_id FROM cal_ch_settings ' .
212 'WHERE admin_id = ' .
$ilDB->quote($a_usr_id,
'integer');
217 $users[] = (
int) $row->user_id;
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...
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static _lookupFullname(int $a_user_id)
static lookupManagedUsers($a_usr_id)
Lookup managed users.
static getInstance(int $a_ref_id)
static cancelBooking(int $a_usr_id, int $a_app_id, bool $a_send_notification=true)
Cancel a booking.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getConsultationHourLinksForRepositoryObject(int $ref_id, int $current_user_id, array $ctrl_class_structure)
static _lookupObjId(int $ref_id)
static bookAppointment(int $a_usr_id, int $a_app_id)
Book an appointment.
static getAppointmentIds(int $a_user_id, int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.
static _lookupCategories(int $a_cal_id)
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.
cancelBooking(int $a_entry_id, ?int $a_user_id=null)
cancel calendar booking for user
addAssignment(int $a_cal_cat_id)
static _getLanguage(string $a_lang_key='')
Get language object.
static getAppointments(int $a_user_id)
Get all appointments.
static lookupBookableUsersForObject(array $a_obj_id, array $a_user_ids)
Consultation hours are offered if 1) consultation hour owner is admin or tutor and no object assignme...
static findCalendarAppointmentsForBooking(ilBookingEntry $booking, ilDateTime $start, ilDateTime $end)
book(int $a_entry_id, ?int $a_user_id=null)
book calendar entry for user