ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCalendarAppointmentGUI Class Reference

Administrate calendar appointments. More...

+ Collaboration diagram for ilCalendarAppointmentGUI:

Public Member Functions

 __construct (ilDate $seed, ilDate $initialDate, $a_appointment_id=0)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getAppointment ()
 Get current appointment. More...
 
 editResponsibleUsers ()
 Edit responsible users. More...
 
 showResponsibleUsersList ($a_grp_id)
 Show responsible uses of a milestone (default set is participants of group) More...
 
 saveMilestoneResponsibleUsers ()
 Save milestone responsibilites. More...
 
 confirmUnregister ()
 Confirmation screen to unregister calendar. More...
 
 book ()
 Confirmation screen for booking of consultation appointment. More...
 
 bookconfirmed ()
 Book consultation appointment, was confirmed. More...
 
 cancelBooking ()
 Confirmation screen to cancel consultation appointment or ressource booking depends on calendar category. More...
 
 cancelConfirmed ()
 Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar entry. More...
 

Protected Member Functions

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

Protected Attributes

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

Private Attributes

 $logger = null
 

Detailed Description

Administrate calendar appointments.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

public

Parameters
ilDateseed
Returns

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

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

39  {
40  global $ilCtrl,$lng;
41 
42  $this->lng = $lng;
43  $lng->loadLanguageModule('dateplaner');
44  $this->ctrl = $ilCtrl;
45 
46  $this->logger = $GLOBALS['DIC']->logger()->cal();
47 
48  $this->initTimeZone();
49  $this->initSeed($seed);
50  $this->initInitialDate($initialDate);
51  $this->initAppointment($a_appointment_id);
52  }
initAppointment($a_app_id=0)
init appointment
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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 ( ilPropertyFormGUI  $form = null)
protected

add new appointment

Parameters
\ilPropertyFormGUI$formprotected
Returns

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

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

Referenced by save().

333  {
334  global $tpl, $ilHelp;
335 
336  $ilHelp->setScreenIdComponent("cal");
337  $ilHelp->setScreenId("app");
338  $ilHelp->setSubScreenId("create");
339 
340  if (!$form instanceof ilPropertyFormGUI) {
341  $this->initForm('create');
342  }
343  $tpl->setContent($this->form->getHTML());
344  }
This class represents a property form user interface.
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 352 of file class.ilCalendarAppointmentGUI.php.

References $tpl, and initForm().

Referenced by save().

353  {
354  global $tpl, $ilHelp;
355 
356  $ilHelp->setScreenIdComponent("cal");
357  $ilHelp->setScreenId("app");
358  $ilHelp->setSubScreenId("create_milestone");
359 
360  $this->initForm('create', true);
361  $tpl->setContent($this->form->getHTML());
362  }
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 813 of file class.ilCalendarAppointmentGUI.php.

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

814  {
815  global $tpl;
816 
817  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
818 
819  $this->ctrl->saveParameter($this, array('seed','app_id','dt','idate'));
820 
821  $confirm = new ilConfirmationGUI();
822  $confirm->setFormAction($this->ctrl->getFormAction($this));
823  $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
824  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
825  $confirm->addItem('appointments[]', $this->app->getEntryId(), $this->app->getTitle());
826 
827  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
828  if (sizeof(ilCalendarRecurrences::_getRecurrences($_GET['app_id']))
829  && !$this->app->isMilestone()) {
830  $confirm->addButton($this->lng->txt('cal_delete_single'), 'deleteexclude');
831  $confirm->setConfirm($this->lng->txt('cal_delete_recurrences'), 'delete');
832  } else {
833  $confirm->setConfirm($this->lng->txt('delete'), 'delete');
834  }
835 
836  $tpl->setContent($confirm->getHTML());
837  }
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
$_GET["client_id"]
Create styles array
The data for the language used.
Confirmation screen class.
+ Here is the call graph for this function:

◆ askEdit()

ilCalendarAppointmentGUI::askEdit ( )
protected

Check edit single apppointment / edit all appointments for recurring appointments.

Todo:
works with milestones???

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

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

561  {
562  // check for recurring entries
563  include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php';
565  if (!$rec) {
566  return $this->edit(true);
567  }
568  // Show edit single/all appointments
569  $this->ctrl->saveParameter($this, array('seed','app_id','dt','idate'));
570 
571  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
572  $confirm = new ilConfirmationGUI();
573  $confirm->setFormAction($this->ctrl->getFormAction($this));
574  #$confirm->setHeaderText($this->lng->txt('cal_edit_app_sure'));
575  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
576  $confirm->addItem('appointments[]', $this->app->getEntryId(), $this->app->getTitle());
577  $confirm->addButton($this->lng->txt('cal_edit_single'), 'editSingle');
578  $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'), 'edit');
579 
580  $GLOBALS['tpl']->setContent($confirm->getHTML());
581  }
getAppointment()
Get current appointment.
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
Confirmation screen class.
+ Here is the call graph for this function:

◆ book()

ilCalendarAppointmentGUI::book ( )

Confirmation screen for booking of consultation appointment.

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

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

