ILIAS  release_4-4 Revision
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 380 of file class.ilCalendarAppointmentGUI.php.

References $tpl, and initForm().

Referenced by save().

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

References $tpl, and initForm().

Referenced by save().

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

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

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

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

619  {
620  // check for recurring entries
621  include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php';
623  if(!$rec)
624  {
625  return $this->edit();
626  }
627  // Show edit single/all appointments
628  $this->ctrl->saveParameter($this,array('seed','app_id','dt','idate'));
629 
630  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
631  $confirm = new ilConfirmationGUI();
632  $confirm->setFormAction($this->ctrl->getFormAction($this));
633  #$confirm->setHeaderText($this->lng->txt('cal_edit_app_sure'));
634  $confirm->setCancel($this->lng->txt('cancel'),'cancel');
635  $confirm->addItem('appointments[]',$this->app->getEntryId(),$this->app->getTitle());
636  $confirm->addButton($this->lng->txt('cal_edit_single'),'editSingle');
637  $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'),'edit');
638 
639  $GLOBALS['tpl']->setContent($confirm->getHTML());
640  }
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 1426 of file class.ilCalendarAppointmentGUI.php.

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

1427  {
1428  global $ilUser, $tpl;
1429 
1430  $entry = (int)$_GET['app_id'];
1431  $user = (int)$_GET['bkid'];
1432 
1433  $this->ctrl->saveParameter($this,'app_id');
1434 
1435  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1436  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1437  $entry = new ilCalendarEntry($entry);
1438 
1439  $form = $this->initFormConfirmBooking();
1440  $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()));
1441  $form->getItemByPostVar('title')->setValue($entry->getTitle()." (".ilObjUser::_lookupFullname($user).')');
1442 
1443  $tpl->setContent($form->getHTML());
1444  return true;
1445  }
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 1475 of file class.ilCalendarAppointmentGUI.php.

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

1476  {
1477  global $ilUser;
1478 
1479  $entry = (int) $_REQUEST['app_id'];
1480  $user = (int) $_REQUEST['bkid'];
1481 
1482  $form = $this->initFormConfirmBooking();
1483  if($form->checkInput())
1484  {
1485  // check if appointment is bookable
1486  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1487  $cal_entry = new ilCalendarEntry($entry);
1488 
1489  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1490  $booking = new ilBookingEntry($cal_entry->getContextId());
1491 
1492  if(!$booking->isAppointmentBookableForUser($entry, $GLOBALS['ilUser']->getId()))
1493  {
1494  ilUtil::sendFailure($this->lng->txt('cal_booking_failed_info'), true);
1495  $this->ctrl->returnToParent($this);
1496  }
1497 
1498  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1499  ilConsultationHourUtils::bookAppointment($ilUser->getId(), $entry);
1500 
1501  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1502  ilBookingEntry::writeBookingMessage($entry, $ilUser->getId(), $form->getInput('comment'));
1503  }
1504  ilUtil::sendSuccess($this->lng->txt('cal_booking_confirmed'),true);
1505  $this->ctrl->returnToParent($this);
1506  }
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 1617 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by cancelBooking(), and cancelConfirmed().

1618  {
1619  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1620  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1621  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1622  $assignment = $assignment->getFirstAssignment();
1623  return new ilCalendarCategory($assignment);
1624  }
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 1512 of file class.ilCalendarAppointmentGUI.php.

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

1513  {
1514  global $ilUser, $tpl;
1515 
1516  $entry = (int)$_GET['app_id'];
1517 
1518  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1519  $entry = new ilCalendarEntry($entry);
1520 
1521  $category = $this->calendarEntryToCategory($entry);
1522  if($category->getType() == ilCalendarCategory::TYPE_CH)
1523  {
1524  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1525  $booking = new ilBookingEntry($entry->getContextId());
1526  if(!$booking->hasBooked($entry->getEntryId()))
1527  {
1528  $this->ctrl->returnToParent($this);
1529  return false;
1530  }
1531 
1532  $entry_title = ' '.$entry->getTitle()." (".ilObjUser::_lookupFullname($booking->getObjId()).')';
1533  }
1534  else if($category->getType() == ilCalendarCategory::TYPE_BOOK)
1535  {
1536  $entry_title = ' '.$entry->getTitle();
1537  }
1538  else
1539  {
1540  $this->ctrl->returnToParent($this);
1541  return false;
1542  }
1543 
1544  $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1545 
1546  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1547  $conf = new ilConfirmationGUI;
1548  $conf->setFormAction($this->ctrl->getFormAction($this));
1549  $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
1550  $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
1551  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1552  $conf->addItem('app_id', $entry->getEntryId(), $title.' - '.$entry_title);
1553 
1554  $tpl->setContent($conf->getHTML());
1555  }
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 1561 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.

