コード例 #1
0
 /**
  * Edit multiple sequence items
  */
 public function edit()
 {
     global $ilTabs;
     if (!isset($_REQUEST['apps'])) {
         ilUtil::sendFailure($this->lng->txt('select_one'));
         return $this->appointmentList();
     }
     $this->initFormSequence(self::MODE_MULTI);
     if ($_REQUEST['apps'] && !is_array($_REQUEST['apps'])) {
         $_REQUEST['apps'] = explode(';', $_REQUEST['apps']);
     }
     $hidden = new ilHiddenInputGUI('apps');
     $hidden->setValue(implode(';', $_REQUEST['apps']));
     $this->form->addItem($hidden);
     include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
     $first = $_REQUEST['apps'];
     $first = array_shift($_REQUEST['apps']);
     $entry = new ilCalendarEntry($first);
     $this->form->getItemByPostVar('ti')->setValue($entry->getTitle());
     $this->form->getItemByPostVar('lo')->setValue($entry->getLocation());
     $this->form->getItemByPostVar('de')->setValue($entry->getDescription());
     include_once 'Services/Booking/classes/class.ilBookingEntry.php';
     $booking = new ilBookingEntry($entry->getContextId());
     $this->form->getItemByPostVar('bo')->setValue($booking->getNumberOfBookings());
     $ref_ids = array();
     foreach ($booking->getTargetObjIds() as $obj_id) {
         $refs = ilObject::_getAllReferences($obj_id);
         $ref_ids[] = end($refs);
     }
     $this->form->getItemByPostVar('tgt')->setValue(implode(',', $ref_ids));
     $deadline = $booking->getDeadlineHours();
     $this->form->getItemByPostVar('dead')->setDays(floor($deadline / 24));
     $this->form->getItemByPostVar('dead')->setHours($deadline % 24);
     if ($booking->getBookingGroup()) {
         $this->form->getItemByPostVar('grp')->setValue($booking->getBookingGroup());
     }
     $this->tpl->setContent($this->form->getHTML());
 }