33 include_once(
'./Services/Calendar/classes/class.ilTimeZone.php');
34 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
62 $lng->loadLanguageModule(
'dateplaner');
82 $next_class = $this->ctrl->getNextClass($this);
87 $cmd = $this->ctrl->getCmd(
"add");
103 $this->ctrl->returnToParent($this);
113 protected function initForm($a_mode, $a_as_milestone =
false)
117 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
118 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php');
119 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
120 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
121 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
125 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
131 $this->ctrl->saveParameter($this,array(
'seed',
'idate'));
132 $this->form->setFormAction($this->ctrl->getFormAction($this));
135 $this->form->setTitle($this->lng->txt(
'cal_new_ms'));
136 $this->form->addCommandButton(
'saveMilestone',$this->lng->txt(
'cal_add_milestone'));
137 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
141 $this->form->setTitle($this->lng->txt(
'cal_new_app'));
142 $this->form->addCommandButton(
'save',$this->lng->txt(
'cal_add_appointment'));
143 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
150 $this->form->setTitle($this->lng->txt(
'cal_edit_milestone'));
154 $this->form->setTitle($this->lng->txt(
'cal_edit_appointment'));
156 $this->ctrl->saveParameter($this,array(
'seed',
'app_id',
'idate'));
157 $this->form->setFormAction($this->ctrl->getFormAction($this));
161 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
165 && ($type ==
"grp" || $type ==
"crs"))
168 $this->form->addCommandButton(
'editResponsibleUsers',$this->lng->txt(
'cal_change_responsible_users'));
170 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
172 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
177 $title->setValue($this->app->getTitle());
178 $title->setRequired(
true);
179 $title->setMaxLength(128);
181 $this->form->addItem(
$title);
184 $calendar =
new ilSelectInputGUI($this->lng->txt(
'cal_category_selection'),
'calendar');
188 $selected_calendar = (int) $_POST[
'calendar'];
190 else if(
$_GET[
'category_id'])
192 $calendar->setValue((
int)
$_GET[
'category_id']);
193 $selected_calendar = (int) $_GET[
'category_id'];
195 elseif($a_mode ==
'edit')
199 $calendar->setValue($cat);
200 $selected_calendar = $cat;
202 elseif(isset(
$_GET[
'ref_id']))
204 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
209 $calendar->setRequired(
true);
211 $calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
213 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
216 $notification_cals = $cats->getNotificationCalendars();
217 $notification_cals = count($notification_cals) ? implode(
',',$notification_cals) :
'';
218 $calendar->addCustomAttribute(
"onchange=\"ilToggleNotification(new Array(".$notification_cals.
"));\"");
220 $this->form->addItem($calendar);
222 if (!$a_as_milestone)
224 include_once
'./Services/Form/classes/class.ilDateDurationInputGUI.php';
225 $tpl->addJavaScript(
'./Services/Form/js/date_duration.js');
228 $dur->setEndText($this->lng->txt(
'cal_end'));
229 $dur->enableToggleFullTime(
230 $this->lng->txt(
'cal_fullday_title'),
231 $this->app->isFullday() ?
true : false
233 $dur->setMinuteStepSize(5);
234 $dur->setShowDate(
true);
235 $dur->setShowTime(
true);
236 $dur->setStart($this->app->getStart());
237 $dur->setEnd($this->app->getEnd());
238 $this->form->addItem($dur);
241 include_once(
'./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
243 $rec->setRecurrence($this->rec);
244 $this->form->addItem(
$rec);
247 $where =
new ilTextInputGUI($this->lng->txt(
'cal_where'),
'location');
248 $where->
setValue($this->app->getLocation());
249 $where->setMaxLength(128);
251 $this->form->addItem($where);
256 $deadline->
setDate($this->app->getStart());
257 $deadline->setShowTime(
false);
258 $deadline->setMinuteStepSize(5);
259 $this->form->addItem($deadline);
262 $completion_vals = array();
263 for($i = 0; $i <= 100; $i+=5)
265 $completion_vals[$i] = $i.
" %";
270 $compl->setValue($this->app->getCompletion());
271 $this->form->addItem($compl);
275 $desc->
setValue($this->app->getDescription());
277 $this->form->addItem($desc);
279 if ($a_as_milestone && $a_mode ==
"edit" && $resp_info)
282 $users = $this->app->readResponsibleUsers();
286 foreach($users as $r)
288 $value.= $delim.$r[
"lastname"].
", ".$r[
"firstname"].
" [".$r[
"login"].
"]";
291 if (count($users) > 0)
297 $resp->setValue(
"-");
300 $this->form->addItem($resp);
304 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
317 $tpl->addJavaScript(
'./Services/Calendar/js/toggle_notification.js');
319 $not->
setInfo($this->lng->txt(
'cal_notification_info'));
321 $not->setChecked($this->app->isNotificationEnabled());
322 $not->setDisabled($disabled);
323 $this->form->addItem($not);
339 $tpl->setContent($this->form->getHTML());
353 $tpl->setContent($this->form->getHTML());
371 protected function save($a_as_milestone =
false)
375 $this->
load($a_as_milestone);
377 if($this->app->validate())
379 if(!(
int)
$_POST[
'calendar'])
385 $cat_id = (int)
$_POST[
'calendar'];
389 $this->rec->setEntryId($this->app->getEntryId());
392 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
397 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
403 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
408 && ($type ==
"grp" || $type ==
"crs"))
413 elseif($a_as_milestone)
416 $this->ctrl->returnToParent($this);
421 $this->ctrl->returnToParent($this);
444 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
447 include_once
'./Services/Calendar/classes/class.ilCalendarMailNotification.php';
449 $notification->setAppointmentId($app_id);
451 switch($cat_info[
'type'])
455 switch($cat_info[
'obj_type'])
460 $notification->setRefId(
$ref_id);
461 $notification->setType(
470 $notification->setRefId(
$ref_id);
471 $notification->setType(
480 $notification->send();
488 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
490 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
504 include_once(
"./Services/Calendar/classes/class.ilMilestoneResponsiblesTableGUI.php");
506 $this->app->getEntryId());
507 $tpl->setContent($table_gui->getHTML());
517 $this->app->writeResponsibleUsers(
$_POST[
"user_id"]);
518 $ilCtrl->returnToParent($this);
532 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
533 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
534 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
539 if(!$cats->isVisible($cat_id))
541 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
544 if(!$cats->isEditable($cat_id) or $this->app->isAutoGenerated())
550 $this->
initForm(
'edit', $this->app->isMilestone());
551 $tpl->setContent($this->form->getHTML());
564 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
566 $info->setFormAction($this->ctrl->getFormAction($this));
568 if ($this->app->isMilestone())
570 $info->addSection($this->lng->txt(
'cal_ms_details'));
574 $info->addSection($this->lng->txt(
'cal_details'));
578 $info->addProperty($this->lng->txt(
'appointment'),
580 $this->app->getStart(),
581 $this->app->getEnd()));
582 $info->addProperty($this->lng->txt(
'title'),$this->app->getPresentationTitle());
585 if(strlen($desc = $this->app->getDescription()))
587 $info->addProperty($this->lng->txt(
'description'),$desc);
591 if(strlen($loc = $this->app->getLocation()))
593 $info->addProperty($this->lng->txt(
'cal_where'),$loc);
597 if ($this->app->isMilestone() && $this->app->getCompletion() > 0)
599 $info->addProperty($this->lng->txt(
'cal_task_completion'),
600 $this->app->getCompletion().
" %");
603 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
608 && ($type ==
"grp" || $type ==
"crs"))
611 $users = $this->app->readResponsibleUsers();
613 foreach($users as $r)
615 $value.= $delim.$r[
"lastname"].
", ".$r[
"firstname"].
" [".$r[
"login"].
"]";
618 if (count($users) > 0)
620 $info->addProperty($this->lng->txt(
'cal_responsible'),
629 $info->addSection($this->lng->txt(
'additional_info'));
634 include_once(
'classes/class.ilLink.php');
636 $info->addProperty($this->lng->txt(
'perma_link'),
'<a class="small" href="'.$href.
'" target="_top">'.$href.
'</a>');
639 $tpl->setContent($info->getHTML());
652 $this->
load($this->app->isMilestone());
654 if($this->app->validate())
656 if(!(
int)
$_POST[
'calendar'])
662 $cat_id = (int)
$_POST[
'calendar'];
665 $this->app->update();
668 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
671 $ass->addAssignment($cat_id);
674 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
681 $this->ctrl->returnToParent($this);
702 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
704 $this->ctrl->saveParameter($this,array(
'seed',
'app_id',
'dt',
'idate'));
707 $confirm->setFormAction($this->ctrl->getFormAction($this));
708 $confirm->setHeaderText($this->lng->txt(
'cal_delete_app_sure'));
709 $confirm->setCancel($this->lng->txt(
'cancel'),
'cancel');
710 $confirm->addItem(
'appointments[]',$this->app->getEntryId(),$this->app->getTitle());
712 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrences.php');
714 && !$this->app->isMilestone())
716 $confirm->addButton($this->lng->txt(
'cal_delete_single'),
'deleteexclude');
717 $confirm->setConfirm($this->lng->txt(
'cal_delete_recurrences'),
'delete');
721 $confirm->setConfirm($this->lng->txt(
'delete'),
'delete');
724 $tpl->setContent($confirm->getHTML());
735 protected function delete()
737 foreach(
$_POST[
'appointments'] as $app_id)
742 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
746 $this->ctrl->returnToParent($this);
758 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrenceExclusion.php');
760 $excl->setEntryId(
$_GET[
'app_id']);
765 $this->ctrl->returnToParent($this);
779 $this->timezone = $ilUser->getTimeZone();
788 if(!isset(
$_GET[
'hour']))
791 $this->default_fulltime =
true;
795 if((
int)
$_GET[
'hour'] < 10)
797 $time =
'0'.(int)
$_GET[
'hour'].
':00:00';
801 $time = (int)
$_GET[
'hour'].
':00:00';
804 $this->default_fulltime =
false;
817 $this->seed = clone
$seed;
818 $this->default_fulltime =
true;
830 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
831 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrences.php');
837 $this->app->setStart($start);
840 if($this->default_fulltime)
842 #$seed_end->increment(IL_CAL_DAY,1);
848 $this->app->setEnd($seed_end);
849 $this->app->setFullday($this->default_fulltime);
867 protected function load($a_as_milestone =
false)
871 $this->app->setMilestone(
true);
879 $this->app->enableNotification((
int)
$_POST[
'not']);
882 $this->app->setFullday(
true);
886 $this->app->setFullday(isset($_POST[
'event'][
'fulltime']) ?
true :
false);
889 if($this->app->isFullday())
891 $start =
new ilDate($_POST[
'event'][
'start'][
'date'][
'y'].
'-'.$_POST[
'event'][
'start'][
'date'][
'm'].
'-'.$_POST[
'event'][
'start'][
'date'][
'd'],
893 $this->app->setStart($start);
895 $end =
new ilDate($_POST[
'event'][
'end'][
'date'][
'y'].
'-'.$_POST[
'event'][
'end'][
'date'][
'm'].
'-'.$_POST[
'event'][
'end'][
'date'][
'd'],
901 $this->app->setEnd($start);
905 $this->app->setEnd($end);
910 $start_dt[
'year'] = (int) $_POST[
'event'][
'start'][
'date'][
'y'];
911 $start_dt[
'mon'] = (int) $_POST[
'event'][
'start'][
'date'][
'm'];
912 $start_dt[
'mday'] = (int) $_POST[
'event'][
'start'][
'date'][
'd'];
913 $start_dt[
'hours'] = (int) $_POST[
'event'][
'start'][
'time'][
'h'];
914 $start_dt[
'minutes'] = (int) $_POST[
'event'][
'start'][
'time'][
'm'];
916 $this->app->setStart($start);
918 $end_dt[
'year'] = (int) $_POST[
'event'][
'end'][
'date'][
'y'];
919 $end_dt[
'mon'] = (int) $_POST[
'event'][
'end'][
'date'][
'm'];
920 $end_dt[
'mday'] = (int) $_POST[
'event'][
'end'][
'date'][
'd'];
921 $end_dt[
'hours'] = (int) $_POST[
'event'][
'end'][
'time'][
'h'];
922 $end_dt[
'minutes'] = (int) $_POST[
'event'][
'end'][
'time'][
'm'];
924 $this->app->setEnd($end);
939 switch(
$_POST[
'frequence'])
942 $this->rec->setFrequenceType(
$_POST[
'frequence']);
943 $this->rec->setInterval((
int)
$_POST[
'count_DAILY']);
947 $this->rec->setFrequenceType($_POST[
'frequence']);
948 $this->rec->setInterval((
int) $_POST[
'count_WEEKLY']);
949 if(is_array($_POST[
'byday_WEEKLY']))
956 $this->rec->setFrequenceType($_POST[
'frequence']);
957 $this->rec->setInterval((
int) $_POST[
'count_MONTHLY']);
958 switch((
int) $_POST[
'subtype_MONTHLY'])
965 switch((
int) $_POST[
'monthly_byday_day'])
969 $this->rec->setBYSETPOS((
int) $_POST[
'monthly_byday_num']);
970 $this->rec->setBYDAY(
'MO,TU,WE,TH,FR');
975 $this->rec->setBYMONTHDAY((
int) $_POST[
'monthly_byday_num']);
979 $this->rec->setBYDAY((
int) $_POST[
'monthly_byday_num'].$_POST[
'monthly_byday_day']);
985 $this->rec->setBYMONTHDAY((
int) $_POST[
'monthly_bymonthday']);
991 $this->rec->setFrequenceType($_POST[
'frequence']);
992 $this->rec->setInterval((
int) $_POST[
'count_YEARLY']);
993 switch((
int) $_POST[
'subtype_YEARLY'])
1000 $this->rec->setBYMONTH((
int) $_POST[
'yearly_bymonth_byday']);
1001 $this->rec->setBYDAY((
int) $_POST[
'yearly_byday_num'].$_POST[
'yearly_byday']);
1005 $this->rec->setBYMONTH((
int) $_POST[
'yearly_bymonth_by_monthday']);
1006 $this->rec->setBYMONTHDAY((
int) $_POST[
'yearly_bymonthday']);
1013 switch((
int)
$_POST[
'until_type'])
1016 $this->rec->setFrequenceUntilDate(null);
1021 $this->rec->setFrequenceUntilDate(null);
1022 $this->rec->setFrequenceUntilCount((
int) $_POST[
'count']);
1026 $end_dt[
'year'] = (int) $_POST[
'until_end'][
'date'][
'y'];
1027 $end_dt[
'mon'] = (int) $_POST[
'until_end'][
'date'][
'm'];
1028 $end_dt[
'mday'] = (int) $_POST[
'until_end'][
'date'][
'd'];
1030 $this->rec->setFrequenceUntilCount(0);
1046 switch(
$_POST[
'frequence'])
1050 if($this->rec->getRecurrenceId())
1052 $this->rec->delete();
1057 if($this->rec->getRecurrenceId())
1059 $this->rec->update();
1077 global $ilUser,
$lng;
1082 $cat->setTitle($this->lng->txt(
'cal_default_calendar'));
1083 $cat->setObjId($ilUser->getId());
1102 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1105 $this->ctrl->setParameter($this,
'dstart',(
int)
$_REQUEST[
'dstart']);
1106 $this->ctrl->setParameter($this,
'dend',(
int) $_REQUEST[
'dend']);
1109 $conf->setHeaderText($this->lng->txt(
'cal_confirm_reg_info'));
1110 $conf->setConfirm($this->lng->txt(
'cal_reg_register'),
'register');
1111 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1112 $conf->addItem(
'app_id', $entry->getEntryId(), $entry->getTitle().
' ('.$start.
')');
1114 $tpl->setContent($conf->getHTML());
1121 protected function register()
1125 include_once
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
1134 $this->ctrl->returnToParent($this);
1152 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1155 $this->ctrl->setParameter($this,
'dstart',(
int)
$_REQUEST[
'dstart']);
1156 $this->ctrl->setParameter($this,
'dend',(
int) $_REQUEST[
'dend']);
1159 $conf->setHeaderText($this->lng->txt(
'cal_confirm_unreg_info'));
1160 $conf->setConfirm($this->lng->txt(
'cal_reg_unregister'),
'unregister');
1161 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1162 $conf->addItem(
'app_id', $entry->getEntryId(), $entry->getTitle().
' ('.$start.
')');
1164 $tpl->setContent($conf->getHTML());
1175 include_once
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
1184 $this->ctrl->returnToParent($this);
1192 global $ilUser,
$tpl;
1194 $entry = (int)
$_GET[
'app_id'];
1195 $user = (int)
$_GET[
'bkid'];
1197 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1198 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1204 switch($user_settings->getTimeFormat())
1219 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1222 $conf->setHeaderText($this->lng->txt(
'cal_confirm_booking_info'));
1223 $conf->setConfirm($this->lng->txt(
'cal_confirm_booking'),
'bookconfirmed');
1224 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1225 $conf->addItem(
'app_id', $entry->getEntryId(),
$title);
1227 $tpl->setContent($conf->getHTML());
1237 $entry = (int)
$_POST[
'app_id'];
1238 $user = (int)
$_GET[
'bkid'];
1240 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1241 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1244 $booking->
book($entry->getEntryId());
1247 include_once
'./Services/Calendar/classes/class.ilCalendarCategory.php';
1248 include_once
'./Services/Calendar/classes/class.ilCalendarUtil.php';
1249 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1250 $user_entry = clone $entry;
1251 $user_entry->save();
1257 $this->ctrl->returnToParent($this);
1266 global $ilUser,
$tpl;
1268 $entry = (int)
$_GET[
'app_id'];
1270 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1276 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1278 if(!$booking->hasBooked($entry->getEntryId()))
1280 $this->ctrl->returnToParent($this);
1288 $entry_title =
' '.$entry->getTitle();
1292 $this->ctrl->returnToParent($this);
1298 switch($user_settings->getTimeFormat())
1311 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1314 $conf->setHeaderText($this->lng->txt(
'cal_cancel_booking_info'));
1315 $conf->setConfirm($this->lng->txt(
'cal_cancel_booking'),
'cancelconfirmed');
1316 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1317 $conf->addItem(
'app_id', $entry->getEntryId(),
$title.
' - '.$entry_title);
1319 $tpl->setContent($conf->getHTML());
1330 $entry = (int)
$_POST[
'app_id'];
1331 $user = (int)
$_GET[
'bkid'];
1333 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1340 include_once
'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1345 $ref_entry->delete();
1348 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1356 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1365 $this->ctrl->returnToParent($this);
1375 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1376 include_once
'Services/Calendar/classes/class.ilCalendarCategory.php';