ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCalendarAppointmentGUI Class Reference

Administrate calendar appointments. More...

+ Collaboration diagram for ilCalendarAppointmentGUI:

Public Member Functions

 __construct (ilDate $seed, ilDate $initialDate, $a_appointment_id=0)
 
 executeCommand ()
 
 getAppointment ()
 Get current appointment. More...
 
 editResponsibleUsers ()
 Edit responsible users. More...
 
 showResponsibleUsersList ($a_grp_id)
 Show responsible uses of a milestone (default set is participants of group) More...
 
 saveMilestoneResponsibleUsers ()
 Save milestone responsibilites. More...
 
 confirmUnregister ()
 Confirmation screen to unregister calendar. More...
 
 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

 cancel ()
 cancel editing More...
 
 initForm ($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
 init form More...
 
 add (ilPropertyFormGUI $form=null)
 add new appointment More...
 
 addMilestone ()
 add milestone More...
 
 saveMilestone ()
 save milestone More...
 
 save ($a_as_milestone=false)
 save appointment More...
 
 distributeUserNotifications ()
 Send mail to selected users ilObjUser $ilUser. More...
 
 distributeNotifications ($a_cat_id, $app_id, $a_new_appointment=true)
 Distribute mail notifications. More...
 
 askEdit ()
 Check edit single apppointment / edit all appointments for recurring appointments. More...
 
 editSingle ()
 Edit one single appointment ^. More...
 
 edit ($a_edit_single_app=false, ilPropertyFormGUI $form=null)
 edit appointment More...
 
 showInfoScreen ()
 show info screen More...
 
 update ()
 update More...
 
 askDelete ()
 ask delete More...
 
 delete ()
 delete More...
 
 deleteExclude ($a_return=true)
 delete single item of recurrence list More...
 
 initTimeZone ()
 init timezone More...
 
 initInitialDate (ilDate $initialDate)
 init initial date More...
 
 initSeed (ilDate $seed)
 init seed More...
 
 initAppointment ($a_app_id=0)
 init appointment More...
 
 load ($a_mode, $a_as_milestone=false)
 load post More...
 
 loadNotificationRecipients ()
 
 loadRecurrenceSettings ($a_as_milestone=false)
 load recurrence settings More...
 
 saveRecurrenceSettings ()
 save recurrence settings More...
 
 createDefaultCalendar ()
 Create a default calendar. More...
 
 confirmRegister ()
 Register to an appointment. More...
 
 register ()
 Register. More...
 
 unregister ()
 Unregister calendar, was confirmed. More...
 
 initFormConfirmBooking ()
 
 calendarEntryToCategory (ilCalendarEntry $entry)
 Get category object of given calendar entry. More...
 
 doUserAutoComplete ()
 Do auto completion. More...
 

Protected Attributes

 $seed = null
 
 $initialDate = null
 
 $default_fulltime = true
 
 $app = null
 
 $rec = null
 
 $timezone = null
 
 $tpl
 
 $lng
 
 $ctrl
 
 $request
 

Private Attributes

 $logger = null
 

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 12 of file class.ilCalendarAppointmentGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

public

Parameters
ilDateseed
Returns

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

References $DIC, $GLOBALS, initAppointment(), initInitialDate(), initSeed(), and initTimeZone().

44  {
45  global $DIC;
46 
47  $this->lng = $DIC->language();
48  $this->lng->loadLanguageModule('dateplaner');
49  $this->ctrl = $DIC->ctrl();
50  $this->tpl = $DIC->ui()->mainTemplate();
51  $this->logger = $GLOBALS['DIC']->logger()->cal();
52  $this->request = $DIC->http()->request();
53 
54  $this->initTimeZone();
55  $this->initSeed($seed);
56  $this->initInitialDate($initialDate);
57  $this->initAppointment($a_appointment_id);
58  }
initAppointment($a_app_id=0)
init appointment
initInitialDate(ilDate $initialDate)
init initial date
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

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

add new appointment

Parameters
\ilPropertyFormGUI$formprotected
Returns

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

References $DIC, and initForm().

Referenced by save().

339  {
340  global $DIC;
341 
342  $ilHelp = $DIC->help();
343 
344  $ilHelp->setScreenIdComponent("cal");
345  $ilHelp->setScreenId("app");
346  $ilHelp->setSubScreenId("create");
347 
348  if (!$form instanceof ilPropertyFormGUI) {
349  $this->initForm('create');
350  }
351  $this->tpl->setContent($this->form->getHTML());
352  }
This class represents a property form user interface.
global $DIC
Definition: goto.php:24
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMilestone()

ilCalendarAppointmentGUI::addMilestone ( )
protected

add milestone

protected

Returns

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

References $DIC, $tpl, and initForm().

Referenced by save().

361  {
362  global $DIC;
363 
364  $tpl = $DIC['tpl'];
365  $ilHelp = $DIC['ilHelp'];
366 
367  $ilHelp->setScreenIdComponent("cal");
368  $ilHelp->setScreenId("app");
369  $ilHelp->setSubScreenId("create_milestone");
370 
371  $this->initForm('create', true);
372  $tpl->setContent($this->form->getHTML());
373  }
global $DIC
Definition: goto.php:24
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ askDelete()

ilCalendarAppointmentGUI::askDelete ( )
protected

ask delete

protected

Returns

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

References $DIC, $tpl, ilCalendarRecurrences\_getRecurrences(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendQuestion().

847  {
848  global $DIC;
849 
850  $tpl = $DIC['tpl'];
851 
852  $this->ctrl->saveParameter(
853  $this,
854  [
855  'seed',
856  'app_id',
857  'dt',
858  'idate'
859  ]
860  );
861 
862  $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
863  if (!$app_id) {
864  ilUtil::sendFailure($this->lng->txt('err_check_input'));
865  $this->ctrl->returnToParent($this);
866  }
867 
868  $entry = new ilCalendarEntry($app_id);
870  if (
871  !count($recs) &&
872  !$this->app->isMilestone()
873  ) {
874  $confirm = new ilConfirmationGUI();
875  $confirm->setFormAction($this->ctrl->getFormAction($this));
876  $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
877  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
878  $confirm->addItem('appointments[]', $this->app->getEntryId(), $this->app->getTitle());
879  $confirm->setConfirm($this->lng->txt('delete'), 'delete');
880  $this->tpl->setContent($confirm->getHTML());
881  } else {
882  $table = new ilCalendarRecurrenceTableGUI(
883  $this->app,
884  $this,
885  'askDelete'
886  );
887  $table->init();
888  $table->parse();
889  $this->tpl->setContent($table->getHTML());
890  ilUtil::sendQuestion($this->lng->txt('cal_delete_app_sure'));
891  ilUtil::sendInfo($this->lng->txt('cal_recurrence_confirm_deletion'));
892  }
893  }
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
Model for a calendar entry.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilCalendarRecurrenceTableGUI.
Confirmation screen class.
+ 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 579 of file class.ilCalendarAppointmentGUI.php.

References $GLOBALS, $rec, ilCalendarRecurrences\_getRecurrences(), edit(), and getAppointment().

580  {
581  // check for recurring entries
582  include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php';
584  if (!$rec) {
585  return $this->edit(true);
586  }
587  // Show edit single/all appointments
588  $this->ctrl->saveParameter($this, array('seed','app_id','dt','idate'));
589 
590  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
591  $confirm = new ilConfirmationGUI();
592  $confirm->setFormAction($this->ctrl->getFormAction($this));
593  #$confirm->setHeaderText($this->lng->txt('cal_edit_app_sure'));
594  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
595  $confirm->addItem('appointments[]', $this->app->getEntryId(), $this->app->getTitle());
596  $confirm->addButton($this->lng->txt('cal_edit_single'), 'editSingle');
597  $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'), 'edit');
598 
599  $GLOBALS['DIC']['tpl']->setContent($confirm->getHTML());
600  }
getAppointment()
Get current appointment.
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Confirmation screen class.
+ Here is the call graph for this function:

◆ book()

ilCalendarAppointmentGUI::book ( )

Confirmation screen for booking of consultation appointment.

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

References $_GET, $DIC, $ilUser, $tpl, ilObjUser\_lookupFullname(), ilDatePresentation\formatPeriod(), and initFormConfirmBooking().

1381  {
1382  global $DIC;
1383 
1384  $ilUser = $DIC['ilUser'];
1385  $tpl = $DIC['tpl'];
1386 
1387  $entry_id = (int) $_GET['app_id'];
1388  $this->ctrl->saveParameter($this, 'app_id');
1389 
1390  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1391  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1392  $entry = new ilCalendarEntry($entry_id);
1393  $booking = new \ilBookingEntry($entry->getContextId());
1394  $user = $booking->getObjId();
1395 
1396 
1397  $form = $this->initFormConfirmBooking();
1398  $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()));
1399  $form->getItemByPostVar('title')->setValue($entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')');
1400 
1401  $tpl->setContent($form->getHTML());
1402  return true;
1403  }
Model for a calendar entry.
$_GET["client_id"]
static _lookupFullname($a_user_id)
Lookup Full Name.
global $DIC
Definition: goto.php:24
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ bookconfirmed()

