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


PHP Form::macro方法代码示例

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


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

示例1: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     parent::register();
     \Form::macro('myField', function () {
         return '<input type="awesome">';
     });
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:12,代码来源:FormMacroServiceProvider.php

示例2: generar_lista_con_agrupador_distritos

 public function generar_lista_con_agrupador_distritos($valor = null)
 {
     \Form::macro('selectOpt', function (\ArrayAccess $collection, $name, $groupBy, $labelBy = 'name', $valueBy = 'id', $value = null, $attributes = array()) {
         $select_optgroup_arr = [];
         foreach ($collection as $item) {
             $select_optgroup_arr[$item->{$groupBy}][$item->{$valueBy}] = $item->{$labelBy};
         }
         return \Form::select($name, $select_optgroup_arr, $value, $attributes);
     });
     return \Form::selectOpt($this->model->orderBy('codigoSemplades')->get(), 'id_circuito', 'distrito', 'codigoSemplades', 'id_circuito', $valor, array('class' => 'form-control', 'data-required' => 'true', 'id' => 'id_circuito'));
 }
开发者ID:eddrems,项目名称:mogac,代码行数:11,代码来源:divCircuitoRepository.php

示例3: generar_lista_con_servicio_seleccion

 public function generar_lista_con_servicio_seleccion($valor)
 {
     \Form::macro('selectOpt', function (\ArrayAccess $collection, $name, $groupBy, $labelBy = 'name', $valueBy = 'id', $value = null, $attributes = array()) {
         $select_optgroup_arr = [];
         foreach ($collection as $item) {
             $select_optgroup_arr[$item->{$groupBy}][$item->{$valueBy}] = $item->{$labelBy};
         }
         return \Form::select($name, $select_optgroup_arr, $value, $attributes);
     });
     return \Form::selectOpt($this->model->all(), 'id_caso', 'servicio', 'denominacion', 'id_caso', $valor, array('class' => 'form-control', 'data-required' => 'true', 'id' => 'id_caso'));
 }
开发者ID:eddrems,项目名称:mogac,代码行数:11,代码来源:aciudCasoRepository.php

示例4: generar_lista_con_agrupador_permisos

 public function generar_lista_con_agrupador_permisos($valor = null, $id_rol)
 {
     \Form::macro('selectOpt', function (\ArrayAccess $collection, $name, $groupBy, $labelBy = 'name', $valueBy = 'id', $value = null, $attributes = array()) {
         $select_optgroup_arr = [];
         foreach ($collection as $item) {
             $select_optgroup_arr[$item->{$groupBy}][$item->{$valueBy}] = $item->{$labelBy};
         }
         return \Form::select($name, $select_optgroup_arr, $value, $attributes);
     });
     $modulos_asignados = configRolModulo::where('id_rol', $id_rol)->select('id_modulo')->get()->toArray();
     return \Form::selectOpt($this->model->whereNotIn('id_modulo', $modulos_asignados)->orderBy('descripcion')->get(), 'id_modulo', 'agrupador', 'descripcion', 'id_modulo', $valor, array('class' => 'form-control', 'data-required' => 'true', 'id' => 'id_modulo'));
 }
开发者ID:eddrems,项目名称:mogac,代码行数:12,代码来源:configModuloRepository.php

示例5: __construct

 public function __construct()
 {
     //js
     Asset::add('jquery', 'js/jquery-1.7.2.min.js');
     Asset::add('bootstrap-js', 'js/bootstrap.min.js', 'jquery');
     Asset::add('bootstrap-js-datepicker', 'js/bootstrap-datepicker.js', 'bootstrap-js');
     Asset::add('moment-js', 'js/moment.min.js');
     Asset::add('sapoc-js', 'js/sapoc.js', 'jquery');
     //css
     Asset::add('bootstrap-css', 'css/bootstrap.min.css');
     Asset::add('bootstrap-css-responsive', 'css/bootstrap-responsive.min.css', 'bootstrap-css');
     Asset::add('datepicker-css', 'css/datepicker.css', 'bootstrap-css');
     Asset::add('sapoc-css', 'css/sapoc.css', 'bootstrap-css');
     //Form macros
     Form::macro('date', function ($name) {
         return sprintf('<input type="text" name="%s" id="%s" class="%s">', $name, Config::get('application.date_class_js'));
     });
     parent::__construct();
 }
