17 $lng = $DIC->language();
18 $logger = $DIC->logger()->cal();
22 $candidates = array_unique(array_merge(
23 $participants->getAdmins(),
24 $participants->getTutors()
29 foreach ($users as $user_id) {
33 foreach ($appointments as $entry) {
40 if (!in_array($obj_id, $booking_entry->getTargetObjIds())) {
43 if (!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(), $current_user_id)) {
50 $ctrl->setParameterByClass(end($ctrl_class_structure),
'ch_user_id', $user_id);
51 if ( $category_id > 0) {
52 $ctrl->setParameterByClass(end($ctrl_class_structure),
'category_id', $category_id);
55 $ctrl->setParameterByClass(end($ctrl_class_structure),
'seed', $next_entry->getStart()->get(
IL_CAL_DATE));
58 'link' => $ctrl->getLinkTargetByClass($ctrl_class_structure,
'selectCHCalendarOfUser'),
61 $links[] = $current_link;
64 $ctrl->setParameterByClass(end($ctrl_class_structure),
'seed',
'');
65 $ctrl->setParameterByClass(end($ctrl_class_structure),
'ch_user_id',
'');
66 $ctrl->setParameterByClass(end($ctrl_class_structure),
'category_id',
'');
83 $db = $DIC->database();
85 $query =
'select ce.cal_id from cal_entries ce ' .
86 'join cal_cat_assignments cca on ce.cal_id = cca.cal_id ' .
87 'join cal_categories cc on cca.cat_id = cc.cat_id ' .
88 'where context_id = ' . $db->quote($booking->
getId(),
'integer') .
' ' .
94 $calendar_apppointments = [];
96 $calendar_apppointments[] = $row->cal_id;
98 return $calendar_apppointments;
115 include_once
'./Services/Language/classes/class.ilLanguageFactory.php';
117 $cal_lang->loadLanguageModule(
'dateplaner');
119 include_once
'./Services/Calendar/classes/class.ilCalendarUtil.php';
120 include_once
'./Services/Calendar/classes/class.ilCalendarCategory.php';
124 $cal_lang->txt(
'cal_ch_personal_ch'),
129 include_once
'./Services/Calendar/classes/class.ilCalendarEntry.php';
131 $personal_app = clone
$app;
132 $personal_app->save();
135 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
140 include_once
'./Services/Booking/classes/class.ilBookingEntry.php';
142 $booking->
book($app->getEntryId(), $a_usr_id);
152 public static function cancelBooking($a_usr_id, $a_app_id, $a_send_notification =
true)
155 include_once
'./Services/Calendar/classes/class.ilCalendarEntry.php';
158 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
161 $app->getContextId(),
166 foreach ($user_apps as $uapp_id) {
170 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
179 if ($a_send_notification) {
182 $booking->deleteBooking($a_app_id, $a_usr_id);
195 $ilDB = $DIC[
'ilDB'];
197 $query =
'SELECT user_id FROM cal_ch_settings ' .
198 'WHERE admin_id = ' .
$ilDB->quote($a_usr_id,
'integer');
203 $users[] = $row->user_id;
Model for a calendar entry.
static lookupManagedUsers($a_usr_id)
Lookup managed users.
static _lookupFullname($a_user_id)
Lookup Full Name.
static findCalendarAppointmentsForBooking(\ilBookingEntry $booking, \ilDateTime $start, \ilDateTime $end)
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.
static _lookupCategories($a_cal_id)
lookup categories
static getConsultationHourLinksForRepositoryObject(int $ref_id, int $current_user_id, array $ctrl_class_structure)
static getInstance($a_ref_id)
Get instance by ref_id.
static _getLanguage($a_lang_key='')
Get langauge object.
static lookupBookableUsersForObject($a_obj_id, $a_user_ids)
Consultation hours are offered if 1) consultation hour owner is admin or tutor and no object assignme...
foreach($_POST as $key=> $value) $res
static getAppointments($a_user_id)
Get all appointments.
static _lookupObjId($a_id)
cancelBooking($a_entry_id, $a_user_id=false)
cancel calendar booking for user
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
get($a_format, $a_format_str='', $a_tz='')
get formatted date
addAssignment($a_cal_cat_id)
add assignment
static cancelBooking($a_usr_id, $a_app_id, $a_send_notification=true)
Cancel a booking.
book($a_entry_id, $a_user_id=false)
book calendar entry for user
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.