ilCalendarAppointmentGUI::bookconfirmed ( )

Book consultation appointment, was confirmed.

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

References $DIC, $GLOBALS, $ilUser, ilConsultationHourUtils\bookAppointment(), initFormConfirmBooking(), ilUtil\sendFailure(), and ilBookingEntry\writeBookingMessage().

1434  {
1435  global $DIC;
1436 
1437  $ilUser = $DIC->user();
1438 
1439  $entry = (int) $_REQUEST['app_id'];
1440  $form = $this->initFormConfirmBooking();
1441  if ($form->checkInput()) {
1442  // check if appointment is bookable
1443  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1444  $cal_entry = new ilCalendarEntry($entry);
1445 
1446  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1447  $booking = new ilBookingEntry($cal_entry->getContextId());
1448 
1449  if (!$booking->isAppointmentBookableForUser($entry, $GLOBALS['DIC']['ilUser']->getId())) {
1450  ilUtil::sendFailure($this->lng->txt('cal_booking_failed_info'), true);
1451  $this->ctrl->returnToParent($this);
1452  }
1453 
1454  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1456 
1457  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1458  ilBookingEntry::writeBookingMessage($entry, $ilUser->getId(), $form->getInput('comment'));
1459  }
1460  ilUtil::sendSuccess($this->lng->txt('cal_booking_confirmed'), true);
1461  $this->ctrl->returnToParent($this);
1462  }
Model for a calendar entry.
Booking definition.
static writeBookingMessage($a_entry_id, $a_usr_id, $a_message)
Write booking message.
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ilUser
Definition: imgupload.php:18
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.
+ Here is the call graph for this function:

◆ calendarEntryToCategory()

ilCalendarAppointmentGUI::calendarEntryToCategory ( ilCalendarEntry  $entry)
protected

Get category object of given calendar entry.

Parameters
ilCalendarEntry$entry
Returns
ilCalendarCategory

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

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

Referenced by cancelBooking(), and cancelConfirmed().

1566  {
1567  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1568  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1569  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1570  $assignment = $assignment->getFirstAssignment();
1571  return new ilCalendarCategory($assignment);
1572  }
getEntryId()
get entry id
Stores calendar categories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilCalendarAppointmentGUI::cancel ( )
protected

cancel editing

protected

Parameters

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

104  {
105  $this->ctrl->returnToParent($this);
106  }

◆ cancelBooking()

ilCalendarAppointmentGUI::cancelBooking ( )

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

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

References $_GET, $DIC, $ilUser, $tpl, ilObjUser\_lookupFullname(), calendarEntryToCategory(), ilDatePresentation\formatPeriod(), ilConfirmationGUI\setFormAction(), ilCalendarCategory\TYPE_BOOK, and ilCalendarCategory\TYPE_CH.

1469  {
1470  global $DIC;
1471 
1472  $ilUser = $DIC['ilUser'];
1473  $tpl = $DIC['tpl'];
1474 
1475  $entry = (int) $_GET['app_id'];
1476 
1477  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1478  $entry = new ilCalendarEntry($entry);
1479 
1480  $category = $this->calendarEntryToCategory($entry);
1481  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1482  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1483  $booking = new ilBookingEntry($entry->getContextId());
1484  if (!$booking->hasBooked($entry->getEntryId())) {
1485  $this->ctrl->returnToParent($this);
1486  return false;
1487  }
1488 
1489  $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
1490  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1491  $entry_title = ' ' . $entry->getTitle();
1492  } else {
1493  $this->ctrl->returnToParent($this);
1494  return false;
1495  }
1496 
1497  $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1498 
1499  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1500  $conf = new ilConfirmationGUI;
1501  $conf->setFormAction($this->ctrl->getFormAction($this));
1502  $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
1503  $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
1504  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1505  $conf->addItem('app_id', $entry->getEntryId(), $title . ' - ' . $entry_title);
1506 
1507  $tpl->setContent($conf->getHTML());
1508  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
static _lookupFullname($a_user_id)
Lookup Full Name.
Booking definition.
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
global $DIC
Definition: goto.php:24
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$ilUser
Definition: imgupload.php:18
Confirmation screen class.
+ 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 1514 of file class.ilCalendarAppointmentGUI.php.

References $_POST, $DIC, $ilUser, calendarEntryToCategory(), ilBookingEntry\cancelBooking(), ilConsultationHourAppointments\getAppointmentIds(), ilBookingReservation\setStatus(), ilBookingReservation\STATUS_CANCELLED, ilCalendarCategory\TYPE_BOOK, and ilCalendarCategory\TYPE_CH.

1515  {
1516  global $DIC;
1517 
1518  $ilUser = $DIC['ilUser'];
1519 
1520  $entry = (int) $_POST['app_id'];
1521 
1522  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1523  $entry = new ilCalendarEntry($entry);
1524 
1525  $category = $this->calendarEntryToCategory($entry);
1526  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1527  // find cloned calendar entry in user calendar
1528  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1530  $ilUser->getId(),
1531  $entry->getContextId(),
1532  $entry->getStart(),
1534  false
1535  );
1536 
1537  // Fix for wrong, old entries
1538  foreach ((array) $apps as $own_app) {
1539  $ref_entry = new ilCalendarEntry($own_app);
1540  $ref_entry->delete();
1541  }
1542 
1543  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1544  $booking = new ilBookingEntry($entry->getContextId());
1545  $booking->cancelBooking($entry->getEntryId());
1546 
1547  // do NOT delete original entry
1548  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1549  $booking = new ilBookingReservation($entry->getContextId());
1551  $booking->update();
1552 
1553  $entry->delete();
1554  }
1555 
1556  ilUtil::sendSuccess($this->lng->txt('cal_cancel_booking_confirmed'), true);
1557  $this->ctrl->returnToParent($this);
1558  }
Model for a calendar entry.
setStatus($a_status)
Set booking status.
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.
Booking definition.
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
global $DIC
Definition: goto.php:24
cancelBooking($a_entry_id, $a_user_id=false)
cancel calendar booking for user
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ confirmRegister()

