ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 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)
 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
 

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

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

58  {
59  global $ilCtrl,$lng;
60 
61  $this->lng = $lng;
62  $lng->loadLanguageModule('dateplaner');
63  $this->ctrl = $ilCtrl;
64 
65  $this->initTimeZone();
66  $this->initSeed($seed);
67  $this->initInitialDate($initialDate);
68  $this->initAppointment($a_appointment_id);
69  }
initAppointment($a_app_id=0)
init appointment
initInitialDate(ilDate $initialDate)
init initial date
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilCalendarAppointmentGUI::add ( )
protected

add new appointment

protected

Returns

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

References $tpl, and initForm().

Referenced by save().

377  {
378  global $tpl, $ilHelp;
379 
380  $ilHelp->setScreenIdComponent("cal");
381  $ilHelp->setScreenId("app");
382  $ilHelp->setSubScreenId("create");
383 
384  $this->initForm('create');
385  $tpl->setContent($this->form->getHTML());
386  }
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 394 of file class.ilCalendarAppointmentGUI.php.

References $tpl, and initForm().

Referenced by save().

395  {
396  global $tpl, $ilHelp;
397 
398  $ilHelp->setScreenIdComponent("cal");
399  $ilHelp->setScreenId("app");
400  $ilHelp->setSubScreenId("create_milestone");
401 
402  $this->initForm('create', true);
403  $tpl->setContent($this->form->getHTML());
404  }
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 888 of file class.ilCalendarAppointmentGUI.php.

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

889  {
890  global $tpl;
891 
892  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
893 
894  $this->ctrl->saveParameter($this,array('seed','app_id','dt','idate'));
895 
896  $confirm = new ilConfirmationGUI();
897  $confirm->setFormAction($this->ctrl->getFormAction($this));
898  $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
899  $confirm->setCancel($this->lng->txt('cancel'),'cancel');
900  $confirm->addItem('appointments[]',$this->app->getEntryId(),$this->app->getTitle());
901 
902  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
903  if(sizeof(ilCalendarRecurrences::_getRecurrences($_GET['app_id']))
904  && !$this->app->isMilestone())
905  {
906  $confirm->addButton($this->lng->txt('cal_delete_single'),'deleteexclude');
907  $confirm->setConfirm($this->lng->txt('cal_delete_recurrences'),'delete');
908  }
909  else
910  {
911  $confirm->setConfirm($this->lng->txt('delete'),'delete');
912  }
913 
914  $tpl->setContent($confirm->getHTML());
915 
916  }
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
$_GET["client_id"]
Create styles array
The data for the language used.
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 614 of file class.ilCalendarAppointmentGUI.php.

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

615  {
616  // check for recurring entries
617  include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php';
619  if(!$rec)
620  {
621  return $this->edit(TRUE);
622  }
623  // Show edit single/all appointments
624  $this->ctrl->saveParameter($this,array('seed','app_id','dt','idate'));
625 
626  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
627  $confirm = new ilConfirmationGUI();
628  $confirm->setFormAction($this->ctrl->getFormAction($this));
629  #$confirm->setHeaderText($this->lng->txt('cal_edit_app_sure'));
630  $confirm->setCancel($this->lng->txt('cancel'),'cancel');
631  $confirm->addItem('appointments[]',$this->app->getEntryId(),$this->app->getTitle());
632  $confirm->addButton($this->lng->txt('cal_edit_single'),'editSingle');
633  $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'),'edit');
634 
635  $GLOBALS['tpl']->setContent($confirm->getHTML());
636  }
getAppointment()
Get current appointment.
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
edit($a_edit_single_app=false)
edit appointment
Create styles array
The data for the language used.
Confirmation screen class.
+ Here is the call graph for this function:

◆ book()

ilCalendarAppointmentGUI::book ( )

Confirmation screen for booking of consultation appointment.

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

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

1412  {
1413  global $ilUser, $tpl;
1414 
1415  $entry = (int)$_GET['app_id'];
1416  $user = (int)$_GET['bkid'];
1417 
1418  $this->ctrl->saveParameter($this,'app_id');
1419 
1420  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1421  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1422  $entry = new ilCalendarEntry($entry);
1423 
1424  $form = $this->initFormConfirmBooking();
1425  $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()));
1426  $form->getItemByPostVar('title')->setValue($entry->getTitle()." (".ilObjUser::_lookupFullname($user).')');
1427 
1428  $tpl->setContent($form->getHTML());
1429  return true;
1430  }
Model for a calendar entry.
$_GET["client_id"]
static _lookupFullname($a_user_id)
Lookup Full Name.
static formatPeriod(ilDateTime $start, ilDateTime $end)
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 1460 of file class.ilCalendarAppointmentGUI.php.

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

