Skip to content

Commit 78d02d7

Browse files
author
Patrick Anders
committed
stats: add backup stats
1 parent 1fa8f42 commit 78d02d7

File tree

4 files changed

+174
-0
lines changed

4 files changed

+174
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
require_once '../../lib/config.inc.php';
3+
require_once '../../lib/app.inc.php';
4+
5+
$list_def_file = 'list/backup_stats.list.php';
6+
7+
/******************************************
8+
* End Form configuration
9+
******************************************/
10+
11+
//* Check permissions for module
12+
$app->auth->check_module_permissions('sites');
13+
14+
$app->load('listform_actions','functions');
15+
16+
class list_action extends listform_actions {
17+
18+
public function prepareDataRow($rec)
19+
{
20+
$rec = parent::prepareDataRow($rec);
21+
22+
$rec['active'] = "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>";
23+
if ($rec['backup_interval'] === 'none') {
24+
$rec['active'] = "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>";
25+
}
26+
27+
return $rec;
28+
}
29+
}
30+
31+
$list = new list_action;
32+
$list->SQLExtWhere = "";
33+
$list->onLoad();

interface/web/sites/lib/module.conf.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@
189189
'link' => 'sites/database_quota_stats.php',
190190
'html_id' => 'databse_quota_stats');
191191

192+
$items[] = array (
193+
'title' => 'Backup Stats',
194+
'target' => 'content',
195+
'link' => 'sites/backup_stats.php',
196+
'html_id' => 'backup_stats'
197+
);
198+
192199
$module['nav'][] = array( 'title' => 'Statistics',
193200
'open' => 1,
194201
'items' => $items);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
// Name of the list
3+
$liste["name"] = "backup_stats";
4+
5+
// Database table
6+
$liste["table"] = "web_domain";
7+
8+
// Index index field of the database table
9+
$liste["table_idx"] = "domain_id";
10+
11+
// Search Field Prefix
12+
$liste["search_prefix"] = "search_";
13+
14+
// Records per page
15+
$liste["records_per_page"] = "15";
16+
17+
// Script File of the list
18+
$liste["file"] = "backup_stats.php";
19+
20+
// Script file of the edit form
21+
$liste["edit_file"] = "backup_stats_edit.php";
22+
23+
// Paging Template
24+
$liste["paging_tpl"] = "templates/paging.tpl.htm";
25+
26+
// Enable auth
27+
$liste["auth"] = "yes";
28+
29+
// mark columns for php sorting (no real mySQL columns)
30+
$liste["phpsort"] = array('used_sort', 'files');
31+
32+
33+
/*****************************************************
34+
* Suchfelder
35+
*****************************************************/
36+
37+
$liste['item'][] = array (
38+
'field' => 'server_id',
39+
'datatype' => 'INTEGER',
40+
'formtype' => 'SELECT',
41+
'op' => '=',
42+
'prefix' => '',
43+
'width' => '',
44+
'value' => '',
45+
'suffix' => '',
46+
'datasource' => array (
47+
'type' => 'SQL',
48+
'querystring' => 'SELECT a.server_id, a.server_name FROM server a, web_domain b WHERE (a.server_id = b.server_id) ORDER BY a.server_name',
49+
'keyfield' => 'server_id',
50+
'valuefield' => 'server_name'
51+
)
52+
);
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<h2><tmpl_var name="list_head_txt"></h2>
2+
<p><tmpl_var name="list_desc_txt"></p>
3+
4+
<div class="panel panel_list_backup_stats">
5+
<div class="pnl_listarea">
6+
<fieldset><legend><tmpl_var name="list_head_txt"></legend>
7+
<table class="list">
8+
<thead>
9+
<tr class="caption">
10+
<th class="tbl_col_active" scope="col">
11+
<tmpl_var name="active_txt">
12+
</th>
13+
<th class="tbl_col_domain" scope="col">
14+
<tmpl_var name="domain_txt">
15+
</th>
16+
<th class="tbl_col_backup_count" scope="col">
17+
<tmpl_var name="backup_count_txt">
18+
</th>
19+
<th class="tbl_col_server" scope="col">
20+
<tmpl_var name="backup_server_txt">
21+
</th>
22+
<th class="tbl_col_period" scope="col">
23+
<tmpl_var name="backup_period_txt">
24+
</th>
25+
</tr>
26+
</thead>
27+
<tbody>
28+
<tmpl_loop name="records">
29+
<tr class="tbl_row_{tmpl_if name='__EVEN__'}even{tmpl_else}uneven{/tmpl_if}">
30+
<td class="tbl_col_active">{tmpl_var name="active"}</td>
31+
<td class="tbl_col_domain">{tmpl_var name="domain"}</td>
32+
<td class="tbl_col_backup_count">{tmpl_var name="backup_copies"}</td>
33+
<td class="tbl_col_server">{tmpl_var name="server_id"}</td>
34+
<td class="tbl_col_period">{tmpl_var name="backup_interval"}</td>
35+
</tr>
36+
</tmpl_loop>
37+
</tbody>
38+
<tfoot>
39+
<tr>
40+
<td class="tbl_footer tbl_paging" colspan="5">
41+
<tmpl_var name="paging">
42+
</td>
43+
</tr>
44+
</tfoot>
45+
</table>
46+
</fieldset>
47+
</div>
48+
</div>
49+
50+
<!--
51+
-<old>
52+
- <tmpl_loop name="records">
53+
- <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
54+
- <td class="tbl_col_domain"><a target="_blank" href="http://{tmpl_var name="domain"}/stats">{tmpl_var name="domain"}</a></td>
55+
- <td class="tbl_col_this_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_month"} MB</a></td>
56+
- <td class="tbl_col_last_month"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_month"} MB</a></td>
57+
- <td class="tbl_col_this_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="this_year"} MB</a></td>
58+
- <td class="tbl_col_last_year"><a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="last_year"} MB</a></td>
59+
- <td class="tbl_col_buttons"></td>
60+
- </tr>
61+
- </tmpl_loop>
62+
- <tmpl_unless name="records">
63+
- <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
64+
- <td colspan="6">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
65+
- </tr>
66+
- </tmpl_unless>
67+
- <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
68+
- <td class="tbl_col_domain"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_txt"}</a></td>
69+
- <td class="tbl_col_this_month"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_month"} MB</a></td>
70+
- <td class="tbl_col_last_month"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_month"} MB</a></td>
71+
- <td class="tbl_col_this_year"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_year"} MB</a></td>
72+
- <td class="tbl_col_last_year"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_year"} MB</a></td>
73+
- <td class="tbl_col_buttons"></td>
74+
- </tr>
75+
- </tbody>
76+
- <tfoot>
77+
- <tr>
78+
- <td class="tbl_footer tbl_paging" colspan="6"><tmpl_var name="paging"></td>
79+
- </tr>
80+
- </tfoot>
81+
-</old>
82+
-->

0 commit comments

Comments
 (0)