本文整理汇总了PHP中kartik\select2\Select2::classname方法的典型用法代码示例。如果您正苦于以下问题:PHP Select2::classname方法的具体用法?PHP Select2::classname怎么用?PHP Select2::classname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\select2\Select2
的用法示例。
在下文中一共展示了Select2::classname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectField
function selectField($attribute, $data, $widgetOptions = [], $fieldOptions = [])
{
$defaultFieldOptions = ['options' => ['class' => 'form-group']];
$defaultInputOptions = ['class' => 'form-control select', 'placeholder' => $this->model->getAttributeLabel($attribute) . '...'];
$fieldOptions = array_replace_recursive($defaultFieldOptions, $fieldOptions);
$inputOptions = array_replace_recursive($defaultInputOptions, isset($widgetOptions['inputOptions']) ? $widgetOptions['inputOptions'] : []);
if ($this->viewMode || in_array($attribute, $this->disabledFields)) {
$fieldOptions['enableClientValidation'] = false;
$inputOptions['disabled'] = 'disabled';
}
$defaultWidgetOptions = ['data' => $data, 'options' => $inputOptions, 'pluginOptions' => ['allowClear' => true, 'minimumResultsForSearch' => 1]];
$widgetOptions = array_replace_recursive($defaultWidgetOptions, $widgetOptions);
return $this->form->field($this->model, $attribute, $fieldOptions)->widget(Select2::classname(), $widgetOptions);
}
示例2:
if (yii::$app->has('organization') && ($organization = yii::$app->get('organization'))) {
?>
<?php
echo $form->field($model, 'organization_id')->dropDownList(array_merge(['0' => 'Нет'], ArrayHelper::map($organization->getList(), 'id', 'name')));
?>
<?php
}
?>
<?php
echo $form->field($model, 'sort')->textInput(['maxlength' => true]);
?>
<p><small>Чем выше приоритет, тем выше элемент среди других в общем списке.</small></p>
<?php
echo $form->field($model, 'service_ids')->widget(Select2::classname(), ['data' => $services, 'language' => 'ru', 'options' => ['multiple' => true, 'placeholder' => 'Выберите услуги комплекса ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Добавить' : 'Редактировать', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例3:
/* @var $this yii\web\View */
/* @var $model backend\models\AuthItemChild */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="auth-item-child-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'parent')->widget(Select2::classname(), ['data' => ArrayHelper::map(AuthItem::find()->where(['and', "type=1"])->all(), 'name', 'name'), 'language' => 'en', 'options' => ['placeholder' => 'Please Select']]);
?>
<?php
echo $form->field($model, 'child')->widget(Select2::classname(), ['data' => ArrayHelper::map(AuthItem::find()->where(['and', "type=2"])->all(), 'name', 'name'), 'language' => 'en', 'options' => ['placeholder' => 'Please Select']]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例4:
use backend\models\Companies;
use kartik\select2\Select2;
/* @var $this yii\web\View */
/* @var $model backend\models\Branches */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="branches-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'companies_company_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), 'language' => 'en', 'options' => ['placeholder' => 'Выберите компанию'], 'pluginOptions' => ['allowClear' => true]]);
?>
<?php
echo $form->field($model, 'branch_name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'branch_address')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'branch_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive'], ['prompt' => '']);
?>
示例5:
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\select2\Select2;
use kartik\datecontrol\DateControl;
?>
<?php
echo $form->field($model, 'edital')->textInput(['readonly' => true]);
?>
<?php
$data_cargos = ArrayHelper::map($cargos, 'descricao', 'descricao');
echo $form->field($model, 'cargo')->widget(Select2::classname(), ['data' => array_merge(["" => ""], $data_cargos), 'options' => ['placeholder' => 'Selecione o cargo...'], 'pluginOptions' => ['allowClear' => true]]);
?>
<?php
echo $form->field($model, 'nome')->textInput(['maxlength' => true, 'placeholder' => 'Nome completo...']);
?>
<?php
echo $form->field($model, "datanascimento")->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATETIME, 'displayFormat' => 'dd/MM/yyyy', 'autoWidget' => false, 'widgetClass' => 'yii\\widgets\\MaskedInput', 'options' => ['mask' => '99/99/9999', 'options' => ['class' => 'form-control', 'placeholder' => 'Data nascimento...']]]);
?>
<?php
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 4, 'attributes' => ['cpf' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Informe seu CPF...']], 'identidade' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Informe seu RG...']], 'orgao_exped' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Informe o orgão expedidor...']], 'sexo' => ['type' => Form::INPUT_RADIO_LIST, 'items' => [true => 'Masculino', false => 'Feminino'], 'options' => ['inline' => true]]]]);
?>
示例6: callback
}).done(function(data) { callback(data.results);});
}
}
SCRIPT;
$met_description = Yii::t('app', 'Introduce your business, Your business on the map, image gallery for your business, attachments for your business, Mark your business location in map');
$this->registerMetaTag(['property' => 'og:description', 'content' => $met_description]);
$this->registerMetaTag(['name' => 'description', 'content' => $met_description]);
$this->registerMetaTag(['name' => 'keywords', 'content' => $met_description]);
?>
<div class="row">
<div class="col-md-2">
<?php
$form = ActiveForm::begin(['id' => $searchModel->formName(), 'enableAjaxValidation' => false, 'enableClientValidation' => false, 'method' => 'get']);
?>
<?php
echo $form->field($searchModel, 'category_id')->widget(Select2::classname(), ['language' => Yii::$app->helper->getTwoCharLanguage(), 'size' => Select2::MEDIUM, 'options' => [], 'pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 2, 'ajax' => ['url' => $categoriesListUrl, 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {search:params.term}; }'), 'results' => new JsExpression('function(data,page) { return {results:data.results}; }')], 'initSelection' => new JsExpression($initCategoriesListScript)]]);
?>
<?php
echo $form->field($searchModel, 'country_id')->widget(Select2::className(), ['data' => ArrayHelper::map(Country::find()->asArray()->all(), 'id', 'name'), 'language' => Yii::$app->helper->getTwoCharLanguage(), 'options' => ['placeholder' => Yii::t('app', 'Select...')], 'pluginOptions' => ['allowClear' => true]]);
echo $form->field($searchModel, 'province_id')->widget(DepDrop::classname(), ['data' => !$searchModel->country_id ? [] : ArrayHelper::map(Province::find()->where(['country_id' => $searchModel->country_id])->asArray()->all(), 'id', 'name'), 'type' => DepDrop::TYPE_SELECT2, 'options' => ['placeholder' => Yii::t('app', 'Select...')], 'select2Options' => ['pluginOptions' => ['allowClear' => true], 'language' => Yii::$app->helper->getTwoCharLanguage()], 'pluginOptions' => ['depends' => ['search-country_id'], 'url' => Url::to(['/province/dep-list']), 'loadingText' => Yii::t('app', 'Loading...')]]);
echo $form->field($searchModel, 'city_id')->widget(DepDrop::classname(), ['data' => !$searchModel->province_id ? [] : ArrayHelper::map(City::find()->where(['province_id' => $searchModel->province_id])->asArray()->all(), 'id', 'name'), 'options' => ['placeholder' => Yii::t('app', 'Select...')], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['allowClear' => true], 'language' => Yii::$app->helper->getTwoCharLanguage()], 'pluginOptions' => ['depends' => ['search-province_id'], 'url' => Url::to(['/city/dep-list']), 'loadingText' => Yii::t('app', 'Loading...')]]);
?>
<?php
echo $form->field($searchModel, 'title')->textInput();
?>
<?php
echo $form->field($searchModel, 'address')->textInput();
?>
<?php
echo Html::hiddenInput('view', $adverView, ['id' => 'hiddenViewMode']);
?>
示例7:
echo $form->errorSummary($model);
?>
<!-- dummy inputs to prevent auto fill -->
<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;" />
<input type="password" name="password_fake" id="password_fake" value="" style="display:none;" />
<div class="row">
<div class="col-md-8">
<?php
echo $form->field($model, 'username')->textInput(['maxlength' => 128, 'autocomplete' => 'new_username']);
if (in_array(Module::SCN_ADMIN, $m->passwordSettings['strengthMeter'])) {
echo $form->field($model, 'password')->widget(PasswordInput::classname(), []);
} else {
echo $form->field($model, 'password')->passwordInput();
}
echo $form->field($model, 'email')->textInput(['maxlength' => 255]);
echo $form->field($model, 'status')->widget(Select2::classname(), ['data' => $m->getEditStatuses(), 'options' => ['options' => $m->getDisabledStatuses()]]);
?>
</div>
</div>
<hr>
<div class="text-right">
<?php
echo $m->button(Module::BTN_RESET_FORM);
?>
<?php
echo $m->button(Module::BTN_SUBMIT_FORM);
?>
</div>
<?php
ActiveForm::end();
示例8: JsExpression
?>
<div class="row">
<div class="col-lg-5 col-centered">
<?php
echo $form->field($model, 'name');
?>
<?php
echo $form->field($model, 'description')->textarea();
?>
<?php
echo $form->field($model, 'cover');
?>
<?php
echo $form->field($model, 'file');
?>
<?php
echo $form->field($model, 'categories')->widget(Select2::classname(), ['options' => ['placeholder' => null, 'multiple' => true], 'data' => $model->getCategoriesData(), 'pluginOptions' => ['tags' => true, 'maximumInputLength' => 10, 'ajax' => ['url' => Url::to(['/ajax/category/index']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(data) { return data.text; }'), 'templateSelection' => new JsExpression('function (data) {return data.text;}')]]);
?>
<?php
echo $form->field($model, 'users')->widget(Select2::classname(), ['options' => ['placeholder' => null, 'multiple' => true], 'data' => $model->getUsersData(), 'pluginOptions' => ['tags' => true, 'maximumInputLength' => 10, 'ajax' => ['url' => Url::to(['/ajax/user/index']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(data) { return data.text; }'), 'templateSelection' => new JsExpression('function (data) { return data.text; }')]]);
?>
<div class="form-group">
<?php
echo Html::submitButton('Сохранить', ['class' => 'btn btn-primary', 'name' => 'button-save']);
?>
</div>
</div>
</div>
<?php
ActiveForm::end();
示例9: JsExpression
<div class="container">
<div class="section-inner">
<div class="section-content layout-2cols-left">
<div class="row">
<div class="col-xs-12 col-sm-9 col-sm-push-3 col-main section-gap">
<div class="reg-area">
<h1 class="text-center h2">Create New Message</h1>
<?php
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
?>
<?php
echo $form->field($model, 'subject');
?>
<?php
echo $form->field($model, 'users')->widget(\kartik\select2\Select2::classname(), ['data' => $model->getUserOptions(), 'options' => ['placeholder' => Yii::t('message', 'Select Users'), 'multiple' => 'multiple'], 'pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 2, 'ajax' => ['url' => Url::to(['user-list']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(users) { return users.text; }'), 'templateSelection' => new JsExpression('function (users) { return users.text; }')]]);
?>
<?php
echo $form->field($model, 'category_id')->dropDownList(\app\modules\message\models\Message::getCategoryOptions());
?>
<?php
echo $form->field($model, 'content')->widget(letyii\tinymce\Tinymce::className(), ['options' => ['style' => 'height: 400px;'], 'configs' => ['setup' => new \yii\web\JsExpression('function(editor) { editor.on("change", function() { tinymce.triggerSave(); }); }'), 'plugins' => 'moxiemanager advlist autolink lists link image charmap print preview hr anchor pagebreak ' . 'searchreplace wordcount visualblocks visualchars code fullscreen ' . 'insertdatetime media nonbreaking save table contextmenu directionality ' . 'emoticons template paste textcolor colorpicker textpattern', 'toolbar1' => 'insertfile undo redo | styleselect | fontselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', 'toolbar2' => 'print preview media | forecolor backcolor emoticons', 'moxiemanager_image_settings' => ['moxiemanager_title' => 'Images', 'moxiemanager_extensions' => 'jpg,png,gif', 'moxiemanager_rootpath' => '/uploads/files', 'moxiemanager_view' => 'thumbs'], 'external_plugins' => ['moxiemanager' => Url::base() . '/plugins/moxiemanager/plugin.min.js']]]);
?>
<div class="text-center">
<button type="submit" class="button button-primary button-lg">Send</button>
</div>
<?php
ActiveForm::end();
?>
示例10: JsExpression
<div class="col-sm-9">
<?php
echo $this->render('/elements/messages/_navbar', ['active' => 'new']);
?>
<br>
<?php
$form = ActiveForm::begin(['id' => 'message-form']);
?>
<div class="row">
<div class="col-sm-3 text-right"><p class="form-control-static"><?php
echo Yii::t('podium/view', 'Send to');
?>
</p></div>
<div class="col-sm-9">
<?php
echo $form->field($model, 'receiver_id')->widget(Select2::classname(), ['options' => ['placeholder' => Yii::t('podium/view', 'Select a member...')], 'theme' => Select2::THEME_KRAJEE, 'pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 3, 'ajax' => ['url' => Url::to(['members/fieldlist']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }')]])->label(false);
?>
</div>
</div>
<div class="row">
<div class="col-sm-3 text-right"><p class="form-control-static"><?php
echo Yii::t('podium/view', 'Message Topic');
?>
</p></div>
<div class="col-sm-9">
<?php
echo $form->field($model, 'topic')->textInput(['placeholder' => Yii::t('podium/view', 'Message Topic')])->label(false);
?>
</div>
</div>
<div class="row">
示例11:
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model im\eav\models\Value */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="value-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'attribute_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Attribute::find()->asArray()->orderBy('name')->all(), 'id', 'presentation'), 'options' => ['prompt' => '']]);
?>
<?php
echo $form->field($model, 'value')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'presentation')->textInput(['maxlength' => true]);
?>
<?php
echo Html::submitButton($model->isNewRecord ? Module::t('module', 'Create') : Module::t('module', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-success']);
?>
<?php
示例12:
<div class="panel panel-default">
<?php
$form = ActiveForm::begin(['id' => 'details-form']);
?>
<div class="panel-body">
<div class="row">
<div class="col-sm-12">
<?php
echo $form->field($model, 'username')->textInput(['data-container' => 'body', 'data-toggle' => 'popover', 'data-placement' => 'right', 'data-content' => Yii::t('podium/view', 'Username must start with a letter, contain only letters, digits and underscores, and be at least 3 characters long.'), 'data-trigger' => 'focus'])->label(Yii::t('podium/view', 'Username'));
?>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<?php
echo $form->field($model, 'timezone')->widget(Select2::classname(), ['data' => Helper::timeZones(), 'theme' => Select2::THEME_KRAJEE, 'options' => ['placeholder' => Yii::t('podium/view', 'Select your time zone for proper dates display...')], 'pluginOptions' => ['allowClear' => true]])->label(Yii::t('podium/view', 'Time Zone'));
?>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<?php
echo $form->field($model, 'anonymous')->checkbox(['uncheck' => 0])->label(Yii::t('podium/view', 'Hide username while forum viewing'));
?>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<button class="btn btn-success" id="show-email"><span class="glyphicon glyphicon-envelope"></span> <?php
echo Yii::t('podium/view', 'Click here to change your e-mail address');
?>
示例13:
<?php
/* $form->field($model, 'username')->textInput(['maxlength' => true]) */
?>
<?php
// $form->field($model, 'datetime')->textInput()
?>
<?php
// $form->field($model, 'ipaddress')->textInput()
?>
<?php
echo $form->field($model, 'degreeid')->widget(Select2::classname(), ['name' => 'state_2', 'value' => '', 'data' => ArrayHelper::map(Acddegree::find()->joinWith(['acdevaluations.group'])->where(['acdgroup.groupid' => $model->groupid])->orderBy('description')->asArray()->all(), 'degreeid', 'description'), 'id' => 'combo', 'pluginOptions' => ['allowClear' => true], 'options' => ['placeholder' => 'Selecione o Grau acadêmico', 'format' => 'raw']]);
?>
<?php
echo $form->field($model, 'description')->textInput();
?>
<?php
// $form->field($model, 'dateforecast')->textInput()
?>
<?php
echo $form->field($model, 'dateforecast')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATE, 'ajaxConversion' => false, 'options' => ['pluginOptions' => ['autoclose' => true]]]);
?>
<?php
//$form->field($model, 'weight')->textInput()
示例14:
foreach ($rces as $i => $rce) {
$ids[$i] = $rce->reserva_id;
}
$data = ArrayHelper::map(Reserva::find()->where(['not in', 'id', $ids])->all(), 'id', 'ReservaSelect');
?>
<?php
echo $form->field($model, "reserva_id")->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Seleccionar Reserva...', 'id' => 'reservaId'], 'pluginOptions' => ['width' => '300px', 'disabled' => !$model->isNewRecord]]);
?>
<?php
$data = ArrayHelper::map(Profesional::find()->all(), 'id', 'Nombres');
?>
<?php
echo $form->field($model, "persona_id_realiza_examen")->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Seleccionar Profesional que realiza el Examen...'], 'pluginOptions' => ['width' => '300px', 'disabled' => !$model->isNewRecord]]);
?>
<?php
foreach ($modelsExamenes as $i => $modelExamen) {
$script = <<<JS
// here you right all your javascript stuff
\$('#reservaId').change(function(){
var reservaId = \$(this).val();
\$.get('index.php?r=examen/get-datos-examen',{ reservaId : reservaId },function(data){
var data = \$.parseJSON(data);
\$('#rceexamenexamen-{$i}-monto_a_pagar').attr('value',data[{$i}].monto);
\$('#rceexamenexamen-{$i}-descripcion').attr('value',data[{$i}].descripcion);
\$('#rceexamenexamen-{$i}-observaciones').attr('value',data[{$i}].observaciones);
});
示例15:
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
use common\models\Scholar;
/* @var $this yii\web\View */
/* @var $model common\models\Tuition */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="tuition-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'scholar_scholar_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Scholar::find()->all(), 'scholar_id', 'scholar_last_name', 'scholar_id'), 'language' => 'en', 'options' => ['placeholder' => 'Select Scholar ID'], 'pluginOptions' => ['allowClear' => true]]);
?>
<?php
echo $form->field($model, 'tuition_term')->textInput();
?>
<?php
echo $form->field($model, 'tuition_school_year_start')->textInput();
?>
<?php
echo $form->field($model, 'tuition_school_year_end')->textInput();
?>
<?php