Exemplo n.º 1
0
 protected function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addText('subject_name', 'Subject', null, 255)->setDisabled();
     $form->addText('account_name', 'Account', null, 255)->setDisabled();
     $form->addTextArea('description', 'Description')->getControlPrototype()->class('texyla');
     $form->addText('author', 'Author', null, 255);
     $form->addText('email', 'E-mail', null, 255);
     $form->addText('url', 'URL', null, 255);
     $form->addText('created', 'Created', null, 255)->setDisabled();
     $form->addCheckbox('visible', 'Visible')->setDefaultValue(1);
     $form->addCheckbox('approved', 'Approved')->setDefaultValue(1);
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     $form->onSuccess[] = array($this, 'saveItem');
     return $form;
 }
Exemplo n.º 2
0
 public function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addGroup('User');
     /*
     		  if ($this->user->isAllowed('users','edit')) {
     		  $form->addText('login', 'Login:'******'username', 'Login:'******'Prosím, vlož username');
     //}
     $form->addText('name', 'Name:')->addRule(Form::FILLED, 'Prosím, vlož jméno');
     $form->addText('surname', 'Surname:')->addRule(Form::FILLED, 'Prosím, vlož příjmení');
     $form->addSelect('role', 'Role:', $this->items->getRolesToSelect())->addRule(Form::FILLED, 'Please, select right user role.');
     $form->addCheckbox('active', 'Active:');
     $form->addSelect('country_id', 'Country:', $this->system->getCountriesToSelect())->addRule(Form::FILLED, 'Prosím, vlož stát')->setValue(208);
     $form->addRadioList('sex', 'Sex:', $this->system->getSexToSelect())->addRule(Form::FILLED, 'Prosím, vyber pohlaví');
     $form->addGroup('Additional data');
     $form->addText('email', 'E-mail:')->setEmptyValue('@')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'E-mail is not valid');
     $form->addText('homepage', 'Homepage:')->addCondition(Form::FILLED)->addRule(Form::URL, 'Homepage is not valid');
     $form->addText('telephone', 'telephone:');
     $form->addText('street', 'Street:');
     $form->addText('city', 'City:');
     $form->addText('zip', 'Zip:');
     $form->addText('icq', 'ICQ:');
     $form->addText('aim', 'AIM:');
     $form->addText('skype', 'Skype:');
     $form->addText('jabber', 'Jabber:');
     $form->addText('birthday', 'Birthday:');
     $form->addTextArea('description', 'Description:');
     $form->addGroup('Password');
     $form->addPassword('heslokreslo', 'Password:'******'password1', 'Password again:')->addConditionOn($form['heslokreslo'], Form::FILLED, TRUE)->addRule(Form::FILLED, 'Prosím, vlož heslo znovu');
     /*
      if ($this->user->isAllowed('users')) {
      $this['form']->addPassword('heslokreslo', 'Heslo:');
      } else {
      $this['form']->addPassword('password', 'Heslo:')->addRule(Form::FILLED, 'Prosím, vlož heslo');
      }
      $this['form']->addPassword('password1', 'Heslo znovu:')
      ->addConditionOn($this['form']['heslokreslo'], Form::FILLED, TRUE)
      ->addRule(Form::FILLED, 'Prosím, vlož heslo znovu');
     */
     /*
      if ($this->getView() == 'add')
      {
      $form->addSubmit('add', 'Save & Add next');
      $form->addSubmit('leave', 'Save & Leave');
      } else {
      $form->addHidden('id');
      $form->addSubmit('leave', 'Save & Leave');
      $form->addSubmit('add', 'Save & Add new');
      }
     
     
      $form->addSubmit('save', 'Save');
      $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
      $form['cancel']->getControlPrototype()->class('cancel');
     */
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     $form->onSuccess[] = array($this, 'saveItem');
     return $form;
 }
Exemplo n.º 3
0
 public function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addUpload('file', 'File')->addRule(FORM::MAX_FILE_SIZE, 'File is too big! Please, choose smaller one.', 3 * 1024 * 1024);
     $form->addText('name', 'Name')->addRule(Form::FILLED, 'Please, insert name of the file.');
     $form->addTextArea('description', 'Description');
     $form->addTextArea('note', 'Note');
     $form->addSelect('user_id', 'Author', $this->system->getAccountsToSelect())->value = $this->user->isLoggedIn() ? $this->user->getIdentity()->id : NULL;
     $form->addCheckbox('visible', 'visible')->setDefaultValue(1);
     $form->addCheckbox('lock', 'locked');
     $form->addHidden('backlink');
     $form->onSuccess[] = array($this, 'saveItem');
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     return $form;
 }