1295  {
1296  global $ilUser, $tpl;
1297 
1298  $entry = (int) $_GET['app_id'];
1299  $user = (int) $_GET['bkid'];
1300 
1301  $this->ctrl->saveParameter($this, 'app_id');
1302 
1303  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1304  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1305  $entry = new ilCalendarEntry($entry);
1306 
1307  $form = $this->initFormConfirmBooking();
1308  $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()));
1309  $form->getItemByPostVar('title')->setValue($entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')');
1310 
1311  $tpl->setContent($form->getHTML());
1312  return true;
1313  }
Model for a calendar entry.
$_GET["client_id"]
static _lookupFullname($a_user_id)
Lookup Full Name.
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
+ Here is the call graph for this function:

◆ bookconfirmed()

ilCalendarAppointmentGUI::bookconfirmed ( )

Book consultation appointment, was confirmed.

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

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

1344  {
1345  global $ilUser;
1346 
1347  $entry = (int) $_REQUEST['app_id'];
1348  $user = (int) $_REQUEST['bkid'];
1349 
1350  $form = $this->initFormConfirmBooking();
1351  if ($form->checkInput()) {
1352  // check if appointment is bookable
1353  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1354  $cal_entry = new ilCalendarEntry($entry);
1355 
1356  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1357  $booking = new ilBookingEntry($cal_entry->getContextId());
1358 
1359  if (!$booking->isAppointmentBookableForUser($entry, $GLOBALS['ilUser']->getId())) {
1360  ilUtil::sendFailure($this->lng->txt('cal_booking_failed_info'), true);
1361  $this->ctrl->returnToParent($this);
1362  }
1363 
1364  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1365  ilConsultationHourUtils::bookAppointment($ilUser->getId(), $entry);
1366 
1367  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1368  ilBookingEntry::writeBookingMessage($entry, $ilUser->getId(), $form->getInput('comment'));
1369  }
1370  ilUtil::sendSuccess($this->lng->txt('cal_booking_confirmed'), true);
1371  $this->ctrl->returnToParent($this);
1372  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Booking definition.
static writeBookingMessage($a_entry_id, $a_usr_id, $a_message)
Write booking message.
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.
+ Here is the call graph for this function:

◆ calendarEntryToCategory()

ilCalendarAppointmentGUI::calendarEntryToCategory ( ilCalendarEntry  $entry)
protected

Get category object of given calendar entry.

Parameters
ilCalendarEntry$entry
Returns
ilCalendarCategory

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

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

Referenced by cancelBooking(), and cancelConfirmed().

1475  {
1476  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1477  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1478  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1479  $assignment = $assignment->getFirstAssignment();
1480  return new ilCalendarCategory($assignment);
1481  }
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 100 of file class.ilCalendarAppointmentGUI.php.

101  {
102  $this->ctrl->returnToParent($this);
103  }

◆ cancelBooking()

ilCalendarAppointmentGUI::cancelBooking ( )

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

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

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

1379  {
1380  global $ilUser, $tpl;
1381 
1382  $entry = (int) $_GET['app_id'];
1383 
1384  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1385  $entry = new ilCalendarEntry($entry);
1386 
1387  $category = $this->calendarEntryToCategory($entry);
1388  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1389  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1390  $booking = new ilBookingEntry($entry->getContextId());
1391  if (!$booking->hasBooked($entry->getEntryId())) {
1392  $this->ctrl->returnToParent($this);
1393  return false;
1394  }
1395 
1396  $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
1397  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1398  $entry_title = ' ' . $entry->getTitle();
1399  } else {
1400  $this->ctrl->returnToParent($this);
1401  return false;
1402  }
1403 
1404  $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1405 
1406  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1407  $conf = new ilConfirmationGUI;
1408  $conf->setFormAction($this->ctrl->getFormAction($this));
1409  $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
1410  $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
1411  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1412  $conf->addItem('app_id', $entry->getEntryId(), $title . ' - ' . $entry_title);
1413 
1414  $tpl->setContent($conf->getHTML());
1415  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
static _lookupFullname($a_user_id)
Lookup Full Name.
Booking definition.
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
$ilUser
Definition: imgupload.php:18
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
Confirmation screen class.
+ Here is the call graph for this function:

◆ cancelConfirmed()

ilCalendarAppointmentGUI::cancelConfirmed ( )

Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar entry.

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

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

1422  {
1423  global $ilUser;
1424 
1425  $entry = (int) $_POST['app_id'];
1426  $user = (int) $_GET['bkid'];
1427 
1428  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1429  $entry = new ilCalendarEntry($entry);
1430 
1431  $category = $this->calendarEntryToCategory($entry);
1432  if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1433  // find cloned calendar entry in user calendar
1434  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1435  $GLOBALS['ilLog']->dump($entry->getStart());
1437  $ilUser->getId(),
1438  $entry->getContextId(),
1439  $entry->getStart(),
1441  false
1442  );
1443  $GLOBALS['ilLog']->dump($apps);
1444 
1445  // Fix for wrong, old entries
1446  foreach ((array) $apps as $own_app) {
1447  $ref_entry = new ilCalendarEntry($own_app);
1448  $ref_entry->delete();
1449  }
1450 
1451  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1452  $booking = new ilBookingEntry($entry->getContextId());
1453  $booking->cancelBooking($entry->getEntryId());
1454 
1455  // do NOT delete original entry
1456  } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1457  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1458  $booking = new ilBookingReservation($entry->getContextId());
1460  $booking->update();
1461 
1462  $entry->delete();
1463  }
1464 
1465  ilUtil::sendSuccess($this->lng->txt('cal_cancel_booking_confirmed'), true);
1466  $this->ctrl->returnToParent($this);
1467  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
setStatus($a_status)
Set booking status.
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.
Booking definition.
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
cancelBooking($a_entry_id, $a_user_id=false)
cancel calendar booking for user
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ confirmRegister()

