2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/09/2003 *
4 * =================== Last change: 04/21/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-stats.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Statistics over send mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Statistik ueber gesendete Mails *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
43 } elseif (!isMember()) {
44 redirectToIndexMemberOnlyModule();
47 // Add description as navigation point
48 addMenuDescription('member', __FILE__);
51 $main_content = array();
53 // Load waiting/pending orders
54 $result = SQL_QUERY_ESC("SELECT
55 `id`, `cat_id`, `payment_id`, `subject`, `url`, `timestamp`, `target_send`, `data_type`, `zip`
57 `{?_MYSQL_PREFIX?}_pool`
59 `sender`=%s AND `data_type` != 'SEND'
62 array(getMemberId()), __FILE__, __LINE__);
64 // Are there mails left in pool?
65 if (SQL_NUMROWS($result) > 0) {
68 while ($data = SQL_FETCHARRAY($result)) {
69 // Is the ZIP code set? If not, set dashes
70 if (empty($data['zip'])) $data['zip'] = '---';
72 // Prepare content for output
76 'cat' => getCategory($data['cat_id']),
77 'pay' => getPaymentTitlePrice($data['payment_id']),
78 'subject' => $data['subject'],
79 'url' => generateDerefererUrl($data['url']),
80 'timestamp' => generateDateTime($data['timestamp'], 2),
81 'target_send' => $data['target_send'],
82 'type' => translatePoolType($data['data_type']),
87 $OUT .= loadTemplate('member_pool_row', true, $content);
94 $main_content['pool'] = loadTemplate('member_pool_table', true, $OUT);
97 $main_content['pool'] = loadTemplate('admin_settings_saved', true, getMessage('MEMBER_NO_MAILS_IN_POOL'));
101 SQL_FREERESULT($result);
104 $result = SQL_QUERY_ESC("SELECT
105 `id`, `cat_id`, `payment_id`, `subject`, `url`, `timestamp_ordered`, `max_rec`, `timestamp_send`, `clicks`
107 `{?_MYSQL_PREFIX?}_user_stats`
111 `timestamp_ordered` DESC",
112 array(getMemberId()), __FILE__, __LINE__);
114 if (SQL_NUMROWS($result) > 0) {
115 // Mail orders are in pool so we can display them
117 while ($content = SQL_FETCHARRAY($result)) {
118 // Prepare data for the template
119 // @TODO Rewrite in template: clix->clicks
122 'cat' => getCategory($content['cat_id']),
123 'pay' => getPaymentTitlePrice($content['payment_id']),
124 'url' => generateDerefererUrl($content['url']),
125 'timestamp_ordered' => generateDateTime($content['timestamp_ordered'], 2),
126 'target_send' => $content['max_rec'],
127 'sent' => generateDateTime($content['timestamp_send'], 2),
128 'clix' => $content['clicks'],
129 'subject' => $content['subject'],
130 'percents' => translateComma($content['clicks'] / $content['max_rec'] * 100)."%",
133 // Load row template and switch colors
134 $OUT .= loadTemplate('member_stats_row', true, $content);
138 // Load main template
139 $main_content['stats'] = loadTemplate('member_stats_table', true, $OUT);
141 // No mail orders fond
142 $main_content['stats'] = loadTemplate('admin_settings_saved', true, getMessage('MEMBER_NO_MAILS_IN_STATS'));
146 SQL_FREERESULT($result);
148 // Load main template
149 loadTemplate('member_stats_pool', false, $main_content);