ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCalendarAppointmentGUI Class Reference

Administrate calendar appointments. More...

+ Collaboration diagram for ilCalendarAppointmentGUI:

Public Member Functions

 __construct (ilDate $seed, ilDate $initialDate, int $a_appointment_id=0)
 
 executeCommand ()
 
 getAppointment ()
 
 confirmUnregister ()
 
 book ()
 Confirmation screen for booking of consultation appointment. More...
 
 bookconfirmed ()
 Book consultation appointment, was confirmed. More...
 
 cancelBooking (bool $send_mail=true)
 Confirmation screen to cancel consultation appointment or ressource booking depends on calendar category. More...
 
 cancelConfirmed (bool $send_mail=true)
 Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar entry. More...
 

Protected Member Functions

 getAppointmentIdFromQuery ()
 
 getRecurrenceExclusionFromQuery ()
 
 getRecurrenceDateFromQuery ()
 
 cancel ()
 
 readAndPrepareCalendarSelection (string $mode)
 
 doUserAutoComplete ()
 Currently not in use, but will be as soon as tag inputs support autocomplete, see ilCalendarAppointmentGUI::initForm. More...
 
 add (?Form $form=null)
 add new appointment More...
 
 save ()
 
 distributeUserNotifications ()
 Send mail to selected users. More...
 
 distributeNotifications (int $a_cat_id, int $app_id, bool $a_new_appointment=true)
 
 askEdit ()
 Check edit single apppointment / edit all appointments for recurring appointments. More...
 
 editSingle ()
 Edit one single appointment ^. More...
 
 edit (bool $a_edit_single_app=false, ?Form $form=null)
 edit appointment More...
 
 showInfoScreen ()
 
 update ()
 
 askDelete ()
 
 delete ()
 
 deleteExclude (bool $a_return=true)
 
 initTimeZone ()
 
 initInitialDate (ilDate $initialDate)
 
 initSeed (ilDate $seed)
 
 initAppointment (int $a_app_id=0)
 
 loadNotificationRecipients (array $recipients)
 
 loadRecurrenceSettings (?ilCalendarRecurrence $recurrence)
 
 saveRecurrenceSettings ()
 
 createDefaultCalendar ()
 
 confirmRegister ()
 Register to an appointment. More...
 
 register ()
 
 unregister ()
 Unregister calendar, was confirmed. More...
 
 initFormConfirmBooking ()
 
 deleteBooking ()
 
 deleteConfirmed ()
 
 calendarEntryToCategory (ilCalendarEntry $entry)
 Get category object of given calendar entry. More...
 

Protected Attributes

bool $requested_rexl
 
ilDate $seed
 
ilDateTime $initialDate
 
bool $default_fulltime = true
 
ilCalendarEntry $app
 
ilCalendarRecurrence $rec
 
string $timezone
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrlInterface $ctrl
 
ilObjUser $user
 
ilTabsGUI $tabs
 
ilSetting $settings
 
ilHelpGUI $help
 
ilErrorHandling $error
 
HTTPServices $http
 
RefineryFactory $refinery
 
RequestInterface $request
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 

Private Attributes

Form $form
 
ilCalendarUserNotification $notification
 
ilLogger $logger
 

Detailed Description

Administrate calendar appointments.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 35 of file class.ilCalendarAppointmentGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarAppointmentGUI::__construct ( ilDate  $seed,
ilDate  $initialDate,
int  $a_appointment_id = 0 
)
Todo:
make appointment_id required and remove all GET request

Definition at line 66 of file class.ilCalendarAppointmentGUI.php.

