-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathadmin_dashboard.php
83 lines (65 loc) · 3.17 KB
/
admin_dashboard.php
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
require('../include/session.inc.php');
/*
This file is part of CoDev-Timetracking.
CoDev-Timetracking is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CoDev-Timetracking is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CoDev-Timetracking. If not, see <http://www.gnu.org/licenses/>.
*/
require('../path.inc.php');
class AdminDashboardController extends Controller {
/**
* @var Logger The logger
*/
private static $logger;
public static function staticInit() {
self::$logger = Logger::getLogger(__CLASS__);
}
protected function display() {
if (Tools::isConnectedUser()) {
$team = TeamCache::getInstance()->getTeam($this->teamid);
$action = filter_input(INPUT_GET, 'action');
// feed the PluginDataProvider
$pluginDataProvider = PluginDataProvider::getInstance();
$pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $this->session_userid);
$pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $this->teamid);
$weekDates = Tools::week_dates(date('W'),date('Y'));
$pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $weekDates[1]);
$pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $weekDates[5]);
$dashboardName = 'Admin'.$this->teamid;
$dashboardDomain = IndicatorPluginInterface::DOMAIN_ADMIN;
$pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_DOMAIN, $dashboardDomain);
// save the DataProvider for Ajax calls
$_SESSION[PluginDataProviderInterface::SESSION_ID.$dashboardName] = serialize($pluginDataProvider);
// create the Dashboard
$dashboard = new Dashboard($dashboardName);
$dashboard->setDomain($dashboardDomain);
$dashboard->setCategories(array(
IndicatorPluginInterface::CATEGORY_QUALITY,
IndicatorPluginInterface::CATEGORY_ACTIVITY,
IndicatorPluginInterface::CATEGORY_ROADMAP,
IndicatorPluginInterface::CATEGORY_PLANNING,
IndicatorPluginInterface::CATEGORY_RISK,
IndicatorPluginInterface::CATEGORY_ADMIN,
));
$dashboard->setTeamid($this->teamid);
$dashboard->setUserid($this->session_userid);
$data = $dashboard->getSmartyVariables($this->smartyHelper);
foreach ($data as $smartyKey => $smartyVariable) {
$this->smartyHelper->assign($smartyKey, $smartyVariable);
}
} else {
$this->smartyHelper->assign('error',T_('Sorry, you need to be identified.'));
}
}
}
AdminDashboardController::staticInit();
$controller = new AdminDashboardController('../', 'Admin tools','Admin');
$controller->execute();