index.php 1.8 KB
Newer Older
Qiang Xue committed
1 2 3
<?php

use yii\helpers\Html;
4 5
use yii\grid\GridView;
use yii\data\ArrayDataProvider;
Qiang Xue committed
6 7

/**
Alexander Makarov committed
8
 * @var \yii\web\View $this
Qiang Xue committed
9
 * @var array $manifest
Qiang Xue committed
10 11
 * @var \yii\debug\models\search\Debug $searchModel
 * @var ArrayDataProvider $dataProvider
Qiang Xue committed
12
 */
Qiang Xue committed
13

Qiang Xue committed
14
$this->title = 'Yii Debugger';
Qiang Xue committed
15
?>
Qiang Xue committed
16
<div class="default-index">
17 18 19
	<div id="yii-debug-toolbar">
		<div class="yii-debug-toolbar-block title">
			Yii Debugger
Qiang Xue committed
20 21
		</div>
	</div>
Qiang Xue committed
22

23 24
	<div class="container">
		<div class="row">
Qiang Xue committed
25
			<h1>Available Debug Data</h1>
26 27 28 29 30 31 32 33

<?php

$timeFormatter = extension_loaded('intl') ? Yii::createObject(['class' => 'yii\i18n\Formatter']) : Yii::$app->formatter;

echo GridView::widget([
	'dataProvider' => $dataProvider,
	'filterModel' => $searchModel,
Qiang Xue committed
34 35
	'rowOptions' => function ($model, $key, $index, $grid) use ($searchModel) {
		if ($searchModel->isCodeCritical($model['statusCode'])) {
36
			return ['class'=>'danger'];
Qiang Xue committed
37 38 39
		} else {
			return [];
		}
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
	},
	'columns' => [
		['class' => 'yii\grid\SerialColumn'],
		[
			'attribute' => 'tag',
			'value' => function ($data)
			{
				return Html::a($data['tag'], ['view', 'tag' => $data['tag']]);
			},
			'format' => 'html',
		],
		[
			'attribute' => 'time',
			'value' => function ($data) use ($timeFormatter)
			{
				return $timeFormatter->asDateTime($data['time'], 'long');
			},
		],
		'ip',
		[
			'attribute' => 'sqlCount',
			'label' => 'Total queries count'
		],
		[
			'attribute' => 'method',
			'filter' => ['get' => 'GET', 'post' => 'POST', 'delete' => 'DELETE', 'put' => 'PUT', 'head' => 'HEAD']
		],
		[
			'attribute'=>'ajax',
			'value' => function ($data)
			{
				return $data['ajax'] ? 'Yes' : 'No';
			},
			'filter' => ['No', 'Yes'],
		],
		'url',
		[
			'attribute' => 'statusCode',
Qiang Xue committed
78
			'filter' => [200 => 200, 404 => 404, 403 => 403, 500 => 500],
79 80 81 82
			'label' => 'Status code'
		],
	],
]); ?>
Qiang Xue committed
83 84
		</div>
	</div>
Qiang Xue committed
85
</div>