ilCalendarAppointmentGUI::confirmRegister ( )
protected

Register to an appointment.

Returns

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

References $_GET, $DIC, $tpl, ilDatePresentation\formatDate(), IL_CAL_UNIX, and ilConfirmationGUI\setFormAction().

1274  {
1275  global $DIC;
1276 
1277  $tpl = $DIC['tpl'];
1278 
1279  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1281  new ilDateTime($_GET['dstart'], IL_CAL_UNIX),
1282  new ilDateTime($_GET['dend'], IL_CAL_UNIX)
1283  );
1284 
1285 
1286  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1287  $conf = new ilConfirmationGUI;
1288 
1289  $this->ctrl->setParameter($this, 'dstart', (int) $_REQUEST['dstart']);
1290  $this->ctrl->setParameter($this, 'dend', (int) $_REQUEST['dend']);
1291 
1292  $conf->setFormAction($this->ctrl->getFormAction($this));
1293  $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1294  $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1295  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1296  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1297 
1298  $tpl->setContent($conf->getHTML());
1299  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
global $DIC
Definition: goto.php:24
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmUnregister()

ilCalendarAppointmentGUI::confirmUnregister ( )

Confirmation screen to unregister calendar.

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

References $_GET, $DIC, $tpl, ilDatePresentation\formatDate(), IL_CAL_UNIX, and ilConfirmationGUI\setFormAction().

1327  {
1328  global $DIC;
1329 
1330  $tpl = $DIC['tpl'];
1331 
1332 
1333  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1335  $dstart = new ilDateTime($_GET['dstart'], IL_CAL_UNIX),
1336  $dend = new ilDateTime($_GET['dend'], IL_CAL_UNIX)
1337  );
1338 
1339 
1340  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1341  $conf = new ilConfirmationGUI;
1342 
1343  $this->ctrl->setParameter($this, 'dstart', (int) $_REQUEST['dstart']);
1344  $this->ctrl->setParameter($this, 'dend', (int) $_REQUEST['dend']);
1345 
1346  $conf->setFormAction($this->ctrl->getFormAction($this));
1347  $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1348  $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1349  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1350  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1351 
1352  $tpl->setContent($conf->getHTML());
1353  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
global $DIC
Definition: goto.php:24
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDefaultCalendar()

ilCalendarAppointmentGUI::createDefaultCalendar ( )
protected

Create a default calendar.

protected

Returns

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

References $DIC, $ilUser, $lng, ilCalendarCategory\DEFAULT_COLOR, ilCalendarCache\getInstance(), and ilCalendarCategory\TYPE_USR.

Referenced by save(), and update().

1250  {
1251  global $DIC;
1252 
1253  $ilUser = $DIC['ilUser'];
1254  $lng = $DIC['lng'];
1255 
1256  $cat = new ilCalendarCategory();
1257  $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1258  $cat->setType(ilCalendarCategory::TYPE_USR);
1259  $cat->setTitle($this->lng->txt('cal_default_calendar'));
1260  $cat->setObjId($ilUser->getId());
1261 
1262  // delete calendar cache
1263  include_once './Services/Calendar/classes/class.ilCalendarCache.php';
1264  ilCalendarCache::getInstance()->deleteUserEntries($ilUser->getId());
1265 
1266  return $cat->add();
1267  }
static getInstance()
get singleton instance
Stores calendar categories.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarAppointmentGUI::delete ( )
protected

delete

protected

Parameters

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

References $app, ilCalendarCategoryAssignments\_deleteByAppointmentId(), and ilCalendarUserNotification\deleteCalendarEntry().

903  {
904  $app_ids = (array) ($this->request->getParsedBody()['appointment_ids'] ?? []);
905  if (!$app_ids) {
906  $this->logger->dump($app_ids);
907  $app_ids = (array) ($this->request->getQueryParams()['app_id'] ?? []);
908  }
909  if (!$app_ids) {
910  $this->ctrl->returnToParent($this);
911  }
912  foreach ($app_ids as $app_id) {
913  $app = new ilCalendarEntry($app_id);
914  $app->delete();
915 
916  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
918 
919  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
921  }
922  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
923  $this->ctrl->returnToParent($this);
924  }
Model for a calendar entry.
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static deleteCalendarEntry($a_cal_id)
Delete notification for a calendar entry ilDB $ilDB.
+ Here is the call graph for this function:

◆ deleteExclude()

ilCalendarAppointmentGUI::deleteExclude (   $a_return = true)
protected

delete single item of recurrence list

protected

Parameters

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

References IL_CAL_UNIX, and ilUtil\sendFailure().

934  {
935  $recurrence_ids = (array) ($this->request->getParsedBody()['recurrence_ids'] ?? []);
936  $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
937  if (!count($recurrence_ids)) {
938  ilUtil::sendFailure($this->lng->txt('select_one'), true);
939  $this->ctrl->redirect($this, 'askDelete');
940  }
941  if (!$app_id) {
942  $this->ctrl->returnToParent($this);
943  }
944  foreach ($recurrence_ids as $rdate) {
945  $exclusion = new ilCalendarRecurrenceExclusion();
946  $exclusion->setEntryId($app_id);
947  $exclusion->setDate(new ilDate($rdate, IL_CAL_UNIX));
948  $exclusion->save();
949  }
950  if ($a_return) {
951  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
952  $this->ctrl->returnToParent($this);
953  }
954  }
const IL_CAL_UNIX
Class for single dates.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Stores exclusion dates for calendar recurrences.
+ Here is the call graph for this function:

◆ distributeNotifications()

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

Distribute mail notifications.

Returns

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

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

489  {
490  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
491  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
492 
493  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
494  $notification = new ilCalendarMailNotification();
495  $notification->setAppointmentId($app_id);
496 
497  switch ($cat_info['type']) {
499 
500  switch ($cat_info['obj_type']) {
501  case 'crs':
502  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
503  $ref_id = current($ref_ids);
504  $notification->setRefId($ref_id);
505  $notification->setType(
506  $a_new_appointment ?
509  );
510  break;
511 
512  case 'grp':
513  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
514  $ref_id = current($ref_ids);
515  $notification->setRefId($ref_id);
516  $notification->setType(
517  $a_new_appointment ?
520  );
521  break;
522  }
523  break;
524  }
525 
526  $notification->send();
527  }
Distributes calendar mail notifications.
static _getAllReferences($a_id)
get all reference ids of object
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 ilObjUser $ilUser.

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

References $DIC, $ilUser, ANONYMOUS_USER_ID, notification(), ilCalendarUserNotification\TYPE_EMAIL, ilCalendarUserNotification\TYPE_USER, ilCalendarMailNotification\TYPE_USER, and ilCalendarMailNotification\TYPE_USER_ANONYMOUS.

Referenced by save(), and update().

456  {
457  global $DIC;
458 
459  $ilUser = $DIC['ilUser'];
460 
461  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
462  $notification = new ilCalendarMailNotification();
463  $notification->setAppointmentId($this->app->getEntryId());
464 
465  foreach ($this->notification->getRecipients() as $rcp) {
466  switch ($rcp['type']) {
468  $notification->setSender(ANONYMOUS_USER_ID);
469  $notification->setRecipients(array($rcp['usr_id']));
470  $notification->setType(ilCalendarMailNotification::TYPE_USER);
471  break;
472 
474  $notification->setSender(ANONYMOUS_USER_ID);
475  $notification->setRecipients(array($rcp['email']));
476  $notification->setType(ilCalendarMailNotification::TYPE_USER_ANONYMOUS);
477  break;
478  }
479  $notification->send();
480  }
481  }
const ANONYMOUS_USER_ID
Definition: constants.php:25
Distributes calendar mail notifications.
global $DIC
Definition: goto.php:24
notification()
Definition: notification.php:2
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUserAutoComplete()

