예제 #1
0
 /**
  * Creates an event corresponding to this calendar item.
  *
  * @param DateTime $dateStart
  * @param DateTime $dateEnd
  *
  * @return Event
  */
 protected function createEvent(DateTime $dateStart, DateTime $dateEnd)
 {
     $event = new Event();
     $event->setTitle($this->title);
     $event->setDescription($this->description);
     $event->setDateStart($dateStart);
     $event->setDateEnd($dateEnd);
     return $event;
 }
예제 #2
0
 /**
  * Compares two dates.
  *
  * @param Event $eventA
  * @param Event $eventB
  *
  * @return int
  */
 protected function dateCompare(Event $eventA, Event $eventB)
 {
     $dateStartA = $eventA->getDateStart()->format('YmdHis');
     $dateEndA = $eventA->getDateEnd()->format('YmdHis');
     $dateStartB = $eventB->getDateStart()->format('YmdHis');
     $dateEndB = $eventB->getDateEnd()->format('YmdHis');
     $diff = strcmp($dateStartA, $dateStartB);
     if ($diff == 0) {
         $diff = strcmp($dateEndA, $dateEndB);
     }
     return $diff;
 }