Example #1
0
 public function createComponentEntryCopyForm()
 {
     $form = new Form();
     $raceentry = $form->addMultiSelect('raceentry', 'Přihlášky závodu:', $this->entry->listNames())->addRule(Form::FILLED, "Nic není označeno.");
     $raceentry->getControlPrototype()->size(25);
     $globalentry = $form->addMultiSelect('globalentry', 'DB závodníků :', $this->entry->listNames(Entry::GLOBTB))->addRule(Form::FILLED, "Nic není označeno.");
     $globalentry->getControlPrototype()->size(25);
     $form->addRadioList('si_collision', 'Stejné SI:', self::$collision_options)->setValue(Entry::COLL_ADD);
     $form->addSubmit('torace', '<span class="glyphicon glyphicon-arrow-left"></span>')->setValidationScope([$globalentry])->getControlPrototype()->addClass('btn-default');
     $form->addSubmit('toglobal', '<span class="glyphicon glyphicon-arrow-right"></span>')->setValidationScope([$raceentry])->getControlPrototype()->addClass('btn-default');
     $form->onSuccess[] = [$this, 'entryCopyFormSucceeded'];
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
 protected function createComponentForm()
 {
     $form = new Form();
     $form->addText('description', 'Popis výčetky:')->setRequired('Vyplňte pole Popis Výčetky.')->setAttribute('placeholder', 'Vyplňte popis výčetky');
     $form->addMultiSelect('recipients', 'Pro uživatele:', null, 7)->setRequired('Vyberte alespoň jednoho příjemce.')->setItems($this->users);
     $form->addSubmit('send', 'Odeslat výčetku');
     $form->onSuccess[] = [$this, 'processListingSharing'];
     $form->onSuccess[] = [$this, 'sendNotifications'];
     return $form;
 }
Example #3
0
 protected function createComponentOsobaEditForm()
 {
     $form = new Form();
     $form->addText('jmeno', 'Jméno a příjmení')->addRule(Form::FILLED, 'Jméno a příjmení musí být vyplněno.');
     $form->addText('email', 'Email')->addRule(Form::EMAIL, 'Email musí být validní.');
     $form->addText('cisloJednotky', 'Číslo jednotky');
     $form->addCheckbox('chceMaily', 'Dostávat emaily?');
     if ($this->user->isInRole('spravce')) {
         $form->addMultiSelect('role', 'Role/oprávnění:', Model\UserManager::$roleDiakritika)->setAttribute('class', 'form-control');
     }
     $form->addHidden('id');
     $form->addSubmit('send', 'Uložit');
     if ($this->presenter->action == 'edit') {
         $form->addButton('delete', 'Smazat')->setAttribute('data-toggle', 'modal')->setAttribute('data-target', '#modal-delete')->setAttribute('class', 'btn btn-danger');
     }
     $form->onSuccess[] = array($this, 'osobaEditFormSucceeded');
     //$form->onValidate[] = array($this, 'validateLicenceForm');
     $form->setRenderer(new BootstrapRenderer());
     return $form;
 }
Example #4
0
 /**
  * @return Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->addText('addon', 'Addon URL')->addRule($form::REQUIRED, 'URL is required')->addRule($form::URL, 'URL is not valid')->addRule($form::PATTERN, 'Only GitHub urls are allowed', self::GITHUB_REGEX);
     $tags = $this->tagRepository->fetchPairs();
     $form->addMultiSelect('tags', 'Tags', $tags);
     $form->addSubmit('add', 'Add addon');
     $form->onSuccess[] = function (Form $form) {
         $matches = Strings::match($form->values->addon, '#' . self::GITHUB_REGEX . '#');
         if (!$matches) {
             $this->presenter->flashMessage('Invalid addon name.', 'warning');
             $this->presenter->redirect('this');
             return;
         }
         list($all, $owner, $name) = $matches;
         $addon = new Addon();
         $this->addonRepository->attach($addon);
         $addon->state = Addon::STATE_QUEUED;
         $addon->createdAt = new DateTime();
         $addon->owner = $owner;
         $addon->name = $name;
         $addon->github = new Github();
         if ($form->values->tags) {
             $addon->tags->add($form->values->tags);
         }
         try {
             $this->addonRepository->persistAndFlush($addon);
             $this->presenter->flashMessage('Addon successful added to the cron process queue. Thank you.', 'info');
         } catch (UniqueConstraintViolationException $e) {
             $this->presenter->flashMessage('There is already addon "' . ($owner . '/' . $name) . '" in our database.', 'warning');
         } catch (PDOException $e) {
             $this->presenter->flashMessage('Database error has occurred.', 'danger');
         }
         $this->presenter->redirect('this');
     };
     return $form;
 }
Example #5
0
 public function createComponentSubjectForm()
 {
     $form = new AppForm();
     $form->setTranslator($this->translator);
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'div class="well"';
     $renderer->wrappers['pair']['container'] = 'div  class="control-group"';
     $renderer->wrappers['label']['container'] = 'div class="control-label"';
     $renderer->wrappers['control']['container'] = 'div class="controls"';
     $renderer->wrappers['error']['container'] = 'ul class="alert alert-error"';
     $form->getElementPrototype()->addAttributes(array('class' => 'form-horizontal'));
     $form->addText('name', 'Name', null, 255)->setRequired('Name must be filled.')->setAttribute('placeholder', 'Write name of your subject')->getControlPrototype()->class('span6');
     $form->addText('street', 'Street', null, 127)->setRequired('Street must bu filled.')->setAttribute('placeholder', 'Write street when your subject is located')->getControlPrototype()->class('span6');
     $form->addSelect('locality_id', 'Locality', $this->system->getLocalitiesToSelect());
     $form->addText('locality_alt', 'New locality');
     $form['locality_id']->setPrompt("--- Choose your option ---")->setOption('description', 'Nenašli jste v seznamu svoji lokalitu? Napište její název a kraj, kde se nachází do následujícího pole.')->setAttribute('placeholder', 'Choose locality')->getControlPrototype()->class('span6 chzn');
     $form['locality_alt']->setAttribute('placeholder', 'Write new locality')->getControlPrototype()->class('span6');
     $form['locality_id']->addConditionOn($form['locality_alt'], ~Form::FILLED, TRUE)->addRule(FORM::FILLED, 'Locality must be filled');
     $form['locality_alt']->addConditionOn($form['locality_id'], ~Form::FILLED, TRUE)->addRule(FORM::FILLED, 'Alternative locality');
     //$form->addRequestButton('addlocality', 'Add new locality', ':Admin:System:Localities:add');
     //$form['addlocality']->getControlPrototype()->class('btn_add');
     $form->addText('locality_nickname', 'Local name', null, 127)->setAttribute('placeholder', 'Write local name of your locality')->getControlPrototype()->class('span6');
     $form->addText('zip', 'Zip', null, 10)->setOption('description', 'Např.: 12345')->setAttribute('placeholder', 'Write ZIP code')->getControlPrototype()->class('span6');
     $form->addText('map_coords', 'Map coordinates', null, 255)->setOption('description', 'Například: "Loc: 50°5\'42.12"N,14°29\'14.75"E". Vyhledejte na http://www.mapy.cz vaši adresu a vpravo klikněte na odkaz GPS')->addRule(FORM::FILLED, 'Map coordinates must be filled.')->setAttribute('placeholder', 'Paste here coordinates of your subject')->getControlPrototype()->class('span6');
     $form->addText('web', 'Website', null, 127)->setAttribute('placeholder', 'Have your subject website? Put it in here')->setOption('description', 'http://domain.tld/foo')->addCondition(FORM::FILLED)->addRule(FORM::URL, 'Website je vyplněna v nesprávném formátu.');
     $form['web']->getControlPrototype()->class('span6');
     $form->addText('facebook', 'Facebook Page', null, 127)->setAttribute('placeholder', 'Do you have Facebook Page? Put here its URL')->setOption('description', 'http://domain.tld/foo')->addCondition(FORM::FILLED)->addRule(FORM::URL, 'Facebook Page je vyplněna v nesprávném formátu.');
     $form['facebook']->getControlPrototype()->class('span6');
     $form->addText('email', 'E-mail', null, 127)->setAttribute('placeholder', 'Write contact e-mail or e-mail for reservations')->setOption('description', '*****@*****.**')->addCondition(FORM::FILLED)->addRule(FORM::EMAIL, 'E-mail je vyplněn v nesprávném formátu.');
     $form['email']->getControlPrototype()->class('span6');
     $form->addText('phone', 'Phone', null, 127)->setAttribute('placeholder', 'Write contact phone number or phone number for reservations')->setOption('description', 'Například: +420 123 456 789 nebo 123 456 789')->addCondition(Form::FILLED)->addRule(FORM::REGEXP, 'Telephone number is not valid.', '/^(\\+420)? ?\\d{3} ?\\d{3} ?\\d{3}$/');
     $form['phone']->getControlPrototype()->class('span6');
     $form->addTextArea('description', 'Description')->setAttribute('placeholder', 'Please, describe your venue. It sels.')->getControlPrototype()->class('span6');
     $categories = new \Model\Categories($this->ns);
     $items = $categories->getGlobalCategoriesArray('subject');
     $form->addMultiSelect('categories', 'Categories', $items)->setAttribute('data-placeholder', 'Choose one category. Or more.')->getControlPrototype()->class('span6 chzn');
     $form->addText('age_min', 'Min. age', null, 10)->addCondition(FORM::FILLED)->addRule(FORM::INTEGER, 'Věk musí být uveden v celých letech.');
     $form->addText('age_max', 'Max. age', null, 10)->addCondition(FORM::FILLED)->addRule(FORM::INTEGER, 'Věk musí být uveden v celých letech.');
     $form->addTextArea('openhours', 'Opening hours')->setAttribute('placeholder', 'When do you have open a close.')->getControlPrototype()->class('span6');
     $form->addTextArea('pricelist', 'Prices')->setAttribute('placeholder', 'Write some prices')->getControlPrototype()->class('span6');
     $form->addCheckbox('stroller', 'Stroller')->setDefaultValue(0);
     $form->addTextArea('notice', 'Notice for administrator')->setOption('description', 'Chcete-li nám ke zpracování vašeho profilu na PeknyDen.cz něco sdělit.')->getControlPrototype()->class('span9');
     $form->addHidden('user_id', $this->user->getId());
     $form->addHidden('visible');
     $form->addSubmit('save', 'Save Subject')->getControlPrototype()->class('btn btn-primary');
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = array($this, 'cancelClicked');
     $form['cancel']->getControlPrototype()->class('btn btn-grey btn-small');
     $form->onSuccess[] = array($this, 'saveSubject');
     return $form;
 }
Example #6
0
 /**
  * @Actions newMessage
  */
 protected function createComponentNewMessageForm()
 {
     $form = new Form();
     $form->addText('subject', 'Předmět', 35, 80)->setRequired('Vyplňte prosím předmět zprávy.');
     $form->addTextArea('message', 'Zpráva', 50, 12)->setRequired('Vyplňte prosím text zprávy.')->addRule(Form::MAX_LENGTH, 'Zpráva může obsahovat maximálně %d znaků.', 2000);
     $form->addMultiSelect('receivers', 'Příjemci', $this->userManager->findAllUsers([$this->user->id]), 13)->setRequired('Vyberte alespoň jednoho příjemce.');
     $form->addCheckbox('isSystemMessage', 'Odeslat jako systémovou zprávu');
     $form->addSubmit('send', 'Odeslat');
     $form->getElementPrototype()->id = 'new-message-form';
     $form->onSuccess[] = $this->processNewMessageForm;
     return $form;
 }