ILIAS  release_8 Revision v8.23
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 ()
 
 editResponsibleUsers ()
 
 showResponsibleUsersList (int $a_grp_id)
 Show responsible uses of a milestone (default set is participants of group) More...
 
 saveMilestoneResponsibleUsers ()
 Save milestone responsibilites. More...
 
 confirmUnregister ()
 
 book ()
 Confirmation screen for booking of consultation appointment. More...
 
 bookconfirmed ()
 Book consultation appointment, was confirmed. More...
 
 cancelBooking ()
 Confirmation screen to cancel consultation appointment or ressource booking depends on calendar category. More...
 
 cancelConfirmed ()
 Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar entry. More...
 

Protected Member Functions

 getAppointmentIdFromQuery ()
 
 getRecurrenceExclusionFromQuery ()
 
 getRecurrenceDateFromQuery ()
 
 cancel ()
 
 initForm (string $a_mode, bool $a_as_milestone=false, bool $a_edit_single_app=false)
 
 doUserAutoComplete ()
 
 add (?ilPropertyFormGUI $form=null)
 add new appointment More...
 
 addMilestone ()
 add milestone More...
 
 saveMilestone ()
 
 save (bool $a_as_milestone=false)
 
 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, ilPropertyFormGUI $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)
 
 load ($a_mode, $a_as_milestone=false)
 
 loadNotificationRecipients (ilPropertyFormGUI $form)
 
 loadRecurrenceSettings (ilPropertyFormGUI $form, bool $a_as_milestone=false)
 
 saveRecurrenceSettings ()
 
 createDefaultCalendar ()
 
 confirmRegister ()
 Register to an appointment. More...
 
 register ()
 
 unregister ()
 Unregister calendar, was confirmed. More...
 
 initFormConfirmBooking ()
 
 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
 

Private Attributes

ilPropertyFormGUI $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 31 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 60 of file class.ilCalendarAppointmentGUI.php.

References $DIC, ILIAS\Repository\ctrl(), 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().

