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


PHP Form::select方法代码示例

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


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

示例1: smarty_function_form_select

/**
 * @param array                    $params
 * @param Smarty_Internal_Template $smarty
 *
 * @throws SmartyException
 * @return string
 *
 * @author Kovács Vince
 */
function smarty_function_form_select($params, Smarty_Internal_Template &$smarty)
{
    if (!isset($params['_name'])) {
        throw new SmartyException('Missing _name attribute for form_select tag');
    }
    $name = $params['_name'];
    $list = isset($params['_list']) ? $params['_list'] : array();
    if (isset($params['_default'])) {
        $list = array('' => $params['_default']) + $list;
    }
    $selected = isset($params['_selected']) ? $params['_selected'] : (isset($params['_populate']) && $params['_populate'] ? \Input::get($name) : null);
    $range = isset($params['_range']) && $params['_range'];
    unset($params['_name']);
    unset($params['_list']);
    unset($params['_selected']);
    unset($params['_range']);
    unset($params['_populate']);
    if ($range) {
        if (!isset($params['_begin'])) {
            throw new SmartyException('Missing _begin attribute for form_select tag');
        }
        if (!isset($params['_end'])) {
            throw new SmartyException('Missing _end attribute for form_select tag');
        }
        $begin = $params['_begin'];
        $end = $params['_end'];
        unset($params['_begin']);
        unset($params['_end']);
        return Form::selectRange($name, $begin, $end, $selected, $params);
    }
    return Form::select($name, $list, $selected, $params);
}
开发者ID:vi-kon,项目名称:laravel-smarty-view,代码行数:41,代码来源:function.form_select.php

示例2: buildActive

function buildActive()
{
    $html = '';
    $html .= '<label for="active">' . trans('admin.active') . '</label>';
    $html .= Form::select('active', selectBoolean(), null, ['class' => 'form-control select2-simple', 'style' => 'width: 100%;']);
    return $html;
}
开发者ID:Tisho84,项目名称:conference,代码行数:7,代码来源:functions.php

