本文整理汇总了PHP中Zend\Form\Element\File类的典型用法代码示例。如果您正苦于以下问题:PHP File类的具体用法?PHP File怎么用?PHP File使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了File类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
public function getForm(array $default_status)
{
if (!$this->form) {
$hidId = new Element\Hidden();
$hidId->setName('userId');
$txtName = new Element\Text();
$txtName->setLabel('User Name')->setName("userName")->setAttribute('class', 'form-control');
$password = new Element\Password();
$password->setLabel('Password')->setName('password')->setAttribute('class', 'form-control');
$confirmPassword = new Element\Password();
$confirmPassword->setName('confirmPassword')->setLabel('Retype Password')->setAttribute('class', 'form-control');
$selectRole = new Element\Hidden('userRole');
$description = new Element\Textarea();
$description->setName('description')->setLabel('Description')->setAttribute('class', 'form-control');
$status = new Element\Select();
$status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($default_status);
$image = new Element\File();
$image->setName('image')->setLabel('Profile image');
$form = new Form();
$form->setAttribute('class', 'form-horizontal');
$form->setAttribute('enctype', 'multipart/form-data');
$form->add($hidId);
$form->add($txtName);
$form->add($password);
$form->add($confirmPassword);
$form->add($selectRole);
$form->add($description);
$form->add($status);
$form->add($image);
$this->form = $form;
}
return $this->form;
}
示例2: __construct
public function __construct($name = null)
{
parent::__construct('registration');
$this->setAttribute('method', 'post');
/*
$this->add(array(
'name' => 'file',
'attributes' => array(
'type' => 'Zend\Form\Element\File',
),
'options' => array(
'label' => 'Single file input',
),
));
*/
// Single file upload
$file = new Element\File('file');
$file->setLabel('Single file input');
// HTML5 multiple file upload
$multiFile = new Element\File('multi-file');
$multiFile->setLabel('Multi file input')->setAttribute('multiple', true);
// $form = new Form('my-file');
$this->add($file)->add($multiFile);
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Upload', 'id' => 'submitbutton')));
}
示例3: __construct
public function __construct(EntityManager $objectManager)
{
parent::__construct('ligue');
$this->setAttributes(array('method' => 'post', 'id' => 'auth', 'role' => 'form'));
$this->setInputFilter(new LigueFilter($objectManager));
$this->setHydrator(new DoctrineObject($objectManager));
// Id
$id = new Hidden('id');
$this->add($id);
// Nom
$nom = new Text('nom');
$nom->setLabel('Nom')->setLabelAttributes(array('class', 'control-label'));
$nom->setAttributes(array('id' => 'nom', 'class' => 'form-control', 'placeholder' => 'Nom', 'required' => true));
$this->add($nom);
// Image
$image = new File('image');
$image->setLabel('Image')->setLabelAttributes(array('class', 'control-label'));
$image->setAttributes(array('id' => 'image', 'class' => 'form-control', 'placeholder' => 'Image'));
$this->add($image);
// Date début
$dateDebut = new Text('dateDebut');
$dateDebut->setLabel('Début de la ligue')->setLabelAttributes(array('class', 'control-label'));
$dateDebut->setAttributes(array('id' => 'dateDebut', 'class' => 'form-control'));
//$this->add($dateDebut);
// Date fin
$dateFin = new Text('dateFin');
$dateFin->setLabel('Fin de la ligue')->setLabelAttributes(array('class', 'control-label'));
$dateFin->setAttributes(array('id' => 'dateFin', 'class' => 'form-control'));
//$this->add($dateFin);
// Submit
$submit = new Submit('submit');
$submit->setValue('Enregistrer');
$submit->setAttributes(array('class' => 'btn btn-primary'));
$this->add($submit);
}
示例4: addElements
public function addElements()
{
// File Input
$file = new Element\File('image');
$file->setLabel('Zdjęcia')->setAttribute('id', 'image-file')->setAttribute('multiple', true)->setAttribute('class', 'button round blue image-right');
$this->add($file);
}
示例5: __construct
public function __construct()
{
parent::__construct(null);
$this->setInputFilter(new ReuniaoFilter());
$this->setAttribute('method', 'POST')->setAttribute('enctype', 'multipart/form-data');
$id = new \Zend\Form\Element\Hidden('id');
$this->add($id);
$data = new Text('data');
$data->setLabel('Data')->setAttribute('autofocus', 'autofocus');
$this->add($data);
$eventos = new Text('eventos');
$eventos->setLabel('Evento')->setAttribute('placeholder', 'Entre com o evento')->setAttribute('maxlength', 255)->setAttribute('size', 50);
$this->add($eventos);
$pauta = new Text('pauta');
$pauta->setLabel('Pauta')->setAttribute('maxlength', 255)->setAttribute('size', 50);
$this->add($pauta);
$cardapio = new Textarea('cardapio');
$cardapio->setLabel('Cardápio')->setAttribute('cols', '60')->setAttribute('rows', '5');
$this->add($cardapio);
$listaPresente = new Textarea('lista_presente');
$listaPresente->setLabel('Lista de Presente')->setAttribute('cols', '60')->setAttribute('rows', '5');
$this->add($listaPresente);
$ata = new Text('ata');
$ata->setLabel('Ata')->setAttribute('maxlength', 255)->setAttribute('size', 50);
$this->add($ata);
$imagnes = new File('imagens');
$imagnes->setLabel('Imagens')->setAttribute('id', 'imagnes');
$this->add($imagnes);
$button = new Button('submit');
$button->setLabel('Salvar')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success'));
$this->add($button);
}
示例6: testWillAddFileEnctypeAttributeToForm
public function testWillAddFileEnctypeAttributeToForm()
{
$file = new FileElement('foo');
$formMock = $this->getMock('Zend\\Form\\Form');
$formMock->expects($this->exactly(1))->method('setAttribute')->with($this->stringContains('enctype'), $this->stringContains('multipart/form-data'));
$file->prepareElement($formMock);
}
示例7: __construct
public function __construct(EntityManager $entityManager)
{
parent::__construct();
$this->entityManager = $entityManager;
$this->setAttributes(array("method" => "post", "enctype" => "multipart/form-data", "class" => "form"));
$this->setInputFilter(new HomeBannersFilters());
// Campo de titulo
$titulo = new Text('titulo');
$titulo->setLabel("* Título")->setAttributes(array("maxLength" => "400", "class" => "form-control", "required" => "required"));
// Campo tipo de midia
$tipo = new Radio('tipo_banner');
$tipo->setLabel('Tipo de mídia');
$tipo->setValueOptions(array('IMAGEM' => 'Imagem', 'VIDEO' => 'Vídeo'))->setOptions(array('label_attributes' => array('class' => 'radio-inline')))->setAttribute("value", "IMAGEM");
// Campo de midia
$file = new File("midia");
$file->setLabel('*Imagem (Tamanho exato de ' . \Base\Constant\Upload::BANNER_WIDTH . 'x' . \Base\Constant\Upload::BANNER_HEIGTH . ' px | ' . \Base\Constant\Upload::BANNER_MAX_SIZE . ')')->setAttribute('name', 'midia')->setAttribute('id', 'image');
// Campo de midia2
$file2 = new File("midia2");
$file2->setLabel('*Video (' . \Base\Constant\Upload::BANNER_MAX_SIZE . ')')->setAttribute('id', 'video');
// Botão de Submit
$botao = new Submit("submit");
$botao->setAttributes(array("value" => "Salvar"));
// Adiciona campos
$this->add($titulo)->add($tipo)->add($file)->add($file2)->add($botao);
}
示例8: addElements
public function addElements()
{
$id = new Element\Text('id');
$id->setLabel('ID')->setAttribute('class', 'form-control')->setAttribute('type', 'hidden');
$this->add($id);
$name = new Element\Text('name');
$name->setLabel('catalog name')->setAttribute('class', 'form-control')->setAttribute('required', 'true')->setAttribute('onchange', 'get_alias();')->setAttribute('id', 'name');
$this->add($name);
$alias = new Element\Text('alias');
$alias->setLabel('catalog alias')->setAttribute('required', 'true')->setAttribute('class', 'form-control')->setAttribute('id', 'alias');
$this->add($alias);
$description = new Element\Textarea('description');
$description->setLabel('Description')->setAttribute('class', 'materialize-textarea form-control')->setAttribute('id', 'description');
$this->add($description);
$hot = new Element\Radio('hot');
$hot->setLabel('Choice hot')->setValueOptions(array('0' => 'No Hot', '1' => 'Hot'))->setAttribute('id', 'hot')->setAttribute('class', 'radio_style');
$this->add($hot);
$new = new Element\Radio('new');
$new->setLabel('Choice new')->setValueOptions(array('0' => 'No New', '1' => 'New'))->setAttribute('id', 'new')->setAttribute('class', 'radio_style');
$this->add($new);
$status = new Element\Radio('status');
$status->setLabel('status');
//->setAttribute('required', 'true')
$status->setValueOptions(array('0' => 'Pause', '1' => 'Active'))->setAttribute('id', 'status')->setAttribute('class', 'radio_style');
$this->add($status);
$show_index = new Element\Radio('show_index');
$show_index->setLabel('show_index');
//->setAttribute('required', 'true')
$show_index->setValueOptions(array('0' => 'No', '1' => 'Yes'))->setAttribute('id', 'show_index')->setAttribute('class', 'radio_style');
$this->add($show_index);
$img = new Element\File('img');
$img->setLabel('file img (* not support .png , .gif)')->setAttribute('class', 'form-control')->setAttribute('type', 'file')->setAttribute('accept', '.jpg, .jpeg, .JPG, .JPEG')->setAttribute('id', 'img');
$this->add($img);
}
示例9: addElements
public function addElements()
{
// File Input
$file = new Element\File('image-file');
$file->setLabel('Avatar Image Upload')->setAttribute('id', 'image-file');
$this->add($file);
}
示例10: addElements
public function addElements()
{
// File Input
$file = new Element\File('image-file');
$file->setLabel('Avatar Image Upload')->setAttribute('id', 'image-file');
$this->add($file);
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Upload', 'id' => 'submitbutton')));
}
示例11: form
/**
* {@inheritDoc}
*/
public function form(PhpRenderer $view, array $options = [])
{
$fileInput = new File('file[__index__]');
$fileInput->setOptions(['label' => $view->translate('Upload File')]);
$fileInput->setAttributes(['id' => 'media-file-input-__index__']);
$field = $view->formRow($fileInput);
return $field . '<input type="hidden" name="o:media[__index__][file_index]" value="__index__">';
}
示例12: addElements
public function addElements()
{
// File Input
$file = new Element\File('file');
$file->setLabel('File Input')->setAttributes(['id' => 'file', 'multiple' => true]);
$this->add($file);
// Progress ID hidden input is only added with a view helper,
// not as an element to the form.
}
示例13: addElements
public function addElements()
{
// File Input
$file = new Element\File('file');
$file->setLabel('Image Upload')->setAttribute('id', 'file')->setAttribute('multiple', true);
// That's it
$this->add($file);
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Upload', 'id' => 'submitbutton')));
}
示例14: addElements
public function addElements()
{
// File Input
$file = new Element\File('file');
$file->setLabel('File Input')->setAttributes(array('id' => 'file', 'class' => 'form-control'));
$this->add($file);
$this->add(array('type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'id'));
$this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'file_type', 'attributes' => array('id' => 'file_type', 'options' => \Application\Form\OptionsConfig::getFormOption('file_upload_type'), 'class' => 'form-control', 'required' => true), 'options' => array('label' => 'Datei-Typ')));
}
示例15: __construct
public function __construct($name = null, array $classificacoes = null)
{
parent::__construct($name);
$this->classificacoes = $classificacoes;
$this->setInputFilter(new PessoaFilter());
$this->setAttribute('method', 'POST');
$this->setAttribute('enctype', 'multipart/form-data');
$id = new \Zend\Form\Element\Hidden('id');
$this->add($id);
$titulo = new Text('nome');
$titulo->setLabel('Nome : ')->setAttribute('placeholder', 'Entre com o nome')->setAttribute('maxlength', 100)->setAttribute('size', 50)->setAttribute('autofocus', 'autofocus');
$this->add($titulo);
$classificacao = new Select();
$classificacao->setLabel("Classificacao ")->setName("classification")->setOptions(array('value_options' => $classificacoes));
$this->add($classificacao);
$dataAdmissao = new Text('data_admissao');
$dataAdmissao->setLabel('Data Admissão');
$this->add($dataAdmissao);
$enderecoResidencial = new Text('endereco_residencial');
$enderecoResidencial->setLabel('End. Residencial:')->setAttribute('placeholder', 'Entre com o endereço residencial')->setAttribute('maxlength', 255)->setAttribute('size', 50);
$this->add($enderecoResidencial);
$telefoneResidencial = new Text('telefone_residencial');
$telefoneResidencial->setLabel('Tel. Residencial');
$this->add($telefoneResidencial);
$celular = new Text('celular');
$celular->setLabel('Celular');
$this->add($celular);
$emailPessoal = new Text('email_pessoal');
$emailPessoal->setLabel('Email Pessoal');
$this->add($emailPessoal);
$enderecoComercial = new Text('endereco_comercial');
$enderecoComercial->setLabel('End. Comercial:')->setAttribute('placeholder', 'Entre com o endereço comercial')->setAttribute('maxlength', 255)->setAttribute('size', 50);
$this->add($enderecoComercial);
$telefoneComercial = new Text('telefone_comercial');
$telefoneComercial->setLabel('Tel. Comercial');
$this->add($telefoneComercial);
$emailComercial = new Text('email_comercial');
$emailComercial->setLabel('Email Comercial');
$this->add($emailComercial);
$conjuge = new Text('conjuge');
$conjuge->setLabel('Nome do Conjuge')->setAttribute('maxlength', 100)->setAttribute('size', 50);
$this->add($conjuge);
$celularConjuge = new Text('celular_conjuge');
$celularConjuge->setLabel('Celular do Conjuge');
$this->add($celularConjuge);
/*===========================================================================================*/
$fotografia = new File('fotografia');
$fotografia->setLabel('Fotografia')->setAttribute('id', 'fotografia');
$this->add($fotografia);
/*===========================================================================================*/
$ativo = new Checkbox('ativo');
$ativo->setLabel('Ativo : ');
$this->add($ativo);
$button = new Button('submit');
$button->setLabel('Salvar')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success'));
$this->add($button);
}