33 include_once(
'./Services/Calendar/classes/class.ilTimeZone.php');
34 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
61 $lng->loadLanguageModule(
'dateplaner');
80 $next_class = $this->ctrl->getNextClass($this);
85 $cmd = $this->ctrl->getCmd(
"add");
101 $this->ctrl->returnToParent($this);
115 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
116 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php');
117 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
118 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
119 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
123 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
129 $this->form->setTitle($this->lng->txt(
'cal_new_app'));
130 $this->ctrl->saveParameter($this,array(
'seed'));
131 $this->form->setFormAction($this->ctrl->getFormAction($this));
132 $this->form->addCommandButton(
'save',$this->lng->txt(
'cal_add_appointment'));
133 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
137 $this->form->setTitle($this->lng->txt(
'cal_edit_appointment'));
138 $this->ctrl->saveParameter($this,array(
'seed',
'app_id'));
139 $this->form->setFormAction($this->ctrl->getFormAction($this));
140 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
141 $this->form->addCommandButton(
'askDelete',$this->lng->txt(
'delete'));
142 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
147 $title->setValue($this->app->getTitle());
148 $title->setRequired(
true);
149 $title->setMaxLength(128);
151 $this->form->addItem(
$title);
154 $calendar =
new ilSelectInputGUI($this->lng->txt(
'cal_category_selection'),
'calendar');
155 if($_POST[
'category'])
157 $calendar->
setValue((
int) $_POST[
'calendar']);
159 elseif($a_mode ==
'edit')
163 $calendar->setValue($cat);
165 elseif(isset(
$_GET[
'ref_id']))
167 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
171 $calendar->setRequired(
true);
173 $calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
174 $this->form->addItem($calendar);
176 $tpl->addJavaScript(
'./Services/Calendar/js/toggle_appointment_time.js');
178 $fullday->
setChecked($this->app->isFullday() ?
true :
false);
179 $fullday->setOptionTitle($this->lng->txt(
'cal_fullday_title'));
180 $fullday->setAdditionalAttributes(
'onchange="ilToggleAppointmentTime(this);"');
181 $this->form->addItem($fullday);
184 $start->
setDate($this->app->getStart());
185 $start->setShowTime(
true);
186 $start->setMinuteStepSize(5);
187 $fullday->addSubItem($start);
190 $end->
setDate($this->app->getEnd());
191 $end->setShowTime(
true);
192 $end->setMinuteStepSize(5);
193 $fullday->addSubItem($end);
196 include_once(
'./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
198 $rec->setRecurrence($this->rec);
199 $this->form->addItem(
$rec);
202 $where =
new ilTextInputGUI($this->lng->txt(
'cal_where'),
'location');
203 $where->
setValue($this->app->getLocation());
204 $where->setMaxLength(128);
206 $this->form->addItem($where);
209 $desc->
setValue($this->app->getDescription());
211 $this->form->addItem($desc);
227 $tpl->setContent($this->form->getHTML());
241 if($this->app->validate())
243 if(!(
int) $_POST[
'calendar'])
249 $cat_id = (int) $_POST[
'calendar'];
253 $this->rec->setEntryId($this->app->getEntryId());
256 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
261 $this->ctrl->returnToParent($this);
281 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
282 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
283 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
288 if(!$cats->isVisible($cat_id))
290 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
293 if(!$cats->isEditable($cat_id) or $this->app->isAutoGenerated())
300 $tpl->setContent($this->form->getHTML());
313 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
315 $info->setFormAction($this->ctrl->getFormAction($this));
317 $info->addSection($this->lng->txt(
'cal_details'));
320 $info->addProperty($this->lng->txt(
'appointment'),
322 $this->app->getStart(),
323 $this->app->getEnd()));
324 $info->addProperty($this->lng->txt(
'title'),$this->app->getPresentationTitle());
327 if(strlen($desc = $this->app->getDescription()))
329 $info->addProperty($this->lng->txt(
'description'),$desc);
333 if(strlen($loc = $this->app->getLocation()))
335 $info->addProperty($this->lng->txt(
'cal_where'),$loc);
338 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
344 $info->addSection($this->lng->txt(
'additional_info'));
349 include_once(
'classes/class.ilLink.php');
351 $info->addProperty($this->lng->txt(
'perma_link'),
'<a class="small" href="'.$href.
'" target="_top">'.$href.
'</a>');
354 $tpl->setContent($info->getHTML());
369 if($this->app->validate())
371 if(!(
int) $_POST[
'calendar'])
377 $cat_id = (int) $_POST[
'calendar'];
381 $this->app->update();
384 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
387 $ass->addAssignment($cat_id);
390 $this->ctrl->returnToParent($this);
411 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
413 $this->ctrl->saveParameter($this,array(
'seed',
'app_id'));
416 $confirm->setFormAction($this->ctrl->getFormAction($this));
417 $confirm->setHeaderText($this->lng->txt(
'cal_delete_app_sure'));
418 $confirm->setCancel($this->lng->txt(
'cancel'),
'edit');
419 $confirm->setConfirm($this->lng->txt(
'delete'),
'delete');
420 $confirm->addItem(
'appointments[]',$this->app->getEntryId(),$this->app->getTitle());
421 $tpl->setContent($confirm->getHTML());
432 protected function delete()
434 foreach($_POST[
'appointments'] as $app_id)
439 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
443 $this->ctrl->returnToParent($this);
457 $this->timezone = $ilUser->getTimeZone();
469 if(!isset(
$_GET[
'hour']))
471 $this->seed = clone
$seed;
472 $this->default_fulltime =
true;
476 if((
int)
$_GET[
'hour'] < 10)
478 $time =
'0'.(int)
$_GET[
'hour'].
':00:00';
482 $time = (int)
$_GET[
'hour'].
':00:00';
485 $this->default_fulltime =
false;
499 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
500 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrences.php');
506 $this->app->setStart($start);
509 if($this->default_fulltime)
511 #$seed_end->increment(IL_CAL_DAY,1);
517 $this->app->setEnd($seed_end);
518 $this->app->setFullday($this->default_fulltime);
542 $this->app->setFullday(isset($_POST[
'fullday']) ?
true :
false);
544 if($this->app->isFullday())
546 $start =
new ilDate($_POST[
'start'][
'date'][
'y'].
'-'.$_POST[
'start'][
'date'][
'm'].
'-'.$_POST[
'start'][
'date'][
'd'],
548 $this->app->setStart($start);
550 $end =
new ilDate($_POST[
'end'][
'date'][
'y'].
'-'.$_POST[
'end'][
'date'][
'm'].
'-'.$_POST[
'end'][
'date'][
'd'],
552 $this->app->setEnd($end);
556 $start_dt[
'year'] = (int) $_POST[
'start'][
'date'][
'y'];
557 $start_dt[
'mon'] = (int) $_POST[
'start'][
'date'][
'm'];
558 $start_dt[
'mday'] = (int) $_POST[
'start'][
'date'][
'd'];
559 $start_dt[
'hours'] = (int) $_POST[
'start'][
'time'][
'h'];
560 $start_dt[
'minutes'] = (int) $_POST[
'start'][
'time'][
'm'];
562 $this->app->setStart($start);
564 $end_dt[
'year'] = (int) $_POST[
'end'][
'date'][
'y'];
565 $end_dt[
'mon'] = (int) $_POST[
'end'][
'date'][
'm'];
566 $end_dt[
'mday'] = (int) $_POST[
'end'][
'date'][
'd'];
567 $end_dt[
'hours'] = (int) $_POST[
'end'][
'time'][
'h'];
568 $end_dt[
'minutes'] = (int) $_POST[
'end'][
'time'][
'm'];
570 $this->app->setEnd($end);
585 switch($_POST[
'frequence'])
588 $this->rec->setFrequenceType($_POST[
'frequence']);
589 $this->rec->setInterval((
int) $_POST[
'count_DAILY']);
593 $this->rec->setFrequenceType($_POST[
'frequence']);
594 $this->rec->setInterval((
int) $_POST[
'count_WEEKLY']);
595 if(is_array($_POST[
'byday_WEEKLY']))
602 $this->rec->setFrequenceType($_POST[
'frequence']);
603 $this->rec->setInterval((
int) $_POST[
'count_MONTHLY']);
604 switch((
int) $_POST[
'subtype_MONTHLY'])
611 switch((
int) $_POST[
'monthly_byday_day'])
615 $this->rec->setBYSETPOS((
int) $_POST[
'monthly_byday_num']);
616 $this->rec->setBYDAY(
'MO,TU,WE,TH,FR');
621 $this->rec->setBYMONTHDAY((
int) $_POST[
'monthly_byday_num']);
625 $this->rec->setBYDAY((
int) $_POST[
'monthly_byday_num'].$_POST[
'monthly_byday_day']);
631 $this->rec->setBYMONTHDAY((
int) $_POST[
'monthly_bymonthday']);
637 $this->rec->setFrequenceType($_POST[
'frequence']);
638 $this->rec->setInterval((
int) $_POST[
'count_YEARLY']);
639 switch((
int) $_POST[
'subtype_YEARLY'])
646 $this->rec->setBYMONTH((
int) $_POST[
'yearly_bymonth_byday']);
647 $this->rec->setBYDAY((
int) $_POST[
'yearly_byday_num'].$_POST[
'yearly_byday']);
651 $this->rec->setBYMONTH((
int) $_POST[
'yearly_bymonth_by_monthday']);
652 $this->rec->setBYMONTHDAY((
int) $_POST[
'yearly_bymonthday']);
659 switch((
int) $_POST[
'until_type'])
666 $this->rec->setFrequenceUntilCount((
int) $_POST[
'count']);
681 switch($_POST[
'frequence'])
685 if($this->rec->getRecurrenceId())
687 $this->rec->delete();
692 if($this->rec->getRecurrenceId())
694 $this->rec->update();
717 $cat->setTitle($this->lng->txt(
'cal_default_calendar'));
718 $cat->setObjId($ilUser->getId());