added overall stats

This commit is contained in:
Serghey Rodin 2012-12-22 14:31:45 +02:00
commit 917b6e2c3f
7 changed files with 388 additions and 14 deletions

View file

@ -13,11 +13,33 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
top_panel($user,$TAB);
// Data
exec (VESTA_CMD."v-list-user-stats $user json", $output, $return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data);
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_stats.html');
if ($_SESSION['user'] == 'admin') {
if (empty($_GET['user'])) {
exec (VESTA_CMD."v-list-users-stats json", $output, $return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data);
unset($output);
} else {
$v_user = escapeshellarg($_GET['user']);
exec (VESTA_CMD."v-list-user-stats $v_user json", $output, $return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data);
unset($output);
}
exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var);
$users = json_decode(implode('', $output), true);
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_stats.html');
} else {
exec (VESTA_CMD."v-list-user-stats $user json", $output, $return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data);
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_stats.html');
}
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -3,10 +3,10 @@
<tr>
<td style="padding: 12px 0 0 16px">
<div style="float:left">
<a class="add" <?php if ((empty($_GET['period'])) || ($_GET['period'] == 'daily')) echo "style='color: #34536A'" ?> href="?period=daily">Daily</a>
<a class="add" <?php if ($_GET['period'] == 'weekly') echo "style='color: #34536A'" ?> href="?period=weekly">Weekly</a>
<a class="add" <?php if ($_GET['period'] == 'monthly') echo "style='color: #34536A'" ?> href="?period=monthly">Monthly</a>
<a class="add" <?php if ($_GET['period'] == 'yearly') echo "style='color: #34536A'" ?> href="?period=yearly">Yearly</a>
<a class="vst" <?php if ((empty($_GET['period'])) || ($_GET['period'] == 'daily')) echo "style='color: #34536A'" ?> href="?period=daily">Daily</a>
<a class="vst" <?php if ($_GET['period'] == 'weekly') echo "style='color: #34536A'" ?> href="?period=weekly">Weekly</a>
<a class="vst" <?php if ($_GET['period'] == 'monthly') echo "style='color: #34536A'" ?> href="?period=monthly">Monthly</a>
<a class="vst" <?php if ($_GET['period'] == 'yearly') echo "style='color: #34536A'" ?> href="?period=yearly">Yearly</a>
</div>
<div style="text-align: right; float: right;">
<form action="/search/" method="get" >

View file

@ -3,6 +3,24 @@
<tr>
<td style="padding: 12px 0 0 16px">
<div style="float:left">
<form action="/list/stats/" method="get" id="objects">
<a class="vst" <?php if (empty($_GET['user'])) echo "style='color: #34536A'"; ?> href='/list/stats/'>Overall Statistics</a>
<span style="padding: 0 8px;"></span>
<select style="margin:0 2px 0 0px;" name="user">
<option value=''>show per user</option>
<?php
foreach ($users as $key => $value) {
echo "\t\t\t\t<option value=\"".$value."\"";
if ((!empty($v_user)) && ( $value == $_GET['user'])){
echo ' selected';
}
echo ">".$value."</option>\n";
}
?>
</select>
<input type="submit" name="list" value="" class="button" style="width: 37px;font-size: 12px; height: 24px;">
</form>
</div>
<div style="text-align: right; float: right;">
<form action="/search/" method="get" >

View file

