ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCalendarAppointmentGUI Class Reference

Administrate calendar appointments. More...

+ Collaboration diagram for ilCalendarAppointmentGUI:

Public Member Functions

 __construct (ilDate $seed, ilDate $initialDate, $a_appointment_id=0)
 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_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 378 of file class.ilCalendarAppointmentGUI.php.

References $tpl, and initForm().

Referenced by save().

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

References $tpl, and initForm().

Referenced by save().

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

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

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

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

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

◆ book()

ilCalendarAppointmentGUI::book ( )

Confirmation screen for booking of consultation appointment.

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

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

1431  {
1432  global $ilUser, $tpl;
1433 
1434  $entry = (int)$_GET['app_id'];
1435  $user = (int)$_GET['bkid'];
1436 
1437  $this->ctrl->saveParameter($this,'app_id');
1438 
1439  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1440  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1441  $entry = new ilCalendarEntry($entry);
1442 
1443  $form = $this->initFormConfirmBooking();
1444  $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()));
1445  $form->getItemByPostVar('title')->setValue($entry->getTitle()." (".ilObjUser::_lookupFullname($user).')');
1446 
1447  $tpl->setContent($form->getHTML());
1448  return true;
1449  }
Model for a calendar entry.
$_GET["client_id"]
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
_lookupFullname($a_user_id)
Lookup Full Name.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ bookconfirmed()

ilCalendarAppointmentGUI::bookconfirmed ( )

Book consultation appointment, was confirmed.

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

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

