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


PHP jui\AutoComplete类代码示例

本文整理汇总了PHP中yii\jui\AutoComplete的典型用法代码示例。如果您正苦于以下问题:PHP AutoComplete类的具体用法?PHP AutoComplete怎么用?PHP AutoComplete使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: array_keys

<?php

use yii\widgets\ActiveForm;
use yii\helpers\Html;
$this->registerCss(".ui-menu .ui-menu-item:hover,.ui-menu .ui-state-active {background:#4f99c6}");
?>

<?php 
$form = ActiveForm::begin();
?>

<?php 
echo $form->field($model, 'name');
?>

<?php 
echo $form->field($model, 'description');
?>

<?php 
//echo $form->field($model, 'rule_name')
echo $form->field($model, 'rule_name')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => array_keys(\Yii::$app->authManager->getRules())], 'options' => ['class' => 'form-control']]);
echo $form->field($model, 'data')->textarea(['rows' => 6]);
?>

<?php 
echo Html::submitButton('Save', ['class' => 'btn btn-success btn-block']);
?>

<?php 
ActiveForm::end();
开发者ID:sea129,项目名称:kbay,代码行数:31,代码来源:_form.php

示例2: function

?>
    
		</div>
		<div class="col-sm-8">	
	
	<?php 
echo $form->field($model, 'tags')->widget(Select2::classname(), ['options' => ['placeholder' => Yii::t('app', 'Put additional tags, usefull for Helper Ledger ...')], 'data' => $model->getTags(), 'pluginOptions' => ['tags' => true, 'tokenSeparators' => [',', ' ']]]);
?>
			
		</div>
	</div>	
	
	<div class="row">	
		<div class="col-sm-9">			
	<?php 
