ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarAppointmentGUI Class Reference

Administrate calendar appointments. More...

+ Collaboration diagram for ilCalendarAppointmentGUI:

Public Member Functions

 __construct (ilDate $seed, ilDate $initialDate, $a_appointment_id=0)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 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
 

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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarAppointmentGUI::__construct ( ilDate  $seed,
ilDate  $initialDate,
  $a_appointment_id = 0 
)

Constructor.

public

Parameters
ilDateseed
Returns

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

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

39  {
40  global $DIC;
41 
42  $ilCtrl = $DIC['ilCtrl'];
43  $lng = $DIC['lng'];
44 
45  $this->lng = $lng;
46  $lng->loadLanguageModule('dateplaner');
47  $this->ctrl = $ilCtrl;
48 
49  $this->logger = $GLOBALS['DIC']->logger()->cal();
50 
51  $this->initTimeZone();
52  $this->initSeed($seed);
53  $this->initInitialDate($initialDate);
54  $this->initAppointment($a_appointment_id);
55  }
global $DIC
Definition: saml.php:7
initAppointment($a_app_id=0)
init appointment
initInitialDate(ilDate $initialDate)
init initial date
global $ilCtrl
Definition: ilias.php:18
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 343 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save().

344  {
345  global $DIC;
346 
347  $tpl = $DIC['tpl'];
348  $ilHelp = $DIC['ilHelp'];
349 
350  $ilHelp->setScreenIdComponent("cal");
351  $ilHelp->setScreenId("app");
352  $ilHelp->setSubScreenId("create");
353 
354  if (!$form instanceof ilPropertyFormGUI) {
355  $this->initForm('create');
356  }
357  $tpl->setContent($this->form->getHTML());
358  }
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
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 366 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save().

367  {
368  global $DIC;
369 
370  $tpl = $DIC['tpl'];
371  $ilHelp = $DIC['ilHelp'];
372 
373  $ilHelp->setScreenIdComponent("cal");
374  $ilHelp->setScreenId("app");
375  $ilHelp->setSubScreenId("create_milestone");
376 
377  $this->initForm('create', true);
378  $tpl->setContent($this->form->getHTML());
379  }
global $DIC
Definition: saml.php:7
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 848 of file class.ilCalendarAppointmentGUI.php.

References $_GET, $DIC, $tpl, and ilCalendarRecurrences\_getRecurrences().

849  {
850  global $DIC;
851 
852  $tpl = $DIC['tpl'];
853 
854  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
855 
856  $this->ctrl->saveParameter($this, array('seed','app_id','dt','idate'));
857 
858  $confirm = new ilConfirmationGUI();
859  $confirm->setFormAction($this->ctrl->getFormAction($this));
860  $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
861  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
862  $confirm->addItem('appointments[]', $this->app->getEntryId(), $this->app->getTitle());
863 
864  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
865  if (sizeof(ilCalendarRecurrences::_getRecurrences($_GET['app_id']))
866  && !$this->app->isMilestone()) {
867  $confirm->addButton($this->lng->txt('cal_delete_single'), 'deleteexclude');
868  $confirm->setConfirm($this->lng->txt('cal_delete_recurrences'), 'delete');
869  } else {
870  $confirm->setConfirm($this->lng->txt('delete'), 'delete');
871  }
872 
873  $tpl->setContent($confirm->getHTML());
874  }
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
global $DIC
Definition: saml.php:7
$_GET["client_id"]
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 585 of file class.ilCalendarAppointmentGUI.php.

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

586  {
587  // check for recurring entries
588  include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php';
590  if (!$rec) {
591  return $this->edit(true);
592  }
593  // Show edit single/all appointments
594  $this->ctrl->saveParameter($this, array('seed','app_id','dt','idate'));
595 
596  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
597  $confirm = new ilConfirmationGUI();
598  $confirm->setFormAction($this->ctrl->getFormAction($this));
599  #$confirm->setHeaderText($this->lng->txt('cal_edit_app_sure'));
600  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
601  $confirm->addItem('appointments[]', $this->app->getEntryId(), $this->app->getTitle());
602  $confirm->addButton($this->lng->txt('cal_edit_single'), 'editSingle');
603  $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'), 'edit');
604 
605  $GLOBALS['DIC']['tpl']->setContent($confirm->getHTML());
606  }
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
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
Confirmation screen class.
+ Here is the call graph for this function:

◆ book()

ilCalendarAppointmentGUI::book ( )

Confirmation screen for booking of consultation appointment.

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

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

