本文整理汇总了PHP中yii\jui\AutoComplete::classname方法的典型用法代码示例。如果您正苦于以下问题:PHP AutoComplete::classname方法的具体用法?PHP AutoComplete::classname怎么用?PHP AutoComplete::classname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\jui\AutoComplete
的用法示例。
在下文中一共展示了AutoComplete::classname方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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")
{
示例2:
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>
示例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>
示例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 -->
示例5: 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;
}
示例6: echoFieldList
/**
* @param \yii\widgets\ActiveForm $form
*/
public function echoFieldList($form, $fields = null)
{
/** @var \yii\widgets\ActiveField $object */
$model = $this;
if (is_null($fields)) {
$fields = static::$fields;
}
foreach ($fields as $field) {
if (isset($field['draw'])) {
$method = $field['draw'];
$object = call_user_func($method, $form, $this, $field);
} else {
$object = $form->field($model, $field[0])->label($field[1]);
if (isset($field[self::POS_HINT])) {
if ($field[self::POS_HINT] != '') {
$object->hint($field[self::POS_HINT]);
}
}
if (isset($field['widget'])) {
$class = $field['widget'][0];
$object->widget($class::className(), ArrayHelper::getValue($field, 'widget.1', []));
}
if (isset($field[self::POS_RULE])) {
if ($field[self::POS_RULE] != '') {
if ($field[self::POS_RULE] == 'file') {
$object->widget(FileUpload::className());
}
}
}
if (isset($field[self::POS_RULE])) {
if ($field[self::POS_RULE] != '') {
if ($field[self::POS_RULE] == 'boolean') {
$object->checkbox();
}
}
}
if (isset($field[self::POS_RULE])) {
if ($field[self::POS_RULE] != '') {
if ($field[self::POS_RULE] == 'date') {
$object->widget(DatePicker::classname(), ['dateFormat' => 'php:d.m.Y', 'options' => ['class' => 'form-control']]);
}
}
}
if (ArrayHelper::keyExists('type', $field)) {
$options = [];
if (is_array($field['type'])) {
$name = $field['type'][0];
if (isset($field['type'][1])) {
$options = $field['type'][1];
}
} else {
$name = $field['type'];
}
switch ($name) {
case 'checkbox':
$object->checkbox();
break;
case 'textarea':
$object->textarea($options);
break;
case 'listBox':
$object->listBox($options);
break;
case 'RadioList':
$object->widget(\cs\Widget\RadioList\RadioList::className(), $options);
break;
case 'CheckBox':
$object->widget(\cs\Widget\CheckBox\CheckBox::className(), $options);
break;
case 'radioList':
$object->radioList($options);
break;
case 'place':
$object->widget(Place::className(), $options);
break;
case 'hidden':
$options['id'] = strtolower($this->formName()) . '-' . $field[self::POS_DB_NAME];
$object = Html::hiddenInput($this->formName() . '[' . $field[self::POS_DB_NAME] . ']', null, $options);
break;
case 'autoComplete':
$options['clientOptions']['select'] = new JsExpression("function( event, ui ) {" . "\$('#" . strtolower($model->formName()) . "-" . $field[self::POS_DB_NAME] . "').val(ui.item.id);" . "}");
$attr = $object->attribute;
if ($model->{$attr} != '') {
echo Html::hiddenInput($model->formName() . '[' . $field[self::POS_DB_NAME] . ']', $model->{$attr}, ['id' => strtolower($model->formName()) . '-' . $field[self::POS_DB_NAME]]);
} else {
echo Html::hiddenInput($model->formName() . '[' . $field[self::POS_DB_NAME] . ']', $model->{$attr}, ['id' => strtolower($model->formName()) . '-' . $field[self::POS_DB_NAME]]);
}
$object->attribute = $field[self::POS_DB_NAME] . '_name';
$object->widget(\yii\jui\AutoComplete::classname(), $options);
break;
}
}
}
echo $object;
}
}
示例7:
<?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');
示例8: 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.']];
}
示例9:
$this->title = 'Customer';
?>
<div class="site-index">
<div class="jumbotron" style="margin-bottom: 0px">
<h1>Welcome our beloved customer!</h1>
<p class="lead">You can input your passcode here to view your medical records</p>
</div>
<div class="col-lg-4 col-lg-offset-4">
<?php
$form = ActiveForm::begin(['id' => 'auth-form', 'class' => 'form-signin', 'method' => 'POST', 'action' => Url::to('@web/customer-report/auth')]);
?>
<?php
echo $form->field($model, 'name')->widget(AutoComplete::classname(), ['options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $patientNames]]);
?>
<?php
echo $form->field($model, 'passcode')->passwordInput();
?>
<!-- $form->field($model, 'verifyCode')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) -->
<div class="form-group">
<?php
echo Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'auth-button']);
?>
</div>
示例10:
?>
<?php
echo $form->field($model, 'date')->widget(\yii\jui\DatePicker::classname(), ['dateFormat' => 'MM-dd-yyyy']);
?>
<?php
echo $form->field($model, 'location')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'amgen_attendees')->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => ['source' => $data]]);
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'department_id')->dropDownList(ArrayHelper::map(Departments::find()->asArray()->all(), 'ID', 'Name'), ['ID' => 'Name']);
?>
<?php
echo $form->field($model, 'meeting_group_id')->dropDownList(ArrayHelper::map(MeetingGroups::find()->asArray()->all(), 'id', 'Group_name'), ['id' => 'Group_name']);
?>
示例11: JsExpression
<div class="requirement-form">
<?php
$form = ActiveForm::begin();
?>
<div class="form-group">
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
?>
<p class="help-block">Please include the relevant event and year for the requirement, if applicable. That way we can tell the difference between each year's Ranger Trainings, etc.
</div>
<div class="form-group">
<?php
echo $form->field($model, 'team')->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => ['source' => new JsExpression("function(request, response) {\n\t\t\t\t\t\t\$.getJSON('" . Url::to(['/requirement/team-ajax-search']) . "', {\n\t\t\t\t\t\t\tterm: request.term\n\t\t\t\t\t\t}, response);\n\t\t\t\t\t}")], 'options' => ['class' => 'form-control ui-autocomplete-input']]);
?>
<p class="help-block">Optional. The team name associated with this requirement.</p>
</div>
<div class="form-group">
<?php
echo $form->field($model, 'error_message')->textInput(['maxlength' => 255]);
?>
<p class="help-block">The error someone will see when attempting to signup for a shift without this requirement.</p>
</div>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
示例12: JsExpression
echo DetailView::widget(['model' => $model, 'attributes' => ['team.name', 'title', 'length', 'start_time:datetime', 'min_needed', 'max_needed', 'active:boolean', 'requirement.name']]);
?>
<h3>Volunteers</h3>
<?php
echo GridView::widget(['dataProvider' => $dp, 'columns' => ['user.username', 'user.real_name', 'user.burn_name', 'user.email', ['class' => 'yii\\grid\\ActionColumn', 'controller' => 'participant', 'template' => '{delete}']]]);
?>
<h4>Add Volunteer</h4>
<p class="help-block">Warning, this will add a user to the shift, regardless of any caps or requirements</p>
<?php
$activeForm = ActiveForm::begin(['id' => 'add-participant-form']);
?>
<?php
echo $activeForm->field($form, 'user_search')->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => ['source' => new JsExpression("function(request, response) {\n\t\t\t\t\t\t\$.getJSON('" . Url::to(['/user/ajax-search']) . "', {\n\t\t\t\t\t\t\tterm: request.term\n\t\t\t\t\t\t}, response);\n\t\t\t\t\t}"), 'select' => new JsExpression("function(event, ui) {\n\t\t\t\t\t\$('#addparticipantform-user_id').val(ui.item.id);\n\t\t\t\t}")], 'options' => ['class' => 'form-control ui-autocomplete-input', 'placeholder' => 'Search by username, email, burn name, or real name']]);
?>
<?php
echo Html::activeHiddenInput($form, 'user_id');
?>
<div class="form-group">
<?php
echo Html::submitButton('Copy', ['class' => 'btn btn-primary', 'name' => 'copy-button']);
?>
</div>
<?php
ActiveForm::end();
?>
示例13: array
<h4 class="modal-title">Add New Contact</h4>
</div>
<?php
echo $form->field($model2, 'congress_id')->hiddenInput()->label(false);
?>
<div class="modal-body">
<div class="row">
<div class="col-sm-12 col-xs-12"><span class="pull-right"><a href="#" data-toggle="modal" data-target="#myModal2"><img src="images/view_contact.png"></a></span></div>
<div id="success"></div>
<div class="col-sm-12 col-xs-12" style="padding-top:20px;">
<div class="col-sm-8 col-xs-8 ">
<?php
echo $form->field($workforce, 'workforce_id', array('labelOptions' => array('class' => 'w80', 'style' => 'width:100px')))->label('Name')->widget(\yii\jui\AutoComplete::classname(), ['options' => ['class' => 'form-control input'], 'clientOptions' => ['source' => $data]]);
?>
</div>
<div class="col-sm-6 col-xs-6">
<label for="exampleInputEmail2" class="w80">Title</label>
<input type="text" name="title" class="form-control input telnumber" id="exampleInputTitle" readonly >
</div>
<div class="col-sm-6 col-xs-6">
<label for="exampleInputEmail2" >Cost Center Name</label>
<input type="text" name="cost" class="form-control input telnumber" id="exampleInputGroup" readonly >
</div>
<div class="col-sm-6 col-xs-6">
<label for="exampleInputEmail2" class="w80">Function</label>
示例14:
</div>
<div style="padding: 10px;">
<?php
echo $form->field($model, 'svid_num')->textInput(['maxlength' => true]);
?>
<?php
//echo $form->field($model, 'svid_date')->textInput()
?>
<?php
echo $form->field($model, 'svid_date')->widget(\dosamigos\datepicker\DatePicker::className(), ['language' => 'ru', 'options' => ['class' => 'form-control', 'autocomplete' => 'off'], 'clientOptions' => ['forceParse' => true, 'todayBtn' => true, 'clearBtn' => true, 'autoclose' => true, 'todayHighlight' => true, 'format' => 'dd.mm.yyyy']]);
?>
<?php
//echo $form->field($model, 'svid_who_give')->textInput(['maxlength' => true])
?>
<?php
echo $form->field($model, 'svid_who_give')->widget(\yii\jui\AutoComplete::classname(), ['options' => ['class' => 'form-control'], 'clientOptions' => ['source' => \app\models\Firm::find()->select(['svid_who_give as value'])->active()->distinct()->orderBy('svid_who_give asc')->asArray()->all(), 'autoFocus' => true, 'minLength' => '1', 'delay' => '100']]);
?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" style="margin-bottom: 20px;">
<h3 class="panel-title"><?php
echo 'Прочее';
?>
</h3>
</div>
<div style="padding: 10px;">
<?php
echo $form->field($model, 'note')->textarea(['rows' => 6]);
?>