2020-04-24 18:08:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Engelsystem\Controllers;
|
|
|
|
|
2021-04-10 17:02:34 +02:00
|
|
|
use Engelsystem\Config\Config;
|
2022-06-07 22:59:49 +02:00
|
|
|
use Engelsystem\Helpers\BarChart;
|
2020-04-24 18:08:09 +02:00
|
|
|
use Engelsystem\Http\Response;
|
2022-06-06 13:00:37 +02:00
|
|
|
use Engelsystem\Models\User\PersonalData;
|
2020-04-24 18:08:09 +02:00
|
|
|
use Engelsystem\Models\User\State;
|
|
|
|
use Engelsystem\Models\User\User;
|
|
|
|
|
|
|
|
class DesignController extends BaseController
|
|
|
|
{
|
|
|
|
/** @var Response */
|
|
|
|
protected $response;
|
|
|
|
|
2021-04-10 17:02:34 +02:00
|
|
|
/** @var Config */
|
|
|
|
protected $config;
|
|
|
|
|
|
|
|
public function __construct(Response $response, Config $config)
|
2020-04-24 18:08:09 +02:00
|
|
|
{
|
2021-04-10 17:02:34 +02:00
|
|
|
$this->config = $config;
|
2020-04-24 18:08:09 +02:00
|
|
|
$this->response = $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the design overview page
|
|
|
|
*
|
|
|
|
* @return Response
|
|
|
|
*/
|
2021-07-24 12:35:29 +02:00
|
|
|
public function index()
|
2020-04-24 18:08:09 +02:00
|
|
|
{
|
|
|
|
$demoUser = (new User())->forceFill([
|
2021-04-10 17:02:34 +02:00
|
|
|
'id' => 42,
|
2020-04-24 18:08:09 +02:00
|
|
|
'name' => 'test',
|
|
|
|
]);
|
|
|
|
$demoUser->__set('state', (new State())->forceFill([
|
|
|
|
'user_id' => 42,
|
|
|
|
'arrived' => true,
|
|
|
|
]));
|
|
|
|
$demoUser2 = (new User())->forceFill([
|
2021-04-10 17:02:34 +02:00
|
|
|
'id' => 1337,
|
2020-04-24 18:08:09 +02:00
|
|
|
'name' => 'test2',
|
|
|
|
]);
|
|
|
|
$demoUser2->__set('state', (new State())->forceFill([
|
|
|
|
'user_id' => 1337,
|
|
|
|
'arrived' => false,
|
|
|
|
]));
|
2022-06-06 13:00:37 +02:00
|
|
|
$demoUser2->__set('personalData', (new PersonalData())->forceFill([
|
|
|
|
'pronoun' => 'it/its',
|
|
|
|
]));
|
2020-04-24 18:08:09 +02:00
|
|
|
|
2021-04-29 21:58:20 +02:00
|
|
|
$themes = $this->config->get('themes');
|
2021-04-10 17:02:34 +02:00
|
|
|
$data = [
|
2022-10-18 21:16:05 +02:00
|
|
|
'demo_user' => $demoUser,
|
|
|
|
'demo_user_2' => $demoUser2,
|
|
|
|
'themes' => $themes,
|
|
|
|
'bar_chart' => BarChart::render(...BarChart::generateChartDemoData(23)),
|
|
|
|
'timestamp30m' => time() + 30 * 60,
|
|
|
|
'timestamp59m' => time() + 59 * 60,
|
|
|
|
'timestamp1h' => time() + 1 * 60 * 60,
|
|
|
|
'timestamp1h30m' => time() + 90 * 60,
|
|
|
|
'timestamp1h31m' => time() + 91 * 60,
|
|
|
|
'timestamp2h' => time() + 2 * 60 * 60,
|
|
|
|
'timestamp2d' => time() + 2 * 24 * 60 * 60,
|
|
|
|
'timestamp3m' => time() + 3 * 30 * 24 * 60 * 60,
|
|
|
|
'timestamp22y' => time() + 22 * 365 * 24 * 60 * 60,
|
|
|
|
'timestamp30s' => time() + 30,
|
|
|
|
|
|
|
|
'timestamp30mago' => time() - 30 * 60,
|
|
|
|
'timestamp45mago' => time() - 45 * 60,
|
2021-04-10 17:02:34 +02:00
|
|
|
];
|
|
|
|
|
2020-04-24 18:08:09 +02:00
|
|
|
return $this->response->withView(
|
|
|
|
'pages/design',
|
2021-04-10 17:02:34 +02:00
|
|
|
$data
|
2020-04-24 18:08:09 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|