forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
224 lines (206 loc) · 6.77 KB
/
home.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?php
/**
* Home page for logged in system users.
*
* @package ProjectSend
*
*/
$allowed_levels = array(9,8,7);
require_once('sys.includes.php');
$page_title = __('Welcome to ProjectSend', 'cftp_admin');
$active_nav = 'dashboard';
$flot = 1;
include('header.php');
$database->MySQLDB();
define('CAN_INCLUDE_FILES', true);
?>
<div id="main">
<h2><?php echo $page_title; ?></h2>
<div class="home">
<div class="container-fluid">
<div class="row-fluid">
<?php
$log_allowed = array(9);
if (in_session_or_cookies($log_allowed)) {
$show_log = true;
}
?>
<div class="span8 <?php if ($show_log != true) { echo 'offset2'; } ?>">
<div class="row-fluid">
<div class="span12">
<div class="widget">
<h4><?php _e('Statistics','cftp_admin'); ?></h4>
<div class="widget_int">
<div class="stats_change_days">
<a href="#" class="stats_days btn btn-small" rel="15" id="default_graph">15 <?php _e('days','cftp_admin'); ?></a>
<a href="#" class="stats_days btn btn-small" rel="30">30 <?php _e('days','cftp_admin'); ?></a>
<a href="#" class="stats_days btn btn-small" rel="60">60 <?php _e('days','cftp_admin'); ?></a>
</div>
<ul class="graph_legend">
<li><div class="legend_color legend_color1"></div><?php _e('Uploads by users','cftp_admin'); ?></li><li>
<div class="legend_color legend_color2"></div><?php _e('Uploads by clients','cftp_admin'); ?></li><li>
<div class="legend_color legend_color3"></div><?php _e('Downloads','cftp_admin'); ?></li><li>
<div class="legend_color legend_color4"></div><?php _e('Zip Downloads','cftp_admin'); ?></li>
</ul>
<div id="statistics" style="height:320px;width:100%;"></div>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<?php include(ROOT_DIR.'/home-news-widget.php'); ?>
</div>
<div class="span6">
<div class="widget">
<h4><?php _e('System data','cftp_admin'); ?></h4>
<div class="widget_int">
<p><strong><?php _e('Note:','cftp_admin'); ?></strong> <?php _e('This graphic will help you get a relative view of the existing data, allowing you to see the relation between clients, users, groups and files.','cftp_admin'); ?>
<div id="sys_info" style="height:290px; width:100%;"></div>
</div>
</div>
</div>
</div>
</div>
<?php if (isset($show_log) && $show_log == true) { ?>
<div class="span4">
<div class="widget">
<h4><?php _e('Recent activites','cftp_admin'); ?></h4>
<div class="widget_int">
<div class="log_change_action">
<a href="#" class="log_action btn btn-small" rel="" id="default_log"><?php _e('All activities','cftp_admin'); ?></a>
<a href="#" class="log_action btn btn-small" rel="1"><?php _e('Logins','cftp_admin'); ?></a>
<a href="#" class="log_action btn btn-small" rel="8"><?php _e('Downloads','cftp_admin'); ?></a>
<?php
if (CLIENTS_CAN_REGISTER == '1') {
?>
<a href="#" class="log_action btn btn-small" rel="4"><?php _e('Clients self-registrations','cftp_admin'); ?></a>
<?php
}
?>
</div>
<ul class="activities_log">
</ul>
<div class="view_full_log">
<a href="actions-log.php" class="btn btn-primary btn-wide"><?php _e('View all','cftp_admin'); ?></a>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<?php
/** Get the data to show on the bars graphic */
$sql = $database->query("SELECT distinct id FROM tbl_files");
$total_files = mysql_num_rows($sql);
$sql = $database->query("SELECT distinct user FROM tbl_users WHERE level='0'");
$total_clients = mysql_num_rows($sql);
$sql = $database->query("SELECT distinct id FROM tbl_groups");
$total_groups = mysql_num_rows($sql);
$sql = $database->query("SELECT distinct user FROM tbl_users WHERE level != '0'");
$total_users = mysql_num_rows($sql);
?>
<script type="text/javascript">
$(document).ready(function(){
$.plot(
$("#sys_info"), [{
data: [
[1, <?php echo $total_files; ?>],
[2, <?php echo $total_clients; ?>],
[3, <?php echo $total_groups; ?>]
<?php
$log_allowed = array(9);
if (in_session_or_cookies($log_allowed)) {
?>
,[4, <?php echo $total_users; ?>]
<?php
$show_log = true;
}
?>
]
}
], {
series:{
bars:{show: true}
},
bars:{
barWidth:.5,
align: 'center'
},
legend: {
show: true
},
grid:{
hoverable: true,
borderWidth: 0,
backgroundColor: {
colors: ["#fff", "#f9f9f9"]
}
},
xaxis: {
ticks: [
[1, '<?php _e('Files','cftp_admin'); ?>: <?php echo $total_files; ?>'],
[2, '<?php _e('Clients','cftp_admin'); ?>: <?php echo $total_clients; ?>'],
[3, '<?php _e('Groups','cftp_admin'); ?>: <?php echo $total_groups; ?>'],
[4, '<?php _e('Users','cftp_admin'); ?>: <?php echo $total_users; ?>']
]
},
yaxis: {
min: 0,
tickDecimals:0
}
}
);
// Generate the graphic
$('.stats_days').click(function(e) {
if ($(this).hasClass('btn-inverse')) {
return false;
}
$('.stats_days').removeClass('btn-inverse');
$(this).addClass('btn-inverse');
$('.graph_legend').hide();
$('#statistics').html('<div class="loading-graph">'+
'<img src="<?php echo BASE_URI; ?>/img/ajax-loader.gif" alt="Loading" />'+
'<p><?php _e('Please wait while the system generates the statistics graph.','cftp_admin'); ?></p></div>'
);
var days = $(this).attr('rel');
$.get('<?php echo BASE_URI; ?>home-statistics.php', { days:days },
function(data) {
$('#statistics').html(data);
$('.graph_legend').css('display','inline-block');
}
);
return false;
});
$('#default_graph').click();
// Generate the action log
$('.log_action').click(function(e) {
if ($(this).hasClass('btn-inverse')) {
return false;
}
$('.log_action').removeClass('btn-inverse');
$(this).addClass('btn-inverse');
$('.activities_log').html('<li><div class="loading-graph">'+
'<img src="<?php echo BASE_URI; ?>/img/ajax-loader.gif" alt="Loading" />'+
'<p><?php _e('Please wait while the system gets the information from the log.','cftp_admin'); ?></p></div></li>'
);
var action = $(this).attr('rel');
$.get('<?php echo BASE_URI; ?>home-log.php', { action:action },
function(data) {
$('.activities_log').html(data);
}
);
return false;
});
$('#default_log').click();
});
</script>
<?php
$database->Close();
include('footer.php');
?>