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


PHP FormHelper::select方法代码示例

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


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

示例1: testSelect

 public function testSelect()
 {
     $this->assertEqual(FormHelper::select('name', array('1' => 'un', '2' => 'deux'), '1', array('class' => 'myClass')), '<select name="name" class="myClass" id="name">' . '<option value="1" selected="selected">un</option>' . '<option value="2">deux</option>' . '</select>');
     $this->assertEqual(FormHelper::select('name', array('1' => 'un', '2' => 'deux'), array('1', '2'), array('class' => 'myClass')), '<select name="name" class="myClass" id="name">' . '<option value="1" selected="selected">un</option>' . '<option value="2" selected="selected">deux</option>' . '</select>');
     $this->assertEqual(FormHelper::select('name', array('1' => 'un', '2' => 'deux'), array('1', '2'), array('empty' => '-- select --', 'class' => 'myClass')), '<select name="name" class="myClass" id="name">' . '<option value="">-- select --</option>' . '<option value="1" selected="selected">un</option>' . '<option value="2" selected="selected">deux</option>' . '</select>');
     $this->assertEqual(FormHelper::select('name', array('obj' => 'un', '2' => 'deux'), $this->Model, array('class' => 'myClass')), '<select name="name" class="myClass" id="name">' . '<option value="obj" selected="selected">un</option>' . '<option value="2">deux</option>' . '</select>');
 }
开发者ID:nicolasmartin,项目名称:framework,代码行数:7,代码来源:helper.form.php

示例2: testSelect

 public function testSelect()
 {
     $options = array('1' => 'One', '2' => 'Two', '3' => 'Three');
     //test where valueOrArray is array
     $html = $this->object->select('element', $options, array('arbitrary' => 'arbitrary', 'class' => 'test-class'));
     $this->assertAttributes(substr($html, 0, strpos($html, '<option')), array('class' => array('test-class', 'ccm-input-select'), 'arbitrary' => 'arbitrary'));
     //test where valueOrArray is value
     $html = $this->object->select('element', $options, '3', array('arbitrary' => 'arbitrary', 'class' => 'test-class'));
     $this->assertAttributes(substr($html, 0, strpos($html, '<option')), array('class' => array('test-class', 'ccm-input-select'), 'arbitrary' => 'arbitrary', 'ccm-passed-value' => '3'));
     $html = substr($html, strpos($html, 'option value="3"'));
     $html = substr($html, 0, strpos($html, '</option'));
     $this->assertContains('selected', $html);
 }
开发者ID:notzen,项目名称:concrete5-tests,代码行数:13,代码来源:FormHelperTest.php

示例3: select

 public function select($fieldName, $options = array(), $attributes = array())
 {
     $multiple = $this->_extractOption('multiple', $attributes);
     $checkbox = explode(' ', $multiple);
     $attributes['multiple'] = $checkbox[0];
     $out = parent::select($fieldName, $options, $attributes);
     if ('checkbox' === $checkbox[0]) {
         $out = $this->_restructureLabel($out, array('class' => $multiple));
     }
     return $out;
 }
开发者ID:racklin,项目名称:TwitterBootstrap,代码行数:11,代码来源:BootstrapFormHelper.php

示例4: select

 public function select($fieldName, $options = array(), $attributes = array())
 {
     $select_source = parent::select($fieldName, $options, $attributes);
     if (!isset($attributes['multiple']) || isset($attributes['multiple']) && $attributes['multiple'] !== 'checkbox') {
         $js = '$("#' . $this->domId($fieldName) . '").select2();';
         echo $this->Html->script('/CakeUI/js/select2-3.4.8/select2.min', array('inline' => false));
         if (empty($this->once['/CakeUI/css/select2-3.4.8/select2.css']) && empty($this->once['/CakeUI/css/select2-3.4.8/select2-bootstrap.css'])) {
             $this->once['/CakeUI/css/select2-3.4.8/select2.css'] = true;
             $this->once['/CakeUI/css/select2-3.4.8/select2-bootstrap.css'] = true;
             echo $this->Html->css(array('/CakeUI/css/select2-3.4.8/select2.css', '/CakeUI/css/select2-3.4.8/select2-bootstrap.css'), null, array('inline' => false));
         }
         echo $this->Html->scriptBlock($js, array('inline' => false));
     }
     return $select_source;
 }
