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