From 78d02d715edcbe5e18556f650baa2e1873629759 Mon Sep 17 00:00:00 2001 From: Patrick Anders <p.anders@timmehosting.de> Date: Mon, 08 Dec 2014 08:35:32 -0500 Subject: [PATCH] stats: add backup stats --- interface/web/sites/lib/module.conf.php | 7 ++ interface/web/sites/list/backup_stats.list.php | 52 +++++++++++++++++ interface/web/sites/backup_stats.php | 33 +++++++++++ interface/web/sites/templates/backup_stats_list.htm | 82 +++++++++++++++++++++++++++ 4 files changed, 174 insertions(+), 0 deletions(-) diff --git a/interface/web/sites/backup_stats.php b/interface/web/sites/backup_stats.php new file mode 100644 index 0000000..3774f63 --- /dev/null +++ b/interface/web/sites/backup_stats.php @@ -0,0 +1,33 @@ +<?php +require_once '../../lib/config.inc.php'; +require_once '../../lib/app.inc.php'; + +$list_def_file = 'list/backup_stats.list.php'; + +/****************************************** +* End Form configuration +******************************************/ + +//* Check permissions for module +$app->auth->check_module_permissions('sites'); + +$app->load('listform_actions','functions'); + +class list_action extends listform_actions { + + public function prepareDataRow($rec) + { + $rec = parent::prepareDataRow($rec); + + $rec['active'] = "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>"; + if ($rec['backup_interval'] === 'none') { + $rec['active'] = "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"; + } + + return $rec; + } +} + +$list = new list_action; +$list->SQLExtWhere = ""; +$list->onLoad(); diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php index 5b3a2f8..b6d506a 100644 --- a/interface/web/sites/lib/module.conf.php +++ b/interface/web/sites/lib/module.conf.php @@ -189,6 +189,13 @@ 'link' => 'sites/database_quota_stats.php', 'html_id' => 'databse_quota_stats'); +$items[] = array ( + 'title' => 'Backup Stats', + 'target' => 'content', + 'link' => 'sites/backup_stats.php', + 'html_id' => 'backup_stats' +); + $module['nav'][] = array( 'title' => 'Statistics', 'open' => 1, 'items' => $items); diff --git a/interface/web/sites/list/backup_stats.list.php b/interface/web/sites/list/backup_stats.list.php new file mode 100644 index 0000000..cc7358b --- /dev/null +++ b/interface/web/sites/list/backup_stats.list.php @@ -0,0 +1,52 @@ +<?php +// Name of the list +$liste["name"] = "backup_stats"; + +// Database table +$liste["table"] = "web_domain"; + +// Index index field of the database table +$liste["table_idx"] = "domain_id"; + +// Search Field Prefix +$liste["search_prefix"] = "search_"; + +// Records per page +$liste["records_per_page"] = "15"; + +// Script File of the list +$liste["file"] = "backup_stats.php"; + +// Script file of the edit form +$liste["edit_file"] = "backup_stats_edit.php"; + +// Paging Template +$liste["paging_tpl"] = "templates/paging.tpl.htm"; + +// Enable auth +$liste["auth"] = "yes"; + +// mark columns for php sorting (no real mySQL columns) +$liste["phpsort"] = array('used_sort', 'files'); + + +/***************************************************** +* Suchfelder +*****************************************************/ + +$liste['item'][] = array ( + 'field' => 'server_id', + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'op' => '=', + 'prefix' => '', + 'width' => '', + 'value' => '', + 'suffix' => '', + 'datasource' => array ( + 'type' => 'SQL', + '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', + 'keyfield' => 'server_id', + 'valuefield' => 'server_name' + ) +); diff --git a/interface/web/sites/templates/backup_stats_list.htm b/interface/web/sites/templates/backup_stats_list.htm new file mode 100644 index 0000000..543b4a7 --- /dev/null +++ b/interface/web/sites/templates/backup_stats_list.htm @@ -0,0 +1,82 @@ +<h2><tmpl_var name="list_head_txt"></h2> +<p><tmpl_var name="list_desc_txt"></p> + +<div class="panel panel_list_backup_stats"> + <div class="pnl_listarea"> + <fieldset><legend><tmpl_var name="list_head_txt"></legend> + <table class="list"> + <thead> + <tr class="caption"> + <th class="tbl_col_active" scope="col"> + <tmpl_var name="active_txt"> + </th> + <th class="tbl_col_domain" scope="col"> + <tmpl_var name="domain_txt"> + </th> + <th class="tbl_col_backup_count" scope="col"> + <tmpl_var name="backup_count_txt"> + </th> + <th class="tbl_col_server" scope="col"> + <tmpl_var name="backup_server_txt"> + </th> + <th class="tbl_col_period" scope="col"> + <tmpl_var name="backup_period_txt"> + </th> + </tr> + </thead> + <tbody> + <tmpl_loop name="records"> + <tr class="tbl_row_{tmpl_if name='__EVEN__'}even{tmpl_else}uneven{/tmpl_if}"> + <td class="tbl_col_active">{tmpl_var name="active"}</td> + <td class="tbl_col_domain">{tmpl_var name="domain"}</td> + <td class="tbl_col_backup_count">{tmpl_var name="backup_copies"}</td> + <td class="tbl_col_server">{tmpl_var name="server_id"}</td> + <td class="tbl_col_period">{tmpl_var name="backup_interval"}</td> + </tr> + </tmpl_loop> + </tbody> + <tfoot> + <tr> + <td class="tbl_footer tbl_paging" colspan="5"> + <tmpl_var name="paging"> + </td> + </tr> + </tfoot> + </table> + </fieldset> + </div> +</div> + +<!-- + -<old> + - <tmpl_loop name="records"> + - <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + - <td class="tbl_col_domain"><a target="_blank" href="http://{tmpl_var name="domain"}/stats">{tmpl_var name="domain"}</a></td> + - <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> + - <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> + - <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> + - <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> + - <td class="tbl_col_buttons"></td> + - </tr> + - </tmpl_loop> + - <tmpl_unless name="records"> + - <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + - <td colspan="6">{tmpl_var name='globalsearch_noresults_text_txt'}</td> + - </tr> + - </tmpl_unless> + - <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> + - <td class="tbl_col_domain"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_txt"}</a></td> + - <td class="tbl_col_this_month"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_month"} MB</a></td> + - <td class="tbl_col_last_month"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_month"} MB</a></td> + - <td class="tbl_col_this_year"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_this_year"} MB</a></td> + - <td class="tbl_col_last_year"><a href="#" onclick="return false;" style="font-weight:bold;">{tmpl_var name="sum_last_year"} MB</a></td> + - <td class="tbl_col_buttons"></td> + - </tr> + - </tbody> + - <tfoot> + - <tr> + - <td class="tbl_footer tbl_paging" colspan="6"><tmpl_var name="paging"></td> + - </tr> + - </tfoot> + -</old> + --> -- Gitblit v1.9.1