1480  {
1481  global $ilUser;
1482 
1483  $entry = (int) $_REQUEST['app_id'];
1484  $user = (int) $_REQUEST['bkid'];
1485 
1486  $form = $this->initFormConfirmBooking();
1487  if($form->checkInput())
1488  {
1489  // check if appointment is bookable
1490  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1491  $cal_entry = new ilCalendarEntry($entry);
1492 
1493  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1494  $booking = new ilBookingEntry($cal_entry->getContextId());
1495 
1496  if(!$booking->isAppointmentBookableForUser($entry, $GLOBALS['ilUser']->getId()))
1497  {
1498  ilUtil::sendFailure($this->lng->txt('cal_booking_failed_info'), true);
1499  $this->ctrl->returnToParent($this);
1500  }
1501 
1502  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1503  ilConsultationHourUtils::bookAppointment($ilUser->getId(), $entry);
1504 
1505  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1506  ilBookingEntry::writeBookingMessage($entry, $ilUser->getId(), $form->getInput('comment'));
1507  }
1508  ilUtil::sendSuccess($this->lng->txt('cal_booking_confirmed'),true);
1509  $this->ctrl->returnToParent($this);
1510  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
Booking definition.
static writeBookingMessage($a_entry_id, $a_usr_id, $a_message)
Write booking message.
$GLOBALS['ct_recipient']
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
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 1621 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by cancelBooking(), and cancelConfirmed().

1622  {
1623  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1624  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1625  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1626  $assignment = $assignment->getFirstAssignment();
1627  return new ilCalendarCategory($assignment);
1628  }
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 1516 of file class.ilCalendarAppointmentGUI.php.

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

1517  {
1518  global $ilUser, $tpl;
1519 
1520  $entry = (int)$_GET['app_id'];
1521 
1522  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1523  $entry = new ilCalendarEntry($entry);
1524 
1525  $category = $this->calendarEntryToCategory($entry);
1526  if($category->getType() == ilCalendarCategory::TYPE_CH)
1527  {
1528  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1529  $booking = new ilBookingEntry($entry->getContextId());
1530  if(!$booking->hasBooked($entry->getEntryId()))
1531  {
1532  $this->ctrl->returnToParent($this);
1533  return false;
1534  }
1535 
1536  $entry_title = ' '.$entry->getTitle()." (".ilObjUser::_lookupFullname($booking->getObjId()).')';
1537  }
1538  else if($category->getType() == ilCalendarCategory::TYPE_BOOK)
1539  {
1540  $entry_title = ' '.$entry->getTitle();
1541  }
1542  else
1543  {
1544  $this->ctrl->returnToParent($this);
1545  return false;
1546  }
1547 
1548  $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1549 
1550  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1551  $conf = new ilConfirmationGUI;
1552  $conf->setFormAction($this->ctrl->getFormAction($this));
1553  $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
1554  $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
1555  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1556  $conf->addItem('app_id', $entry->getEntryId(), $title.' - '.$entry_title);
1557 
1558  $tpl->setContent($conf->getHTML());
1559  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
Booking definition.
_lookupFullname($a_user_id)
Lookup Full Name.
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
global $ilUser
Definition: imgupload.php:15
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 1565 of file class.ilCalendarAppointmentGUI.php.

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

1566  {
1567  global $ilUser;
1568 
1569  $entry = (int)$_POST['app_id'];
1570  $user = (int)$_GET['bkid'];
1571 
1572  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1573  $entry = new ilCalendarEntry($entry);
1574 
1575  $category = $this->calendarEntryToCategory($entry);
1576  if($category->getType() == ilCalendarCategory::TYPE_CH)
1577  {
1578  // find cloned calendar entry in user calendar
1579  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1580  $GLOBALS['ilLog']->dump($entry->getStart());
1582  $ilUser->getId(),
1583  $entry->getContextId(),
1584  $entry->getStart(),
1586  false);
1587  $GLOBALS['ilLog']->dump($apps);
1588 
1589  // Fix for wrong, old entries
1590  foreach((array) $apps as $own_app)
1591  {
1592  $ref_entry = new ilCalendarEntry($own_app);
1593  $ref_entry->delete();
1594  }
1595 
1596  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1597  $booking = new ilBookingEntry($entry->getContextId());
1598  $booking->cancelBooking($entry->getEntryId());
1599 
1600  // do NOT delete original entry
1601  }
1602  else if($category->getType() == ilCalendarCategory::TYPE_BOOK)
1603  {
1604  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1605  $booking = new ilBookingReservation($entry->getContextId());
1607  $booking->update();
1608 
1609  $entry->delete();
1610  }
1611 
1612  ilUtil::sendSuccess($this->lng->txt('cal_cancel_booking_confirmed'),true);
1613  $this->ctrl->returnToParent($this);
1614  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$_POST['username']
Definition: cron.php:12
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.
Booking definition.
$GLOBALS['ct_recipient']
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
cancelBooking($a_entry_id, $a_user_id=false)
cancel calendar booking for user
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ confirmRegister()

ilCalendarAppointmentGUI::confirmRegister ( )
protected

Register to an appointment.

Returns

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

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

1332  {
1333  global $tpl;
1334 
1335  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1337  new ilDateTime($_GET['dstart'],IL_CAL_UNIX),
1338  new ilDateTime($_GET['dend'],IL_CAL_UNIX)
1339  );
1340 
1341 
1342  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1343  $conf = new ilConfirmationGUI;
1344 
1345  $this->ctrl->setParameter($this,'dstart',(int) $_REQUEST['dstart']);
1346  $this->ctrl->setParameter($this,'dend',(int) $_REQUEST['dend']);
1347 
1348  $conf->setFormAction($this->ctrl->getFormAction($this));
1349  $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1350  $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1351  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1352  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle().' ('.$start.')');
1353 
1354  $tpl->setContent($conf->getHTML());
1355  }
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
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmUnregister()

ilCalendarAppointmentGUI::confirmUnregister ( )

Confirmation screen to unregister calendar.

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

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

1381  {
1382  global $tpl;
1383 
1384 
1385  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1387  $dstart = new ilDateTime($_GET['dstart'],IL_CAL_UNIX),
1388  $dend = new ilDateTime($_GET['dend'],IL_CAL_UNIX)
1389  );
1390 
1391 
1392  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1393  $conf = new ilConfirmationGUI;
1394 
1395  $this->ctrl->setParameter($this,'dstart',(int) $_REQUEST['dstart']);
1396  $this->ctrl->setParameter($this,'dend',(int) $_REQUEST['dend']);
1397 
1398  $conf->setFormAction($this->ctrl->getFormAction($this));
1399  $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1400  $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1401  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1402  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle().' ('.$start.')');
1403 
1404  $tpl->setContent($conf->getHTML());
1405  }
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
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDefaultCalendar()

ilCalendarAppointmentGUI::createDefaultCalendar ( )
protected

Create a default calendar.

protected

Returns

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

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

Referenced by save(), and update().

