mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
git-subtree-dir: community_server git-subtree-mainline: ff11f6efe35bba180260fe84077bcd94298895c1 git-subtree-split: b6544b9e69fb85d4da100934675323c3e8c8ef67
79 lines
2.3 KiB
PHP
79 lines
2.3 KiB
PHP
<?php
|
|
namespace App\Controller;
|
|
|
|
use App\Controller\AppController;
|
|
//use Cake\Routing\Router;
|
|
use Cake\ORM\TableRegistry;
|
|
|
|
use Model\Navigation\NaviHierarchy;
|
|
use Model\Navigation\NaviHierarchyEntry;
|
|
|
|
/**
|
|
* StateUsers Controller
|
|
*
|
|
* @property \App\Model\Table\StateUsersTable $StateUsers
|
|
*
|
|
* @method \App\Model\Entity\StateUser[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
|
*/
|
|
class DashboardController extends AppController
|
|
{
|
|
|
|
public function initialize()
|
|
{
|
|
parent::initialize();
|
|
//$this->Auth->allow(['add', 'edit']);
|
|
$this->Auth->allow(['index', 'errorHttpRequest']);
|
|
$this->set(
|
|
'naviHierarchy',
|
|
(new NaviHierarchy())->
|
|
add(new NaviHierarchyEntry(__('Startseite'), 'Dashboard', 'index', true))
|
|
);
|
|
}
|
|
/**
|
|
* Index method
|
|
*
|
|
* @return \Cake\Http\Response|null
|
|
*/
|
|
public function index()
|
|
{
|
|
$startTime = microtime(true);
|
|
$this->viewBuilder()->setLayout('frontend');
|
|
$session = $this->getRequest()->getSession();
|
|
$result = $this->requestLogin();
|
|
if($result !== true) {
|
|
return $result;
|
|
}
|
|
$user = $session->read('StateUser');
|
|
$serverUser = $this->Auth->user('id');
|
|
if($serverUser) {
|
|
$adminErrorsTable = TableRegistry::getTableLocator()->get('AdminErrors');
|
|
$adminErrorCount = $adminErrorsTable->find('all')->count();
|
|
$this->set('adminErrorCount', $adminErrorCount);
|
|
}
|
|
|
|
$this->set('user', $user);
|
|
$this->set('serverUser', $serverUser);
|
|
$this->set('timeUsed', microtime(true) - $startTime);
|
|
|
|
}
|
|
|
|
public function serverIndex()
|
|
{
|
|
$startTime = microtime(true);
|
|
$this->viewBuilder()->setLayout('frontend');
|
|
$adminErrorsTable = TableRegistry::getTableLocator()->get('AdminErrors');
|
|
$adminErrorCount = $adminErrorsTable->find('all')->count();
|
|
|
|
$this->set('adminErrorCount', $adminErrorCount);
|
|
$this->set('timeUsed', microtime(true) - $startTime);
|
|
}
|
|
|
|
public function errorHttpRequest()
|
|
{
|
|
$startTime = microtime(true);
|
|
$this->viewBuilder()->setLayout('frontend');
|
|
$this->set('timeUsed', microtime(true) - $startTime);
|
|
}
|
|
|
|
}
|