Browse Source

CS fixes.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
dafd360152
  1. 9
      extensions/yii/debug/components/search/Filter.php
  2. 12
      extensions/yii/debug/models/search/Debug.php
  3. 11
      extensions/yii/debug/views/default/index.php

9
extensions/yii/debug/components/search/Filter.php

@ -35,8 +35,7 @@ class Filter extends Component
{
$filtered = [];
foreach($data as $row)
{
foreach ($data as $row) {
if ($this->checkFilter($row)) {
$filtered[] = $row;
}
@ -53,14 +52,12 @@ class Filter extends Component
{
$matched = true;
foreach ($row as $name=>$value)
{
foreach ($row as $name => $value) {
if (isset($this->rules[$name])) {
#check all rules for given attribute
foreach($this->rules[$name] as $rule)
{
foreach ($this->rules[$name] as $rule) {
if (!$rule->check($value)) {
$matched = false;
}

12
extensions/yii/debug/models/search/Debug.php

@ -78,8 +78,8 @@ class Debug extends Model
/**
* Returns data provider with filled models. Filter applied if needed.
* @param type $params
* @param type $models
* @param array $params
* @param array $models
* @return \yii\data\ArrayDataProvider
*/
public function search($params, $models)
@ -121,12 +121,16 @@ class Debug extends Model
return in_array($code, $this->criticalCodes);
}
/**
* @param Filter $filter
* @param string $attribute
* @param boolean $partial
*/
public function addCondition($filter, $attribute, $partial = false)
{
$value = $this->$attribute;
if (mb_strpos($value, '>') !== false)
{
if (mb_strpos($value, '>') !== false) {
$value = intval(str_replace('>', '', $value));
$filter->addMatch($attribute, new matches\Greater(['value' => $value]));

11
extensions/yii/debug/views/default/index.php

@ -1,6 +1,5 @@
<?php
use Yii;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\data\ArrayDataProvider;
@ -8,6 +7,8 @@ use yii\data\ArrayDataProvider;
/**
* @var \yii\web\View $this
* @var array $manifest
* @var \yii\debug\models\search\Debug $searchModel
* @var ArrayDataProvider $dataProvider
*/
$this->title = 'Yii Debugger';
@ -30,10 +31,12 @@ $timeFormatter = extension_loaded('intl') ? Yii::createObject(['class' => 'yii\i
echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'rowOptions' => function ($model, $key, $index, $grid) use ($searchModel)
{
if ($searchModel->isCodeCritical($model['statusCode']))
'rowOptions' => function ($model, $key, $index, $grid) use ($searchModel) {
if ($searchModel->isCodeCritical($model['statusCode'])) {
return ['class'=>'danger'];
} else {
return [];
}
},
'columns' => [
['class' => 'yii\grid\SerialColumn'],

Loading…
Cancel
Save