forked from php-censor/php-censor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomeController.php
More file actions
51 lines (42 loc) · 1.07 KB
/
Copy pathHomeController.php
File metadata and controls
51 lines (42 loc) · 1.07 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
<?php
namespace PHPCensor\Controller;
use PHPCensor\Config;
use PHPCensor\Helper\Lang;
use PHPCensor\WebController;
/**
* Home Controller - Displays the Dashboard.
*/
class HomeController extends WebController
{
/**
* @var string
*/
public $layoutName = 'layout';
/**
* Display dashboard:
*/
public function index()
{
$this->layout->title = Lang::get('dashboard');
$widgets = [
'left' => [],
'right' => [],
];
$widgetsConfig = Config::getInstance()->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();
}
}