51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
<?php
|
|
|
|
namespace Trinity\Bundle\DashBoardBundle\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
|
use Trinity\Bundle\DashBoardBundle\DashBoard\ConfigurationTransformer;
|
|
use Trinity\Bundle\UserBundle\Model\UserPeer;
|
|
|
|
/**
|
|
* @Route("/admin")
|
|
*/
|
|
class DefaultController extends Controller
|
|
{
|
|
protected $router;
|
|
protected $rac;
|
|
protected $config;
|
|
|
|
protected function init()
|
|
{
|
|
$this->rac = $this->get('trinity.security.route_access_control');
|
|
$this->router = $this->container->get('router');
|
|
$this->config = $this->container->getParameter('trinity_dash_board.dash');
|
|
}
|
|
|
|
/**
|
|
* @Route("/", name="TrinityDashBoardBundle_index")
|
|
* @Template()
|
|
*/
|
|
public function indexAction()
|
|
{
|
|
$this->init();
|
|
|
|
return $this->render(
|
|
$this->config['template'],
|
|
array(
|
|
'dashboard' => $this->getDashboard(),
|
|
'connections' => UserPeer::getLastConnections(),
|
|
)
|
|
);
|
|
}
|
|
|
|
public function getDashboard()
|
|
{
|
|
$transformer = new ConfigurationTransformer($this->rac, $this->router, $this->config);
|
|
|
|
return $transformer->getDash();
|
|
}
|
|
}
|