toolbar.php 1.51 KB
Newer Older
Qiang Xue committed
1 2
<?php
/**
Alexander Makarov committed
3
 * @var \yii\web\View $this
Qiang Xue committed
4
 * @var \yii\debug\Panel[] $panels
Qiang Xue committed
5
 * @var string $tag
6
 * @var string $position
Qiang Xue committed
7
 */
8

9
use yii\helpers\Url;
10 11 12 13 14

$minJs = <<<EOD
document.getElementById('yii-debug-toolbar').style.display = 'none';
document.getElementById('yii-debug-toolbar-min').style.display = 'block';
if (window.localStorage) {
15
    localStorage.setItem('yii-debug-toolbar', 'minimized');
16 17 18 19 20 21 22
}
EOD;

$maxJs = <<<EOD
document.getElementById('yii-debug-toolbar-min').style.display = 'none';
document.getElementById('yii-debug-toolbar').style.display = 'block';
if (window.localStorage) {
23
    localStorage.setItem('yii-debug-toolbar', 'maximized');
24 25 26
}
EOD;

27 28
$firstPanel = reset($panels);
$url = $firstPanel->getUrl();
Qiang Xue committed
29
?>
30
<div id="yii-debug-toolbar" class="yii-debug-toolbar-<?= $position ?> hidden-print">
31
    <div class="yii-debug-toolbar-block title">
32
        <a href="<?= Url::to(['index']) ?>">
33 34 35 36 37
            <img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
            Yii Debugger
        </a>
    </div>

38 39 40 41
    <?php foreach ($panels as $panel): ?>
        <?= $panel->getSummary() ?>
    <?php endforeach; ?>
    <span class="yii-debug-toolbar-toggler" onclick="<?= $minJs ?>"></span>
42
</div>
43
<div id="yii-debug-toolbar-min" class="hidden-print">
44 45 46 47
    <a href="<?= $url ?>" title="Open Yii Debugger" id="yii-debug-toolbar-logo">
        <img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
    </a>
    <span class="yii-debug-toolbar-toggler" onclick="<?= $maxJs ?>"></span>
Qiang Xue committed
48
</div>