/**
 * Edit hlavne menu form component factory.
 * @return Nette\Application\UI\Form
 */
  public function create($iko, $upload_size)
  {
      $form = new Form();
      $form->addProtection();
      $form->addHidden("id");
      $form->addHidden("id_lang");
      $form->addHidden("spec_nazov");
      $form->addUpload('title_image', 'Titulný obrázok:')->setOption('description', 'Odporúčaný rozmer obrázku je: 90x70px alebo násobky tejto veľkosti. Inak môže dôjsť k deformácii alebo orezaniu obrázku pri ukladaní!')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'Titulný obrázok musí byť JPEG, PNG alebo GIF.')->addRule(Form::MAX_FILE_SIZE, 'Maximálna veľkosť súboru je 64 kB.', 64 * 1024);
      $form->addText('nazov', 'Názov produktu:', 50, 50)->setRequired('Názov musí byť zadaný!');
      $form->addRadioList('tepkat', 'Tepelná kategória:', $iko)->getSeparatorPrototype()->setName(NULL);
      $form->addText('vyska', 'Výška[mm]:', 5, 5)->addRule(Form::RANGE, 'Výška musí byť v rozsahu od %d do %d mm!', array(0, 4000))->setRequired('Výška musí byť zadaná!');
      $form->addText('sirka', 'Šírka[mm]:', 5, 5)->addRule(Form::RANGE, 'Šírka musí byť v rozsahu od %d do %d mm!', array(0, 2000))->setRequired('Šírka musí byť zadaná!');
      $form->addText('hlbka', 'Hĺbka[mm]:', 5, 5)->addRule(Form::RANGE, 'Hĺbka musí byť v rozsahu od %d do %d mm!', array(0, 2000))->setRequired('Hĺbka musí byť zadaná!');
      $form->addText('hmotnost', 'Hmotnosť[kg]:', 5, 5)->addRule(Form::RANGE, 'Hmotnosť musí byť v rozsahu od %d do %d kg!', array(0, 3500))->setRequired('Hmotnosť musí byť zadaná!');
      $form->addText('bottom_plinth_weight', 'Hmotnosť spodného podstavca[kg]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Hmotnosť spodného podstavca musí byť v rozsahu od %d do %d kg!', array(0, 2000));
      $form->addCheckbox('copatible_aurum', ' Kompatibilné s Aurum Pellet Unit');
      $form->addText('termal_energy', 'Tepelná energia[kWh]:', 5, 5)->addRule(Form::RANGE, 'Tepelná energia musí byť v rozsahu od %d do %d kWh!', array(0, 200))->setRequired('Tepelná energia musí byť zadaná!');
      $form->addText('heating_time', 'Čas spaľovania[h:min]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::PATTERN, 'Čas spaľovania musí byť zapísaný v tvare napr.:02:30', '([0-9]\\s*){2}:([0-9]\\s*){2}');
      $form->addText('heating_occasion', 'Max. množstvo dreva[kg]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Max. množstvo dreva musí byť v rozsahu od %d do %d kg!', array(0, 100));
      $form->addText('forewood_lenght', 'Dĺžka dreva do rúry na pečenie[cm]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Dĺžka dreva do rúry na pečenie musí byť v rozsahu od %d do %d cm!', array(0, 100));
      $form->addText('firewood_lenght', 'Dĺžka dreva[cm]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Dĺžka dreva musí byť v rozsahu od %d do %d cm!', array(0, 100));
      $form->addText('nominal_heat_output', 'Nominálny tepelný výkon[kW]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Nominálny tepelný výkon musí byť v rozsahu od %d do %d kW!', array(0, 15));
      $form->addText('nominal_heat_time', 'Nominálny čas[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Nominálny čas musí byť v rozsahu od %d do %d h!', array(0, 50));
      $form->addText('heat_release_time100', 'Tepelná akumulačná kapacita, 100 percent maximálneho výkonu[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Tepelná akumulačná kapacita musí byť v rozsahu od %d do %d h!', array(0, 50));
      $form->addText('heat_release_time50', 'Tepelná akumulačná kapacita, 50 percent maximálneho výkonu[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Tepelná akumulačná kapacita musí byť v rozsahu od %d do %d h!', array(0, 100));
      $form->addText('heat_release_time25', 'Tepelná akumulačná kapacita, 25 percent maximálneho výkonu[h]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Tepelná akumulačná kapacita musí byť v rozsahu od %d do %d h!', array(0, 100));
      $form->addText('efficiency', 'Účinnosť[%]:', 5, 5)->addCondition(Form::FILLED)->addRule(Form::RANGE, 'Účinnosť musí byť v rozsahu od %d do %d %!', array(0, 100));
      $form->addUpload('pec_pdf', 'Katalógový list vo formáte pdf:')->setOption('description', sprintf('Max veľkosť prílohy v bytoch %s kB', $upload_size / 1024))->addCondition(Form::FILLED)->addRule(Form::MIME_TYPE, 'Katalógový list musí byť vo formáte pdf!', 'application/pdf')->addRule(Form::MAX_FILE_SIZE, 'Max veľkosť prílohy može byť v bytoch %d B', $upload_size);
      $form->addSubmit('uloz', 'Ulož produkt');
 public function createComponentUpload()
 {
     $form = new Form();
     $form->addUpload('json');
     $form->addUpload('audio');
     $form->addSubmit('save');
     $form->onSuccess[] = [$this, 'onUpload'];
     return $form;
 }
 /**
  * Article factory.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentArticleInsertForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->addText('heading', 'Titulek:')->addRule(\Nette\Application\UI\Form::MIN_LENGTH, 'Titulek musí mít alespoň %d znaků', 10)->addRule(\Nette\Application\UI\Form::MAX_LENGTH, 'Titulek nesmí mít více než %d znaků', 50)->setRequired('Zadejte titulek nového záznamu.');
     $form->addSelect('rating', 'Hodnocení:', range(1, 5));
     $form->addTextArea('content', 'Obsah:')->addRule(\Nette\Application\UI\Form::MIN_LENGTH, 'Obsah musí mít alespoň %d znaků', 100)->addRule(\Nette\Application\UI\Form::MAX_LENGTH, 'Obsah nesmí mít více než %d znaků', 1000)->setRequired('Vložte obsah nového záznamu.');
     $form->addText('link', 'WWW (odkaz na zdroj):')->addRule(\Nette\Application\UI\Form::MIN_LENGTH, 'Odkaz musí mít alespoň %d znaků', 7)->addRule(\Nette\Application\UI\Form::MAX_LENGTH, 'Odkaz nesmí mít více než %d znaků', 250)->setRequired('Zadejte platný odkaz na zdroj.');
     $form->addUpload('img1', '1. obrázek:')->addRule(\Nette\Application\UI\Form::IMAGE, 'Obrázek musí být JPEG, PNG nebo GIF.')->addRule(\Nette\Application\UI\Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 3 MB.', 3145728);
     $form->addUpload('img2', '2. obrázek:')->addRule(\Nette\Application\UI\Form::IMAGE, 'Obrázek musí být JPEG, PNG nebo GIF.')->addRule(\Nette\Application\UI\Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 3 MB.', 3145728);
     $form->addSubmit('insert', 'Vložit');
     // call method articleInsertFormSucceeded() on success
     $form->onSuccess[] = array($this, 'articleInsertFormSucceeded');
     return $form;
 }
 /**
  * @return Form
  */
 public function create($otherUser = '', $privilegesEdit = false)
 {
     $form = new Form();
     if (!empty($otherUser)) {
         $user = $otherUser;
         $form->addHidden('id', $otherUser->id);
     } else {
         $user = $this->user;
     }
     $form->addUpload('photo', 'Fotka')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost fotky je 10MB', 80000000);
     $form->addText('nickName', 'Přihlašovací jméno')->setValue($user->nickName)->setOption('description', Html::el('p')->setHtml('Pokud chcete můžete pro jednodušší přihlašování zadat jméno'))->addCondition(Form::FILLED)->addRule(Form::MIN_LENGTH, 'Jméno musí mít alespoň %d znaky', 3);
     $form->addText('name', 'Jméno k zobrazení')->setValue($user->name);
     if ($privilegesEdit) {
         $form->addText('title', 'Titul')->setValue($user->title)->setOption('description', Html::el('p')->setHtml('Titul měnitelný administrátorem přidaný před jméno'));
     }
     $date = $this->parseDateForm();
     $form->addSelect('day', 'Den narození', $date['days'])->setValue($date['day']);
     $form->addSelect('month', 'Měsíc narození', $date['months'])->setValue($date['month']);
     $form->addSelect('year', 'Rok narození', $date['years'])->setValue($date['year']);
     $form->addSelect('gender', 'Pohlaví', ['ma' => 'Muž', 'fe' => 'Žena', 'no' => 'Neuvedeno'])->setValue($user->gender);
     $form->addCheckbox('wall', 'Povolit zeď')->setValue($user->wall == 1 ? true : false);
     $form->addCheckbox('mailList', 'Posílat od nás maily')->setValue($user->mailList == 1 ? true : false);
     $form->addTextArea('about', 'O mě')->setValue($user->about);
     if ($privilegesEdit) {
         $this->editPrivileges($form, $user->permissions);
     }
     $form->addSubmit('submit', 'Uložit');
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->onSuccess[] = [$this, 'formSucceeded'];
     return $form;
 }
 public function createComponentForm()
 {
     $form = new Form();
     $form->addUpload('picture', 'obrazek');
     $form->addSubmit('ok', 'upload');
     $form->onSuccess[] = callback($this, 'process');
     return $form;
 }
 /**
  * Vytvori formular pro nahrani zakladnich casu.
  * @return object $form Formular.
  */
 protected function createComponentBtUploadForm()
 {
     $form = new UI\Form();
     $form->addUpload('file', 'Soubor:');
     $form->addSubmit('upload', 'Nahrát');
     $form->onSuccess[] = array($this, 'btUploadFormSubmitted');
     return $form;
 }
Exemple #7
0
 public function createComponentSubmitForm()
 {
     $form = new Form();
     $form->addUpload('riesenia', 'Opravené riešenia');
     $form->addSubmit('submit', 'Nahraj');
     $form->onSuccess[] = callback($this, 'onSubmit');
     return $form;
 }
Exemple #8
0
 /**
  * @return Form
  */
 function create()
 {
     $form = new Form();
     $form->addUpload('file', 'Select file')->setRequired();
     $form->addTextArea('note', 'Your note');
     $form->addSubmit('process', 'Upload');
     $form->onSuccess[] = $this->solutionFormSucceeded;
     return BootstrapForm::makeBootstrap($form);
 }
 /**
  * @return Form
  */
 public function createComponentUploadImgForm()
 {
     $form = new Form();
     $form->setTranslator($this->translator->domain('ui'));
     $form->addUpload('img', 'pictures', true)->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'only-format-jpg-gif-or-png')->addRule(Form::MAX_FILE_SIZE, 'max-file-size', 2 * 1024 * 1024);
     $form->addSubmit('send', 'upload');
     $form->onSuccess[] = $this->uploadImgFormSucceeded;
     return $form;
 }
 public function create()
 {
     $form = new Form();
     $form->addGroup("Set Google Webmaster tools");
     $form->addUpload("file", "Google Webmaster tools file:")->setRequired("Upload Google Webmaster tools file");
     $form->addSubmit("send", "Set Google Webmaster tools");
     $form->onSuccess[] = $this->processForm;
     return $form;
 }
 protected function createComponentFormImportTemplate()
 {
     if ($this->acl->isAllowed($this->me, $this->project, 'importTemplate')) {
         $form = new Form();
         $form->addUpload('template', 'Template file')->setRequired();
         $form->addSubmit('btnSubmit', 'Import');
         $form->onSuccess[] = callback($this, 'formImportTemplateSubmitted');
         return $form;
     }
 }
 /**
  * Creates the new invoice form.
  * @return Nette\Application\UI\Form The form
  */
 public function createComponentInvoiceForm()
 {
     $form = new Form();
     $form->addUpload('userfile')->addRule(Form::MIME_TYPE, 'Protokolem musí být PDF.', 'application/pdf,application/x-pdf')->setRequired();
     $form->addSelect('zadavatel', NULL, $this->createModel->getAllClients())->setRequired();
     $form->addText('cena')->setRequired();
     $form->addSubmit('submit');
     $form->onSuccess[] = array($this, 'invoiceFormSucceeded');
     return $form;
 }
 public function createComponentUpload()
 {
     $form = new Form();
     $form->addUpload('foto', 'Fotografie (max. 2 MB):')->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 2 MB.', 2 * 1024 * 1024);
     $form->addTextarea("alt", "Popis");
     $form->addTextarea("title", "Titulek");
     $form->addSubmit('submit', 'Nahrát');
     $form->onSuccess[] = callback($this, 'handleSavePhoto');
     return $form;
 }
