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


PHP Form::init方法代码示例

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


在下文中一共展示了Form::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:8,代码来源:GroupMemberships.php

示例2: init

 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $this->_types = $this->getOption('customFieldManager')->getFields();
     $fields = new \Zend\Form\Fieldset('Fields');
     $inputFilterField = new \Zend\InputFilter\InputFilter();
     foreach ($this->_types as $name => $type) {
         if ($type == 'clob') {
             $element = new \Zend\Form\Element\Textarea($name);
         } else {
             $element = new \Zend\Form\Element\Text($name);
         }
         if ($name == 'TAG') {
             $element->setLabel('Category');
         } else {
             $element->setLabel($name);
         }
         $fields->add($element);
         $filter = array('name' => $name, 'required' => false, 'filters' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'filterField'), 'callback_params' => $type))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateField'), 'callbackOptions' => $type))));
         $inputFilterField->add($filter);
     }
     $this->add($fields);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Change');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add($inputFilterField, 'Fields');
     $this->setInputFilter($inputFilter);
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:30,代码来源:CustomFields.php

示例3: init

 function init()
 {
     parent::init();
     $this->setLayout('reports\\productionform');
     $this->date_range_field = $this->addField('DateRangePicker', 'date_range')->setStartDate($this->app->now)->setEndDate($this->app->now)->getBackDatesSet();
     switch ($this->entity) {
         case 'customer':
             $this->addField('autocomplete/Basic', 'contact')->setModel('xepan\\base\\Contact');
             $this->layout->template->tryDel('department_wrapper');
             $this->layout->template->tryDel('outsourceparty_wrapper');
             break;
         case 'outsourceparty':
             $this->addField('autocomplete/Basic', 'outsource_party')->setModel('xepan\\production\\OutsourceParty');
             $this->layout->template->tryDel('department_wrapper');
             $this->layout->template->tryDel('contact_wrapper');
             break;
         default:
             $this->addField('autocomplete/Basic', 'department')->setModel('xepan\\hr\\Department');
             $this->layout->template->tryDel('contact_wrapper');
             $this->layout->template->tryDel('outsourceparty_wrapper');
             break;
     }
     if ($this->extra_fields) {
         $this->addField('xepan\\base\\DropDown', 'status')->setValueList($this->status_array)->setEmptyText('Please Select');
         $this->addField('xepan\\base\\DropDown', 'order')->setValueList(['desc' => 'Highest', 'asc' => 'Lowest'])->setEmptyText('Please Select');
     } else {
         $this->layout->template->tryDel('extra_field_wrapper');
     }
     $this->addSubmit('Filter')->addClass('btn btn-primary btn-block');
 }
开发者ID:xepan,项目名称:production,代码行数:30,代码来源:FilterForm.php

示例4: init

 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $types = new \Zend\Form\Fieldset('Types');
     $this->add($types);
     $inputFilterTypes = new \Zend\InputFilter\InputFilter();
     $this->_definedTypes = $this->getOption('DeviceManager')->getTypeCounts();
     foreach ($this->_definedTypes as $name => $count) {
         $element = new \Zend\Form\Element\Text($name);
         $element->setValue($name);
         $types->add($element);
         $filter = array('name' => $name, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('min' => 1, 'max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'callbackOptions' => $name, 'message' => $this->_('The name already exists')))));
         $inputFilterTypes->add($filter);
     }
     $add = new \Zend\Form\Element\Text('Add');
     $add->setLabel('Add');
     $this->add($add);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Change');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add($inputFilterTypes, 'Types');
     $inputFilter->add(array('name' => 'Add', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'message' => $this->_('The name already exists'))))));
     $this->setInputFilter($inputFilter);
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:26,代码来源:NetworkDeviceTypes.php