1345  {
1346  global $DIC;
1347 
1348  $ilUser = $DIC['ilUser'];
1349  $tpl = $DIC['tpl'];
1350 
1351  $entry = (int) $_GET['app_id'];
1352  $user = (int) $_GET['bkid'];
1353 
1354  $this->ctrl->saveParameter($this, 'app_id');
1355 
1356  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1357  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1358  $entry = new ilCalendarEntry($entry);
1359 
1360  $form = $this->initFormConfirmBooking();
1361  $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()));
1362  $form->getItemByPostVar('title')->setValue($entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')');
1363 
1364  $tpl->setContent($form->getHTML());
1365  return true;
1366  }
Model for a calendar entry.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _lookupFullname($a_user_id)
Lookup Full Name.
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
$user
Definition: migrateto20.php:57
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
+ Here is the call graph for this function:

◆ bookconfirmed()

ilCalendarAppointmentGUI::bookconfirmed ( )

Book consultation appointment, was confirmed.

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

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

1397  {
1398  global $DIC;
1399 
1400  $ilUser = $DIC['ilUser'];
1401 
1402  $entry = (int) $_REQUEST['app_id'];
1403  $user = (int) $_REQUEST['bkid'];
1404 
1405  $form = $this->initFormConfirmBooking();
1406  if ($form->checkInput()) {
1407  // check if appointment is bookable
1408  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1409  $cal_entry = new ilCalendarEntry($entry);
1410 
1411  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1412  $booking = new ilBookingEntry($cal_entry->getContextId());
1413 
1414  if (!$booking->isAppointmentBookableForUser($entry, $GLOBALS['DIC']['ilUser']->getId())) {
1415  ilUtil::sendFailure($this->lng->txt('cal_booking_failed_info'), true);
1416  $this->ctrl->returnToParent($this);
1417  }
1418 
1419  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1421 
1422  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1423  ilBookingEntry::writeBookingMessage($entry, $ilUser->getId(), $form->getInput('comment'));
1424  }
1425  ilUtil::sendSuccess($this->lng->txt('cal_booking_confirmed'), true);
1426  $this->ctrl->returnToParent($this);
1427  }
Model for a calendar entry.
global $DIC
Definition: saml.php:7
Booking definition.
static writeBookingMessage($a_entry_id, $a_usr_id, $a_message)
Write booking message.
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
$user
Definition: migrateto20.php:57
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
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 1532 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by cancelBooking(), and cancelConfirmed().

1533  {
1534  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1535  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1536  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1537  $assignment = $assignment->getFirstAssignment();
1538  return new ilCalendarCategory($assignment);
1539  }
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 108 of file class.ilCalendarAppointmentGUI.php.

109  {
110  $this->ctrl->returnToParent($this);
111  }

◆ cancelBooking()

ilCalendarAppointmentGUI::cancelBooking ( )

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

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

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

1434  {
1435  global $DIC;
1436 
1437  $ilUser = $DIC['ilUser'];
1438  $tpl = $DIC['tpl'];
1439 
1440  $entry = (int) $_GET['app_id'];
1441 
1442  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1443  $entry = new ilCalendarEntry($entry);
1444 
1445  $category = $this->calendarEntryToCategory($entry);
1446  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1447  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1448  $booking = new ilBookingEntry($entry->getContextId());
1449  if (!$booking->hasBooked($entry->getEntryId())) {
1450  $this->ctrl->returnToParent($this);
1451  return false;
1452  }
1453 
1454  $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
1455  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1456  $entry_title = ' ' . $entry->getTitle();
1457  } else {
1458  $this->ctrl->returnToParent($this);
1459  return false;
1460  }
1461 
1462  $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1463 
1464  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1465  $conf = new ilConfirmationGUI;
1466  $conf->setFormAction($this->ctrl->getFormAction($this));
1467  $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
1468  $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
1469  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1470  $conf->addItem('app_id', $entry->getEntryId(), $title . ' - ' . $entry_title);
1471 
1472  $tpl->setContent($conf->getHTML());
1473  }
Model for a calendar entry.
global $DIC
Definition: saml.php:7
$_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.
$ilUser
Definition: imgupload.php:18
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
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 1479 of file class.ilCalendarAppointmentGUI.php.

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

