Renamed function so it might be more understandable
[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  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
20  * For more information visit: http://www.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 // Check if there is enougth selected
47 $show = true;
48 if ((isPostRequestParameterSet('id')) && (is_array(postRequestParameter('id'))) && (count(postRequestParameter('id')) > 0)) {
49         // Okay, which button was pressed?
50         if (isFormSent('change')) {
51                 // Change permissions
52                 adminChangeActivationStatus(postRequestParameter('id'), 'bank_packages', 'package_active');
53         } elseif (isFormSent('edit')) {
54                 // Delete entries (with confirmation)
55                 adminEditEntriesConfirm(
56                         postRequestParameter('id'),
57                         'bank_packages',
58                         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'),
59                         array('bigintval', '', '', 'translateComma', 'bigintval', 'translateComma', '', '', 'bigintval', 'translateComma', 'translateComma', 'translateComma', 'translateComma', '', 'bigintval'),
60                         array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '')
61                 );
62                 $show = false;
63         } elseif (isPostRequestParameterSet('do_edit')) {
64                 // Delete entries (with confirmation)
65                 adminEditEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
66         } elseif (isPostRequestParameterSet('delete')) {
67                 // Delete entries (with confirmation)
68                 adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array('id', 'title', 'description', 'account_fee'), array('bigintval', '', '', 'translateComma'), array('', '', '', ''));
69                 $show = false;
70         } elseif (isFormSent('remove')) {
71                 // Delete entries (with confirmation)
72                 adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true);
73         }
74 } // END - if
75
76 // Skip showing old entries?
77 if ($show === false) return;
78
79 // Load all banking packages from DB
80 $result = SQL_QUERY("SELECT
81         `id`, `title`, `description`, `account_fee`, `package_active`, `interest_plus`, `interest_minus`
82 FROM
83         `{?_MYSQL_PREFIX?}_bank_packages`
84 ORDER BY
85         `id` ASC", __FILE__, __LINE__);
86
87 // Is there at lease one package?
88 if (!SQL_HASZERONUMS($result)) {
89         // List all packages
90         $OUT = '';
91         while ($content = SQL_FETCHARRAY($result)) {
92                 // Load row template
93                 $OUT .= loadTemplate('admin_list_bank_package_row', true, $content);
94         } // END - while
95
96         // Load main template
97         loadTemplate('admin_list_bank_package', false, $OUT);
98 } else {
99         // No packages found!
100         loadTemplate('admin_settings_saved', false, '{--ADMIN_BANK_NO_PACKAGES_FOUND--}');
101 }
102
103 // Free the result
104 SQL_FREERESULT($result);
105
106 // [EOF]
107 ?>