public function isValidEvent(ilCalendarEntry $a_event) { global $ilUser; $booking = new ilBookingEntry($a_event->getContextId()); // portfolio embedded: filter by consultation hour groups? if (!is_array($this->group_ids) || in_array($booking->getBookingGroup(), $this->group_ids)) { // do not filter against course/group in portfolio if ($this->cats->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) { $booking->setTargetObjIds(null); } if (($this->user_id == $ilUser->getId() || !$booking->isBookedOut($a_event->getEntryId(), true)) && $booking->isTargetObjectVisible($this->cats->getTargetRefId())) { return true; } } return false; }
/** * 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()); }