1461  {
1462  global $ilUser;
1463 
1464  $entry = (int) $_REQUEST['app_id'];
1465  $user = (int) $_REQUEST['bkid'];
1466 
1467  $form = $this->initFormConfirmBooking();
1468  if($form->checkInput())
1469  {
1470  // check if appointment is bookable
1471  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1472  $cal_entry = new ilCalendarEntry($entry);
1473 
1474  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1475  $booking = new ilBookingEntry($cal_entry->getContextId());
1476 
1477  if(!$booking->isAppointmentBookableForUser($entry, $GLOBALS['ilUser']->getId()))
1478  {
1479  ilUtil::sendFailure($this->lng->txt('cal_booking_failed_info'), true);
1480  $this->ctrl->returnToParent($this);
1481  }
1482 
1483  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1484  ilConsultationHourUtils::bookAppointment($ilUser->getId(), $entry);
1485 
1486  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1487  ilBookingEntry::writeBookingMessage($entry, $ilUser->getId(), $form->getInput('comment'));
1488  }
1489  ilUtil::sendSuccess($this->lng->txt('cal_booking_confirmed'),true);
1490  $this->ctrl->returnToParent($this);
1491  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Booking definition.
static writeBookingMessage($a_entry_id, $a_usr_id, $a_message)
Write booking message.
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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 1602 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by cancelBooking(), and cancelConfirmed().

1603  {
1604  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1605  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1606  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1607  $assignment = $assignment->getFirstAssignment();
1608  return new ilCalendarCategory($assignment);
1609  }
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 118 of file class.ilCalendarAppointmentGUI.php.

119  {
120  $this->ctrl->returnToParent($this);
121  }

◆ cancelBooking()

ilCalendarAppointmentGUI::cancelBooking ( )

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

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

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

1498  {
1499  global $ilUser, $tpl;
1500 
1501  $entry = (int)$_GET['app_id'];
1502 
1503  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1504  $entry = new ilCalendarEntry($entry);
1505 
1506  $category = $this->calendarEntryToCategory($entry);
1507  if($category->getType() == ilCalendarCategory::TYPE_CH)
1508  {
1509  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1510  $booking = new ilBookingEntry($entry->getContextId());
1511  if(!$booking->hasBooked($entry->getEntryId()))
1512  {
1513  $this->ctrl->returnToParent($this);
1514  return false;
1515  }
1516 
1517  $entry_title = ' '.$entry->getTitle()." (".ilObjUser::_lookupFullname($booking->getObjId()).')';
1518  }
1519  else if($category->getType() == ilCalendarCategory::TYPE_BOOK)
1520  {
1521  $entry_title = ' '.$entry->getTitle();
1522  }
1523  else
1524  {
1525  $this->ctrl->returnToParent($this);
1526  return false;
1527  }
1528 
1529  $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1530 
1531  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1532  $conf = new ilConfirmationGUI;
1533  $conf->setFormAction($this->ctrl->getFormAction($this));
1534  $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
1535  $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
1536  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1537  $conf->addItem('app_id', $entry->getEntryId(), $title.' - '.$entry_title);
1538 
1539  $tpl->setContent($conf->getHTML());
1540  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
static _lookupFullname($a_user_id)
Lookup Full Name.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
Booking definition.
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
$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 1546 of file class.ilCalendarAppointmentGUI.php.

References $_GET, $_POST, $GLOBALS, $ilUser, array, calendarEntryToCategory(), ilBookingEntry\cancelBooking(), ilConsultationHourAppointments\getAppointmentIds(), ilUtil\sendSuccess(), ilBookingReservation\setStatus(), ilBookingReservation\STATUS_CANCELLED, ilCalendarCategory\TYPE_BOOK, and ilCalendarCategory\TYPE_CH.

1547  {
1548  global $ilUser;
1549 
1550  $entry = (int)$_POST['app_id'];
1551  $user = (int)$_GET['bkid'];
1552 
1553  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1554  $entry = new ilCalendarEntry($entry);
1555 
1556  $category = $this->calendarEntryToCategory($entry);
1557  if($category->getType() == ilCalendarCategory::TYPE_CH)
1558  {
1559  // find cloned calendar entry in user calendar
1560  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1561  $GLOBALS['ilLog']->dump($entry->getStart());
1563  $ilUser->getId(),
1564  $entry->getContextId(),
1565  $entry->getStart(),
1567  false);
1568  $GLOBALS['ilLog']->dump($apps);
1569 
1570  // Fix for wrong, old entries
1571  foreach((array) $apps as $own_app)
1572  {
1573  $ref_entry = new ilCalendarEntry($own_app);
1574  $ref_entry->delete();
1575  }
1576 
1577  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1578  $booking = new ilBookingEntry($entry->getContextId());
1579  $booking->cancelBooking($entry->getEntryId());
1580 
1581  // do NOT delete original entry
1582  }
1583  else if($category->getType() == ilCalendarCategory::TYPE_BOOK)
1584  {
1585  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1586  $booking = new ilBookingReservation($entry->getContextId());
1588  $booking->update();
1589 
1590  $entry->delete();
1591  }
1592 
1593  ilUtil::sendSuccess($this->lng->txt('cal_cancel_booking_confirmed'),true);
1594  $this->ctrl->returnToParent($this);
1595  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
setStatus($a_status)
Set booking status.
$_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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ confirmRegister()

ilCalendarAppointmentGUI::confirmRegister ( )
protected

Register to an appointment.

Returns

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

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

1313  {
1314  global $tpl;
1315 
1316  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1318  new ilDateTime($_GET['dstart'],IL_CAL_UNIX),
1319  new ilDateTime($_GET['dend'],IL_CAL_UNIX)
1320  );
1321 
1322 
1323  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1324  $conf = new ilConfirmationGUI;
1325 
1326  $this->ctrl->setParameter($this,'dstart',(int) $_REQUEST['dstart']);
1327  $this->ctrl->setParameter($this,'dend',(int) $_REQUEST['dend']);
1328 
1329  $conf->setFormAction($this->ctrl->getFormAction($this));
1330  $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1331  $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1332  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1333  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle().' ('.$start.')');
1334 
1335  $tpl->setContent($conf->getHTML());
1336  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date public.
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 1361 of file class.ilCalendarAppointmentGUI.php.

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

1362  {
1363  global $tpl;
1364 
1365 
1366  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1368  $dstart = new ilDateTime($_GET['dstart'],IL_CAL_UNIX),
1369  $dend = new ilDateTime($_GET['dend'],IL_CAL_UNIX)
1370  );
1371 
1372 
1373  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1374  $conf = new ilConfirmationGUI;
1375 
1376  $this->ctrl->setParameter($this,'dstart',(int) $_REQUEST['dstart']);
1377  $this->ctrl->setParameter($this,'dend',(int) $_REQUEST['dend']);
1378 
1379  $conf->setFormAction($this->ctrl->getFormAction($this));
1380  $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1381  $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1382  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1383  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle().' ('.$start.')');
1384 
1385  $tpl->setContent($conf->getHTML());
1386  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date public.
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 1291 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