Exemplo n.º 4
0
 public function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addText('name', 'Name')->setAttribute('size', 255)->addRule(FORM::FILLED, 'Name must be filled.');
     //$form->addText('name_short', 'Short name', 127, 127);
     $form->addText('zip', 'Zip')->setAttribute('size', 5)->setOption('description', 'Např.: 12345')->addRule(FORM::FILLED, 'Zip must be filled.');
     $form->addSelect('shire_id', 'Shire', $this->system->getShiresToSelect())->addRule(FORM::FILLED, 'Shire must be filled.')->setPrompt('---');
     //$form->addText('map_coords', 'Map coordinates')->setOption('description', 'Loc: 50°5\'42.12"N,14°29\'14.75"E');
     $form->onSuccess[] = array($this, 'saveItem');
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     return $form;
 }
Exemplo n.º 5
0
 public function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addText('email', 'E-mail')->addRule(Form::EMAIL, 'Please, insert right e-mail address.');
     $form->addCheckbox('is_active', 'Is Active');
     $form->addHidden('backlink');
     $form->onSuccess[] = array($this, 'saveItem');
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     return $form;
 }
Exemplo n.º 6
0
 public function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addText('name', 'Name')->addRule(Form::FILLED, 'Please, enter name of gallery.');
     $form->addTextarea('description', 'Description');
     $form->addSelect('account_id', 'Owner', $this->system->getAccountsToSelect())->value = $this->user->isLoggedIn() ? $this->user->getIdentity()->id : NULL;
     $form->addCheckbox('visible', 'Visibility');
     $form->onSuccess[] = array($this, 'saveItem');
     if ($this->getView() == 'add') {
         $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
         $form->addSubmit('leave', 'Save & Leave');
     } else {
         $form->addHidden('id');
         $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
         $form->addSubmit('add', 'Save & Add new');
     }
     $form->addSubmit('save', 'Save');
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
     $form['cancel']->getControlPrototype()->class('cancel');
     return $form;
 }
Exemplo n.º 7
0
 protected function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addGroup('Basics');
     $form->addText('name', 'Name', null, 255)->addRule(Form::FILLED, 'Name must be filled');
     $form->addSelect('locality_id', 'Locality', $this->system->getLocalitiesToSelect())->addRule(FORM::FILLED, 'Locality must be filled')->setPrompt("---");
     $form->addRequestButton('addlocality', 'Add new locality', ':Admin:System:Localities:add');
     $form['addlocality']->getControlPrototype()->class('btn_add');
     $form->addText('locality_alt', 'New locality from user', null, 255);
     $form->addText('street', 'Street', null, 127);
     $form->addText('locality_nickname', 'Locality for web', null, 127);
     $form->addText('zip', 'Zip', null, 10)->setOption('description', 'Např.: 12345');
     $form->addText('web', 'Website', null, 127)->setOption('description', 'http://domain.tld/foo')->addCondition(FORM::FILLED)->addRule(FORM::URL, 'Website je vyplněna v nesprávném formátu.');
     $form->addText('facebook', 'Facebook Page', null, 127)->setOption('description', 'http://domain.tld/foo')->addCondition(FORM::FILLED)->addRule(FORM::URL, 'Facebook Page je vyplněna v nesprávném formátu.');
     $form->addText('email', 'E-mail', null, 127)->setOption('description', '*****@*****.**')->addCondition(FORM::FILLED)->addRule(FORM::EMAIL, 'E-mail je vyplněn v nesprávném formátu.');
     $form->addText('phone', 'Phone', null, 127)->setOption('description', '+420 123 456 789, +420 123 456 789');
     $form->addText('map_coords', 'Map coordinates', null, 255)->setOption('description', 'Loc: 50°5\'42.12"N,14°29\'14.75"E')->addRule(FORM::FILLED, 'Map coordinates must be filled.');
     $form->addTextArea('description', 'Description')->getControlPrototype()->class('texyla');
     $categories = new \Model\Categories($this->ns);
     $items = $categories->getGlobalCategoriesArray('subject', true);
     $form->addMultiSelect('categories', 'Categories', $items);
     $form->addGroup('Settings');
     $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');
     $form->addTextArea('pricelist', 'Prices');
     $form->addCheckbox('stroller', 'Stroller')->setDefaultValue(0);
     $form->addCheckbox('visible', 'Visible')->setDefaultValue(1);
     $form->addCheckbox('show_in_catalogue', 'Show in catalogue')->setDefaultValue(1);
     $form->addCheckbox('show_in_calendar', 'Show in calendar')->setDefaultValue(1);
     $form->addCheckbox('approved', 'Approved')->setDefaultValue(1);
     $form->addTextArea('notice', 'Notice');
     $form->addGroup('Recommended');
     $form->addCheckbox('ad', 'Recommended');
     $form->addCheckbox('ad_onhomepage', 'On homepage');
     $form->addText('ad_name', 'Alternative name (40 chars)');
     $form->addText('ad_description', 'Alternative description');
     $form->addSelect('ad_category', 'Only in category', $categories->getGlobalCategoriesArray('subject', null, false))->setPrompt('---');
     $form->addSelect('ad_shire', 'Only in shire', $this->system->getShiresToSelect('name', false))->setPrompt('---');
     $form->addGroup('Buttons :)');
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         //todo K cemu to je? Je to potreba?
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     $form->onSuccess[] = array($this, 'saveItem');
     return $form;
 }
