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();
85 $ilCtrl->setParameter($this,
'user_id', $this->user_id);
88 switch($this->ctrl->getNextClass())
90 case "ilpublicuserprofilegui":
91 include_once(
'./Services/User/classes/class.ilPublicUserProfileGUI.php');
93 $ilCtrl->forwardCommand($profile);
97 $cmd = $this->ctrl->getCmd(
'appointmentList');
120 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
121 $ilToolbar->addButton($this->lng->txt(
'cal_ch_add_sequence'),$this->ctrl->getLinkTarget($this,
'createSequence'));
123 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursTableGUI.php';
126 $this->tpl->setContent($tbl->getHTML());
138 $this->form->getItemByPostVar(
'bo')->setValue($this->booking->getNumberOfBookings());
139 $this->form->getItemByPostVar(
'ap')->setValue(1);
140 $this->form->getItemByPostVar(
'du')->setMinutes(15);
141 $this->form->getItemByPostVar(
'st')->setDate(
144 $this->tpl->setContent($this->form->getHTML());
154 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
156 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
160 $this->form->setFormAction($this->ctrl->getFormAction($this));
164 case self::MODE_CREATE:
165 $this->form->setTitle($this->lng->txt(
'cal_ch_add_sequence'));
166 $this->form->addCommandButton(
'saveSequence', $this->lng->txt(
'save'));
167 $this->form->addCommandButton(
'appointmentList', $this->lng->txt(
'cancel'));
178 case self::MODE_MULTI:
179 $this->form->setTitle($this->lng->txt(
'cal_ch_multi_edit_sequence'));
180 $this->form->addCommandButton(
'updateMulti', $this->lng->txt(
'save'));
181 $this->form->addCommandButton(
'appointmentList', $this->lng->txt(
'cancel'));
188 $ti->setMaxLength(128);
189 $ti->setRequired(
true);
190 $this->form->addItem($ti);
192 if($a_mode != self::MODE_MULTI)
195 include_once
'./Services/Form/classes/class.ilDateTimeInputGUI.php';
198 $dur->setMinuteStepSize(5);
199 $this->form->addItem($dur);
204 $du->setShowHours(
false);
205 $this->form->addItem($du);
208 $nu =
new ilNumberInputGUI($this->lng->txt(
'cal_ch_num_appointments'),
'ap');
209 $nu->
setInfo($this->lng->txt(
'cal_ch_num_appointments_info'));
211 $nu->setMaxLength(2);
212 $nu->setRequired(
true);
214 $this->form->addItem($nu);
217 include_once(
'./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
226 $this->form->addItem($rec);
232 $nu->setMaxLength(2);
234 $nu->setRequired(
true);
235 $this->form->addItem($nu);
239 $dead->
setInfo($this->lng->txt(
'cal_ch_deadline_info'));
240 $dead->setShowMinutes(
false);
241 $dead->setShowHours(
true);
242 $dead->setShowDays(
true);
243 $this->form->addItem($dead);
248 $lo->setMaxLength(128);
249 $this->form->addItem($lo);
255 $this->form->addItem($de);
259 $tgt->
setInfo($this->lng->txt(
'cal_ch_target_object_info'));
261 $this->form->addItem($tgt);
270 global $ilObjDataCache;
274 if($this->form->checkInput())
276 $this->form->setValuesByPost();
280 $booking->setNumberOfBookings($this->form->getInput(
'bo'));
282 $deadline = $this->form->getInput(
'dead');
283 $deadline = $deadline[
'dd']*24+$deadline[
'hh'];
284 $booking->setDeadlineHours($deadline);
286 $tgt = $this->form->getInput(
'tgt');
289 $obj_id = $ilObjDataCache->lookupObjId($tgt);
293 $this->tpl->setContent($this->form->getHTML());
305 $this->ctrl->redirect($this,
'appointmentList');
309 $this->form->setValuesByPost();
310 $this->tpl->setContent($this->form->getHTML());
321 include_once
'./Services/Calendar/classes/class.ilDateList.php';
323 $start = clone $this->form->getItemByPostVar(
'st')->getDate();
324 for($i = 0; $i < $this->form->getItemByPostVar(
'ap')->getValue(); $i++)
326 $concurrent_dates->add($start);
330 include_once
'./Services/Calendar/classes/class.ilCalendarUtil.php';
334 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
335 include_once
'./Services/Calendar/classes/class.ilCalendarEntry.php';
336 include_once
'./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
337 include_once
'./Services/Booking/classes/class.ilBookingPeriod.php';
338 foreach($concurrent_dates as $dt)
341 $end->increment(
ilDateTime::MINUTE,$this->form->getItemByPostVar(
'du')->getMinutes());
345 $this->form->getItemByPostVar(
'frequence')->getRecurrence()
350 $limit->increment(ilDAteTime::YEAR,1);
354 foreach($date_list as $app_start)
356 $app_end = clone $app_start;
357 $app_end->increment(
ilDateTime::MINUTE,$this->form->getItemByPostVar(
'du')->getMinutes());
361 $entry->setContextId($booking->
getId());
362 $entry->setTitle($this->form->getInput(
'ti'));
363 $entry->setDescription($this->form->getInput(
'de'));
364 $entry->setLocation($this->form->getInput(
'lo'));
365 $entry->setStart($app_start);
366 $entry->setEnd($app_end);
383 global $ilTabs, $ilUser,
$ilCtrl;
385 $ilTabs->addTab(
'consultation_hours_'.$ilUser->getId(), $this->lng->txt(
'cal_ch_ch'), $this->ctrl->getLinkTarget($this,
'appointmentList'));
389 $ilCtrl->setParameter($this,
'user_id', $user_id);
390 $ilTabs->addTab(
'consultation_hours_'.$user_id, $this->lng->txt(
'cal_ch_ch').
': '.$login, $this->ctrl->getLinkTarget($this,
'appointmentList'));
391 $ilCtrl->setParameter($this,
'user_id',
'');
394 $ilTabs->addTab(
'settings', $this->lng->txt(
'settings'), $this->ctrl->getLinkTarget($this,
'settings'));
396 $ilTabs->activateTab(
'consultation_hours_'.$this->
getUserId());
406 if(!isset(
$_POST[
'apps']))
420 $hidden->setValue(implode(
';',
$_POST[
'apps']));
421 $this->form->addItem($hidden);
423 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
425 $first = array_shift(
$_POST[
'apps']);
428 $this->form->getItemByPostVar(
'ti')->setValue($entry->getTitle());
429 $this->form->getItemByPostVar(
'lo')->setValue($entry->getLocation());
430 $this->form->getItemByPostVar(
'de')->setValue($entry->getDescription());
432 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
435 $this->form->getItemByPostVar(
'bo')->setValue(
$booking->getNumberOfBookings());
436 $this->form->getItemByPostVar(
'tgt')->setValue(
$booking->getTargetObjId());
438 $deadline =
$booking->getDeadlineHours();
439 $this->form->getItemByPostVar(
'dead')->setDays(floor($deadline/24));
440 $this->form->getItemByPostVar(
'dead')->setHours($deadline%24);
442 $this->tpl->setContent($this->form->getHTML());
451 global $ilObjDataCache;
455 if($this->form->checkInput())
457 $this->form->setValuesByPost();
458 $apps = explode(
';',
$_POST[
'apps']);
460 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
461 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
465 $first = array_shift($first);
467 if($this->form->getInput(
'bo') < $entry->getNumberOfBookings())
478 $booking->setNumberOfBookings($this->form->getInput(
'bo'));
480 $deadline = $this->form->getInput(
'dead');
481 $deadline = $deadline[
'dd']*24+$deadline[
'hh'];
482 $booking->setDeadlineHours($deadline);
484 $tgt = $this->form->getInput(
'tgt');
488 if($tgt != $entry->getTargetObjId())
490 $obj_id = $ilObjDataCache->lookupObjId($tgt);
510 $title = $this->form->getInput(
'ti');
512 $description = $this->form->getInput(
'de');
514 foreach($apps as $item_id)
517 $entry->setContextId(
$booking->getId());
520 $entry->setDescription($description);
527 $this->ctrl->redirect($this,
'appointmentList');
529 $this->tpl->setContent($this->form->getHTML());
539 if(!isset(
$_POST[
'apps']))
545 include_once(
'./Services/Utilities/classes/class.ilConfirmationGUI.php');
547 $this->ctrl->saveParameter($this,array(
'seed',
'app_id',
'dt'));
550 $confirm->setFormAction($this->ctrl->getFormAction($this));
551 $confirm->setHeaderText($this->lng->txt(
'cal_delete_app_sure'));
552 $confirm->setCancel($this->lng->txt(
'cancel'),
'cancel');
554 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
555 foreach(
$_POST[
'apps'] as $entry_id)
561 $confirm->setConfirm($this->lng->txt(
'delete'),
'delete');
562 $confirm->setCancel($this->lng->txt(
'cancel'),
'appointmentList');
564 $tpl->setContent($confirm->getHTML());
570 public function delete()
574 if(!isset(
$_POST[
'apps']))
580 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
581 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
582 foreach(
$_POST[
'apps'] as $entry_id)
593 $this->ctrl->redirect($this,
'appointmentList');
603 $ilTabs->clearTargets();
608 $ilTabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI'));
611 else if(isset(
$_GET[
'panel']))
613 $ilTabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTargetByClass(
'ilCalendarPresentationGUI'));
618 $ilTabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'appointmentList'));
623 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
625 $tpl->setContent($profile->getHTML());
633 global
$tpl, $ilTabs;
635 $ilTabs->activateTab(
'settings');
638 $tpl->setContent($form->getHTML());
647 global
$ilDB, $ilUser;
649 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
652 $form->setFormAction($this->ctrl->getFormAction($this));
654 $mng =
new ilTextInputGUI($this->lng->txt(
'cal_ch_manager'),
'mng');
655 $mng->
setInfo($this->lng->txt(
'cal_ch_manager_info'));
656 $form->addItem($mng);
660 $form->setTitle($this->lng->txt(
'settings'));
661 $form->addCommandButton(
'updateSettings', $this->lng->txt(
'save'));
674 if($form->checkInput())
676 $mng = $form->getInput(
'mng');
680 $ilCtrl->redirect($this,
'appointmentList');
684 $ilTabs->activateTab(
'settings');
687 $field = $form->getItemByPostVar(
'mng');
688 $field->setValue($mng);
689 $tpl->setContent($form->getHTML());