ilCalendarAppointmentGUI::confirmRegister ( )
protected

Register to an appointment.

Returns

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

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

1196  {
1197  global $tpl;
1198 
1199  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1201  new ilDateTime($_GET['dstart'], IL_CAL_UNIX),
1202  new ilDateTime($_GET['dend'], IL_CAL_UNIX)
1203  );
1204 
1205 
1206  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1207  $conf = new ilConfirmationGUI;
1208 
1209  $this->ctrl->setParameter($this, 'dstart', (int) $_REQUEST['dstart']);
1210  $this->ctrl->setParameter($this, 'dend', (int) $_REQUEST['dend']);
1211 
1212  $conf->setFormAction($this->ctrl->getFormAction($this));
1213  $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1214  $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1215  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1216  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1217 
1218  $tpl->setContent($conf->getHTML());
1219  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
Date and time handling
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmUnregister()

ilCalendarAppointmentGUI::confirmUnregister ( )

Confirmation screen to unregister calendar.

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

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

1245  {
1246  global $tpl;
1247 
1248 
1249  $entry = new ilCalendarEntry((int) $_GET['app_id']);
1251  $dstart = new ilDateTime($_GET['dstart'], IL_CAL_UNIX),
1252  $dend = new ilDateTime($_GET['dend'], IL_CAL_UNIX)
1253  );
1254 
1255 
1256  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1257  $conf = new ilConfirmationGUI;
1258 
1259  $this->ctrl->setParameter($this, 'dstart', (int) $_REQUEST['dstart']);
1260  $this->ctrl->setParameter($this, 'dend', (int) $_REQUEST['dend']);
1261 
1262  $conf->setFormAction($this->ctrl->getFormAction($this));
1263  $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1264  $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1265  $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1266  $conf->addItem('app_id', $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1267 
1268  $tpl->setContent($conf->getHTML());
1269  }
Model for a calendar entry.
$_GET["client_id"]
setFormAction($a_form_action)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
Date and time handling
Confirmation screen class.
+ Here is the call graph for this function:

◆ createDefaultCalendar()

ilCalendarAppointmentGUI::createDefaultCalendar ( )
protected

Create a default calendar.

protected

Returns

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

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

Referenced by save(), and update().

1175  {
1176  global $ilUser,$lng;
1177 
1178  $cat = new ilCalendarCategory();
1179  $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1180  $cat->setType(ilCalendarCategory::TYPE_USR);
1181  $cat->setTitle($this->lng->txt('cal_default_calendar'));
1182  $cat->setObjId($ilUser->getId());
1183 
1184  // delete calendar cache
1185  include_once './Services/Calendar/classes/class.ilCalendarCache.php';
1186  ilCalendarCache::getInstance()->deleteUserEntries($ilUser->getId());
1187 
1188  return $cat->add();
1189  }
static getInstance()
get singleton instance
Stores calendar categories.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarAppointmentGUI::delete ( )
protected

delete

protected

Parameters

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

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

