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 $ilHelp->setScreenIdComponent(
"cal");
83 switch($this->ctrl->getNextClass())
85 case "ilpublicuserprofilegui":
86 include_once(
'./Services/User/classes/class.ilPublicUserProfileGUI.php');
89 $ret = $ilCtrl->forwardCommand($profile);
90 $tpl->setContent(
$ret);
94 $tpl->setTitle($this->lng->txt(
"cal_ch_form_header"));
100 $ilCtrl->setParameter($this,
'user_id', $this->user_id);
103 $cmd = $this->ctrl->getCmd(
'appointmentList');
124 global $ilToolbar, $ilHelp;
126 $ilHelp->setScreenId(
"consultation_hours");
128 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
129 $ilToolbar->addButton($this->lng->txt(
'cal_ch_add_sequence'),$this->ctrl->getLinkTarget($this,
'createSequence'));
131 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursTableGUI.php';
134 $this->tpl->setContent($tbl->getHTML());
146 $this->form->getItemByPostVar(
'bo')->setValue($this->booking->getNumberOfBookings());
147 $this->form->getItemByPostVar(
'ap')->setValue(1);
148 $this->form->getItemByPostVar(
'du')->setMinutes(15);
149 $this->form->getItemByPostVar(
'st')->setDate(
152 $this->tpl->setContent($this->form->getHTML());
162 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
164 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
168 $this->form->setFormAction($this->ctrl->getFormAction($this));
172 case self::MODE_CREATE:
173 $this->form->setTitle($this->lng->txt(
'cal_ch_add_sequence'));
174 $this->form->addCommandButton(
'saveSequence', $this->lng->txt(
'save'));
175 $this->form->addCommandButton(
'appointmentList', $this->lng->txt(
'cancel'));
186 case self::MODE_MULTI:
187 $this->form->setTitle($this->lng->txt(
'cal_ch_multi_edit_sequence'));
188 $this->form->addCommandButton(
'updateMulti', $this->lng->txt(
'save'));
189 $this->form->addCommandButton(
'appointmentList', $this->lng->txt(
'cancel'));
196 $ti->setMaxLength(128);
197 $ti->setRequired(
true);
198 $this->form->addItem($ti);
200 if($a_mode != self::MODE_MULTI)
203 include_once
'./Services/Form/classes/class.ilDateTimeInputGUI.php';
206 $dur->setMinuteStepSize(5);
207 $this->form->addItem($dur);
212 $du->setShowHours(
false);
213 $this->form->addItem($du);
216 $nu =
new ilNumberInputGUI($this->lng->txt(
'cal_ch_num_appointments'),
'ap');
217 $nu->
setInfo($this->lng->txt(
'cal_ch_num_appointments_info'));
219 $nu->setMaxLength(2);
220 $nu->setRequired(
true);
222 $this->form->addItem($nu);
225 include_once(
'./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
234 $this->form->addItem($rec);
240 $nu->setMaxLength(2);
242 $nu->setRequired(
true);
243 $this->form->addItem($nu);
247 $dead->
setInfo($this->lng->txt(
'cal_ch_deadline_info'));
248 $dead->setShowMinutes(
false);
249 $dead->setShowHours(
true);
250 $dead->setShowDays(
true);
251 $this->form->addItem($dead);
256 $lo->setMaxLength(128);
257 $this->form->addItem($lo);
263 $this->form->addItem($de);
267 $tgt->
setInfo($this->lng->txt(
'cal_ch_target_object_info'));
269 $this->form->addItem($tgt);
278 global $ilObjDataCache;
282 if($this->form->checkInput())
284 $this->form->setValuesByPost();
288 $booking->setNumberOfBookings($this->form->getInput(
'bo'));
290 $deadline = $this->form->getInput(
'dead');
291 $deadline = $deadline[
'dd']*24+$deadline[
'hh'];
292 $booking->setDeadlineHours($deadline);
294 $tgt = $this->form->getInput(
'tgt');
297 $obj_id = $ilObjDataCache->lookupObjId($tgt);
301 $this->tpl->setContent($this->form->getHTML());
313 $this->ctrl->redirect($this,
'appointmentList');
317 $this->form->setValuesByPost();
318 $this->tpl->setContent($this->form->getHTML());
329 include_once
'./Services/Calendar/classes/class.ilDateList.php';
331 $start = clone $this->form->getItemByPostVar(
'st')->getDate();
332 for($i = 0; $i < $this->form->getItemByPostVar(
'ap')->getValue(); $i++)
334 $concurrent_dates->add($start);
338 include_once
'./Services/Calendar/classes/class.ilCalendarUtil.php';
342 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
343 include_once
'./Services/Calendar/classes/class.ilCalendarEntry.php';
344 include_once
'./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
345 include_once
'./Services/Booking/classes/class.ilBookingPeriod.php';
346 foreach($concurrent_dates as $dt)
349 $end->increment(
ilDateTime::MINUTE,$this->form->getItemByPostVar(
'du')->getMinutes());
353 $this->form->getItemByPostVar(
'frequence')->getRecurrence()
358 $limit->increment(ilDAteTime::YEAR,1);
362 foreach($date_list as $app_start)
364 $app_end = clone $app_start;
365 $app_end->increment(
ilDateTime::MINUTE,$this->form->getItemByPostVar(
'du')->getMinutes());
369 $entry->setContextId($booking->
getId());
370 $entry->setTitle($this->form->getInput(
'ti'));
371 $entry->setDescription($this->form->getInput(
'de'));
372 $entry->setLocation($this->form->getInput(
'lo'));
373 $entry->setStart($app_start);
374 $entry->setEnd($app_end);
393 $ilCtrl->setParameter($this,
'user_id',
'');
394 $ilTabs->addTab(
'consultation_hours_'.$ilUser->getId(), $this->lng->txt(
'cal_ch_ch'), $this->ctrl->getLinkTarget($this,
'appointmentList'));
398 $ilCtrl->setParameter($this,
'user_id', $user_id);
399 $ilTabs->addTab(
'consultation_hours_'.$user_id, $this->lng->txt(
'cal_ch_ch').
': '.$login, $this->ctrl->getLinkTarget($this,
'appointmentList'));
401 $ilCtrl->setParameter($this,
'user_id',
'');
403 $ilTabs->addTab(
'settings', $this->lng->txt(
'settings'), $this->ctrl->getLinkTarget($this,
'settings'));
405 $ilTabs->activateTab(
'consultation_hours_'.$this->
getUserId());
415 if(!isset(
$_POST[
'apps']))
429 $hidden->setValue(implode(
';',
$_POST[
'apps']));
430 $this->form->addItem($hidden);
432 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
434 $first = array_shift(
$_POST[
'apps']);
437 $this->form->getItemByPostVar(
'ti')->setValue($entry->getTitle());
438 $this->form->getItemByPostVar(
'lo')->setValue($entry->getLocation());
439 $this->form->getItemByPostVar(
'de')->setValue($entry->getDescription());
441 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
444 $this->form->getItemByPostVar(
'bo')->setValue(
$booking->getNumberOfBookings());
445 $this->form->getItemByPostVar(
'tgt')->setValue(
$booking->getTargetObjId());
447 $deadline =
$booking->getDeadlineHours();
448 $this->form->getItemByPostVar(
'dead')->setDays(floor($deadline/24));
449 $this->form->getItemByPostVar(
'dead')->setHours($deadline%24);
451 $this->tpl->setContent($this->form->getHTML());
460 global $ilObjDataCache;
464 if($this->form->checkInput())
466 $this->form->setValuesByPost();
467 $apps = explode(
';',
$_POST[
'apps']);
469 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
470 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
474 $first = array_shift($first);
476 if($this->form->getInput(
'bo') < $entry->getNumberOfBookings())
487 $booking->setNumberOfBookings($this->form->getInput(
'bo'));
489 $deadline = $this->form->getInput(
'dead');
490 $deadline = $deadline[
'dd']*24+$deadline[
'hh'];
491 $booking->setDeadlineHours($deadline);
493 $tgt = $this->form->getInput(
'tgt');
497 if($tgt != $entry->getTargetObjId())
499 $obj_id = $ilObjDataCache->lookupObjId($tgt);
519 $title = $this->form->getInput(
'ti');
521 $description = $this->form->getInput(
'de');
523 foreach($apps as $item_id)
526 $entry->setContextId(
$booking->getId());
529 $entry->setDescription($description);
536 $this->ctrl->redirect($this,
'appointmentList');
538 $this->tpl->setContent($this->form->getHTML());
548 if(!isset(
$_POST[
'apps']))
554 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
556 $this->ctrl->saveParameter($this,array(
'seed',
'app_id',
'dt'));
559 $confirm->setFormAction($this->ctrl->getFormAction($this));
560 $confirm->setHeaderText($this->lng->txt(
'cal_delete_app_sure'));
561 $confirm->setCancel($this->lng->txt(
'cancel'),
'cancel');
563 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
564 foreach(
$_POST[
'apps'] as $entry_id)
570 $confirm->setConfirm($this->lng->txt(
'delete'),
'delete');
571 $confirm->setCancel($this->lng->txt(
'cancel'),
'appointmentList');
573 $tpl->setContent($confirm->getHTML());
579 public function delete()
583 if(!isset(
$_POST[
'apps']))
589 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
590 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
591 foreach(
$_POST[
'apps'] as $entry_id)
597 foreach($entry->getCurrentBookings($entry_id) as
$user_id)
599 $entry->cancelBooking($entry_id,
$user_id);
613 $this->ctrl->redirect($this,
'appointmentList');
623 $ilTabs->clearTargets();
627 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
630 $tpl->setContent($ilCtrl->getHTML($profile));
643 $url = $this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI');
646 else if(isset(
$_GET[
'panel']))
648 $url = $this->ctrl->getLinkTargetByClass(
'ilCalendarPresentationGUI');
653 $url = $this->ctrl->getLinkTarget($this,
'appointmentList');
663 global
$tpl, $ilTabs, $ilHelp;
665 $ilHelp->setScreenId(
"consultation_hours_settings");
666 $ilTabs->activateTab(
'settings');
669 $tpl->setContent($form->getHTML());
680 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
683 $form->setFormAction($this->ctrl->getFormAction($this));
685 $mng =
new ilTextInputGUI($this->lng->txt(
'cal_ch_manager'),
'mng');
686 $mng->
setInfo($this->lng->txt(
'cal_ch_manager_info'));
687 $form->addItem($mng);
691 $form->setTitle($this->lng->txt(
'settings'));
692 $form->addCommandButton(
'updateSettings', $this->lng->txt(
'save'));
705 if($form->checkInput())
707 $mng = $form->getInput(
'mng');
711 $ilCtrl->redirect($this,
'appointmentList');
715 $ilTabs->activateTab(
'settings');
718 $field = $form->getItemByPostVar(
'mng');
719 $field->setValue($mng);
720 $tpl->setContent($form->getHTML());