]> git.mxchange.org Git - mailer.git/blob - inc/modules/admin/what-list_notifications.php
Mailer project continued:
[mailer.git] / inc / modules / admin / what-list_notifications.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 10/07/2008 *
4  * ===================                          Last change: 10/07/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_notifications.php                      *
8  * -------------------------------------------------------------------- *
9  * Short description : See all notification emails (beg/active rallye)  *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Alle Benachrichtigungen sehen (Bettel-/Aktiv-R.) *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
40         die();
41 } // END - if
42
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
45
46 // Init variables
47 $SQL2 = '';
48 $result_max = false;
49
50 // Set offset an current page to default values
51 if (!isGetRequestElementSet('page'))   setGetRequestElement('page'  , 1);
52 if (!isGetRequestElementSet('offset')) setGetRequestElement('offset', getMailsPage());
53
54 if (isExtensionActive('bonus')) {
55         // Bonus mails sent by you
56         $SQL2 = "SELECT
57         `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`,
58         `mails_sent`, `clicks`, (`mails_sent` - `clicks`) AS `unconfirmed`
59 FROM
60         `{?_MYSQL_PREFIX?}_bonus`
61 WHERE
62         `is_notify`='Y'
63 ORDER BY
64         `timestamp` DESC";
65
66         // Check for maximum pages
67         $result_max = SQL_QUERY($SQL2, __FILE__, __LINE__);
68 } else {
69         // Bonus extension required!
70         displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=bonus%}');
71 }
72
73 // Create limitation line
74 $add = ' LIMIT ' . (bigintval(getRequestElement('offset')) * bigintval(getRequestElement('page')) - bigintval(getRequestElement('offset'))) . ', ' . bigintval(getRequestElement('offset'));
75
76 // Add limitation
77 if (!empty($SQL2)) $SQL2 .= $add;
78
79 if ((isExtensionActive('bonus')) && (!SQL_HASZERONUMS($result_max)) && (!empty($SQL2))) {
80         // Run SQL query for notification mails
81         $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
82
83         // Load bonus mails only when extension is active
84         if (!SQL_HASZERONUMS($result_bonus)) {
85                 // Calculate pages
86                 $numPages = round(SQL_NUMROWS($result_bonus) / getMailsPage() + 0.5);
87
88                 // List emails
89                 $OUT = ''; $content = array();
90                 while ($content = SQL_FETCHARRAY($result_bonus)) {
91                         // Add "unconfirmed-link"
92                         $content['unconfirmed_content'] = generateUnconfirmedAdminLink($content['id'], $content['unconfirmed']);
93
94                         // Prepare content
95                         $content['timestamp']   = generateDateTime($content['timestamp'], 0);
96
97                         // Load row template
98                         $OUT .= loadTemplate('admin_list_notify_emails_row', true, $content);
99                 } // END - if
100
101                 // Add navigation (without change box but with colspan=3)
102                 $content['nav'] = addEmailNavigation($numPages, getMailsPage(), false, 3, true);
103
104                 // Prepare content
105                 $content['rows'] = $OUT;
106
107                 // Load main template
108                 loadTemplate('admin_list_notify_emails', false, $content);
109         }
110 } elseif ((SQL_NUMROWS($result_max) === 0) && (is_resource($result_max))) {
111         // No notifications found
112         displayMessage('{--ADMIN_NO_NOTIFICATIONS--}');
113 }
114
115 // [EOF]
116 ?>