开发者ID:piotr0beschel,项目名称:CakeUI,代码行数:15,代码来源:BootstrapFormHelper.php

示例5: select

    /**
     *  Added by Zuha to parse extra fields needed for ajax
     */
    public function select($fieldName, $options = array(), $attributes = array())
    {
        // Added by Zuha to parse extra fields needed for ajax
        if (isset($attributes['ajax'])) {
            $attributes = $this->ajaxElement($attributes);
        }
        $selectElement = parent::select($fieldName, $options, $attributes);
        if (isset($attributes['limit']) && $attributes['multiple'] == 'checkbox') {
            $matches = explode('.', $fieldName);
            $name = 'data';
            foreach ($matches as $match) {
                $name .= '[' . $match . ']';
            }
            $name .= '[]';
            $selectElement .= '
				<script type="text/javascript">
					$(document).ready(function() {
					  $("input[name=\'' . $name . '\'").click(function() {
					    if ( $("input[name=\'' . $name . '\']:checked").length > ' . $attributes['limit'] . ' ) {
					      alert("You may only choose a maximum of ' . $attributes['limit'] . '");
					      $(this).prop("checked", false);
					    }
					  });
					});
				</script>';
        }
        return $selectElement;
    }
开发者ID:ajayphp,项目名称:Zuha,代码行数:31,代码来源:ZuhaFormHelper.php

