|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
-
-
- namespace yii\debug\models\search;
-
- use yii\data\ArrayDataProvider;
- use yii\debug\components\search\Filter;
-
-
- class Profile extends Base
- {
-
-
- public $category;
-
-
- public $info;
-
-
-
-
- public function rules()
- {
- return [
- [['category', 'info'], 'safe'],
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'category' => 'Category',
- 'info' => 'Info',
- ];
- }
-
-
-
- public function search($params, $models)
- {
- $dataProvider = new ArrayDataProvider([
- 'allModels' => $models,
- 'pagination' => false,
- 'sort' => [
- 'attributes' => ['category', 'seq', 'duration', 'info'],
- 'defaultOrder' => [
- 'seq' => SORT_ASC,
- ],
- ],
- ]);
-
- if (!($this->load($params) && $this->validate())) {
- return $dataProvider;
- }
-
- $filter = new Filter();
- $this->addCondition($filter, 'category', true);
- $this->addCondition($filter, 'info', true);
- $dataProvider->allModels = $filter->filter($models);
-
- return $dataProvider;
- }
- }
|