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


PHP Fieldset::add方法代码示例

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


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

示例1: register

 public static function register(Fieldset $form)
 {
     $form->add('email', 'E-mail:')->add_rule('required')->add_rule('valid_email');
     $form->add('password', 'Choose Password:', array('type' => 'password'))->add_rule('required');
     $form->add('password2', 'Re-type Password:', array('type' => 'password'))->add_rule('required');
     $form->add('submit', ' ', array('type' => 'submit', 'value' => 'Register'));
     return $form;
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:8,代码来源:user.php

示例2: populate_register_fieldset

 public static function populate_register_fieldset(Fieldset $form)
 {
     $form->add('username', 'Username:', array('class' => 'form-control'))->add_rule('required');
     $form->add('password', 'Choose Password:', array('type' => 'password', 'class' => 'form-control'))->add_rule('required');
     $form->add('password2', 'Re-type Password:', array('type' => 'password', 'class' => 'form-control'))->add_rule('required');
     $form->add('email', 'E-mail:', array('class' => 'form-control'))->add_rule('required')->add_rule('valid_email');
     $form->add('submit', ' ', array('type' => 'submit', 'value' => 'Register', 'class' => 'btn btn-primary'));
     return $form;
 }
开发者ID:blueshift9,项目名称:pscms,代码行数:9,代码来源:user.php

示例3: getRadioCheckbox

 public function getRadioCheckbox($renderApi, $unit, $fieldId, $postRequestValue = null, $required = false)
 {
     $formField = new \Fieldset();
     $listOptions = $this->listOptions->getListOptions($renderApi, $unit);
     $inputName = strlen($renderApi->getFormValue($unit, 'inputName')) > 0 ? $renderApi->getFormValue($unit, 'inputName') . "[]" : $fieldId . "[]";
     if ($listOptions->hasOptions()) {
         $optionCount = 0;
         $options = $listOptions->getOptions();
         $optionsLength = count($options);
         foreach ($options as $option) {
             /* @var $option \Option */
             $properties = $unit->getFormValues();
             if ($properties["listType"] === \ListType::RADIO) {
                 $choiceField = new \RadioButtonField();
             } elseif ($properties["listType"] === \ListType::CHECKBOX) {
                 $choiceField = new \CheckboxField();
             }
             $optionId = $fieldId . '_' . $optionCount;
             $elementProperties = $choiceField->getElementProperties();
             $elementProperties->addAttribute("value", $option->getValue());
             $elementProperties->addAttribute("name", $inputName);
             $elementProperties->addAttribute("id", $optionId);
             // set required attribute for radio options or when there is only one checkbox
             // don't set for multiple checkboxes to match server-side validation logic
             if ($required && ($properties["listType"] === \ListType::RADIO || $optionsLength === 1)) {
                 $elementProperties->addAttribute("required", null);
             }
             $request = new Request();
             $request->isPostRequest();
             if (!$request->isPostRequest() && $option->isChecked() || !is_null($postRequestValue) && in_array($option->getValue(), $postRequestValue)) {
                 $elementProperties->addAttribute("checked", null);
             }
             $label = new \Label();
             $label->add($choiceField);
             $label->add(new \Span($option->getName()));
             $labelProperties = $label->getElementProperties();
             $labelProperties->addAttribute("for", $optionId);
             $formField->add($label);
             $optionCount++;
         }
     }
     if ($this->formSubmit->isValid($renderApi, $unit) && !$this->isValidValue($unit, $postRequestValue)) {
         $formField->add($this->getErrorMessage($unit, $postRequestValue));
         $formField->getElementProperties()->addClass('vf__error');
     }
     return $formField;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:47,代码来源:ChoiceBox.php

示例4: add

 /**
  * Alias for $this->fieldset->add()
  */
 public function add($name, $label = '', array $attributes = array(), array $rules = array())
 {
     return $this->fieldset->add($name, $label, $attributes, $rules);
 }
开发者ID:highestgoodlikewater,项目名称:webspider-1,代码行数:7,代码来源:instance.php

示例5: viewAll

 /**
  * Display all options
  * @return void
  */
 function viewAll()
 {
     global $DB, $USER;
     $r = $DB->config->get(array('type!' => 'not_editable'), false, false, 'section,property');
     $form = new Form();
     $e = $this->may($USER, EDIT);
     $lastSectionName = false;
     $lastSection = false;
     $sections = array();
     while ($c = Database::fetchAssoc($r)) {
         if ($lastSectionName != $c['section']) {
             $lastSectionName = $c['section'];
             if ($lastSection != false && $lastSection->count() == 0) {
                 array_pop($sections);
             }
             $sections[] = $lastSection = new Fieldset(ucwords(str_replace('_', ' ', $c['section'])));
         }
         $mult = false;
         $a = false;
         switch ($c['type']) {
             case 'CSV':
                 if (is_array($c['value'])) {
                     $c['value'] = @join(',', $c['value']);
                 }
             case 'text':
                 if ($e) {
                     $a = new Input(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', $c['value'], null, __($c['description']));
                 } else {
                     $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">' . $c['value'] . '</span><span class="description">' . __($c['description']) . '</span>';
                 }
                 break;
             case 'password':
                 if ($e) {
                     $a = new Password(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', '********', null, __($c['description']));
                 } else {
                     $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">********</span><span class="description">' . __($c['description']) . '</span>';
                 }
                 break;
             case 'set':
                 $mult = true;
             case 'select':
                 if (is_array($c['set'])) {
                     if ($e) {
                         $a = new Select(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', array_map('__', $c['set']), $c['value'], $mult, false, false, __($c['description']));
                     } else {
                         $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">' . @$c['set'][$c['value']] . '</span><span class="description">' . __($c['description']) . '</span>';
                     }
                 }
                 break;
             case 'check':
                 if ($e) {
                     $a = new Checkbox(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', $c['value'], $c['value'], false, __($c['description']));
                 } else {
                     $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">' . $c['value'] . '</span><span class="description">' . __($c['description']) . '</span>';
                 }
                 break;
         }
         if ($a) {
             $lastSection->add($a);
         }
     }
     if ($lastSection != false && $lastSection->count() == 0) {
         array_pop($sections);
     }
     if ($e) {
         return $form->collection($sections);
     } else {
         return join('', $sections);
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:74,代码来源:ConfigEditor.php

示例6: set_fieldset

 /**
  * @param   Fieldset  Fieldset to assign the field to
  * @return  Fieldset_Field
  * @throws  \RuntimeException
  */
 public function set_fieldset(Fieldset $fieldset)
 {
     // if we currently have a fieldset
     if ($this->fieldset) {
         // remove the field from the fieldset
         $this->fieldset->delete($this->name);
     }
     // add this field to the new fieldset
     $fieldset->add($this);
     // swap fieldsets
     $this->fieldset = $fieldset;
     return $this;
 }
开发者ID:takawasitobi,项目名称:pembit,代码行数:18,代码来源:field.php


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