Ejemplo n.º 1
0
 protected function instantiateRecurrences(Event $event)
 {
     if (empty($event->recurring_dates) || empty($event->start)) {
         return;
     }
     $dates = array_map('trim', explode(';', $event->recurring_dates));
     foreach ($dates as $start) {
         $newEvent = $this->newEntity($event->toArray(), ['accessibleFields' => ['id' => false, 'recurring_dates' => false, 'created' => false, 'modified' => false, 'created_by' => false, 'modified_by' => false]]);
         $newEvent->parent_event_id = $event->id;
         $newEvent->start_day = $start;
         $dateDiff = $event->start->diffInDays($newEvent->start, false);
         if ($dateDiff < 1 || $dateDiff > 366) {
             //Sanity check!
             //Recurrences should all be *after* the original date
             //and within a year of the original date
             continue;
         }
         $this->save($newEvent);
     }
     //Clear original list of recurring dates so we don't re-instantiate
     $event->recurring_dates = '';
     $this->save($event);
 }
Ejemplo n.º 2
0
 /**
  * Sestaveni formulare
  * @return \App\Form\BaseForm
  */
 public function create()
 {
     $form = new \App\Form\BaseForm();
     $form->setTranslator($this->translator);
     $form->addGroup('')->setOption('container', Html::el('fieldset', 'class="has-help"'));
     $form->addText('name', 'event.description.name')->setRequired('event.description.nameRequired')->addRule(Form::FILLED, 'event.description.nameFilled')->setOption('description', Html::el('p', $this->translator->translate('event.description.nameDescription'))->addAttributes(array('id' => 'event-name-desc')));
     $form->addAddressInput('address', 'event.description.address')->setRequired('event.description.addressRequired')->addRule(Form::FILLED, 'event.description.addressFilled');
     $form->addDateTimeRange('dateTimeRange', 'event.description.dateTimeRange')->addRule(Form::FILLED, 'event.description.dateFromFilled');
     $form->addImageUpload('logo', 'event.description.logo')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'event.description.logoImage');
     $form->addTextArea('description', 'event.description.description')->setRequired('event.description.descriptionRequired')->addRule(Form::FILLED, 'event.description.descriptionFilled');
     $form->addSelect('eventType', 'event.description.eventType', $this->eventService->selectboxes['eventType'])->setRequired('event.description.eventTypeRequired')->setPrompt('event.description.eventTypePrompt');
     $form->addSelect('eventCategory', 'event.description.eventCategory', Event::getCategories())->setRequired('event.description.eventCategoryRequired')->setPrompt('event.description.eventCategoryPrompt');
     $form->addText('organizer', 'event.description.organizer')->setRequired('event.description.organizerRequired')->addRule(Form::FILLED, 'event.description.organizerFilled');
     $form->addTextArea('organizerDescription', 'event.description.organizerDescription')->setRequired('event.description.organizerDescriptionRequired')->addRule(Form::FILLED, 'event.description.organizerDescriptionFilled');
     $form->addHidden('id');
     $form->addSubmit('save', 'event.description.saveChanges');
     $form->addSubmit('notSave', 'event.description.cancelChanges')->setAttribute('type', 'reset');
     return $form;
 }
Ejemplo n.º 3
0
 /**
  * Uloží nakreslenou scénu
  * 
  * @param strong $postData
  * @param \App\Model\Entity\Event $event
  */
 function saveScene($postData, $event)
 {
     $scenes = $event->getEventScenes();
     if (empty($scenes)) {
         $scene = new \App\Model\Entity\EventScene();
         $scene->setEvent($event);
         $scene->setName('Scéna 1');
         $scene->setScene($postData);
         $this->em->persist($scene);
         $event->addEventScene($scene);
     } else {
         $scene = $scenes[0];
         $scene->setScene($postData);
         $this->em->persist($scene);
         if ($event->hasEventScene($scene)) {
             $event->removeEventScene($scene);
         }
         $event->addEventScene($scene);
     }
     $this->em->persist($event);
     return $this->saveEvent($event);
 }
Ejemplo n.º 4
0
 /**
  * Má událost prodané lístky?
  *
  * @param App\Model\Entity\Event $event
  */
 function hasSoldTickets($event)
 {
     foreach ($event->getTicketInfos() as $ticketInfo) {
         if (count($ticketInfo->getTickets()) > 0) {
             return TRUE;
         }
     }
     return FALSE;
 }