Exemple #14
0
 protected function createComponentConsoleForm()
 {
     $form = new Form();
     $defaults = [];
     $form->setRenderer(new BootstrapRenderer());
     $uri = $this->request->getUrl();
     $scheme = $uri->scheme;
     if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
         $scheme = $_SERVER['HTTP_X_FORWARDED_PROTO'];
     }
     $port = '';
     if ($uri->scheme == 'http' && $uri->port != 80) {
         $port = ':' . $uri->port;
     }
     $url = $scheme . '://' . $uri->host . $port . '/api/' . $this->endpoint->getUrl();
     $form->addText('api_url', 'Api Url');
     $defaults['api_url'] = $url;
     $form->addText('method', 'Method');
     $defaults['method'] = $this->endpoint->getMethod();
     if ($this->authorization instanceof BearerTokenAuthorization) {
         $form->addText('token', 'Token')->setAttribute('placeholder', 'Enter token');
     } elseif ($this->authorization instanceof NoAuthorization) {
         $form->addText('authorization', 'Authorization')->setDisabled(true);
         $defaults['authorization'] = 'No authorization - global access';
     }
     $params = $this->handler->params();
     foreach ($params as $param) {
         $count = $param->isMulti() ? 5 : 1;
         for ($i = 0; $i < $count; $i++) {
             $key = $param->getKey();
             if ($param->isMulti()) {
                 $key = $key . '___' . $i;
             }
             if ($param->getAvailableValues() && is_array($param->getAvailableValues())) {
                 $c = $form->addSelect($key, $this->getParamLabel($param), array_combine($param->getAvailableValues(), $param->getAvailableValues()));
                 if (!$param->isRequired()) {
                     $c->setPrompt('Select ' . $this->getLabel($param));
                 }
             } elseif ($param->getAvailableValues() && is_string($param->getAvailableValues())) {
                 $c = $form->addText($key, $this->getParamLabel($param))->setDisabled(true);
                 $defaults[$key] = $param->getAvailableValues();
             } elseif ($param->getType() == InputParam::TYPE_FILE) {
                 $c = $form->addUpload($key, $this->getParamLabel($param));
             } elseif ($param->getType() == InputParam::TYPE_POST_RAW) {
                 $c = $form->addTextArea('post_raw', $this->getParamLabel($param))->setAttribute('rows', 10);
             } else {
                 $c = $form->addText($key, $this->getParamLabel($param));
             }
         }
     }
     $form->addSubmit('send', 'Otestuj')->getControlPrototype()->setName('button')->setHtml('<i class="fa fa-cloud-upload"></i> Try api');
     $form->setDefaults($defaults);
     $form->onSuccess[] = array($this, 'formSucceeded');
     return $form;
 }
 protected function createComponentArticleForm()
 {
     $form = new UI\Form();
     $form->addText('name', 'Název článku:')->setRequired();
     $form->addUpload('image', 'Obrázek JPG')->addCondition($form::FILLED)->addRule($form::IMAGE, 'Zvolený soubor není obrázek.')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost souboru je 5 MB.', 6 * 1024 * 1024);
     $form->addTextArea('annotation', 'Annotace:')->setAttribute('class', 'tinyMCE');
     $form->addTextArea('text', 'Článek:')->setAttribute('class', 'tinyMCE');
     $form->addSubmit('save', 'Uložit')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'articleFormSucceeded');
     return $form;
 }
 /**
  * @return Form
  */
 public function create($id = null)
 {
     $this->id = $id;
     $form = new Form();
     $form->getElementPrototype()->class('ajax form');
     $form->addUpload('img', 'Fotografie:', FALSE)->setRequired('Vyberte prosím fotografii, kterou chcete nahrát.')->addRule(Form::IMAGE, 'Fotografie musí být ve formátu JPEG, PNG nebo GIF.')->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost fotografie je 2 MB.', 2 * 1024 * 1024);
     $form->addSubmit('send', 'Nahrát obrázek')->setAttribute('class', 'btn btn-primary');
     $form->onSuccess[] = array($this, 'formSucceeded');
     $form->onError[] = array($this, 'formNotSucceeded');
     return $form;
 }