67 {
68 global $DIC;
69
70 $this->lng = $DIC->language();
71 $this->lng->loadLanguageModule('dateplaner');
72 $this->ctrl = $DIC->ctrl();
73 $this->tpl = $DIC->ui()->mainTemplate();
74 $this->logger = $DIC->logger()->cal();
75 $this->user = $DIC->user();
76 $this->settings = $DIC->settings();
77 $this->tabs = $DIC->tabs();
78 $this->help = $DIC->help();
79 $this->error = $DIC['ilErr'];
80 $this->ui_factory = $DIC->ui()->factory();
81 $this->ui_renderer = $DIC->ui()->renderer();
82 $this->http = $DIC->http();
83 $this->refinery = $DIC->refinery();
84 $this->request = $DIC->http()->request();
85
86 $this->initTimeZone();
87 $this->initSeed($seed);
88 $this->initInitialDate($initialDate);
89 $this->initAppointment($a_appointment_id);
90 $this->requested_rexl = (bool) $this->getRecurrenceExclusionFromQuery();
91 }
error(string $a_errmsg)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), error(), getRecurrenceExclusionFromQuery(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initAppointment(), initInitialDate(), initSeed(), initTimeZone(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilCalendarAppointmentGUI::add ( ?Form  $form = null)
protected

add new appointment

Definition at line 459 of file class.ilCalendarAppointmentGUI.php.

459 : void
460 {
461 $this->help->setScreenIdComponent("cal");
462 $this->help->setScreenId("app");
463 $this->help->setSubScreenId("create");
464
465 if (!$form) {
466 $form = $this->initForm('create');
467 }
468 $this->tpl->setContent($this->ui_renderer->render($form));
469 }

References $form, and ILIAS\Repository\help().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ askDelete()

ilCalendarAppointmentGUI::askDelete ( )
protected

Definition at line 770 of file class.ilCalendarAppointmentGUI.php.

770 : void
771 {
772 $this->ctrl->saveParameter(
773 $this,
774 [
775 'seed',
776 'app_id',
777 'dt',
778 'idate'
779 ]
780 );
781
782 $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
783 if (!$app_id) {
784 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
785 $this->ctrl->returnToParent($this);
786 }
787
789 if (!count($recs)) {
790 $confirm = new ilConfirmationGUI();
791 $confirm->setFormAction($this->ctrl->getFormAction($this));
792 $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
793 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
794 $confirm->addItem('appointments[]', (string) $this->app->getEntryId(), $this->app->getTitle());
795 $confirm->setConfirm($this->lng->txt('delete'), 'delete');
796 $this->tpl->setContent($confirm->getHTML());
797 } else {
798 $table = new ilCalendarRecurrenceTableGUI(
799 $this->app,
800 $this,
801 'askDelete'
802 );
803 $table->init();
804 $table->parse();
805 $this->tpl->setContent($table->getHTML());
806 $this->tpl->setOnScreenMessage('question', $this->lng->txt('cal_delete_app_sure'));
807 $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_recurrence_confirm_deletion'));
808 }
809 }
Class ilCalendarRecurrenceTableGUI.
static _getRecurrences(int $a_cal_id)
get all recurrences of an appointment
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilCalendarRecurrences\_getRecurrences(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ askEdit()

ilCalendarAppointmentGUI::askEdit ( )
protected

Check edit single apppointment / edit all appointments for recurring appointments.

Definition at line 583 of file class.ilCalendarAppointmentGUI.php.

583 : void
584 {
585 // check for recurring entries
587 if (!$rec) {
588 $this->edit(true);
589 return;
590 }
591 // Show edit single/all appointments
592 $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt', 'idate'));
593
594 $confirm = new ilConfirmationGUI();
595 $confirm->setHeaderText($this->lng->txt('cal_edit_single_or_all_info'));
596 $confirm->setFormAction($this->ctrl->getFormAction($this));
597 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
598 $confirm->addItem('appointments[]', (string) $this->app->getEntryId(), $this->app->getTitle());
599 $confirm->addButton($this->lng->txt('cal_edit_single'), 'editSingle');
600 $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'), 'edit');
601
602 $this->tpl->setContent($confirm->getHTML());
603 }
edit(bool $a_edit_single_app=false, ?Form $form=null)
edit appointment

References $rec, ilCalendarRecurrences\_getRecurrences(), ILIAS\Repository\ctrl(), edit(), getAppointment(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ book()

ilCalendarAppointmentGUI::book ( )

Confirmation screen for booking of consultation appointment.

Definition at line 1184 of file class.ilCalendarAppointmentGUI.php.

1184 : void
1185 {
1186 $entry_id = $this->getAppointmentIdFromQuery();
1187 $this->ctrl->saveParameter($this, 'app_id');
1188
1189 $entry = new ilCalendarEntry($entry_id);
1190 $booking = new \ilBookingEntry($entry->getContextId());
1191 $user = $booking->getObjId();
1192
1193 $form = $this->initFormConfirmBooking();
1194 $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod(
1195 $entry->getStart(),
1196 $entry->getEnd()
1197 ));
1198 $form->getItemByPostVar('title')->setValue($entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')');
1199
1200 $this->tpl->setContent($form->getHTML());
1201 }
Model for a calendar entry.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
static _lookupFullname(int $a_user_id)

References $form, $user, ilObjUser\_lookupFullname(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), getAppointmentIdFromQuery(), and initFormConfirmBooking().

+ Here is the call graph for this function:

◆ bookconfirmed()

ilCalendarAppointmentGUI::bookconfirmed ( )

Book consultation appointment, was confirmed.

Definition at line 1226 of file class.ilCalendarAppointmentGUI.php.

1227 {
1228 $entry = $this->getAppointmentIdFromQuery();
1229 $form = $this->initFormConfirmBooking();
1230 if ($form->checkInput()) {
1231 // check if appointment is bookable
1232 $cal_entry = new ilCalendarEntry($entry);
1233
1234 $booking = new ilBookingEntry($cal_entry->getContextId());
1235
1236 if (!$booking->isAppointmentBookableForUser($entry, $GLOBALS['DIC']['ilUser']->getId())) {
1237 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_booking_failed_info'), true);
1238 $this->ctrl->returnToParent($this);
1239 }
1240
1241 ilConsultationHourUtils::bookAppointment($this->user->getId(), $entry, $form->getInput('comment'));
1242 }
1243 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_booking_confirmed'), true);
1244 $this->ctrl->returnToParent($this);
1245 }
Booking definition.
static bookAppointment(int $a_usr_id, int $a_app_id, string $comment='')
Book an appointment.
$GLOBALS["DIC"]
Definition: wac.php:54

References $form, $GLOBALS, ilConsultationHourUtils\bookAppointment(), ILIAS\Repository\ctrl(), getAppointmentIdFromQuery(), initFormConfirmBooking(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ calendarEntryToCategory()

ilCalendarAppointmentGUI::calendarEntryToCategory ( ilCalendarEntry  $entry)
protected

Get category object of given calendar entry.

Definition at line 1360 of file class.ilCalendarAppointmentGUI.php.

1361 {
1362 $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1363 $assignment = $assignment->getFirstAssignment();
1364 return new ilCalendarCategory($assignment);
1365 }
Stores calendar categories.

References ilCalendarEntry\getEntryId().

Referenced by cancelBooking(), and cancelConfirmed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilCalendarAppointmentGUI::cancel ( )
protected

Definition at line 159 of file class.ilCalendarAppointmentGUI.php.

159 : void
160 {
161 $this->ctrl->returnToParent($this);
162 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ cancelBooking()

ilCalendarAppointmentGUI::cancelBooking ( bool  $send_mail = true)

Confirmation screen to cancel consultation appointment or ressource booking depends on calendar category.

Definition at line 1256 of file class.ilCalendarAppointmentGUI.php.

1256 : void
1257 {
1258 $entry = $this->getAppointmentIdFromQuery();
1259 $entry = new ilCalendarEntry($entry);
1260
1261 $category = $this->calendarEntryToCategory($entry);
1262 if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1263 $booking = new ilBookingEntry($entry->getContextId());
1264 if (!$booking->hasBooked($entry->getEntryId()) && !$booking->isOwner()) {
1265 $this->ctrl->returnToParent($this);
1266 return;
1267 }
1268 $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
1269 } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1270 $entry_title = ' ' . $entry->getTitle();
1271 } else {
1272 $this->ctrl->returnToParent($this);
1273 return;
1274 }
1275 $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1276 $conf = new ilConfirmationGUI();
1277 $conf->setFormAction($this->ctrl->getFormAction($this));
1278 $conf->setHeaderText(
1279 $send_mail ?
1280 $this->lng->txt('cal_cancel_booking_info') :
1281 $this->lng->txt('cal_delete_booking_info')
1282 );
1283 $conf->setConfirm(
1284 $send_mail ?
1285 $this->lng->txt('cal_cancel_booking') :
1286 $this->lng->txt('delete'),
1287 $send_mail ?
1288 'cancelConfirmed' :
1289 'deleteConfirmed'
1290 );
1291 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1292 $conf->addItem('app_id', (string) $entry->getEntryId(), $title . ' - ' . $entry_title);
1293 $this->tpl->setContent($conf->getHTML());
1294 }
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.

References ilObjUser\_lookupFullname(), calendarEntryToCategory(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), getAppointmentIdFromQuery(), ILIAS\Repository\lng(), ilCalendarCategory\TYPE_BOOK, and ilCalendarCategory\TYPE_CH.

Referenced by deleteBooking().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelConfirmed()

ilCalendarAppointmentGUI::cancelConfirmed ( bool  $send_mail = true)

Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar entry.

Definition at line 1305 of file class.ilCalendarAppointmentGUI.php.

1305 : void
1306 {
1307 $app_id = 0;
1308 if ($this->http->wrapper()->post()->has('app_id')) {
1309 $app_id = $this->http->wrapper()->post()->retrieve(
1310 'app_id',
1311 $this->refinery->kindlyTo()->int()
1312 );
1313 }
1314 $entry = new ilCalendarEntry($app_id);
1315 $category = $this->calendarEntryToCategory($entry);
1316 $booking = new ilBookingEntry($entry->getContextId());
1317 if ($category->getType() == ilCalendarCategory::TYPE_CH && $booking->isOwner()) {
1318 foreach ($booking->getCurrentBookings($entry->getEntryId()) as $bookuser) {
1320 $bookuser,
1321 (int) $app_id,
1322 $send_mail
1323 );
1324 }
1325 } elseif ($category->getType() == ilCalendarCategory::TYPE_CH) {
1326 // find cloned calendar entry in user calendar
1328 $this->user->getId(),
1329 $entry->getContextId(),
1330 $entry->getStart(),
1332 false
1333 );
1334
1335 // Fix for wrong, old entries
1336 foreach ($apps as $own_app) {
1337 $ref_entry = new ilCalendarEntry($own_app);
1338 $ref_entry->delete();
1339 }
1340
1341 $booking = new ilBookingEntry($entry->getContextId());
1342 $booking->cancelBooking($entry->getEntryId());
1343
1344 // do NOT delete original entry
1345 } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1346 $booking = new ilBookingReservation($entry->getContextId());
1347 $booking->setStatus(ilBookingReservation::STATUS_CANCELLED);
1348 $booking->update();
1349
1350 $entry->delete();
1351 }
1352
1353 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_cancel_booking_confirmed'), true);
1354 $this->ctrl->returnToParent($this);
1355 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 cancelBooking(int $a_usr_id, int $a_app_id, bool $a_send_notification=true)
Cancel a booking.

References calendarEntryToCategory(), ilConsultationHourUtils\cancelBooking(), ILIAS\Repository\ctrl(), ilConsultationHourAppointments\getAppointmentIds(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilBookingReservation\STATUS_CANCELLED, ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, and ILIAS\Repository\user().

Referenced by deleteConfirmed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmRegister()

ilCalendarAppointmentGUI::confirmRegister ( )
protected

Register to an appointment.

Definition at line 1037 of file class.ilCalendarAppointmentGUI.php.

1037 : void
1038 {
1039 $dstart = 0;
1040 if ($this->http->wrapper()->query()->has('dstart')) {
1041 $dstart = $this->http->wrapper()->query()->retrieve(
1042 'dstart',
1043 $this->refinery->kindlyTo()->int()
1044 );
1045 }
1046 $dend = 0;
1047 if ($this->http->wrapper()->query()->has('dend')) {
1048 $dend = $this->http->wrapper()->query()->retrieve(
1049 'dend',
1050 $this->refinery->kindlyTo()->int()
1051 );
1052 }
1053
1054 $app_id = $this->getAppointmentIdFromQuery();
1055 $entry = new ilCalendarEntry($app_id);
1057 new ilDateTime($dstart, IL_CAL_UNIX),
1058 new ilDateTime($dend, IL_CAL_UNIX)
1059 );
1060
1061 $conf = new ilConfirmationGUI();
1062 $this->ctrl->setParameter($this, 'dstart', $dstart);
1063 $this->ctrl->setParameter($this, 'dend', $dend);
1064
1065 $conf->setFormAction($this->ctrl->getFormAction($this));
1066 $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1067 $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1068 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1069 $conf->addItem('app_id', (string) $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1070 $this->tpl->setContent($conf->getHTML());
1071 }
const IL_CAL_UNIX
@classDescription Date and time handling

References ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), getAppointmentIdFromQuery(), ILIAS\FileDelivery\http(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ confirmUnregister()

ilCalendarAppointmentGUI::confirmUnregister ( )

Definition at line 1107 of file class.ilCalendarAppointmentGUI.php.

1107 : void
1108 {
1109 $dstart = 0;
1110 if ($this->http->wrapper()->query()->has('dstart')) {
1111 $dstart = $this->http->wrapper()->query()->retrieve(
1112 'dstart',
1113 $this->refinery->kindlyTo()->int()
1114 );
1115 }
1116 $dend = 0;
1117 if ($this->http->wrapper()->query()->has('dend')) {
1118 $dend = $this->http->wrapper()->query()->retrieve(
1119 'dend',
1120 $this->refinery->kindlyTo()->int()
1121 );
1122 }
1123
1124 $app_id = $this->getAppointmentIdFromQuery();
1125 $entry = new ilCalendarEntry($app_id);
1127 new ilDateTime($dstart, IL_CAL_UNIX),
1128 new ilDateTime($dend, IL_CAL_UNIX)
1129 );
1130
1131 $this->ctrl->setParameter($this, 'dstart', (int) $dstart);
1132 $this->ctrl->setParameter($this, 'dend', (int) $dend);
1133
1134 $conf = new ilConfirmationGUI();
1135 $conf->setFormAction($this->ctrl->getFormAction($this));
1136 $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1137 $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1138 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1139 $conf->addItem('app_id', (string) $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1140
1141 $this->tpl->setContent($conf->getHTML());
1142 }

References ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), getAppointmentIdFromQuery(), ILIAS\FileDelivery\http(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ createDefaultCalendar()

ilCalendarAppointmentGUI::createDefaultCalendar ( )
protected

Definition at line 1020 of file class.ilCalendarAppointmentGUI.php.

1020 : int
1021 {
1022 $cat = new ilCalendarCategory();
1023 $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1024 $cat->setType(ilCalendarCategory::TYPE_USR);
1025 $cat->setTitle($this->lng->txt('cal_default_calendar'));
1026 $cat->setObjId($this->user->getId());
1027
1028 // delete calendar cache
1029 ilCalendarCache::getInstance()->deleteUserEntries($this->user->getId());
1030
1031 return $cat->add();
1032 }

References ilCalendarCategory\DEFAULT_COLOR, ilCalendarCache\getInstance(), ILIAS\Repository\lng(), ilCalendarCategory\TYPE_USR, and ILIAS\Repository\user().

Referenced by save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarAppointmentGUI::delete ( )
protected

Definition at line 811 of file class.ilCalendarAppointmentGUI.php.

811 : void
812 {
813 $app_ids = (array) ($this->request->getParsedBody()['appointment_ids'] ?? []);
814 if (!$app_ids) {
815 $this->logger->dump($app_ids);
816 $app_ids = (array) ($this->request->getQueryParams()['app_id'] ?? []);
817 }
818 if (!$app_ids) {
819 $this->ctrl->returnToParent($this);
820 }
821 foreach ($app_ids as $app_id) {
822 $app_id = (int) $app_id;
823 $app = new ilCalendarEntry($app_id);
824 $app->delete();
827 }
828 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
829 $this->ctrl->returnToParent($this);
830 }
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.

References $app, ilCalendarCategoryAssignments\_deleteByAppointmentId(), ILIAS\Repository\ctrl(), ilCalendarEntry\delete(), ilCalendarUserNotification\deleteCalendarEntry(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

◆ deleteBooking()

ilCalendarAppointmentGUI::deleteBooking ( )
protected

Definition at line 1247 of file class.ilCalendarAppointmentGUI.php.

1247 : void
1248 {
1249 $this->cancelBooking(false);
1250 }
cancelBooking(bool $send_mail=true)
Confirmation screen to cancel consultation appointment or ressource booking depends on calendar categ...

References cancelBooking().

+ Here is the call graph for this function:

◆ deleteConfirmed()

ilCalendarAppointmentGUI::deleteConfirmed ( )
protected

Definition at line 1296 of file class.ilCalendarAppointmentGUI.php.

1296 : void
1297 {
1298 $this->cancelConfirmed(false);
1299 }
cancelConfirmed(bool $send_mail=true)
Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar ent...

References cancelConfirmed().

+ Here is the call graph for this function:

◆ deleteExclude()

ilCalendarAppointmentGUI::deleteExclude ( bool  $a_return = true)
protected

Definition at line 832 of file class.ilCalendarAppointmentGUI.php.

832 : void
833 {
834 $recurrence_ids = (array) ($this->request->getParsedBody()['recurrence_ids'] ?? []);
835 $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
836 if (!count($recurrence_ids)) {
837 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
838 $this->ctrl->redirect($this, 'askDelete');
839 }
840 if (!$app_id) {
841 $this->ctrl->returnToParent($this);
842 }
843 foreach ($recurrence_ids as $rdate) {
844 $exclusion = new ilCalendarRecurrenceExclusion();
845 $exclusion->setEntryId($app_id);
846 $exclusion->setDate(new ilDate($rdate, IL_CAL_UNIX));
847 $exclusion->save();
848 }
849 if ($a_return) {
850 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
851 $this->ctrl->returnToParent($this);
852 }
853 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class for single dates.

References ILIAS\Repository\ctrl(), IL_CAL_UNIX, ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ distributeNotifications()

ilCalendarAppointmentGUI::distributeNotifications ( int  $a_cat_id,
int  $app_id,
bool  $a_new_appointment = true 
)
protected

Definition at line 542 of file class.ilCalendarAppointmentGUI.php.

542 : void
543 {
544 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
545
547 $notification->setAppointmentId($app_id);
548
549 switch ($cat_info['type']) {
551
552 switch ($cat_info['obj_type']) {
553 case 'crs':
554 $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
555 $ref_id = current($ref_ids);
556 $notification->setRefId($ref_id);
557 $notification->setType(
558 $a_new_appointment ?
561 );
562 break;
563
564 case 'grp':
565 $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
566 $ref_id = current($ref_ids);
567 $notification->setRefId($ref_id);
568 $notification->setType(
569 $a_new_appointment ?
572 );
573 break;
574 }
575 break;
576 }
577 $notification->send();
578 }
ilCalendarUserNotification $notification
static _getInstance($a_usr_id=0)
get singleton instance
Distributes calendar mail notifications.
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:66

References $notification, $ref_id, ilObject\_getAllReferences(), ilCalendarCategories\_getInstance(), ilCalendarMailNotification\TYPE_CRS_NEW_NOTIFICATION, ilCalendarMailNotification\TYPE_CRS_NOTIFICATION, ilCalendarMailNotification\TYPE_GRP_NEW_NOTIFICATION, ilCalendarMailNotification\TYPE_GRP_NOTIFICATION, and ilCalendarCategory\TYPE_OBJ.

Referenced by save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ distributeUserNotifications()

ilCalendarAppointmentGUI::distributeUserNotifications ( )
protected

Send mail to selected users.

Definition at line 519 of file class.ilCalendarAppointmentGUI.php.

519 : void
520 {
522 $notification->setAppointmentId($this->app->getEntryId());
523
524 foreach ($this->notification->getRecipients() as $rcp) {
525 switch ($rcp['type']) {
528 $notification->setRecipients(array($rcp['usr_id']));
530 break;
531
534 $notification->setRecipients(array($rcp['email']));
536 break;
537 }
538 $notification->send();
539 }
540 }
const ANONYMOUS_USER_ID
Definition: constants.php:27

References $notification, ANONYMOUS_USER_ID, ILIAS\UI\examples\Symbol\Glyph\Notification\notification(), ilCalendarUserNotification\setRecipients(), ilCalendarUserNotification\TYPE_EMAIL, ilCalendarMailNotification\TYPE_USER, ilCalendarUserNotification\TYPE_USER, and ilCalendarMailNotification\TYPE_USER_ANONYMOUS.

Referenced by save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUserAutoComplete()

ilCalendarAppointmentGUI::doUserAutoComplete ( )
protected

Currently not in use, but will be as soon as tag inputs support autocomplete, see ilCalendarAppointmentGUI::initForm.

Definition at line 404 of file class.ilCalendarAppointmentGUI.php.

404 : ?string
405 {
406 // hide anonymout request
407 if ($this->user->getId() == ANONYMOUS_USER_ID) {
408 return json_encode(new stdClass(), JSON_THROW_ON_ERROR);
409 }
410 if (!$this->http->wrapper()->query()->has('autoCompleteField')) {
411 $a_fields = [
412 'login',
413 'firstname',
414 'lastname',
415 'email'
416 ];
417 $result_field = 'login';
418 } else {
419 $auto_complete_field = $this->http->wrapper()->query()->retrieve(
420 'autoCompleteField',
421 $this->refinery->kindlyTo()->string()
422 );
423 $a_fields = [$auto_complete_field];
424 $result_field = $auto_complete_field;
425 }
426 $auto = new ilUserAutoComplete();
428
429 if ($this->http->wrapper()->query()->has('fetchall')) {
430 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
431 }
432
433 $auto->setMoreLinkAvailable(true);
434 $auto->setSearchFields($a_fields);
435 $auto->setResultField($result_field);
436 $auto->enableFieldSearchableCheck(true);
437 $query = '';
438 if ($this->http->wrapper()->post()->has('term')) {
439 $query = $this->http->wrapper()->post()->retrieve(
440 'term',
441 $this->refinery->kindlyTo()->string()
442 );
443 }
444 if ($query === '') {
445 if ($this->http->wrapper()->query()->has('term')) {
446 $query = $this->http->wrapper()->query()->retrieve(
447 'term',
448 $this->refinery->kindlyTo()->string()
449 );
450 }
451 }
452 echo $auto->getList($query);
453 exit;
454 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exit

References ANONYMOUS_USER_ID, exit, ILIAS\FileDelivery\http(), ilUserAutoComplete\MAX_ENTRIES, ilUserAutoComplete\PRIVACY_MODE_RESPECT_USER_SETTING, ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ edit()

ilCalendarAppointmentGUI::edit ( bool  $a_edit_single_app = false,
?Form  $form = null 
)
protected

edit appointment

Definition at line 618 of file class.ilCalendarAppointmentGUI.php.

618 : void
619 {
620 $this->help->setScreenIdComponent("cal");
621 $this->help->setScreenId("app");
622 $this->help->setSubScreenId("edit");
623
624 $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt', 'idate'));
625 if ($this->requested_rexl) {
626 $this->ctrl->setParameter($this, 'rexl', 1);
627 // Calculate new appointment time
628 $duration = $this->getAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->getAppointment()->getStart()->get(IL_CAL_UNIX);
629 $calc = new ilCalendarRecurrenceCalculator($this->getAppointment(), $this->rec);
630
631 $current_date = new ilDateTime($this->getRecurrenceDateFromQuery(), IL_CAL_UNIX);
632
633 $yesterday = clone $current_date;
634 $yesterday->increment(IL_CAL_DAY, -1);
635 $tomorrow = clone $current_date;
636 $tomorrow->increment(IL_CAL_DAY, 1);
637
638 foreach ($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry) {
639 if (ilDateTime::_equals($current_date, $date_entry, IL_CAL_DAY)) {
640 $this->getAppointment()->setStart(new ilDateTime($date_entry->get(IL_CAL_UNIX), IL_CAL_UNIX));
641 $this->getAppointment()->setEnd(new ilDateTime(
642 $date_entry->get(IL_CAL_UNIX) + $duration,
644 ));
645 break;
646 }
647 }
648 // Finally reset recurrence
649 $this->rec = new ilCalendarRecurrence();
650 }
651
652 $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
653 $cats = ilCalendarCategories::_getInstance($this->user->getId());
654
655 if (!$cats->isVisible($cat_id)) {
656 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
657 return;
658 }
659 if (!$cats->isEditable($cat_id) or $this->app->isAutoGenerated()) {
660 $this->showInfoScreen();
661 return;
662 }
663 if (!$form) {
664 $form = $this->initForm('edit', $a_edit_single_app);
665 }
666 $this->tpl->setContent($this->ui_renderer->render($form));
667 }
$duration
const IL_CAL_DAY
Calculates an ilDateList for a given calendar entry and recurrence rule.
Model of calendar entry recurrcences based on iCalendar-RFC-5545.
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.

References $duration, $form, ilDateTime\_equals(), ilCalendarCategories\_getInstance(), ilCalendarCategoryAssignments\_lookupCategory(), ILIAS\Repository\ctrl(), error(), getAppointment(), getRecurrenceDateFromQuery(), ILIAS\Repository\help(), IL_CAL_DAY, IL_CAL_UNIX, ILIAS\Repository\lng(), showInfoScreen(), and ILIAS\Repository\user().

Referenced by askEdit(), editSingle(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSingle()

ilCalendarAppointmentGUI::editSingle ( )
protected

Edit one single appointment ^.

Definition at line 608 of file class.ilCalendarAppointmentGUI.php.

608 : void
609 {
610 $this->ctrl->setParameter($this, 'rexl', "1");
611 $this->requested_rexl = true;
612 $this->edit(true);
613 }

References ILIAS\Repository\ctrl(), and edit().

+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarAppointmentGUI::executeCommand ( )

Definition at line 133 of file class.ilCalendarAppointmentGUI.php.

133 : void
134 {
135 // Clear tabs and set back target
136 $this->tabs->clearTargets();
137 if ($this->http->wrapper()->query()->has('app_id')) {
138 $this->ctrl->saveParameter($this, 'app_id');
139 }
140 $this->tabs->setBackTarget(
141 $this->lng->txt('cal_back_to_cal'),
142 $this->ctrl->getLinkTarget($this, 'cancel')
143 );
144
145 $next_class = $this->ctrl->getNextClass($this);
146 switch ($next_class) {
147 default:
148 $cmd = $this->ctrl->getCmd("add");
149 $this->$cmd();
150 break;
151 }
152 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ getAppointment()

ilCalendarAppointmentGUI::getAppointment ( )

Definition at line 154 of file class.ilCalendarAppointmentGUI.php.

155 {
156 return $this->app;
157 }

References $app.

Referenced by askEdit(), edit(), and update().

+ Here is the caller graph for this function:

◆ getAppointmentIdFromQuery()

ilCalendarAppointmentGUI::getAppointmentIdFromQuery ( )
protected

Definition at line 93 of file class.ilCalendarAppointmentGUI.php.

93 : int
94 {
95 if ($this->http->wrapper()->query()->has('app_id')) {
96 return $this->http->wrapper()->query()->retrieve(
97 'app_id',
98 $this->refinery->kindlyTo()->int()
99 );
100 }
101 return 0;
102 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by book(), bookconfirmed(), cancelBooking(), confirmRegister(), and confirmUnregister().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecurrenceDateFromQuery()

ilCalendarAppointmentGUI::getRecurrenceDateFromQuery ( )
protected

Definition at line 122 of file class.ilCalendarAppointmentGUI.php.

122 : int
123 {
124 if ($this->http->wrapper()->query()->has('dt')) {
125 return $this->http->wrapper()->query()->retrieve(
126 'dt',
127 $this->refinery->kindlyTo()->int()
128 );
129 }
130 return 0;
131 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by edit(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecurrenceExclusionFromQuery()

ilCalendarAppointmentGUI::getRecurrenceExclusionFromQuery ( )
protected

Definition at line 104 of file class.ilCalendarAppointmentGUI.php.

104 : int
105 {
106 $val = 0;
107 if ($this->http->wrapper()->post()->has('rexl')) {
108 $val = $this->http->wrapper()->post()->retrieve(
109 'rexl',
110 $this->refinery->kindlyTo()->int()
111 );
112 }
113 if ($val === 0 && $this->http->wrapper()->query()->has('rexl')) {
114 $val = $this->http->wrapper()->query()->retrieve(
115 'rexl',
116 $this->refinery->kindlyTo()->int()
117 );
118 }
119 return $val;
120 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAppointment()

ilCalendarAppointmentGUI::initAppointment ( int  $a_app_id = 0)
protected

Definition at line 894 of file class.ilCalendarAppointmentGUI.php.

894 : void
895 {
896 $this->app = new ilCalendarEntry($a_app_id);
897 $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
898
899 if (!$a_app_id) {
900 $start = clone $this->initialDate;
901 $this->app->setStart($start);
902
903 $seed_end = clone $this->initialDate;
904 if ($this->default_fulltime) {
905 #$seed_end->increment(IL_CAL_DAY,1);
906 } else {
907 $seed_end->increment(IL_CAL_HOUR, 1);
908 }
909 $this->app->setEnd($seed_end);
910 $this->app->setFullday($this->default_fulltime);
911
912 $this->rec = new ilCalendarRecurrence();
913 } else {
914 $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
915 }
916 }
const IL_CAL_HOUR
increment(string $a_type, int $a_count=1)

References $initialDate, ilCalendarRecurrences\_getFirstRecurrence(), IL_CAL_HOUR, ilDateTime\increment(), and ILIAS\UI\examples\Symbol\Glyph\Notification\notification().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormConfirmBooking()

ilCalendarAppointmentGUI::initFormConfirmBooking ( )
protected

Definition at line 1203 of file class.ilCalendarAppointmentGUI.php.

1204 {
1205 $form = new ilPropertyFormGUI();
1206 $form->setFormAction($this->ctrl->getFormAction($this));
1207 $form->addCommandButton('bookconfirmed', $this->lng->txt('cal_confirm_booking'));
1208 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1209
1210 $date = new ilNonEditableValueGUI($this->lng->txt('appointment'), 'date');
1211 $form->addItem($date);
1212
1213 $title = new ilNonEditableValueGUI($this->lng->txt('title'), 'title');
1214 $form->addItem($title);
1215
1216 $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1217 $message->setRows(5);
1218 $form->addItem($message);
1219
1220 return $form;
1221 }
This class represents a non editable value in a property form.
This class represents a property form user interface.
This class represents a text area property in a property form.
$message
Definition: xapiexit.php:31

References $form, $message, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by book(), and bookconfirmed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initInitialDate()

ilCalendarAppointmentGUI::initInitialDate ( ilDate  $initialDate)
protected

Definition at line 860 of file class.ilCalendarAppointmentGUI.php.

860 : void
861 {
862 $hour = 0;
863 if ($this->http->wrapper()->query()->has('hour')) {
864 $hour = $this->http->wrapper()->query()->retrieve(
865 'hour',
866 $this->refinery->kindlyTo()->int()
867 );
868 }
869
870 if (!$hour) {
871 $this->initialDate = clone $initialDate;
872 $this->default_fulltime = true;
873 } else {
874 if ($hour < 10) {
875 $time = '0' . $hour . ':00:00';
876 } else {
877 $time = (int) $hour . ':00:00';
878 }
879 $this->initialDate = new ilDateTime(
880 $initialDate->get(IL_CAL_DATE) . ' ' . $time,
882 $this->timezone
883 );
884 $this->default_fulltime = false;
885 }
886 }
const IL_CAL_DATE
const IL_CAL_DATETIME
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date

References $initialDate, ilDateTime\get(), ILIAS\FileDelivery\http(), IL_CAL_DATE, IL_CAL_DATETIME, ILIAS\Repository\int(), and ILIAS\Repository\refinery().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSeed()

ilCalendarAppointmentGUI::initSeed ( ilDate  $seed)
protected

Definition at line 888 of file class.ilCalendarAppointmentGUI.php.

888 : void
889 {
890 $this->seed = clone $seed;
891 $this->default_fulltime = true;
892 }

References $seed.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

Definition at line 855 of file class.ilCalendarAppointmentGUI.php.

855 : void
856 {
857 $this->timezone = $this->user->getTimeZone();
858 }

References ILIAS\Repository\user().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadNotificationRecipients()

ilCalendarAppointmentGUI::loadNotificationRecipients ( array  $recipients)
protected
Parameters
string[]$recipients

Definition at line 961 of file class.ilCalendarAppointmentGUI.php.

961 : void
962 {
963 $this->notification->setRecipients([]);
964 $map = [];
965 foreach ($recipients as $rcp) {
966 $rcp = trim($rcp);
967 $usr_id = (int) ilObjUser::_loginExists($rcp);
968 if ($rcp === '') {
969 continue;
970 }
971 if (in_array($rcp, $map)) {
972 continue;
973 }
974 $map[] = $rcp;
975 if ($usr_id) {
976 $this->notification->addRecipient(
978 $usr_id
979 );
980 } else {
981 $this->notification->addRecipient(
983 0,
984 $rcp
985 );
986 }
987 }
988 }
static _loginExists(string $a_login, int $a_user_id=0)

References ilObjUser\_loginExists(), ILIAS\Repository\int(), ILIAS\UI\examples\Symbol\Glyph\Notification\notification(), ilCalendarUserNotification\TYPE_EMAIL, and ilCalendarUserNotification\TYPE_USER.

+ Here is the call graph for this function:

◆ loadRecurrenceSettings()

ilCalendarAppointmentGUI::loadRecurrenceSettings ( ?ilCalendarRecurrence  $recurrence)
protected

Definition at line 990 of file class.ilCalendarAppointmentGUI.php.

990 : void
991 {
992 if ($recurrence) {
993 $this->rec = $recurrence;
994 } else {
995 $this->rec = new ilCalendarRecurrence();
996 }
997 }

◆ readAndPrepareCalendarSelection()

ilCalendarAppointmentGUI::readAndPrepareCalendarSelection ( string  $mode)
protected

Definition at line 350 of file class.ilCalendarAppointmentGUI.php.

350 : int
351 {
352 $category_id = 0;
353 if ($this->http->wrapper()->query()->has('category_id')) {
354 $category_id = $this->http->wrapper()->query()->retrieve(
355 'category_id',
356 $this->refinery->kindlyTo()->int()
357 );
358 }
359 $ref_id = 0;
360 if ($this->http->wrapper()->query()->has('ref_id')) {
361 $ref_id = $this->http->wrapper()->query()->retrieve(
362 'ref_id',
363 $this->refinery->kindlyTo()->int()
364 );
365 }
366 $selected_calendar = 0;
367 if ($this->http->wrapper()->post()->has('calendar')) {
368 $selected_calendar = $this->http->wrapper()->post()->retrieve(
369 'calendar',
370 $this->refinery->kindlyTo()->int()
371 );
372 }
373
374 if ($selected_calendar > 0) {
375 return $selected_calendar;
376 }
377
378 if ($category_id) {
379 return (int) $category_id;
380 }
381
382 if ($mode == 'edit') {
383 $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
384 return $ass->getFirstAssignment();
385 }
386
387 if ($ref_id) {
389 $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal);
390 $cats = ilCalendarCategories::_getInstance($this->user->getId());
391 $cats->readSingleCalendar($selected_calendar);
392 return $selected_calendar;
393 }
394
395 $cats = ilCalendarCategories::_getInstance($this->user->getId());
396 $categories = $cats->prepareCategoriesOfUserForSelection();
397 return key($categories);
398 }
static _lookupCategoryIdByObjId(int $a_obj_id)
lookup category by obj_id
static _lookupObjId(int $ref_id)

References $ref_id, ilCalendarCategories\_getInstance(), ilCalendarCategories\_lookupCategoryIdByObjId(), ilObject\_lookupObjId(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ register()

ilCalendarAppointmentGUI::register ( )
protected

Definition at line 1073 of file class.ilCalendarAppointmentGUI.php.

1073 : void
1074 {
1075 $dstart = 0;
1076 if ($this->http->wrapper()->query()->has('dstart')) {
1077 $dstart = $this->http->wrapper()->query()->retrieve(
1078 'dstart',
1079 $this->refinery->kindlyTo()->int()
1080 );
1081 }
1082 $dend = 0;
1083 if ($this->http->wrapper()->query()->has('dend')) {
1084 $dend = $this->http->wrapper()->query()->retrieve(
1085 'dend',
1086 $this->refinery->kindlyTo()->int()
1087 );
1088 }
1089 $app_id = 0;
1090 if ($this->http->wrapper()->post()->has('app_id')) {
1091 $app_id = $this->http->wrapper()->post()->retrieve(
1092 'app_id',
1093 $this->refinery->kindlyTo()->int()
1094 );
1095 }
1096 $reg = new ilCalendarRegistration($app_id);
1097 $reg->register(
1098 $this->user->getId(),
1099 new ilDateTime($dstart, IL_CAL_UNIX),
1100 new ilDateTime((int) $dend, IL_CAL_UNIX)
1101 );
1102
1103 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_reg_registered'), true);
1104 $this->ctrl->returnToParent($this);
1105 }
registration for calendar appointments

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), IL_CAL_UNIX, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ save()

ilCalendarAppointmentGUI::save ( )
protected

Definition at line 471 of file class.ilCalendarAppointmentGUI.php.

471 : void
472 {
473 $data = $this->load('create');
474
475 if ($data && $this->app->validate() && $this->notification->validate()) {
476 if ((int) $data['calendar'] === 0) {
477 $cat_id = $this->createDefaultCalendar();
478 } else {
479 $cat_id = (int) $data['calendar'];
480 }
481
482 $this->app->save();
483 $this->notification->setEntryId($this->app->getEntryId());
484 $this->notification->save();
485 $this->rec->setEntryId($this->app->getEntryId());
486 $this->saveRecurrenceSettings();
487
488 $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
489 $ass->addAssignment($cat_id);
490
491 // Send notifications
492 if (
493 ilCalendarSettings::_getInstance()->isNotificationEnabled() &&
494 ($data['not'] ?? false)
495 ) {
496 $this->distributeNotifications($cat_id, $this->app->getEntryId(), true);
497 }
498 if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
500 }
501
502 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_created_appointment'), true);
503 $this->ctrl->returnToParent($this);
504 } else {
505 if ($data && $this->error->getMessage() !== '') {
506 $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
507 } else {
508 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
509 }
510 $this->add($this->form);
511 return;
512 }
513 $this->add();
514 }
add(?Form $form=null)
add new appointment
distributeUserNotifications()
Send mail to selected users.
distributeNotifications(int $a_cat_id, int $app_id, bool $a_new_appointment=true)
form( $class_path, string $cmd, string $submit_caption="")

References $data, ilCalendarSettings\_getInstance(), add(), createDefaultCalendar(), ILIAS\Repository\ctrl(), distributeNotifications(), distributeUserNotifications(), error(), ILIAS\Repository\form(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\UI\examples\Symbol\Glyph\Notification\notification(), and saveRecurrenceSettings().

+ Here is the call graph for this function:

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

Definition at line 999 of file class.ilCalendarAppointmentGUI.php.

999 : void
1000 {
1001 switch ($this->rec->getFrequenceType()) {
1002 case '':
1004 // No recurrence => delete if there is an recurrence rule
1005 if ($this->rec->getRecurrenceId()) {
1006 $this->rec->delete();
1007 }
1008 break;
1009
1010 default:
1011 if ($this->rec->getRecurrenceId()) {
1012 $this->rec->update();
1013 } else {
1014 $this->rec->save();
1015 }
1016 break;
1017 }
1018 }

References ilCalendarRecurrence\FREQ_NONE.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ showInfoScreen()

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

Definition at line 669 of file class.ilCalendarAppointmentGUI.php.

669 : void
670 {
671 $info = new ilInfoScreenGUI($this);
672 $info->setFormAction($this->ctrl->getFormAction($this));
673 $info->addSection($this->lng->txt('cal_details'));
674
675 // Appointment
676 $info->addProperty(
677 $this->lng->txt('appointment'),
679 $this->app->getStart(),
680 $this->app->getEnd()
681 )
682 );
683 $info->addProperty($this->lng->txt('title'), $this->app->getPresentationTitle());
684
685 // Description
686 if (strlen($desc = $this->app->getDescription())) {
687 $info->addProperty($this->lng->txt('description'), $desc);
688 }
689
690 // Location
691 if (strlen($loc = $this->app->getLocation())) {
692 $info->addProperty($this->lng->txt('cal_where'), $loc);
693 }
694
695 $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
696 $category = new ilCalendarCategory($cat_id);
697
698 if ($category->getType() == ilCalendarCategory::TYPE_OBJ) {
699 $info->addSection($this->lng->txt('additional_info'));
700
701 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
702 $refs = ilObject::_getAllReferences($cat_info['obj_id']);
703
704 $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($cat_info['obj_id']), true);
705 $info->addProperty(
706 $this->lng->txt('perma_link'),
707 '<a class="small" href="' . $href . '" target="_top">' . $href . '</a>'
708 );
709 }
710 $this->tpl->setContent($info->getHTML());
711 }
Class ilInfoScreenGUI.
static _lookupType(int $id, bool $reference=false)
$info
Definition: entry_point.php:21

References $info, ilObject\_getAllReferences(), ilCalendarCategories\_getInstance(), ilLink\_getStaticLink(), ilCalendarCategoryAssignments\_lookupCategory(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), ILIAS\Repository\lng(), and ilCalendarCategory\TYPE_OBJ.

Referenced by edit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unregister()

ilCalendarAppointmentGUI::unregister ( )
protected

Unregister calendar, was confirmed.

Definition at line 1147 of file class.ilCalendarAppointmentGUI.php.

1147 : void
1148 {
1149 $dstart = 0;
1150 if ($this->http->wrapper()->query()->has('dstart')) {
1151 $dstart = $this->http->wrapper()->query()->retrieve(
1152 'dstart',
1153 $this->refinery->kindlyTo()->int()
1154 );
1155 }
1156 $dend = 0;
1157 if ($this->http->wrapper()->query()->has('dend')) {
1158 $dend = $this->http->wrapper()->query()->retrieve(
1159 'dend',
1160 $this->refinery->kindlyTo()->int()
1161 );
1162 }
1163 $app_id = 0;
1164 if ($this->http->wrapper()->post()->has('app_id')) {
1165 $app_id = $this->http->wrapper()->post()->retrieve(
1166 'app_id',
1167 $this->refinery->kindlyTo()->int()
1168 );
1169 }
1170 $reg = new ilCalendarRegistration($app_id);
1171 $reg->unregister(
1172 $this->user->getId(),
1173 new ilDateTime((int) $dstart, IL_CAL_UNIX),
1174 new ilDateTime((int) $dend, IL_CAL_UNIX)
1175 );
1176
1177 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_reg_unregistered'), true);
1178 $this->ctrl->returnToParent($this);
1179 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), IL_CAL_UNIX, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ update()

ilCalendarAppointmentGUI::update ( )
protected

Definition at line 713 of file class.ilCalendarAppointmentGUI.php.

713 : void
714 {
715 $single_editing = $this->requested_rexl;
716 $data = $this->load('edit');
717
718 if ($data && $this->app->validate() && $this->notification->validate()) {
719 if (!(int) $data['calendar']) {
720 $cat_id = $this->createDefaultCalendar();
721 } else {
722 $cat_id = (int) $data['calendar'];
723 }
724
725 if ($single_editing) {
726 $original_id = $this->getAppointment()->getEntryId();
727 $this->getAppointment()->save();
728 $selected_ut = $this->getRecurrenceDateFromQuery();
729 if ($selected_ut > 0) {
730 $exclusion = new ilCalendarRecurrenceExclusion();
731 $exclusion->setEntryId($original_id);
732 $exclusion->setDate(new ilDate($selected_ut, IL_CAL_UNIX));
733 $this->logger->dump($this->getAppointment()->getEntryId());
734 $this->logger->dump(ilDatePresentation::formatDate(new ilDate($selected_ut, IL_CAL_UNIX)));
735 $exclusion->save();
736 }
737 $this->rec = new ilCalendarRecurrence();
738 $this->rec->setEntryId($this->getAppointment()->getEntryId());
739 } else {
740 $this->getAppointment()->update();
741 }
742 $this->notification->save();
743 $this->saveRecurrenceSettings();
744 $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
745 $ass->deleteAssignments();
746 $ass->addAssignment($cat_id);
747
748 // Send notifications
749 $notification = (bool) ($data['not'] ?? false);
750 if (
751 ilCalendarSettings::_getInstance()->isNotificationEnabled() &&
753 ) {
754 $this->distributeNotifications($cat_id, $this->app->getEntryId(), false);
755 }
756 if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
758 }
759
760 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
761 $this->ctrl->returnToParent($this);
762 } elseif ($data && $this->error->getMessage() !== '') {
763 $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
764 } else {
765 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
766 }
767 $this->edit(false, $this->form);
768 }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)

References $data, $notification, $requested_rexl, ilCalendarSettings\_getInstance(), createDefaultCalendar(), ILIAS\Repository\ctrl(), distributeNotifications(), distributeUserNotifications(), edit(), error(), ILIAS\Repository\form(), ilDatePresentation\formatDate(), getAppointment(), getRecurrenceDateFromQuery(), IL_CAL_UNIX, ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), ILIAS\UI\examples\Symbol\Glyph\Notification\notification(), and saveRecurrenceSettings().

+ Here is the call graph for this function:

Field Documentation

◆ $app

ilCalendarEntry ilCalendarAppointmentGUI::$app
protected

Definition at line 44 of file class.ilCalendarAppointmentGUI.php.

Referenced by delete(), and getAppointment().

◆ $ctrl

ilCtrlInterface ilCalendarAppointmentGUI::$ctrl
protected

Definition at line 50 of file class.ilCalendarAppointmentGUI.php.

◆ $default_fulltime

bool ilCalendarAppointmentGUI::$default_fulltime = true
protected

Definition at line 43 of file class.ilCalendarAppointmentGUI.php.

◆ $error

ilErrorHandling ilCalendarAppointmentGUI::$error
protected

Definition at line 55 of file class.ilCalendarAppointmentGUI.php.

◆ $form

Form ilCalendarAppointmentGUI::$form
private

◆ $help

ilHelpGUI ilCalendarAppointmentGUI::$help
protected

Definition at line 54 of file class.ilCalendarAppointmentGUI.php.

◆ $http

HTTPServices ilCalendarAppointmentGUI::$http
protected

Definition at line 57 of file class.ilCalendarAppointmentGUI.php.

◆ $initialDate

ilDateTime ilCalendarAppointmentGUI::$initialDate
protected

Definition at line 42 of file class.ilCalendarAppointmentGUI.php.

Referenced by initAppointment(), and initInitialDate().

◆ $lng

ilLanguage ilCalendarAppointmentGUI::$lng
protected

Definition at line 49 of file class.ilCalendarAppointmentGUI.php.

◆ $logger

ilLogger ilCalendarAppointmentGUI::$logger
private

Definition at line 56 of file class.ilCalendarAppointmentGUI.php.

◆ $notification

ilCalendarUserNotification ilCalendarAppointmentGUI::$notification
private

◆ $rec

ilCalendarRecurrence ilCalendarAppointmentGUI::$rec
protected

Definition at line 45 of file class.ilCalendarAppointmentGUI.php.

Referenced by askEdit().

◆ $refinery

RefineryFactory ilCalendarAppointmentGUI::$refinery
protected

Definition at line 58 of file class.ilCalendarAppointmentGUI.php.

◆ $request

RequestInterface ilCalendarAppointmentGUI::$request
protected

Definition at line 59 of file class.ilCalendarAppointmentGUI.php.

◆ $requested_rexl

bool ilCalendarAppointmentGUI::$requested_rexl
protected

Definition at line 39 of file class.ilCalendarAppointmentGUI.php.

Referenced by update().

◆ $seed

ilDate ilCalendarAppointmentGUI::$seed
protected

Definition at line 41 of file class.ilCalendarAppointmentGUI.php.

Referenced by initSeed().

◆ $settings

ilSetting ilCalendarAppointmentGUI::$settings
protected

Definition at line 53 of file class.ilCalendarAppointmentGUI.php.

◆ $tabs

ilTabsGUI ilCalendarAppointmentGUI::$tabs
protected

Definition at line 52 of file class.ilCalendarAppointmentGUI.php.

◆ $timezone

string ilCalendarAppointmentGUI::$timezone
protected

Definition at line 46 of file class.ilCalendarAppointmentGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilCalendarAppointmentGUI::$tpl
protected

Definition at line 48 of file class.ilCalendarAppointmentGUI.php.

◆ $ui_factory

UIFactory ilCalendarAppointmentGUI::$ui_factory
protected

Definition at line 60 of file class.ilCalendarAppointmentGUI.php.

◆ $ui_renderer

UIRenderer ilCalendarAppointmentGUI::$ui_renderer
protected

Definition at line 61 of file class.ilCalendarAppointmentGUI.php.

◆ $user

ilObjUser ilCalendarAppointmentGUI::$user
protected

Definition at line 51 of file class.ilCalendarAppointmentGUI.php.

Referenced by book().


The documentation for this class was generated from the following file: