More rewrites to make use of (cached) wrapper functions
[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  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
22  * For more information visit: http://www.mxchange.org                  *
23  *                                                                      *
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.                                  *
28  *                                                                      *
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.                         *
33  *                                                                      *
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,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
42         die();
43 } // END - if
44
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
47
48 // Check if there is enougth selected
49 $show = true;
50 if ((isPostRequestParameterSet('id')) && (is_array(postRequestParameter('id'))) && (count(postRequestParameter('id')) > 0)) {
51         // Okay, which button was pressed?
52         if (isFormSent('change')) {
53                 // Change permissions
54                 adminChangeActivationStatus(postRequestParameter('id'), 'bank_packages', 'package_active');
55         } elseif (isFormSent('edit')) {
56                 // Delete entries (with confirmation)
57                 adminEditEntriesConfirm(
58                         postRequestParameter('id'),
59                         'bank_packages',
60                         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'),
61                         array('bigintval', '', '', 'translateComma', 'bigintval', 'translateComma', '', '', 'bigintval', 'translateComma', 'translateComma', 'translateComma', 'translateComma', '', 'bigintval'),
62                         array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
63                 );
64                 $show = false;
65         } elseif (isPostRequestParameterSet('do_edit')) {
66                 // Delete entries (with confirmation)
67                 adminEditEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
68         } elseif (isPostRequestParameterSet('delete')) {
69                 // Delete entries (with confirmation)
70                 adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array('id', 'title', 'description', 'account_fee'), array('bigintval', '', '', 'translateComma'), array('', '', '', ''));
71                 $show = false;
72         } elseif (isFormSent('remove')) {
73                 // Delete entries (with confirmation)
74                 adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
75         }
76 } // END - if
77
78 // Skip showing old entries?
79 if ($show === false) return;
80
81 // Load all banking packages from DB
82 $result = SQL_QUERY("SELECT
83         `id`, `title`, `description`, `account_fee`, `package_active`, `interest_plus`, `interest_minus`
84 FROM
85         `{?_MYSQL_PREFIX?}_bank_packages`
86 ORDER BY
87         `id` ASC", __FILE__, __LINE__);
88
89 // Is there at lease one package?
90 if (!SQL_HASZERONUMS($result)) {
91         // List all packages
92         $OUT = '';
93         while ($content = SQL_FETCHARRAY($result)) {
94                 // Load row template
95                 $OUT .= loadTemplate('admin_list_bank_package_row', true, $content);
96         } // END - while
97
98         // Load main template
99         loadTemplate('admin_list_bank_package', false, $OUT);
100 } else {
101         // No packages found!
102         loadTemplate('admin_settings_saved', false, '{--ADMIN_BANK_NO_PACKAGES_FOUND--}');
103 }
104
105 // Free the result
106 SQL_FREERESULT($result);
107
108 // [EOF]
109 ?>