Exemplo n.º 8
0
 public function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->onSuccess[] = array($this, 'saveItem');
     $form->addText('name', 'Name')->addRule(Form::FILLED, 'Name must be filled.');
     $form->addText('name_short', 'Short name');
     $form->addTextArea('description', 'Description')->addRule(Form::FILLED, 'Description must be  filled.');
     $form->addTextArea('description_short', 'Short description');
     $form->addCheckbox('visible', 'Is visible?');
     $form->addCheckbox('subject', 'category is for subjects');
     $form->addCheckbox('event', 'category is for events');
     $form->addText('shift', 'Shift')->setEmptyValue('0')->addCondition(Form::FILLED)->addRule(Form::INTEGER, 'Shift must be integer.');
     $form->addSelect('color', 'Color', array('blue' => 'Blue', 'darkblue' => 'Dark Blue', 'green' => 'Green', 'darkgreen' => 'Dark Green', 'yellow' => 'Yellow', 'red' => 'Red', 'pink' => 'Pink', 'orange' => 'Orange'))->setPrompt('-- Select color --');
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     return $form;
 }
Exemplo n.º 9
0
 protected function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->setTranslator($this->translator);
     $form->addGroup('Basics');
     $form->addText('name', 'Name')->setAttribute('maxlength', 255)->addRule(FORM::FILLED, 'Name must be filled');
     $form->addSelect('account_id', 'Author', $this->system->getAccountsToSelect())->addRule(FORM::FILLED, 'Accounts must be filled')->setAttribute('class', 'chzn')->setDefaultValue($this->user->id);
     $form->addRequestButton('adduser', 'Add new author', ':Admin:Users:Default:add');
     $form['adduser']->getControlPrototype()->class('btn_add');
     $form->addTextArea('perex', 'Perex')->addRule(FORM::FILLED, 'Perex must be filled')->getControlPrototype()->class('texyla');
     foreach ($this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->order('created DESC') as $item) {
         //$el = \Nette\Utils\Html::el('option')->value($item->id)->setText($this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-100x100/' . $item->code);
         $el = \Nette\Utils\Html::el('option')->value($item->id)->setText($item->code);
         $arr[$item->id] = $el;
     }
     $form->addSelect('file_id', 'File:', $arr)->setPrompt('Choose image')->setAttribute('class', 'eggs');
     //		foreach ($this->context->createServiceFiles()->where('isImage', '1')->where('isnull(deleted)')->where('visible','1')->limit(100)->order('created DESC') as $item) {
     //			$el = \Nette\Utils\Html::el('option')->value($item->id)->setText($item->name)->data(array('imagesrc' => $this->presenter->getHttpRequest()->url->baseUrl . 'image/crop-40x40/' . $item->code, 'description' => $item->description));
     //			//if($key == $data->doprava_id)
     //			//$el->selected(TRUE);
     //			$arr[$item->id] = $el;
     //		}
     //
     //		$form->addSelect('file_id', 'File:', $arr)
     //			->setPrompt('Choose image')->setAttribute('class', 'ddslick');
     //		$form->addSelect('file_id', 'File', $this->context->createServiceFiles()->where('isImage','1')->where('isnull(deleted)')->fetchPairs('id', 'name'))->setPrompt('Choose image');
     $form->addTextArea('body', 'Body')->addRule(FORM::FILLED, 'Body must be filled')->getControlPrototype()->class('texyla');
     $form->addTextArea('conclusion', 'Conclusion')->setAttribute('cols', 40)->setAttribute('rows', 5)->getControlPrototype()->class('texyla');
     $form->addText('published', 'Published')->setAttribute('size', 10)->getControlPrototype()->class('datetimepicker');
     $form->addGroup('Hidden');
     $form->addTextArea('notes', 'Notes')->setAttribute('cols', 40)->setAttribute('rows', 5)->getControlPrototype();
     $form->addTextArea('keywords', 'Keywords')->setAttribute('cols', 40)->setAttribute('rows', 5)->setOption('description', 'Zadejte klíčová slova či spojení oddělená čárkou.');
     $form->addCheckbox('is_visible', 'Visible')->setDefaultValue(1);
     $form->addCheckbox('ad', 'Recommended');
     if (!$this->isRequestButton) {
         if ($this->getView() == 'add') {
             $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary');
             $form->addSubmit('leave', 'Save & Leave');
         } else {
             $form->addHidden('id');
             $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary');
             $form->addSubmit('add', 'Save & Add new');
         }
         $form->addSubmit('save', 'Save');
         $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype();
         $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked';
         $form['cancel']->getControlPrototype()->class('cancel');
     } else {
         $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     $form->onSuccess[] = array($this, 'saveItem');
     return $form;
 }
