Esempio n. 1
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
use kartik\typeahead\TypeaheadBasic;
//$form = ActiveForm::begin(); //Default Active Form begin
$form = ActiveForm::begin(['id' => 'create-location', 'options' => ['class' => 'form', 'enctype' => 'multipart/form-data']]);
/**
 * Select2 for County Selection Dropdown
 */
echo $form->field($model, 'country_id')->widget(Select2::classname(), ['data' => \humanized\location\components\GUIHelper::getCountryList(), 'options' => ['placeholder' => 'Select Country'], 'pluginOptions' => ['allowClear' => true]])->label(false);
/*
 * Dependant City Typeahead
 */
echo $form->field($model, 'label')->widget(TypeaheadBasic::classname(), ['data' => ['' => ''], 'options' => ['placeholder' => 'Enter Location Name'], 'pluginOptions' => ['highlight' => true]])->label(false);
/**
 * Dependant Postcode Typeahead 
 */
echo $form->field($model, 'postcode')->widget(TypeaheadBasic::classname(), ['data' => ['' => ''], 'options' => ['placeholder' => 'Enter Postcode (Optional)'], 'pluginOptions' => ['highlight' => true]])->label(false);
echo Html::submitButton('Submit', ['class' => 'btn btn-primary']);
ActiveForm::end();
Esempio n. 2
0
$form = ActiveForm::begin(['action' => ['log'], 'method' => 'get']);
?>

    <?php 
if (Yii::$app->user->usermode != 'developer') {
    $dataSql = User::findBySql('SELECT DISTINCT username FROM user WHERE usermode !="developer"')->asArray()->all();
} else {
    $dataSql = User::findBySql('SELECT DISTINCT username FROM user')->asArray()->all();
}
foreach ($dataSql as $row) {
    $CT_IDS[] = $row['username'];
}
?>

    <?php 
echo $form->field($model, 'username')->widget(TypeaheadBasic::classname(), ['data' => $CT_IDS, 'pluginOptions' => ['highlight' => true], 'options' => ['placeholder' => 'All']]);
?>
    <?php 
echo $form->field($model, 'start_date', ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-calendar"></i>']], 'options' => ['class' => 'drp-container form-group', 'readonly' => 'readonly']])->widget(DateRangePicker::classname(), ['useWithAddon' => true, 'convertFormat' => true, 'pluginOptions' => ['locale' => ['format' => 'Y-m-d']]]);
?>
    
     
    <div class="form-group">
        <?php 
echo Html::submitButton('Search', ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::resetButton('Reset', ['class' => 'btn btn-default']);
?>
    </div>