_search.php 1.19 KB
Newer Older
Qiang Xue committed
1
<?php
Qiang Xue committed
2 3 4 5

use yii\helpers\Inflector;
use yii\helpers\StringHelper;

6 7
/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\crud\Generator */
Qiang Xue committed
8 9

echo "<?php\n";
Qiang Xue committed
10
?>
Qiang Xue committed
11 12 13 14

use yii\helpers\Html;
use yii\widgets\ActiveForm;

15 16 17
/* @var $this yii\web\View */
/* @var $model <?= ltrim($generator->searchModelClass, '\\') ?> */
/* @var $form yii\widgets\ActiveForm */
Qiang Xue committed
18 19
?>

Alexander Makarov committed
20
<div class="<?= Inflector::camel2id(StringHelper::basename($generator->modelClass)) ?>-search">
Qiang Xue committed
21

22 23 24 25
    <?= "<?php " ?>$form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>
Qiang Xue committed
26 27

<?php
Qiang Xue committed
28
$count = 0;
29
foreach ($generator->getColumnNames() as $attribute) {
30
    if (++$count < 6) {
31
        echo "    <?= " . $generator->generateActiveSearchField($attribute) . " ?>\n\n";
32
    } else {
33
        echo "    <?php // echo " . $generator->generateActiveSearchField($attribute) . " ?>\n\n";
34
    }
Qiang Xue committed
35
}
Qiang Xue committed
36
?>
37
    <div class="form-group">
38 39
        <?= "<?= " ?>Html::submitButton(<?= $generator->generateString('Search') ?>, ['class' => 'btn btn-primary']) ?>
        <?= "<?= " ?>Html::resetButton(<?= $generator->generateString('Reset') ?>, ['class' => 'btn btn-default']) ?>
40
    </div>
Qiang Xue committed
41

42
    <?= "<?php " ?>ActiveForm::end(); ?>
Qiang Xue committed
43

Qiang Xue committed
44
</div>