Exemplo n.º 10
0
 protected function createComponentForm()
 {
     $form = new \RequestButton\RequestButtonReceiver();
     $form->renderStyle = MyForm::SEMANTIC;
     $form->setTranslator($this->translator);
     $form->addText('name', 'Place name')->addRule(Form::FILLED, 'Name must be filled')->setAttribute('placeholder', 'Name of place');
     $form->addTextArea('description', 'Description')->setAttribute('rows', 300)->setRequired('Popište, co se na vašim místě najde.')->getControlPrototype()->style('height: 500px;');
     $categories = new \Model\Categories($this->ns);
     $items = $categories->getGlobalCategoriesArray('subject', true);
     $form->addMultiSelect('categories', 'Categories', $items)->setRequired('Zařaďte své místo do nějaké kategorie pro lepší nalezení.')->setAttribute('class', 'chzn')->setAttribute('data-placeholder', 'Vyberte kategorii')->addCondition(\Nette\Forms\Form::FILLED, 'Dej tam kategorii');
     $form->addSelect('locality_id', 'Locality', $this->context->createServiceLocalities()->select('locality.id, concat(locality.name, " / ", shire.name) AS title')->order('title')->fetchPairs('id', 'title'))->setPrompt("---")->setAttribute('class', 'chzn');
     $form->addRequestButton('addlocality', 'Add new locality', ':Admin:System:Localities:add');
     $form['addlocality']->getControlPrototype()->class('btn_add');
     $form->addCheckbox('locality_alt_toggle', 'Add new locality')->setDefaultValue(FALSE)->addCondition(Form::EQUAL, TRUE)->toggle("locality_alt");
     $form->addText('locality_alt', 'New locality from user', null, 255)->addConditionOn($form['locality_id'], Form::BLANK)->addRule(Form::FILLED, 'Vyberte lokalitu nebo zadejte novou.');
     $form['locality_id']->addConditionOn($form['locality_alt'], FORM::BLANK)->addRule(FORM::FILLED, 'Locality must be filled');
     $form->addText('map_coords', 'Map coordinates', null, 255)->setAttribute('placeholder', '49°49\'55.074"N, 18°16\'36.995"E')->addRule(FORM::FILLED, 'Map coordinates must be filled.');
     $form->addText('street', 'Street and number', null, 127)->setAttribute('placeholder', 'Na Maninách 14');
     $form->addText('locality_nickname', 'Locality for web', null, 127)->setAttribute('placeholder', 'Žižkov');
     $form->addText('zip', 'Zip', null, 10)->setOption('description', 'Např.: 12345')->setAttribute('placeholder', '13000');
     $form->addCheckbox('scope_all', 'Působnost v celé ČR.')->setOption('description', 'Zaškrtněte působíte-li na území celé ČR.');
     $form->addText('web', 'Website', null, 127)->setOption('description', 'http://domain.tld/foo')->setAttribute('placeholder', 'http://peknyden.cz/')->addCondition(FORM::FILLED)->addRule(FORM::URL, 'Website je vyplněna v nesprávném formátu.');
     $form->addText('facebook', 'Facebook Page', null, 127)->setOption('description', 'http://domain.tld/foo')->setAttribute('placeholder', 'http://facebook.cz/peknydencz')->addCondition(FORM::FILLED)->addRule(FORM::URL, 'Facebook Page je vyplněna v nesprávném formátu.');
     $form->addText('email', 'E-mail', null, 127)->setOption('description', '*****@*****.**')->setAttribute('placeholder', '*****@*****.**')->addCondition(FORM::FILLED)->addRule(FORM::EMAIL, 'E-mail je vyplněn v nesprávném formátu.');
     $form->addText('phone', 'Phone', null, 127)->setOption('description', '+420 123 456 789, +420 123 456 789')->setAttribute('placeholder', '800 110 100');
     $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('pricelist', 'Prices');
     $form->addTextArea('openhours', 'Opening hours');
     $form->addCheckbox('stroller', 'Stroller')->setDefaultValue(0);
     $form->addCheckbox('wheelchair_access', 'Wheelchair Access')->setDefaultValue(0);
     $form->addCheckbox('nonsmoking', 'Nonsmoking')->setDefaultValue(0);
     if ($this->user->isInRole('administrator')) {
         $form->addCheckbox('visible', 'Visible')->setDefaultValue(0);
     } else {
         $form->addCheckbox('visible', 'Visible')->setDefaultValue(1);
     }
     $form->addTextArea('notice', 'Notice');
     if ($this->user->isInRole('administrator')) {
         $form->addSelect('user_id', 'Owner', $this->context->createServiceUsers()->fetchPairs('id', 'email'))->setPrompt('---')->setAttribute('class', 'input-xxlarge chzn');
         $form->addCheckbox('approved', 'Approved')->setDefaultValue(1);
         $form->addCheckbox('show_in_catalogue', 'Show in catalogue')->setDefaultValue(1);
         $form->addCheckbox('show_in_calendar', 'Show in calendar')->setDefaultValue(1);
         $form->addCheckbox('ad', 'Recommended');
         $form->addCheckbox('ad_onhomepage', 'On homepage');
         $form->addText('ad_name', 'Alternative name (40 chars)');
         $form->addText('ad_description', 'Alternative description');
         $form->addSelect('ad_category', 'Only in category', $categories->getGlobalCategoriesArray('subject', null, false))->setPrompt('---')->setAttribute('class', 'input-xxlarge chzn');
         $form->addSelect('ad_shire', 'Only in shire', $this->context->createServiceShires()->fetchPairs('id', 'name'))->setPrompt('---')->setAttribute('class', 'input-xxlarge chzn');
     } else {
         $form->addHidden('approved', 'Approved')->setDefaultValue(0);
         $form->addHidden('show_in_catalogue', 'Show in catalogue')->setDefaultValue(1);
         $form->addHidden('show_in_calendar', 'Show in calendar')->setDefaultValue(1);
     }
     if (!$this->isRequestButton) {
         $form->addSubmit('save', 'Save place')->onClick[] = callback($this, 'savePlace');
         $form->addSubmit('saveNew', 'Save place')->onClick[] = callback($this, 'savePlace');
         $form->addSubmit('saveBack', 'Save & Back')->onClick[] = callback($this, 'savePlace');
     } else {
         //$form->addSubmit('save', 'Save')->getControlPrototype()->class('primary');
         $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel');
     }
     $form->addHidden('id');
     $form->addHidden('code');
     return $form;
 }