You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

view.php 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /* @var $this \yii\web\View */
  3. /* @var $summary array */
  4. /* @var $tag string */
  5. /* @var $manifest array */
  6. /* @var $panels \yii\debug\Panel[] */
  7. /* @var $activePanel \yii\debug\Panel */
  8. use yii\bootstrap\ButtonDropdown;
  9. use yii\bootstrap\ButtonGroup;
  10. use yii\helpers\Html;
  11. use yii\helpers\Url;
  12. $this->title = 'Yii Debugger';
  13. ?>
  14. <div class="default-view">
  15. <div id="yii-debug-toolbar" class="yii-debug-toolbar yii-debug-toolbar_position_top" style="display: none;">
  16. <div class="yii-debug-toolbar__bar">
  17. <div class="yii-debug-toolbar__block yii-debug-toolbar__title">
  18. <a href="<?= Url::to(['index']) ?>">
  19. <img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
  20. </a>
  21. </div>
  22. <?php foreach ($panels as $panel): ?>
  23. <?= $panel->getSummary() ?>
  24. <?php endforeach; ?>
  25. </div>
  26. </div>
  27. <div class="container main-container">
  28. <div class="row">
  29. <div class="col-lg-2 col-md-2">
  30. <div class="list-group">
  31. <?php
  32. foreach ($panels as $id => $panel) {
  33. $label = '<i class="glyphicon glyphicon-chevron-right"></i>' . Html::encode($panel->getName());
  34. echo Html::a($label, ['view', 'tag' => $tag, 'panel' => $id], [
  35. 'class' => $panel === $activePanel ? 'list-group-item active' : 'list-group-item',
  36. ]);
  37. }
  38. ?>
  39. </div>
  40. </div>
  41. <div class="col-lg-10 col-md-10">
  42. <?php
  43. $statusCode = $summary['statusCode'];
  44. if ($statusCode === null) {
  45. $statusCode = 200;
  46. }
  47. if ($statusCode >= 200 && $statusCode < 300) {
  48. $calloutClass = 'callout-success';
  49. } elseif ($statusCode >= 300 && $statusCode < 400) {
  50. $calloutClass = 'callout-info';
  51. } else {
  52. $calloutClass = 'callout-important';
  53. }
  54. ?>
  55. <div class="callout <?= $calloutClass ?>">
  56. <?php
  57. $count = 0;
  58. $items = [];
  59. foreach ($manifest as $meta) {
  60. $label = ($meta['tag'] == $tag ? Html::tag('strong', '&#9654;&nbsp;'.$meta['tag']) : $meta['tag'])
  61. . ': ' . $meta['method'] . ' ' . $meta['url'] . ($meta['ajax'] ? ' (AJAX)' : '')
  62. . ', ' . date('Y-m-d h:i:s a', $meta['time'])
  63. . ', ' . $meta['ip'];
  64. $url = ['view', 'tag' => $meta['tag'], 'panel' => $activePanel->id];
  65. $items[] = [
  66. 'label' => $label,
  67. 'url' => $url,
  68. ];
  69. if (++$count >= 10) {
  70. break;
  71. }
  72. }
  73. echo ButtonGroup::widget([
  74. 'options'=>['class'=>'btn-group-sm'],
  75. 'buttons' => [
  76. Html::a('All', ['index'], ['class' => 'btn btn-default']),
  77. Html::a('Latest', ['view', 'panel' => $activePanel->id], ['class' => 'btn btn-default']),
  78. ButtonDropdown::widget([
  79. 'label' => 'Last 10',
  80. 'options' => ['class' => 'btn-default btn-sm'],
  81. 'dropdown' => ['items' => $items, 'encodeLabels' => false],
  82. ]),
  83. ],
  84. ]);
  85. echo "\n" . $summary['tag'] . ': ' . $summary['method'] . ' ' . Html::a(Html::encode($summary['url']), $summary['url']);
  86. echo ' at ' . date('Y-m-d h:i:s a', $summary['time']) . ' by ' . $summary['ip'];
  87. ?>
  88. </div>
  89. <?= $activePanel->getDetail() ?>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <script type="text/javascript">
  95. if (!window.frameElement) {
  96. document.querySelector('#yii-debug-toolbar').style.display = 'block';
  97. }
  98. </script>