当前位置: 首页>>代码示例>>PHP>>正文


PHP File::setName方法代码示例

本文整理汇总了PHP中Zend\Form\Element\File::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP File::setName方法的具体用法?PHP File::setName怎么用?PHP File::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Form\Element\File的用法示例。


在下文中一共展示了File::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:khinmyatkyi,项目名称:Office_Management,代码行数:33,代码来源:UserHelper.php

示例2: getForm

 public function getForm(array $currencies, array $companies, array $contacts, array $statusList)
 {
     if (!$this->form) {
         $hidId = new Element\Hidden();
         $hidId->setName('proposalId');
         $txtCompanyId = new Element\Select();
         $txtCompanyId->setLabel('Company Name')->setName("companyId")->setAttribute('class', 'form-control')->setEmptyOption("--Choose Company--")->setValueOptions($companies);
         $txtContactId = new Element\Select();
         $txtContactId->setLabel('Contact Name')->setName('contactId')->setAttribute('class', 'form-control')->setEmptyOption("--Choose Contact--")->setValueOptions($contacts);
         $txtCode = new Element\Text();
         $txtCode->setLabel('Code')->setName('code')->setAttribute('class', 'form-control');
         $txtName = new Element\Text();
         $txtName->setLabel('Name')->setName('name')->setAttribute('class', 'form-control');
         $txtAmount = new Element\Number();
         $txtAmount->setName("amount")->setLabel('Amount')->setAttribute('class', 'form-control')->setAttributes(array('min' => '100', 'max' => '99999999999', 'step' => '100'));
         $selectCurrency = new Element\Select();
         $selectCurrency->setName('currencyId')->setLabel('Currency')->setAttribute('class', 'form-control')->setValueOptions($currencies);
         $txtProposalDate = new Element\Date('proposalDate');
         $txtProposalDate->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
         $txtProposalFile = new Element\File();
         $txtProposalFile->setName('proposalFile')->setLabel('Upload file');
         $txtNodes = new Element\Textarea();
         $txtNodes->setLabel('Notes')->setName('notes')->setAttribute('class', 'form-control');
         $txtProposalBy = new Element\Text();
         $txtProposalBy->setName('proposalBy')->setLabel('Proposal By')->setAttribute('class', 'form-control');
         $txtGroupCode = new Element\Text();
         $txtGroupCode->setLabel('Group Code')->setName('group_code')->setAttribute('class', 'form-control');
         $txtStatus = new Element\Select();
         $txtStatus->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList);
         $form = new Form();
         $form->setAttribute('class', 'form-horizontal');
         $form->setAttribute('enctype', 'multipart/form-data');
         $form->add($hidId);
         $form->add($txtCompanyId);
         $form->add($txtContactId);
         $form->add($txtCode);
         $form->add($txtName);
         $form->add($txtAmount);
         $form->add($selectCurrency);
         $form->add($txtProposalDate);
         $form->add($txtProposalFile);
         $form->add($txtNodes);
         $form->add($txtProposalBy);
         $form->add($txtGroupCode);
         $form->add($txtStatus);
         $this->form = $form;
     }
     return $this->form;
 }
开发者ID:khinmyatkyi,项目名称:Office_Management,代码行数:49,代码来源:ProposalHelper.php

示例3: load

 /**
  * Load upload editor
  *
  * @return mixed
  */
 public function load()
 {
     $parameters = $this->getConfig();
     $property = $this->getProperty();
     $upload = new Element\File($this->getName());
     $value = $this->getValue();
     $upload->setLabel($property->getName());
     $upload->setAttribute('class', 'form-control')->setAttribute('id', $this->getName());
     if (!empty($parameters['is_multiple'])) {
         $upload->setAttribute('multiple', 'multiple');
         $upload->setName($upload->getName());
     }
     $hiddenUpload = new Element\Hidden($this->getName() . '-hidden');
     if (!empty($value)) {
         $hiddenUpload->setValue($value);
     }
     return array($upload, $hiddenUpload, $this->addPath(__DIR__)->render('upload-editor.phtml', array('files' => $value, 'id' => $this->getName(), 'isMultiple' => $parameters['is_multiple'])));
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:23,代码来源:Editor.php

示例4: render

 public function render($formPV, $id)
 {
     $form = new Form();
     $form->setAttribute('id', $id);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $factory = new InputFactory();
     foreach ($formPV as $element) {
         if (isset($element->line_text)) {
             $attributes = $element->line_text[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //$required    = ($attributes->data->required == 'true') ? true : false ;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $element = new Element\Text($name);
             $element->setName($label);
             $element->setLabel($label);
             $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
             $form->add($element);
             $options = array();
             $options['encoding'] = 'UTF-8';
             if ($lengthMin && $lengthMin > 0) {
                 $options['min'] = $lengthMin;
             }
             if ($lengthMax && $lengthMax > $lengthMin) {
                 $options['max'] = $lengthMax;
                 $element->setAttribute('maxlength', $lengthMax);
                 $options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
             }
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
         }
         if (isset($element->line_email)) {
             $attributes = $element->line_email[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //$required    = ($attributes->data->required == 'true') ? true : false ;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $element = new Element\Email($name);
             $element->setLabel($label);
             $element->setName($label);
             $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
             $form->add($element);
             $options = array();
             $options['encoding'] = 'UTF-8';
             if ($lengthMin && $lengthMin > 0) {
                 $options['min'] = $lengthMin;
             }
             if ($lengthMax && $lengthMax > $lengthMin) {
                 $options['max'] = $lengthMax;
                 $element->setAttribute('maxlength', $lengthMax);
                 $options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
             }
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
         }
         if (isset($element->line_checkbox)) {
             $attributes = $element->line_checkbox[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //                 $required    = ($attributes->data->required == 'yes') ? true : false;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $innerData = isset($attributes->data->innerData) ? $attributes->data->innerData : array();
             $element = new Element\MultiCheckbox($name);
             $element->setLabel($label);
             $element->setName($label);
             $element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id));
             $values = array();
             foreach ($innerData as $value) {
                 $values[] = $value->label;
             }
             $element->setValueOptions($values);
             $form->add($element);
             $options = array();
             $options['encoding'] = 'UTF-8';
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required)));
         }
         if (isset($element->line_paragraph)) {
             $attributes = $element->line_paragraph[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
//.........这里部分代码省略.........
开发者ID:arnaud-hours,项目名称:PlaygroundCore,代码行数:101,代码来源:Formgen.php


注:本文中的Zend\Form\Element\File::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。