10 <ul
class=
"nav nav-tabs">
12 <a href=
"#queries" data-toggle=
"tab">
14 <span
class=
"badge badge-info"><?php echo $queriesCount; ?></span>
18 <a href=
"#resume" data-toggle=
"tab">
20 <?php
if ($queriesCount > $resumeCount): ?>
21 <span
class=
"badge badge-warning" title=
"Repeated queries: <?php echo $queriesCount - $resumeCount; ?>">
22 <?php echo $resumeCount; ?>
25 <span
class=
"badge badge-info">
26 <?php echo $resumeCount; ?>
32 <a href=
"#connections" data-toggle=
"tab">
34 <span
class=
"badge badge-info"><?php echo $connectionsCount; ?></span>
38 <div
class=
"tab-content">
39 <div
id=
"queries" class=
"tab-pane active">
40 <table
class=
"table table-condensed table-bordered table-filtered" style=
"table-layout:fixed">
43 <th style=
"width:100px">Time</th>
44 <th style=
"width:80px">Duration</th>
49 <?php
foreach ($queries as $num => $query): ?>
51 <td style=
"width:100px"><?php echo $query[
'time']; ?></td>
52 <td style=
"width:80px"><?php echo $query[
'duration']; ?></td>
54 <?php echo $this->highlightCode ? $this->highlightSql($query[
'procedure']) : CHtml::encode($query[
'procedure']); ?>
55 <?php
if ($this->canExplain && count($explainConnections = $this->getExplainConnections($query[
'procedure'])) > 0): ?>
56 <div
class=
"pull-right">
57 <?php
if (count($explainConnections) > 1): ?>
58 <div
class=
"btn-group">
59 <button
class=
"btn btn-link btn-small" data-toggle=
"dropdown">
60 Explain <span
class=
"caret"></span>
62 <ul
class=
"dropdown-menu pull-right">
63 <?php
foreach ($explainConnections as $name => $info): ?>
65 <?php echo CHtml::link(
"$name - $info[driver]", array(
69 'connection' => $name,
70 ), array(
'class' =>
'explain')); ?>
76 <?php
foreach ($explainConnections as $name => $info): ?>
77 <?php echo CHtml::link(
'Explain', array(
81 'connection' => $name,
82 ), array(
'class' =>
'explain btn btn-link btn-small')); ?>
92 </div><!-- queries -->
93 <div
id=
"resume" class=
"tab-pane">
94 <table
class=
"table table-condensed table-bordered table-striped table-hover table-filtered" style=
"table-layout:fixed">
97 <th style=
"width:30px;">#</th>
99 <th style=
"width:50px;">Count</th>
100 <th style=
"width:70px;">Total</th>
101 <th style=
"width:70px;">Avg</th>
102 <th style=
"width:70px;">Min</th>
103 <th style=
"width:70px;">Max</th>
107 <?php
foreach ($resume as $num => $query): ?>
109 <td style=
"width:30px;"><?php echo $num + 1; ?></td>
111 <?php echo $this->highlightCode ? $this->highlightSql($query[
'procedure']) : CHtml::encode($query[
'procedure']); ?>
113 <td style=
"width:50px;"><?php echo $query[
'count']; ?></td>
114 <td style=
"width:70px;"><?php echo $query[
'total']; ?></td>
115 <td style=
"width:70px;"><?php echo $query[
'avg']; ?></td>
116 <td style=
"width:70px;"><?php echo $query[
'min']; ?></td>
117 <td style=
"width:70px;"><?php echo $query[
'max']; ?></td>
122 </div><!-- resume -->
123 <div
id=
"connections" class=
"tab-pane">
125 foreach ($connections as $id => $info) {
126 $caption =
'Component: ';
127 if ($this->owner->showConfig) {
128 $caption .= CHtml::link($id, array(
'config',
'#' =>
'components-' . $id));
132 $caption .=
' (' . $info[
'class'] .
')';
133 unset($info[
'class']);
134 echo $this->render(dirname(__FILE__) .
'/_detail.php', array(
135 'caption' => $caption,
140 </div><!-- connections -->
143 Yii::app()->getClientScript()->registerScript(__CLASS__ .
'#explain', <<<JS
144 $(
'a.explain').click(
function(e){
145 if (e.altKey || e.ctrlKey || e.shiftKey)
return;
147 var block = $(
this).data(
'explain-block');
149 block = $(
'<tr>').insertAfter($(
this).parents(
'tr').get(0));
150 var div = $(
'<div class="explain">').appendTo($(
'<td colspan="3">').appendTo(block));
151 div.text(
'Loading...');
152 div.load($(
this).attr(
'href'),
function(response, status, xhr){
153 if (status ==
"error") {
154 div.text(xhr.status +
': ' + xhr.statusText);
155 block.addClass(
'error');
158 $(
this).data(
'explain-block', block);