Exemple #17
0
 /**
  * Vytvoří formulář pro zadání parametru pro import vysledku 
  * @return Form
  */
 protected function createComponentImportTimeForm()
 {
     $form = new UI\Form();
     $events_id = $this->database->query('SELECT id FROM sm_event')->fetchPairs();
     $form->addSelect('event_id', 'ID závodu')->setPrompt('- Vyberte -')->setItems($events_id, FALSE);
     $form->addUpload('file', 'Soubor:')->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 1000 kB (1MB).', 1000 * 1024);
     $form->addSubmit('check', 'Zkontrolovat');
     $form->addSubmit('import', 'Importovat');
     $form->onSuccess[] = array($this, 'importTimeFormSucceeded');
     return $form;
 }
 protected function createComponentPolozkaForm($name)
 {
     $hornina = $this->horninaRepository->findAll()->fetchPairs('id', 'nazov');
     $form = new Form();
     $form->addText('nazov', 'Nazov')->setRequired('Zvolte nazov');
     $form->addText('popis', 'Popis')->setRequired('Zvolte popis');
     $form->addSelect('idHornina', 'Hornina', $hornina);
     $form->addUpload('nazovSuboru', 'Súbor');
     $form->addSubmit('uloz', 'Uloz')->onClick[] = callback($this, 'nazovFormSubmitted');
     $form->addSubmit('cancel', 'Storno')->onClick[] = callback($this, 'cancelFormSubmitted');
     return $form;
 }
 protected function createComponentEventForm()
 {
     $form = new UI\Form();
     $form->addText('name', 'Název události:')->setRequired();
     $form->addUpload('eventImage', 'Obrázek akce')->addCondition($form::FILLED)->addRule($form::IMAGE, 'Zvolený soubor není obrázek.')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost souboru je 5 MB.', 6 * 1024 * 1024);
     $form->addText('date', 'Datum a čas začátku události')->addRule($form::PATTERN, 'Vyplňte datum a čas ve tvaru 13.8.2014 18:00.', '([0-3]?[0-9]\\.[0-1]?[0-9]\\.[0-9]{4}( [0-2]?[0-9]:[0-5][0-9](:[0-5][0-9])?)?)|([0-9]{4}-[0-9]{2}-[0-9]{2}( [0-9]{2}:[0-9]{2}:[0-9]{2})?)')->setRequired();
     $form->addTextArea('annotation', 'Annotace:')->setAttribute('class', 'tinyMCE');
     $form->addTextArea('description', 'Článek:')->setAttribute('class', 'tinyMCE');
     $form->addCheckbox('main', 'Akce SOS?');
     $form->addText('max_ticket_per_email', 'Max. vstupenek/reg. na email:')->setDefaultValue(1)->setAttribute('type', 'number')->addRule($form::RANGE, 'Počet musí být v rozsahu 1 až 20.', [1, 20]);
     $form->addCheckbox('registration', 'Konference?');
     $form->addCheckbox('ticket', 'Koncert?')->addCondition($form::EQUAL, true)->toggle('ticket-image');
     $form->addCheckbox('document', 'Dokument ke stažení?')->addCondition($form::EQUAL, true)->toggle('document-to-download');
     $form->addUpload('attachedDocument', 'Dokument PDF')->setOption('id', 'document-to-download')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost souboru je 12 MB.', 13 * 1024 * 1024);
     $form->addUpload('ticketImage', 'Obrázek vstupenky JPG')->setOption('id', 'ticket-image')->addCondition($form::FILLED)->addRule($form::IMAGE, 'Zvolený soubor není obrázek.')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost souboru je 5 MB.', 6 * 1024 * 1024);
     $form->addTextArea('note', 'Poznámka:')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Poznámka k formuláři registrace konference.');
     $form->addSubmit('save', 'Uložit')->setAttribute('class', 'btn btn-primary');
     $form->onValidate[] = array($this, 'formValidate');
     $form->onSuccess[] = array($this, 'formSucceeded');
     return $form;
 }
