1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\Bridges\SecurityTracy;
9:
10: use Nette;
11: use Tracy;
12:
13:
14: /**
15: * User panel for Debugger Bar.
16: */
17: class UserPanel extends Nette\Object implements Tracy\IBarPanel
18: {
19: /** @var Nette\Security\User */
20: private $user;
21:
22:
23: public function __construct(Nette\Security\User $user)
24: {
25: $this->user = $user;
26: }
27:
28:
29: /**
30: * Renders tab.
31: * @return string
32: */
33: public function getTab()
34: {
35: if (headers_sent() && !session_id()) {
36: return;
37: }
38:
39: ob_start(function () {});
40: $user = $this->user;
41: require __DIR__ . '/templates/UserPanel.tab.phtml';
42: return ob_get_clean();
43: }
44:
45:
46: /**
47: * Renders panel.
48: * @return string
49: */
50: public function getPanel()
51: {
52: ob_start(function () {});
53: $user = $this->user;
54: require __DIR__ . '/templates/UserPanel.panel.phtml';
55: return ob_get_clean();
56: }
57:
58: }
59: