Beispiel #1
0
 /**
  * @param EventInterface $event
  *
  * @return bool
  */
 public function canAccept(EventInterface $event)
 {
     //First check if the time is the same (within a certain threshold)
     $earliest = clone $this->start;
     $earliest->modify('-' . (self::MAX_ROW_RANGE_MINUTES + 1) . ' minutes');
     $latest = clone $this->start;
     $latest->modify('+' . (self::MAX_ROW_RANGE_MINUTES + 1) . ' minutes');
     if ($event->getStartTime() <= $earliest || $event->getStartTime() >= $latest) {
         return false;
     }
     //Now see if there's space in the row
     if ($event instanceof SingleDayEventInterface) {
         $index = $this->calculateIndex($event->getDate());
         return $this->rangeIsFree($index, $index);
     } elseif ($event instanceof MultiDayEventInterface) {
         $start_index = $this->calculateIndex($event->getStartDate());
         $end_index = $this->calculateIndex($event->getEndDate());
         return $this->rangeIsFree($start_index, $end_index);
     }
 }
Beispiel #2
0
 protected function createRow(EventInterface $event)
 {
     return new DiaryRow($event->getStartTime(), $this->getStartAt());
 }