Exemple #20
0
 protected function createComponentImageUpload()
 {
     $form = new Form();
     $form->setTranslator($this->translator->domain('images.uploadForm'));
     $form->addUpload('image', new Phrase('image.label', ['size' => $this->imageSize]))->addRule(Form::IMAGE, 'image.messages.imageFile')->addRule(Form::MAX_FILE_SIZE, new Phrase('image.messages.maxFileSize', ['size' => $this->imageSize]), Image::MAX_FILE_SIZE);
     $form->addSubmit('upload', 'upload.caption');
     $form->onSuccess[] = [$this, 'processImageUpload'];
     if (!$this->authorizator->isAllowed($this->user, 'image', 'upload')) {
         $form['upload']->setDisabled();
     }
     $form->addProtection();
     return $form;
 }
  /** @var string */
  private $avatar_path;
  /** @var string */
  private $www_dir;
  /**
 * @param DbTable\Hlavne_menu $hlavne_menu */
  public function __construct(DbTable\Hlavne_menu $hlavne_menu)
  {
      $this->hlavne_menu = $hlavne_menu;
  }
  /**
 * Formular pre pridanie a editaciu titulneho obrazku polozky.
 * @return Nette\Application\UI\Form */
  public function create($avatar_path, $www_dir)
 public function createComponentForm()
 {
     $form = new Form();
     $priklady = $this->context->sources->prikladSource->getAll($this->getSeriaId());
     foreach ($priklady as $priklad) {
         $items[$priklad['id']] = $priklad['kod'] . ' ' . $priklad['nazov'];
     }
     $form->addSelect('priklad', 'Príklad:', $items)->setPrompt('Zvoľ príklad')->setRequired('Zvoľ príklad');
     $form->addUpload('file', 'Riešenie:')->addRule(Form::MAX_FILE_SIZE, 'Príliš veľký súbor', 1000000)->setRequired('Zvoľ riešenie na odovzdanie');
     $form->addSubmit('odovzdaj', 'Odovzdaj');
     $form->onSuccess[] = callback($this, 'onSubmit');
     return $form;
 }
