本文整理汇总了PHP中Nette\Application\UI\Form::addMultiUpload方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addMultiUpload方法的具体用法?PHP Form::addMultiUpload怎么用?PHP Form::addMultiUpload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::addMultiUpload方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentFormPhoto
protected function createComponentFormPhoto()
{
$form = new Nette\Application\UI\Form();
$form->addMultiUpload('img', 'Soubor:')->addRule($form::IMAGE, 'Soubor musí být JPEG, PNG nebo GIF.');
$form->addSubmit("submit");
$form->onSuccess[] = $this->formPhotoSubmitted;
return $form;
}
示例2: createComponentForm
public function createComponentForm()
{
$form = new Form();
$form->addSelect('id_game', 'Výběr hry', $this->games->findPairs('name'))->setPrompt('Spojit s hrou...')->setDisabled(['']);
$form->addMultiUpload('pictures');
$form->addSubmit('save', 'Prilepit špageti');
$form->onSuccess[] = $this->processForm;
return $form;
}
示例3: createComponentItemForm
protected function createComponentItemForm()
{
$form = new UI\Form();
$form->addText('name', 'Název fotografie:');
$form->addTextArea('description', 'Popis:')->setAttribute('class', 'tinyMCE');
$form->addMultiUpload('photo', 'Fotografie JPG')->setRequired('Vyberte fotografie.');
$form->addSubmit('save', 'Uložit')->setAttribute('class', 'btn btn-primary');
$form->onSuccess[] = array($this, 'itemFormSucceeded');
return $form;
}
示例4: createComponentNewsletterForm
protected function createComponentNewsletterForm()
{
$events = $this->event->order('id DESC')->limit(10)->fetchPairs('id', 'name');
$events[null] = 'ODESLAT VŠEM';
$form = new UI\Form();
$form->addSelect('event_id', 'Účatníků události', $events);
$form->addText('subject', 'Předmět:');
$form->addTextArea('text', 'text')->setAttribute('class', 'tinyMCE');
$form->addCheckbox('notTest', 'TOTO NENÍ TEST');
$form->addMultiUpload('files', 'Přílohy');
$form->addSubmit('send', 'Odeslat')->setAttribute('class', 'btn btn-danger');
$form->onSuccess[] = array($this, 'newsletterFormSucceeded');
$form->setDefaults($this->loadFormValues());
return $form;
}
示例5: createComponentShopForm
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;
}
示例6: create
/**
* @return Form
*/
public function create($id = null)
{
$form = new Form();
$form->addtext('id_inzerat', 'Id inzerátu');
$form->addText('title', 'Název inzerátu:')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno')->setRequired('Vyplňte prosím nadpis inzerátu.');
// The categories need to be retrieved from the database, ToDO
// $kategorie_ex = $this->database->findAll('kategorie');
// $kategorie;
// foreach ($kategorie_ex as $kategorie_i)
// array_push($kategorie, $kategorie_i);
$kategorie = array('1' => 'Elektronika', '2' => 'Akce', '3' => 'Jidlo', '4' => 'Jine');
$form->addSelect('id_kategorie', 'Vyberte kategorii:', $kategorie)->setAttribute('class', 'form-control');
$form->addTextArea('body', 'Popis:')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno');
$form->addTextArea('bodyEdit', 'Popis:')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno');
$form->addMultiUpload('photo', 'Fotky:');
//->addRule(Form::IMAGE, 'Obrázek musí být JPEG, PNG nebo GIF.')
//->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost obrázku je 4MB', 4 * 1000 * 1024);
$form->addText('value', 'Cena:')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Nevyplněno');
$form->addSubmit('send', 'Uložit inzerát')->setAttribute('class', 'btn btn-primary');
$form->onSuccess[] = array($this, 'save_inzerat');
return $form;
}
示例7: create
/** @return Form */
public function create()
{
$f = new Form();
$f->addText('name', 'Jméno:');
//->setRequired();
$f->addText('surname', 'Příjmení:');
//->setRequired();
$f->addText('institution', 'Pracoviště:');
$f->addText('project', 'Projekt:');
$f->AddText('www', 'web:');
$f->addText('date', 'Datum setkání:')->setAttribute('placeholder', 'rrrr-mm-dd');
$f->addTextArea('note', 'Poznámka')->setAttribute('rows', '10');
$f->addMultiUpload('img', 'Vizitka');
$f->addUpload('foto', 'Foto:');
$f->addSubmit('submit', 'Uložit');
// setup form rendering
$renderer = $f->getRenderer();
$renderer->wrappers['controls']['container'] = NULL;
$renderer->wrappers['pair']['container'] = 'div class=form-group';
$renderer->wrappers['pair']['.error'] = 'has-error';
$renderer->wrappers['control']['container'] = 'div class=col-sm-8';
$renderer->wrappers['label']['container'] = 'div class="col-sm-2 control-label"';
$renderer->wrappers['control']['description'] = 'span class=help-block';
$renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
$f->getElementPrototype()->class('form-horizontal');
foreach ($f->getControls() as $control) {
if ($control instanceof Controls\Button) {
$control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-success' : 'btn btn-default');
$usedPrimary = TRUE;
} elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
$control->getControlPrototype()->addClass('form-control');
} elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
$control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
}
}
return $f;
}
示例8: createComponentFileUploadForm
protected function createComponentFileUploadForm()
{
$form = new AppForm();
$form->setTranslator($this->translator);
$renderer = $form->getRenderer();
$form->addMultiUpload("image", "Choose image(s)")->setRequired()->addRule(Form::MAX_FILE_SIZE, 'File is too big! Please, choose smaller one. It could be 3 megs large.', 3 * 1024 * 1024);
$form->addSubmit('send', 'Upload')->getControlPrototype()->class('btn btn-primary');
$form->onSuccess[] = callback($this, 'fileUploadSuccess');
return $form;
}
示例9: createComponentFileUploadForm
protected function createComponentFileUploadForm()
{
$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->addMultiUpload("image", "Choose image(s)")->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->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;
}
示例10: createComponentUploadImg
protected function createComponentUploadImg()
{
$form = new Form();
$form->addMultiUpload("imgs", "Obrázek")->addRule(Form::IMAGE, "Lze vložit pouze obrázky");
// ->addRule(Form::MAX_FILE_SIZE, 'Maximální velikost souboru je 5 MB.', '50000');
$form->addHidden('folder', $this->getParameter('galId'));
$form->addSubmit('create', 'Nahrát');
$form->addSubmit('cancel', 'Zrušit')->setValidationScope(FALSE);
// setup form rendering
$renderer = $form->getRenderer();
$renderer->wrappers['controls']['container'] = NULL;
$renderer->wrappers['pair']['container'] = 'div class="form-group text-center"';
$renderer->wrappers['pair']['.error'] = 'has-error';
$renderer->wrappers['control']['container'] = 'div class="col-sm-10"';
$renderer->wrappers['label']['container'] = 'div class="control-label text-center col-sm-1"';
$renderer->wrappers['control']['description'] = 'span class=help-block';
$renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
// make form and controls compatible with Twitter Bootstrap
$form->getElementPrototype()->class('form-horizontal');
foreach ($form->getControls() as $control) {
if ($control instanceof Controls\Button) {
$control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
$usedPrimary = TRUE;
} elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
$control->getControlPrototype()->addClass('form-control');
} elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
$control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
}
}
$form->onSuccess[] = array($this, 'uploadImgSuccess');
return $form;
}