847  {
848  foreach ($_POST['appointments'] as $app_id) {
849  $app = new ilCalendarEntry($app_id);
850  $app->delete();
851 
852  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
854 
855  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
857  }
858  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
859  $this->ctrl->returnToParent($this);
860  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static deleteCalendarEntry($a_cal_id)
Delete notification for a calendar entry ilDB $ilDB.
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteExclude()

ilCalendarAppointmentGUI::deleteExclude (   $a_return = true)
protected

delete single item of recurrence list

protected

Parameters

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

References IL_CAL_UNIX, and ilUtil\sendSuccess().

Referenced by update().

870  {
871  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceExclusion.php');
872  $excl = new ilCalendarRecurrenceExclusion();
873  $excl->setEntryId($_REQUEST['app_id']);
874  $excl->setDate(new ilDate($_REQUEST['dt'], IL_CAL_UNIX));
875  $excl->save();
876 
877  if ($a_return) {
878  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
879  $this->ctrl->returnToParent($this);
880  }
881  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_UNIX
Class for single dates.
Stores exclusion dates for calendar recurrences.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ distributeNotifications()

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

Distribute mail notifications.

Returns

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

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

Referenced by save(), and update().

474  {
475  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
476  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
477 
478  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
479  $notification = new ilCalendarMailNotification();
480  $notification->setAppointmentId($app_id);
481 
482  switch ($cat_info['type']) {
484 
485  switch ($cat_info['obj_type']) {
486  case 'crs':
487  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
488  $ref_id = current($ref_ids);
489  $notification->setRefId($ref_id);
490  $notification->setType(
491  $a_new_appointment ?
494  );
495  break;
496 
497  case 'grp':
498  $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
499  $ref_id = current($ref_ids);
500  $notification->setRefId($ref_id);
501  $notification->setType(
502  $a_new_appointment ?
505  );
506  break;
507  }
508  break;
509  }
510 
511  $notification->send();
512  }
Distributes calendar mail notifications.
static _getAllReferences($a_id)
get all reference ids of object
static _getInstance($a_usr_id=0)
get singleton instance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ distributeUserNotifications()

ilCalendarAppointmentGUI::distributeUserNotifications ( )
protected

Send mail to selected users ilObjUser $ilUser.

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

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

Referenced by save(), and update().

443  {
444  global $ilUser;
445 
446  include_once './Services/Calendar/classes/class.ilCalendarMailNotification.php';
447  $notification = new ilCalendarMailNotification();
448  $notification->setAppointmentId($this->app->getEntryId());
449 
450  foreach ($this->notification->getRecipients() as $rcp) {
451  switch ($rcp['type']) {
453  $notification->setSender(ANONYMOUS_USER_ID);
454  $notification->setRecipients(array($rcp['usr_id']));
455  $notification->setType(ilCalendarMailNotification::TYPE_USER);
456  break;
457 
459  $notification->setSender(ANONYMOUS_USER_ID);
460  $notification->setRecipients(array($rcp['email']));
461  $notification->setType(ilCalendarMailNotification::TYPE_USER_ANONYMOUS);
462  break;
463  }
464  $notification->send();
465  }
466  }
Distributes calendar mail notifications.
notification()
Definition: notification.php:2
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUserAutoComplete()

ilCalendarAppointmentGUI::doUserAutoComplete ( )
protected

Do auto completion.

Returns
void

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

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

1488  {
1489  if (!isset($_GET['autoCompleteField'])) {
1490  $a_fields = array('login','firstname','lastname','email');
1491  } else {
1492  $a_fields = array((string) $_GET['autoCompleteField']);
1493  }
1494 
1495  $GLOBALS['ilLog']->write(print_r($a_fields, true));
1496  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1497  $auto = new ilUserAutoComplete();
1498  $auto->setSearchFields($a_fields);
1499  $auto->enableFieldSearchableCheck(true);
1500  $auto->setMoreLinkAvailable(true);
1501 
1502  if (($_REQUEST['fetchall'])) {
1503  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1504  }
1505 
1506  echo $auto->getList($_REQUEST['query']);
1507  exit();
1508  }
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Auto completion class for user lists.
Create styles array
The data for the language used.

◆ edit()

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

edit appointment

protected

Parameters
boolsingel appointment

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

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

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

602  {
603  global $tpl,$ilUser,$ilErr, $ilHelp;
604 
605  $ilHelp->setScreenIdComponent("cal");
606  $ilHelp->setScreenId("app");
607  if ($this->app->isMilestone()) {
608  $ilHelp->setSubScreenId("edit_milestone");
609  } else {
610  $ilHelp->setSubScreenId("edit");
611  }
612 
613  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
614  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
615  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
616 
617  $GLOBALS['ilCtrl']->saveParameter($this, array('seed','app_id','dt','idate'));
618 
619  if ($_REQUEST['rexl']) {
620  $GLOBALS['ilCtrl']->setParameter($this, 'rexl', 1);
621 
622  // Calculate new appointment time
623  $duration = $this->getAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->getAppointment()->getStart()->get(IL_CAL_UNIX);
624  include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
625  $calc = new ilCalendarRecurrenceCalculator($this->getAppointment(), $this->rec);
626 
627  $current_date = new ilDateTime($_REQUEST['dt'], IL_CAL_UNIX);
628 
629  $yesterday = clone $current_date;
630  $yesterday->increment(IL_CAL_DAY, -1);
631  $tomorrow = clone $current_date;
632  $tomorrow->increment(IL_CAL_DAY, 1);
633 
634 
635  foreach ($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry) {
636  if (ilDateTime::_equals($current_date, $date_entry, IL_CAL_DAY)) {
637  $this->getAppointment()->setStart(new ilDateTime($date_entry->get(IL_CAL_UNIX), IL_CAL_UNIX));
638  $this->getAppointment()->setEnd(new ilDateTime($date_entry->get(IL_CAL_UNIX) + $duration, IL_CAL_UNIX));
639  break;
640  }
641  }
642 
643  // Finally reset recurrence
644  $this->rec = new ilCalendarRecurrence();
645  }
646 
647  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
648  $cats = ilCalendarCategories::_getInstance($ilUser->getId());
649 
650  if (!$cats->isVisible($cat_id)) {
651  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
652  return false;
653  }
654  if (!$cats->isEditable($cat_id) or $this->app->isAutoGenerated()) {
655  $this->showInfoScreen();
656  return true;
657  }
658  if (!$form instanceof ilPropertyFormGUI) {
659  $this->initForm('edit', $this->app->isMilestone(), $a_edit_single_app);
660  }
661  $tpl->setContent($this->form->getHTML());
662  }
getAppointment()
Get current appointment.
global $ilErr
Definition: raiseError.php:16
static _lookupCategory($a_cal_id)
Lookup category id.
This class represents a property form user interface.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const IL_CAL_UNIX
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
Calculates an ilDateList for a given calendar entry and recurrence rule.
Date and time handling
$ilUser
Definition: imgupload.php:18
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
static _getInstance($a_usr_id=0)
get singleton instance
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editResponsibleUsers()

ilCalendarAppointmentGUI::editResponsibleUsers ( )

Edit responsible users.

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

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

518  {
519  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
520  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
521  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
522  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
523 
524  $this->showResponsibleUsersList($cat_info['obj_id']);
525  }
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 586 of file class.ilCalendarAppointmentGUI.php.

References $GLOBALS, and edit().

587  {
588  $_REQUEST['rexl'] = 1;
589  $GLOBALS['ilCtrl']->setParameter($this, 'rexcl', 1);
590  $this->edit(true);
591  }
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarAppointmentGUI::executeCommand ( )

Execute command.

public

Parameters

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

References $ilSetting, $ilUser, and $tpl.

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

◆ getAppointment()

ilCalendarAppointmentGUI::getAppointment ( )

Get current appointment.

Returns
ilCalendarEntry

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

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

Referenced by __construct().

938  {
939  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
940  include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
941  $this->app = new ilCalendarEntry($a_app_id);
942 
943  include_once './Services/Calendar/classes/class.ilCalendarUserNotification.php';
944  $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
945 
946  if (!$a_app_id) {
947  $start = clone $this->initialDate;
948  $this->app->setStart($start);
949 
950  $seed_end = clone $this->initialDate;
951  if ($this->default_fulltime) {
952  #$seed_end->increment(IL_CAL_DAY,1);
953  } else {
954  $seed_end->increment(IL_CAL_HOUR, 1);
955  }
956  $this->app->setEnd($seed_end);
957  $this->app->setFullday($this->default_fulltime);
958 
959  $this->rec = new ilCalendarRecurrence();
960  } else {
961  $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
962  }
963  }
Model for a calendar entry.
const IL_CAL_HOUR
static _getFirstRecurrence($a_cal_id)
get first recurrence
notification()
Definition: notification.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

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

init form

protected

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

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

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

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

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

◆ initFormConfirmBooking()

ilCalendarAppointmentGUI::initFormConfirmBooking ( )
protected
Returns
ilPropertyFormGUI

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

References $form, $message, and $title.

Referenced by book(), and bookconfirmed().

1320  {
1321  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1322  $form = new ilPropertyFormGUI();
1323  $form->setFormAction($this->ctrl->getFormAction($this));
1324  $form->addCommandButton('bookconfirmed', $this->lng->txt('cal_confirm_booking'));
1325  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1326 
1327  $date = new ilNonEditableValueGUI($this->lng->txt('appointment'), 'date');
1328  $form->addItem($date);
1329 
1330  $title = new ilNonEditableValueGUI($this->lng->txt('title'), 'title');
1331  $form->addItem($title);
1332 
1333  $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1334  $message->setRows(5);
1335  $form->addItem($message);
1336 
1337  return $form;
1338  }
This class represents a property form user interface.
catch(Exception $e) $message
if(isset($_POST['submit'])) $form
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
+ Here is the caller graph for this function:

◆ initInitialDate()

ilCalendarAppointmentGUI::initInitialDate ( ilDate  $initialDate)
protected

init initial date

Parameters
ilDate$initialDate

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

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

Referenced by __construct().

902  {
903  if (!isset($_GET['hour'])) {
904  $this->initialDate = clone $initialDate;
905  $this->default_fulltime = true;
906  } else {
907  if ((int) $_GET['hour'] < 10) {
908  $time = '0' . (int) $_GET['hour'] . ':00:00';
909  } else {
910  $time = (int) $_GET['hour'] . ':00:00';
911  }
912  $this->initialDate = new ilDateTime($initialDate->get(IL_CAL_DATE) . ' ' . $time, IL_CAL_DATETIME, $this->timezone);
913  $this->default_fulltime = false;
914  }
915  }
const IL_CAL_DATETIME
$_GET["client_id"]
get($a_format, $a_format_str='', $a_tz='')
get formatted date
$time
Definition: cron.php:21
Date and time handling
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSeed()

ilCalendarAppointmentGUI::initSeed ( ilDate  $seed)
protected

init seed

protected

Parameters

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

References $seed.

Referenced by __construct().

925  {
926  $this->seed = clone $seed;
927  $this->default_fulltime = true;
928  }
+ Here is the caller graph for this function:

◆ initTimeZone()

ilCalendarAppointmentGUI::initTimeZone ( )
protected

init timezone

protected

Parameters

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

References $ilUser, and timezone.

Referenced by __construct().

891  {
892  global $ilUser;
893 
894  $this->timezone = $ilUser->getTimeZone();
895  }
Set timezone
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ load()

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

load post

protected

Parameters

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

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

Referenced by save(), and update().

973  {
974  // needed for date handling
975  $this->initForm($a_mode, $a_as_milestone);
976  $this->form->checkInput();
977 
978  if ($a_as_milestone) {
979  $this->app->setMilestone(true);
980  $this->app->setCompletion(ilUtil::stripSlashes($_POST['completion']));
981  }
982 
983  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
984  $this->app->setLocation(ilUtil::stripSlashes($_POST['location']));
985  $this->app->setDescription(ilUtil::stripSlashes($_POST['description']));
986  $this->app->setTitle(ilUtil::stripSlashes($_POST['title']));
987  $this->app->enableNotification((int) $_POST['not']);
988 
989  if ($a_as_milestone) { // milestones are always fullday events
990  $start = $this->form->getItemByPostVar('event_start');
991  $start = $start->getDate();
992 
993  $this->app->setFullday(true);
994 
995  // for milestones is end date = start date
996  $this->app->setStart($start);
997  $this->app->setEnd($start);
998  } else {
999  $period = $this->form->getItemByPostVar('event');
1000  $start = $period->getStart();
1001  $end = $period->getEnd();
1002 
1003  $this->app->setFullday($start instanceof ilDate);
1004  $this->app->setStart($start);
1005  $this->app->setEnd($end);
1006  }
1007 
1008  $this->loadNotificationRecipients();
1009  $this->loadRecurrenceSettings($a_as_milestone = false);
1010  }
$end
Definition: saml1-acs.php:18
Class for single dates.
initForm($a_mode, $a_as_milestone=false, $a_edit_single_app=false)
init form
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
loadRecurrenceSettings($a_as_milestone=false)
load recurrence settings
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadNotificationRecipients()

ilCalendarAppointmentGUI::loadNotificationRecipients ( )
protected

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

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

Referenced by load().

1013  {
1014  $this->notification->setRecipients(array());
1015 
1016  foreach ((array) $_POST['notu'] as $rcp) {
1017  $rcp = trim(ilUtil::stripSlashes($rcp));
1018  $usr_id = ilObjUser::_loginExists($rcp);
1019 
1020  if (strlen($rcp) == 0) {
1021  continue;
1022  }
1023 
1024  if ($usr_id) {
1025  $this->notification->addRecipient(
1027  $usr_id
1028  );
1029  } else {
1030  $this->notification->addRecipient(
1032  0,
1033  $rcp
1034  );
1035  }
1036  }
1037  }
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
notification()
Definition: notification.php:2
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRecurrenceSettings()

ilCalendarAppointmentGUI::loadRecurrenceSettings (   $a_as_milestone = false)
protected

load recurrence settings

protected

Returns

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

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

Referenced by load().

1046  {
1047  $this->rec->reset();
1048 
1049  switch ($_POST['frequence']) {
1050  case IL_CAL_FREQ_DAILY:
1051  $this->rec->setFrequenceType($_POST['frequence']);
1052  $this->rec->setInterval((int) $_POST['count_DAILY']);
1053  break;
1054 
1055  case IL_CAL_FREQ_WEEKLY:
1056  $this->rec->setFrequenceType($_POST['frequence']);
1057  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1058  if (is_array($_POST['byday_WEEKLY'])) {
1059  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $_POST['byday_WEEKLY'])));
1060  }
1061  break;
1062 
1063  case IL_CAL_FREQ_MONTHLY:
1064  $this->rec->setFrequenceType($_POST['frequence']);
1065  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1066  switch ((int) $_POST['subtype_MONTHLY']) {
1067  case 0:
1068  // nothing to do;
1069  break;
1070 
1071  case 1:
1072  switch ((int) $_POST['monthly_byday_day']) {
1073  case 8:
1074  // Weekday
1075  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1076  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1077  break;
1078 
1079  case 9:
1080  // Day of month
1081  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1082  break;
1083 
1084  default:
1085  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'] . $_POST['monthly_byday_day']);
1086  break;
1087  }
1088  break;
1089 
1090  case 2:
1091  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1092  break;
1093  }
1094  break;
1095 
1096  case IL_CAL_FREQ_YEARLY:
1097  $this->rec->setFrequenceType($_POST['frequence']);
1098  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1099  switch ((int) $_POST['subtype_YEARLY']) {
1100  case 0:
1101  // nothing to do;
1102  break;
1103 
1104  case 1:
1105  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1106  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'] . $_POST['yearly_byday']);
1107  break;
1108 
1109  case 2:
1110  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1111  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1112  break;
1113  }
1114  break;
1115  }
1116 
1117  // UNTIL
1118  switch ((int) $_POST['until_type']) {
1119  case 1:
1120  $this->rec->setFrequenceUntilDate(null);
1121  // nothing to do
1122  break;
1123 
1124  case 2:
1125  $this->rec->setFrequenceUntilDate(null);
1126  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1127  break;
1128 
1129  case 3:
1130  $dt = new ilDateTimeInputGUI('', 'until_end');
1131  $dt->setRequired(true);
1132  if ($dt->checkInput()) {
1133  $this->rec->setFrequenceUntilCount(0);
1134  $this->rec->setFrequenceUntilDate($dt->getDate());
1135  }
1136  break;
1137  }
1138  }
const IL_CAL_FREQ_MONTHLY
This class represents a date/time property in a property form.
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
const IL_CAL_FREQ_YEARLY
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
const IL_CAL_FREQ_WEEKLY
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ register()

