1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91:
<?php
namespace MvcCore\Ext\Debug\Tracy;
class AuthPanel implements \Tracy\IBarPanel {
const VERSION = '4.2.0';
public static $Id = 'auth-panel';
protected static $viewData = NULL;
public function getId() {
return self::$Id;
}
public function getTab() {
$view = self::setUpViewData();
return '<span title="' . ($view->authorized ? 'Authorized' : 'Not authorized') . '">'
.'<svg viewBox="0 -50 2048 2048">'
.'<path fill="' . ($view->authorized ? '#61A519' : '#ababab') . '" '
.'d="m1615 1803.5c-122 17-246 7-369 8-255 1-510 3-765-1-136-2-266-111-273-250-11-192 11-290.5 '
.'115-457.5 62-100 192-191 303-147 110 44 201 130 321 149 160 25 317-39 446-130 82-58 200-9 '
.'268 51 157 173 186.8 275.49 184 484.49-1.9692 147.11-108.91 271.41-230 293zm-144-1226.5c0 '
.'239-208 447-447 447s-447-208-447-447 208-447 447-447c240 1 446 207 447 447z" />'
.'</svg>'
.'</span>';
}
public function getPanel() {
$view = self::setUpViewData();
return '<h1>' . ($view->authorized ? 'Authorized' : 'Not authorized') . '</h1>'
. ($view->authorized ? \Tracy\Dumper::toHtml($view->user, array(
\Tracy\Dumper::LIVE => TRUE,
)) : '<p>no identity</p>');
}
public static function setUpViewData () {
if (static::$viewData) return static::$viewData;
$user = \MvcCore\Ext\Auth::GetInstance()->GetUser();
$authorized = $user instanceof \MvcCore\Ext\Auth\User;
static::$viewData = (object) array(
'user' => $user,
'authorized'=> $authorized,
);
return static::$viewData;
}
}