ilCalendarAppointmentGUI::doUserAutoComplete ( )
protected

Do auto completion.

Returns
void

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

References $_GET, exit, and ilUserAutoComplete\MAX_ENTRIES.

1579  {
1580  if (!isset($_GET['autoCompleteField'])) {
1581  $a_fields = array('login','firstname','lastname','email');
1582  } else {
1583  $a_fields = array((string) $_GET['autoCompleteField']);
1584  }
1585 
1586  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1587  $auto = new ilUserAutoComplete();
1588  $auto->setSearchFields($a_fields);
1589  $auto->enableFieldSearchableCheck(true);
1590  $auto->setMoreLinkAvailable(true);
1591 
1592  if (($_REQUEST['fetchall'])) {
1593  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1594  }
1595 
1596  echo $auto->getList($_REQUEST['query']);
1597  exit();
1598  }
exit
Definition: login.php:29
$_GET["client_id"]
Auto completion class for user lists.

◆ edit()

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

edit appointment

protected

Parameters
boolsingel appointment

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

References $DIC, $GLOBALS, $ilErr, $ilUser, $tpl, ilDateTime\_equals(), ilCalendarCategories\_getInstance(), ilCalendarCategoryAssignments\_lookupCategory(), getAppointment(), IL_CAL_DAY, IL_CAL_UNIX, initForm(), and showInfoScreen().

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

621  {
622  global $DIC;
623 
624  $tpl = $DIC->ui()->mainTemplate();
625  $ilUser = $DIC['ilUser'];
626  $ilErr = $DIC['ilErr'];
627  $ilHelp = $DIC['ilHelp'];
628 
629  $ilHelp->setScreenIdComponent("cal");
630  $ilHelp->setScreenId("app");
631  if ($this->app->isMilestone()) {
632  $ilHelp->setSubScreenId("edit_milestone");
633  } else {
634  $ilHelp->setSubScreenId("edit");
635  }
636 
637  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
638  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
639  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
640 
641  $GLOBALS['DIC']['ilCtrl']->saveParameter($this, array('seed','app_id','dt','idate'));
642 
643  if ($_REQUEST['rexl']) {
644  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'rexl', 1);
645  // Calculate new appointment time
646  $duration = $this->getAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->getAppointment()->getStart()->get(IL_CAL_UNIX);
647  include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
648  $calc = new ilCalendarRecurrenceCalculator($this->getAppointment(), $this->rec);
649 
650  $current_date = new ilDateTime($_REQUEST['dt'], IL_CAL_UNIX);
651 
652  $yesterday = clone $current_date;
653  $yesterday->increment(IL_CAL_DAY, -1);
654  $tomorrow = clone $current_date;
655  $tomorrow->increment(IL_CAL_DAY, 1);
656 
657 
658  foreach ($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry) {
659  if (ilDateTime::_equals($current_date, $date_entry, IL_CAL_DAY)) {
660  $this->getAppointment()->setStart(new ilDateTime($date_entry->get(IL_CAL_UNIX), IL_CAL_UNIX));
661  $this->getAppointment()->setEnd(new ilDateTime($date_entry->get(IL_CAL_UNIX) + $duration, IL_CAL_UNIX));
662  break;
663  }
664  }
665 
666  // Finally reset recurrence
667  $this->rec = new ilCalendarRecurrence();
668  }
669 
670  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
672 
673  if (!$cats->isVisible($cat_id)) {
674  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
675  return false;
676  }
677  if (!$cats->isEditable($cat_id) or $this->app->isAutoGenerated()) {
678  $this->showInfoScreen();
679  return true;
680  }
681  if (!$form instanceof ilPropertyFormGUI) {
682  $this->initForm('edit', $this->app->isMilestone(), $a_edit_single_app);
683  }
684  $tpl->setContent($this->form->getHTML());
685  }
getAppointment()
Get current appointment.
static _lookupCategory($a_cal_id)
Lookup category id.
This class represents a property form user interface.
const IL_CAL_UNIX
$ilErr
Definition: raiseError.php:18
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
Calculates an ilDateList for a given calendar entry and recurrence rule.
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
static _getInstance($a_usr_id=0)
get singleton instance
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editResponsibleUsers()

ilCalendarAppointmentGUI::editResponsibleUsers ( )

Edit responsible users.

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

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

533  {
534  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
535  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
536  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
537  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
538 
539  $this->showResponsibleUsersList($cat_info['obj_id']);
540  }
static _lookupCategory($a_cal_id)
Lookup category id.
static _getInstance($a_usr_id=0)
get singleton instance
showResponsibleUsersList($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 605 of file class.ilCalendarAppointmentGUI.php.

References $GLOBALS, and edit().

606  {
607  $_REQUEST['rexl'] = 1;
608  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'rexcl', 1);
609  $this->edit(true);
610  }
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarAppointmentGUI::executeCommand ( )

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

References $DIC, $ilSetting, $ilUser, and $tpl.

61  {
62  global $DIC;
63 
64  $ilUser = $DIC['ilUser'];
65  $ilSetting = $DIC['ilSetting'];
66  $tpl = $DIC['tpl'];
67  $ilTabs = $DIC['ilTabs'];
68 
69 
70  // Clear tabs and set back target
71  $ilTabs->clearTargets();
72  $ilTabs->setBackTarget(
73  $this->lng->txt('cal_back_to_cal'),
74  $this->ctrl->getLinkTarget($this, 'cancel')
75  );
76 
77  $next_class = $this->ctrl->getNextClass($this);
78  switch ($next_class) {
79 
80  default:
81  $cmd = $this->ctrl->getCmd("add");
82  $this->$cmd();
83  break;
84  }
85  }
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18

◆ getAppointment()

ilCalendarAppointmentGUI::getAppointment ( )

Get current appointment.

Returns
ilCalendarEntry

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

References $app.

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

+ Here is the caller graph for this function:

◆ initAppointment()

ilCalendarAppointmentGUI::initAppointment (   $a_app_id = 0)
protected

init appointment

protected

Parameters
intappointment id
Returns

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

References $initialDate, ilCalendarRecurrences\_getFirstRecurrence(), IL_CAL_HOUR, and notification().

Referenced by __construct().

1013  {
1014  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1015  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
1016  $this->app = new ilCalendarEntry($a_app_id);
1017 
1018  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
1019  $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
1020 
1021  if (!$a_app_id) {
1022  $start = clone $this->initialDate;
1023  $this->app->setStart($start);
1024 
1025  $seed_end = clone $this->initialDate;
1026  if ($this->default_fulltime) {
1027  #$seed_end->increment(IL_CAL_DAY,1);
1028  } else {
1029  $seed_end->increment(IL_CAL_HOUR, 1);
1030  }
1031  $this->app->setEnd($seed_end);
1032  $this->app->setFullday($this->default_fulltime);
1033 
1034  $this->rec = new ilCalendarRecurrence();
1035  } else {
1036  $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
1037  }
1038  }
Model for a calendar entry.
const IL_CAL_HOUR
static _getFirstRecurrence($a_cal_id)
get first recurrence
notification()
Definition: notification.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

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

init form

protected

Parameters
stringmode ('edit' | 'create')
Returns

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

