-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathHomeController.php
More file actions
52 lines (42 loc) · 1.11 KB
/
HomeController.php
File metadata and controls
52 lines (42 loc) · 1.11 KB
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
<?php
declare(strict_types=1);
namespace PHPCensor\Controller;
use PHPCensor\Helper\Lang;
use PHPCensor\WebController;
/**
* @package PHP Censor
* @subpackage Application
*
* @author Dmitry Khomutov <[email protected]>
*/
class HomeController extends WebController
{
public string $layoutName = 'layout';
/**
* Display dashboard:
*/
public function index(): string
{
$this->layout->title = Lang::get('dashboard');
$widgets = [
'left' => [],
'right' => [],
];
$widgetsConfig = $this->configuration->get('php-censor.dashboard_widgets', [
'all_projects' => [
'side' => 'left',
],
'last_builds' => [
'side' => 'right',
],
]);
foreach ($widgetsConfig as $name => $params) {
$side = (isset($params['side']) && 'right' === $params['side'])
? 'right'
: 'left';
$widgets[$side][$name] = $params;
}
$this->view->widgets = $widgets;
return $this->view->render();
}
}