forked from seeks/ocDashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
38 lines (31 loc) · 1.06 KB
/
index.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
<?php
// Look up other security checks in the docs!
\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('ocDashboard');
\OCP\App::setActiveNavigationEntry( 'ocDashboard' );
OCP\Util::addscript('ocDashboard', 'ocDashboard');
OCP\Util::addscript('ocDashboard', 'ajaxService');
OCP\Util::addStyle('ocDashboard', 'ocDashboard');
$user = OCP\User::getUser();
$w = Array();
OC::$CLASSPATH['widgets'] = 'ocDashboard/appinfo/widgetConfigs.php';
OC::$CLASSPATH['factory'] = 'ocDashboard/lib/factory.php';
foreach (widgets::$widgets as $widget) {
// if widget is enabled
if (OCP\Config::getUserValue($user, "ocDashboard", "ocDashboard_".$widget['id']) == "yes") {
$w[] = factory::getWidget($widget)->getData();
}
}
//if all deactivated
if(empty($w)) {
$l=new OC_L10N('ocDashboard');
$w[0]['error'] = "You can configure this site in your personal settings.";
$w[0]['id'] = "none";
$w[0]['name'] = "";
$w[0]['status'] = "3";
$w[0]['interval'] = "0";
$w[0]['icon'] = "";
}
$tpl = new OCP\Template("ocDashboard", "main", "user");
$tpl->assign('widgets', $w);
$tpl->printPage();