Exemple #23
0
 public function create()
 {
     $form = new Form();
     $form->enableLocalized();
     $form->addText('username')->setRequired('errors.fill_user_name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'user_name');
     $form->addUpload('img')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'img')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'errors.img');
     $form->addText('email')->setRequired('errors.fill_email')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'email')->addRule(Form::EMAIL, 'errors.fill_email_success')->addRule($this->checkEmail, 'errors.email_used');
     $form->addSelect('role', $form->translate('role'), $this->getRoleList())->setRequired('errors.role')->setTranslator(null)->setAttribute('class', 'form-control');
     $form->addPassword('password')->setRequired('errors.enter_password')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'password');
     $form->addPassword('password2')->setRequired('errors.enter_password_retry')->setAttribute('class', 'form-control')->addRule(Form::EQUAL, 'errors.password_must_match', $form['password'])->setAttribute('placeholder', 'password_retry');
     $form->addSubmit('submit', 'register')->setAttribute('class', 'btn btn-primary btn-purple btn-flat');
     $form->onSuccess[] = $this->success_form_add;
     return $form;
 }
 /**
  * 
  * @param integer $id
  * @return Form
  */
 public function editInfo($id)
 {
     $this->user_id = $id;
     $user = $this->user_manager->getUser($id);
     $form = new Form();
     $form->enableLocalized();
     $form->addText('name')->setValue($user->name)->setRequired('errors.fill_user_name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'user_name');
     $form->addText('email')->setValue($user->email)->setRequired('errors.fill_email')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'email')->addRule(Form::EMAIL, 'errors.fill_email_success')->addRule($this->checkEmailUpdate, 'errros.email_used');
     $form->addSelect('role', $form->translate('role'), $this->getListRoles())->setAttribute('class', 'form-control')->setValue($user->user_roles_id)->setRequired('errors.field_required')->setTranslator(null);
     $form->addUpload('img')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'user_name')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'errors.img');
     $form->addSubmit('submit', 'edit')->setAttribute('class', 'btn btn-primary btn-purple btn-flat');
     $form->onSuccess[] = $this->success_form_info;
     return $form;
 }
 protected function createComponentDokumentUploadForm()
 {
     $form = new Form();
     $kategorie = $this->kategorie->getSelect();
     $form->addUpload('soubor', 'Soubor')->addRule(Form::FILLED, 'Soubor musí být vybrán.');
     $form->addText('popis', 'Popis')->addRule(Form::FILLED, 'Popis souboru musí být vyplněn.');
     $form->addSelect('kategorie_id', 'Kategorie', $kategorie);
     $form->addCheckbox('verejne', 'Veřejný soubor');
     $form->addCheckbox('rozeslatMaily', 'Rozeslat maily')->setValue(true);
     $form->addSubmit('send', 'Nahrát soubor');
     $form->onSuccess[] = array($this, 'dokumentUploadFormSucceeded');
     //$form->onValidate[] = array($this, 'validateLicenceForm');
     $form->setRenderer(new BootstrapRenderer());
     return $form;
 }