1480  {
1481  global $DIC;
1482 
1483  $ilUser = $DIC['ilUser'];
1484 
1485  $entry = (int) $_POST['app_id'];
1486  $user = (int) $_GET['bkid'];
1487 
1488  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1489  $entry = new ilCalendarEntry($entry);
1490 
1491  $category = $this->calendarEntryToCategory($entry);
1492  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1493  // find cloned calendar entry in user calendar
1494  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1496  $ilUser->getId(),
1497  $entry->getContextId(),
1498  $entry->getStart(),
1500  false
1501  );
1502 
1503  // Fix for wrong, old entries
1504  foreach ((array) $apps as $own_app) {
1505  $ref_entry = new ilCalendarEntry($own_app);
1506  $ref_entry->delete();
1507  }
1508 
1509  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1510  $booking = new ilBookingEntry($entry->getContextId());
1511  $booking->cancelBooking($entry->getEntryId());
1512 
1513  // do NOT delete original entry
1514  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1515  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1516  $booking = new ilBookingReservation($entry->getContextId());
1518  $booking->update();
1519 
1520  $entry->delete();
1521  }
1522 
1523  ilUtil::sendSuccess($this->lng->txt('cal_cancel_booking_confirmed'), true);
1524  $this->ctrl->returnToParent($this);
1525  }
Model for a calendar entry.
setStatus($a_status)
Set booking status.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
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.
cancelBooking($a_entry_id, $a_user_id=false)
cancel calendar booking for user
$ilUser
Definition: imgupload.php:18
$user
Definition: migrateto20.php:57
$_POST["username"]
+ Here is the call graph for this function:

◆ confirmRegister()

ilCalendarAppointmentGUI::confirmRegister ( )
protected

Register to an appointment.

Returns

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

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

1238  {
1239  global $DIC;
1240 
1241  $tpl = $DIC['tpl'];
1242 
1243  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1245  new ilDateTime($_GET['dstart'], IL_CAL_UNIX),
1246  new ilDateTime($_GET['dend'], IL_CAL_UNIX)
1247  );
1248 
1249 
1250  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1251  $conf = new ilConfirmationGUI;
1252 
1253  $this->ctrl->setParameter($this, 'dstart', (int) $_REQUEST['dstart']);
1254  $this->ctrl->setParameter($this, 'dend', (int) $_REQUEST['dend']);
1255 
1256  $conf->setFormAction($this->ctrl->getFormAction($this));
1257  $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1258  $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1259  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1260  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1261 
1262  $tpl->setContent($conf->getHTML());
1263  }
Model for a calendar entry.
global $DIC
Definition: saml.php:7
$_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.
$start
Definition: bench.php:8
Date and time handling
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmUnregister()

ilCalendarAppointmentGUI::confirmUnregister ( )

Confirmation screen to unregister calendar.

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

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

1291  {
1292  global $DIC;
1293 
1294  $tpl = $DIC['tpl'];
1295 
1296 
1297  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1299  $dstart = new ilDateTime($_GET['dstart'], IL_CAL_UNIX),
1300  $dend = new ilDateTime($_GET['dend'], IL_CAL_UNIX)
1301  );
1302 
1303 
1304  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1305  $conf = new ilConfirmationGUI;
1306 
1307  $this->ctrl->setParameter($this, 'dstart', (int) $_REQUEST['dstart']);
1308  $this->ctrl->setParameter($this, 'dend', (int) $_REQUEST['dend']);
1309 
1310  $conf->setFormAction($this->ctrl->getFormAction($this));
1311  $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1312  $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1313  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1314  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1315 
1316  $tpl->setContent($conf->getHTML());
1317  }
Model for a calendar entry.
global $DIC
Definition: saml.php:7
$_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.
$start
Definition: bench.php:8
Date and time handling
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDefaultCalendar()

ilCalendarAppointmentGUI::createDefaultCalendar ( )
protected

Create a default calendar.

protected

Returns

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

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

Referenced by save(), and update().

1214  {
1215  global $DIC;
1216 
1217  $ilUser = $DIC['ilUser'];
1218  $lng = $DIC['lng'];
1219 
1220  $cat = new ilCalendarCategory();
1221  $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1222  $cat->setType(ilCalendarCategory::TYPE_USR);
1223  $cat->setTitle($this->lng->txt('cal_default_calendar'));
1224  $cat->setObjId($ilUser->getId());
1225 
1226  // delete calendar cache
1227  include_once './Services/Calendar/classes/class.ilCalendarCache.php';
1228  ilCalendarCache::getInstance()->deleteUserEntries($ilUser->getId());
1229 
1230  return $cat->add();
1231  }
static getInstance()
get singleton instance
global $DIC
Definition: saml.php:7
Stores calendar categories.
$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 883 of file class.ilCalendarAppointmentGUI.php.

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

884  {
885  foreach ($_POST['appointments'] as $app_id) {
886  $app = new ilCalendarEntry($app_id);
887  $app->delete();
888 
889  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
891 
892  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
894  }
895  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
896  $this->ctrl->returnToParent($this);
897  }
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.
$_POST["username"]
+ 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 906 of file class.ilCalendarAppointmentGUI.php.

