示例#1
0
 protected function createComponentFileUploadForm()
 {
     $form = new \soundake\helpers\MyForm();
     $form->renderStyle = \soundake\helpers\MyForm::SEMANTIC;
     $form->getElementPrototype()->addAttributes(array('class' => ''));
     $form->addUpload("image", "Vyberte obrázky", true)->setRequired('Nebyl vybrán žádný soubor. Vyberte prosím jeden či více.')->addRule(Form::IMAGE, "Nahrajte prosím pouze obrázky!")->addRule(Form::MAX_FILE_SIZE, 'Soubor je příliš velký! Prosím, nahrajte menší obrázek, do velikosti 3 MB.', 3 * 1024 * 1024)->getControlPrototype()->class('ui input');
     $form->addHidden('id');
     $form->addHidden('type');
     $form->addSubmit('send', 'Nahrát');
     $form->onSuccess[] = callback($this, 'fileUploadSuccess');
     return $form;
 }
示例#2
0
 protected function createComponentFileUploadForm()
 {
     $form = new \soundake\helpers\MyForm();
     $form->renderStyle = 'bootstrap';
     $form->setTranslator($this->translator);
     $form->getElementPrototype()->addAttributes(array('class' => 'form form-inline'));
     $form->addUpload("image", "Choose image(s)", true)->setRequired()->addRule(Form::IMAGE, "You can choose images only!")->addRule(Form::MAX_FILE_SIZE, 'File is too big! Please, choose smaller one. It could be 3 megs large.', 3 * 1024 * 1024)->setOption('description', \Nette\Utils\Html::el('div class="alert alert-info"')->setHtml('Minimální velikost obrázku <strong>440 x 440 px</strong>, maximální velikost souboru <strong>3 MB</strong>. Formát obrázků <strong>jpg</strong>, <strong>gif</strong> a <strong>png</strong>.'));
     $form->addHidden('event_id');
     $form->addSubmit('send', 'Upload image(s)')->getControlPrototype()->class('btn btn-primary');
     $form->addSubmit('cancel', 'Přeskočit nahrávání obrázků')->setValidationScope(FALSE)->onClick[] = array($this, 'cancelClicked');
     $form['cancel']->getControlPrototype()->class('btn btn-grey btn-small');
     $form->onSuccess[] = callback($this, 'fileUploadSuccess');
     return $form;
 }