1562  {
1563  global $ilUser;
1564 
1565  $entry = (int)$_POST['app_id'];
1566  $user = (int)$_GET['bkid'];
1567 
1568  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1569  $entry = new ilCalendarEntry($entry);
1570 
1571  $category = $this->calendarEntryToCategory($entry);
1572  if($category->getType() == ilCalendarCategory::TYPE_CH)
1573  {
1574  // find cloned calendar entry in user calendar
1575  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1576  $GLOBALS['ilLog']->dump($entry->getStart());
1578  $ilUser->getId(),
1579  $entry->getContextId(),
1580  $entry->getStart(),
1582  false);
1583  $GLOBALS['ilLog']->dump($apps);
1584 
1585  // Fix for wrong, old entries
1586  foreach((array) $apps as $own_app)
1587  {
1588  $ref_entry = new ilCalendarEntry($own_app);
1589  $ref_entry->delete();
1590  }
1591 
1592  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1593  $booking = new ilBookingEntry($entry->getContextId());
1594  $booking->cancelBooking($entry->getEntryId());
1595 
1596  // do NOT delete original entry
1597  }
1598  else if($category->getType() == ilCalendarCategory::TYPE_BOOK)
1599  {
1600  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1601  $booking = new ilBookingReservation($entry->getContextId());
1603  $booking->update();
1604 
1605  $entry->delete();
1606  }
1607 
1608  ilUtil::sendSuccess($this->lng->txt('cal_cancel_booking_confirmed'),true);
1609  $this->ctrl->returnToParent($this);
1610  }
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 1327 of file class.ilCalendarAppointmentGUI.php.

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

1328  {
1329  global $tpl;
1330 
1331  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1333  new ilDateTime($_GET['dstart'],IL_CAL_UNIX),
1334  new ilDateTime($_GET['dend'],IL_CAL_UNIX)
1335  );
1336 
1337 
1338  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1339  $conf = new ilConfirmationGUI;
1340 
1341  $this->ctrl->setParameter($this,'dstart',(int) $_REQUEST['dstart']);
1342  $this->ctrl->setParameter($this,'dend',(int) $_REQUEST['dend']);
1343 
1344  $conf->setFormAction($this->ctrl->getFormAction($this));
1345  $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1346  $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1347  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1348  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle().' ('.$start.')');
1349 
1350  $tpl->setContent($conf->getHTML());
1351  }
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 1376 of file class.ilCalendarAppointmentGUI.php.

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

1377  {
1378  global $tpl;
1379 
1380 
1381  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1383  $dstart = new ilDateTime($_GET['dstart'],IL_CAL_UNIX),
1384  $dend = new ilDateTime($_GET['dend'],IL_CAL_UNIX)
1385  );
1386 
1387 
1388  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1389  $conf = new ilConfirmationGUI;
1390 
1391  $this->ctrl->setParameter($this,'dstart',(int) $_REQUEST['dstart']);
1392  $this->ctrl->setParameter($this,'dend',(int) $_REQUEST['dend']);
1393 
1394  $conf->setFormAction($this->ctrl->getFormAction($this));
1395  $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1396  $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1397  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1398  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle().' ('.$start.')');
1399 
1400  $tpl->setContent($conf->getHTML());
1401  }
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 1311 of file class.ilCalendarAppointmentGUI.php.

References $ilUser, $lng, ilCalendarCategory\DEFAULT_COLOR, and ilCalendarCategory\TYPE_USR.

Referenced by save(), and update().

1312  {
1313  global $ilUser,$lng;
1314 
1315  $cat = new ilCalendarCategory();
1316  $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1317  $cat->setType(ilCalendarCategory::TYPE_USR);
1318  $cat->setTitle($this->lng->txt('cal_default_calendar'));
1319  $cat->setObjId($ilUser->getId());
1320  return $cat->add();
1321  }
Stores calendar categories.
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ delete()

ilCalendarAppointmentGUI::delete ( )
protected

delete

protected

Parameters

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

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

930  {
931  foreach($_POST['appointments'] as $app_id)
932  {
933  $app = new ilCalendarEntry($app_id);
934  $app->delete();
935 
936  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
938 
939  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
941  }
942  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'),true);
943  $this->ctrl->returnToParent($this);
944  }
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 953 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by update().

