Skip to content

Commit 746e5bb

Browse files
author
Florian Schaal
committed
add backup stats for mail
1 parent c193ade commit 746e5bb

File tree

6 files changed

+163
-1
lines changed

6 files changed

+163
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
global $app;
21+
22+
$rec = parent::prepareDataRow($rec);
23+
24+
$rec['active'] = "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>";
25+
if ($rec['backup_interval'] === 'none') {
26+
$rec['active'] = "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>";
27+
$rec['backup_copies'] = 0;
28+
}
29+
$recBackup = $app->db->queryOneRecord('SELECT COUNT(backup_id) AS backup_count FROM mail_backup WHERE mailuser_id = ?', $rec['mailuser_id']);
30+
$rec['backup_copies_exists'] = $recBackup['backup_count'];
31+
32+
return $rec;
33+
}
34+
}
35+
36+
$list = new list_action;
37+
$list->SQLExtWhere = "";
38+
$list->onLoad();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Backup Statistiken';
3+
$wb["database_name_txt"] = '';
4+
$wb['active_txt'] = 'Aktiv';
5+
$wb['domain_txt'] = 'Email';
6+
$wb['backup_count_txt'] = 'Anz. Backups';
7+
$wb['backup_server_txt'] = 'Server';
8+
$wb['backup_interval_txt'] = 'Intervall / Anz.';
9+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Backup Stats';
3+
$wb["database_name_txt"] = '';
4+
$wb['active_txt'] = 'Active';
5+
$wb['domain_txt'] = 'Email';
6+
$wb['backup_count_txt'] = 'Backup count';
7+
$wb['backup_server_txt'] = 'Server';
8+
$wb['backup_interval_txt'] = 'Interval / cnt.';
9+
?>

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@
164164
'target' => 'content',
165165
'link' => 'mail/mail_user_stats.php',
166166
'html_id' => 'mail_user_stats');
167-
167+
$items[] = array (
168+
'title' => 'Backup Stats',
169+
'target' => 'content',
170+
'link' => 'mail/backup_stats.php',
171+
'html_id' => 'backup_stats');
168172

169173

170174
$module['nav'][] = array( 'title' => 'Statistics',
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
// Name of the list
3+
$liste["name"] = "backup_stats";
4+
5+
// Database table
6+
//$liste["table"] = "mail_domain";
7+
$liste["table"] = "mail_user";
8+
9+
// Index index field of the database table
10+
//$liste["table_idx"] = "domain_id";
11+
$liste["table_idx"] = "mailuser_id";
12+
13+
// Search Field Prefix
14+
$liste["search_prefix"] = "search_";
15+
16+
// Records per page
17+
$liste["records_per_page"] = "15";
18+
19+
// Script File of the list
20+
$liste["file"] = "backup_stats.php";
21+
22+
// Script file of the edit form
23+
$liste["edit_file"] = "backup_stats_edit.php";
24+
25+
// Paging Template
26+
$liste["paging_tpl"] = "templates/paging.tpl.htm";
27+
28+
// Enable auth
29+
$liste["auth"] = "yes";
30+
31+
// mark columns for php sorting (no real mySQL columns)
32+
$liste["phpsort"] = array('used_sort', 'files');
33+
34+
35+
/*****************************************************
36+
* Suchfelder
37+
*****************************************************/
38+
39+
$liste['item'][] = array (
40+
'field' => 'server_id',
41+
'datatype' => 'INTEGER',
42+
'formtype' => 'SELECT',
43+
'op' => '=',
44+
'prefix' => '',
45+
'width' => '',
46+
'value' => '',
47+
'suffix' => '',
48+
'datasource' => array (
49+
'type' => 'SQL',
50+
'querystring' => 'SELECT a.server_id, a.server_name FROM server a, mail_domain b WHERE (a.server_id = b.server_id) ORDER BY a.server_name',
51+
'keyfield' => 'server_id',
52+
'valuefield' => 'server_name'
53+
)
54+
);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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_server" scope="col">
17+
<tmpl_var name="backup_server_txt">
18+
</th>
19+
<th class="tbl_col_interval" scope="col">
20+
<tmpl_var name="backup_interval_txt">
21+
</th>
22+
<th class="tbl_col_backup_count" scope="col">
23+
<tmpl_var name="backup_count_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"> <a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="active"}</a> </td>
31+
<td class="tbl_col_domain"> <a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="email"}</a> </td>
32+
<td class="tbl_col_server"> <a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a> </td>
33+
<td class="tbl_col_interval"> <a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="backup_interval"}</a> / <a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="backup_copies"}</a> </td>
34+
<td class="tbl_col_backup_count"> <a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="backup_copies_exists"}</a> </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>

0 commit comments

Comments
 (0)