66b701da9a55a08a3889c026fc4b5c80454bf901
[mailer.git] / inc / modules / admin / what-list_bank_package.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 02/12/2004 *
4  * ===================                          Last change: 02/12/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_bank_package.php                       *
8  * -------------------------------------------------------------------- *
9  * Short description : List packages                                    *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Listet Angebotspakete auf                        *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
41         die();
42 } // END - if
43
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
46
47 // Check if there is enougth selected
48 $show = true;
49 if ((isPostRequestParameterSet('id')) && (is_array(postRequestParameter('id'))) && (count(postRequestParameter('id')) > 0)) {
50         // Okay, which button was pressed?
51         if (isPostRequestParameterSet('change')) {
52                 // Change permissions
53                 adminChangeActivationStatus(postRequestParameter('id'), 'bank_packages', 'package_active');
54         } elseif (isPostRequestParameterSet('edit')) {
55                 // Delete entries (with confirmation)
56                 adminEditEntriesConfirm(
57                         postRequestParameter('id'),
58                         'bank_packages',
59                         array('id', 'title', 'description', 'account_fee', 'free_transfers', 'transfer_fee', 'output_system_mode', 'package_active', 'free_months_no_fee', 'interest_plus', 'interest_minus', 'first_payment', 'free_account_income', 'free_account_stuff', 'tan_lock'),
60                         array('bigintval', '', '', 'translateComma', 'bigintval', 'translateComma', '', '', 'bigintval', 'translateComma', 'translateComma', 'translateComma', 'translateComma', '', 'bigintval'),
61                         array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
62                 );
63                 $show = false;
64         } elseif (isPostRequestParameterSet('do_edit')) {
65                 // Delete entries (with confirmation)
66                 adminEditEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
67         } elseif (isPostRequestParameterSet('delete')) {
68                 // Delete entries (with confirmation)
69                 adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array('id', 'title', 'description', 'account_fee'), array('bigintval', '', '', 'translateComma'), array('', '', '', ''));
70                 $show = false;
71         } elseif (isPostRequestParameterSet('remove')) {
72                 // Delete entries (with confirmation)
73                 adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
74         }
75 } // END - if
76
77 // Skip showing old entries?
78 if ($show === false) return;
79
80 // Load all banking packages from DB
81 $result = SQL_QUERY("SELECT id, title, description, account_fee AS 'fee', package_active AS 'active', interest_plus AS 'plus', interest_minus AS 'minus'
82 FROM `{?_MYSQL_PREFIX?}_bank_packages`
83 ORDER BY `id`", __FILE__, __LINE__);
84
85 // Is there at lease one package?
86 if (SQL_NUMROWS($result) > 0) {
87         // List all packages
88         $OUT = ''; $SW = 2;
89         while ($content = SQL_FETCHARRAY($result)) {
90                 // "Translate" some data
91                 $content['active'] = translateYesNo($content['active']);
92                 $content['fee']    = translateComma($content['fee']);
93                 $content['plus']   = translateComma($content['plus']);
94                 $content['minus']  = translateComma($content['minus']);
95                 $content['sw']     = $SW;
96
97                 // Load row template
98                 $OUT .= loadTemplate('admin_list_bank_package_row', true, $content);
99                 $SW = 3 - $SW;
100         } // END - while
101
102         // Load main template
103         loadTemplate('admin_list_bank_package', false, $OUT);
104 } else {
105         // No packages found!
106         loadTemplate('admin_settings_saved', false, getMessage('ADMIN_BANK_NO_PACKAGES_FOUND'));
107 }
108
109 // Free the result
110 SQL_FREERESULT($result);
111
112 //
113 ?>