1311  {
1312  global $ilUser,$lng;
1313 
1314  $cat = new ilCalendarCategory();
1315  $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1316  $cat->setType(ilCalendarCategory::TYPE_USR);
1317  $cat->setTitle($this->lng->txt('cal_default_calendar'));
1318  $cat->setObjId($ilUser->getId());
1319 
1320  // delete calendar cache
1321  include_once './Services/Calendar/classes/class.ilCalendarCache.php';
1322  ilCalendarCache::getInstance()->deleteUserEntries($ilUser->getId());
1323 
1324  return $cat->add();
1325  }
static getInstance()
get singleton instance
Stores calendar categories.
global $ilUser
Definition: imgupload.php:15
+ 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 927 of file class.ilCalendarAppointmentGUI.php.

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

928  {
929  foreach($_POST['appointments'] as $app_id)
930  {
931  $app = new ilCalendarEntry($app_id);
932  $app->delete();
933 
934  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
936 
937  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
939  }
940  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'),true);
941  $this->ctrl->returnToParent($this);
942  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$_POST['username']
Definition: cron.php:12
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static deleteCalendarEntry($a_cal_id)
Delete notification for a calendar entry ilDB $ilDB.
+ Here is the call graph for this function:

◆ deleteExclude()

ilCalendarAppointmentGUI::deleteExclude (   $a_return = true)
protected

delete single item of recurrence list

protected

Parameters

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

References $_REQUEST, IL_CAL_UNIX, and ilUtil\sendSuccess().

Referenced by update().

952  {
953  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceExclusion.php');
954  $excl = new ilCalendarRecurrenceExclusion();
955  $excl->setEntryId($_REQUEST['app_id']);
956  $excl->setDate(new ilDate($_REQUEST['dt'], IL_CAL_UNIX));
957  $excl->save();
958 
959  if($a_return)
960  {
961  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'),true);
962  $this->ctrl->returnToParent($this);
963  }
964  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_UNIX
Class for single dates.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
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 533 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().

534  {
535  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
536  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
537 
538  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
539  $notification = new ilCalendarMailNotification();
540  $notification->setAppointmentId($app_id);
541 
542  switch($cat_info['type'])
543  {
545 
546  switch($cat_info['obj_type'])
547  {
548  case 'crs':
549  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
550  $ref_id = current($ref_ids);
551  $notification->setRefId($ref_id);
552  $notification->setType(
553  $a_new_appointment ?
556  break;
557 
558  case 'grp':
559  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
560  $ref_id = current($ref_ids);
561  $notification->setRefId($ref_id);
562  $notification->setType(
563  $a_new_appointment ?
566  break;
567  }
568  break;
569  }
570 
571  $notification->send();
572  }
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 500 of file class.ilCalendarAppointmentGUI.php.

References $ilUser, ilCalendarUserNotification\TYPE_EMAIL, ilCalendarUserNotification\TYPE_USER, ilCalendarMailNotification\TYPE_USER, and ilCalendarMailNotification\TYPE_USER_ANONYMOUS.

Referenced by save(), and update().

501  {
502  global $ilUser;
503 
504  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
505  $notification = new ilCalendarMailNotification();
506  $notification->setAppointmentId($this->app->getEntryId());
507 
508  foreach($this->notification->getRecipients() as $rcp)
509  {
510  switch($rcp['type'])
511  {
513  $notification->setSender(ANONYMOUS_USER_ID);
514  $notification->setRecipients(array($rcp['usr_id']));
515  $notification->setType(ilCalendarMailNotification::TYPE_USER);
516  break;
517 
519  $notification->setSender(ANONYMOUS_USER_ID);
520  $notification->setRecipients(array($rcp['email']));
521  $notification->setType(ilCalendarMailNotification::TYPE_USER_ANONYMOUS);
522  break;
523  }
524  $notification->send();
525  }
526  }
Distributes calendar mail notifications.
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ doUserAutoComplete()

ilCalendarAppointmentGUI::doUserAutoComplete ( )
protected

Do auto completion.

Returns
void

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

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

1635  {
1636  if(!isset($_GET['autoCompleteField']))
1637  {
1638  $a_fields = array('login','firstname','lastname','email');
1639  }
1640  else
1641  {
1642  $a_fields = array((string) $_GET['autoCompleteField']);
1643  }
1644 
1645  $GLOBALS['ilLog']->write(print_r($a_fields,true));
1646  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1647  $auto = new ilUserAutoComplete();
1648  $auto->setSearchFields($a_fields);
1649  $auto->enableFieldSearchableCheck(true);
1650  $auto->setMoreLinkAvailable(true);
1651 
1652  if(($_REQUEST['fetchall']))
1653  {
1654  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1655  }
1656 
1657  echo $auto->getList($_REQUEST['query']);
1658  exit();
1659  }
exit
Definition: login.php:54
$_GET["client_id"]
Auto completion class for user lists.
$GLOBALS['ct_recipient']
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

◆ edit()

ilCalendarAppointmentGUI::edit (   $a_edit_single_app = false)
protected

edit appointment

protected

Parameters

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

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

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

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

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

References $_REQUEST, $GLOBALS, and edit().

644  {
645  $_REQUEST['rexl'] = 1;
646  $GLOBALS['ilCtrl']->setParameter($this,'rexcl',1);
647  $this->edit(true);
648  }
edit($a_edit_single_app=false)
edit appointment
$GLOBALS['ct_recipient']
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40

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

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

Referenced by __construct().

1027  {
1028  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1029  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
1030  $this->app = new ilCalendarEntry($a_app_id);
1031 
1032  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
1033  $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
1034 
1035  if(!$a_app_id)
1036  {
1037  $start = clone $this->initialDate;
1038  $this->app->setStart($start);
1039 
1040  $seed_end = clone $this->initialDate;
1041  if($this->default_fulltime)
1042  {
1043  #$seed_end->increment(IL_CAL_DAY,1);
1044  }
1045  else
1046  {
1047  $seed_end->increment(IL_CAL_HOUR,1);
1048  }
1049  $this->app->setEnd($seed_end);
1050  $this->app->setFullday($this->default_fulltime);
1051 
1052  $this->rec = new ilCalendarRecurrence();
1053  }
1054  else
1055  {
1056  $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
1057  }
1058 
1059  }
Model for a calendar entry.
const IL_CAL_HOUR
static _getFirstRecurrence($a_cal_id)
get first recurrence
+ 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, $tpl, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarCategories\_lookupCategoryIdByObjId(), ilObjUser\_lookupLogin(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilCalendarCategoryAssignments\getFirstAssignment(), ilYuiUtil\initDomEvent(), ilDateTimeInputGUI\setDate(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilDateDurationInputGUI\setStartText(), ilTextInputGUI\setValue(), ilSelectInputGUI\setValue(), ilNonEditableValueGUI\setValue(), ilTextAreaInputGUI\setValue(), ilCalendarUserNotification\TYPE_EMAIL, ilCalendarCategory\TYPE_OBJ, and ilCalendarUserNotification\TYPE_USER.

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

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->setStartText($this->lng->txt('cal_start'));
245  $dur->setEndText($this->lng->txt('cal_end'));
246  $dur->enableToggleFullTime(
247  $this->lng->txt('cal_fullday_title'),
248  $this->app->isFullday() ? true : false
249  );
250  $dur->setShowTime(true);
251  $dur->setStart($this->app->getStart());
252  $dur->setEnd($this->app->getEnd());
253  $this->form->addItem($dur);
254 
255  // recurrence
256  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
257  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
258  $rec->setRecurrence($this->rec);
259  $this->form->addItem($rec);
260 
261  // location
262  $where = new ilTextInputGUI($this->lng->txt('cal_where'),'location');
263  $where->setValue($this->app->getLocation());
264  $where->setMaxLength(128);
265  $where->setSize(32);
266  $this->form->addItem($where);
267  }
268  else
269  {
270  $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'),'event[start]');
271  $deadline->setDate($this->app->getStart());
272  $deadline->setShowTime(false);
273  $deadline->setMinuteStepSize(5);
274  $this->form->addItem($deadline);
275 
276  // completion
277  $completion_vals = array();
278  for($i = 0; $i <= 100; $i+=5)
279  {
280  $completion_vals[$i] = $i." %";
281  }
282  $compl = new ilSelectInputGUI($this->lng->txt('cal_task_completion'),
283  'completion');
284  $compl->setOptions($completion_vals);
285  $compl->setValue($this->app->getCompletion());
286  $this->form->addItem($compl);
287  }
288 
289  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
290  $desc->setValue($this->app->getDescription());
291  $desc->setRows(5);
292  $this->form->addItem($desc);
293 
294  if ($a_as_milestone && $a_mode == "edit" && $resp_info)
295  {
296  // users responsible
297  $users = $this->app->readResponsibleUsers();
298  $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'),
299  $users);
300  $delim = "";
301  foreach($users as $r)
302  {
303  $value.= $delim.$r["lastname"].", ".$r["firstname"]." [".$r["login"]."]";
304  $delim = "<br />";
305  }
306  if (count($users) > 0)
307  {
308  $resp->setValue($value);
309  }
310  else
311  {
312  $resp->setValue("-");
313  }
314 
315  $this->form->addItem($resp);
316  }
317 
318 
319  if(ilCalendarSettings::_getInstance()->isUserNotificationEnabled())
320  {
321  $notu = new ilTextWizardInputGUI($this->lng->txt('cal_user_notification'), 'notu');
322  $notu->setInfo($this->lng->txt('cal_user_notification_info'));
323  $notu->setSize(20);
324  $notu->setMaxLength(64);
325 
326  $values = array();
327  foreach($this->notification->getRecipients() as $rcp)
328  {
329  switch ($rcp['type'])
330  {
332  $values[] = ilObjUser::_lookupLogin($rcp['usr_id']);
333  break;
334 
336  $values[] = $rcp['email'];
337  break;
338  }
339  }
340  if(count($values))
341  $notu->setValues($values);
342  else
343  $notu->setValues(array(''));
344  $this->form->addItem($notu);
345  }
346 
347  // Notifications
348  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
349  if(ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars()))
350  {
351  $selected_cal = new ilCalendarCategory($selected_calendar);
352  $disabled = true;
353  if($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ)
354  {
355  if(ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp')
356  {
357  $disabled = false;
358  }
359  }
360 
361  $tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js');
362  $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'),'not');
363  $not->setInfo($this->lng->txt('cal_notification_info'));
364  $not->setValue(1);
365  $not->setChecked($this->app->isNotificationEnabled());
366  $not->setDisabled($disabled);
367  $this->form->addItem($not);
368  }
369  }
static _getInstance()
get singleton instance
$_POST['username']
Definition: cron.php:12
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)
setValue($a_value)
Set Value.
static _lookupObjId($a_id)
This class represents a text property in a property form.
static initDomEvent()
Init YUI DomEvent.
_lookupLogin($a_user_id)
lookup login
setOptions($a_options)
Set Options.
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupType($a_id, $a_reference=false)
lookup object type
setStartText($a_txt)
Set text, which will be shown before the start date.
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
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.
$r
+ 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 1455 of file class.ilCalendarAppointmentGUI.php.

References ilTextAreaInputGUI\setRows().

Referenced by book(), and bookconfirmed().

1456  {
1457  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1458  $form = new ilPropertyFormGUI();
1459  $form->setFormAction($this->ctrl->getFormAction($this));
1460  $form->addCommandButton('bookconfirmed',$this->lng->txt('cal_confirm_booking'));
1461  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
1462 
1463  $date = new ilNonEditableValueGUI($this->lng->txt('appointment'),'date');
1464  $form->addItem($date);
1465 
1466  $title = new ilNonEditableValueGUI($this->lng->txt('title'),'title');
1467  $form->addItem($title);
1468 
1469  $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1470  $message->setRows(5);
1471  $form->addItem($message);
1472 
1473  return $form;
1474  }
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 984 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by __construct().

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

References $seed.

Referenced by __construct().

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

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

init timezone

protected

Parameters

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

References $ilUser.

Referenced by __construct().

974  {
975  global $ilUser;
976 
977  $this->timezone = $ilUser->getTimeZone();
978  }
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ load()

ilCalendarAppointmentGUI::load (   $a_as_milestone = false)
protected

load post

protected

Parameters

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

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

Referenced by save(), and update().

1069  {
1070  if ($a_as_milestone)
1071  {
1072  $this->app->setMilestone(true);
1073  $this->app->setCompletion(ilUtil::stripSlashes($_POST['completion']));
1074  }
1075 
1076  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1077  $this->app->setLocation(ilUtil::stripSlashes($_POST['location']));
1078  $this->app->setDescription(ilUtil::stripSlashes($_POST['description']));
1079  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
1080  $this->app->enableNotification((int) $_POST['not']);
1081  if ($a_as_milestone) // milestones are always fullday events
1082  {
1083  $this->app->setFullday(true);
1084  }
1085  else
1086  {
1087  $this->app->setFullday(isset($_POST['event']['fulltime']) ? true : false);
1088  }
1089 
1090  if($this->app->isFullday())
1091  {
1092  $start = new ilDate($_POST['event']['start']['date']['y'].'-'.$_POST['event']['start']['date']['m'].'-'.$_POST['event']['start']['date']['d'],
1093  IL_CAL_DATE);
1094  $this->app->setStart($start);
1095 
1096  $end = new ilDate($_POST['event']['end']['date']['y'].'-'.$_POST['event']['end']['date']['m'].'-'.$_POST['event']['end']['date']['d'],
1097  IL_CAL_DATE);
1098 
1099  if ($a_as_milestone)
1100  {
1101  // for milestones is end date = start date
1102  $this->app->setEnd($start);
1103  }
1104  else
1105  {
1106  $this->app->setEnd($end);
1107  }
1108  }
1109  else
1110  {
1111  $start_dt['year'] = (int) $_POST['event']['start']['date']['y'];
1112  $start_dt['mon'] = (int) $_POST['event']['start']['date']['m'];
1113  $start_dt['mday'] = (int) $_POST['event']['start']['date']['d'];
1114  $start_dt['hours'] = (int) $_POST['event']['start']['time']['h'];
1115  $start_dt['minutes'] = (int) $_POST['event']['start']['time']['m'];
1116  $start = new ilDateTime($start_dt,IL_CAL_FKT_GETDATE,$this->timezone);
1117  $this->app->setStart($start);
1118 
1119  $end_dt['year'] = (int) $_POST['event']['end']['date']['y'];
1120  $end_dt['mon'] = (int) $_POST['event']['end']['date']['m'];
1121  $end_dt['mday'] = (int) $_POST['event']['end']['date']['d'];
1122  $end_dt['hours'] = (int) $_POST['event']['end']['time']['h'];
1123  $end_dt['minutes'] = (int) $_POST['event']['end']['time']['m'];
1124  $end = new ilDateTime($end_dt,IL_CAL_FKT_GETDATE,$this->timezone);
1125  $this->app->setEnd($end);
1126  }
1127  $this->loadNotificationRecipients();
1128  $this->loadRecurrenceSettings($a_as_milestone = false);
1129  }
$_POST['username']
Definition: cron.php:12
Class for single dates.
Date and time handling
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const IL_CAL_FKT_GETDATE
loadRecurrenceSettings($a_as_milestone=false)
load recurrence settings
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadNotificationRecipients()

ilCalendarAppointmentGUI::loadNotificationRecipients ( )
protected

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

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

Referenced by load().

1132  {
1133  $this->notification->setRecipients(array());
1134 
1135  foreach((array) $_POST['notu'] as $rcp)
1136  {
1137  $rcp = trim(ilUtil::stripSlashes($rcp));
1138  $usr_id = ilObjUser::_loginExists($rcp);
1139 
1140  if(strlen($rcp) == 0)
1141  {
1142  continue;
1143  }
1144 
1145  if($usr_id)
1146  {
1147  $this->notification->addRecipient(
1149  $usr_id
1150  );
1151  }
1152  else
1153  {
1154  $this->notification->addRecipient(
1156  0,
1157  $rcp
1158  );
1159  }
1160  }
1161  }
$_POST['username']
Definition: cron.php:12
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...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ 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 1169 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by load().

1170  {
1171  $this->rec->reset();
1172 
1173  switch($_POST['frequence'])
1174  {
1175  case IL_CAL_FREQ_DAILY:
1176  $this->rec->setFrequenceType($_POST['frequence']);
1177  $this->rec->setInterval((int) $_POST['count_DAILY']);
1178  break;
1179 
1180  case IL_CAL_FREQ_WEEKLY:
1181  $this->rec->setFrequenceType($_POST['frequence']);
1182  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1183  if(is_array($_POST['byday_WEEKLY']))
1184  {
1185  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
1186  }
1187  break;
1188 
1189  case IL_CAL_FREQ_MONTHLY:
1190  $this->rec->setFrequenceType($_POST['frequence']);
1191  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1192  switch((int) $_POST['subtype_MONTHLY'])
1193  {
1194  case 0:
1195  // nothing to do;
1196  break;
1197 
1198  case 1:
1199  switch((int) $_POST['monthly_byday_day'])
1200  {
1201  case 8:
1202  // Weekday
1203  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1204  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1205  break;
1206 
1207  case 9:
1208  // Day of month
1209  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1210  break;
1211 
1212  default:
1213  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
1214  break;
1215  }
1216  break;
1217 
1218  case 2:
1219  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1220  break;
1221  }
1222  break;
1223 
1224  case IL_CAL_FREQ_YEARLY:
1225  $this->rec->setFrequenceType($_POST['frequence']);
1226  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1227  switch((int) $_POST['subtype_YEARLY'])
1228  {
1229  case 0:
1230  // nothing to do;
1231  break;
1232 
1233  case 1:
1234  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1235  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
1236  break;
1237 
1238  case 2:
1239  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1240  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1241  break;
1242  }
1243  break;
1244  }
1245 
1246  // UNTIL
1247  switch((int) $_POST['until_type'])
1248  {
1249  case 1:
1250  $this->rec->setFrequenceUntilDate(null);
1251  // nothing to do
1252  break;
1253 
1254  case 2:
1255  $this->rec->setFrequenceUntilDate(null);
1256  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1257  break;
1258 
1259  case 3:
1260  $end_dt['year'] = (int) $_POST['until_end']['date']['y'];
1261  $end_dt['mon'] = (int) $_POST['until_end']['date']['m'];
1262  $end_dt['mday'] = (int) $_POST['until_end']['date']['d'];
1263 
1264  $this->rec->setFrequenceUntilCount(0);
1265  $this->rec->setFrequenceUntilDate(new ilDate($end_dt,IL_CAL_FKT_GETDATE,$this->timezone));
1266  break;
1267  }
1268 
1269  }
const IL_CAL_FREQ_MONTHLY
$_POST['username']
Definition: cron.php:12
Class for single dates.
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
const IL_CAL_FKT_GETDATE
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 1361 of file class.ilCalendarAppointmentGUI.php.

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

1362  {
1363  global $ilUser;
1364 
1365  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1366  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1367  $reg->register(
1368  $ilUser->getId(),
1369  new ilDateTime((int) $_REQUEST['dstart'],IL_CAL_UNIX),
1370  new ilDateTime((int) $_REQUEST['dend'],IL_CAL_UNIX)
1371  );
1372 
1373  ilUtil::sendSuccess($this->lng->txt('cal_reg_registered'),true);
1374  $this->ctrl->returnToParent($this);
1375  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ save()

ilCalendarAppointmentGUI::save (   $a_as_milestone = false)
protected

save appointment

protected

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

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

Referenced by saveMilestone().

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

References save().

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

◆ saveMilestoneResponsibleUsers()

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

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

References $_POST, and $ilCtrl.

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

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

save recurrence settings

protected

Parameters

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

References $_POST.

Referenced by save(), and update().

1279  {
1280  switch($_POST['frequence'])
1281  {
1282  case 'NONE':
1283  case '':
1284  // No recurrence => delete if there is an recurrence rule
1285  if($this->rec->getRecurrenceId())
1286  {
1287  $this->rec->delete();
1288  }
1289  break;
1290 
1291  default:
1292  if($this->rec->getRecurrenceId())
1293  {
1294  $this->rec->update();
1295  }
1296  else
1297  {
1298  $this->rec->save();
1299  }
1300  break;
1301  }
1302  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ showInfoScreen()

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

show info screen

protected

Returns

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

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

Referenced by edit().

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

References $tpl.

Referenced by editResponsibleUsers(), and save().

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

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

1412  {
1413  global $ilUser;
1414 
1415  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1416  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1417  $reg->unregister(
1418  $ilUser->getId(),
1419  new ilDateTime((int) $_REQUEST['dstart'],IL_CAL_UNIX),
1420  new ilDateTime((int) $_REQUEST['dend'],IL_CAL_UNIX)
1421  );
1422 
1423  ilUtil::sendSuccess($this->lng->txt('cal_reg_unregistered'),true);
1424  $this->ctrl->returnToParent($this);
1425  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ update()

ilCalendarAppointmentGUI::update ( )
protected

update

protected

Returns

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

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

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