4f8ce1d7a3f13116a679259fd97e7c643037e94c
[mailer.git] / inc / modules / admin / what-list_bank_package.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    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  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 } // END - if
39
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
42
43 // Check if there is enougth selected
44 $show = true;
45 if ((isset($_POST['id'])) && (is_array($_POST['id'])) && (count($_POST['id']) > 0)) {
46         // Okay, which button was pressed?
47         if (isset($_POST['change'])) {
48                 // Change permissions
49                 ADMIN_CHANGE_ACTIVATION_STATUS($_POST['id'], "bank_packages", "package_active");
50         } elseif (isset($_POST['edit'])) {
51                 // Delete entries (with confirmation)
52                 ADMIN_EDIT_ENTRIES_CONFIRM(
53                         $_POST['id'],
54                         "bank_packages",
55                         "package_active",
56                         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"),
57                         array("bigintval", "", "", "TRANSLATE_COMMA", "bigintval", "TRANSLATE_COMMA", "", "", "bigintval", "TRANSLATE_COMMA", "TRANSLATE_COMMA", "TRANSLATE_COMMA", "TRANSLATE_COMMA", "", "bigintval")
58                 );
59                 $show = false;
60         } elseif (isset($_POST['do_edit'])) {
61                 // Delete entries (with confirmation)
62                 ADMIN_EDIT_ENTRIES_CONFIRM($_POST['id'], "bank_packages", "package_active", array(), array(), true);
63         } elseif (isset($_POST['delete'])) {
64                 // Delete entries (with confirmation)
65                 ADMIN_DELETE_ENTRIES_CONFIRM($_POST['id'], "bank_packages", "package_active", array("id", "title", "description", "account_fee"), array("bigintval", "", "", "TRANSLATE_COMMA"));
66                 $show = false;
67         } elseif (isset($_POST['remove'])) {
68                 // Delete entries (with confirmation)
69                 ADMIN_DELETE_ENTRIES_CONFIRM($_POST['id'], "bank_packages", "package_active", array(), array(), true);
70         }
71 } // END - if
72
73 // Skip showing old entries?
74 if (!$show) return;
75
76 // Load all banking packages from DB
77 $result = SQL_QUERY("SELECT id, title, description, account_fee AS 'fee', package_active AS 'active', interest_plus AS 'plus', interest_minus AS 'minus'
78 FROM "._MYSQL_PREFIX."_bank_packages
79 ORDER BY id", __FILE__, __LINE__);
80
81 // Is there at lease one package?
82 if (SQL_NUMROWS($result) > 0) {
83         // List all packages
84         $OUT = ""; $SW = 2;
85         while ($content = SQL_FETCHARRAY($result)) {
86                 // "Translate" some data
87                 $content['active'] = TRANSLATE_YESNO($content['active']);
88                 $content['fee']    = TRANSLATE_COMMA($content['fee']);
89                 $content['plus']   = TRANSLATE_COMMA($content['plus']);
90                 $content['minus']  = TRANSLATE_COMMA($content['minus']);
91                 $content['sw']     = $SW;
92
93                 // Load row template
94                 $OUT .= LOAD_TEMPLATE("admin_list_bank_package_row", true, $content);
95                 $SW = 3 - $SW;
96         } // END - while
97
98         // Prepare row(s) for output to template
99         define('__BANK_PACKAGE_ROWS', $OUT);
100
101         // Load main template
102         LOAD_TEMPLATE("admin_list_bank_package");
103 } else {
104         // No packages found!
105         LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BANK_NO_PACKAGES_FOUND);
106 }
107
108 // Free the result
109 SQL_FREERESULT($result);
110
111 //
112 ?>