References IL_CAL_UNIX.

Referenced by update().

907  {
908  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceExclusion.php');
909  $excl = new ilCalendarRecurrenceExclusion();
910  $excl->setEntryId($_REQUEST['app_id']);
911  $excl->setDate(new ilDate($_REQUEST['dt'], IL_CAL_UNIX));
912  $excl->save();
913 
914  if ($a_return) {
915  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
916  $this->ctrl->returnToParent($this);
917  }
918  }
const IL_CAL_UNIX
Class for single dates.
Stores exclusion dates for calendar recurrences.
+ Here is the caller graph for this function:

◆ distributeNotifications()

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

Distribute mail notifications.

Returns

Definition at line 494 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().

495  {
496  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
497  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
498 
499  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
500  $notification = new ilCalendarMailNotification();
501  $notification->setAppointmentId($app_id);
502 
503  switch ($cat_info['type']) {
505 
506  switch ($cat_info['obj_type']) {
507  case 'crs':
508  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
509  $ref_id = current($ref_ids);
510  $notification->setRefId($ref_id);
511  $notification->setType(
512  $a_new_appointment ?
515  );
516  break;
517 
518  case 'grp':
519  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
520  $ref_id = current($ref_ids);
521  $notification->setRefId($ref_id);
522  $notification->setType(
523  $a_new_appointment ?
526  );
527  break;
528  }
529  break;
530  }
531 
532  $notification->send();
533  }
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 461 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

462  {
463  global $DIC;
464 
465  $ilUser = $DIC['ilUser'];
466 
467  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
468  $notification = new ilCalendarMailNotification();
469  $notification->setAppointmentId($this->app->getEntryId());
470 
471  foreach ($this->notification->getRecipients() as $rcp) {
472  switch ($rcp['type']) {
474  $notification->setSender(ANONYMOUS_USER_ID);
475  $notification->setRecipients(array($rcp['usr_id']));
476  $notification->setType(ilCalendarMailNotification::TYPE_USER);
477  break;
478 
480  $notification->setSender(ANONYMOUS_USER_ID);
481  $notification->setRecipients(array($rcp['email']));
482  $notification->setType(ilCalendarMailNotification::TYPE_USER_ANONYMOUS);
483  break;
484  }
485  $notification->send();
486  }
487  }
global $DIC
Definition: saml.php:7
Distributes calendar mail notifications.
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 1545 of file class.ilCalendarAppointmentGUI.php.

References $_GET, exit, and ilUserAutoComplete\MAX_ENTRIES.

1546  {
1547  if (!isset($_GET['autoCompleteField'])) {
1548  $a_fields = array('login','firstname','lastname','email');
1549  } else {
1550  $a_fields = array((string) $_GET['autoCompleteField']);
1551  }
1552 
1553  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1554  $auto = new ilUserAutoComplete();
1555  $auto->setSearchFields($a_fields);
1556  $auto->enableFieldSearchableCheck(true);
1557  $auto->setMoreLinkAvailable(true);
1558 
1559  if (($_REQUEST['fetchall'])) {
1560  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1561  }
1562 
1563  echo $auto->getList($_REQUEST['query']);
1564  exit();
1565  }
$_GET["client_id"]
Auto completion class for user lists.
exit
Definition: backend.php:16

◆ edit()

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

edit appointment

protected

Parameters
boolsingel appointment

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

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