示例5: init

 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $translatedTypes = array('text' => $this->_('Text'), 'clob' => $this->_('Long text'), 'integer' => $this->_('Integer'), 'float' => $this->_('Float'), 'date' => $this->_('Date'));
     $fields = new \Zend\Form\Fieldset('Fields');
     $this->add($fields);
     $inputFilterFields = new \Zend\InputFilter\InputFilter();
     foreach ($this->getOption('CustomFieldManager')->getFields() as $name => $type) {
         if ($name == 'TAG') {
             // Static field, can not be edited
             continue;
         }
         $this->_definedFields[$name] = $translatedTypes[$type];
         $element = new \Zend\Form\Element\Text($name);
         $element->setValue($name);
         $fields->add($element);
         $filter = array('name' => $name, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('min' => 1, 'max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'callbackOptions' => $name, 'message' => $this->_('The name already exists')))));
         $inputFilterFields->add($filter);
     }
     // Empty text field to create new field.
     $newName = new \Zend\Form\Element\Text('NewName');
     $newName->setLabel('Add');
     $this->add($newName);
     // Datatype of new field
     $newType = new \Zend\Form\Element\Select('NewType');
     $newType->setValueOptions($translatedTypes);
     $this->add($newType);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Change');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add($inputFilterFields, 'Fields');
     $inputFilter->add(array('name' => 'NewName', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'message' => $this->_('The name already exists'))))));
     $this->setInputFilter($inputFilter);
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:36,代码来源:DefineFields.php