ilCalendarAppointmentGUI::register ( )
protected

Register.

Returns

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

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

1226  {
1227  global $ilUser;
1228 
1229  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1230  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1231  $reg->register(
1232  $ilUser->getId(),
1233  new ilDateTime((int) $_REQUEST['dstart'], IL_CAL_UNIX),
1234  new ilDateTime((int) $_REQUEST['dend'], IL_CAL_UNIX)
1235  );
1236 
1237  ilUtil::sendSuccess($this->lng->txt('cal_reg_registered'), true);
1238  $this->ctrl->returnToParent($this);
1239  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ save()

ilCalendarAppointmentGUI::save (   $a_as_milestone = false)
protected

save appointment

protected

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

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

Referenced by saveMilestone().

380  {
381  global $ilErr;
382 
383  $this->load('create', $a_as_milestone);
384 
385  if ($this->app->validate() and $this->notification->validate()) {
386  if (!(int) $_POST['calendar']) {
387  $cat_id = $this->createDefaultCalendar();
388  } else {
389  $cat_id = (int) $_POST['calendar'];
390  }
391 
392  $this->app->save();
393  $this->notification->setEntryId($this->app->getEntryId());
394  $this->notification->save();
395  $this->rec->setEntryId($this->app->getEntryId());
396  $this->saveRecurrenceSettings();
397 
398  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
399  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
400  $ass->addAssignment($cat_id);
401 
402  // Send notifications
403  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
404  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not']) {
405  $this->distributeNotifications($cat_id, $this->app->getEntryId(), true);
406  }
407  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
409  }
410 
411  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
412  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
413  $type = ilObject::_lookupType($cat_info['obj_id']);
414 
415  if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
416  && ($type == "grp" || $type == "crs")) {
417  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone_resp_q'), true);
418  return $this->showResponsibleUsersList($cat_info['obj_id']);
419  } elseif ($a_as_milestone) {
420  ilUtil::sendSuccess($this->lng->txt('cal_created_milestone'), true);
421  $this->ctrl->returnToParent($this);
422  } else {
423  ilUtil::sendSuccess($this->lng->txt('cal_created_appointment'), true);
424  $this->ctrl->returnToParent($this);
425  }
426  } else {
427  $this->form->setValuesByPost();
428  ilUtil::sendFailure($ilErr->getMessage());
429  return $this->add($this->form);
430  }
431  if ($a_as_milestone) {
432  $this->addMilestone();
433  } else {
434  $this->add();
435  }
436  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
static _getInstance()
get singleton instance
$type
distributeUserNotifications()
Send mail to selected users ilObjUser $ilUser.
notification()
Definition: notification.php:2
static _getInstance($a_usr_id=0)
get singleton instance
distributeNotifications($a_cat_id, $app_id, $a_new_appointment=true)
Distribute mail notifications.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
load($a_mode, $a_as_milestone=false)
load post
add(ilPropertyFormGUI $form=null)
add new appointment
saveRecurrenceSettings()
save recurrence settings
createDefaultCalendar()
Create a default calendar.
$_POST["username"]
showResponsibleUsersList($a_grp_id)
Show responsible uses of a milestone (default set is participants of group)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveMilestone()