1292  {
1293  global $ilUser,$lng;
1294 
1295  $cat = new ilCalendarCategory();
1296  $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1297  $cat->setType(ilCalendarCategory::TYPE_USR);
1298  $cat->setTitle($this->lng->txt('cal_default_calendar'));
1299  $cat->setObjId($ilUser->getId());
1300 
1301  // delete calendar cache
1302  include_once './Services/Calendar/classes/class.ilCalendarCache.php';
1303  ilCalendarCache::getInstance()->deleteUserEntries($ilUser->getId());
1304 
1305  return $cat->add();
1306  }
static getInstance()
get singleton instance
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 925 of file class.ilCalendarAppointmentGUI.php.

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

926  {
927  foreach($_POST['appointments'] as $app_id)
928  {
929  $app = new ilCalendarEntry($app_id);
930  $app->delete();
931 
932  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
934 
935  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
937  }
938  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'),true);
939  $this->ctrl->returnToParent($this);
940  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 949 of file class.ilCalendarAppointmentGUI.php.

References IL_CAL_UNIX, and ilUtil\sendSuccess().

Referenced by update().

950  {
951  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceExclusion.php');
952  $excl = new ilCalendarRecurrenceExclusion();
953  $excl->setEntryId($_REQUEST['app_id']);
954  $excl->setDate(new ilDate($_REQUEST['dt'], IL_CAL_UNIX));
955  $excl->save();
956 
957  if($a_return)
958  {
959  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'),true);
960  $this->ctrl->returnToParent($this);
961  }
962  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_UNIX
Class for single dates.
Stores exclusion dates for calendar recurrences.
+ Here is the call graph for this function:
+ 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 531 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

532  {
533  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
534  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
535 
536  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
537  $notification = new ilCalendarMailNotification();
538  $notification->setAppointmentId($app_id);
539 
540  switch($cat_info['type'])
541  {
543 
544  switch($cat_info['obj_type'])
545  {
546  case 'crs':
547  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
548  $ref_id = current($ref_ids);
549  $notification->setRefId($ref_id);
550  $notification->setType(
551  $a_new_appointment ?
554  break;
555 
556  case 'grp':
557  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
558  $ref_id = current($ref_ids);
559  $notification->setRefId($ref_id);
560  $notification->setType(
561  $a_new_appointment ?
564  break;
565  }
566  break;
567  }
568 
569  $notification->send();
570  }
Distributes calendar mail notifications.
static _getAllReferences($a_id)
get all reference ids of object
static _getInstance($a_usr_id=0)
get singleton instance
$ref_id
Definition: sahs_server.php:39
+ 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 498 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

499  {
500  global $ilUser;
501 
502  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
503  $notification = new ilCalendarMailNotification();
504  $notification->setAppointmentId($this->app->getEntryId());
505 
506  foreach($this->notification->getRecipients() as $rcp)
507  {
508  switch($rcp['type'])
509  {
511  $notification->setSender(ANONYMOUS_USER_ID);
512  $notification->setRecipients(array($rcp['usr_id']));
513  $notification->setType(ilCalendarMailNotification::TYPE_USER);
514  break;
515 
517  $notification->setSender(ANONYMOUS_USER_ID);
518  $notification->setRecipients(array($rcp['email']));
519  $notification->setType(ilCalendarMailNotification::TYPE_USER_ANONYMOUS);
520  break;
521  }
522  $notification->send();
523  }
524  }
Distributes calendar mail notifications.
notification()
Definition: notification.php:2
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
+ 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 1615 of file class.ilCalendarAppointmentGUI.php.

References $_GET, $GLOBALS, array, exit, and ilUserAutoComplete\MAX_ENTRIES.

1616  {
1617  if(!isset($_GET['autoCompleteField']))
1618  {
1619  $a_fields = array('login','firstname','lastname','email');
1620  }
1621  else
1622  {
1623  $a_fields = array((string) $_GET['autoCompleteField']);
1624  }
1625 
1626  $GLOBALS['ilLog']->write(print_r($a_fields,true));
1627  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1628  $auto = new ilUserAutoComplete();
1629  $auto->setSearchFields($a_fields);
1630  $auto->enableFieldSearchableCheck(true);
1631  $auto->setMoreLinkAvailable(true);
1632 
1633  if(($_REQUEST['fetchall']))
1634  {
1635  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1636  }
1637 
1638  echo $auto->getList($_REQUEST['query']);
1639  exit();
1640  }
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Auto completion class for user lists.
Create styles array
The data for the language used.

◆ edit()

ilCalendarAppointmentGUI::edit (   $a_edit_single_app = false)
protected

edit appointment

protected

Parameters

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

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

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

656  {
657  global $tpl,$ilUser,$ilErr, $ilHelp;
658 
659  $ilHelp->setScreenIdComponent("cal");
660  $ilHelp->setScreenId("app");
661  if ($this->app->isMilestone())
662  {
663  $ilHelp->setSubScreenId("edit_milestone");
664  }
665  else
666  {
667  $ilHelp->setSubScreenId("edit");
668  }
669 
670  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
671  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
672  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
673 
674  $GLOBALS['ilCtrl']->saveParameter($this,array('seed','app_id','dt','idate'));
675 
676  if($_REQUEST['rexl'])
677  {
678  $GLOBALS['ilCtrl']->setParameter($this,'rexl',1);
679 
680  // Calculate new appointment time
681  $duration = $this->getAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->getAppointment()->getStart()->get(IL_CAL_UNIX);
682  include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
683  $calc = new ilCalendarRecurrenceCalculator($this->getAppointment(), $this->rec);
684 
685  $current_date = new ilDateTime($_REQUEST['dt'],IL_CAL_UNIX);
686 
687  $yesterday = clone $current_date;
688  $yesterday->increment(IL_CAL_DAY,-1);
689  $tomorrow = clone $current_date;
690  $tomorrow->increment(IL_CAL_DAY, 1);
691 
692 
693  foreach($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry)
694  {
695  if(ilDateTime::_equals($current_date, $date_entry,IL_CAL_DAY))
696  {
697  $this->getAppointment()->setStart(new ilDateTime($date_entry->get(IL_CAL_UNIX),IL_CAL_UNIX));
698  $this->getAppointment()->setEnd(new ilDateTime($date_entry->get(IL_CAL_UNIX) + $duration,IL_CAL_UNIX));
699  break;
700  }
701  }
702 
703  // Finally reset recurrence
704  $this->rec = new ilCalendarRecurrence();
705  }
706 
707  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
708  $cats = ilCalendarCategories::_getInstance($ilUser->getId());
709 
710  if(!$cats->isVisible($cat_id))
711  {
712  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
713  return false;
714  }
715  if(!$cats->isEditable($cat_id) or $this->app->isAutoGenerated())
716  {
717  $this->showInfoScreen();
718  return true;
719  }
720 
721  $this->initForm('edit', $this->app->isMilestone(), $a_edit_single_app);
722  $tpl->setContent($this->form->getHTML());
723  }
getAppointment()
Get current appointment.
global $ilErr
Definition: raiseError.php:16
static _lookupCategory($a_cal_id)
Lookup category id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const IL_CAL_UNIX
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
Create styles array
The data for the language used.
+ 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 575 of file class.ilCalendarAppointmentGUI.php.

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

576  {
577  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
578  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
579  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
580  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
581 
582  $this->showResponsibleUsersList($cat_info['obj_id']);
583  }
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 641 of file class.ilCalendarAppointmentGUI.php.

References $GLOBALS, and edit().

642  {
643  $_REQUEST['rexl'] = 1;
644  $GLOBALS['ilCtrl']->setParameter($this,'rexcl',1);
645  $this->edit(true);
646  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
edit($a_edit_single_app=false)
edit appointment
+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarAppointmentGUI::executeCommand ( )

Execute command.

public

Parameters

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

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

79  {
80  global $ilUser, $ilSetting,$tpl, $ilTabs;
81 
82 
83  // Clear tabs and set back target
84  $ilTabs->clearTargets();
85  $ilTabs->setBackTarget(
86  $this->lng->txt('cal_back_to_cal'),
87  $this->ctrl->getLinkTarget($this,'cancel')
88  );
89 
90  $next_class = $this->ctrl->getNextClass($this);
91  switch($next_class)
92  {
93 
94  default:
95  $cmd = $this->ctrl->getCmd("add");
96  $this->$cmd();
97  break;
98  }
99  return true;
100  }
$cmd
Definition: sahs_server.php:35
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17

◆ getAppointment()

ilCalendarAppointmentGUI::getAppointment ( )

Get current appointment.

Returns
ilCalendarEntry

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

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

Referenced by __construct().

1025  {
1026  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1027  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
1028  $this->app = new ilCalendarEntry($a_app_id);
1029 
1030  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
1031  $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
1032 
1033  if(!$a_app_id)
1034  {
1035  $start = clone $this->initialDate;
1036  $this->app->setStart($start);
1037 
1038  $seed_end = clone $this->initialDate;
1039  if($this->default_fulltime)
1040  {
1041  #$seed_end->increment(IL_CAL_DAY,1);
1042  }
1043  else
1044  {
1045  $seed_end->increment(IL_CAL_HOUR,1);
1046  }
1047  $this->app->setEnd($seed_end);
1048  $this->app->setFullday($this->default_fulltime);
1049 
1050  $this->rec = new ilCalendarRecurrence();
1051  }
1052  else
1053  {
1054  $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
1055  }
1056 
1057  }
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 130 of file class.ilCalendarAppointmentGUI.php.

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

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

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

References $title, and ilTextAreaInputGUI\setRows().

Referenced by book(), and bookconfirmed().

1437  {
1438  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1439  $form = new ilPropertyFormGUI();
1440  $form->setFormAction($this->ctrl->getFormAction($this));
1441  $form->addCommandButton('bookconfirmed',$this->lng->txt('cal_confirm_booking'));
1442  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
1443 
1444  $date = new ilNonEditableValueGUI($this->lng->txt('appointment'),'date');
1445  $form->addItem($date);
1446 
1447  $title = new ilNonEditableValueGUI($this->lng->txt('title'),'title');
1448  $form->addItem($title);
1449 
1450  $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1451  $message->setRows(5);
1452  $form->addItem($message);
1453 
1454  return $form;
1455  }
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initInitialDate()

ilCalendarAppointmentGUI::initInitialDate ( ilDate  $initialDate)
protected

init initial date

Parameters
ilDate$initialDate

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

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

Referenced by __construct().

983  {
984  if(!isset($_GET['hour']))
985  {
986  $this->initialDate = clone $initialDate;
987  $this->default_fulltime = true;
988  }
989  else
990  {
991  if((int) $_GET['hour'] < 10)
992  {
993  $time = '0'.(int) $_GET['hour'].':00:00';
994  }
995  else
996  {
997  $time = (int) $_GET['hour'].':00:00';
998  }
999  $this->initialDate = new ilDateTime($initialDate->get(IL_CAL_DATE).' '.$time,IL_CAL_DATETIME,$this->timezone);
1000  $this->default_fulltime = false;
1001  }
1002  }
const IL_CAL_DATETIME
$_GET["client_id"]
get($a_format, $a_format_str='', $a_tz='')
get formatted date
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 1011 of file class.ilCalendarAppointmentGUI.php.

References $seed.

Referenced by __construct().

1012  {
1013  $this->seed = clone $seed;
1014  $this->default_fulltime = true;
1015  }
+ Here is the caller graph for this function:

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

init timezone

protected

Parameters

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

References $ilUser, and timezone.

Referenced by __construct().

972  {
973  global $ilUser;
974 
975  $this->timezone = $ilUser->getTimeZone();
976  }
Set timezone
$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 1066 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

1067  {
1068  // needed for date handling
1069  $this->initForm($a_mode, $a_as_milestone);
1070  $this->form->checkInput();
1071 
1072  if ($a_as_milestone)
1073  {
1074  $this->app->setMilestone(true);
1075  $this->app->setCompletion(ilUtil::stripSlashes($_POST['completion']));
1076  }
1077 
1078  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1079  $this->app->setLocation(ilUtil::stripSlashes($_POST['location']));
1080  $this->app->setDescription(ilUtil::stripSlashes($_POST['description']));
1081  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1082  $this->app->enableNotification((int) $_POST['not']);
1083 
1084  if ($a_as_milestone) // milestones are always fullday events
1085  {
1086  $start = $this->form->getItemByPostVar('event_start');
1087  $start = $start->getDate();
1088 
1089  $this->app->setFullday(true);
1090 
1091  // for milestones is end date = start date
1092  $this->app->setStart($start);
1093  $this->app->setEnd($start);
1094  }
1095  else
1096  {
1097 
1098  $period = $this->form->getItemByPostVar('event');
1099  $start = $period->getStart();
1100  $end = $period->getEnd();
1101 
1102  $this->app->setFullday($start instanceof ilDate);
1103  $this->app->setStart($start);
1104  $this->app->setEnd($end);
1105  }
1106 
1107  $this->loadNotificationRecipients();
1108  $this->loadRecurrenceSettings($a_as_milestone = false);
1109  }
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 1111 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by load().

1112  {
1113  $this->notification->setRecipients(array());
1114 
1115  foreach((array) $_POST['notu'] as $rcp)
1116  {
1117  $rcp = trim(ilUtil::stripSlashes($rcp));
1118  $usr_id = ilObjUser::_loginExists($rcp);
1119 
1120  if(strlen($rcp) == 0)
1121  {
1122  continue;
1123  }
1124 
1125  if($usr_id)
1126  {
1127  $this->notification->addRecipient(
1129  $usr_id
1130  );
1131  }
1132  else
1133  {
1134  $this->notification->addRecipient(
1136  0,
1137  $rcp
1138  );
1139  }
1140  }
1141  }
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
Create styles array
The data for the language used.
$_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 1149 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().

1150  {
1151  $this->rec->reset();
1152 
1153  switch($_POST['frequence'])
1154  {
1155  case IL_CAL_FREQ_DAILY:
1156  $this->rec->setFrequenceType($_POST['frequence']);
1157  $this->rec->setInterval((int) $_POST['count_DAILY']);
1158  break;
1159 
1160  case IL_CAL_FREQ_WEEKLY:
1161  $this->rec->setFrequenceType($_POST['frequence']);
1162  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1163  if(is_array($_POST['byday_WEEKLY']))
1164  {
1165  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
1166  }
1167  break;
1168 
1169  case IL_CAL_FREQ_MONTHLY:
1170  $this->rec->setFrequenceType($_POST['frequence']);
1171  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1172  switch((int) $_POST['subtype_MONTHLY'])
1173  {
1174  case 0:
1175  // nothing to do;
1176  break;
1177 
1178  case 1:
1179  switch((int) $_POST['monthly_byday_day'])
1180  {
1181  case 8:
1182  // Weekday
1183  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1184  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1185  break;
1186 
1187  case 9:
1188  // Day of month
1189  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1190  break;
1191 
1192  default:
1193  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
1194  break;
1195  }
1196  break;
1197 
1198  case 2:
1199  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1200  break;
1201  }
1202  break;
1203 
1204  case IL_CAL_FREQ_YEARLY:
1205  $this->rec->setFrequenceType($_POST['frequence']);
1206  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1207  switch((int) $_POST['subtype_YEARLY'])
1208  {
1209  case 0:
1210  // nothing to do;
1211  break;
1212 
1213  case 1:
1214  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1215  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
1216  break;
1217 
1218  case 2:
1219  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1220  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1221  break;
1222  }
1223  break;
1224  }
1225 
1226  // UNTIL
1227  switch((int) $_POST['until_type'])
1228  {
1229  case 1:
1230  $this->rec->setFrequenceUntilDate(null);
1231  // nothing to do
1232  break;
1233 
1234  case 2:
1235  $this->rec->setFrequenceUntilDate(null);
1236  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1237  break;
1238 
1239  case 3:
1240  $dt = new ilDateTimeInputGUI('','until_end');
1241  $dt->setRequired(true);
1242  if($dt->checkInput())
1243  {
1244  $this->rec->setFrequenceUntilCount(0);
1245  $this->rec->setFrequenceUntilDate($dt->getDate());
1246  }
1247  break;
1248  }
1249 
1250  }
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 1342 of file class.ilCalendarAppointmentGUI.php.

References $_POST, $ilUser, IL_CAL_UNIX, and ilUtil\sendSuccess().

1343  {
1344  global $ilUser;
1345 
1346  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1347  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1348  $reg->register(
1349  $ilUser->getId(),
1350  new ilDateTime((int) $_REQUEST['dstart'],IL_CAL_UNIX),
1351  new ilDateTime((int) $_REQUEST['dend'],IL_CAL_UNIX)
1352  );
1353 
1354  ilUtil::sendSuccess($this->lng->txt('cal_reg_registered'),true);
1355  $this->ctrl->returnToParent($this);
1356  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ save()

ilCalendarAppointmentGUI::save (   $a_as_milestone = false)
protected

save appointment

protected

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

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

Referenced by saveMilestone().

422  {
423  global $ilErr;
424 
425  $this->load('create', $a_as_milestone);
426 
427  if($this->app->validate() and $this->notification->validate())
428  {
429  if(!(int) $_POST['calendar'])
430  {
431  $cat_id = $this->createDefaultCalendar();
432  }
433  else
434  {
435  $cat_id = (int) $_POST['calendar'];
436  }
437 
438  $this->app->save();
439  $this->notification->setEntryId($this->app->getEntryId());
440  $this->notification->save();
441  $this->rec->setEntryId($this->app->getEntryId());
442  $this->saveRecurrenceSettings();
443 
444  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
445  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
446  $ass->addAssignment($cat_id);
447 
448  // Send notifications
449  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
450  if(ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not'])
451  {
452  $this->distributeNotifications($cat_id,$this->app->getEntryId(),true);
453  }
454  if(ilCalendarSettings::_getInstance()->isUserNotificationEnabled())
455  {
457  }
458 
459  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
460  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
461  $type = ilObject::_lookupType($cat_info['obj_id']);
462 
463  if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
464  && ($type == "grp" || $type == "crs"))
465  {
466  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone_resp_q'),true);
467  return $this->showResponsibleUsersList($cat_info['obj_id']);
468  }
469  elseif($a_as_milestone)
470  {
471  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone'),true);
472  $this->ctrl->returnToParent($this);
473  }
474  else
475  {
476  ilUtil::sendSuccess($this->lng->txt('cal_created_appointment'),true);
477  $this->ctrl->returnToParent($this);
478  }
479  }
480  else
481  {
482  ilUtil::sendFailure($ilErr->getMessage());
483  }
484  if ($a_as_milestone)
485  {
486  $this->addMilestone();
487  }
488  else
489  {
490  $this->add();
491  }
492  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
static _getInstance()
get singleton instance
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
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 411 of file class.ilCalendarAppointmentGUI.php.

References save().

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

◆ saveMilestoneResponsibleUsers()

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

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

References $_POST, and $ilCtrl.

603  {
604  global $ilCtrl;
605 
606  $this->app->writeResponsibleUsers($_POST["user_id"]);
607  $ilCtrl->returnToParent($this);
608  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

save recurrence settings

protected

Parameters

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

References $_POST.

Referenced by save(), and update().

1260  {
1261  switch($_POST['frequence'])
1262  {
1263  case 'NONE':
1264  case '':
1265  // No recurrence => delete if there is an recurrence rule
1266  if($this->rec->getRecurrenceId())
1267  {
1268  $this->rec->delete();
1269  }
1270  break;
1271 
1272  default:
1273  if($this->rec->getRecurrenceId())
1274  {
1275  $this->rec->update();
1276  }
1277  else
1278  {
1279  $this->rec->save();
1280  }
1281  break;
1282  }
1283  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ showInfoScreen()

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

show info screen

protected

Returns

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

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

Referenced by edit().

732  {
733  global $tpl,$ilUser;
734 
735  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
736  $info = new ilInfoScreenGUI($this);
737  $info->setFormAction($this->ctrl->getFormAction($this));
738 
739  if ($this->app->isMilestone())
740  {
741  $info->addSection($this->lng->txt('cal_ms_details'));
742  }
743  else
744  {
745  $info->addSection($this->lng->txt('cal_details'));
746  }
747 
748  // Appointment
749  $info->addProperty($this->lng->txt('appointment'),
751  $this->app->getStart(),
752  $this->app->getEnd()));
753  $info->addProperty($this->lng->txt('title'),$this->app->getPresentationTitle());
754 
755  // Description
756  if(strlen($desc = $this->app->getDescription()))
757  {
758  $info->addProperty($this->lng->txt('description'),ilUtil::makeClickable(nl2br($desc)));
759  }
760 
761  // Location
762  if(strlen($loc = $this->app->getLocation()))
763  {
764  $info->addProperty($this->lng->txt('cal_where'),$loc);
765  }
766 
767  // completion
768  if ($this->app->isMilestone() && $this->app->getCompletion() > 0)
769  {
770  $info->addProperty($this->lng->txt('cal_task_completion'),
771  $this->app->getCompletion()." %");
772  }
773 
774  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
775  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
776  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
777  $type = ilObject::_lookupType($cat_info['obj_id']);
778  if ($this->app->isMilestone() && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
779  && ($type == "grp" || $type == "crs"))
780  {
781  // users responsible
782  $users = $this->app->readResponsibleUsers();
783  $delim = "";
784  foreach($users as $r)
785  {
786  $value.= $delim.$r["lastname"].", ".$r["firstname"]." [".$r["login"]."]";
787  $delim = "<br />";
788  }
789  if (count($users) > 0)
790  {
791  $info->addProperty($this->lng->txt('cal_responsible'),
792  $value);
793  }
794  }
795 
796  $category = new ilCalendarCategory($cat_id);
797 
798  if($category->getType() == ilCalendarCategory::TYPE_OBJ)
799  {
800  $info->addSection($this->lng->txt('additional_info'));
801 
802  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
803  $refs = ilObject::_getAllReferences($cat_info['obj_id']);
804 
805  include_once('./Services/Link/classes/class.ilLink.php');
806  $href = ilLink::_getStaticLink(current($refs),ilObject::_lookupType($cat_info['obj_id']),true);
807  $info->addProperty($this->lng->txt('perma_link'),'<a class="small" href="'.$href.'" target="_top">'.$href.'</a>');
808  }
809 
810  $tpl->setContent($info->getHTML());
811  }
static _lookupCategory($a_cal_id)
Lookup category id.
Class ilInfoScreenGUI.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
Stores calendar categories.
static _getAllReferences($a_id)
get all reference ids of object
$info
Definition: example_052.php:80
$r
Definition: example_031.php:79
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
$ilUser
Definition: imgupload.php:18
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupType($a_id, $a_reference=false)
lookup object type
+ 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 589 of file class.ilCalendarAppointmentGUI.php.

References $tpl.

Referenced by editResponsibleUsers(), and save().

590  {
591  global $tpl;
592 
593  include_once("./Services/Calendar/classes/class.ilMilestoneResponsiblesTableGUI.php");
594  $table_gui = new ilMilestoneResponsiblesTableGUI($this, "", $a_grp_id,
595  $this->app->getEntryId());
596  $tpl->setContent($table_gui->getHTML());
597  }
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 1392 of file class.ilCalendarAppointmentGUI.php.

References $_POST, $ilUser, IL_CAL_UNIX, and ilUtil\sendSuccess().

1393  {
1394  global $ilUser;
1395 
1396  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1397  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1398  $reg->unregister(
1399  $ilUser->getId(),
1400  new ilDateTime((int) $_REQUEST['dstart'],IL_CAL_UNIX),
1401  new ilDateTime((int) $_REQUEST['dend'],IL_CAL_UNIX)
1402  );
1403 
1404  ilUtil::sendSuccess($this->lng->txt('cal_reg_unregistered'),true);
1405  $this->ctrl->returnToParent($this);
1406  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ update()

ilCalendarAppointmentGUI::update ( )
protected

update

protected

Returns

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

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

820  {
821  global $ilErr;
822 
823  $single_editing = ($_REQUEST['rexl'] ? true : false);
824 
825  $this->load('edit', $this->app->isMilestone());
826 
827  if($this->app->validate() and $this->notification->validate())
828  {
829  if(!(int) $_POST['calendar'])
830  {
831  $cat_id = $this->createDefaultCalendar();
832  }
833  else
834  {
835  $cat_id = (int) $_POST['calendar'];
836  }
837 
838  if($single_editing)
839  {
840  $this->getAppointment()->save();
841  $this->deleteExclude(false);
842 
843  $this->rec = new ilCalendarRecurrence();
844  $this->rec->setEntryId($this->getAppointment()->getEntryId());
845  }
846  else
847  {
848  $this->getAppointment()->update();
849  }
850  $this->notification->save();
851  $this->saveRecurrenceSettings();
852 
853  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
854  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
855  $GLOBALS['ilLog']->write($this->app->getEntryId());
856  $ass->deleteAssignments();
857  $ass->addAssignment($cat_id);
858 
859  // Send notifications
860  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
861  if(ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not'])
862  {
863  $this->distributeNotifications($cat_id,$this->app->getEntryId(),false);
864  }
865  if(ilCalendarSettings::_getInstance()->isUserNotificationEnabled())
866  {
868  }
869 
870  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
871  $this->ctrl->returnToParent($this);
872  }
873  else
874  {
875  ilUtil::sendFailure($ilErr->getMessage());
876  }
877 
878  $this->edit();
879 
880  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getAppointment()
Get current appointment.
global $ilErr
Definition: raiseError.php:16
static _getInstance()
get singleton instance
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
deleteExclude($a_return=true)
delete single item of recurrence list
edit($a_edit_single_app=false)
edit appointment
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 42 of file class.ilCalendarAppointmentGUI.php.

Referenced by delete(), and getAppointment().

◆ $ctrl

ilCalendarAppointmentGUI::$ctrl
protected

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

◆ $default_fulltime

ilCalendarAppointmentGUI::$default_fulltime = true
protected

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

◆ $initialDate

ilCalendarAppointmentGUI::$initialDate = null
protected

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

Referenced by initAppointment(), and initInitialDate().

◆ $lng

ilCalendarAppointmentGUI::$lng
protected

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

Referenced by __construct(), and createDefaultCalendar().

◆ $rec

ilCalendarAppointmentGUI::$rec = null
protected

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

Referenced by askEdit(), and initForm().

◆ $seed

ilCalendarAppointmentGUI::$seed = null
protected

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

Referenced by initSeed().

◆ $timezone

ilCalendarAppointmentGUI::$timezone = null
protected

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

Referenced by initInitialDate().

◆ $tpl


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