References $_GET, $_POST, $DIC, $i, $ilUser, $rec, XapiProxy\$resp, $tpl, $type, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarCategories\_lookupCategoryIdByObjId(), ilObjUser\_lookupLogin(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilCalendarCategoryAssignments\getFirstAssignment(), ilYuiUtil\initDomEvent(), notification(), ilDateTimeInputGUI\setDate(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setValue(), ilCalendarUserNotification\TYPE_EMAIL, ilCalendarCategory\TYPE_OBJ, and ilCalendarUserNotification\TYPE_USER.

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

116  {
117  global $DIC;
118 
119  $ilUser = $DIC['ilUser'];
120  $tpl = $DIC['tpl'];
121 
122  $this->form = new ilPropertyFormGUI();
123 
124  include_once('./Services/YUI/classes/class.ilYuiUtil.php');
126  $resp_info = false;
127  switch ($a_mode) {
128  case 'create':
129  $this->ctrl->saveParameter($this, array('seed','idate'));
130  $this->form->setFormAction($this->ctrl->getFormAction($this));
131  if ($a_as_milestone) {
132  $this->form->setTitle($this->lng->txt('cal_new_ms'));
133  $this->form->addCommandButton('saveMilestone', $this->lng->txt('cal_add_milestone'));
134  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
135  } else {
136  $this->form->setTitle($this->lng->txt('cal_new_app'));
137  $this->form->addCommandButton('save', $this->lng->txt('cal_add_appointment'));
138  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
139  }
140  break;
141 
142  case 'edit':
143  if ($a_as_milestone) {
144  $this->form->setTitle($this->lng->txt('cal_edit_milestone'));
145  } else {
146  $this->form->setTitle($this->lng->txt('cal_edit_appointment'));
147  }
148  $this->ctrl->saveParameter($this, array('seed','app_id','idate'));
149  $this->form->setFormAction($this->ctrl->getFormAction($this));
150 
151  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
152  $cat = $ass->getFirstAssignment();
153  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
154  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat);
155  $type = ilObject::_lookupType($cat_info['obj_id']);
156  if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
157  && ($type == "grp" || $type == "crs")) {
158  $resp_info = true;
159  $this->form->addCommandButton('editResponsibleUsers', $this->lng->txt('cal_change_responsible_users'));
160  }
161  $this->form->addCommandButton('update', $this->lng->txt('save'));
162  // $this->form->addCommandButton('askDelete',$this->lng->txt('delete'));
163  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
164  break;
165  }
166  // title
167  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
168  $title->setValue($this->app->getTitle());
169  $title->setRequired(true);
170  $title->setMaxLength(128);
171  $title->setSize(32);
172  $this->form->addItem($title);
173 
174  // calendar selection
175  $calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'), 'calendar');
176  if ($_POST['category']) {
177  $calendar->setValue((int) $_POST['calendar']);
178  $selected_calendar = (int) $_POST['calendar'];
179  } elseif ($_GET['category_id']) {
180  $calendar->setValue((int) $_GET['category_id']);
181  $selected_calendar = (int) $_GET['category_id'];
182  } elseif ($a_mode == 'edit') {
183  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
184  $cat = $ass->getFirstAssignment();
185  $calendar->setValue($cat);
186  $selected_calendar = $cat;
187  } elseif (isset($_GET['ref_id'])) {
188  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
189  $obj_cal = ilObject::_lookupObjId($_GET['ref_id']);
190  $calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal));
191  $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal);
193  $cats->readSingleCalendar($selected_calendar);
194  } else {
196  $categories = $cats->prepareCategoriesOfUserForSelection();
197  $selected_calendar = key((array) $categories);
198  $calendar->setValue($selected_calendar);
199  }
200  $calendar->setRequired(true);
202  $calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
203 
204  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
205  if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) {
206  $notification_cals = $cats->getNotificationCalendars();
207  $notification_cals = count($notification_cals) ? implode(',', $notification_cals) : '';
208  $calendar->addCustomAttribute("onchange=\"ilToggleNotification([" . $notification_cals . "]);\"");
209  }
210  $this->form->addItem($calendar);
211 
212  if (!$a_as_milestone) {
213  include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
214  $tpl->addJavaScript('./Services/Form/js/date_duration.js');
215  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
216  $dur->setRequired(true);
217  $dur->enableToggleFullTime(
218  $this->lng->txt('cal_fullday_title'),
219  $this->app->isFullday() ? true : false
220  );
221  $dur->setShowTime(true);
222  $dur->setStart($this->app->getStart());
223  $dur->setEnd($this->app->getEnd());
224  $this->form->addItem($dur);
225 
226  // recurrence
227  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
228  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
229  $rec->setRecurrence($this->rec);
230  $this->form->addItem($rec);
231 
232  // location
233  $where = new ilTextInputGUI($this->lng->txt('cal_where'), 'location');
234  $where->setValue($this->app->getLocation());
235  $where->setMaxLength(128);
236  $where->setSize(32);
237  $this->form->addItem($where);
238  } else {
239  $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'), 'event_start');
240  $deadline->setDate($this->app->getStart());
241  $deadline->setShowTime(false);
242  $deadline->setMinuteStepSize(5);
243  $this->form->addItem($deadline);
244 
245  // completion
246  $completion_vals = array();
247  for ($i = 0; $i <= 100; $i += 5) {
248  $completion_vals[$i] = $i . " %";
249  }
250  $compl = new ilSelectInputGUI(
251  $this->lng->txt('cal_task_completion'),
252  'completion'
253  );
254  $compl->setOptions($completion_vals);
255  $compl->setValue($this->app->getCompletion());
256  $this->form->addItem($compl);
257  }
258 
259  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
260  $desc->setValue($this->app->getDescription());
261  $desc->setRows(5);
262  $this->form->addItem($desc);
263 
264  if ($a_as_milestone && $a_mode == "edit" && $resp_info) {
265  // users responsible
266  $users = $this->app->readResponsibleUsers();
267  $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'), "", true);
268  $delim = "";
269  foreach ($users as $r) {
270  $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
271  $delim = "<br />";
272  }
273  if (count($users) > 0) {
274  $resp->setValue($value);
275  } else {
276  $resp->setValue("-");
277  }
278 
279  $this->form->addItem($resp);
280  }
281 
282 
283  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
284  $notu = new ilTextWizardInputGUI($this->lng->txt('cal_user_notification'), 'notu');
285  $notu->setInfo($this->lng->txt('cal_user_notification_info'));
286  $notu->setSize(20);
287  $notu->setMaxLength(64);
288 
289  $values = array();
290  foreach ($this->notification->getRecipients() as $rcp) {
291  switch ($rcp['type']) {
293  $values[] = ilObjUser::_lookupLogin($rcp['usr_id']);
294  break;
295 
297  $values[] = $rcp['email'];
298  break;
299  }
300  }
301  if (count($values)) {
302  $notu->setValues($values);
303  } else {
304  $notu->setValues(array(''));
305  }
306  $this->form->addItem($notu);
307  }
308 
309  // Notifications
310  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
311  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars())) {
312  $selected_cal = new ilCalendarCategory($selected_calendar);
313  $disabled = true;
314  if ($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ) {
315  if (ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp') {
316  $disabled = false;
317  }
318  }
319 
320  $tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js');
321  $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'), 'not');
322  $not->setInfo($this->lng->txt('cal_notification_info'));
323  $not->setValue(1);
324  $not->setChecked($this->app->isNotificationEnabled());
325  $not->setDisabled($disabled);
326  $this->form->addItem($not);
327  }
328  }
static _lookupLogin($a_user_id)
lookup login
static _getInstance()
get singleton instance
This class represents a property form user interface.
$type
$_GET["client_id"]
This class represents an input GUI for recurring events/appointments (course events or calendar appoi...
setValue($a_value)
Set Value.
static _lookupCategoryIdByObjId($a_obj_id)
lookup category by obj_id
This class represents a checkbox property in a property form.
Stores calendar categories.
This class represents a date/time property in a property form.
setInfo($a_info)
Set Information Text.
input GUI for a time span (start and end date)
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
setDate(ilDateTime $a_date=null)
set date E.g $dt_form->setDate(new ilDateTime(time(),IL_CAL_UTC)); or $dt_form->setDate(new ilDateTim...
notification()
Definition: notification.php:2
static initDomEvent(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
$ilUser
Definition: imgupload.php:18
This class represents a text wizard property in a property form.
$_POST["username"]
setRequired($a_required)
Set Required.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormConfirmBooking()

ilCalendarAppointmentGUI::initFormConfirmBooking ( )
protected
Returns
ilPropertyFormGUI

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

References $message.

Referenced by book(), and bookconfirmed().

1410  {
1411  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1412  $form = new ilPropertyFormGUI();
1413  $form->setFormAction($this->ctrl->getFormAction($this));
1414  $form->addCommandButton('bookconfirmed', $this->lng->txt('cal_confirm_booking'));
1415  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1416 
1417  $date = new ilNonEditableValueGUI($this->lng->txt('appointment'), 'date');
1418  $form->addItem($date);
1419 
1420  $title = new ilNonEditableValueGUI($this->lng->txt('title'), 'title');
1421  $form->addItem($title);
1422 
1423  $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1424  $message->setRows(5);
1425  $form->addItem($message);
1426 
1427  return $form;
1428  }
This class represents a property form user interface.
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
$message
Definition: xapiexit.php:14
+ Here is the caller graph for this function:

◆ initInitialDate()

ilCalendarAppointmentGUI::initInitialDate ( ilDate  $initialDate)
protected

init initial date

Parameters
ilDate$initialDate

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

References $_GET, $initialDate, $timezone, ilDate\get(), IL_CAL_DATE, and IL_CAL_DATETIME.

Referenced by __construct().

977  {
978  if (!isset($_GET['hour'])) {
979  $this->initialDate = clone $initialDate;
980  $this->default_fulltime = true;
981  } else {
982  if ((int) $_GET['hour'] < 10) {
983  $time = '0' . (int) $_GET['hour'] . ':00:00';
984  } else {
985  $time = (int) $_GET['hour'] . ':00:00';
986  }
987  $this->initialDate = new ilDateTime($initialDate->get(IL_CAL_DATE) . ' ' . $time, IL_CAL_DATETIME, $this->timezone);
988  $this->default_fulltime = false;
989  }
990  }
const IL_CAL_DATETIME
$_GET["client_id"]
get($a_format, $a_format_str='', $a_tz='')
get formatted date
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

init seed

protected

Parameters

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

References $seed.

Referenced by __construct().

1000  {
1001  $this->seed = clone $seed;
1002  $this->default_fulltime = true;
1003  }
+ Here is the caller graph for this function:

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

init timezone

protected

Parameters

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

References $DIC, and $ilUser.

Referenced by __construct().

964  {
965  global $DIC;
966 
967  $ilUser = $DIC['ilUser'];
968 
969  $this->timezone = $ilUser->getTimeZone();
970  }
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ load()

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

load post

protected

Parameters

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

References $_POST, initForm(), loadNotificationRecipients(), loadRecurrenceSettings(), and ilUtil\stripSlashes().

Referenced by save(), and update().

1048  {
1049  // needed for date handling
1050  $this->initForm($a_mode, $a_as_milestone);
1051  $this->form->checkInput();
1052 
1053  if ($a_as_milestone) {
1054  $this->app->setMilestone(true);
1055  $this->app->setCompletion(ilUtil::stripSlashes($_POST['completion']));
1056  }
1057 
1058  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1059  $this->app->setLocation(ilUtil::stripSlashes($_POST['location']));
1060  $this->app->setDescription(ilUtil::stripSlashes($_POST['description']));
1061  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1062  $this->app->enableNotification((int) $_POST['not']);
1063 
1064  if ($a_as_milestone) { // milestones are always fullday events
1065  $start = $this->form->getItemByPostVar('event_start');
1066  $start = $start->getDate();
1067 
1068  $this->app->setFullday(true);
1069 
1070  // for milestones is end date = start date
1071  $this->app->setStart($start);
1072  $this->app->setEnd($start);
1073  } else {
1074  $period = $this->form->getItemByPostVar('event');
1075  $start = $period->getStart();
1076  $end = $period->getEnd();
1077 
1078  $this->app->setFullday($start instanceof ilDate);
1079  $this->app->setStart($start);
1080  $this->app->setEnd($end);
1081  }
1082 
1083  $this->loadNotificationRecipients();
1084  $this->loadRecurrenceSettings($a_as_milestone = false);
1085  }
Class for single dates.
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
loadRecurrenceSettings($a_as_milestone=false)
load recurrence settings
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadNotificationRecipients()

ilCalendarAppointmentGUI::loadNotificationRecipients ( )
protected

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

References $_POST, ilObjUser\_loginExists(), notification(), ilUtil\stripSlashes(), ilCalendarUserNotification\TYPE_EMAIL, and ilCalendarUserNotification\TYPE_USER.

Referenced by load().

1088  {
1089  $this->notification->setRecipients(array());
1090 
1091  foreach ((array) $_POST['notu'] as $rcp) {
1092  $rcp = trim(ilUtil::stripSlashes($rcp));
1093  $usr_id = ilObjUser::_loginExists($rcp);
1094 
1095  if (strlen($rcp) == 0) {
1096  continue;
1097  }
1098 
1099  if ($usr_id) {
1100  $this->notification->addRecipient(
1102  $usr_id
1103  );
1104  } else {
1105  $this->notification->addRecipient(
1107  0,
1108  $rcp
1109  );
1110  }
1111  }
1112  }
static _loginExists($a_login, $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...
notification()
Definition: notification.php:2
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRecurrenceSettings()

ilCalendarAppointmentGUI::loadRecurrenceSettings (   $a_as_milestone = false)
protected

load recurrence settings

protected

Returns

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

References $_POST, IL_CAL_FREQ_DAILY, IL_CAL_FREQ_MONTHLY, IL_CAL_FREQ_WEEKLY, IL_CAL_FREQ_YEARLY, and ilUtil\stripSlashes().

Referenced by load().

1121  {
1122  $this->rec->reset();
1123 
1124  switch ($_POST['frequence']) {
1125  case IL_CAL_FREQ_DAILY:
1126  $this->rec->setFrequenceType($_POST['frequence']);
1127  $this->rec->setInterval((int) $_POST['count_DAILY']);
1128  break;
1129 
1130  case IL_CAL_FREQ_WEEKLY:
1131  $this->rec->setFrequenceType($_POST['frequence']);
1132  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1133  if (is_array($_POST['byday_WEEKLY'])) {
1134  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $_POST['byday_WEEKLY'])));
1135  }
1136  break;
1137 
1138  case IL_CAL_FREQ_MONTHLY:
1139  $this->rec->setFrequenceType($_POST['frequence']);
1140  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1141  switch ((int) $_POST['subtype_MONTHLY']) {
1142  case 0:
1143  // nothing to do;
1144  break;
1145 
1146  case 1:
1147  switch ((int) $_POST['monthly_byday_day']) {
1148  case 8:
1149  // Weekday
1150  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1151  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1152  break;
1153 
1154  case 9:
1155  // Day of month
1156  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1157  break;
1158 
1159  default:
1160  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'] . $_POST['monthly_byday_day']);
1161  break;
1162  }
1163  break;
1164 
1165  case 2:
1166  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1167  break;
1168  }
1169  break;
1170 
1171  case IL_CAL_FREQ_YEARLY:
1172  $this->rec->setFrequenceType($_POST['frequence']);
1173  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1174  switch ((int) $_POST['subtype_YEARLY']) {
1175  case 0:
1176  // nothing to do;
1177  break;
1178 
1179  case 1:
1180  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1181  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'] . $_POST['yearly_byday']);
1182  break;
1183 
1184  case 2:
1185  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1186  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1187  break;
1188  }
1189  break;
1190  }
1191 
1192  // UNTIL
1193  switch ((int) $_POST['until_type']) {
1194  case 1:
1195  $this->rec->setFrequenceUntilDate(null);
1196  // nothing to do
1197  break;
1198 
1199  case 2:
1200  $this->rec->setFrequenceUntilDate(null);
1201  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1202  break;
1203 
1204  case 3:
1205  $dt = new ilDateTimeInputGUI('', 'until_end');
1206  $dt->setRequired(true);
1207  if ($dt->checkInput()) {
1208  $this->rec->setFrequenceUntilCount(0);
1209  $this->rec->setFrequenceUntilDate($dt->getDate());
1210  }
1211  break;
1212  }
1213  }
const IL_CAL_FREQ_MONTHLY
This class represents a date/time property in a property form.
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
const IL_CAL_FREQ_YEARLY
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
const IL_CAL_FREQ_WEEKLY
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ register()

ilCalendarAppointmentGUI::register ( )
protected

Register.

Returns

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

References $_POST, $DIC, $ilUser, and IL_CAL_UNIX.

1306  {
1307  global $DIC;
1308 
1309  $ilUser = $DIC['ilUser'];
1310 
1311  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1312  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1313  $reg->register(
1314  $ilUser->getId(),
1315  new ilDateTime((int) $_REQUEST['dstart'], IL_CAL_UNIX),
1316  new ilDateTime((int) $_REQUEST['dend'], IL_CAL_UNIX)
1317  );
1318 
1319  ilUtil::sendSuccess($this->lng->txt('cal_reg_registered'), true);
1320  $this->ctrl->returnToParent($this);
1321  }
const IL_CAL_UNIX
registration for calendar appointments
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
$_POST["username"]

◆ save()

ilCalendarAppointmentGUI::save (   $a_as_milestone = false)
protected

save appointment

protected

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

References $_POST, $DIC, $ilErr, $type, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilObject\_lookupType(), add(), ilCalendarCategoryAssignments\addAssignment(), addMilestone(), createDefaultCalendar(), distributeNotifications(), distributeUserNotifications(), load(), notification(), saveRecurrenceSettings(), ilUtil\sendFailure(), showResponsibleUsersList(), and ilCalendarCategory\TYPE_OBJ.

Referenced by saveMilestone().

391  {
392  global $DIC;
393 
394  $ilErr = $DIC['ilErr'];
395 
396  $this->load('create', $a_as_milestone);
397 
398  if ($this->app->validate() and $this->notification->validate()) {
399  if (!(int) $_POST['calendar']) {
400  $cat_id = $this->createDefaultCalendar();
401  } else {
402  $cat_id = (int) $_POST['calendar'];
403  }
404 
405  $this->app->save();
406  $this->notification->setEntryId($this->app->getEntryId());
407  $this->notification->save();
408  $this->rec->setEntryId($this->app->getEntryId());
409  $this->saveRecurrenceSettings();
410 
411  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
412  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
413  $ass->addAssignment($cat_id);
414 
415  // Send notifications
416  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
417  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not']) {
418  $this->distributeNotifications($cat_id, $this->app->getEntryId(), true);
419  }
420  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
422  }
423 
424  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
425  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
426  $type = ilObject::_lookupType($cat_info['obj_id']);
427 
428  if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
429  && ($type == "grp" || $type == "crs")) {
430  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone_resp_q'), true);
431  return $this->showResponsibleUsersList($cat_info['obj_id']);
432  } elseif ($a_as_milestone) {
433  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone'), true);
434  $this->ctrl->returnToParent($this);
435  } else {
436  ilUtil::sendSuccess($this->lng->txt('cal_created_appointment'), true);
437  $this->ctrl->returnToParent($this);
438  }
439  } else {
440  $this->form->setValuesByPost();
441  ilUtil::sendFailure($ilErr->getMessage());
442  return $this->add($this->form);
443  }
444  if ($a_as_milestone) {
445  $this->addMilestone();
446  } else {
447  $this->add();
448  }
449  }
static _getInstance()
get singleton instance
$type
$ilErr
Definition: raiseError.php:18
distributeUserNotifications()
Send mail to selected users ilObjUser $ilUser.
global $DIC
Definition: goto.php:24
notification()
Definition: notification.php:2
static _getInstance($a_usr_id=0)
get singleton instance
distributeNotifications($a_cat_id, $app_id, $a_new_appointment=true)
Distribute mail notifications.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
load($a_mode, $a_as_milestone=false)
load post
add(ilPropertyFormGUI $form=null)
add new appointment
saveRecurrenceSettings()
save recurrence settings
createDefaultCalendar()
Create a default calendar.
$_POST["username"]
showResponsibleUsersList($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

save milestone

protected

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

References save().

381  {
382  $this->save(true);
383  }
save($a_as_milestone=false)
save appointment
+ Here is the call graph for this function:

◆ saveMilestoneResponsibleUsers()

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

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

References $_POST, and $DIC.

566  {
567  global $DIC;
568 
569  $ilCtrl = $DIC['ilCtrl'];
570 
571  $this->app->writeResponsibleUsers($_POST["user_id"]);
572  $ilCtrl->returnToParent($this);
573  }
global $DIC
Definition: goto.php:24
$_POST["username"]

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

save recurrence settings

protected

Parameters

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

References $_POST.

Referenced by save(), and update().

1223  {
1224  switch ($_POST['frequence']) {
1225  case 'NONE':
1226  case '':
1227  // No recurrence => delete if there is an recurrence rule
1228  if ($this->rec->getRecurrenceId()) {
1229  $this->rec->delete();
1230  }
1231  break;
1232 
1233  default:
1234  if ($this->rec->getRecurrenceId()) {
1235  $this->rec->update();
1236  } else {
1237  $this->rec->save();
1238  }
1239  break;
1240  }
1241  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ showInfoScreen()

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

show info screen

protected

Returns

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

References $DIC, $ilUser, $tpl, $type, ilObject\_getAllReferences(), ilCalendarCategories\_getInstance(), ilLink\_getStaticLink(), ilCalendarCategoryAssignments\_lookupCategory(), ilObject\_lookupType(), ilDatePresentation\formatPeriod(), and ilCalendarCategory\TYPE_OBJ.

Referenced by edit().

694  {
695  global $DIC;
696 
697  $tpl = $DIC['tpl'];
698  $ilUser = $DIC['ilUser'];
699 
700  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
701  $info = new ilInfoScreenGUI($this);
702  $info->setFormAction($this->ctrl->getFormAction($this));
703 
704  if ($this->app->isMilestone()) {
705  $info->addSection($this->lng->txt('cal_ms_details'));
706  } else {
707  $info->addSection($this->lng->txt('cal_details'));
708  }
709 
710  // Appointment
711  $info->addProperty(
712  $this->lng->txt('appointment'),
714  $this->app->getStart(),
715  $this->app->getEnd()
716  )
717  );
718  $info->addProperty($this->lng->txt('title'), $this->app->getPresentationTitle());
719 
720  // Description
721  if (strlen($desc = $this->app->getDescription())) {
722  $info->addProperty($this->lng->txt('description'), $desc);
723  }
724 
725  // Location
726  if (strlen($loc = $this->app->getLocation())) {
727  $info->addProperty($this->lng->txt('cal_where'), $loc);
728  }
729 
730  // completion
731  if ($this->app->isMilestone() && $this->app->getCompletion() > 0) {
732  $info->addProperty(
733  $this->lng->txt('cal_task_completion'),
734  $this->app->getCompletion() . " %"
735  );
736  }
737 
738  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
739  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
740  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
741  $type = ilObject::_lookupType($cat_info['obj_id']);
742  if ($this->app->isMilestone() && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
743  && ($type == "grp" || $type == "crs")) {
744  // users responsible
745  $users = $this->app->readResponsibleUsers();
746  $delim = "";
747  foreach ($users as $r) {
748  $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
749  $delim = "<br />";
750  }
751  if (count($users) > 0) {
752  $info->addProperty(
753  $this->lng->txt('cal_responsible'),
754  $value
755  );
756  }
757  }
758 
759  $category = new ilCalendarCategory($cat_id);
760 
761  if ($category->getType() == ilCalendarCategory::TYPE_OBJ) {
762  $info->addSection($this->lng->txt('additional_info'));
763 
764  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
765  $refs = ilObject::_getAllReferences($cat_info['obj_id']);
766 
767  include_once('./Services/Link/classes/class.ilLink.php');
768  $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($cat_info['obj_id']), true);
769  $info->addProperty($this->lng->txt('perma_link'), '<a class="small" href="' . $href . '" target="_top">' . $href . '</a>');
770  }
771 
772  $tpl->setContent($info->getHTML());
773  }
static _lookupCategory($a_cal_id)
Lookup category id.
Class ilInfoScreenGUI.
$type
Stores calendar categories.
static _getAllReferences($a_id)
get all reference ids of object
global $DIC
Definition: goto.php:24
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupType($a_id, $a_reference=false)
lookup object type
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showResponsibleUsersList()

