コード例 #1
0
ファイル: BackupPresenter.php プロジェクト: VNovotna/MP2014
 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentLoadBackup()
 {
     $form = new \Nette\Application\UI\Form();
     $form->addUpload('upload', 'Zip archiv se zálohou:')->addRule(\Nette\Application\UI\Form::MIME_TYPE, "Soubor musí být zip archiv", "application/zip");
     $form->addSubmit('send', 'Nahrát');
     $form->onSuccess[] = $this->loadBackupSubmitted;
     $form->onError[] = function ($form) {
         foreach ($form->errors as $er) {
             $form->getPresenter()->flashMessage($er, 'error');
         }
         $form->cleanErrors();
     };
     return $form;
 }