echo $form->field($model, 'title')->widget(AutoComplete::classname(), ['clientOptions' => ['source' => Yii::$app->urlManager->createUrl("//cap/transaction/template")], 'clientEvents' => ['select' => 'function(event, ui) {																											
								var id = ui.item.value;								
								var url = "' . Yii::$app->urlManager->createUrl('//cap/transaction/template') . '?id="+id;
								$.ajax(url, {
									success: function (xhr) {										
										xhr = JSON.parse(xhr);									
										if (xhr != null)
										{											
											var t = JSON.parse(xhr.json);							
											
											var total = parseFloat($("#transaction-total").val());
																																	
											for (k in t)
											{
												if (k == "total")
												{
开发者ID:prasgema,项目名称:cap,代码行数:31,代码来源:_form.php

示例3:

echo $form->field($model, 'status')->widget(Select2::classname(), ['data' => $model->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Select shipping status...')], 'pluginOptions' => ['allowClear' => false], 'pluginEvents' => []]);
?>
				</div>		
			</div>
			<?php 
$field = $form->field($model, "city");
//$field->template = "{input}";
echo $field->widget(AutoComplete::classname(), ['clientOptions' => ['source' => Yii::$app->urlManager->createUrl("//yes/shipping/index?format=json&arraymap=city")], 'clientEvents' => ['select' => 'function(event, ui) {												
										console.log(event,ui,"tes");							
									}'], 'options' => ['class' => 'form-control required', 'maxlength' => 255, 'placeholder' => Yii::t('app', 'City name that use by shipping provider')]]);
?>
	
			<?php 
$field = $form->field($model, "area");
//$field->template = "{input}";
echo $field->widget(AutoComplete::classname(), ['clientOptions' => ['source' => Yii::$app->urlManager->createUrl("//yes/shipping/index?format=json&arraymap=area")], 'clientEvents' => ['select' => 'function(event, ui) {												
										console.log(event,ui,"tes");							
									}'], 'options' => ['class' => 'form-control required', 'maxlength' => 255, 'placeholder' => Yii::t('app', 'Wider area of the city like province and state, ex: Jakarta, Indonesia')]]);
?>
			
		</div>
		<div class="col-sm-6">
			<div class="well data">		
				<h4><?php 
echo Yii::t('app', 'Shipping Data');
?>
 <small class="pull-right"><?php 
echo Yii::t('app', 'list of carrier/provider that available to reach the city');
?>
  <a id="data-add" class="btn btn-sm btn-default">Add Data</a></small></h4>				
				<br>
开发者ID:highestgoodlikewater,项目名称:yes,代码行数:31,代码来源:_form.php

示例4: OlAttendees

 echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]id");
 echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]congress_id");
 echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]meeting_id");
 echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]ol_attendee_id");
 ?>
                                     <?php 
 if (!is_object($modelMeetingSchedule->olattendee)) {
     $olAttendeeModel = new OlAttendees();
 } else {
     $olAttendeeModel = $modelMeetingSchedule->olattendee;
 }
 $atNameField = $form->field($olAttendeeModel, "[{$i}]name")->textInput(['maxlength' => true, 'readonly' => true]);
 ?>
                                     <?php 
 if ($modelMeetingSchedule->isNewRecord) {
     $atNameField->widget(\yii\jui\AutoComplete::classname(), ['options' => ['class' => 'form-control input'], 'clientOptions' => ['source' => "index.php?r=ajax/auto"]]);
 }
 echo $atNameField;
 ?>
                                     <div class="row">
                                         <div class="col-sm-6">
                                             <?php 
 echo $form->field($olAttendeeModel, "[{$i}]ol_phone_no")->textInput(['maxlength' => true, 'readonly' => true, 'class' => "form-control intp telnumber"]);
 ?>
                                         </div>
                                         <div class="col-sm-6">
                                             <?php 
 echo $form->field($olAttendeeModel, "[{$i}]ol_bio")->textInput(['maxlength' => true, 'readonly' => true]);
 ?>
                                         </div>
                                     </div><!--  .row  -->
开发者ID:Rakeshdrupal,项目名称:yiifirstliveproject,代码行数:31,代码来源:_form_readonly.php

示例5:

echo $form->field($user, 'name');
?>

                        <label class="control-label" style="margin-top: 14px;">Email</label>
                        <?php 
echo $form->field($user, 'email');
?>


                        <label class="control-label" style="margin-top: 14px;">Тип користувача</label>
                        <?php 
echo $form->field($user, 'ac_type')->dropDownList(['0' => 'Користувач', '10' => 'Редактор', '11' => 'Адмін']);
?>
                        <label class="control-label" style="margin-top: 14px;">Країна</label>
                        <?php 
echo $form->field($user, 'country')->widget(\yii\jui\AutoComplete::classname(), ['name' => 'User[country]', 'id' => 'user-country', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $countries, 'autoFill' => true, 'minLength' => '2', 'style' => 'font-size: 0.8em']]);
?>
                        <label class="control-label" style="margin-top: 14px;">Місто</label>
                        <?php 
echo $form->field($user, 'city');
?>
                        <label class="control-label" style="margin-top: 14px;">Адреса</label>
                        <?php 
echo $form->field($user, 'address');
?>
                        <label class="control-label" style="margin-top: 14px;">Робота</label>
                        <?php 
echo $form->field($user, 'work');
?>

                        <label class="control-label" style="margin-top: 14px;">Стать</label>
开发者ID:sergiimazurok,项目名称:koziuck,代码行数:31,代码来源:user_edit.php

示例6: editAttribute

 /**
  * @param ActiveRecord $model - profile model
  * @param $field - profile fields model item
  * @param $htmlOptions - htmlOptions
  * @return string
  */
 public function editAttribute($model, $field, $htmlOptions = [])
 {
     /** @var ActiveRecord $modelName */
     $modelName = $this->params['modelName'];
     $list = [];
     if (isset($this->params['emptyFieldValue'])) {
         $list[] = ['id' => $this->params['emptyFieldValue'], 'label' => $this->params['emptyFieldLabel']];
     }
     $models = $modelName->find()->all();
     foreach ($models as $m) {
         if ($this->params['optionName']) {
             $list[] = ['label' => $m->getAttribute($this->params['optionName']), 'id' => $m->id];
         } else {
             $list[] = ['label' => $m->id, 'id' => $m->id];
         }
     }
     if (!isset($htmlOptions['id'])) {
         $htmlOptions['id'] = $field->varname;
     }
     $id = $htmlOptions['id'];
     $relation = $this->params['relationName'];
     /** @var ActiveRecord $modelName */
     $modelName = $this->params['modelName'];
     if ($relation && method_exists($model, $relation)) {
         $m = $model->__get($this->params['relationName']);
     } else {
         $m = $modelName::findOne($model->getAttribute($field->varname));
     }
     if ($m) {
         $default_value = $this->params['optionName'] ? $m->getAttribute($this->params['optionName']) : $m->id;
     } else {
         $default_value = '';
     }
     $htmlOptions['value'] = $default_value;
     $options['source'] = $list;
     $options['minLength'] = $this->params['minLength'];
     //$options['showAnim'] = 'fold';
     $options['select'] = "js:function(event, ui) { \$('#" . get_class($model) . "_" . $field->varname . "').val(ui.item.id);}";
     $options = Json::encode($options);
     /** @var \yii\widgets\ActiveField $form */
     $form = $htmlOptions['formField'];
     unset($htmlOptions['formField']);
     $return = $form->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => $options]);
     return $return;
 }
开发者ID:marsoltys,项目名称:yii2user,代码行数:51,代码来源:UWjuiAutoComplete.php

示例7:

use yii\helpers\Html;
use yii\helpers\Url;
use yii\jui\AutoComplete;
$this->title = '';
if ($locale) {
    $this->title = \Locale::getDisplayName($locale, Yii::$app->language) . ', ' . Html::encode($locale) . ' - ';
}
$this->title .= 'PHP intl extension, ICU data tables';
?>

<?php 
echo Html::beginForm(['site/index'], 'get', ['class' => 'form-horizontal']);
?>
<div class="input-group">
    <?php 
echo AutoComplete::widget(['name' => 'locale', 'value' => $locale, 'options' => ['class' => 'form-control', 'placeholder' => 'Enter locale code such as "en" or "en_US"', 'autofocus' => true], 'clientOptions' => ['source' => Url::toRoute(['site/suggest-locale'])]]);
?>
    <span class="input-group-btn">
        <?php 
echo Html::submitButton('Find', ['class' => 'btn btn-primary']);
?>
    </span>
</div>
<?php 
echo Html::endForm();
?>

<?php 
if ($locale) {
    ?>
开发者ID:mlzharov,项目名称:intl-icu-data-tables,代码行数:30,代码来源:index.php

示例8: autocompleteJui

 public function autocompleteJui($opts)
 {
     $id = $this->getInputId();
     $options = array_merge_recursive(['id' => $id . '_autoComplete', 'clientOptions' => ['select' => new JsExpression("function( event, ui ) { \$( '#{$id}' ).val( ui.item.id ); }"), 'change' => new JsExpression("function(){ if( \$( '#{$id}' ).val() <= 0 ){ \$(this).val(null); }}"), 'search' => new JsExpression("function(){ \$( '#{$id}' ).val(null); }")]], $opts);
     $hidden = Html::activeHiddenInput($this->model, $this->attribute);
     $autocomplete = AutoComplete::widget($options);
     Yii::$app->getView()->registerJs("\$('body').on('autocompletecreate', 'input', function(e, ui){" . "\$(this).addClass('form-control') });", View::POS_END, 'autocompletecreate');
     $this->parts['{input}'] = $hidden . $autocomplete;
     return $this;
 }
开发者ID:bruno-melo,项目名称:components,代码行数:10,代码来源:ActiveField.php

示例9: registerScript

 /**
  * Register the js scripts including the required assets and the options in
  * `$clientOptions`
  */
 protected function registerScript()
 {
     $view = $this->getView();
     if (isset($this->clientOptions['autocomplete_url'])) {
         if (class_exists('yii\\jui\\AutoComplete')) {
             \yii\jui\AutoComplete::register($view);
         } else {
             throw new InvalidConfigException('To use autocomplete functionality you need to install the ' . ' JUI Extension for Yii 2. ' . 'http://www.yiiframework.com/doc-2.0/ext-jui-index.html');
         }
     }
     $clientOptions = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
     JqueryTagsAsset::register($view);
     $view->registerJs("jQuery('#{$this->options["id"]}').tagsInput({$clientOptions});");
 }
开发者ID:Faryshta,项目名称:yii2-jquery-tagsinput,代码行数:18,代码来源:JqueryTagsInput.php

示例10:

    <?php 
$form = ActiveForm::begin(['action' => ['reportkpi'], 'method' => 'get']);
?>

    <div class="col-md-12">
        <?php 
/*echo $form->field($model, 'partner_id')->widget(Select2::classname(), [
      'data' => ArrayHelper::map(ResPartner::find()->all(),'id','display_name'),
      'options' => ['placeholder' => 'Filter as you type ...'],
  ])->label('Address Name')*/
?>
        <?php 
$data = ResPartner::find()->select(['display_name as value', 'display_name as  label', 'id as id'])->asArray()->all();
?>
        <?php 
echo $form->field($model, 'partner_id')->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => ['source' => $data]])->textInput()->label('Address Name');
?>
    </div>
    <div class="col-md-6">
        <?php 
echo $form->field($model, 'month_tanggal')->dropDownList(['1' => 'Januari', '2' => 'Februari', '3' => 'Maret', '4' => 'April', '5' => 'Mei', '6' => 'Juni', '7' => 'Juli', '8' => 'Agustus', '9' => 'September', '10' => 'Oktober', '11' => 'November', '12' => 'Desember'], ['prompt' => ''])->label('Bulan Kirim');
?>
    </div>
    <div class="col-md-6">
        <?php 
echo $form->field($model, 'year_tanggal')->textInput()->label('Tahun Kirim');
?>
    </div>
    <div class="col-md-6">
        <?php 
echo $form->field($model, 'month_po')->dropDownList(['1' => 'Januari', '2' => 'Februari', '3' => 'Maret', '4' => 'April', '5' => 'Mei', '6' => 'Juni', '7' => 'Juli', '8' => 'Agustus', '9' => 'September', '10' => 'Oktober', '11' => 'November', '12' => 'Desember'], ['prompt' => ''])->label('Bulan PO');
开发者ID:hendri30,项目名称:OpenPrint,代码行数:31,代码来源:_searchKPI.php

示例11:

_form_container" class="token-form <?php 
echo $this->context->getStatusIndicator($model);
?>
">

    <?php 
$form = (include \Yii::getAlias("@nitm/views/layouts/form/header.php"));
?>
		<?php 
echo Html::label('User', 'usersearch', []);
?>
		<?php 
if (!$model->isNewRecord) {
    echo Html::tag('h4', \nitm\module\models\User::getFullName($model->user_id));
} else {
    echo \yii\jui\AutoComplete::widget(['name' => 'name', 'attribute' => 'name', 'options' => ['class' => 'form-control', 'id' => 'usersearch', 'role' => 'autocompleteSelect', 'data-select' => \yii\helpers\Json::encode(["value" => "unique", "label" => "name", "container" => "token-user_id"])], 'clientOptions' => ['source' => '/autocomplete/user']]);
}
?>
		<?php 
echo Html::activeHiddenInput($model, 'user_id');
?>
		<?php 
echo $form->field($model, 'active')->checkbox();
?>

		<?php 
echo $form->field($model, 'revoked')->checkbox();
?>

		<?php 
echo $form->field($model, 'level')->dropDownList($model->getLevels());
开发者ID:nhatvuvan,项目名称:yii2-widgets,代码行数:31,代码来源:_form.php

示例12: JsExpression

                            <?php 
echo Html::label('Print Count:');
?>
<br>
                            <?php 
echo Html::input('text', 'jml', '10', ['id' => 'jml', 'style' => 'width:80px;']);
?>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="form-group" style="padding: 15px; padding-top: 0px;">
            <label for="product">Product :</label>
            <?php 
echo AutoComplete::widget(['name' => 'product', 'id' => 'product', 'clientOptions' => ['source' => new JsExpression('yii.global.sourceProduct'), 'select' => new JsExpression('yii.master.onProductSelect'), 'delay' => 100], 'options' => ['class' => 'form-control', 'style' => 'width:60%;']]);
?>
            <?php 
echo Html::hiddenInput('barcodeValue', '', ['id' => 'barcodeValue']);
?>
        </div>
    </div>
    <div class="box-footer">
        <?php 
echo Html::button(' Generate', ['onclick' => 'generateBarcode();', 'class' => 'btn btn-warning fa fa-qrcode']);
?>
        <?php 
echo Html::button(' Print', ['onclick' => 'print();', 'class' => 'btn btn-info fa fa-print']);
?>
    </div>
</div>
开发者ID:advance100,项目名称:sangkilbiz3,代码行数:31,代码来源:create-barcode.php

示例13:

            <div class="col-xs-3">
                <?php 
// Estado
$lista = ArrayHelper::map(\backend\models\Estado::find()->asArray()->all(), 'estadoid', 'estado');
echo $form->field($model, 'estado_id')->dropDownList($lista)->label('Estatus');
?>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-3">
                <?php 
// Cuenta
$data = \backend\models\Cuentas::find()->select(['cuenta'])->distinct()->asArray()->createCommand()->queryColumn();
//echo $form->field($model, 'cuenta')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => $data],]);
echo $form->field($model, 'cuenta')->widget(\yii\jui\AutoComplete::className(), ['options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $data]])->label('Dependencia / Entidad');
?>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-3">
                <?php 
// Siglas
echo $form->field($model, 'siglas')->textInput(['maxlength' => true])->textInput();
?>
            </div>
        </div>


开发者ID:rvences,项目名称:tele_sept,代码行数:28,代码来源:create-partidos.php

示例14: attributeWidgets

 /**
  * Config for attribute widgets (ycm)
  *
  * @return array
  */
 public function attributeWidgets()
 {
     /**
      * You should configure attribute widget as: ['field', 'widget'].
      *
      * If you need to pass additional configuration to the widget, add them as: ['field', 'widget', 'key' => 'value'].
      * The first two items are sliced from the array, and then it's passed to the widget as: ['key' => 'value'].
      *
      * There are couple of exceptions to this slicing:
      * If you use 'hint', 'hintOptions', 'label' or 'labelOptions' the widget will render hint and/or label and
      * then it will unset those keys and pass the array to the widget.
      *
      * If you use 'widget', you must also set 'widgetClass'.
      *
      * Check each widget to see what options you can override/set.
      */
     // example data
     $data = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'];
     return [['field_widget', 'widget', 'widgetClass' => \yii\jui\AutoComplete::classname(), 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $data], 'hint' => 'Type: t', 'label' => 'Autocomplete'], ['field_wysiwyg', 'wysiwyg'], ['field_date', 'date'], ['field_time', 'time'], ['field_datetime', 'datetime'], ['field_select', 'select'], ['field_selectMultiple', 'selectMultiple'], ['field_image', 'image'], ['field_file', 'file'], ['field_text', 'text'], ['field_hidden', 'hidden'], ['field_password', 'password'], ['field_textarea', 'textarea'], ['field_radio', 'radio'], ['field_boolean', 'boolean'], ['field_checkbox', 'checkbox'], ['field_dropdown', 'dropdown'], ['field_listbox', 'listbox'], ['field_checkboxList', 'checkboxList'], ['field_radioList', 'radioList'], ['field_disabled', 'disabled'], ['field_hide', 'hide'], ['field_html5', 'text', 'input' => 'number', 'min' => 1, 'max' => 5, 'hint' => 'Number between 1 - 5.']];
 }
开发者ID:janisto,项目名称:yii2-ycm-demo,代码行数:25,代码来源:Example.php

示例15: function

<section class="content">
    <?php 
echo \common\widgets\Alert::widget();
?>
    <div class="box box-primary">
        <div class="box-body">
            <h1><?php 
echo Html::encode($this->title);
?>
</h1>

            <p>
                <?php 
if (\Yii::$app->user->can('create-product')) {
    ?>
                    <?php 
    echo Html::a(Yii::t('app', 'Create Product'), ['create'], ['class' => 'btn btn-success']);
    ?>
                <?php 
}
?>
            </p>
            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'emptyText' => 'You don\'t have any products', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'title', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'title', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => Product::getAutoCompleteItems('title')]])], ['attribute' => 'ui', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'ui', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => Product::getAutoCompleteItems('ui')]])], ['class' => '\\pheme\\grid\\ToggleColumn', 'attribute' => 'active', 'enableAjax' => false, 'filter' => [1 => Yii::t('yii', 'Yes'), 0 => Yii::t('yii', 'No')]], ['class' => 'yii\\grid\\ActionColumn', 'template' => Product::getGridButtonsTemplate(), 'buttons' => ['delete' => function ($url, $model, $key) {
    $options = ['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => 'Are you sure you want to delete this item?', 'data-method' => 'post', 'data-pjax' => '0'];
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
}]]]]);
?>
        </div>
    </div>
</section>
开发者ID:ninetor,项目名称:yii-classifield,代码行数:31,代码来源:index.php


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