forked from Runalyze/Runalyze
-
Notifications
You must be signed in to change notification settings - Fork 5
/
dashboard.php
102 lines (88 loc) · 2.37 KB
/
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* RUNALYZE
*
* @author Hannes Christiansen
* @copyright http://www.runalyze.com/
*/
use Runalyze\View\Activity\Context;
if (!isset($request) || !$request->isXmlHttpRequest()) {
include 'inc/tpl/tpl.Frontend.header.php';
}
?>
<div id="container">
<div id="main">
<div id="data-browser" class="panel">
<div id="data-browser-inner">
<?php
$DataBrowser = new DataBrowser();
$DataBrowser->display();
?>
</div>
</div>
<div id="statistics" class="panel">
<!-- #TSC: needed to scroll to statistics
same as runalyze.lib.training.js#load() of "scrollTop" -->
<div id="statistics-scrolltag" style="position: relative; top: -43px;"></div>
<ul id="statistics-nav">
<?php
$Factory = new PluginFactory();
$Stats = $Factory->activePlugins( PluginType::STAT );
foreach ($Stats as $i => $key) {
$Plugin = $Factory->newInstance($key);
if ($Plugin !== false) {
echo '<li'.($i == 0 ? ' class="active"' : '').'>'.$Plugin->getLink().'</li>';
}
}
if (PluginStat::hasVariousStats()) {
echo '<li class="with-submenu">';
echo '<a href="#">'.__('Miscellaneous').'</a>';
echo '<ul class="submenu">';
$VariousStats = $Factory->variousPlugins();
foreach ($VariousStats as $key) {
$Plugin = $Factory->newInstance($key);
if ($Plugin !== false) {
echo '<li>'.$Plugin->getLink().'</li>';
}
}
echo '</ul>';
echo '</li>';
}
?>
</ul>
<div id="statistics-inner">
<?php
if (isset($_GET['id'])) {
$Context = new Context(Request::sendId(), SessionAccountHandler::getId());
$View = new TrainingView($Context);
$View->display();
} else {
$showFirstPlugin = true;
if (isset($_GET['pluginid'])) {
$Plugin = $Factory->newInstanceFor((int)$_GET['pluginid']);
if (!$Plugin->isInActive()) {
$showFirstPlugin = false;
$Plugin->display();
}
}
if ($showFirstPlugin) {
if (empty($Stats)) {
echo __('<em>There are no statistics available. Activate a plugin in your configuration.</em>');
} else {
$Factory->newInstance($Stats[0])->display();
}
}
}
?>
</div>
</div>
</div>
<div id="panels">
<?php echo $panelsContent; ?>
</div>
</div>
<?php
if (!isset($request) || !$request->isXmlHttpRequest()) {
include 'inc/tpl/tpl.Frontend.footer.php';
}
?>