Exemple #26
0
 /**
  * 
  * @param integer $id
  * @return Form
  */
 public function create($id)
 {
     $this->user_id = $id;
     $user = $this->user_manager->getUser($id);
     $form = new Form();
     $form->enableLocalized();
     $form->addText('name')->setValue($user->name)->setRequired('errors.fill_user_name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'name_surname');
     $form->addText('email')->setValue($user->email)->setRequired('errors.fill_email')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'email')->addRule(Form::EMAIL, 'errors.fill_email_success')->addRule($this->checkEmailUpdate, 'errors.email_used');
     $form->addPassword('password')->setRequired('errors.fill_password')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'password');
     $form->addUpload('img')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'img')->addCondition(Form::FILLED)->addRule(Form::IMAGE, 'errors.img');
     $form->addPassword('password2')->setRequired('errors.enter_password_retry')->setAttribute('class', 'form-control')->addRule(Form::EQUAL, 'errors.password_must_match', $form['password'])->setAttribute('placeholder', 'password_retry');
     $form->addSubmit('submit', 'edit')->setAttribute('class', 'btn btn-primary btn-purple btn-flat');
     $form->onSuccess[] = $this->success_form;
     return $form;
 }
  /** @var string */
  private $wwwDir;
  /**
 * @param DbTable\Dokumenty $dokumenty
 * @param User $user
 * @param string $wwwDir  */
  public function __construct(DbTable\Dokumenty $dokumenty, User $user, $wwwDir = "")
  {
      $this->dokumenty = $dokumenty;
      $this->id_user_profiles = $user->getId();
      $this->wwwDir = $wwwDir;
  }
  /**
 * Formular pre pridanie prilohy a editaciu polozky.
 * @param int $upload_size
 * @param string $prilohy_adresar
 * @param array $prilohy_images
 public function createComponentImageForm()
 {
     $form = new Form();
     for ($i = 1; $i <= $this->uploadCount; $i++) {
         if ($this->uploadCount == 1) {
             $i1 = "";
         } else {
             $i1 = $i;
         }
         // jen kvuli UX
         $form->addUpload('file' . $i, 'Obr.' . $i1 . ':');
         //->addRule(Form::IMAGE, 'Obrázek musí být JPEG, PNG nebo GIF.')
         //->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 1,5 MB.', 1572864 /* v bytech */);
     }
     $form->addSubmit('save', 'Nahrát');
     $form->onSuccess[] = callback($this, 'processImageForm');
     return $form;
 }
