Permalink
Browse files

added colors for query time; updated code for psr1/2 compliance; phpd…

…oc updates;
  • Loading branch information...
1 parent 6f4c94b commit 479e7df9a9e07187fbddfe08f79bb4774a2b507d @elvenpath committed May 13, 2014
Showing with 250 additions and 151 deletions.
  1. +215 −124 panels/YiiDebugToolbarPanelSql.php
  2. +35 −27 views/panels/sql/summary.php
Oops, something went wrong.
@@ -1,30 +1,38 @@
-<?php if (!empty($summary)) :?>
-<table data-ydtb-data-table>
- <thead>
+<?php if (!empty($summary)) : ?>
+ <table data-ydtb-data-table>
+ <thead>
<tr>
- <th><?php echo Yii::t('yii-debug-toolbar','Query')?></th>
- <th><?php echo Yii::t('yii-debug-toolbar','Count')?></th>
- <th><?php echo Yii::t('yii-debug-toolbar','Total (s)')?></th>
- <th><?php echo Yii::t('yii-debug-toolbar','Avg. (s)')?></th>
- <th><?php echo Yii::t('yii-debug-toolbar','Min. (s)')?></th>
- <th><?php echo Yii::t('yii-debug-toolbar','Max. (s)')?></th>
+ <th><?php echo Yii::t('yii-debug-toolbar', 'Query') ?></th>
+ <th><?php echo Yii::t('yii-debug-toolbar', 'Count') ?></th>
+ <th><?php echo Yii::t('yii-debug-toolbar', 'Total (s)') ?></th>
+ <th><?php echo Yii::t('yii-debug-toolbar', 'Avg. (s)') ?></th>
+ <th><?php echo Yii::t('yii-debug-toolbar', 'Min. (s)') ?></th>
+ <th><?php echo Yii::t('yii-debug-toolbar', 'Max. (s)') ?></th>
</tr>
- </thead>
- <tbody>
- <?php foreach($summary as $id=>$entry):?>
- <tr class="<?php echo ($entry[1]>$this->countLimit || ($entry[4]/$entry[1] > $this->timeLimit) ?' warning':'') ?>">
- <td data-ydtb-data-type="varchar"><?php echo $entry[0]; ?></td>
- <td data-ydtb-data-type="number"><?php echo number_format($entry[1]); ?></td>
- <td data-ydtb-data-type="number"><?php echo sprintf('%0.6F',$entry[4]); ?></td>
- <td data-ydtb-data-type="number"><?php echo sprintf('%0.6F',$entry[4]/$entry[1]); ?></td>
- <td data-ydtb-data-type="number"><?php echo sprintf('%0.6F',$entry[2]); ?></td>
- <td data-ydtb-data-type="number"><?php echo sprintf('%0.6F',$entry[3]);?></td>
- </tr>
- <?php endforeach; ?>
- </tbody>
-</table>
+ </thead>
+ <tbody>
+ <?php foreach ($summary as $id => $entry): ?>
+ <tr class="<?php echo($entry[1] > $this->countLimit || ($entry[4] / $entry[1] > $this->timeLimit) ? ' warning' : '') ?>">
+ <td data-ydtb-data-type="varchar"><?php echo $entry[0]; ?></td>
+ <td data-ydtb-data-type="number"><?php echo number_format($entry[1]); ?></td>
+ <td data-ydtb-data-type="number"><?php echo sprintf('%0.6F', $entry[4]); ?></td>
+ <td data-ydtb-data-type="number"><?php echo sprintf('%0.6F', $entry[4] / $entry[1]); ?></td>
+ <td data-ydtb-data-type="number"><?php echo sprintf('%0.6F', $entry[2]); ?></td>
+ <?php $queryTimeColors = $this->queryTimeColor($entry[3]) ?>
+ <td data-ydtb-data-type="number"
+ style="color:<?php echo isset($queryTimeColors['textColor']) ? $queryTimeColors['textColor'] : CLogger::LEVEL_ERROR; ?>;
+ background-color:<?php echo isset($queryTimeColors['backgroundColor']) ? $queryTimeColors['backgroundColor'] : CLogger::LEVEL_WARNING; ?>;">
+ <?php echo sprintf('%0.6F', $entry[3]); ?>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
<?php else : ?>
-<p>
- <?php echo Yii::t('yii-debug-toolbar','No SQL queries were recorded during this request or profiling the SQL is DISABLED.')?>
-</p>
-<?php endif; ?>
+ <p>
+ <?php echo Yii::t(
+ 'yii-debug-toolbar',
+ 'No SQL queries were recorded during this request or profiling the SQL is DISABLED.'
+ ) ?>
+ </p>
+<?php endif; ?>

0 comments on commit 479e7df

Please sign in to comment.