954  {
955  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceExclusion.php');
956  $excl = new ilCalendarRecurrenceExclusion();
957  $excl->setEntryId($_REQUEST['app_id']);
958  $excl->setDate(new ilDate($_REQUEST['dt'], IL_CAL_UNIX));
959  $excl->save();
960 
961  if($a_return)
962  {
963  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'),true);
964  $this->ctrl->returnToParent($this);
965  }
966  }
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 535 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().

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

503  {
504  global $ilUser;
505 
506  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
507  $notification = new ilCalendarMailNotification();
508  $notification->setAppointmentId($this->app->getEntryId());
509 
510  foreach($this->notification->getRecipients() as $rcp)
511  {
512  switch($rcp['type'])
513  {
515  $notification->setSender(ANONYMOUS_USER_ID);
516  $notification->setRecipients(array($rcp['usr_id']));
517  $notification->setType(ilCalendarMailNotification::TYPE_USER);
518  break;
519 
521  $notification->setSender(ANONYMOUS_USER_ID);
522  $notification->setRecipients(array($rcp['email']));
523  $notification->setType(ilCalendarMailNotification::TYPE_USER_ANONYMOUS);
524  break;
525  }
526  $notification->send();
527  }
528  }
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 1630 of file class.ilCalendarAppointmentGUI.php.

References $_GET, $_REQUEST, $GLOBALS, and exit.

1631  {
1632  if(!isset($_GET['autoCompleteField']))
1633  {
1634  $a_fields = array('login','firstname','lastname','email');
1635  }
1636  else
1637  {
1638  $a_fields = array((string) $_GET['autoCompleteField']);
1639  }
1640 
1641  $GLOBALS['ilLog']->write(print_r($a_fields,true));
1642  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1643  $auto = new ilUserAutoComplete();
1644  $auto->setSearchFields($a_fields);
1645  $auto->enableFieldSearchableCheck(true);
1646  echo $auto->getList($_REQUEST['query']);
1647  exit();
1648  }
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 659 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().

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

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

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

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

646  {
647  $_REQUEST['rexl'] = 1;
648  $GLOBALS['ilCtrl']->setParameter($this,'rexcl',1);
649  $this->edit(true);
650  }
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 1028 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by __construct().

1029  {
1030  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
1031  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
1032  $this->app = new ilCalendarEntry($a_app_id);
1033 
1034  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
1035  $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
1036 
1037  if(!$a_app_id)
1038  {
1039  $start = clone $this->initialDate;
1040  $this->app->setStart($start);
1041 
1042  $seed_end = clone $this->initialDate;
1043  if($this->default_fulltime)
1044  {
1045  #$seed_end->increment(IL_CAL_DAY,1);
1046  }
1047  else
1048  {
1049  $seed_end->increment(IL_CAL_HOUR,1);
1050  }
1051  $this->app->setEnd($seed_end);
1052  $this->app->setFullday($this->default_fulltime);
1053 
1054  $this->rec = new ilCalendarRecurrence();
1055  }
1056  else
1057  {
1058  $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
1059  }
1060 
1061  }
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->setMinuteStepSize(5);
251  $dur->setShowDate(true);
252  $dur->setShowTime(true);
253  $dur->setStart($this->app->getStart());
254  $dur->setEnd($this->app->getEnd());
255  $this->form->addItem($dur);
256 
257  // recurrence
258  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
259  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
260  $rec->setRecurrence($this->rec);
261  $this->form->addItem($rec);
262 
263  // location
264  $where = new ilTextInputGUI($this->lng->txt('cal_where'),'location');
265  $where->setValue($this->app->getLocation());
266  $where->setMaxLength(128);
267  $where->setSize(32);
268  $this->form->addItem($where);
269  }
270  else
271  {
272  $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'),'event[start]');
273  $deadline->setDate($this->app->getStart());
274  $deadline->setShowTime(false);
275  $deadline->setMinuteStepSize(5);
276  $this->form->addItem($deadline);
277 
278  // completion
279  $completion_vals = array();
280  for($i = 0; $i <= 100; $i+=5)
281  {
282  $completion_vals[$i] = $i." %";
283  }
284  $compl = new ilSelectInputGUI($this->lng->txt('cal_task_completion'),
285  'completion');
286  $compl->setOptions($completion_vals);
287  $compl->setValue($this->app->getCompletion());
288  $this->form->addItem($compl);
289  }
290 
291  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
292  $desc->setValue($this->app->getDescription());
293  $desc->setRows(5);
294  $this->form->addItem($desc);
295 
296  if ($a_as_milestone && $a_mode == "edit" && $resp_info)
297  {
298  // users responsible
299  $users = $this->app->readResponsibleUsers();
300  $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'),
301  $users);
302  $delim = "";
303  foreach($users as $r)
304  {
305  $value.= $delim.$r["lastname"].", ".$r["firstname"]." [".$r["login"]."]";
306  $delim = "<br />";
307  }
308  if (count($users) > 0)
309  {
310  $resp->setValue($value);
311  }
312  else
313  {
314  $resp->setValue("-");
315  }
316 
317  $this->form->addItem($resp);
318  }
319 
320 
321  if(ilCalendarSettings::_getInstance()->isUserNotificationEnabled())
322  {
323  $notu = new ilTextWizardInputGUI($this->lng->txt('cal_user_notification'), 'notu');
324  $notu->setInfo($this->lng->txt('cal_user_notification_info'));
325  $notu->setSize(20);
326  $notu->setMaxLength(64);
327 
328  $values = array();
329  foreach($this->notification->getRecipients() as $rcp)
330  {
331  switch ($rcp['type'])
332  {
334  $values[] = ilObjUser::_lookupLogin($rcp['usr_id']);
335  break;
336 
338  $values[] = $rcp['email'];
339  break;
340  }
341  }
342  if(count($values))
343  $notu->setValues($values);
344  else
345  $notu->setValues(array(''));
346  $this->form->addItem($notu);
347  }
348 
349  // Notifications
350  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
351  if(ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars()))
352  {
353  $selected_cal = new ilCalendarCategory($selected_calendar);
354  $disabled = true;
355  if($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ)
356  {
357  if(ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp')
358  {
359  $disabled = false;
360  }
361  }
362 
363  $tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js');
364  $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'),'not');
365  $not->setInfo($this->lng->txt('cal_notification_info'));
366  $not->setValue(1);
367  $not->setChecked($this->app->isNotificationEnabled());
368  $not->setDisabled($disabled);
369  $this->form->addItem($not);
370  }
371  }
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.
global $ilUser
Definition: imgupload.php:15
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.
$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 1451 of file class.ilCalendarAppointmentGUI.php.