ilCalendarAppointmentGUI::saveMilestone ( )
protected

save milestone

protected

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

References save().

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

◆ saveMilestoneResponsibleUsers()

ilCalendarAppointmentGUI::saveMilestoneResponsibleUsers ( )

Save milestone responsibilites.

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

References $_POST, and $ilCtrl.

549  {
550  global $ilCtrl;
551 
552  $this->app->writeResponsibleUsers($_POST["user_id"]);
553  $ilCtrl->returnToParent($this);
554  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ saveRecurrenceSettings()

ilCalendarAppointmentGUI::saveRecurrenceSettings ( )
protected

save recurrence settings

protected

Parameters

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

References $_POST.

Referenced by save(), and update().

1148  {
1149  switch ($_POST['frequence']) {
1150  case 'NONE':
1151  case '':
1152  // No recurrence => delete if there is an recurrence rule
1153  if ($this->rec->getRecurrenceId()) {
1154  $this->rec->delete();
1155  }
1156  break;
1157 
1158  default:
1159  if ($this->rec->getRecurrenceId()) {
1160  $this->rec->update();
1161  } else {
1162  $this->rec->save();
1163  }
1164  break;
1165  }
1166  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ showInfoScreen()

ilCalendarAppointmentGUI::showInfoScreen ( )
protected

show info screen

protected

Returns

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

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

Referenced by edit().

671  {
672  global $tpl,$ilUser;
673 
674  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
675  $info = new ilInfoScreenGUI($this);
676  $info->setFormAction($this->ctrl->getFormAction($this));
677 
678  if ($this->app->isMilestone()) {
679  $info->addSection($this->lng->txt('cal_ms_details'));
680  } else {
681  $info->addSection($this->lng->txt('cal_details'));
682  }
683 
684  // Appointment
685  $info->addProperty(
686  $this->lng->txt('appointment'),
688  $this->app->getStart(),
689  $this->app->getEnd()
690  )
691  );
692  $info->addProperty($this->lng->txt('title'), $this->app->getPresentationTitle());
693 
694  // Description
695  if (strlen($desc = $this->app->getDescription())) {
696  $info->addProperty($this->lng->txt('description'), $desc);
697  }
698 
699  // Location
700  if (strlen($loc = $this->app->getLocation())) {
701  $info->addProperty($this->lng->txt('cal_where'), $loc);
702  }
703 
704  // completion
705  if ($this->app->isMilestone() && $this->app->getCompletion() > 0) {
706  $info->addProperty(
707  $this->lng->txt('cal_task_completion'),
708  $this->app->getCompletion() . " %"
709  );
710  }
711 
712  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
713  $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
714  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
715  $type = ilObject::_lookupType($cat_info['obj_id']);
716  if ($this->app->isMilestone() && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ
717  && ($type == "grp" || $type == "crs")) {
718  // users responsible
719  $users = $this->app->readResponsibleUsers();
720  $delim = "";
721  foreach ($users as $r) {
722  $value.= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
723  $delim = "<br />";
724  }
725  if (count($users) > 0) {
726  $info->addProperty(
727  $this->lng->txt('cal_responsible'),
728  $value
729  );
730  }
731  }
732 
733  $category = new ilCalendarCategory($cat_id);
734 
735  if ($category->getType() == ilCalendarCategory::TYPE_OBJ) {
736  $info->addSection($this->lng->txt('additional_info'));
737 
738  $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
739  $refs = ilObject::_getAllReferences($cat_info['obj_id']);
740 
741  include_once('./Services/Link/classes/class.ilLink.php');
742  $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($cat_info['obj_id']), true);
743  $info->addProperty($this->lng->txt('perma_link'), '<a class="small" href="' . $href . '" target="_top">' . $href . '</a>');
744  }
745 
746  $tpl->setContent($info->getHTML());
747  }
static _lookupCategory($a_cal_id)
Lookup category id.
Class ilInfoScreenGUI.
$type
Stores calendar categories.
static _getAllReferences($a_id)
get all reference ids of object
$r
Definition: example_031.php:79
$ilUser
Definition: imgupload.php:18
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupType($a_id, $a_reference=false)
lookup object type
$users
Definition: authpage.php:44
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$info
Definition: index.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showResponsibleUsersList()

