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

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

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

echo "<?php\n";
Qiang Xue committed
12
?>
Qiang Xue committed
13 14 15 16 17

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

/**
Alexander Makarov committed
18
 * @var yii\web\View $this
Alexander Makarov committed
19
 * @var <?= ltrim($generator->searchModelClass, '\\') ?> $model
Qiang Xue committed
20 21
 * @var yii\widgets\ActiveForm $form
 */
Qiang Xue committed
22 23
?>

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

26
	<?= "<?php " ?>$form = ActiveForm::begin([
Alexander Makarov committed
27
		'action' => ['index'],
Qiang Xue committed
28
		'method' => 'get',
Alexander Makarov committed
29
	]); ?>
Qiang Xue committed
30 31

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

46
	<?= "<?php " ?>ActiveForm::end(); ?>
Qiang Xue committed
47

Qiang Xue committed
48
</div>