References ilTextAreaInputGUI\setRows().

Referenced by book(), and bookconfirmed().

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

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

Referenced by __construct().

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

References $seed.

Referenced by __construct().

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

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

init timezone

protected

Parameters

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

References $ilUser.

Referenced by __construct().

976  {
977  global $ilUser;
978 
979  $this->timezone = $ilUser->getTimeZone();
980  }
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 1070 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by save(), and update().

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  if ($a_as_milestone) // milestones are always fullday events
1084  {
1085  $this->app->setFullday(true);
1086  }
1087  else
1088  {
1089  $this->app->setFullday(isset($_POST['event']['fulltime']) ? true : false);
1090  }
1091 
1092  if($this->app->isFullday())
1093  {
1094  $start = new ilDate($_POST['event']['start']['date']['y'].'-'.$_POST['event']['start']['date']['m'].'-'.$_POST['event']['start']['date']['d'],
1095  IL_CAL_DATE);
1096  $this->app->setStart($start);
1097 
1098  $end = new ilDate($_POST['event']['end']['date']['y'].'-'.$_POST['event']['end']['date']['m'].'-'.$_POST['event']['end']['date']['d'],
1099  IL_CAL_DATE);
1100 
1101  if ($a_as_milestone)
1102  {
1103  // for milestones is end date = start date
1104  $this->app->setEnd($start);
1105  }
1106  else
1107  {
1108  $this->app->setEnd($end);
1109  }
1110  }
1111  else
1112  {
1113  $start_dt['year'] = (int) $_POST['event']['start']['date']['y'];
1114  $start_dt['mon'] = (int) $_POST['event']['start']['date']['m'];
1115  $start_dt['mday'] = (int) $_POST['event']['start']['date']['d'];
1116  $start_dt['hours'] = (int) $_POST['event']['start']['time']['h'];
1117  $start_dt['minutes'] = (int) $_POST['event']['start']['time']['m'];
1118  $start = new ilDateTime($start_dt,IL_CAL_FKT_GETDATE,$this->timezone);
1119  $this->app->setStart($start);
1120 
1121  $end_dt['year'] = (int) $_POST['event']['end']['date']['y'];
1122  $end_dt['mon'] = (int) $_POST['event']['end']['date']['m'];
1123  $end_dt['mday'] = (int) $_POST['event']['end']['date']['d'];
1124  $end_dt['hours'] = (int) $_POST['event']['end']['time']['h'];
1125  $end_dt['minutes'] = (int) $_POST['event']['end']['time']['m'];
1126  $end = new ilDateTime($end_dt,IL_CAL_FKT_GETDATE,$this->timezone);
1127  $this->app->setEnd($end);
1128  }
1129  $this->loadNotificationRecipients();
1130  $this->loadRecurrenceSettings($a_as_milestone = false);
1131  }
$_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 1133 of file class.ilCalendarAppointmentGUI.php.

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