示例6: init

 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $what = new \Zend\Form\Element\Radio('What');
     $what->setValueOptions(array(\Model\Client\Client::MEMBERSHIP_AUTOMATIC => $this->_('Store search parameters. Group memberships will be updated automatically.'), \Model\Client\Client::MEMBERSHIP_ALWAYS => $this->_('Add current search results. Group memberships will be set only this time.'), \Model\Client\Client::MEMBERSHIP_NEVER => $this->_('Exclude search results from a group.')));
     $what->setValue(\Model\Client\Client::MEMBERSHIP_AUTOMATIC);
     $this->add($what);
     $where = new \Zend\Form\Element\Radio('Where');
     $where->setValueOptions(array('new' => $this->_('Store in new group'), 'existing' => $this->_('Store in existing group')));
     $where->setValue('new')->setAttribute('onchange', 'selectElements()');
     $this->add($where);
     $newGroup = new \Zend\Form\Element\Text('NewGroup');
     $newGroup->setLabel('Name');
     $this->add($newGroup);
     $description = new \Zend\Form\Element\Text('Description');
     $description->setLabel('Description');
     $this->add($description);
     $existingGroup = new \Library\Form\Element\SelectSimple('ExistingGroup');
     $existingGroup->setLabel('Group');
     $groups = array();
     foreach ($this->getOption('GroupManager')->getGroups(null, null, 'Name') as $group) {
         $groups[] = $group['Name'];
     }
     $existingGroup->setValueOptions($groups);
     $this->add($existingGroup);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add(array('name' => 'NewGroup', 'continue_if_empty' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(0, 255), 'message' => $this->_('The input is more than 255 characters long')), 'break_chain_on_failure' => true), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(1, 255), 'message' => "Value is required and can't be empty"), 'break_chain_on_failure' => true), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateGroupExists'), 'message' => $this->_('The name already exists'))))));
     $inputFilter->add(array('name' => 'Description', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Null', 'options' => array('type' => 'string'))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(0, 255), 'message' => $this->_('The input is more than 255 characters long'))))));
     $this->setInputFilter($inputFilter);
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:34,代码来源:AddToGroup.php

示例7: init

 function init()
 {
     parent::init();
     //$this->addField('line','test');
     $u = $this->addField('upload', 'file');
     $u->setController('Controller_Filestore_File');
     //$this->addSubmit('Upload');
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:8,代码来源:UploadTest.php

示例8: init

 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $this->setAttribute('method', 'GET');
     $filter = new \Zend\Form\Element\Select('filter');
     $filter->setLabel('Filter')->setValueOptions(array('accepted' => $this->_('selected for display'), 'ignored' => $this->_('ignored for display'), 'new' => $this->_('new or not categorized'), 'all' => $this->_('all')))->setAttribute('onchange', 'this.form.submit();');
     $this->add($filter);
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:9,代码来源:SoftwareFilter.php

示例9: init

 /**
  * Initialization
  *
  * Initialize login form fields with validators and decorators.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $this->setName('login_form');
     $this->setMethod('post');
     $this->addElement('text', 'foo', array());
     $this->addElement('text', 'bar', array());
     $this->addElement('text', 'baz', array());
 }
开发者ID:rexmac,项目名称:zyndax,代码行数:16,代码来源:TestForm.php

示例10: init

 function init()
 {
     parent::init();
     $this->config = Config::getInstance();
     $this->namespace = __NAMESPACE__;
     $public_location = $this->app->pathfinder->addLocation(array('js' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/js'), 'css' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/css')))->setBasePath(getcwd() . '/public')->setBaseURL($this->app->getBaseURL());
     $this->js(true)->_load('atk4_messages');
     $private_location = $this->app->pathfinder->addLocation(array('addons' => array('../vendor/atk4')))->setBasePath('.');
 }
开发者ID:atk4,项目名称:messages,代码行数:9,代码来源:Message.php

示例11: registerForm

 static function registerForm(Form $form)
 {
     self::$forms[$form->getName()] = $form;
     if (@$_REQUEST[FormSigner::ID_ELT] === $form->getName()) {
         $form->call(self::getSigner());
         return true;
     } else {
         $form->init();
     }
     return false;
 }
开发者ID:phoebius,项目名称:proof-of-concept,代码行数:11,代码来源:FormObserver.class.php

示例12: init

    function init(){
        parent::init();
        $f=$this;

        $f->addField('line','name')->validateNotNull()
            ->setFieldHint('Click "Register" to see error');
        $f->addField('line','email')
            ->validateNotNull()
            ->validateField('filter_var($this->get(), FILTER_VALIDATE_EMAIL)')
            ;

        $f->addField('password','password')->validateNotNull()
            ->setProperty('max-length',30)->setFieldHint('30 characters maximum');

        $p2=$f->addField('password','password2')
            ->validateField('$this->get()==$this->owner->getElement("password")->get()',
                    'Passwords do not match');




        $f->addSeparator();

        $f->addField('DatePicker','date_birth','Birthdate');

        $f->addField('dropdown','age')
            ->setValueList(array('','11 - 20', '21 - 30', '31 - 40'));

        $f->addField('text','about')
            ->setProperty('cols',45)->setProperty('rows','5')
            ->validateField('5000>=strlen($this->get())','Too long');

        $f->addSeparator();

        $f->addField('radio','sex')
            ->setValueList(array('m'=>'Male','f'=>'Female'))
            ;  // automatically validated to be one of value list



        $f->addField('checkbox','agreeRules','I Agree to Rules and Terms'
                )->validateNotNull('You must agree to the rules');


        $js=array();
        $this->js()->atk4_form('fieldError','password2','Passwords do not match');
        $this->js()->atk4_form('fieldError','age','Age is not entered - sample longer error which may span');
        $this->js()->atk4_form('fieldError','about','Sample error on textarea field');


        $f->addSubmit('Submit');
        $f->addSubmit('Show More Errors');

    }
开发者ID:nanomo,项目名称:atk4-web,代码行数:54,代码来源:form.php

示例13: init

 function init()
 {
     parent::init();
     $this->addSubmit('Save');
     $f = $this;
     $this->api->addHook('post-init', function () use($f) {
         if ($f->isSubmitted()) {
             $f->update();
             $f->js()->univ()->successMessage('Saved')->execute();
         }
     });
 }
开发者ID:xavoctechnocratspvtltd,项目名称:svc,代码行数:12,代码来源:FormAndSave.php

示例14: init

 function init()
 {
     parent::init();
     $this->addField('line', 'email', 'E-Mail')->addField('password', 'clear', 'Password')->addField('line', 'name', 'Full Name')->addField('line', 'relocated_to', 'Relocate to')->addField('line', 'forward_to', 'Forward to')->addField('line', 'cc_to', 'Send copy to');
     if ($this->api->getUserLevel() == 99) {
         $this->addField('text', 'domains', 'Trusted domains')->addField('dropdown', 'access_level', 'Access Level')->setValueList(array(0 => 'Self only', 9 => 'Maintain', 99 => 'Admin'));
     }
     $this->addSubmit('Save');
     if ($this->api->getUserLevel() == 99 && $_GET['id'] != '') {
         $this->addSubmit('Delete');
     }
     $this->setSource('users')->addConditionFromGET('id');
 }
开发者ID:romaninsh,项目名称:Agile-Postfix-Admin,代码行数:13,代码来源:index.php

示例15: init

 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $deleteInterfaces = new \Zend\Form\Element\Checkbox('DeleteInterfaces');
     $deleteInterfaces->setLabel('Delete interfaces from network listing')->setChecked($this->getOption('config')->defaultDeleteInterfaces);
     $this->add($deleteInterfaces);
     $yes = new \Library\Form\Element\Submit('yes');
     $yes->setLabel('Yes');
     $this->add($yes);
     $no = new \Library\Form\Element\Submit('no');
     $no->setLabel('No');
     $this->add($no);
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:14,代码来源:DeleteClient.php


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