ilCalendarAppointmentGUI::showResponsibleUsersList (   $a_grp_id)

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

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

References $DIC, and $tpl.

Referenced by editResponsibleUsers(), and save().

547  {
548  global $DIC;
549 
550  $tpl = $DIC['tpl'];
551 
552  include_once("./Services/Calendar/classes/class.ilMilestoneResponsiblesTableGUI.php");
553  $table_gui = new ilMilestoneResponsiblesTableGUI(
554  $this,
555  "",
556  $a_grp_id,
557  $this->app->getEntryId()
558  );
559  $tpl->setContent($table_gui->getHTML());
560  }
TableGUI class for selection of milestone responsibles.
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ unregister()

ilCalendarAppointmentGUI::unregister ( )
protected

Unregister calendar, was confirmed.

Returns

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

References $_POST, $DIC, $ilUser, and IL_CAL_UNIX.

1360  {
1361  global $DIC;
1362 
1363  $ilUser = $DIC['ilUser'];
1364 
1365  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1366  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1367  $reg->unregister(
1368  $ilUser->getId(),
1369  new ilDateTime((int) $_REQUEST['dstart'], IL_CAL_UNIX),
1370  new ilDateTime((int) $_REQUEST['dend'], IL_CAL_UNIX)
1371  );
1372 
1373  ilUtil::sendSuccess($this->lng->txt('cal_reg_unregistered'), true);
1374  $this->ctrl->returnToParent($this);
1375  }
const IL_CAL_UNIX
registration for calendar appointments
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
$_POST["username"]