627  {
628  global $DIC;
629 
630  $tpl = $DIC['tpl'];
631  $ilUser = $DIC['ilUser'];
632  $ilErr = $DIC['ilErr'];
633  $ilHelp = $DIC['ilHelp'];
634 
635  $ilHelp->setScreenIdComponent("cal");
636  $ilHelp->setScreenId("app");
637  if ($this->app->isMilestone()) {
638  $ilHelp->setSubScreenId("edit_milestone");
639  } else {
640  $ilHelp->setSubScreenId("edit");
641  }
642 
643  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
644  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
645  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
646 
647  $GLOBALS['DIC']['ilCtrl']->saveParameter($this, array('seed','app_id','dt','idate'));
648 
649  if ($_REQUEST['rexl']) {
650  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'rexl', 1);
651 
652  // Calculate new appointment time
653  $duration = $this->getAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->getAppointment()->getStart()->get(IL_CAL_UNIX);
654  include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
655  $calc = new ilCalendarRecurrenceCalculator($this->getAppointment(), $this->rec);
656 
657  $current_date = new ilDateTime($_REQUEST['dt'], IL_CAL_UNIX);
658 
659  $yesterday = clone $current_date;
660  $yesterday->increment(IL_CAL_DAY, -1);
661  $tomorrow = clone $current_date;
662  $tomorrow->increment(IL_CAL_DAY, 1);
663 
664 
665  foreach ($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry) {
666  if (ilDateTime::_equals($current_date, $date_entry, IL_CAL_DAY)) {
667  $this->getAppointment()->setStart(new ilDateTime($date_entry->get(IL_CAL_UNIX), IL_CAL_UNIX));
668  $this->getAppointment()->setEnd(new ilDateTime($date_entry->get(IL_CAL_UNIX) + $duration, IL_CAL_UNIX));
669  break;
670  }
671  }
672 
673  // Finally reset recurrence
674  $this->rec = new ilCalendarRecurrence();
675  }
676 
677  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
679 
680  if (!$cats->isVisible($cat_id)) {
681  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
682  return false;
683  }
684  if (!$cats->isEditable($cat_id) or $this->app->isAutoGenerated()) {
685  $this->showInfoScreen();
686  return true;
687  }
688  if (!$form instanceof ilPropertyFormGUI) {
689  $this->initForm('edit', $this->app->isMilestone(), $a_edit_single_app);
690  }
691  $tpl->setContent($this->form->getHTML());
692  }
getAppointment()
Get current appointment.
static _lookupCategory($a_cal_id)
Lookup category id.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
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.
Date and time handling
$ilUser
Definition: imgupload.php:18
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
static _getInstance($a_usr_id=0)
get singleton instance
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 538 of file class.ilCalendarAppointmentGUI.php.

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

539  {
540  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
541  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
542  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
543  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
544 
545  $this->showResponsibleUsersList($cat_info['obj_id']);
546  }
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 611 of file class.ilCalendarAppointmentGUI.php.

References $GLOBALS, and edit().

612  {
613  $_REQUEST['rexl'] = 1;
614  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'rexcl', 1);
615  $this->edit(true);
616  }
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarAppointmentGUI::executeCommand ( )

Execute command.

public

Parameters

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

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

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

◆ getAppointment()

ilCalendarAppointmentGUI::getAppointment ( )

Get current appointment.

Returns
ilCalendarEntry

Definition at line 96 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 976 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by __construct().

977  {
978  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
979  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
980  $this->app = new ilCalendarEntry($a_app_id);
981 
982  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
983  $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
984 
985  if (!$a_app_id) {
986  $start = clone $this->initialDate;
987  $this->app->setStart($start);
988 
989  $seed_end = clone $this->initialDate;
990  if ($this->default_fulltime) {
991  #$seed_end->increment(IL_CAL_DAY,1);
992  } else {
993  $seed_end->increment(IL_CAL_HOUR, 1);
994  }
995  $this->app->setEnd($seed_end);
996  $this->app->setFullday($this->default_fulltime);
997 
998  $this->rec = new ilCalendarRecurrence();
999  } else {
1000  $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
1001  }
1002  }
Model for a calendar entry.
const IL_CAL_HOUR
static _getFirstRecurrence($a_cal_id)
get first recurrence
$start
Definition: bench.php:8
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 120 of file class.ilCalendarAppointmentGUI.php.

