24 include_once
'./Services/Calendar/classes/class.ilCalendarRecurrence.php';
25 include_once
'./Services/Booking/classes/class.ilBookingEntry.php';
26 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
65 $this->user_id = $ilUser->getId();
81 switch($this->ctrl->getNextClass())
83 case "ilpublicuserprofilegui":
84 include_once(
'./Services/User/classes/class.ilPublicUserProfileGUI.php');
87 $ret = $ilCtrl->forwardCommand($profile);
88 $tpl->setContent(
$ret);
96 $ilCtrl->setParameter($this,
'user_id', $this->user_id);
99 $cmd = $this->ctrl->getCmd(
'appointmentList');
122 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
123 $ilToolbar->addButton($this->lng->txt(
'cal_ch_add_sequence'),$this->ctrl->getLinkTarget($this,
'createSequence'));
125 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursTableGUI.php';
128 $this->tpl->setContent($tbl->getHTML());
140 $this->form->getItemByPostVar(
'bo')->setValue($this->booking->getNumberOfBookings());
141 $this->form->getItemByPostVar(
'ap')->setValue(1);
142 $this->form->getItemByPostVar(
'du')->setMinutes(15);
143 $this->form->getItemByPostVar(
'st')->setDate(
146 $this->tpl->setContent($this->form->getHTML());
156 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
158 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
162 $this->form->setFormAction($this->ctrl->getFormAction($this));
166 case self::MODE_CREATE:
167 $this->form->setTitle($this->lng->txt(
'cal_ch_add_sequence'));
168 $this->form->addCommandButton(
'saveSequence', $this->lng->txt(
'save'));
169 $this->form->addCommandButton(
'appointmentList', $this->lng->txt(
'cancel'));
180 case self::MODE_MULTI:
181 $this->form->setTitle($this->lng->txt(
'cal_ch_multi_edit_sequence'));
182 $this->form->addCommandButton(
'updateMulti', $this->lng->txt(
'save'));
183 $this->form->addCommandButton(
'appointmentList', $this->lng->txt(
'cancel'));
190 $ti->setMaxLength(128);
191 $ti->setRequired(
true);
192 $this->form->addItem($ti);
194 if($a_mode != self::MODE_MULTI)
197 include_once
'./Services/Form/classes/class.ilDateTimeInputGUI.php';
200 $dur->setMinuteStepSize(5);
201 $this->form->addItem($dur);
206 $du->setShowHours(
false);
207 $this->form->addItem($du);
210 $nu =
new ilNumberInputGUI($this->lng->txt(
'cal_ch_num_appointments'),
'ap');
211 $nu->
setInfo($this->lng->txt(
'cal_ch_num_appointments_info'));
213 $nu->setMaxLength(2);
214 $nu->setRequired(
true);
216 $this->form->addItem($nu);
219 include_once(
'./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
228 $this->form->addItem($rec);
234 $nu->setMaxLength(2);
236 $nu->setRequired(
true);
237 $this->form->addItem($nu);
241 $dead->
setInfo($this->lng->txt(
'cal_ch_deadline_info'));
242 $dead->setShowMinutes(
false);
243 $dead->setShowHours(
true);
244 $dead->setShowDays(
true);
245 $this->form->addItem($dead);
250 $lo->setMaxLength(128);
251 $this->form->addItem($lo);
257 $this->form->addItem($de);
261 $tgt->
setInfo($this->lng->txt(
'cal_ch_target_object_info'));
263 $this->form->addItem($tgt);
272 global $ilObjDataCache;
276 if($this->form->checkInput())
278 $this->form->setValuesByPost();
282 $booking->setNumberOfBookings($this->form->getInput(
'bo'));
284 $deadline = $this->form->getInput(
'dead');
285 $deadline = $deadline[
'dd']*24+$deadline[
'hh'];
286 $booking->setDeadlineHours($deadline);
288 $tgt = $this->form->getInput(
'tgt');
291 $obj_id = $ilObjDataCache->lookupObjId($tgt);
295 $this->tpl->setContent($this->form->getHTML());
307 $this->ctrl->redirect($this,
'appointmentList');
311 $this->form->setValuesByPost();
312 $this->tpl->setContent($this->form->getHTML());
323 include_once
'./Services/Calendar/classes/class.ilDateList.php';
325 $start = clone $this->form->getItemByPostVar(
'st')->getDate();
326 for($i = 0; $i < $this->form->getItemByPostVar(
'ap')->getValue(); $i++)
328 $concurrent_dates->add($start);
332 include_once
'./Services/Calendar/classes/class.ilCalendarUtil.php';
336 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
337 include_once
'./Services/Calendar/classes/class.ilCalendarEntry.php';
338 include_once
'./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
339 include_once
'./Services/Booking/classes/class.ilBookingPeriod.php';
340 foreach($concurrent_dates as $dt)
343 $end->increment(
ilDateTime::MINUTE,$this->form->getItemByPostVar(
'du')->getMinutes());
347 $this->form->getItemByPostVar(
'frequence')->getRecurrence()
352 $limit->increment(ilDAteTime::YEAR,1);
356 foreach($date_list as $app_start)
358 $app_end = clone $app_start;
359 $app_end->increment(
ilDateTime::MINUTE,$this->form->getItemByPostVar(
'du')->getMinutes());
363 $entry->setContextId($booking->
getId());
364 $entry->setTitle($this->form->getInput(
'ti'));
365 $entry->setDescription($this->form->getInput(
'de'));
366 $entry->setLocation($this->form->getInput(
'lo'));
367 $entry->setStart($app_start);
368 $entry->setEnd($app_end);
385 global $ilTabs, $ilUser,
$ilCtrl;
387 $ilCtrl->setParameter($this,
'user_id',
'');
388 $ilTabs->addTab(
'consultation_hours_'.$ilUser->getId(), $this->lng->txt(
'cal_ch_ch'), $this->ctrl->getLinkTarget($this,
'appointmentList'));
392 $ilCtrl->setParameter($this,
'user_id', $user_id);
393 $ilTabs->addTab(
'consultation_hours_'.$user_id, $this->lng->txt(
'cal_ch_ch').
': '.$login, $this->ctrl->getLinkTarget($this,
'appointmentList'));
395 $ilCtrl->setParameter($this,
'user_id',
'');
397 $ilTabs->addTab(
'settings', $this->lng->txt(
'settings'), $this->ctrl->getLinkTarget($this,
'settings'));
399 $ilTabs->activateTab(
'consultation_hours_'.$this->
getUserId());
409 if(!isset(
$_POST[
'apps']))
423 $hidden->setValue(implode(
';',
$_POST[
'apps']));
424 $this->form->addItem($hidden);
426 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
428 $first = array_shift(
$_POST[
'apps']);
431 $this->form->getItemByPostVar(
'ti')->setValue($entry->getTitle());
432 $this->form->getItemByPostVar(
'lo')->setValue($entry->getLocation());
433 $this->form->getItemByPostVar(
'de')->setValue($entry->getDescription());
435 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
438 $this->form->getItemByPostVar(
'bo')->setValue(
$booking->getNumberOfBookings());
439 $this->form->getItemByPostVar(
'tgt')->setValue(
$booking->getTargetObjId());
441 $deadline =
$booking->getDeadlineHours();
442 $this->form->getItemByPostVar(
'dead')->setDays(floor($deadline/24));
443 $this->form->getItemByPostVar(
'dead')->setHours($deadline%24);
445 $this->tpl->setContent($this->form->getHTML());
454 global $ilObjDataCache;
458 if($this->form->checkInput())
460 $this->form->setValuesByPost();
461 $apps = explode(
';',
$_POST[
'apps']);
463 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
464 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
468 $first = array_shift($first);
470 if($this->form->getInput(
'bo') < $entry->getNumberOfBookings())
481 $booking->setNumberOfBookings($this->form->getInput(
'bo'));
483 $deadline = $this->form->getInput(
'dead');
484 $deadline = $deadline[
'dd']*24+$deadline[
'hh'];
485 $booking->setDeadlineHours($deadline);
487 $tgt = $this->form->getInput(
'tgt');
491 if($tgt != $entry->getTargetObjId())
493 $obj_id = $ilObjDataCache->lookupObjId($tgt);
513 $title = $this->form->getInput(
'ti');
515 $description = $this->form->getInput(
'de');
517 foreach($apps as $item_id)
520 $entry->setContextId(
$booking->getId());
523 $entry->setDescription($description);
530 $this->ctrl->redirect($this,
'appointmentList');
532 $this->tpl->setContent($this->form->getHTML());
542 if(!isset(
$_POST[
'apps']))
548 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
550 $this->ctrl->saveParameter($this,array(
'seed',
'app_id',
'dt'));
553 $confirm->setFormAction($this->ctrl->getFormAction($this));
554 $confirm->setHeaderText($this->lng->txt(
'cal_delete_app_sure'));
555 $confirm->setCancel($this->lng->txt(
'cancel'),
'cancel');
557 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
558 foreach(
$_POST[
'apps'] as $entry_id)
564 $confirm->setConfirm($this->lng->txt(
'delete'),
'delete');
565 $confirm->setCancel($this->lng->txt(
'cancel'),
'appointmentList');
567 $tpl->setContent($confirm->getHTML());
573 public function delete()
577 if(!isset(
$_POST[
'apps']))
583 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
584 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
585 foreach(
$_POST[
'apps'] as $entry_id)
591 foreach($entry->getCurrentBookings($entry_id) as
$user_id)
593 $entry->cancelBooking($entry_id,
$user_id);
607 $this->ctrl->redirect($this,
'appointmentList');
617 $ilTabs->clearTargets();
621 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
624 $tpl->setContent($ilCtrl->getHTML($profile));
637 $url = $this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI');
640 else if(isset(
$_GET[
'panel']))
642 $url = $this->ctrl->getLinkTargetByClass(
'ilCalendarPresentationGUI');
647 $url = $this->ctrl->getLinkTarget($this,
'appointmentList');
657 global
$tpl, $ilTabs;
659 $ilTabs->activateTab(
'settings');
662 $tpl->setContent($form->getHTML());
671 global
$ilDB, $ilUser;
673 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
676 $form->setFormAction($this->ctrl->getFormAction($this));
678 $mng =
new ilTextInputGUI($this->lng->txt(
'cal_ch_manager'),
'mng');
679 $mng->
setInfo($this->lng->txt(
'cal_ch_manager_info'));
680 $form->addItem($mng);
684 $form->setTitle($this->lng->txt(
'settings'));
685 $form->addCommandButton(
'updateSettings', $this->lng->txt(
'save'));
698 if($form->checkInput())
700 $mng = $form->getInput(
'mng');
704 $ilCtrl->redirect($this,
'appointmentList');
708 $ilTabs->activateTab(
'settings');
711 $field = $form->getItemByPostVar(
'mng');
712 $field->setValue($mng);
713 $tpl->setContent($form->getHTML());