示例6: select

    /**
     * select - or autocomplete
     *
     * @param mixed $fieldName
     * @param array $options array()
     * @param mixed $selected null
     * @param array $attributes array()
     * @return void
     * @access public
     */
    function select($fieldName, $options = array(), $selected = null, $attributes = array())
    {
        $ac = array();
        if (array_key_exists('--autocomplete--', $options)) {
            $ac = $options['--autocomplete--'];
            unset($options['--autocomplete--']);
        }
        if (count($options) > 1 || $ac === false) {
            return parent::select($fieldName, $options, $selected, $attributes);
        }
        $ac = array_merge(array('class' => 'autocomplete', 'source' => null, 'hiddenField' => null, 'writeJs' => true), (array) $ac);
        if (!$ac['hiddenField']) {
            if (is_null($ac['hiddenField']) && substr($fieldName, -3) == '_id') {
                $ac['hiddenField'] = true;
            }
        }
        $hiddenOptions = $this->_initInputField($fieldName, array('secure' => false));
        if ($ac['hiddenField']) {
            $hidden = $this->hidden($fieldName, $hiddenOptions);
            $suffix = '_auto';
        } else {
            $suffix = $hidden = '';
        }
        if ($ac['class']) {
            if (!empty($attributes['class'])) {
                $attributes['class'] .= ' ' . $ac['class'];
            } else {
                $attributes['class'] = $ac['class'];
            }
        }
        $attributes = $this->_initInputField($fieldName . $suffix, array_merge(array('type' => 'text'), $attributes));
        if (array_key_exists('label', $ac)) {
            $attributes['value'] = $ac['label'];
        } elseif ($selected && array_key_exists($selected, $options)) {
            $attributes['value'] = $options[$selected];
        } elseif (!empty($hiddenOptions['value']) && array_key_exists($hiddenOptions['value'], $options)) {
            $attributes['value'] = $options[$hiddenOptions['value']];
        } elseif ($hiddenOptions['value']) {
            $attributes['value'] = '(' . $hiddenOptions['value'] . ')';
        }
        $input = sprintf($this->Html->tags['input'], $attributes['name'], $this->_parseAttributes($attributes, array('name'), null, ' '));
        if ($ac['writeJs']) {
            if (!empty($ac['source'])) {
                $source = $ac['source'];
                if (is_array($source)) {
                    if (isset($source['action'])) {
                        $url = $this->url($source);
                        $source = 'function (request, response) {
							$.getJSON("' . $url . '/" + request["term"] + ".json", {}, response );
						}';
                    } else {
                        $source = json_encode($source, true);
                    }
                } else {
                    $source = '"' . $this->url($source) . '"';
                }
            } else {
                if (substr($fieldName, -3) == '_id') {
                    $fieldName = substr($fieldName, 0, strlen($fieldName) - 3);
                }
                if (strpos($fieldName, '.') && ($fieldName[0] = strtoupper($fieldName[0]))) {
                    $bits = explode('.', $fieldName);
                    $model = array_shift($bits);
                    $fieldName = array_shift($bits);
                    if ($bits && is_numeric($fieldName)) {
                        $fieldName = array_shift($bits);
                    }
                }
                if ($fieldName === 'parent') {
                    if (!empty($model)) {
                        $controller = Inflector::pluralize($model);
                    } else {
                        $controller = $this->params['controller'];
                    }
                } else {
                    $controller = Inflector::pluralize($fieldName);
                }
                $url = $this->url(array('controller' => $controller, 'action' => 'lookup'));
                $source = 'function (request, response) {
					$.getJSON("' . $url . '/" + request["term"] + ".json", {}, response );
				}';
            }
            if (isset($this->Asset)) {
                $this->Asset->js('jquery-ui', $this->name);
                $this->Asset->codeBlock('$(document).ready(function() {
						$("#' . $attributes['id'] . '").autocomplete({
								source: ' . $source . ($ac['hiddenField'] ? ',
								change: function(event, ui) {
									if ($("#' . $attributes['id'] . '").text() == "") {
										$("#' . $hiddenOptions['id'] . '").val("");
//.........这里部分代码省略.........
开发者ID:hiromi2424,项目名称:mi,代码行数:101,代码来源:mi_form.php

示例7: select

 function select($fieldName, $options = array(), $selected = null, $attributes = array())
 {
     if (isset($attributes) && array_key_exists('multiple', $attributes) && $attributes['multiple'] === false) {
         unset($attributes['multiple']);
     }
     $res = parent::select($fieldName, $options, $selected, $attributes);
     if (!empty($attributes['multiple']) && array_key_exists('hiddenField', $attributes) && !$attributes['hiddenField']) {
         $parts = explode("\n", $res, 2);
         $res = $parts[1];
     }
     return $res;
 }
开发者ID:kevthunder,项目名称:cake-spark-form,代码行数:12,代码来源:spark_form.php

示例8: t

<?php

$classRequired = $divClassOverride ? $divClassOverride : 'user-or-hash-wrapper';
$form = new FormHelper();
?>
<div class="<?php 
echo $classRequired;
?>
">
  <?php 
echo $form->select('userOrHash[]', $userTimelineOrHashSelectArray, $type);
?>
  <?php 
echo $form->text('userOrHashValue[]', $value, array('style' => 'size:40;'));
?>
  <a class="setting-remove"><img src="<?php 
echo $this->getBlockUrl();
?>
/images/delete.png" alt='<?php 
echo t("delete");
?>
' title='<?php 
echo t("delete");
?>
' width='16' height='16' style='vertical-align: middle;' /></a>
  <?php 
if (false && $lastSetting) {
    ?>
    <a href="#" class="add-timeline-component" id="add-timeline-component-button"><img src="<?php 
    echo $this->getBlockUrl();
    ?>
开发者ID:robchenski,项目名称:ids,代码行数:31,代码来源:hash_or_user_tweetcrete_form_element.php

示例9: select

 function select($fieldName, $options = array(), $selected = null, $attributes = array(), $showEmpty = '')
 {
     $attributes = $this->_initInputField($fieldName, $attributes);
     $code = parent::select($fieldName, $options, $selected, $attributes, $showEmpty);
     if (!empty($attributes['autocomplete']) && $attributes['autocomplete'] == true) {
         $code .= "<script type=\"text/javascript\">\n";
         $code .= "var {$attributes['id']}Data = new Array();\n";
         $code .= "\$('#{$attributes['id']}').before('<input type=\"text\" id=\"{$attributes['id']}Text\" />');\n";
         $code .= "\$('#{$attributes['id']}').css('display', 'none');\n";
         $code .= "\$('#{$attributes['id']} option').each(function(i){\n";
         $code .= "{$attributes['id']}Data.push({label: this.innerHTML, value: this.value});\n";
         $code .= "if(\$('#{$attributes['id']}').val() == this.value) \$('#{$attributes['id']}Text').val(this.innerHTML);\n";
         $code .= "});\n";
         $code .= "\$('#{$attributes['id']}Text').autocomplete({$attributes['id']}Data, {\n";
         $code .= "max: 20,\n";
         $code .= "matchContains: true,\n";
         $code .= "formatItem: function(item) {\n";
         $code .= "return item.label;\n";
         $code .= "}\n";
         $code .= "}).result(function(event, item) {\n";
         $code .= "\$('#{$attributes['id']}').val(item.value);\n";
         $code .= "\$('#{$attributes['id']}').change();\n";
         $code .= "});\n";
         $code .= "</script>\n";
     }
     return $code;
 }
开发者ID:hafizubikm,项目名称:bakeme,代码行数:27,代码来源:extended_form.php

示例10: afterFilter

 /**
  * Dynamically replace the field tags with their labels/form field equivalents
  */
 function afterFilter()
 {
     $output =& $this->output;
     $names = array();
     $labels = array();
     $select = array();
     $cat_tag = false;
     $date_field = false;
     $cat_auto = Sanitize::getInt($this->params['module'], 'cat_auto');
     $dir_id = $section_id = $cat_id = $criteria_id = '';
     # Initialize FormHelper
     $Form = new FormHelper();
     $CustomFields = new CustomFieldsHelper();
     $CustomFields->Config =& $this->Config;
     # Process custom field tag attributes
     foreach ($this->fieldTags as $key => $value) {
         $var = explode('|', $value);
         if (!strstr($value, '_label')) {
             $names[$var[0]] = $value;
         } elseif (strstr($value, '_label')) {
             $labels[] = substr($value, 0, -6);
         }
         if ($value == 'category') {
             $cat_tag = true;
             /************************/
             if (isset($var[1]) && $var[1] == 'm') {
                 $category_select_type = ' multiple="multiple"';
             }
             if (isset($var[2]) && (int) $var[2] > 0) {
                 $category_select_size = ' size="' . $var[2] . '"';
             }
             /************************/
         }
         if (isset($var[1]) && strtolower($var[1]) == 'm') {
             $select[$var[0]] = 'selectmultiple';
         } elseif (isset($var[1]) && strtolower($var[1]) == 's') {
             $select[$var[0]] = 'select';
         }
         $select_size[$var[0]] = isset($var[2]) ? $var[2] : 5;
         # Check for category select list
         if ($var[0] == 'category') {
             if (isset($var[1]) && strtolower($var[1]) == 's') {
                 $category_select_type = ' multiple="multiple"';
             }
             if (isset($var[2]) && (int) $var[2] > 0) {
                 $category_select_size = ' size="' . $var[2] . '"';
             }
         }
     }
     # Get selected values from url
     $entry = array();
     foreach ($this->params as $key => $value) {
         if (substr($key, 0, 3) == 'jr_') {
             $entry['Field']['pairs'][$key]['value'] = explode('_', $value);
         }
         // Add categories/sections
     }
     if (isset($this->params['tag'])) {
         $entry['Field']['pairs']['jr_' . $this->params['tag']['field']]['value'] = array($this->params['tag']['value']);
     }
     # Generate category list if tag found in view
     if ($cat_tag) {
         # Get module params before auto-detect
         $param_cat_id = Sanitize::getString($this->params['module'], 'cat_id');
         $param_dir_id = Sanitize::getString($this->params['module'], 'dir_id');
         $param_type_id = Sanitize::getString($this->params['module'], 'criteria_id');
         # Category auto detect
         $ids = CommonController::_discoverIDs($this);
         if ($cat_auto) {
             extract($ids);
         } elseif ($this->cmsVersion != CMS_JOOMLA15) {
             isset($ids['cat_id']) and $cat_id = $ids['cat_id'];
         }
         if ($this->cmsVersion == CMS_JOOMLA15 && $section_id == '' && $cat_id != '') {
             $sql = "SELECT section FROM #__categories WHERE id IN (" . $cat_id . ")";
             $this->_db->setQuery($sql);
             $section_id = $this->_db->loadResult();
         }
         $cat_id != '' and $this->params['module']['cat_id'] = $cat_id;
         $cat_id == '' and $section_id != '' and $this->params['module']['section_id'] = $section_id;
         $cat_id == '' and $criteria_id != '' and $this->params['module']['criteria_id'] = $criteria_id;
         if ($this->cmsVersion == CMS_JOOMLA15) {
             $categorySelect = $this->Category->categoryTree($this->_user->gid, $this->params);
         } else {
             $options = array('disabled' => false, 'cat_id' => !empty($param_cat_id) && !$cat_auto ? $param_cat_id : ($cat_auto ? $cat_id : ''), 'parent_id' => !empty($param_cat_id) && !$cat_auto ? $param_cat_id : ($cat_auto ? $cat_id : ''), 'dir_id' => !empty($param_dir_id) && !$cat_auto ? $param_dir_id : ($cat_auto ? $dir_id : ''), 'type_id' => !empty($param_type_id) && !$cat_auto ? $param_type_id : ($cat_auto ? $criteria_id : ''));
             if ($cat_auto && empty($options['cat_id'])) {
                 $options['level'] = 1;
             }
             $categories = $this->Category->getCategoryList($options);
             // Now get the parent and sibling categories
             if ($cat_auto && isset($categories[$cat_id]) && count($categories) == 1) {
                 $options['cat_id'] = $options['parent_id'] = $categories[$cat_id]->parent_id;
                 $categories = $this->Category->getCategoryList($options);
             }
             $categorySelect = $Form->select('data[categories]', array_merge(array(array('value' => null, 'text' => '- ' . __t("Select Category", true) . ' -')), $categories), $cat_id, array('class' => 'jrSelect'));
         }
         $output = str_replace('{' . $names['category'] . '}', $categorySelect, $output);
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_advanced_search_controller.php

示例11: array

?>
">
					<label for="name">Titre de l'image</label>
					<?php 
echo FormHelper::text('name', $Picture, array('size' => 100));
?>
 
				</div>
	
				<div class="<?php 
echo ++$i % 2 ? 'odd' : 'even';
?>
">
					<label for="width">Taille</label>
					<?php 
echo FormHelper::select('percents', array('100' => '100%', '90' => ' 90%', '80' => ' 80%', '70' => ' 70%', '60' => ' 60%', '50' => ' 50%', '40' => ' 40%', '30' => ' 30%', '20' => ' 20%', '10' => ' 10%'), 100);
?>
					ou <?php 
echo FormHelper::text('width', '', array('size' => 4));
?>
 x <?php 
echo FormHelper::text('height', '', array('size' => 4));
?>
 px
				</div>
	
				<div class="<?php 
echo ++$i % 2 ? 'odd' : 'even';
?>
">
					<label for="alignment">Alignement</label>
开发者ID:nicolasmartin,项目名称:framework,代码行数:31,代码来源:insertion-edit.tpl.php

示例12: select

 public function select($fieldName, $options = array(), $attributes = array())
 {
     $defaults = array('empty' => '-- SELECT --');
     $defaults = Set::merge($this->_myInputDefaults, $defaults);
     $attributes = Set::merge($defaults, $attributes);
     return parent::select($fieldName, $options, $attributes);
 }
开发者ID:jet77,项目名称:DiabeteSavior,代码行数:7,代码来源:BootstrapFormHelper.php

示例13: select

 /**
  * Returns a formatted SELECT element.
  *
  * Extends of FormHelper::select() so get same attributes and params
  *
  * ### New Attributes:
  *
  * - `inline` - Only when attribute [multiple] is checkbox. Align all the checkboxes
  * - `help` - Add a message under the select element to give more informations
  * - 'label' - Add a label to the select element
  *
  * @param string $fieldName Name attribute of the SELECT
  * @param array $options Array of the OPTION elements (as 'value'=>'Text' pairs or as array('label' => 'text', 'help' => 'informations') in case of multiple checkbox) to be used in the
  *	SELECT element
  * @param array $attributes The HTML attributes of the select element.
  * @return string Formatted SELECT element
  */
 public function select($fieldName, $options = array(), $attributes = array())
 {
     $out = '';
     $isDate = false;
     $inline = isset($attributes['inline']) && ('inline' == $attributes['inline'] || true == $attributes['inline']) ? true : false;
     // MULTIPLE CHECKBOX
     if (isset($attributes['multiple']) && 'checkbox' != $attributes['multiple'] || !isset($attributes['multiple'])) {
         if (!isset($attributes['class'])) {
             $attributes['class'] = 'form-control';
         } else {
             $isDate = strpos($attributes['class'], 'input-date') !== false ? true : false;
             if (!$isDate) {
                 $attributes['class'] = 'form-control ' . $attributes['class'];
             }
         }
     } else {
         //----- [checkobx simple] attribute for checkbox
         if (!isset($attributes['class'])) {
             $attributes['class'] = 'checkbox';
         } else {
             $attributes['class'] = 'checkbox ' . $attributes['class'];
         }
     }
     //----- [empty] attribute
     if (!isset($attributes['empty'])) {
         $attributes['empty'] = false;
     }
     $attributes = $this->__errorBootstrap($fieldName, $attributes);
     $attributesForSelect = $attributes;
     // Clean
     unset($attributesForSelect['state']);
     unset($attributesForSelect['help']);
     unset($attributesForSelect['label']);
     $select = parent::select($fieldName, $options, $attributesForSelect);
     if ($isDate) {
         return $select;
     }
     $out .= $this->__buildSelectBefore($fieldName, $attributes);
     $out .= $select;
     $out .= $this->__buildSelectAfter($attributes);
     if (isset($attributes['multiple']) && 'checkbox' == $attributes['multiple']) {
         $regex = '/(<label for=.*?>)/';
         if (preg_match_all($regex, $out, $labels)) {
             foreach ($labels[0] as $label) {
                 $r1 = '/(<label.*.for="?)/';
                 $r2 = '/(".*>)/';
                 $field = preg_replace($r1, '', $label);
                 $field = preg_replace($r2, '', $field);
                 if ($inline) {
                     $r3 = '/(class=".*?)(.*")/';
                     if (preg_match($r3, $label, $labelClass)) {
                         $label = preg_replace($r3, $labelClass[1] . 'checkbox-inline ' . $attributes['class'] . ' ' . $labelClass[2], $label);
                     } else {
                         $r4 = '/(<label for="' . $field . '".*)(.*>)/';
                         $label = preg_replace($r4, '$1' . ' class="checkbox-inline" ' . '$2', $label);
                     }
                     $out = preg_replace('/(<div class="' . $attributes['class'] . '">)/', '', $out);
                     $out = preg_replace('/(<\\/label><\\/div>)/', '</label>', $out);
                 }
                 $out = preg_replace('/(<input type="checkbox".*)(.*id="' . $field . '".*?\\/>)/', $label . '$1' . '$2', $out);
                 $out = preg_replace('/(<input type="checkbox".*)(.*id="' . $field . '".*?\\/>)(<label for=.*?>)/', '$1' . '$2', $out);
             }
         }
     }
     return $out;
 }
开发者ID:xhs345,项目名称:CakePHP-BsHelpers,代码行数:83,代码来源:BsFormHelper.php

示例14: select

 /**
  * Returns a formatted SELECT element.
  *
  * Extends of FormHelper::select() so get same attributes and params
  *
  * ### New Attributes:
  *
  * - `inline` - Only when attribute [multiple] is checkbox. Align all the checkboxes
  * - `help` - Add a message under the select element to give more informations
  * - 'label' - Add a label to the select element
  *
  * @param string $fieldName Name attribute of the SELECT
  * @param array $options Array of the OPTION elements (as 'value'=>'Text' pairs or as array('label' => 'text', 'help' => 'informations') in case of multiple checkbox) to be used in the
  *	SELECT element
  * @param array $attributes The HTML attributes of the select element.
  * @return string Formatted SELECT element
  */
 public function select($fieldName, $options = array(), $attributes = array())
 {
     $out = '';
     // MULTIPLE CHECKBOX
     if (isset($attributes['multiple']) && $attributes['multiple'] != 'checkbox' || !isset($attributes['multiple'])) {
         if (!isset($attributes['class'])) {
             $attributes['class'] = 'form-control';
         } else {
             $attributes['class'] .= ' form-control';
         }
     } else {
         //----- [inline] attribute for checkbox
         if (isset($attributes['inline']) && ($attributes['inline'] == 'inline' || $attributes['inline'] == true)) {
             if (!isset($attributes['class'])) {
                 $attributes['class'] = 'checkbox checkbox-inline';
             } else {
                 $attributes['class'] = 'checkbox checkbox-inline ' . $attributes['class'];
             }
         } else {
             if (!isset($attributes['class'])) {
                 $attributes['class'] = 'checkbox';
             } else {
                 $attributes['class'] = 'checkbox ' . $attributes['class'];
             }
         }
     }
     //----- [empty] attribute
     if (!isset($attributes['empty'])) {
         $attributes['empty'] = false;
     }
     if ($this->_getFormType() == 'horizontal') {
         $out .= '<div class="form-group">';
         //----- [label] attribute
         if (isset($attributes['label']) && !empty($attributes['label'])) {
             $out .= '<label class="control-label col-md-' . $this->left . '">' . $attributes['label'] . '</label>';
             $out .= '<div class="col-md-' . $this->right . '">';
         } else {
             $out .= '<div class="col-md-offset-' . $this->left . ' col-md-' . $this->right . '">';
         }
     }
     $out .= parent::select($fieldName, $options, $attributes);
     if ($this->_getFormType() == 'horizontal') {
         //----- [help] attribute
         if (isset($attributes['help']) && !empty($attributes['help'])) {
             $out .= '<span class="help-block">' . $attributes['help'] . '</span>';
         }
         $out .= '</div></div>';
     }
     return $out;
 }
开发者ID:bramas,项目名称:cakephp2-admin,代码行数:67,代码来源:AdminFormHelper.php

示例15: select

 function select($fieldName, $options = array(), $selected = null, $attributes = array(), $showEmpty = '')
 {
     $locale = Configure::read('Config.language');
     switch ($locale) {
         case 'ja':
             $type = split('\\.', $fieldName);
             switch (array_pop($type)) {
                 case 'year':
                     foreach ($options as $key => $value) {
                         $options[$key] = $value . '年';
                     }
                     break;
                 case 'day':
                     foreach ($options as $key => $value) {
                         $options[$key] = $value . '日';
                     }
                     break;
             }
             break;
     }
     return parent::select($fieldName, $options, $selected, $attributes, $showEmpty);
 }
开发者ID:masayukiando,项目名称:googlemap-search_ActionScript3.0,代码行数:22,代码来源:app_form.php


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