References $_GET, $_POST, $calendar, $DIC, $i, $ilUser, $r, $rec, $title, $tpl, $type, $users, $values, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarCategories\_lookupCategoryIdByObjId(), ilObjUser\_lookupLogin(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilCalendarCategoryAssignments\getFirstAssignment(), ilYuiUtil\initDomEvent(), notification(), ilDateTimeInputGUI\setDate(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextInputGUI\setValue(), ilNonEditableValueGUI\setValue(), ilTextAreaInputGUI\setValue(), ilCalendarUserNotification\TYPE_EMAIL, ilCalendarCategory\TYPE_OBJ, and ilCalendarUserNotification\TYPE_USER.

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

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

References $form, $message, and $title.

Referenced by book(), and bookconfirmed().

1373  {
1374  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1375  $form = new ilPropertyFormGUI();
1376  $form->setFormAction($this->ctrl->getFormAction($this));
1377  $form->addCommandButton('bookconfirmed', $this->lng->txt('cal_confirm_booking'));
1378  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1379 
1380  $date = new ilNonEditableValueGUI($this->lng->txt('appointment'), 'date');
1381  $form->addItem($date);
1382 
1383  $title = new ilNonEditableValueGUI($this->lng->txt('title'), 'title');
1384  $form->addItem($title);
1385 
1386  $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1387  $message->setRows(5);
1388  $form->addItem($message);
1389 
1390  return $form;
1391  }
This class represents a property form user interface.
catch(Exception $e) $message
if(isset($_POST['submit'])) $form
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
+ Here is the caller graph for this function:

◆ initInitialDate()

ilCalendarAppointmentGUI::initInitialDate ( ilDate  $initialDate)
protected

init initial date

Parameters
ilDate$initialDate

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

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

Referenced by __construct().

941  {
942  if (!isset($_GET['hour'])) {
943  $this->initialDate = clone $initialDate;
944  $this->default_fulltime = true;
945  } else {
946  if ((int) $_GET['hour'] < 10) {
947  $time = '0' . (int) $_GET['hour'] . ':00:00';
948  } else {
949  $time = (int) $_GET['hour'] . ':00:00';
950  }
951  $this->initialDate = new ilDateTime($initialDate->get(IL_CAL_DATE) . ' ' . $time, IL_CAL_DATETIME, $this->timezone);
952  $this->default_fulltime = false;
953  }
954  }
const IL_CAL_DATETIME
$_GET["client_id"]
get($a_format, $a_format_str='', $a_tz='')
get formatted date
$time
Definition: cron.php:21
Date and time handling
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 963 of file class.ilCalendarAppointmentGUI.php.

References $seed.

Referenced by __construct().

964  {
965  $this->seed = clone $seed;
966  $this->default_fulltime = true;
967  }
+ Here is the caller graph for this function:

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

init timezone

protected

Parameters

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

References $DIC, and $ilUser.

Referenced by __construct().

928  {
929  global $DIC;
930 
931  $ilUser = $DIC['ilUser'];
932 
933  $this->timezone = $ilUser->getTimeZone();
934  }
global $DIC
Definition: saml.php:7
$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 1011 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

1012  {
1013  // needed for date handling
1014  $this->initForm($a_mode, $a_as_milestone);
1015  $this->form->checkInput();
1016 
1017  if ($a_as_milestone) {
1018  $this->app->setMilestone(true);
1019  $this->app->setCompletion(ilUtil::stripSlashes($_POST['completion']));
1020  }
1021 
1022  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1023  $this->app->setLocation(ilUtil::stripSlashes($_POST['location']));
1024  $this->app->setDescription(ilUtil::stripSlashes($_POST['description']));
1025  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1026  $this->app->enableNotification((int) $_POST['not']);
1027 
1028  if ($a_as_milestone) { // milestones are always fullday events
1029  $start = $this->form->getItemByPostVar('event_start');
1030  $start = $start->getDate();
1031 
1032  $this->app->setFullday(true);
1033 
1034  // for milestones is end date = start date
1035  $this->app->setStart($start);
1036  $this->app->setEnd($start);
1037  } else {
1038  $period = $this->form->getItemByPostVar('event');
1039  $start = $period->getStart();
1040  $end = $period->getEnd();
1041 
1042  $this->app->setFullday($start instanceof ilDate);
1043  $this->app->setStart($start);
1044  $this->app->setEnd($end);
1045  }
1046 
1047  $this->loadNotificationRecipients();
1048  $this->loadRecurrenceSettings($a_as_milestone = false);
1049  }
$start
Definition: bench.php:8
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 1051 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by load().

1052  {
1053  $this->notification->setRecipients(array());
1054 
1055  foreach ((array) $_POST['notu'] as $rcp) {
1056  $rcp = trim(ilUtil::stripSlashes($rcp));
1057  $usr_id = ilObjUser::_loginExists($rcp);
1058 
1059  if (strlen($rcp) == 0) {
1060  continue;
1061  }
1062 
1063  if ($usr_id) {
1064  $this->notification->addRecipient(
1066  $usr_id
1067  );
1068  } else {
1069  $this->notification->addRecipient(
1071  0,
1072  $rcp
1073  );
1074  }
1075  }
1076  }
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 1084 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().

1085  {
1086  $this->rec->reset();
1087 
1088  switch ($_POST['frequence']) {
1089  case IL_CAL_FREQ_DAILY:
1090  $this->rec->setFrequenceType($_POST['frequence']);
1091  $this->rec->setInterval((int) $_POST['count_DAILY']);
1092  break;
1093 
1094  case IL_CAL_FREQ_WEEKLY:
1095  $this->rec->setFrequenceType($_POST['frequence']);
1096  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1097  if (is_array($_POST['byday_WEEKLY'])) {
1098  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $_POST['byday_WEEKLY'])));
1099  }
1100  break;
1101 
1102  case IL_CAL_FREQ_MONTHLY:
1103  $this->rec->setFrequenceType($_POST['frequence']);
1104  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1105  switch ((int) $_POST['subtype_MONTHLY']) {
1106  case 0:
1107  // nothing to do;
1108  break;
1109 
1110  case 1:
1111  switch ((int) $_POST['monthly_byday_day']) {
1112  case 8:
1113  // Weekday
1114  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1115  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1116  break;
1117 
1118  case 9:
1119  // Day of month
1120  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1121  break;
1122 
1123  default:
1124  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'] . $_POST['monthly_byday_day']);
1125  break;
1126  }
1127  break;
1128 
1129  case 2:
1130  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1131  break;
1132  }
1133  break;
1134 
1135  case IL_CAL_FREQ_YEARLY:
1136  $this->rec->setFrequenceType($_POST['frequence']);
1137  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1138  switch ((int) $_POST['subtype_YEARLY']) {
1139  case 0:
1140  // nothing to do;
1141  break;
1142 
1143  case 1:
1144  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1145  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'] . $_POST['yearly_byday']);
1146  break;
1147 
1148  case 2:
1149  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1150  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1151  break;
1152  }
1153  break;
1154  }
1155 
1156  // UNTIL
1157  switch ((int) $_POST['until_type']) {
1158  case 1:
1159  $this->rec->setFrequenceUntilDate(null);
1160  // nothing to do
1161  break;
1162 
1163  case 2:
1164  $this->rec->setFrequenceUntilDate(null);
1165  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1166  break;
1167 
1168  case 3:
1169  $dt = new ilDateTimeInputGUI('', 'until_end');
1170  $dt->setRequired(true);
1171  if ($dt->checkInput()) {
1172  $this->rec->setFrequenceUntilCount(0);
1173  $this->rec->setFrequenceUntilDate($dt->getDate());
1174  }
1175  break;
1176  }
1177  }
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 1269 of file class.ilCalendarAppointmentGUI.php.

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