◆ update()

ilCalendarAppointmentGUI::update ( )
protected

update

protected

Returns

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

References $_POST, $DIC, $ilErr, ilCalendarSettings\_getInstance(), createDefaultCalendar(), ilCalendarCategoryAssignments\deleteAssignments(), distributeNotifications(), distributeUserNotifications(), edit(), ilDatePresentation\formatDate(), getAppointment(), IL_CAL_UNIX, load(), notification(), saveRecurrenceSettings(), and ilUtil\sendFailure().

782  {
783  global $DIC;
784 
785  $ilErr = $DIC['ilErr'];
786 
787  $single_editing = ($_REQUEST['rexl'] ? true : false);
788 
789  $this->load('edit', $this->app->isMilestone());
790  if ($this->app->validate() and $this->notification->validate()) {
791  if (!(int) $_POST['calendar']) {
792  $cat_id = $this->createDefaultCalendar();
793  } else {
794  $cat_id = (int) $_POST['calendar'];
795  }
796 
797  if ($single_editing) {
798  $original_id = $this->getAppointment()->getEntryId();
799  $this->getAppointment()->save();
800  $selected_ut = (int) ($this->request->getQueryParams()['dt'] ?? 0);
801  if ($selected_ut > 0) {
802  $exclusion = new ilCalendarRecurrenceExclusion();
803  $exclusion->setEntryId($original_id);
804  $exclusion->setDate(new ilDate($selected_ut, IL_CAL_UNIX));
805  $this->logger->dump($this->getAppointment()->getEntryId());
806  $this->logger->dump(ilDatePresentation::formatDate(new ilDate($selected_ut, IL_CAL_UNIX)));
807  $exclusion->save();
808  }
809  $this->rec = new ilCalendarRecurrence();
810  $this->rec->setEntryId($this->getAppointment()->getEntryId());
811  } else {
812  $this->getAppointment()->update();
813  }
814  $this->notification->save();
815  $this->saveRecurrenceSettings();
816  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
817  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
818  $this->logger->debug($this->app->getEntryId());
819  $ass->deleteAssignments();
820  $ass->addAssignment($cat_id);
821 
822  // Send notifications
823  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
824  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not']) {
825  $this->distributeNotifications($cat_id, $this->app->getEntryId(), false);
826  }
827  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
829  }
830 
831  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
832  $this->ctrl->returnToParent($this);
833  } else {
834  $this->form->setValuesByPost();
835  ilUtil::sendFailure($ilErr->getMessage());
836  }
837  $this->edit(false, $this->form);
838  }
getAppointment()
Get current appointment.
static _getInstance()
get singleton instance
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
$ilErr
Definition: raiseError.php:18
Class for single dates.
distributeUserNotifications()
Send mail to selected users ilObjUser $ilUser.
global $DIC
Definition: goto.php:24
notification()
Definition: notification.php:2
distributeNotifications($a_cat_id, $app_id, $a_new_appointment=true)
Distribute mail notifications.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
load($a_mode, $a_as_milestone=false)
load post
saveRecurrenceSettings()
save recurrence settings
Stores exclusion dates for calendar recurrences.
createDefaultCalendar()
Create a default calendar.
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $app

ilCalendarAppointmentGUI::$app = null
protected

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

Referenced by delete(), and getAppointment().

◆ $ctrl

ilCalendarAppointmentGUI::$ctrl
protected

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

◆ $default_fulltime

ilCalendarAppointmentGUI::$default_fulltime = true
protected

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

◆ $initialDate

ilCalendarAppointmentGUI::$initialDate = null
protected

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

Referenced by initAppointment(), and initInitialDate().

◆ $lng

ilCalendarAppointmentGUI::$lng
protected

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

Referenced by createDefaultCalendar().

◆ $logger

ilCalendarAppointmentGUI::$logger = null
private

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

◆ $rec

ilCalendarAppointmentGUI::$rec = null
protected

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

Referenced by askEdit(), and initForm().

◆ $request

ilCalendarAppointmentGUI::$request
protected

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

◆ $seed

ilCalendarAppointmentGUI::$seed = null
protected

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

Referenced by initSeed().

◆ $timezone

ilCalendarAppointmentGUI::$timezone = null
protected

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

Referenced by initInitialDate().

◆ $tpl


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