开发者ID:rooslunn,项目名称:sapoc,代码行数:19,代码来源:base.php

示例6: function

Form::macro('decimal', function ($attributeName, $value, $options) {
    foreach (['js/plugins/input-mask/jquery.inputmask.js', 'js/plugins/input-mask/jquery.inputmask.numeric.extensions.js'] as $file) {
        $jsFilename = moduleAsset('admin', $file);
        if (!in_array($jsFilename, @Asset::$js['footer'] ?: array())) {
            Asset::add($jsFilename);
        }
    }
    $options['data-inputmask'] = "'alias': 'decimal', 'radixPoint': ','";
    $script = "\$('*[data-inputmask]').inputmask();";
    if (!in_array($script, @Asset::$scripts['footer'] ?: array())) {
        Asset::addScript($script);
    }
    $value = str_replace('.', ',', $value);
    return Form::text($attributeName, $value, $options);
});
/**
 * Creates a Html Editor
 */
Form::macro('editor', function ($attributeName, $value = null, $options = array()) {
    Asset::add(moduleAsset('system', 'js/ckeditor/ckeditor.js'));
    Asset::addScript("\n        CKEDITOR.config.allowedContent = true;\n        var editor = CKEDITOR.replace('{$attributeName}', {\n            filebrowserBrowseUrl : '" . URL::to(moduleAsset('system', 'ckfinder/ckfinder.html')) . "',\n            filebrowserImageBrowseUrl : '" . URL::to(moduleAsset('system', 'ckfinder/ckfinder.html?type=Images')) . "',\n            filebrowserFlashBrowseUrl : '" . URL::to(moduleAsset('system', 'ckfinder/ckfinder.html?type=Flash')) . "',\n            filebrowserUploadUrl : '" . URL::to(moduleAsset('system', 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files')) . "',\n            filebrowserImageUploadUrl : '" . URL::to(moduleAsset('system', 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images')) . "',\n            filebrowserFlashUploadUrl : '" . URL::to(moduleAsset('system', 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash')) . "'\n        });\n        CKFinder.setupCKEditor( editor, '../' );\n    ", 'ready');
    return Form::textArea($attributeName, $value, $options);
});
/**
 * Validates a Recaptcha input
 * Obs: Recapctha package already provide a "captcha" macro to form.
 */
Form::macro('makeCaptchaValidator', function ($input) {
    $v = Validator::make($input, ['g-recaptcha-response' => 'required|recaptcha'])->setAttributeNames(['g-recaptcha-response' => 'Recaptcha']);
    return $v;
});
开发者ID:teewebapp,项目名称:system,代码行数:31,代码来源:form.php

示例7: function

<?php

use Illuminate\Support\ViewErrorBag;
Form::macro('elegantSelect', function ($name, $title, ViewErrorBag $errors, array $list = [], array $options = []) {
    $options = array_merge(['id' => 'elegant-select-' . $name], $options);
    // Create HTML for select element
    $string = "<div class='form-group" . ($errors->has($name) ? ' has-error' : '') . "'>";
    $string .= Form::label($name, $title);
    $string .= Form::select($name, $list, null, $options);
    $string .= $errors->first($name, '<span class="help-block">:message</span>');
    $string .= '</div>';
    // JS to selectize the select element
    $string .= '<script>';
    $string .= "\$(document).ready(function() { \$('#{$options['id']}').selectize({ delimiter: ',', plugins: ['remove_button']}); });";
    $string .= '</script>';
    return $string;
});
开发者ID:pixelindustries,项目名称:elegant-asgard,代码行数:17,代码来源:macros.php

示例8: function

<?php

Form::macro('selectMonth', function ($name, $selected = null, $options = array()) {
    $months = [];
    foreach (range(1, 12) as $month) {
        $months[$month] = date('F', mktime(0, 0, 0, $month));
    }
    return $this->select($name, $months, $selected, $options);
});
Form::macro('selectYear', function ($name, $startYear, $endYear, $selected = null, $options = array()) {
    $years = range($startYear, $endYear);
    $years = array_combine($years, $years);
    return $this->select($name, $years, $selected, $options);
});
Form::macro('selectDay', function ($name, $startDay, $endDay, $selected = null, $options = array()) {
    $days = range(1, 31);
    $days = array_combine($days, $days);
    return $this->select($name, $days, $selected, $options);
});
开发者ID:rituzy,项目名称:iblog,代码行数:19,代码来源:macros.php

示例9: function

<?php

//Form Helper for simple form
Form::macro('txt', function ($name, $label, $value = null) {
    return "\n\t\t<div class='form-group'>\n\t\t\t<label class='control-label' for='{$name}'>{$label}</label>\n\t\t\t<input type='text' class='form-control' name='{$name}' id='{$name}' placeholder='{$label}' value='{$value}'>\n\t\t</div>\n\t";
});
Form::macro('txtarea', function ($name, $label, $value = null) {
    return "\n\t\t<div class='form-group'>\n\t\t\t<label class='control-label' for='{$name}'> {$label} </label>\n\t\t\t<textarea class='form-control' name='{$name}' id='{$name}' placeholder='{$label}' rows='3'>{$value}</textarea>\n\t\t</div>\n\t";
});
Form::macro('mail', function ($name, $label, $value = null) {
    return "\n\t\t<div class='form-group'>\n\t\t\t<label class='control-label'> {$label} </label>\n\t\t\t<input type='email' class='form-control' name='{$name}' id='{$name}' placeholder= '{$label}' value='{$value}'>\n\t\t</div>\n\t";
});
Form::macro('pwd', function ($name, $label) {
    return "\n\t\t<div class='form-group'>\n\t\t\t<label class='control-label'> {$label} </label>\n\t\t\t<input type='password' class='form-control' name= '{$name}'  id='{$name}' placeholder= '{$label}' >\n\t\t</div>\n\t";
});
Form::macro('chkbox', function ($name, $label, $value = null) {
    return "\n\t\t<div class='checkbox'>\n\t\t\t<label>\n\t\t\t\t<input type='checkbox' name='{$name}' {$value} id='{$name}'>  {$label} \n\t\t\t</label>\n\t\t</div>\n\t";
});
Form::macro('radi', function ($name, $label, $value = null, $condition = null) {
    return "<div class='radio'>\n\t  <label>\n\t    <input type='radio' name='{$name}' id='{$name}' value='{$value}' {$condition}>\n\t    {$label}\n\t  </label>\n\t</div>";
});
Form::macro('datetime', function ($name, $label, $value = null) {
    return "\n\t\t<div class='form-group'>\n\t            <div class='input-group date' id={$name}>\n\t                <input type='text' class='form-control' name={$name} placeholder={$label} />\n\t                <span class='input-group-addon'>\n\t                    <span class='fa fa-calendar'>\n\t                    </span>\n\t                </span>\n\t            </div>\n\t        </div>\t\n\t";
});
Form::macro('formSubmit', function ($label, $icon = null) {
    return " \n\t\t<div class='form-group'>\n\t\t\t<button type='submit' class='btn btn-default'>\n\t\t\t\t<i class='fa {$icon}'></i> \t\n\t\t\t\t{$label}\n\t\t\t</button>\n\t\t</div>";
});
开发者ID:eiswe,项目名称:disaster-myanmar,代码行数:27,代码来源:FormHelper.php

示例10: function

|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
Form::macro('date', function ($name, $value = null, $options = array()) {
    $value = (is_null($value) or $value == '') ? \Input::get($name) : $value;
    $input = '<input type="date" name="' . $name . '" value="' . $value . '"';
    foreach ($options as $key => $value) {
        $input .= ' ' . $key . '="' . $value . '"';
    }
    return $input . '>';
});
require app_path() . '/filters.php';
开发者ID:EdgardoPitti,项目名称:plagetri21v2,代码行数:31,代码来源:global.php

示例11: function

    }
    $select .= '</select>';
    return $select;
});
Form::macro('barcode_types', function ($name = "barcode_type", $selected = null, $class = null) {
    $barcode_types = array('QRCODE', 'DATAMATRIX');
    $select = '<select name="' . $name . '" class="' . $class . '">';
    foreach ($barcode_types as $barcode_type) {
        $select .= '<option value="' . $barcode_type . '"' . ($selected == $barcode_type ? ' selected="selected"' : '') . '>' . $barcode_type . '</option> ';
    }
    $select .= '</select>';
    return $select;
});
Form::macro('username_format', function ($name = "username_format", $selected = null, $class = null) {
    $formats = array('firstname.lastname' => trans('general.firstname_lastname_format'), 'firstname' => trans('general.first_name_format'), 'filastname' => trans('general.filastname_format'));
    $select = '<select name="' . $name . '" class="' . $class . '" style="width: 100%">';
    foreach ($formats as $format => $label) {
        $select .= '<option value="' . $format . '"' . ($selected == $format ? ' selected="selected"' : '') . '>' . $label . '</option> ' . "\n";
    }
    $select .= '</select>';
    return $select;
});
Form::macro('customfield_elements', function ($name = "customfield_elements", $selected = null, $class = null) {
    $formats = array('text' => 'Text Box', 'listbox' => 'List Box');
    $select = '<select name="' . $name . '" class="' . $class . '" style="width: 100%">';
    foreach ($formats as $format => $label) {
        $select .= '<option value="' . $format . '"' . ($selected == $format ? ' selected="selected"' : '') . '>' . $label . '</option> ' . "\n";
    }
    $select .= '</select>';
    return $select;
});
开发者ID:stijni,项目名称:snipe-it,代码行数:31,代码来源:macros.php