Referenced by load().

1134  {
1135  $this->notification->setRecipients(array());
1136 
1137  foreach((array) $_POST['notu'] as $rcp)
1138  {
1139  $rcp = trim(ilUtil::stripSlashes($rcp));
1141 
1142  if(strlen($rcp) == 0)
1143  {
1144  continue;
1145  }
1146 
1147  if($usr_id)
1148  {
1149  $this->notification->addRecipient(
1151  $usr_id
1152  );
1153  }
1154  else
1155  {
1156  $this->notification->addRecipient(
1158  0,
1159  $rcp
1160  );
1161  }
1162  }
1163  }
$_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 1171 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().

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

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

1358  {
1359  global $ilUser;
1360 
1361  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1362  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1363  $reg->register(
1364  $ilUser->getId(),
1365  new ilDateTime((int) $_REQUEST['dstart'],IL_CAL_UNIX),
1366  new ilDateTime((int) $_REQUEST['dend'],IL_CAL_UNIX)
1367  );
1368 
1369  ilUtil::sendSuccess($this->lng->txt('cal_reg_registered'),true);
1370  $this->ctrl->returnToParent($this);
1371  }
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 425 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().

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

References save().

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

◆ saveMilestoneResponsibleUsers()

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

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

References $_POST, and $ilCtrl.

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

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

save recurrence settings

protected

Parameters

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

References $_POST.

Referenced by save(), and update().

1281  {
1282  switch($_POST['frequence'])
1283  {
1284  case 'NONE':
1285  // No recurrence => delete if there is an recurrence rule
1286  if($this->rec->getRecurrenceId())
1287  {
1288  $this->rec->delete();
1289  }
1290  break;
1291 
1292  default:
1293  if($this->rec->getRecurrenceId())
1294  {
1295  $this->rec->update();
1296  }
1297  else
1298  {
1299  $this->rec->save();
1300  }
1301  break;
1302  }
1303  }
$_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 735 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().

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

References $tpl.

Referenced by editResponsibleUsers(), and save().

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

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

1408  {
1409  global $ilUser;
1410 
1411  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1412  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1413  $reg->unregister(
1414  $ilUser->getId(),
1415  new ilDateTime((int) $_REQUEST['dstart'],IL_CAL_UNIX),
1416  new ilDateTime((int) $_REQUEST['dend'],IL_CAL_UNIX)
1417  );
1418 
1419  ilUtil::sendSuccess($this->lng->txt('cal_reg_unregistered'),true);
1420  $this->ctrl->returnToParent($this);
1421  }
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 823 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().

824  {
825  global $ilErr;
826 
827  $single_editing = ($_REQUEST['rexl'] ? true : false);
828 
829  $this->load($this->app->isMilestone());
830 
831  if($this->app->validate() and $this->notification->validate())
832  {
833  if(!(int) $_POST['calendar'])
834  {
835  $cat_id = $this->createDefaultCalendar();
836  }
837  else
838  {
839  $cat_id = (int) $_POST['calendar'];
840  }
841 
842  if($single_editing)
843  {
844  $this->getAppointment()->save();
845  $this->deleteExclude(false);
846 
847  $this->rec = new ilCalendarRecurrence();
848  $this->rec->setEntryId($this->getAppointment()->getEntryId());
849  }
850  else
851  {
852  $this->getAppointment()->update();
853  }
854  $this->notification->save();
855  $this->saveRecurrenceSettings();
856 
857  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
858  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
859  $GLOBALS['ilLog']->write($this->app->getEntryId());
860  $ass->deleteAssignments();
861  $ass->addAssignment($cat_id);
862 
863  // Send notifications
864  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
865  if(ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not'])
866  {
867  $this->distributeNotifications($cat_id,$this->app->getEntryId(),false);
868  }
869  if(ilCalendarSettings::_getInstance()->isUserNotificationEnabled())
870  {
872  }
873 
874  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
875  $this->ctrl->returnToParent($this);
876  }
877  else
878  {
879  ilUtil::sendFailure($ilErr->getMessage());
880  }
881 
882  $this->edit();
883 
884  }
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: