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\Security\Diagnostics;
9:
10: use Nette;
11:
12:
13: /**
14: * User panel for Debugger Bar.
15: *
16: * @author David Grudl
17: */
18: class UserPanel extends Nette\Object implements Nette\Diagnostics\IBarPanel
19: {
20: /** @var Nette\Security\User */
21: private $user;
22:
23:
24: public function __construct(Nette\Security\User $user)
25: {
26: $this->user = $user;
27: }
28:
29:
30: /**
31: * Renders tab.
32: * @return string
33: */
34: public function getTab()
35: {
36: if (headers_sent() && !session_id()) {
37: return;
38: }
39:
40: ob_start();
41: $user = $this->user;
42: require __DIR__ . '/templates/UserPanel.tab.phtml';
43: return ob_get_clean();
44: }
45:
46:
47: /**
48: * Renders panel.
49: * @return string
50: */
51: public function getPanel()
52: {
53: ob_start();
54: $user = $this->user;
55: require __DIR__ . '/templates/UserPanel.panel.phtml';
56: return ob_get_clean();
57: }
58:
59: }
60: