Beispiel #1
0
 public function testAddingOfEvent()
 {
     $event = new Tx_CzSimpleCal_Domain_Model_Event();
     $this->timeline->setEvent($event);
     $this->timeline->add(array('start' => strtotime('2009-02-13 23:31:30GMT'), 'end' => strtotime('2009-02-13 23:31:31GMT')));
     $current = $this->timeline->current();
     self::assertArrayHasKey('event', $current, 'data gets key "event"');
     self::assertArrayHasKey('pid', $current, 'data gets key "pid"');
 }
Beispiel #2
0
 /**
  * build the recurrance for all events paying no attention to exceptions 
  * 
  * @return Tx_CzSimpleCal_Recurrance_Timeline_Event
  */
 protected function buildEventTimeline()
 {
     $type = $this->event->getRecurranceType();
     if (empty($type)) {
         throw new RuntimeException('The recurrance_type should not be empty.');
     }
     $className = 'Tx_CzSimpleCal_Recurrance_Type_' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($type);
     if (!class_exists($className)) {
         throw new BadMethodCallException(sprintf('The class %s does not exist for creating recurring events.', $className));
     }
     $class = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className);
     if (!$class instanceof Tx_CzSimpleCal_Recurrance_Type_Base) {
         throw new BadMethodCallException(sprintf('The class %s does not implement the Tx_CzSimpleCal_Recurrance_Type_Base.', get_class($class)));
     }
     $eventTimeline = new Tx_CzSimpleCal_Recurrance_Timeline_Event();
     $eventTimeline->setEvent($this->event);
     return $class->build($this->event, $eventTimeline);
 }
 protected function setEventData($data)
 {
     foreach ($data as $timespan) {
         $this->events->add($timespan);
     }
 }