示例12: function

<?php

// Create a Form macro which generates the fake honeypot field
// as well as the time check field
Form::macro('honeypot', function ($honey_name, $honey_time) {
    return View::make("honeypot::fields", get_defined_vars());
});
// We add a custom validator to validate the honeypot text and time check fields
Validator::register('honeypot', function ($attribute, $value, $parameters) {
    // We want the value to be empty, empty means it wasn't a spammer
    return $value == '';
});
Validator::register('honeytime', function ($attribute, $value, $parameters) {
    // The timestamp is encrypted so let's decrypt it
    $value = Crypter::decrypt($value);
    // The current time should be greater than the time the form was built + the speed option
    return is_numeric($value) && time() > $value + $parameters[0];
});
开发者ID:SerdarSanri,项目名称:Honeypot,代码行数:18,代码来源:start.php

示例13: array

    Route::post('users/create', array('uses' => 'AdminUserController@store'));
    Route::resource('users', 'AdminUserController');
    Route::get('users/{id}/edit', array('uses' => 'AdminUserController@edit'));
    // Route::get('users/{id}/delete', array('uses' => 'AdminUserController@destroy'));
    Route::get('users/{id}/delete', 'AdminUserController@destroy');
    Route::put('users/update', 'AdminUserController@update');
    Route::get('registrations', array('uses' => 'AdminUserController@showRegistrations'));
    Route::resource('installers', 'InstallerController');
    Route::post('installers/store', 'InstallerController@store');
    Route::get('installers/{id}/delete', 'InstallerController@destroy');
    Route::resource('products', 'ProductCategoryController');
    Route::get('products/{id}/subcategories', array('uses' => 'ProductCategoryController@index'));
    Route::get('products/{id}/files', array('uses' => 'ProductCategoryController@files'));
    Route::post('products/addfile', 'ProductCategoryController@addfile');
    Route::get('products/{id}/models', array('uses' => 'ProductsController@models'));
    Route::post('products/{id}/addmodels', 'ProductsController@addmodels');
    Route::post('products/deletemodel/{id}', 'ProductsController@deletemodel');
    Route::post('products/store', array('uses' => 'ProductCategoryController@store'));
    Route::get('products/{id}/setdefault/{fileid}', array('uses' => 'FileController@setdefault'));
    Route::post('products/deletefile/{id}', 'FileController@deletefile');
});
//Macros
Form::macro('stateSelect', function ($name = "state", $selected = null, $options = array()) {
    $states = array('' => "", 'AL' => "Alabama", 'AK' => "Alaska", 'AZ' => "Arizona", 'AR' => "Arkansas", 'CA' => "California", 'CO' => "Colorado", 'CT' => "Connecticut", 'DE' => "Delaware", 'DC' => "District Of Columbia", 'FL' => "Florida", 'GA' => "Georgia", 'HI' => "Hawaii", 'ID' => "Idaho", 'IL' => "Illinois", 'IN' => "Indiana", 'IA' => "Iowa", 'KS' => "Kansas", 'KY' => "Kentucky", 'LA' => "Louisiana", 'ME' => "Maine", 'MD' => "Maryland", 'MA' => "Massachusetts", 'MI' => "Michigan", 'MN' => "Minnesota", 'MS' => "Mississippi", 'MO' => "Missouri", 'MT' => "Montana", 'NE' => "Nebraska", 'NV' => "Nevada", 'NH' => "New Hampshire", 'NJ' => "New Jersey", 'NM' => "New Mexico", 'NY' => "New York", 'NC' => "North Carolina", 'ND' => "North Dakota", 'OH' => "Ohio", 'OK' => "Oklahoma", 'OR' => "Oregon", 'PA' => "Pennsylvania", 'RI' => "Rhode Island", 'SC' => "South Carolina", 'SD' => "South Dakota", 'TN' => "Tennessee", 'TX' => "Texas", 'UT' => "Utah", 'VT' => "Vermont", 'VA' => "Virginia", 'WA' => "Washington", 'WV' => "West Virginia", 'WI' => "Wisconsin", 'WY' => "Wyoming");
    echo $selected;
    return Form::select($name, $states, $selected, $options);
});
Form::macro('countrySelect', function ($name = "country", $selected = null, $options = array()) {
    $countries = array('' => '', 'US' => 'UNITED STATES', 'AF' => 'AFGHANISTAN', 'AL' => 'ALBANIA', 'DZ' => 'ALGERIA', 'AS' => 'AMERICAN SAMOA', 'AD' => 'ANDORRA', 'AO' => 'ANGOLA', 'AI' => 'ANGUILLA', 'AQ' => 'ANTARCTICA', 'AG' => 'ANTIGUA AND BARBUDA', 'AR' => 'ARGENTINA', 'AM' => 'ARMENIA', 'AW' => 'ARUBA', 'AU' => 'AUSTRALIA', 'AT' => 'AUSTRIA', 'AZ' => 'AZERBAIJAN', 'BS' => 'BAHAMAS', 'BH' => 'BAHRAIN', 'BD' => 'BANGLADESH', 'BB' => 'BARBADOS', 'BY' => 'BELARUS', 'BE' => 'BELGIUM', 'BZ' => 'BELIZE', 'BJ' => 'BENIN', 'BM' => 'BERMUDA', 'BT' => 'BHUTAN', 'BO' => 'BOLIVIA', 'BA' => 'BOSNIA AND HERZEGOVINA', 'BW' => 'BOTSWANA', 'BV' => 'BOUVET ISLAND', 'BR' => 'BRAZIL', 'IO' => 'BRITISH INDIAN OCEAN TERRITORY', 'BN' => 'BRUNEI DARUSSALAM', 'BG' => 'BULGARIA', 'BF' => 'BURKINA FASO', 'BI' => 'BURUNDI', 'KH' => 'CAMBODIA', 'CM' => 'CAMEROON', 'CA' => 'CANADA', 'CV' => 'CAPE VERDE', 'KY' => 'CAYMAN ISLANDS', 'CF' => 'CENTRAL AFRICAN REPUBLIC', 'TD' => 'CHAD', 'CL' => 'CHILE', 'CN' => 'CHINA', 'CX' => 'CHRISTMAS ISLAND', 'CC' => 'COCOS (KEELING) ISLANDS', 'CO' => 'COLOMBIA', 'KM' => 'COMOROS', 'CG' => 'CONGO', 'CD' => 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'CK' => 'COOK ISLANDS', 'CR' => 'COSTA RICA', 'CI' => 'COTE D IVOIRE', 'HR' => 'CROATIA', 'CU' => 'CUBA', 'CY' => 'CYPRUS', 'CZ' => 'CZECH REPUBLIC', 'DK' => 'DENMARK', 'DJ' => 'DJIBOUTI', 'DM' => 'DOMINICA', 'DO' => 'DOMINICAN REPUBLIC', 'TP' => 'EAST TIMOR', 'EC' => 'ECUADOR', 'EG' => 'EGYPT', 'SV' => 'EL SALVADOR', 'GQ' => 'EQUATORIAL GUINEA', 'ER' => 'ERITREA', 'EE' => 'ESTONIA', 'ET' => 'ETHIOPIA', 'FK' => 'FALKLAND ISLANDS (MALVINAS)', 'FO' => 'FAROE ISLANDS', 'FJ' => 'FIJI', 'FI' => 'FINLAND', 'FR' => 'FRANCE', 'GF' => 'FRENCH GUIANA', 'PF' => 'FRENCH POLYNESIA', 'TF' => 'FRENCH SOUTHERN TERRITORIES', 'GA' => 'GABON', 'GM' => 'GAMBIA', 'GE' => 'GEORGIA', 'DE' => 'GERMANY', 'GH' => 'GHANA', 'GI' => 'GIBRALTAR', 'GR' => 'GREECE', 'GL' => 'GREENLAND', 'GD' => 'GRENADA', 'GP' => 'GUADELOUPE', 'GU' => 'GUAM', 'GT' => 'GUATEMALA', 'GN' => 'GUINEA', 'GW' => 'GUINEA-BISSAU', 'GY' => 'GUYANA', 'HT' => 'HAITI', 'HM' => 'HEARD ISLAND AND MCDONALD ISLANDS', 'VA' => 'HOLY SEE (VATICAN CITY STATE)', 'HN' => 'HONDURAS', 'HK' => 'HONG KONG', 'HU' => 'HUNGARY', 'IS' => 'ICELAND', 'IN' => 'INDIA', 'ID' => 'INDONESIA', 'IR' => 'IRAN, ISLAMIC REPUBLIC OF', 'IQ' => 'IRAQ', 'IE' => 'IRELAND', 'IL' => 'ISRAEL', 'IT' => 'ITALY', 'JM' => 'JAMAICA', 'JP' => 'JAPAN', 'JO' => 'JORDAN', 'KZ' => 'KAZAKSTAN', 'KE' => 'KENYA', 'KI' => 'KIRIBATI', 'KP' => 'KOREA DEMOCRATIC PEOPLES REPUBLIC OF', 'KR' => 'KOREA REPUBLIC OF', 'KW' => 'KUWAIT', 'KG' => 'KYRGYZSTAN', 'LA' => 'LAO PEOPLES DEMOCRATIC REPUBLIC', 'LV' => 'LATVIA', 'LB' => 'LEBANON', 'LS' => 'LESOTHO', 'LR' => 'LIBERIA', 'LY' => 'LIBYAN ARAB JAMAHIRIYA', 'LI' => 'LIECHTENSTEIN', 'LT' => 'LITHUANIA', 'LU' => 'LUXEMBOURG', 'MO' => 'MACAU', 'MK' => 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'MG' => 'MADAGASCAR', 'MW' => 'MALAWI', 'MY' => 'MALAYSIA', 'MV' => 'MALDIVES', 'ML' => 'MALI', 'MT' => 'MALTA', 'MH' => 'MARSHALL ISLANDS', 'MQ' => 'MARTINIQUE', 'MR' => 'MAURITANIA', 'MU' => 'MAURITIUS', 'YT' => 'MAYOTTE', 'MX' => 'MEXICO', 'FM' => 'MICRONESIA, FEDERATED STATES OF', 'MD' => 'MOLDOVA, REPUBLIC OF', 'MC' => 'MONACO', 'MN' => 'MONGOLIA', 'MS' => 'MONTSERRAT', 'MA' => 'MOROCCO', 'MZ' => 'MOZAMBIQUE', 'MM' => 'MYANMAR', 'NA' => 'NAMIBIA', 'NR' => 'NAURU', 'NP' => 'NEPAL', 'NL' => 'NETHERLANDS', 'AN' => 'NETHERLANDS ANTILLES', 'NC' => 'NEW CALEDONIA', 'NZ' => 'NEW ZEALAND', 'NI' => 'NICARAGUA', 'NE' => 'NIGER', 'NG' => 'NIGERIA', 'NU' => 'NIUE', 'NF' => 'NORFOLK ISLAND', 'MP' => 'NORTHERN MARIANA ISLANDS', 'NO' => 'NORWAY', 'OM' => 'OMAN', 'PK' => 'PAKISTAN', 'PW' => 'PALAU', 'PS' => 'PALESTINIAN TERRITORY, OCCUPIED', 'PA' => 'PANAMA', 'PG' => 'PAPUA NEW GUINEA', 'PY' => 'PARAGUAY', 'PE' => 'PERU', 'PH' => 'PHILIPPINES', 'PN' => 'PITCAIRN', 'PL' => 'POLAND', 'PT' => 'PORTUGAL', 'PR' => 'PUERTO RICO', 'QA' => 'QATAR', 'RE' => 'REUNION', 'RO' => 'ROMANIA', 'RU' => 'RUSSIAN FEDERATION', 'RW' => 'RWANDA', 'SH' => 'SAINT HELENA', 'KN' => 'SAINT KITTS AND NEVIS', 'LC' => 'SAINT LUCIA', 'PM' => 'SAINT PIERRE AND MIQUELON', 'VC' => 'SAINT VINCENT AND THE GRENADINES', 'WS' => 'SAMOA', 'SM' => 'SAN MARINO', 'ST' => 'SAO TOME AND PRINCIPE', 'SA' => 'SAUDI ARABIA', 'SN' => 'SENEGAL', 'SC' => 'SEYCHELLES', 'SL' => 'SIERRA LEONE', 'SG' => 'SINGAPORE', 'SK' => 'SLOVAKIA', 'SI' => 'SLOVENIA', 'SB' => 'SOLOMON ISLANDS', 'SO' => 'SOMALIA', 'ZA' => 'SOUTH AFRICA', 'GS' => 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'ES' => 'SPAIN', 'LK' => 'SRI LANKA', 'SD' => 'SUDAN', 'SR' => 'SURINAME', 'SJ' => 'SVALBARD AND JAN MAYEN', 'SZ' => 'SWAZILAND', 'SE' => 'SWEDEN', 'CH' => 'SWITZERLAND', 'SY' => 'SYRIAN ARAB REPUBLIC', 'TW' => 'TAIWAN, PROVINCE OF CHINA', 'TJ' => 'TAJIKISTAN', 'TZ' => 'TANZANIA, UNITED REPUBLIC OF', 'TH' => 'THAILAND', 'TG' => 'TOGO', 'TK' => 'TOKELAU', 'TO' => 'TONGA', 'TT' => 'TRINIDAD AND TOBAGO', 'TN' => 'TUNISIA', 'TR' => 'TURKEY', 'TM' => 'TURKMENISTAN', 'TC' => 'TURKS AND CAICOS ISLANDS', 'TV' => 'TUVALU', 'UG' => 'UGANDA', 'UA' => 'UKRAINE', 'AE' => 'UNITED ARAB EMIRATES', 'GB' => 'UNITED KINGDOM', 'UM' => 'UNITED STATES MINOR OUTLYING ISLANDS', 'UY' => 'URUGUAY', 'UZ' => 'UZBEKISTAN', 'VU' => 'VANUATU', 'VE' => 'VENEZUELA', 'VN' => 'VIET NAM', 'VG' => 'VIRGIN ISLANDS, BRITISH', 'VI' => 'VIRGIN ISLANDS, U.S.', 'WF' => 'WALLIS AND FUTUNA', 'EH' => 'WESTERN SAHARA', 'YE' => 'YEMEN', 'YU' => 'YUGOSLAVIA', 'ZM' => 'ZAMBIA', 'ZW' => 'ZIMBABWE');
    return Form::select($name, $countries, $selected, $options);
});
开发者ID:periodthree,项目名称:mhd,代码行数:31,代码来源:routes.php