@ -205,8 +205,8 @@
text-decoration: underline;
}
.add {
padding: 0 8px 0 3px;
.vst {
padding: 0 8px 0 0;
margin: 0;
font-family: Arial, sans-serif;
text-decoration: none;
@ -214,11 +214,11 @@
font-size: 12pt;
}
.add:hover {
.vst:hover {
text-decoration: underline;
}
.add:active {
.vst:active {
color: #34536A;
}

View file

@ -0,0 +1,203 @@
<table class="sub-menu" style="background: white;">
<tr>
<td style="padding: 12px 0 0 16px">
<div style="float:left">
</div>
<div style="text-align: right; float: right;">
<form action="/search/" method="get" >
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;" name="q">
<input type="submit" value="Search"class="button" style="font-size: 12px; height: 24px;">
</form>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="vstobjects">
<table class='data'>
<?php
foreach ($data as $key => $value) {
++$i;
?>
<tr class="data-row">
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150px">
<table class="data-col1" width="150">
<tr><td style="padding: 24 0 4 0;"><a class="data-date" title="<?php echo $data[$key]['DATE']." ".$data[$key]['TIME'] ?>"><?php echo date("d M Y", strtotime($key))?></a></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px">
<tr>
<td></td>
</tr>
</table>
<table class="data-col2" width="830px">
<tr>
<td colspan=3 class="username" style="padding: 10 0 0 4px;">
<b><?php echo date("M Y", strtotime($key))?></b>
</td>
</tr>
<tr>
<td style="vertical-align:top;" >
<table>
<tr>
<td colspan=2 class="counter-name" style="padding: 2px 0px 6px 2px;">
[<?php echo $data[$key]['PACKAGE']?>] package
</td>
</tr>
<tr>
<td class="chart1" colspan=2 style="padding: 0 0 0 2px;">
Bandwidth: <?php echo get_percentage($data[$key]['U_BANDWIDTH'],$data[$key]['BANDWIDTH']) ?>% (<?php echo humanize_usage($data[$key]['U_BANDWIDTH']) ?>)
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;">
<div style="width:<?php echo get_percentage($data[$key]['U_BANDWIDTH'],$data[$key]['BANDWIDTH']) ?>%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div>
</div>
</td>
</tr>
<tr>
<td class="chart1" colspan=2 style="padding: 0 0 0 2px;">
Disk: <?php echo get_percentage($data[$key]['U_DISK'],$data[$key]['DISK_QUOTA']) ?>% (<?php echo humanize_usage($data[$key]['U_DISK']) ?>)
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;">
<div style="width:<?php echo get_percentage($data[$key]['U_DISK'],$data[$key]['DISK_QUOTA']) ?>%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div>
</div>
</td>
</tr>
<tr>
<td colspan=2>
<table class="chart2">
<tr>
<td>
Web: <?php echo humanize_usage($data[$key]['U_DISK_WEB'])?><br>
Mail: <?php echo humanize_usage($data[$key]['U_DISK_MAIL'])?><br>
</td>
<td style="padding: 0px 10px 0px 8px">
Databases: <?php echo humanize_usage($data[$key]['U_DISK_DB'])?><br>
User Dirs: <?php echo humanize_usage($data[$key]['U_DISK_DIRS'])?><br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td style="vertical-align:top;" width="280">
<table width="280">
<tr>
<td class="counter-name" width="37%">
Web Domains:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_WEB_DOMAINS'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Web SSL:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_WEB_SSL'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Web Aliases:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_WEB_ALIASES'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Dns Domains:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_DNS_DOMAINS'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Dns Records:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_DNS_RECORDS'] ?>
</td>
</tr>
</table>
</td>
<td style="vertical-align:top;" width="250">
<table class="data-col4" width="250">
<tr>
<td class="counter-name" width="43%">
Mail Domains:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_MAIL_DOMAINS'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Mail Accounts:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_MAIL_ACCOUNTS'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Databases:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_DATABASES'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Cron Jobs:
</td>
<td class="counter-value">
<?php echo $data[$key]['U_CRON_JOBS'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Dedicated IP:
</td>
<td class="counter-value">
<?php echo $data[$key]['IP_OWNED'] ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<?php
}
?>
</table>
<table class="data-count">
<tr>
<td width="160px"></td>
<td>
<?php
if ( $i == 1) {
echo "1 month ";
} else {
echo "$i months ";
}
?>
</td>
</tr>
</table>
</div>