interface/lib/classes/listform_actions.inc.php | ●●●●● patch | view | raw | blame | history | |
interface/web/mail/lib/lang/en_mail_user_stats_list.lng | ●●●●● patch | view | raw | blame | history | |
interface/web/mail/lib/module.conf.php | ●●●●● patch | view | raw | blame | history | |
interface/web/mail/list/mail_user_stats.list.php | ●●●●● patch | view | raw | blame | history | |
interface/web/mail/mail_user_stats.php | ●●●●● patch | view | raw | blame | history | |
interface/web/mail/templates/mail_user_stats_list.htm | ●●●●● patch | view | raw | blame | history |
interface/lib/classes/listform_actions.inc.php
@@ -38,8 +38,8 @@ class listform_actions { private $id; private $idx_key; private $DataRowColor; public $idx_key; public $DataRowColor; public $SQLExtWhere = ''; public $SQLOrderBy = ''; @@ -82,7 +82,7 @@ } private function prepareDataRow($rec) public function prepareDataRow($rec) { global $app; interface/web/mail/lib/lang/en_mail_user_stats_list.lng
New file @@ -0,0 +1,14 @@ <?php $wb["list_head_txt"] = 'Mail traffic statistic'; $wb["email_txt"] = 'Email'; $wb["this_month_txt"] = 'This month'; $wb["last_month_txt"] = 'Last month'; $wb["this_year_txt"] = 'This year'; $wb["last_year_txt"] = 'Last year'; $wb["page_txt"] = 'Page'; $wb["page_of_txt"] = 'of'; $wb["page_next_txt"] = 'Next'; $wb["page_back_txt"] = 'Back'; $wb["delete_txt"] = 'Delete'; $wb["filter_txt"] = 'Filter'; ?> interface/web/mail/lib/module.conf.php
@@ -80,6 +80,18 @@ 'open' => 1, 'items' => $items); //**** Statistics menu $items = array(); $items[] = array( 'title' => 'Mailboxes', 'target' => 'content', 'link' => 'mail/mail_user_stats.php'); $module['nav'][] = array( 'title' => 'Statistics', 'open' => 1, 'items' => $items); //**** Global filters menu $items = array(); interface/web/mail/list/mail_user_stats.list.php
New file @@ -0,0 +1,60 @@ <?php /* Datatypes: - INTEGER - DOUBLE - CURRENCY - VARCHAR - TEXT - DATE */ // Name of the list $liste["name"] = "mail_user_stats"; // Database table $liste["table"] = "mail_user"; // Index index field of the database table $liste["table_idx"] = "mailuser_id"; // Search Field Prefix $liste["search_prefix"] = "search_"; // Records per page $liste["records_per_page"] = 15; // Script File of the list $liste["file"] = "mail_user_stats.php"; // Script file of the edit form $liste["edit_file"] = "mail_user_edit.php"; // Script File of the delete script $liste["delete_file"] = "mail_user_del.php"; // Paging Template $liste["paging_tpl"] = "templates/paging.tpl.htm"; // Enable auth $liste["auth"] = "yes"; /***************************************************** * Suchfelder *****************************************************/ $liste["item"][] = array( 'field' => "email", 'datatype' => "VARCHAR", 'formtype' => "TEXT", 'op' => "like", 'prefix' => "%", 'suffix' => "%", 'width' => "", 'value' => ""); ?> interface/web/mail/mail_user_stats.php
New file @@ -0,0 +1,66 @@ <?php require_once('../../lib/config.inc.php'); require_once('../../lib/app.inc.php'); /****************************************** * Begin Form configuration ******************************************/ $list_def_file = "list/mail_user_stats.list.php"; /****************************************** * End Form configuration ******************************************/ // Checking module permissions if(!stristr($_SESSION["s"]["user"]["modules"],'mail')) { header("Location: ../index.php"); exit; } $app->load('listform_actions'); class list_action extends listform_actions { function prepareDataRow($rec) { global $app; $rec = $app->listform->decode($rec); //* Alternating datarow colors $this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'; $rec['bgcolor'] = $this->DataRowColor; //* Set the statistics colums //** Traffic of the current month $tmp_date = date('Y-m'); $tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'"); $rec['this_month'] = number_format(intval($tmp_rec['t'])/1024, 0, '.', ' '); //** Traffic of the current year $tmp_date = date('Y'); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'"); $rec['this_year'] = number_format(intval($tmp_rec['t'])/1024, 0, '.', ' '); //** Traffic of the last month $tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'"); $rec['last_month'] = number_format(intval($tmp_rec['t'])/1024, 0, '.', ' '); //** Traffic of the last year $tmp_date = date('Y',mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'"); $rec['last_year'] = number_format(intval($tmp_rec['t'])/1024, 0, '.', ' '); //* The variable "id" contains always the index variable $rec['id'] = $rec[$this->idx_key]; return $rec; } } $list = new list_action; $list->onLoad(); ?> interface/web/mail/templates/mail_user_stats_list.htm
New file @@ -0,0 +1,33 @@ <div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br /> <table width="100%" border="0" cellspacing="0" cellpadding="4" class="listTable"> <tr> <td class="tblHead"><tmpl_var name="email_txt"></td> <td class="tblHead"><tmpl_var name="this_month_txt"></td> <td class="tblHead"><tmpl_var name="last_month_txt"></td> <td class="tblHead"><tmpl_var name="this_year_txt"></td> <td class="tblHead"><tmpl_var name="last_year_txt"></td> <td class="tblHead"> </td> </tr> <tr> <td class="frmText11"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" class="text" /></td> <td class="frmText11"> </td> <td class="frmText11"> </td> <td class="frmText11"> </td> <td class="frmText11"> </td> <td class="frmText11" align="right"><input name="Filter" type="button" id="Filter" value="{tmpl_var name="filter_txt"}" class="button" onClick="submitForm('pageForm','mail/mail_user_stats.php');"><div class="buttonEnding"></div></td> </tr> <tmpl_loop name="records"> <tr bgcolor="{tmpl_var name="bgcolor"}"> <td class="frmText11"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="email"}</a></td> <td class="frmText11"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="this_month"} KB</a></td> <td class="frmText11"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="last_month"} KB</a></td> <td class="frmText11"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="this_year"} KB</a></td> <td class="frmText11"><a href="#" onClick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="last_year"} KB</a></td> <td class="frmText11" align="right"> </td> </tr> </tmpl_loop> <tr> <td colspan="6" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td> </tr> </table>