ilCalendarAppointmentGUI::showResponsibleUsersList (   $a_grp_id)

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

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

References $tpl.

Referenced by editResponsibleUsers(), and save().

532  {
533  global $tpl;
534 
535  include_once("./Services/Calendar/classes/class.ilMilestoneResponsiblesTableGUI.php");
536  $table_gui = new ilMilestoneResponsiblesTableGUI(
537  $this,
538  "",
539  $a_grp_id,
540  $this->app->getEntryId()
541  );
542  $tpl->setContent($table_gui->getHTML());
543  }
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 1275 of file class.ilCalendarAppointmentGUI.php.

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

1276  {
1277  global $ilUser;
1278 
1279  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
1280  $reg = new ilCalendarRegistration((int) $_POST['app_id']);
1281  $reg->unregister(
1282  $ilUser->getId(),
1283  new ilDateTime((int) $_REQUEST['dstart'], IL_CAL_UNIX),
1284  new ilDateTime((int) $_REQUEST['dend'], IL_CAL_UNIX)
1285  );
1286 
1287  ilUtil::sendSuccess($this->lng->txt('cal_reg_unregistered'), true);
1288  $this->ctrl->returnToParent($this);
1289  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const IL_CAL_UNIX
registration for calendar appointments
Date and time handling
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ update()

ilCalendarAppointmentGUI::update ( )
protected

update

protected

Returns

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

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

756  {
757  global $ilErr;
758 
759  $single_editing = ($_REQUEST['rexl'] ? true : false);
760 
761  $this->load('edit', $this->app->isMilestone());
762 
763  if ($this->app->validate() and $this->notification->validate()) {
764  if (!(int) $_POST['calendar']) {
765  $cat_id = $this->createDefaultCalendar();
766  } else {
767  $cat_id = (int) $_POST['calendar'];
768  }
769 
770  if ($single_editing) {
771  $this->getAppointment()->save();
772  $this->deleteExclude(false);
773 
774  $this->rec = new ilCalendarRecurrence();
775  $this->rec->setEntryId($this->getAppointment()->getEntryId());
776  } else {
777  $this->getAppointment()->update();
778  }
779  $this->notification->save();
780  $this->saveRecurrenceSettings();
781  //var_dump($cat_id);
782  //var_dump($_POST); exit;
783  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
784  $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
785  $GLOBALS['ilLog']->write($this->app->getEntryId());
786  $ass->deleteAssignments();
787  $ass->addAssignment($cat_id);
788 
789  // Send notifications
790  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
791  if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not']) {
792  $this->distributeNotifications($cat_id, $this->app->getEntryId(), false);
793  }
794  if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
796  }
797 
798  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
799  $this->ctrl->returnToParent($this);
800  } else {
801  $this->form->setValuesByPost();
802  ilUtil::sendFailure($ilErr->getMessage());
803  }
804  $this->edit(false, $this->form);
805  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getAppointment()
Get current appointment.
global $ilErr
Definition: raiseError.php:16
static _getInstance()
get singleton instance
edit($a_edit_single_app=false, ilPropertyFormGUI $form=null)
edit appointment
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
deleteExclude($a_return=true)
delete single item of recurrence list
distributeUserNotifications()
Send mail to selected users ilObjUser $ilUser.
notification()
Definition: notification.php:2
distributeNotifications($a_cat_id, $app_id, $a_new_appointment=true)
Distribute mail notifications.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
load($a_mode, $a_as_milestone=false)
load post
saveRecurrenceSettings()
save recurrence settings
createDefaultCalendar()
Create a default calendar.
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $app

ilCalendarAppointmentGUI::$app = null
protected

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

Referenced by delete(), and getAppointment().

◆ $ctrl

ilCalendarAppointmentGUI::$ctrl
protected

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

◆ $default_fulltime

ilCalendarAppointmentGUI::$default_fulltime = true
protected

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

◆ $initialDate

ilCalendarAppointmentGUI::$initialDate = null
protected

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

Referenced by initAppointment(), and initInitialDate().

◆ $lng

ilCalendarAppointmentGUI::$lng
protected

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

Referenced by __construct(), and createDefaultCalendar().

◆ $logger

ilCalendarAppointmentGUI::$logger = null
private

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

◆ $rec

ilCalendarAppointmentGUI::$rec = null
protected

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

Referenced by askEdit(), and initForm().

◆ $seed

ilCalendarAppointmentGUI::$seed = null
protected

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

Referenced by initSeed().

◆ $timezone

ilCalendarAppointmentGUI::$timezone = null
protected

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

Referenced by initInitialDate().

◆ $tpl


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