Browse Source

finished debugger.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
c0c975075a
  1. 1
      framework/yii/debug/controllers/DefaultController.php
  2. 32
      framework/yii/debug/views/default/index.php
  3. 17
      framework/yii/debug/views/default/view.php

1
framework/yii/debug/controllers/DefaultController.php

@ -24,6 +24,7 @@ class DefaultController extends Controller
public function actionIndex() public function actionIndex()
{ {
return $this->render('index', array( return $this->render('index', array(
'manifest' => $this->getManifest(),
)); ));
} }

32
framework/yii/debug/views/default/index.php

@ -4,11 +4,7 @@ use yii\helpers\Html;
/** /**
* @var \yii\base\View $this * @var \yii\base\View $this
* @var array $meta
* @var string $tag
* @var array $manifest * @var array $manifest
* @var \yii\debug\Panel[] $panels
* @var \yii\debug\Panel $activePanel
*/ */
$this->registerAssetBundle('yii/bootstrap/dropdown'); $this->registerAssetBundle('yii/bootstrap/dropdown');
@ -24,4 +20,32 @@ $this->title = 'Yii Debugger';
</div> </div>
</div> </div>
</div> </div>
<div class="container-fluid">
<div class="row-fluid">
<h1>Available Debug Data</h1>
<table class="table table-condensed table-bordered table-striped table-hover" style="table-layout: fixed;">
<thead>
<tr>
<th style="width: 120px;">Tag</th>
<th style="width: 160px;">Time</th>
<th style="width: 120px;">IP</th>
<th style="width: 60px;">Method</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<?php foreach ($manifest as $tag => $data): ?>
<tr>
<td><?php echo Html::a($tag, array('view', 'tag' => $tag)); ?></td>
<td><?php echo date('Y-m-d h:i:sa', $data['time']); ?></td>
<td><?php echo $data['ip']; ?></td>
<td><?php echo $data['method']; ?></td>
<td><?php echo $data['url']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div> </div>

17
framework/yii/debug/views/default/view.php

@ -43,25 +43,32 @@ $this->title = 'Yii Debugger';
<div class="span10"> <div class="span10">
<div class="meta alert alert-info"> <div class="meta alert alert-info">
<div class="btn-group"> <div class="btn-group">
<?php echo Html::a('All', array('index'), array('class' => 'btn')); ?>
<button class="btn dropdown-toggle" data-toggle="dropdown"> <button class="btn dropdown-toggle" data-toggle="dropdown">
View others Last 10
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<?php foreach ($manifest as $tag2 => $meta2) { <?php
$count = 0;
foreach ($manifest as $tag2 => $meta2) {
$label = $meta2['method'] . ' ' . $meta2['url'] . ($meta2['ajax'] ? ' (AJAX)' : '') $label = $meta2['method'] . ' ' . $meta2['url'] . ($meta2['ajax'] ? ' (AJAX)' : '')
. ', ' . date('Y/m/d h:i:sa', $meta2['time']) . ', ' . date('Y-m-d h:i:sa', $meta2['time'])
. ', ' . $meta2['ip'] . ', ' . $tag2; . ', ' . $meta2['ip'] . ', ' . $tag2;
$url = array('view', 'tag' => $tag2); $url = array('view', 'tag' => $tag2);
echo '<li>' . Html::a(Html::encode($label), $url) . '</li>'; echo '<li>' . Html::a(Html::encode($label), $url) . '</li>';
} ?> if (++$count >= 10) {
break;
}
}
?>
</ul> </ul>
</div> </div>
Debugging: Debugging:
<?php echo $meta['method']; ?> <?php echo $meta['method']; ?>
<?php echo Html::a(Html::encode($meta['url']), $meta['url']); ?> <?php echo Html::a(Html::encode($meta['url']), $meta['url']); ?>
<?php echo $meta['ajax'] ? ' (AJAX)' : ''; ?> <?php echo $meta['ajax'] ? ' (AJAX)' : ''; ?>
at <?php echo date('Y/m/d h:i:sa', $meta['time']); ?> at <?php echo date('Y-m-d h:i:sa', $meta['time']); ?>
by <?php echo $meta['ip']; ?> by <?php echo $meta['ip']; ?>
</div> </div>
<?php echo $activePanel->getDetail(); ?> <?php echo $activePanel->getDetail(); ?>

Loading…
Cancel
Save