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');
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');
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');
715 $confirm->addButton($this->lng->txt(
'cal_delete_single'),
'deleteexclude');
716 $confirm->setConfirm($this->lng->txt(
'cal_delete_recurrences'),
'delete');
720 $confirm->setConfirm($this->lng->txt(
'delete'),
'delete');
723 $tpl->setContent($confirm->getHTML());
734 protected function delete()
736 foreach(
$_POST[
'appointments'] as $app_id)
741 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
745 $this->ctrl->returnToParent($this);
757 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrenceExclusion.php');
759 $excl->setEntryId(
$_GET[
'app_id']);
764 $this->ctrl->returnToParent($this);
778 $this->timezone = $ilUser->getTimeZone();
787 if(!isset(
$_GET[
'hour']))
790 $this->default_fulltime =
true;
794 if((
int)
$_GET[
'hour'] < 10)
796 $time =
'0'.(int)
$_GET[
'hour'].
':00:00';
800 $time = (int)
$_GET[
'hour'].
':00:00';
803 $this->default_fulltime =
false;
816 $this->seed = clone
$seed;
817 $this->default_fulltime =
true;
829 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
830 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrences.php');
836 $this->app->setStart($start);
839 if($this->default_fulltime)
841 #$seed_end->increment(IL_CAL_DAY,1);
847 $this->app->setEnd($seed_end);
848 $this->app->setFullday($this->default_fulltime);
866 protected function load($a_as_milestone =
false)
870 $this->app->setMilestone(
true);
878 $this->app->enableNotification((
int)
$_POST[
'not']);
881 $this->app->setFullday(
true);
885 $this->app->setFullday(isset($_POST[
'event'][
'fulltime']) ?
true :
false);
888 if($this->app->isFullday())
890 $start =
new ilDate($_POST[
'event'][
'start'][
'date'][
'y'].
'-'.$_POST[
'event'][
'start'][
'date'][
'm'].
'-'.$_POST[
'event'][
'start'][
'date'][
'd'],
892 $this->app->setStart($start);
894 $end =
new ilDate($_POST[
'event'][
'end'][
'date'][
'y'].
'-'.$_POST[
'event'][
'end'][
'date'][
'm'].
'-'.$_POST[
'event'][
'end'][
'date'][
'd'],
900 $this->app->setEnd($start);
904 $this->app->setEnd($end);
909 $start_dt[
'year'] = (int) $_POST[
'event'][
'start'][
'date'][
'y'];
910 $start_dt[
'mon'] = (int) $_POST[
'event'][
'start'][
'date'][
'm'];
911 $start_dt[
'mday'] = (int) $_POST[
'event'][
'start'][
'date'][
'd'];
912 $start_dt[
'hours'] = (int) $_POST[
'event'][
'start'][
'time'][
'h'];
913 $start_dt[
'minutes'] = (int) $_POST[
'event'][
'start'][
'time'][
'm'];
915 $this->app->setStart($start);
917 $end_dt[
'year'] = (int) $_POST[
'event'][
'end'][
'date'][
'y'];
918 $end_dt[
'mon'] = (int) $_POST[
'event'][
'end'][
'date'][
'm'];
919 $end_dt[
'mday'] = (int) $_POST[
'event'][
'end'][
'date'][
'd'];
920 $end_dt[
'hours'] = (int) $_POST[
'event'][
'end'][
'time'][
'h'];
921 $end_dt[
'minutes'] = (int) $_POST[
'event'][
'end'][
'time'][
'm'];
923 $this->app->setEnd($end);
938 switch(
$_POST[
'frequence'])
941 $this->rec->setFrequenceType(
$_POST[
'frequence']);
942 $this->rec->setInterval((
int)
$_POST[
'count_DAILY']);
946 $this->rec->setFrequenceType($_POST[
'frequence']);
947 $this->rec->setInterval((
int) $_POST[
'count_WEEKLY']);
948 if(is_array($_POST[
'byday_WEEKLY']))
955 $this->rec->setFrequenceType($_POST[
'frequence']);
956 $this->rec->setInterval((
int) $_POST[
'count_MONTHLY']);
957 switch((
int) $_POST[
'subtype_MONTHLY'])
964 switch((
int) $_POST[
'monthly_byday_day'])
968 $this->rec->setBYSETPOS((
int) $_POST[
'monthly_byday_num']);
969 $this->rec->setBYDAY(
'MO,TU,WE,TH,FR');
974 $this->rec->setBYMONTHDAY((
int) $_POST[
'monthly_byday_num']);
978 $this->rec->setBYDAY((
int) $_POST[
'monthly_byday_num'].$_POST[
'monthly_byday_day']);
984 $this->rec->setBYMONTHDAY((
int) $_POST[
'monthly_bymonthday']);
990 $this->rec->setFrequenceType($_POST[
'frequence']);
991 $this->rec->setInterval((
int) $_POST[
'count_YEARLY']);
992 switch((
int) $_POST[
'subtype_YEARLY'])
999 $this->rec->setBYMONTH((
int) $_POST[
'yearly_bymonth_byday']);
1000 $this->rec->setBYDAY((
int) $_POST[
'yearly_byday_num'].$_POST[
'yearly_byday']);
1004 $this->rec->setBYMONTH((
int) $_POST[
'yearly_bymonth_by_monthday']);
1005 $this->rec->setBYMONTHDAY((
int) $_POST[
'yearly_bymonthday']);
1012 switch((
int)
$_POST[
'until_type'])
1015 $this->rec->setFrequenceUntilDate(null);
1020 $this->rec->setFrequenceUntilDate(null);
1021 $this->rec->setFrequenceUntilCount((
int) $_POST[
'count']);
1025 $end_dt[
'year'] = (int) $_POST[
'until_end'][
'date'][
'y'];
1026 $end_dt[
'mon'] = (int) $_POST[
'until_end'][
'date'][
'm'];
1027 $end_dt[
'mday'] = (int) $_POST[
'until_end'][
'date'][
'd'];
1029 $this->rec->setFrequenceUntilCount(0);
1045 switch(
$_POST[
'frequence'])
1049 if($this->rec->getRecurrenceId())
1051 $this->rec->delete();
1056 if($this->rec->getRecurrenceId())
1058 $this->rec->update();
1076 global $ilUser,
$lng;
1081 $cat->setTitle($this->lng->txt(
'cal_default_calendar'));
1082 $cat->setObjId($ilUser->getId());
1101 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1104 $this->ctrl->setParameter($this,
'dstart',(
int)
$_REQUEST[
'dstart']);
1105 $this->ctrl->setParameter($this,
'dend',(
int) $_REQUEST[
'dend']);
1108 $conf->setHeaderText($this->lng->txt(
'cal_confirm_reg_info'));
1109 $conf->setConfirm($this->lng->txt(
'cal_reg_register'),
'register');
1110 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1111 $conf->addItem(
'app_id', $entry->getEntryId(), $entry->getTitle().
' ('.$start.
')');
1113 $tpl->setContent($conf->getHTML());
1120 protected function register()
1124 include_once
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
1133 $this->ctrl->returnToParent($this);
1151 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1154 $this->ctrl->setParameter($this,
'dstart',(
int)
$_REQUEST[
'dstart']);
1155 $this->ctrl->setParameter($this,
'dend',(
int) $_REQUEST[
'dend']);
1158 $conf->setHeaderText($this->lng->txt(
'cal_confirm_unreg_info'));
1159 $conf->setConfirm($this->lng->txt(
'cal_reg_unregister'),
'unregister');
1160 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1161 $conf->addItem(
'app_id', $entry->getEntryId(), $entry->getTitle().
' ('.$start.
')');
1163 $tpl->setContent($conf->getHTML());
1174 include_once
'./Services/Calendar/classes/class.ilCalendarRegistration.php';
1183 $this->ctrl->returnToParent($this);
1191 global $ilUser,
$tpl;
1193 $entry = (int)
$_GET[
'app_id'];
1194 $user = (int)
$_GET[
'bkid'];
1196 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1197 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1203 switch($user_settings->getTimeFormat())
1218 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1221 $conf->setHeaderText($this->lng->txt(
'cal_confirm_booking_info'));
1222 $conf->setConfirm($this->lng->txt(
'cal_confirm_booking'),
'bookconfirmed');
1223 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1224 $conf->addItem(
'app_id', $entry->getEntryId(),
$title);
1226 $tpl->setContent($conf->getHTML());
1236 $entry = (int)
$_POST[
'app_id'];
1237 $user = (int)
$_GET[
'bkid'];
1239 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1240 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1243 $booking->
book($entry->getEntryId());
1246 include_once
'./Services/Calendar/classes/class.ilCalendarCategory.php';
1247 include_once
'./Services/Calendar/classes/class.ilCalendarUtil.php';
1248 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1249 $user_entry = clone $entry;
1250 $user_entry->save();
1256 $this->ctrl->returnToParent($this);
1265 global $ilUser,
$tpl;
1267 $entry = (int)
$_GET[
'app_id'];
1269 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1275 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1277 if(!$booking->hasBooked($entry->getEntryId()))
1279 $this->ctrl->returnToParent($this);
1287 $entry_title =
' '.$entry->getTitle();
1291 $this->ctrl->returnToParent($this);
1297 switch($user_settings->getTimeFormat())
1310 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1313 $conf->setHeaderText($this->lng->txt(
'cal_cancel_booking_info'));
1314 $conf->setConfirm($this->lng->txt(
'cal_cancel_booking'),
'cancelconfirmed');
1315 $conf->setCancel($this->lng->txt(
'cancel'),
'cancel');
1316 $conf->addItem(
'app_id', $entry->getEntryId(),
$title.
' - '.$entry_title);
1318 $tpl->setContent($conf->getHTML());
1329 $entry = (int)
$_POST[
'app_id'];
1330 $user = (int)
$_GET[
'bkid'];
1332 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1339 include_once
'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
1344 $ref_entry->delete();
1347 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
1355 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1364 $this->ctrl->returnToParent($this);
1374 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1375 include_once
'Services/Calendar/classes/class.ilCalendarCategory.php';