1270  {
1271  global $DIC;
1272 
1273  $ilUser = $DIC['ilUser'];
1274 
1275  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1276  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1277  $reg->register(
1278  $ilUser->getId(),
1279  new ilDateTime((int) $_REQUEST['dstart'], IL_CAL_UNIX),
1280  new ilDateTime((int) $_REQUEST['dend'], IL_CAL_UNIX)
1281  );
1282 
1283  ilUtil::sendSuccess($this->lng->txt('cal_reg_registered'), true);
1284  $this->ctrl->returnToParent($this);
1285  }
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
$ilUser
Definition: imgupload.php:18
$_POST["username"]

◆ save()

ilCalendarAppointmentGUI::save (   $a_as_milestone = false)
protected

save appointment

protected

Definition at line 396 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().

397  {
398  global $DIC;
399 
400  $ilErr = $DIC['ilErr'];
401 
402  $this->load('create', $a_as_milestone);
403 
404  if ($this->app->validate() and $this->notification->validate()) {
405  if (!(int) $_POST['calendar']) {
406  $cat_id = $this->createDefaultCalendar();
407  } else {
408  $cat_id = (int) $_POST['calendar'];
409  }
410 
411  $this->app->save();
412  $this->notification->setEntryId($this->app->getEntryId());
413  $this->notification->save();
414  $this->rec->setEntryId($this->app->getEntryId());
415  $this->saveRecurrenceSettings();
416 
417  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
418  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
419  $ass->addAssignment($cat_id);
420 
421  // Send notifications
422  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
423  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not']) {
424  $this->distributeNotifications($cat_id, $this->app->getEntryId(), true);
425  }
426  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
428  }
429 
430  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
431  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
432  $type = ilObject::_lookupType($cat_info['obj_id']);
433 
434  if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
435  && ($type == "grp" || $type == "crs")) {
436  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone_resp_q'), true);
437  return $this->showResponsibleUsersList($cat_info['obj_id']);
438  } elseif ($a_as_milestone) {
439  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone'), true);
440  $this->ctrl->returnToParent($this);
441  } else {
442  ilUtil::sendSuccess($this->lng->txt('cal_created_appointment'), true);
443  $this->ctrl->returnToParent($this);
444  }
445  } else {
446  $this->form->setValuesByPost();
447  ilUtil::sendFailure($ilErr->getMessage());
448  return $this->add($this->form);
449  }
450  if ($a_as_milestone) {
451  $this->addMilestone();
452  } else {
453  $this->add();
454  }
455  }
static _getInstance()
get singleton instance
$type
global $DIC
Definition: saml.php:7
$ilErr
Definition: raiseError.php:18
distributeUserNotifications()
Send mail to selected users ilObjUser $ilUser.
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 386 of file class.ilCalendarAppointmentGUI.php.

