示例#1
0
</h1>

<p><?php 
echo Module::t("You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.");
?>
</p>

<?php 
echo Html::a(Module::t('Advanced Search'), '#', ['class' => 'search-button']);
?>
<div class="search-form" style="display:none">
    <?php 
echo $this->render('_search', ['model' => $searchModel]);
?>
</div><!-- search-form -->

<?php 
\yii\widgets\Pjax::begin();
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['attribute' => 'varname', 'format' => 'raw', 'value' => function ($data) {
    return UHtml::markSearch($data, "varname");
}], ['attribute' => 'title', 'value' => function ($data) {
    return Module::t($data->title);
}], ['attribute' => 'field_type', 'filter' => ProfileField::itemAlias("field_type")], 'field_size', ['attribute' => 'required', 'value' => function ($data) {
    return ProfileField::itemAlias("required", $data->required);
}, 'filter' => ProfileField::itemAlias("required")], 'position', ['attribute' => 'visible', 'value' => function ($data) {
    return ProfileField::itemAlias("visible", $data->visible);
}, 'filter' => ProfileField::itemAlias("visible")], ['class' => 'yii\\grid\\ActionColumn']]]);
\yii\widgets\Pjax::end();
示例#2
0
    <?php 
echo $this->render('_search', ['model' => $searchModel]);
?>
</div><!-- search-form -->

<?php 
\yii\widgets\Pjax::begin();
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'format' => 'raw', 'value' => function ($data) {
    return Html::a(Html::encode($data->id), ["admin/update", "id" => $data->id]);
}], ['attribute' => 'username', 'format' => 'raw', 'value' => function ($data) {
    return Html::a(UHtml::markSearch($data, "username"), ["admin/view", "id" => $data->id]);
}], ['attribute' => 'email', 'format' => 'raw', 'value' => function ($data) {
    return Html::a(UHtml::markSearch($data, "email"), "mailto:" . $data->email);
}], 'create_at', 'lastvisit_at', ['attribute' => 'superuser', 'value' => function ($data) {
    return User::itemAlias("AdminStatus", $data->superuser);
}, 'filter' => User::itemAlias("AdminStatus")], ['attribute' => 'status', 'value' => function ($data) {
    return User::itemAlias("UserStatus", $data->status);
}, 'filter' => User::itemAlias("UserStatus")], ['class' => 'yii\\grid\\ActionColumn', 'header' => Module::t('Actions')]]]);
?>

<?php 
\yii\widgets\Pjax::end();
?>

<?php 
//$this->widget('zii.widgets.grid.CGridView', array(
//    'id'=>'user-grid',
//    'dataProvider'=>$model->search(),