示例3: displayForm

 /** @inheritdoc */
 public static function displayForm($value, &$settings, $model)
 {
     // No point in ever showing this field if lang isn't enabled
     if (!\CMF::$lang_enabled) {
         return '';
     }
     \Lang::load('languages', true, 'en', true, true);
     $settings = static::settings($settings);
     $include_label = isset($settings['label']) ? $settings['label'] : true;
     $required = isset($settings['required']) ? $settings['required'] : false;
     $errors = $model->getErrorsForField($settings['mapping']['fieldName']);
     $has_errors = count($errors) > 0;
     $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge');
     if ($settings['active_only']) {
         $options = array_map(function ($lang) {
             return \Arr::get(\Lang::$lines, 'en.languages.' . $lang['code'], \Lang::get('admin.errors.language.name_not_found'));
         }, \CMF\Model\Language::select('item.code', 'item', 'item.code')->orderBy('item.pos', 'ASC')->where('item.visible = true')->getQuery()->getArrayResult());
     } else {
         $options = \Arr::get(\Lang::$lines, 'en.languages', array());
     }
     // Whether to allow an empty option
     if (isset($settings['mapping']['nullable']) && $settings['mapping']['nullable'] && !$required && $settings['allow_empty']) {
         $options = array('' => '') + $options;
     }
     $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label'));
     $input = \Form::select($settings['mapping']['fieldName'], $value, $options, $input_attributes);
     if (isset($settings['wrap']) && $settings['wrap'] === false) {
         return $label . $input;
     }
     return html_tag('div', array('class' => 'controls control-group' . ($has_errors ? ' error' : '')), $label . $input);
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:32,代码来源:Language.php

示例4: select

 public static function select($name, $label, $attribs = array(), $modelPair = NULL, $wrapper = 1)
 {
     if (isset($attribs['valueArray'])) {
         $selectValueArray = $attribs['valueArray'];
         unset($attribs['valueArray']);
     }
     if (isset($attribs['range'])) {
         for ($i = $attribs['range'][0]; $i <= $attribs['range'][1]; $i++) {
             $selectValueArray[$i] = $i;
         }
         unset($attribs['range']);
     }
     $value = isset($attribs['value']) ? (string) $attribs['value'] : null;
     if (is_array($modelPair)) {
         $modelName = $modelPair[0];
         $selectValueColumn = $modelPair[1];
         $selectNameColumn = $modelPair[2];
         $model = $modelName::orderBy($selectNameColumn)->get();
         foreach ($model as $item) {
             $selectValueArray[$item->{$selectValueColumn}] = $item->{$selectNameColumn};
         }
     }
     $selectOutput = Form::select($name, $selectValueArray, $value, $attribs) . self::_getInputError($name);
     if ($wrapper == 1) {
         return '<li id="' . $name . '_label">' . Form::label($name, $label) . '<div id="' . $name . '_input" class="input_field">' . $selectOutput . '</div></li>';
     } else {
         return $selectOutput;
     }
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:29,代码来源:formlist.php

示例5: select

 protected function select($data, $show)
 {
     $select = [];
     foreach ($data as $d) {
         if (is_array($show)) {
             $value = '';
             foreach ($show as $show_key) {
                 $value .= Str::title($show_key) . ': ' . $d[$show_key];
                 if (end($show) != $show_key) {
                     $value .= ' | ';
                 }
             }
         } elseif (is_callable($show)) {
             $value = $show($d);
         } else {
             $value = $d[$show];
         }
         $select[$d['id']] = $value;
     }
     if (Request::has($this->name)) {
         $this->id = Request::get($this->name);
     } else {
         if (isset($this->value->id)) {
             $this->id = $this->value->id;
         } else {
             $this->id = $this->value;
         }
     }
     echo \Form::select($this->name, ['0' => Request::ajax() ? '(current)' : '(none)'] + $select, $this->id, $this->attributes);
 }
开发者ID:marcmascarell,项目名称:laravel-artificer,代码行数:30,代码来源:hasOne.php

示例6: build

 public function build()
 {
     $output = "";
     if (!isset($this->style)) {
         $this->style = "margin:0 2px 0 0; vertical-align: middle";
     }
     unset($this->attributes['id']);
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->description;
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             $this->attributes['multiple'] = 'multiple';
             $output .= \Form::select($this->name . '[]', $this->options, $this->values, $this->attributes);
             $output .= $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
开发者ID:chellmann,项目名称:rapyd-laravel,代码行数:33,代码来源:Multiselect.php

示例7: build

 function build()
 {
     $output = "";
     if (!isset($this->style) and !isset($this->attributes['style'])) {
         $this->style = "width:290px;";
     }
     unset($this->attributes['type'], $this->attributes['size']);
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->description;
             }
             $output = "<div class='help-block'>" . $output . "</div>";
             break;
         case "create":
         case "modify":
             $output = \Form::select($this->name, $this->options, $this->value, $this->attributes) . $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
开发者ID:parabol,项目名称:laravel-cms,代码行数:31,代码来源:Select.php

示例8: recurse_pages

function recurse_pages($pages, $spaces = 0, $layoutsBlocks = [], $pageWidgets = [], $pagesWidgets = [])
{
    $data = '';
    foreach ($pages as $page) {
        // Блок
        $currentBlock = array_get($pageWidgets, $page['id'] . '.0');
        $currentPosition = array_get($pageWidgets, $page['id'] . '.1');
        $data .= '<tr data-id="' . $page['id'] . '" data-parent-id="' . $page['parent_id'] . '">';
        $data .= '<td>';
        if (!empty($page['childs'])) {
            $data .= '<div class="input-group">';
        }
        $data .= Form::select('blocks[' . $page['id'] . '][block]', [], $currentBlock, ['class' => 'widget-blocks form-control', 'data-layout' => $page['layout_file'], 'data-value' => $currentBlock]);
        if (!empty($page['childs'])) {
            $data .= "<div class=\"input-group-btn\">" . Form::button(NULL, ['data-icon' => 'level-down', 'class' => 'set_to_inner_pages btn btn-warning', 'title' => trans('widgets::core.button.select_childs')]) . '</div></div>';
        }
        $data .= '</td><td>';
        $data .= Form::text('blocks[' . $page['id'] . '][position]', (int) $currentPosition, ['maxlength' => 4, 'size' => 4, 'class' => 'form-control text-right widget-position']);
        $data .= '</td><td></td>';
        if (acl_check('page::edit')) {
            $data .= '<th>' . str_repeat("-&nbsp;", $spaces) . link_to_route('backend.page.edit', $page['title'], [$page['id']]) . '</th>';
        } else {
            $data .= '<th>' . str_repeat("-&nbsp;", $spaces) . $page['title'] . '</th>';
        }
        $data .= '</tr>';
        if (!empty($page['childs'])) {
            $data .= recurse_pages($page['childs'], $spaces + 5, $layoutsBlocks, $pageWidgets, $pagesWidgets);
        }
    }
    return $data;
}
开发者ID:KodiComponents,项目名称:module-widgets,代码行数:31,代码来源:location.blade.php

示例9: blockZones

 /**
  * [blockZones description]
  * @param  [type] $page_id  [description]
  * @param  [type] $block_id [description]
  * @param  [type] $zone     [description]
  * @param  string $name     [description]
  * @param  string $id       [description]
  * @return [type]           [description]
  */
 public function blockZones($page_id, $block_id, $zone, $name = 'change-zone', $id = 'change-zone')
 {
     if ($block_id) {
         $layout = $this->page->find($page_id)->layout;
         $zones = \Theme::zones($layout);
         return \Form::select($name, $zones, $zone, array('id' => $id, 'data-page' => $page_id, 'class' => 'form-control'));
     }
 }
开发者ID:pongocms,项目名称:cms,代码行数:17,代码来源:Load.php

示例10: input

 public function input($name, array $attr = NULL)
 {
     if (is_array($this->choices)) {
         return Form::select($name, $this->choices, $this->value, $attr);
     } else {
         return Form::input($name, $this->verbose(), $attr);
     }
 }
开发者ID:vitch,项目名称:sprig,代码行数:8,代码来源:field.php

示例11: formComponent

 /**
  * Form Component
  */
 public static function formComponent()
 {
     $_templates = Themes::getTemplates();
     foreach ($_templates as $template) {
         $templates[basename($template, '.template.php')] = basename($template, '.template.php');
     }
     echo '<div class="col-xs-3">' . Form::open() . Form::hidden('csrf', Security::token()) . Form::label('sandbox_form_template', __('Sandbox template', 'sandbox')) . Form::select('sandbox_form_template', $templates, Option::get('sandbox_template'), array('class' => 'form-control')) . Html::br() . Form::submit('sandbox_component_save', __('Save', 'sandbox'), array('class' => 'btn btn-default')) . Form::close() . '</div>';
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:11,代码来源:sandbox.admin.php

示例12: input

 public function input($name, $value, array $attr = NULL)
 {
     $model = Sprig::factory($this->model);
     $choices = $model->select_list($model->pk());
     if ($this->empty) {
         Arr::unshift($choices, '', '-- ' . __('None'));
     }
     return Form::select($name, $choices, $this->verbose($value), $attr);
 }
开发者ID:bosoy83,项目名称:progtest,代码行数:9,代码来源:belongsto.php

示例13: option

 public function option($data, $name, $options, $default = NULL, $attrs = array())
 {
     if (!$this->view->preview) {
         return;
     }
     $default_attrs = array('style' => 'display:none', 'property' => $name, 'property-type' => 'option');
     $attrs = Arr::merge($default_attrs, $attrs);
     return Form::select($name, $options, $this->get($data, $name, $default), $attrs);
 }
开发者ID:huiancg,项目名称:kohana-huia-pagemanager,代码行数:9,代码来源:Block.php

示例14: selectGroup

function selectGroup($name, $options, $value = NULL, $errors, $attributes = [])
{
    $errorClass = $errors->first($name) ? "has-error" : "";
    $output = "<div class='form-group {$errorClass}'>";
    $output .= Form::label($name, ucwords($name));
    $output .= Form::select($name . "[]", $options, $value, $attributes);
    $output .= $errors->first($name, '<label>:message</label>');
    return "{$output}</div>";
}
开发者ID:rdok,项目名称:oblivion-pm,代码行数:9,代码来源:helpers.php

示例15: addTargetLanguageSelect

/**
 * @param $targetLanguage
 * @return string
 *
 */
function addTargetLanguageSelect($targetLanguage)
{
    $selectedValue = isset($targetLanguage->value) && isset($targetLanguage->value->text) && ($targetLanguage->value->text == 'fr' || $targetLanguage->value->text == 'en') ? $targetLanguage->value->text : 'fr';
    $p = "<p>";
    $p .= "<label>" . $targetLanguage->label . "</label>";
    $p .= Form::select('extend[' . $targetLanguage->key . ']', array('fr' => 'Français', 'en' => 'Anglais'), $selectedValue, array('class' => ''));
    $p .= "</p>";
    return $p;
}
开发者ID:Rictus,项目名称:CMS_Prod,代码行数:14,代码来源:helpers.php


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