示例14: function

 * @param string $name The field name
 * @param string $title The field title
 * @param object $errors The laravel errors object
 * @param array $choice The choice of the select
 * @param null|array $object The entity of the field
 */
Form::macro('normalSelect', function ($name, $title, ViewErrorBag $errors, array $choice, $object = null, array $options = []) {
    if (array_key_exists("multiple", $options)) {
        $nameForm = $name . '[]';
    } else {
        $nameForm = $name;
    }
    $string = "<div class='form-group dropdown" . ($errors->has($name) ? ' has-error' : '') . "'>";
    $string .= "<label for='{$nameForm}'>{$title}</label>";
    if (is_object($object)) {
        $currentData = isset($object->{$name}) ? $object->{$name} : '';
    } else {
        $currentData = false;
    }
    /* Bootstrap default class */
    $array_option = ['class' => 'form-control'];
    if (array_key_exists("class", $options)) {
        $array_option = ['class' => $array_option['class'] . ' ' . $options['class']];
        unset($options['class']);
    }
    $options = array_merge($array_option, $options);
    $string .= Form::select($nameForm, $choice, Input::old($nameForm, $currentData), $options);
    $string .= $errors->first($name, '<span class="help-block">:message</span>');
    $string .= "</div>";
    return $string;
});
开发者ID:mikemand,项目名称:Core,代码行数:31,代码来源:macros.php

示例15: app_path

|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path() . '/filters.php';
//require app_path().'/libraries/function/great_circle_distance.php';
//require app_path().'/libraries/function/flight_duration.php';
Form::macro('time_dropdown', function ($name, $options) {
    for ($i = 0; $i <= 23; $i++) {
        if ($i < 10) {
            $i = '0' . $i;
        }
        $hours[] = $i;
    }
    for ($i = 0; $i < 60; $i += 5) {
        if ($i < 10) {
            $i = '0' . $i;
        }
        $minutes[$i] = $i;
    }
    return '<div class="row"><div class="col-sm-6">' . Form::select($name . '[hours]', $hours, null, $options) . '</div><div class="col-sm-6">' . Form::select($name . '[minutes]', $minutes, null, $options) . '</div></div>';
});
HTML::macro('sort_link', function ($sortby) {
    return '<a href="' . action('AirportsController@index', array('sortby' => $sortby)) . '"><span class="glyphicon glyphicon-sort"></span></a>';
});
Form::macro('airports', function ($id, $options, $default = '') {
    $options['class'] = $options['class'] . ' airportsAutocomplete';
    return Form::hidden($id, $default, $options);
});
开发者ID:emtudo,项目名称:airline-manager,代码行数:31,代码来源:global.php


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