Exemple #29
0
 public function createComponentContactForm()
 {
     $form = new Form();
     $form->addText('name', 'Your name:')->setRequired();
     $form->addText('email', 'Your e-mail:')->setType('email')->addRule(Form::EMAIL, 'That doesn\'t look like a proper e-mail address. Please check your e-mail address for typos and send the form again.');
     $form->addText('phone', 'Your phone number:')->setType('tel')->addRule(Form::PATTERN, 'Please specify your phone number in the international format', '(00|\\+)[\\d\\s]+');
     $form->addRadioList('preferred', 'Preferred contact:', ['phone' => 'Phone', 'email' => 'E-mail'])->setRequired();
     $subjects = ['general' => 'General Questions', 'complaint' => 'Quality of Service Complaints', 'idea' => 'Ideas for Improvement'];
     $form->addSelect('topic', 'Message topic:', $subjects)->setRequired();
     $form->addTextArea('content', 'Your message:', 40, 4)->setRequired();
     $form->addUpload('attachments', 'Attachments (only JPEG images allowed):', true)->addCondition(Form::FILLED)->addRule(Form::MIME_TYPE, 'Only JPEG images are allowed', 'image/jpeg');
     $newsletters = ['weekly' => 'Weekly reports', 'promo' => 'Promotional bulletins', 'ads' => 'Interesting offers'];
     $form->addCheckboxList('subscribe', 'Subscribe to:', $newsletters);
     $form->addCheckbox('terms', 'I agree to the terms and conditions')->setOmitted()->setRequired();
     $form->addSubmit('send', 'Send message')->onClick[] = [$this, 'informMessageSent'];
     $form->addSubmit('save', 'Save message')->onClick[] = [$this, 'informMessageSaved'];
     $form->onSuccess[] = [$this, 'doSendMessage'];
     return $form;
 }
 protected function createComponentShopForm()
 {
     $form = new Form();
     $countries = array('Europe' => array('Česká Republika' => 'Česká Republika', 'Slovensko' => 'Slovensko', 'Velká Británia' => 'Velká Británia'), 'CA' => 'Kanada', 'US' => 'USA');
     $hours = array('1' => '01');
     $form->addText('name', 'Názov:')->setRequired('Nezabudni vyplniť názov sekáču.')->setAttribute('placeholder', 'Názov sekáču');
     $form->addText('street', 'Ulica:')->setRequired('Vyplň prosím kompletnú adresu sekáču.')->setAttribute('placeholder', 'Ulica');
     $form->addText('house_number', 'Číslo:')->setRequired('Vyplň prosím kompletnú adresu sekáču.')->setAttribute('placeholder', 'Číslo');
     $form->addText('city', 'Mesto:')->setRequired('Vyplň prosím kompletnú adresu sekáču.')->setAttribute('placeholder', 'Mesto');
     $form->addSelect('country', 'Krajina:', $countries);
     $form->addTextArea('about', 'Popis:')->setRequired('Opíš sekáč aspoň pár vetami.')->setAttribute('placeholder', 'Popis');
     $form->addCheckbox('monday', 'Otvorené');
     $form->addText('monday_open', 'Od:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['monday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('monday_closed', 'do:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['monday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addCheckbox('tuesday', 'Otvorené');
     $form->addText('tuesday_open', 'Od:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['tuesday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('tuesday_closed', 'do:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['tuesday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addCheckbox('wednesday', 'Otvorené');
     $form->addText('wednesday_open', 'Od:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['wednesday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('wednesday_closed', 'do:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['wednesday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addCheckbox('thursday', 'Otvorené');
     $form->addText('thursday_open', 'Od:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['thursday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('thursday_closed', 'do:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['thursday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addCheckbox('friday', 'Otvorené');
     $form->addText('friday_open', 'Od:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['friday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('friday_closed', 'do:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['friday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addCheckbox('saturday', 'Otvorené');
     $form->addText('saturday_open', 'Od:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['saturday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('saturday_closed', 'do:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['saturday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addCheckbox('sunday', 'Otvorené');
     $form->addText('sunday_open', 'Od:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['sunday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('sunday_closed', 'do:')->setAttribute('placeholder', 'formát 00:00')->addConditionOn($form['sunday'], Nette\Application\UI\Form::EQUAL, TRUE)->setRequired('Vyplň prosím otváracie hodiny sekáču.');
     $form->addText('url', 'Web:')->setAttribute('placeholder', 'Webová stránka sekáču');
     $form->addText('phone', 'Tel. kontakt:')->setAttribute('placeholder', 'Tel. kontakt');
     $form->addText('email', 'Email:')->setAttribute('placeholder', 'Kontaktný email');
     //->addRule(Nette\Application\UI\Form::EMAIL, 'Neplatná emailová adresa.');
     $form->addUpload('profile_photo', 'Profilová fotka:')->setRequired('Prosím pridaj fotku sekáču.')->addRule(Nette\Application\UI\Form::IMAGE, 'Obrázok musí byť vo formáte JPEG, PNG alebo GIF.')->addRule(Nette\Application\UI\Form::MAX_FILE_SIZE, 'Maximálna velikosť súboru je 300 kB.', 300 * 1024);
     $form->addMultiUpload('images', 'Fotky:')->setAttribute('placeholder', 'Vyber fotky')->addRule(Nette\Application\UI\Form::IMAGE, 'Obrázok musí byť vo formáte JPEG, PNG alebo GIF.')->addRule(Nette\Application\UI\Form::MAX_FILE_SIZE, 'Maximálna velikosť súboru je 300 kB.', 300 * 1024);
     $form->addSubmit('send', 'Uložiť sekáč');
     $form->onSuccess[] = array($this, 'shopFormSucceeded');
     return $form;
 }