61  {
62  global $DIC;
63 
64  $this->lng = $DIC->language();
65  $this->lng->loadLanguageModule('dateplaner');
66  $this->ctrl = $DIC->ctrl();
67  $this->tpl = $DIC->ui()->mainTemplate();
68  $this->logger = $DIC->logger()->cal();
69  $this->user = $DIC->user();
70  $this->settings = $DIC->settings();
71  $this->tabs = $DIC->tabs();
72  $this->help = $DIC->help();
73  $this->error = $DIC['ilErr'];
74 
75  $this->http = $DIC->http();
76  $this->refinery = $DIC->refinery();
77  $this->request = $DIC->http()->request();
78 
79  $this->initTimeZone();
80  $this->initSeed($seed);
81  $this->initInitialDate($initialDate);
82  $this->initAppointment($a_appointment_id);
83  $this->requested_rexl = (bool) $this->getRecurrenceExclusionFromQuery();
84  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

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

add new appointment

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

References ilPropertyFormGUI\getHTML(), ILIAS\Repository\help(), and initForm().

Referenced by save().

441  : void
442  {
443  $this->help->setScreenIdComponent("cal");
444  $this->help->setScreenId("app");
445  $this->help->setSubScreenId("create");
446 
447  if (!$form instanceof ilPropertyFormGUI) {
448  $form = $this->initForm('create');
449  }
450  $this->tpl->setContent($form->getHTML());
451  }
initForm(string $a_mode, bool $a_as_milestone=false, bool $a_edit_single_app=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMilestone()

ilCalendarAppointmentGUI::addMilestone ( )
protected

add milestone

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

References ilPropertyFormGUI\getHTML(), ILIAS\Repository\help(), and initForm().

Referenced by save().

456  : void
457  {
458  $this->help->setScreenIdComponent("cal");
459  $this->help->setScreenId("app");
460  $this->help->setSubScreenId("create_milestone");
461 
462  $form = $this->initForm('create', true);
463  $this->tpl->setContent($form->getHTML());
464  }
initForm(string $a_mode, bool $a_as_milestone=false, bool $a_edit_single_app=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ askDelete()

ilCalendarAppointmentGUI::askDelete ( )
protected

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

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

868  : void
869  {
870  $this->ctrl->saveParameter(
871  $this,
872  [
873  'seed',
874  'app_id',
875  'dt',
876  'idate'
877  ]
878  );
879 
880  $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
881  if (!$app_id) {
882  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
883  $this->ctrl->returnToParent($this);
884  }
885 
886  $entry = new ilCalendarEntry($app_id);
888  if (
889  !count($recs) ||
890  $this->app->isMilestone()
891  ) {
892  $confirm = new ilConfirmationGUI();
893  $confirm->setFormAction($this->ctrl->getFormAction($this));
894  $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
895  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
896  $confirm->addItem('appointments[]', (string) $this->app->getEntryId(), $this->app->getTitle());
897  $confirm->setConfirm($this->lng->txt('delete'), 'delete');
898  $this->tpl->setContent($confirm->getHTML());
899  } else {
900  $table = new ilCalendarRecurrenceTableGUI(
901  $this->app,
902  $this,
903  'askDelete'
904  );
905  $table->init();
906  $table->parse();
907  $this->tpl->setContent($table->getHTML());
908  $this->tpl->setOnScreenMessage('question', $this->lng->txt('cal_delete_app_sure'));
909  $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_recurrence_confirm_deletion'));
910  }
911  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getRecurrences(int $a_cal_id)
get all recurrences of an appointment
Class ilCalendarRecurrenceTableGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ askEdit()

ilCalendarAppointmentGUI::askEdit ( )
protected

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

Todo:
works with milestones???

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

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

645  : void
646  {
647  // check for recurring entries
649  if (!$rec) {
650  $this->edit(true);
651  return;
652  }
653  // Show edit single/all appointments
654  $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt', 'idate'));
655 
656  $confirm = new ilConfirmationGUI();
657  $confirm->setHeaderText($this->lng->txt('cal_edit_single_or_all_info'));
658  $confirm->setFormAction($this->ctrl->getFormAction($this));
659  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
660  $confirm->addItem('appointments[]', (string) $this->app->getEntryId(), $this->app->getTitle());
661  $confirm->addButton($this->lng->txt('cal_edit_single'), 'editSingle');
662  $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'), 'edit');
663 
664  $this->tpl->setContent($confirm->getHTML());
665  }
static _getRecurrences(int $a_cal_id)
get all recurrences of an appointment
edit(bool $a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ book()

ilCalendarAppointmentGUI::book ( )

Confirmation screen for booking of consultation appointment.

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

References ilObjUser\_lookupFullname(), ILIAS\Repository\ctrl(), ilDatePresentation\formatPeriod(), getAppointmentIdFromQuery(), ilPropertyFormGUI\getHTML(), ilPropertyFormGUI\getItemByPostVar(), and initFormConfirmBooking().

1281  : void
1282  {
1283  $entry_id = $this->getAppointmentIdFromQuery();
1284  $this->ctrl->saveParameter($this, 'app_id');
1285 
1286  $entry = new ilCalendarEntry($entry_id);
1287  $booking = new \ilBookingEntry($entry->getContextId());
1288  $user = $booking->getObjId();
1289 
1290  $form = $this->initFormConfirmBooking();
1292  $entry->getStart(),
1293  $entry->getEnd()
1294  ));
1295  $form->getItemByPostVar('title')->setValue($entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')');
1296 
1297  $this->tpl->setContent($form->getHTML());
1298  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getItemByPostVar(string $a_post_var)
static _lookupFullname(int $a_user_id)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
+ Here is the call graph for this function:

◆ bookconfirmed()

ilCalendarAppointmentGUI::bookconfirmed ( )

Book consultation appointment, was confirmed.

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

References $GLOBALS, ilConsultationHourUtils\bookAppointment(), ilPropertyFormGUI\checkInput(), ILIAS\Repository\ctrl(), getAppointmentIdFromQuery(), ilPropertyFormGUI\getInput(), initFormConfirmBooking(), ILIAS\Repository\lng(), ILIAS\Repository\user(), and ilBookingEntry\writeBookingMessage().

1324  {
1325  $entry = $this->getAppointmentIdFromQuery();
1326  $form = $this->initFormConfirmBooking();
1327  if ($form->checkInput()) {
1328  // check if appointment is bookable
1329  $cal_entry = new ilCalendarEntry($entry);
1330 
1331  $booking = new ilBookingEntry($cal_entry->getContextId());
1332 
1333  if (!$booking->isAppointmentBookableForUser($entry, $GLOBALS['DIC']['ilUser']->getId())) {
1334  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_booking_failed_info'), true);
1335  $this->ctrl->returnToParent($this);
1336  }
1337 
1338  ilConsultationHourUtils::bookAppointment($this->user->getId(), $entry);
1339  ilBookingEntry::writeBookingMessage($entry, $this->user->getId(), $form->getInput('comment'));
1340  }
1341  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_booking_confirmed'), true);
1342  $this->ctrl->returnToParent($this);
1343  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static writeBookingMessage(int $a_entry_id, int $a_usr_id, string $a_message)
Write booking message.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
static bookAppointment(int $a_usr_id, int $a_app_id)
Book an appointment.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ calendarEntryToCategory()

ilCalendarAppointmentGUI::calendarEntryToCategory ( ilCalendarEntry  $entry)
protected

Get category object of given calendar entry.

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

References ilCalendarEntry\getEntryId(), and ilCalendarCategoryAssignments\getFirstAssignment().

Referenced by cancelBooking(), and cancelConfirmed().

1433  {
1434  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1435  $assignment = $assignment->getFirstAssignment();
1436  return new ilCalendarCategory($assignment);
1437  }
Stores calendar categories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilCalendarAppointmentGUI::cancel ( )
protected

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

References ILIAS\Repository\ctrl().

153  : void
154  {
155  $this->ctrl->returnToParent($this);
156  }
+ Here is the call graph for this function:

◆ cancelBooking()

ilCalendarAppointmentGUI::cancelBooking ( )

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

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

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

1349  : void
1350  {
1351  $entry = $this->getAppointmentIdFromQuery();
1352  $entry = new ilCalendarEntry($entry);
1353 
1354  $category = $this->calendarEntryToCategory($entry);
1355  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1356  $booking = new ilBookingEntry($entry->getContextId());
1357  if (!$booking->hasBooked($entry->getEntryId())) {
1358  $this->ctrl->returnToParent($this);
1359  return;
1360  }
1361 
1362  $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
1363  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1364  $entry_title = ' ' . $entry->getTitle();
1365  } else {
1366  $this->ctrl->returnToParent($this);
1367  return;
1368  }
1369 
1370  $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1371 
1372  $conf = new ilConfirmationGUI();
1373  $conf->setFormAction($this->ctrl->getFormAction($this));
1374  $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
1375  $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
1376  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1377  $conf->addItem('app_id', (string) $entry->getEntryId(), $title . ' - ' . $entry_title);
1378 
1379  $this->tpl->setContent($conf->getHTML());
1380  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupFullname(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ cancelConfirmed()

ilCalendarAppointmentGUI::cancelConfirmed ( )

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

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

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

1386  : void
1387  {
1388  $app_id = 0;
1389  if ($this->http->wrapper()->post()->has('app_id')) {
1390  $app_id = $this->http->wrapper()->post()->retrieve(
1391  'app_id',
1392  $this->refinery->kindlyTo()->int()
1393  );
1394  }
1395  $entry = new ilCalendarEntry($app_id);
1396  $category = $this->calendarEntryToCategory($entry);
1397  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1398  // find cloned calendar entry in user calendar
1400  $this->user->getId(),
1401  $entry->getContextId(),
1402  $entry->getStart(),
1404  false
1405  );
1406 
1407  // Fix for wrong, old entries
1408  foreach ($apps as $own_app) {
1409  $ref_entry = new ilCalendarEntry($own_app);
1410  $ref_entry->delete();
1411  }
1412 
1413  $booking = new ilBookingEntry($entry->getContextId());
1414  $booking->cancelBooking($entry->getEntryId());
1415 
1416  // do NOT delete original entry
1417  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1418  $booking = new ilBookingReservation($entry->getContextId());
1420  $booking->update();
1421 
1422  $entry->delete();
1423  }
1424 
1425  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_cancel_booking_confirmed'), true);
1426  $this->ctrl->returnToParent($this);
1427  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 http()
Fetches the global http state from ILIAS.
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
cancelBooking(int $a_entry_id, ?int $a_user_id=null)
cancel calendar booking for user
setStatus(?int $a_status)
Set booking status.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ confirmRegister()

ilCalendarAppointmentGUI::confirmRegister ( )
protected

Register to an appointment.

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

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

1134  : void
1135  {
1136  $dstart = 0;
1137  if ($this->http->wrapper()->query()->has('dstart')) {
1138  $dstart = $this->http->wrapper()->query()->retrieve(
1139  'dstart',
1140  $this->refinery->kindlyTo()->int()
1141  );
1142  }
1143  $dend = 0;
1144  if ($this->http->wrapper()->query()->has('dend')) {
1145  $dend = $this->http->wrapper()->query()->retrieve(
1146  'dend',
1147  $this->refinery->kindlyTo()->int()
1148  );
1149  }
1150 
1151  $app_id = $this->getAppointmentIdFromQuery();
1152  $entry = new ilCalendarEntry($app_id);
1154  new ilDateTime($dstart, IL_CAL_UNIX),
1155  new ilDateTime($dend, IL_CAL_UNIX)
1156  );
1157 
1158  $conf = new ilConfirmationGUI();
1159  $this->ctrl->setParameter($this, 'dstart', $dstart);
1160  $this->ctrl->setParameter($this, 'dend', $dend);
1161 
1162  $conf->setFormAction($this->ctrl->getFormAction($this));
1163  $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1164  $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1165  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1166  $conf->addItem('app_id', (string) $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1167  $this->tpl->setContent($conf->getHTML());
1168  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
static http()
Fetches the global http state from ILIAS.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ confirmUnregister()

ilCalendarAppointmentGUI::confirmUnregister ( )

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

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

1204  : void
1205  {
1206  $dstart = 0;
1207  if ($this->http->wrapper()->query()->has('dstart')) {
1208  $dstart = $this->http->wrapper()->query()->retrieve(
1209  'dstart',
1210  $this->refinery->kindlyTo()->int()
1211  );
1212  }
1213  $dend = 0;
1214  if ($this->http->wrapper()->query()->has('dend')) {
1215  $dend = $this->http->wrapper()->query()->retrieve(
1216  'dend',
1217  $this->refinery->kindlyTo()->int()
1218  );
1219  }
1220 
1221  $app_id = $this->getAppointmentIdFromQuery();
1222  $entry = new ilCalendarEntry($app_id);
1224  new ilDateTime($dstart, IL_CAL_UNIX),
1225  new ilDateTime($dend, IL_CAL_UNIX)
1226  );
1227 
1228  $this->ctrl->setParameter($this, 'dstart', (int) $dstart);
1229  $this->ctrl->setParameter($this, 'dend', (int) $dend);
1230 
1231  $conf = new ilConfirmationGUI();
1232  $conf->setFormAction($this->ctrl->getFormAction($this));
1233  $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1234  $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1235  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1236  $conf->addItem('app_id', (string) $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1237 
1238  $this->tpl->setContent($conf->getHTML());
1239  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
static http()
Fetches the global http state from ILIAS.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ createDefaultCalendar()

ilCalendarAppointmentGUI::createDefaultCalendar ( )
protected

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

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

Referenced by save(), and update().

1117  : int
1118  {
1119  $cat = new ilCalendarCategory();
1120  $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1121  $cat->setType(ilCalendarCategory::TYPE_USR);
1122  $cat->setTitle($this->lng->txt('cal_default_calendar'));
1123  $cat->setObjId($this->user->getId());
1124 
1125  // delete calendar cache
1126  ilCalendarCache::getInstance()->deleteUserEntries($this->user->getId());
1127 
1128  return $cat->add();
1129  }
Stores calendar categories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarAppointmentGUI::delete ( )
protected

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

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

913  : void
914  {
915  $app_ids = (array) ($this->request->getParsedBody()['appointment_ids'] ?? []);
916  if (!$app_ids) {
917  $this->logger->dump($app_ids);
918  $app_ids = (array) ($this->request->getQueryParams()['app_id'] ?? []);
919  }
920  if (!$app_ids) {
921  $this->ctrl->returnToParent($this);
922  }
923  foreach ($app_ids as $app_id) {
924  $app_id = (int) $app_id;
925  $app = new ilCalendarEntry($app_id);
926  $app->delete();
929  }
930  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
931  $this->ctrl->returnToParent($this);
932  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.
+ Here is the call graph for this function:

◆ deleteExclude()

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

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

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

934  : void
935  {
936  $recurrence_ids = (array) ($this->request->getParsedBody()['recurrence_ids'] ?? []);
937  $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
938  if (!count($recurrence_ids)) {
939  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
940  $this->ctrl->redirect($this, 'askDelete');
941  }
942  if (!$app_id) {
943  $this->ctrl->returnToParent($this);
944  }
945  foreach ($recurrence_ids as $rdate) {
946  $exclusion = new ilCalendarRecurrenceExclusion();
947  $exclusion->setEntryId($app_id);
948  $exclusion->setDate(new ilDate($rdate, IL_CAL_UNIX));
949  $exclusion->save();
950  }
951  if ($a_return) {
952  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
953  $this->ctrl->returnToParent($this);
954  }
955  }
const IL_CAL_UNIX
Stores exclusion dates for calendar recurrences.
+ 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 563 of file class.ilCalendarAppointmentGUI.php.

References $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().

563  : void
564  {
565  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
566 
568  $notification->setAppointmentId($app_id);
569 
570  switch ($cat_info['type']) {
572 
573  switch ($cat_info['obj_type']) {
574  case 'crs':
575  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
576  $ref_id = current($ref_ids);
577  $notification->setRefId($ref_id);
578  $notification->setType(
579  $a_new_appointment ?
582  );
583  break;
584 
585  case 'grp':
586  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
587  $ref_id = current($ref_ids);
588  $notification->setRefId($ref_id);
589  $notification->setType(
590  $a_new_appointment ?
593  );
594  break;
595  }
596  break;
597  }
598  $notification->send();
599  }
ilCalendarUserNotification $notification
Distributes calendar mail notifications.
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67
static _getInstance($a_usr_id=0)
get singleton instance
+ 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 540 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

540  : void
541  {
543  $notification->setAppointmentId($this->app->getEntryId());
544 
545  foreach ($this->notification->getRecipients() as $rcp) {
546  switch ($rcp['type']) {
548  $notification->setSender(ANONYMOUS_USER_ID);
549  $notification->setRecipients(array($rcp['usr_id']));
551  break;
552 
554  $notification->setSender(ANONYMOUS_USER_ID);
555  $notification->setRecipients(array($rcp['email']));
557  break;
558  }
559  $notification->send();
560  }
561  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
ilCalendarUserNotification $notification
Distributes calendar mail notifications.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUserAutoComplete()

ilCalendarAppointmentGUI::doUserAutoComplete ( )
protected

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

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

394  : ?string
395  {
396  // hide anonymout request
397  if ($this->user->getId() == ANONYMOUS_USER_ID) {
398  return json_encode(new stdClass(), JSON_THROW_ON_ERROR);
399  }
400  if (!$this->http->wrapper()->query()->has('autoCompleteField')) {
401  $a_fields = [
402  'login',
403  'firstname',
404  'lastname',
405  'email'
406  ];
407  $result_field = 'login';
408  } else {
409  $auto_complete_field = $this->http->wrapper()->query()->retrieve(
410  'autoCompleteField',
411  $this->refinery->kindlyTo()->string()
412  );
413  $a_fields = [$auto_complete_field];
414  $result_field = $auto_complete_field;
415  }
416  $auto = new ilUserAutoComplete();
418 
419  if ($this->http->wrapper()->query()->has('fetchall')) {
420  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
421  }
422 
423  $auto->setMoreLinkAvailable(true);
424  $auto->setSearchFields($a_fields);
425  $auto->setResultField($result_field);
426  $auto->enableFieldSearchableCheck(true);
427  $query = '';
428  if ($this->http->wrapper()->post()->has('term')) {
429  $query = $this->http->wrapper()->post()->retrieve(
430  'term',
431  $this->refinery->kindlyTo()->string()
432  );
433  }
434  echo $auto->getList($query);
435  return null;
436  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
$query
+ Here is the call graph for this function:

◆ edit()

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

edit appointment

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

References ilDateTime\_equals(), ilCalendarCategories\_getInstance(), ilCalendarCategoryAssignments\_lookupCategory(), ILIAS\Repository\ctrl(), getAppointment(), ilPropertyFormGUI\getHTML(), getRecurrenceDateFromQuery(), ILIAS\Repository\help(), IL_CAL_DAY, IL_CAL_UNIX, initForm(), ILIAS\Repository\lng(), showInfoScreen(), and ILIAS\Repository\user().

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

680  : void
681  {
682  $this->help->setScreenIdComponent("cal");
683  $this->help->setScreenId("app");
684  if ($this->app->isMilestone()) {
685  $this->help->setSubScreenId("edit_milestone");
686  } else {
687  $this->help->setSubScreenId("edit");
688  }
689 
690  $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt', 'idate'));
691  if ($this->requested_rexl) {
692  $this->ctrl->setParameter($this, 'rexl', 1);
693  // Calculate new appointment time
694  $duration = $this->getAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->getAppointment()->getStart()->get(IL_CAL_UNIX);
695  $calc = new ilCalendarRecurrenceCalculator($this->getAppointment(), $this->rec);
696 
697  $current_date = new ilDateTime($this->getRecurrenceDateFromQuery(), IL_CAL_UNIX);
698 
699  $yesterday = clone $current_date;
700  $yesterday->increment(IL_CAL_DAY, -1);
701  $tomorrow = clone $current_date;
702  $tomorrow->increment(IL_CAL_DAY, 1);
703 
704  foreach ($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry) {
705  if (ilDateTime::_equals($current_date, $date_entry, IL_CAL_DAY)) {
706  $this->getAppointment()->setStart(new ilDateTime($date_entry->get(IL_CAL_UNIX), IL_CAL_UNIX));
707  $this->getAppointment()->setEnd(new ilDateTime(
708  $date_entry->get(IL_CAL_UNIX) + $duration,
710  ));
711  break;
712  }
713  }
714  // Finally reset recurrence
715  $this->rec = new ilCalendarRecurrence();
716  }
717 
718  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
719  $cats = ilCalendarCategories::_getInstance($this->user->getId());
720 
721  if (!$cats->isVisible($cat_id)) {
722  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
723  return;
724  }
725  if (!$cats->isEditable($cat_id) or $this->app->isAutoGenerated()) {
726  $this->showInfoScreen();
727  return;
728  }
729  if (!$form instanceof ilPropertyFormGUI) {
730  $form = $this->initForm('edit', $this->app->isMilestone(), $a_edit_single_app);
731  }
732  $this->tpl->setContent($form->getHTML());
733  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
const IL_CAL_DAY
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initForm(string $a_mode, bool $a_as_milestone=false, bool $a_edit_single_app=false)
static _getInstance($a_usr_id=0)
get singleton instance
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editResponsibleUsers()

ilCalendarAppointmentGUI::editResponsibleUsers ( )

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

References ilCalendarCategories\_getInstance(), ilCalendarCategoryAssignments\_lookupCategory(), and showResponsibleUsersList().

601  : void
602  {
603  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
604  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
605  $this->showResponsibleUsersList($cat_info['obj_id']);
606  }
static _getInstance($a_usr_id=0)
get singleton instance
showResponsibleUsersList(int $a_grp_id)
Show responsible uses of a milestone (default set is participants of group)
+ Here is the call graph for this function:

◆ editSingle()

ilCalendarAppointmentGUI::editSingle ( )
protected

Edit one single appointment ^.

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

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

670  : void
671  {
672  $this->ctrl->setParameter($this, 'rexl', "1");
673  $this->requested_rexl = true;
674  $this->edit(true);
675  }
edit(bool $a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarAppointmentGUI::executeCommand ( )

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

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

126  : void
127  {
128  // Clear tabs and set back target
129  $this->tabs->clearTargets();
130  if ($this->http->wrapper()->query()->has('app_id')) {
131  $this->ctrl->saveParameter($this, 'app_id');
132  }
133  $this->tabs->setBackTarget(
134  $this->lng->txt('cal_back_to_cal'),
135  $this->ctrl->getLinkTarget($this, 'cancel')
136  );
137 
138  $next_class = $this->ctrl->getNextClass($this);
139  switch ($next_class) {
140 
141  default:
142  $cmd = $this->ctrl->getCmd("add");
143  $this->$cmd();
144  break;
145  }
146  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getAppointment()

ilCalendarAppointmentGUI::getAppointment ( )

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

References $app.

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

149  {
150  return $this->app;
151  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getAppointmentIdFromQuery()

ilCalendarAppointmentGUI::getAppointmentIdFromQuery ( )
protected

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

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

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

86  : int
87  {
88  if ($this->http->wrapper()->query()->has('app_id')) {
89  return $this->http->wrapper()->query()->retrieve(
90  'app_id',
91  $this->refinery->kindlyTo()->int()
92  );
93  }
94  return 0;
95  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecurrenceDateFromQuery()

ilCalendarAppointmentGUI::getRecurrenceDateFromQuery ( )
protected

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

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

Referenced by edit(), and update().

115  : int
116  {
117  if ($this->http->wrapper()->query()->has('dt')) {
118  return $this->http->wrapper()->query()->retrieve(
119  'dt',
120  $this->refinery->kindlyTo()->int()
121  );
122  }
123  return 0;
124  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecurrenceExclusionFromQuery()

ilCalendarAppointmentGUI::getRecurrenceExclusionFromQuery ( )
protected

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

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

Referenced by __construct().

97  : int
98  {
99  $val = 0;
100  if ($this->http->wrapper()->post()->has('rexl')) {
101  $val = $this->http->wrapper()->post()->retrieve(
102  'rexl',
103  $this->refinery->kindlyTo()->int()
104  );
105  }
106  if ($val === 0 && $this->http->wrapper()->query()->has('rexl')) {
107  $val = $this->http->wrapper()->query()->retrieve(
108  'rexl',
109  $this->refinery->kindlyTo()->int()
110  );
111  }
112  return $val;
113  }
static http()
Fetches the global http state from ILIAS.
+ 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 996 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by __construct().

996  : void
997  {
998  $this->app = new ilCalendarEntry($a_app_id);
999  $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
1000 
1001  if (!$a_app_id) {
1002  $start = clone $this->initialDate;
1003  $this->app->setStart($start);
1004 
1005  $seed_end = clone $this->initialDate;
1006  if ($this->default_fulltime) {
1007  #$seed_end->increment(IL_CAL_DAY,1);
1008  } else {
1009  $seed_end->increment(IL_CAL_HOUR, 1);
1010  }
1011  $this->app->setEnd($seed_end);
1012  $this->app->setFullday($this->default_fulltime);
1013 
1014  $this->rec = new ilCalendarRecurrence();
1015  } else {
1016  $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
1017  }
1018  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_HOUR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
increment(string $a_type, int $a_count=1)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilCalendarAppointmentGUI::initForm ( string  $a_mode,
bool  $a_as_milestone = false,
bool  $a_edit_single_app = false 
)
protected

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

References $form, $i, $ref_id, XapiProxy\$resp, $type, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarCategories\_lookupCategoryIdByObjId(), ilObjUser\_lookupLogin(), ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilCalendarCategoryAssignments\getFirstAssignment(), ILIAS\FileDelivery\http(), ilYuiUtil\initDomEvent(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\UI\examples\Symbol\Glyph\Notification\notification(), ILIAS\Repository\refinery(), ilDateTimeInputGUI\setDate(), ilFormPropertyGUI\setInfo(), ilCalendarRecurrence\setRecurrence(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setValue(), ilCalendarUserNotification\TYPE_EMAIL, ilCalendarCategory\TYPE_OBJ, ilCalendarUserNotification\TYPE_USER, and ILIAS\Repository\user().

Referenced by add(), addMilestone(), edit(), and load().

163  $this->form = new ilPropertyFormGUI();
165  $resp_info = false;
166  switch ($a_mode) {
167  case 'create':
168  $this->ctrl->saveParameter($this, array('seed', 'idate'));
169  $this->form->setFormAction($this->ctrl->getFormAction($this));
170  if ($a_as_milestone) {
171  $this->form->setTitle($this->lng->txt('cal_new_ms'));
172  $this->form->addCommandButton('saveMilestone', $this->lng->txt('cal_add_milestone'));
173  } else {
174  $this->form->setTitle($this->lng->txt('cal_new_app'));
175  $this->form->addCommandButton('save', $this->lng->txt('cal_add_appointment'));
176  }
177  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
178  break;
179 
180  case 'edit':
181  if ($a_as_milestone) {
182  $this->form->setTitle($this->lng->txt('cal_edit_milestone'));
183  } else {
184  $this->form->setTitle($this->lng->txt('cal_edit_appointment'));
185  }
186  $this->ctrl->saveParameter($this, array('seed', 'app_id', 'idate'));
187  $this->form->setFormAction($this->ctrl->getFormAction($this));
188 
189  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
190  $cat = $ass->getFirstAssignment();
191  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat);
192  $type = ilObject::_lookupType($cat_info['obj_id']);
193  if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
194  && ($type == "grp" || $type == "crs")) {
195  $resp_info = true;
196  $this->form->addCommandButton(
197  'editResponsibleUsers',
198  $this->lng->txt('cal_change_responsible_users')
199  );
200  }
201  $this->form->addCommandButton('update', $this->lng->txt('save'));
202  // $this->form->addCommandButton('askDelete',$this->lng->txt('delete'));
203  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
204  break;
205  }
206  // title
207  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
208  $title->setValue($this->app->getTitle());
209  $title->setRequired(true);
210  $title->setMaxLength(128);
211  $title->setSize(32);
212  $this->form->addItem($title);
213 
214  $category_id = 0;
215  if ($this->http->wrapper()->query()->has('category_id')) {
216  $category_id = $this->http->wrapper()->query()->retrieve(
217  'category_id',
218  $this->refinery->kindlyTo()->int()
219  );
220  }
221  $ref_id = 0;
222  if ($this->http->wrapper()->query()->has('ref_id')) {
223  $ref_id = $this->http->wrapper()->query()->retrieve(
224  'ref_id',
225  $this->refinery->kindlyTo()->int()
226  );
227  }
228  // calendar selection
229  $calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'), 'calendar');
230 
231  $selected_calendar = 0;
232  if ($this->http->wrapper()->post()->has('calendar')) {
233  $selected_calendar = $this->http->wrapper()->post()->retrieve(
234  'calendar',
235  $this->refinery->kindlyTo()->int()
236  );
237  }
238  if ($selected_calendar > 0) {
239  $calendar->setValue($selected_calendar);
240  } elseif ($category_id) {
241  $calendar->setValue((int) $category_id);
242  $selected_calendar = (int) $category_id;
243  } elseif ($a_mode == 'edit') {
244  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
245  $cat = $ass->getFirstAssignment();
246  $calendar->setValue($cat);
247  $selected_calendar = $cat;
248  } elseif ($ref_id) {
249  $obj_cal = ilObject::_lookupObjId($ref_id);
250  $calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal));
251  $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal);
252  $cats = ilCalendarCategories::_getInstance($this->user->getId());
253  $cats->readSingleCalendar($selected_calendar);
254  } else {
255  $cats = ilCalendarCategories::_getInstance($this->user->getId());
256  $categories = $cats->prepareCategoriesOfUserForSelection();
257  $selected_calendar = key($categories);
258  $calendar->setValue($selected_calendar);
259  }
260  $calendar->setRequired(true);
261  $cats = ilCalendarCategories::_getInstance($this->user->getId());
262  $calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
263 
264  if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) {
265  $notification_cals = $cats->getNotificationCalendars();
266  $notification_cals = count($notification_cals) ? implode(',', $notification_cals) : '';
267  $calendar->addCustomAttribute("onchange=\"ilToggleNotification([" . $notification_cals . "]);\"");
268  }
269  $this->form->addItem($calendar);
270 
271  if (!$a_as_milestone) {
272  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
273  $dur->setRequired(true);
274  $dur->enableToggleFullTime(
275  $this->lng->txt('cal_fullday_title'),
276  $this->app->isFullday()
277  );
278  $dur->setShowTime(true);
279  $dur->setStart($this->app->getStart());
280  $dur->setEnd($this->app->getEnd());
281  $this->form->addItem($dur);
282 
283  // recurrence
284  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
285  $rec->setRecurrence($this->rec);
286  $this->form->addItem($rec);
287 
288  // location
289  $where = new ilTextInputGUI($this->lng->txt('cal_where'), 'location');
290  $where->setValue($this->app->getLocation());
291  $where->setMaxLength(128);
292  $where->setSize(32);
293  $this->form->addItem($where);
294  } else {
295  $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'), 'event_start');
296  $deadline->setDate($this->app->getStart());
297  $deadline->setShowTime(false);
298  $deadline->setMinuteStepSize(5);
299  $this->form->addItem($deadline);
300 
301  // completion
302  $completion_vals = array();
303  for ($i = 0; $i <= 100; $i += 5) {
304  $completion_vals[$i] = $i . " %";
305  }
306  $compl = new ilSelectInputGUI(
307  $this->lng->txt('cal_task_completion'),
308  'completion'
309  );
310  $compl->setOptions($completion_vals);
311  $compl->setValue($this->app->getCompletion());
312  $this->form->addItem($compl);
313  }
314 
315  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
316  $desc->setValue($this->app->getDescription());
317  $desc->setRows(5);
318  $this->form->addItem($desc);
319 
320  if ($a_as_milestone && $a_mode == "edit" && $resp_info) {
321  // users responsible
322  $users = $this->app->readResponsibleUsers();
323  $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'), "", true);
324  $delim = "";
325  $value = '';
326  foreach ($users as $r) {
327  $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
328  $delim = "<br />";
329  }
330  if (count($users) > 0) {
331  $resp->setValue($value);
332  } else {
333  $resp->setValue("-");
334  }
335 
336  $this->form->addItem($resp);
337  }
338 
339  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
340  $ajax_url = $this->ctrl->getLinkTarget(
341  $this,
342  'doUserAutoComplete',
343  '',
344  true,
345  false
346  );
347 
348  $notu = new ilTextInputGUI(
349  $this->lng->txt('cal_user_notification'),
350  'notu'
351  );
352  $notu->setMulti(true, true);
353  $notu->setInfo($this->lng->txt('cal_user_notification_info'));
354  $notu->setDataSource($ajax_url, ',');
355 
356  $values = [];
357  foreach ($this->notification->getRecipients() as $rcp) {
358  switch ($rcp['type']) {
360  $values[] = ilObjUser::_lookupLogin($rcp['usr_id']);
361  break;
362 
364  $values[] = $rcp['email'];
365  break;
366  }
367  }
368  $notu->setValue($values);
369  $this->form->addItem($notu);
370  }
371 
372  // Notifications
373  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars())) {
374  $selected_cal = new ilCalendarCategory($selected_calendar);
375  $disabled = true;
376  if ($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ) {
377  if (ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp') {
378  $disabled = false;
379  }
380  }
381 
382  $this->tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js');
383  $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'), 'not');
384  $not->setInfo($this->lng->txt('cal_notification_info'));
385  $not->setValue('1');
386  $not->setChecked($this->app->isNotificationEnabled());
387  $not->setDisabled($disabled);
388  $this->form->addItem($not);
389  }
390  return $this->form;
391  }
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022) ...
This class represents a checkbox property in a property form.
Stores calendar categories.
setRecurrence(int $a_type)
set type of recurrence public
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static _lookupCategoryIdByObjId(int $a_obj_id)
lookup category by obj_id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67
static http()
Fetches the global http state from ILIAS.
setDate(ilDateTime $a_date=null)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
setRequired(bool $a_required)
static _getInstance($a_usr_id=0)
get singleton instance
form( $class_path, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
static _lookupType(int $id, bool $reference=false)
$i
Definition: metadata.php:41
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormConfirmBooking()

ilCalendarAppointmentGUI::initFormConfirmBooking ( )
protected

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

References $form, $message, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilFormGUI\setFormAction().

Referenced by book(), and bookconfirmed().

1301  {
1302  $form = new ilPropertyFormGUI();
1303  $form->setFormAction($this->ctrl->getFormAction($this));
1304  $form->addCommandButton('bookconfirmed', $this->lng->txt('cal_confirm_booking'));
1305  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1306 
1307  $date = new ilNonEditableValueGUI($this->lng->txt('appointment'), 'date');
1308  $form->addItem($date);
1309 
1310  $title = new ilNonEditableValueGUI($this->lng->txt('title'), 'title');
1311  $form->addItem($title);
1312 
1313  $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1314  $message->setRows(5);
1316 
1317  return $form;
1318  }
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
$message
Definition: xapiexit.php:32
+ 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 962 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by __construct().

962  : void
963  {
964  $hour = 0;
965  if ($this->http->wrapper()->query()->has('hour')) {
966  $hour = $this->http->wrapper()->query()->retrieve(
967  'hour',
968  $this->refinery->kindlyTo()->int()
969  );
970  }
971 
972  if (!$hour) {
973  $this->initialDate = clone $initialDate;
974  $this->default_fulltime = true;
975  } else {
976  if ($hour < 10) {
977  $time = '0' . $hour . ':00:00';
978  } else {
979  $time = (int) $hour . ':00:00';
980  }
981  $this->initialDate = new ilDateTime(
982  $initialDate->get(IL_CAL_DATE) . ' ' . $time,
985  );
986  $this->default_fulltime = false;
987  }
988  }
const IL_CAL_DATETIME
get(int $a_format, string $a_format_str='', string $a_tz='')
static http()
Fetches the global http state from ILIAS.
const IL_CAL_DATE
+ 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 990 of file class.ilCalendarAppointmentGUI.php.

References $seed.

Referenced by __construct().

990  : void
991  {
992  $this->seed = clone $seed;
993  $this->default_fulltime = true;
994  }
+ Here is the caller graph for this function:

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

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

References ILIAS\Repository\user().

Referenced by __construct().

957  : void
958  {
959  $this->timezone = $this->user->getTimeZone();
960  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load()

ilCalendarAppointmentGUI::load (   $a_mode,
  $a_as_milestone = false 
)
protected

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

References $form, ILIAS\Repository\form(), ilPropertyFormGUI\getInput(), initForm(), loadNotificationRecipients(), and loadRecurrenceSettings().

Referenced by save(), and update().

1021  {
1022  // needed for date handling
1023  $form = $this->initForm($a_mode, $a_as_milestone);
1024  $this->form->checkInput();
1025 
1026  if ($a_as_milestone) {
1027  $this->app->setMilestone(true);
1028  $this->app->setCompletion((int) $form->getInput('completion'));
1029  }
1030 
1031  $this->app->setTitle($form->getInput('title'));
1032  $this->app->setLocation($form->getInput('location'));
1033  $this->app->setDescription($form->getInput('description'));
1034  $this->app->enableNotification((bool) $form->getInput('not'));
1035 
1036  if ($a_as_milestone) { // milestones are always fullday events
1037  $start = $this->form->getItemByPostVar('event_start');
1038  $start = $start->getDate();
1039  $this->app->setFullday(true);
1040  // for milestones is end date = start date
1041  $this->app->setStart($start);
1042  $this->app->setEnd($start);
1043  } else {
1044  $period = $this->form->getItemByPostVar('event');
1045  $start = $period->getStart();
1046  $end = $period->getEnd();
1047 
1048  $this->app->setFullday($start instanceof ilDate);
1049  $this->app->setStart($start);
1050  $this->app->setEnd($end);
1051  }
1052 
1054  $this->loadRecurrenceSettings($form, $a_as_milestone = false);
1055  return $form;
1056  }
loadNotificationRecipients(ilPropertyFormGUI $form)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
initForm(string $a_mode, bool $a_as_milestone=false, bool $a_edit_single_app=false)
form( $class_path, string $cmd)
loadRecurrenceSettings(ilPropertyFormGUI $form, bool $a_as_milestone=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadNotificationRecipients()

ilCalendarAppointmentGUI::loadNotificationRecipients ( ilPropertyFormGUI  $form)
protected

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

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

Referenced by load().

1058  : void
1059  {
1060  $this->notification->setRecipients(array());
1061  $map = [];
1062  foreach ((array) $form->getInput('notu') as $rcp) {
1063  $rcp = trim($rcp);
1064  $usr_id = (int) ilObjUser::_loginExists($rcp);
1065  if ($rcp === '') {
1066  continue;
1067  }
1068  if (in_array($rcp, $map)) {
1069  continue;
1070  }
1071  $map[] = $rcp;
1072  if ($usr_id) {
1073  $this->notification->addRecipient(
1075  $usr_id
1076  );
1077  } else {
1078  $this->notification->addRecipient(
1080  0,
1081  $rcp
1082  );
1083  }
1084  }
1085  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
static _loginExists(string $a_login, int $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRecurrenceSettings()

ilCalendarAppointmentGUI::loadRecurrenceSettings ( ilPropertyFormGUI  $form,
bool  $a_as_milestone = false 
)
protected

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

References ilPropertyFormGUI\getItemByPostVar().

Referenced by load().

1087  : void
1088  {
1089  if ($form->getItemByPostVar('frequence') instanceof ilRecurrenceInputGUI) {
1090  $this->rec = $form->getItemByPostVar('frequence')->getRecurrence();
1091  } else {
1092  $this->rec = new ilCalendarRecurrence();
1093  }
1094  }
getItemByPostVar(string $a_post_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ register()

ilCalendarAppointmentGUI::register ( )
protected

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

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

1170  : void
1171  {
1172  $dstart = 0;
1173  if ($this->http->wrapper()->query()->has('dstart')) {
1174  $dstart = $this->http->wrapper()->query()->retrieve(
1175  'dstart',
1176  $this->refinery->kindlyTo()->int()
1177  );
1178  }
1179  $dend = 0;
1180  if ($this->http->wrapper()->query()->has('dend')) {
1181  $dend = $this->http->wrapper()->query()->retrieve(
1182  'dend',
1183  $this->refinery->kindlyTo()->int()
1184  );
1185  }
1186  $app_id = 0;
1187  if ($this->http->wrapper()->post()->has('app_id')) {
1188  $app_id = $this->http->wrapper()->post()->retrieve(
1189  'app_id',
1190  $this->refinery->kindlyTo()->int()
1191  );
1192  }
1193  $reg = new ilCalendarRegistration($app_id);
1194  $reg->register(
1195  $this->user->getId(),
1196  new ilDateTime($dstart, IL_CAL_UNIX),
1197  new ilDateTime((int) $dend, IL_CAL_UNIX)
1198  );
1199 
1200  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_reg_registered'), true);
1201  $this->ctrl->returnToParent($this);
1202  }
const IL_CAL_UNIX
static http()
Fetches the global http state from ILIAS.
registration for calendar appointments
+ Here is the call graph for this function:

◆ save()

ilCalendarAppointmentGUI::save ( bool  $a_as_milestone = false)
protected

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

References $type, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilObject\_lookupType(), add(), ilCalendarCategoryAssignments\addAssignment(), addMilestone(), createDefaultCalendar(), ILIAS\Repository\ctrl(), distributeNotifications(), distributeUserNotifications(), ILIAS\Repository\form(), ilPropertyFormGUI\getInput(), ILIAS\Repository\int(), ILIAS\Repository\lng(), load(), ILIAS\UI\examples\Symbol\Glyph\Notification\notification(), saveRecurrenceSettings(), showResponsibleUsersList(), ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_UNDEFINED.

Referenced by saveMilestone().

471  : void
472  {
473  $form = $this->load('create', $a_as_milestone);
474 
475  if ($this->app->validate() and $this->notification->validate()) {
476  if ((int) $form->getInput('calendar') === 0) {
477  $cat_id = $this->createDefaultCalendar();
478  } else {
479  $cat_id = (int) $form->getInput('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  (int) $form->getInput('not')
495  ) {
496  $this->distributeNotifications($cat_id, $this->app->getEntryId(), true);
497  }
498  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
500  }
501 
502  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
503  $type = ilObject::_lookupType($cat_info['obj_id'] ?? 0);
504 
505  if (
506  $a_as_milestone &&
508  ($type == "grp" || $type == "crs")
509  ) {
510  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_created_milestone_resp_q'), true);
511  $this->showResponsibleUsersList($cat_info['obj_id'] ?? 0);
512  return;
513  } elseif ($a_as_milestone) {
514  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_created_milestone'), true);
515  $this->ctrl->returnToParent($this);
516  } else {
517  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_created_appointment'), true);
518  $this->ctrl->returnToParent($this);
519  }
520  } else {
521  $this->form->setValuesByPost();
522  if ($this->error->getMessage() !== '') {
523  $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
524  } else {
525  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
526  }
527  $this->add($this->form);
528  return;
529  }
530  if ($a_as_milestone) {
531  $this->addMilestone();
532  } else {
533  $this->add();
534  }
535  }
$type
distributeNotifications(int $a_cat_id, int $app_id, bool $a_new_appointment=true)
add(?ilPropertyFormGUI $form=null)
add new appointment
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
distributeUserNotifications()
Send mail to selected users.
static _getInstance($a_usr_id=0)
get singleton instance
form( $class_path, string $cmd)
load($a_mode, $a_as_milestone=false)
static _lookupType(int $id, bool $reference=false)
showResponsibleUsersList(int $a_grp_id)
Show responsible uses of a milestone (default set is participants of group)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveMilestone()

ilCalendarAppointmentGUI::saveMilestone ( )
protected

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

References save().

466  : void
467  {
468  $this->save(true);
469  }
+ Here is the call graph for this function:

◆ saveMilestoneResponsibleUsers()

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

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

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

626  : void
627  {
628  $user_ids = [];
629  if ($this->http->wrapper()->post()->has('user_id')) {
630  $user_ids = $this->http->wrapper()->post()->retrieve(
631  'user_id',
632  $this->refinery->kindlyTo()->dictOf(
633  $this->refinery->kindlyTo()->int()
634  )
635  );
636  }
637  $this->app->writeResponsibleUsers($user_ids);
638  $this->ctrl->returnToParent($this);
639  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

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

References ilCalendarRecurrence\FREQ_NONE.

Referenced by save(), and update().

1096  : void
1097  {
1098  switch ($this->rec->getFrequenceType()) {
1099  case '':
1101  // No recurrence => delete if there is an recurrence rule
1102  if ($this->rec->getRecurrenceId()) {
1103  $this->rec->delete();
1104  }
1105  break;
1106 
1107  default:
1108  if ($this->rec->getRecurrenceId()) {
1109  $this->rec->update();
1110  } else {
1111  $this->rec->save();
1112  }
1113  break;
1114  }
1115  }
+ Here is the caller graph for this function:

◆ showInfoScreen()

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

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

References $type, 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().

735  : void
736  {
737  $info = new ilInfoScreenGUI($this);
738  $info->setFormAction($this->ctrl->getFormAction($this));
739 
740  if ($this->app->isMilestone()) {
741  $info->addSection($this->lng->txt('cal_ms_details'));
742  } else {
743  $info->addSection($this->lng->txt('cal_details'));
744  }
745 
746  // Appointment
747  $info->addProperty(
748  $this->lng->txt('appointment'),
750  $this->app->getStart(),
751  $this->app->getEnd()
752  )
753  );
754  $info->addProperty($this->lng->txt('title'), $this->app->getPresentationTitle());
755 
756  // Description
757  if (strlen($desc = $this->app->getDescription())) {
758  $info->addProperty($this->lng->txt('description'), $desc);
759  }
760 
761  // Location
762  if (strlen($loc = $this->app->getLocation())) {
763  $info->addProperty($this->lng->txt('cal_where'), $loc);
764  }
765 
766  // completion
767  if ($this->app->isMilestone() && $this->app->getCompletion() > 0) {
768  $info->addProperty(
769  $this->lng->txt('cal_task_completion'),
770  $this->app->getCompletion() . " %"
771  );
772  }
773 
774  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
775  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
776  $type = ilObject::_lookupType($cat_info['obj_id']);
777  if ($this->app->isMilestone() && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
778  && ($type == "grp" || $type == "crs")) {
779  // users responsible
780  $users = $this->app->readResponsibleUsers();
781  $delim = "";
782  $value = '';
783  foreach ($users as $r) {
784  $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
785  $delim = "<br />";
786  }
787  if (count($users) > 0) {
788  $info->addProperty(
789  $this->lng->txt('cal_responsible'),
790  $value
791  );
792  }
793  }
794 
795  $category = new ilCalendarCategory($cat_id);
796 
797  if ($category->getType() == ilCalendarCategory::TYPE_OBJ) {
798  $info->addSection($this->lng->txt('additional_info'));
799 
800  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
801  $refs = ilObject::_getAllReferences($cat_info['obj_id']);
802 
803  $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($cat_info['obj_id']), true);
804  $info->addProperty(
805  $this->lng->txt('perma_link'),
806  '<a class="small" href="' . $href . '" target="_top">' . $href . '</a>'
807  );
808  }
809  $this->tpl->setContent($info->getHTML());
810  }
Class ilInfoScreenGUI.
$type
static _getAllReferences(int $id)
get all reference ids for object ID
Stores calendar categories.
static _getInstance($a_usr_id=0)
get singleton instance
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showResponsibleUsersList()

ilCalendarAppointmentGUI::showResponsibleUsersList ( int  $a_grp_id)

Show responsible uses of a milestone (default set is participants of group)

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

Referenced by editResponsibleUsers(), and save().

612  : void
613  {
614  $table_gui = new ilMilestoneResponsiblesTableGUI(
615  $this,
616  "",
617  $a_grp_id,
618  $this->app->getEntryId()
619  );
620  $this->tpl->setContent($table_gui->getHTML());
621  }
TableGUI class for selection of milestone responsibles.
+ Here is the caller graph for this function:

◆ unregister()

ilCalendarAppointmentGUI::unregister ( )
protected

Unregister calendar, was confirmed.

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

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

1244  : void
1245  {
1246  $dstart = 0;
1247  if ($this->http->wrapper()->query()->has('dstart')) {
1248  $dstart = $this->http->wrapper()->query()->retrieve(
1249  'dstart',
1250  $this->refinery->kindlyTo()->int()
1251  );
1252  }
1253  $dend = 0;
1254  if ($this->http->wrapper()->query()->has('dend')) {
1255  $dend = $this->http->wrapper()->query()->retrieve(
1256  'dend',
1257  $this->refinery->kindlyTo()->int()
1258  );
1259  }
1260  $app_id = 0;
1261  if ($this->http->wrapper()->post()->has('app_id')) {
1262  $app_id = $this->http->wrapper()->post()->retrieve(
1263  'app_id',
1264  $this->refinery->kindlyTo()->int()
1265  );
1266  }
1267  $reg = new ilCalendarRegistration($app_id);
1268  $reg->unregister(
1269  $this->user->getId(),
1270  new ilDateTime((int) $dstart, IL_CAL_UNIX),
1271  new ilDateTime((int) $dend, IL_CAL_UNIX)
1272  );
1273 
1274  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_reg_unregistered'), true);
1275  $this->ctrl->returnToParent($this);
1276  }
const IL_CAL_UNIX
static http()
Fetches the global http state from ILIAS.
registration for calendar appointments
+ Here is the call graph for this function:

◆ update()

ilCalendarAppointmentGUI::update ( )
protected

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

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

812  : void
813  {
814  $single_editing = $this->requested_rexl;
815  $form = $this->load('edit', $this->app->isMilestone());
816 
817  if ($this->app->validate() and $this->notification->validate()) {
818  if (!(int) $form->getInput('calendar')) {
819  $cat_id = $this->createDefaultCalendar();
820  } else {
821  $cat_id = (int) $form->getInput('calendar');
822  }
823 
824  if ($single_editing) {
825  $original_id = $this->getAppointment()->getEntryId();
826  $this->getAppointment()->save();
827  $selected_ut = $this->getRecurrenceDateFromQuery();
828  if ($selected_ut > 0) {
829  $exclusion = new ilCalendarRecurrenceExclusion();
830  $exclusion->setEntryId($original_id);
831  $exclusion->setDate(new ilDate($selected_ut, IL_CAL_UNIX));
832  $this->logger->dump($this->getAppointment()->getEntryId());
833  $this->logger->dump(ilDatePresentation::formatDate(new ilDate($selected_ut, IL_CAL_UNIX)));
834  $exclusion->save();
835  }
836  $this->rec = new ilCalendarRecurrence();
837  $this->rec->setEntryId($this->getAppointment()->getEntryId());
838  } else {
839  $this->getAppointment()->update();
840  }
841  $this->notification->save();
842  $this->saveRecurrenceSettings();
843  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
844  $ass->deleteAssignments();
845  $ass->addAssignment($cat_id);
846 
847  // Send notifications
848  $notification = (bool) $form->getInput('not');
849  if (
850  ilCalendarSettings::_getInstance()->isNotificationEnabled() &&
852  ) {
853  $this->distributeNotifications($cat_id, $this->app->getEntryId(), false);
854  }
855  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
857  }
858 
859  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
860  $this->ctrl->returnToParent($this);
861  } else {
862  $this->form->setValuesByPost();
863  $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
864  }
865  $this->edit(false, $this->form);
866  }
ilCalendarUserNotification $notification
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
distributeNotifications(int $a_cat_id, int $app_id, bool $a_new_appointment=true)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
distributeUserNotifications()
Send mail to selected users.
edit(bool $a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
form( $class_path, string $cmd)
load($a_mode, $a_as_milestone=false)
Stores exclusion dates for calendar recurrences.
+ Here is the call graph for this function:

Field Documentation

◆ $app

ilCalendarEntry ilCalendarAppointmentGUI::$app
protected

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

Referenced by getAppointment().

◆ $ctrl

ilCtrlInterface ilCalendarAppointmentGUI::$ctrl
protected

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

◆ $default_fulltime

bool ilCalendarAppointmentGUI::$default_fulltime = true
protected

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

◆ $error

ilErrorHandling ilCalendarAppointmentGUI::$error
protected

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

◆ $form

ilPropertyFormGUI ilCalendarAppointmentGUI::$form
private

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

Referenced by initForm(), initFormConfirmBooking(), and load().

◆ $help

ilHelpGUI ilCalendarAppointmentGUI::$help
protected

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

◆ $http

HTTPServices ilCalendarAppointmentGUI::$http
protected

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

◆ $initialDate

ilDateTime ilCalendarAppointmentGUI::$initialDate
protected

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

Referenced by initAppointment(), and initInitialDate().

◆ $lng

ilLanguage ilCalendarAppointmentGUI::$lng
protected

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

◆ $logger

ilLogger ilCalendarAppointmentGUI::$logger
private

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

◆ $notification

ilCalendarUserNotification ilCalendarAppointmentGUI::$notification
private

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

◆ $rec

ilCalendarRecurrence ilCalendarAppointmentGUI::$rec
protected

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

◆ $refinery

RefineryFactory ilCalendarAppointmentGUI::$refinery
protected

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

◆ $request

RequestInterface ilCalendarAppointmentGUI::$request
protected

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

◆ $requested_rexl

bool ilCalendarAppointmentGUI::$requested_rexl
protected

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

Referenced by update().

◆ $seed

ilDate ilCalendarAppointmentGUI::$seed
protected

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

Referenced by initSeed().

◆ $settings

ilSetting ilCalendarAppointmentGUI::$settings
protected

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

◆ $tabs

ilTabsGUI ilCalendarAppointmentGUI::$tabs
protected

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

◆ $timezone

string ilCalendarAppointmentGUI::$timezone
protected

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

Referenced by initInitialDate().

◆ $tpl

ilGlobalTemplateInterface ilCalendarAppointmentGUI::$tpl
protected

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

◆ $user

ilObjUser ilCalendarAppointmentGUI::$user
protected

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


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