References save().

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

◆ saveMilestoneResponsibleUsers()

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

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

References $_POST, $DIC, and $ilCtrl.

572  {
573  global $DIC;
574 
575  $ilCtrl = $DIC['ilCtrl'];
576 
577  $this->app->writeResponsibleUsers($_POST["user_id"]);
578  $ilCtrl->returnToParent($this);
579  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

save recurrence settings

protected

Parameters

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

References $_POST.

Referenced by save(), and update().

1187  {
1188  switch ($_POST['frequence']) {
1189  case 'NONE':
1190  case '':
1191  // No recurrence => delete if there is an recurrence rule
1192  if ($this->rec->getRecurrenceId()) {
1193  $this->rec->delete();
1194  }
1195  break;
1196 
1197  default:
1198  if ($this->rec->getRecurrenceId()) {
1199  $this->rec->update();
1200  } else {
1201  $this->rec->save();
1202  }
1203  break;
1204  }
1205  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ showInfoScreen()

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

show info screen

protected

Returns

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

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

Referenced by edit().

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

References $DIC, and $tpl.

Referenced by editResponsibleUsers(), and save().

553  {
554  global $DIC;
555 
556  $tpl = $DIC['tpl'];
557 
558  include_once("./Services/Calendar/classes/class.ilMilestoneResponsiblesTableGUI.php");
559  $table_gui = new ilMilestoneResponsiblesTableGUI(
560  $this,
561  "",
562  $a_grp_id,
563  $this->app->getEntryId()
564  );
565  $tpl->setContent($table_gui->getHTML());
566  }
global $DIC
Definition: saml.php:7
TableGUI class for selection of milestone responsibles.
+ Here is the caller graph for this function:

◆ unregister()

ilCalendarAppointmentGUI::unregister ( )
protected

Unregister calendar, was confirmed.

Returns

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

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

1324  {
1325  global $DIC;
1326 
1327  $ilUser = $DIC['ilUser'];
1328 
1329  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1330  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1331  $reg->unregister(
1332  $ilUser->getId(),
1333  new ilDateTime((int) $_REQUEST['dstart'], IL_CAL_UNIX),
1334  new ilDateTime((int) $_REQUEST['dend'], IL_CAL_UNIX)
1335  );
1336 
1337  ilUtil::sendSuccess($this->lng->txt('cal_reg_unregistered'), true);
1338  $this->ctrl->returnToParent($this);
1339  }
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
$ilUser
Definition: imgupload.php:18
$_POST["username"]

◆ update()

ilCalendarAppointmentGUI::update ( )
protected

update

protected

Returns

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

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

789  {
790  global $DIC;
791 
792  $ilErr = $DIC['ilErr'];
793 
794  $single_editing = ($_REQUEST['rexl'] ? true : false);
795 
796  $this->load('edit', $this->app->isMilestone());
797 
798  if ($this->app->validate() and $this->notification->validate()) {
799  if (!(int) $_POST['calendar']) {
800  $cat_id = $this->createDefaultCalendar();
801  } else {
802  $cat_id = (int) $_POST['calendar'];
803  }
804 
805  if ($single_editing) {
806  $this->getAppointment()->save();
807  $this->deleteExclude(false);
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  //var_dump($cat_id);
817  //var_dump($_POST); exit;
818  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
819  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
820  $this->logger->debug($this->app->getEntryId());
821  $ass->deleteAssignments();
822  $ass->addAssignment($cat_id);
823 
824  // Send notifications
825  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
826  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not']) {
827  $this->distributeNotifications($cat_id, $this->app->getEntryId(), false);
828  }
829  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
831  }
832 
833  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
834  $this->ctrl->returnToParent($this);
835  } else {
836  $this->form->setValuesByPost();
837  ilUtil::sendFailure($ilErr->getMessage());
838  }
839  $this->edit(false, $this->form);
840  }
getAppointment()
Get current appointment.
static _getInstance()
get singleton instance
global $DIC
Definition: saml.php:7
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
$ilErr
Definition: raiseError.php:18
deleteExclude($a_return=true)
delete single item of recurrence list
distributeUserNotifications()
Send mail to selected users ilObjUser $ilUser.
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
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 __construct(), and createDefaultCalendar().

◆ $logger

ilCalendarAppointmentGUI::$logger = null
private

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

◆ $rec

ilCalendarAppointmentGUI::$rec = null
protected

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

Referenced by askEdit(), and initForm().

◆ $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: