Even more rewrites to make use of the EL
[mailer.git] / inc / modules / admin / what-list_network_translations.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 06/01/2010 *
4  * ===================                          Last change: 06/01/2010 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_network_translations.php               *
8  * -------------------------------------------------------------------- *
9  * Short description : List/manage network array translations           *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Verwaltet API-Abfrageparameter                   *
12  * -------------------------------------------------------------------- *
13  * $Revision:: 1794                                                   $ *
14  * $Date:: 2010-05-28 19:55:19 +0200 (Fri, 28 May 2010)               $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author:: quix0r                                                   $ *
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 // These are expert settings!
49 if (doVerifyExpertSettings() != 'agreed') {
50         // Abort here
51         return;
52 } // END - if
53
54 // By default we should display list/add new forms
55 $GLOBALS['network_display'] = true;
56
57 // Handle form here
58 doNetworkHandleForm();
59
60 // Display forms?
61 if ($GLOBALS['network_display'] === false) {
62         // Abort here
63         return;
64 } // END - if
65
66 // Do we have a network selected?
67 if (isGetRequestParameterSet('network_type')) {
68         // Get network data from given type-id
69         $networkData = getNetworkDataByTypeId(getRequestParameter('network_type'));
70
71         // Init disabled list
72         $GLOBALS['network_translations_disabled'] = array();
73
74         // Load all advert codes for given network
75         $result = SQL_QUERY("SELECT
76         `network_translate_id`, `network_type_id`, `network_translation`
77 FROM
78         `{?_MYSQL_PREFIX?}_network_translations`
79 ORDER BY
80         `network_translate_id` ASC", __FILE__, __LINE__);
81
82         // Remember the rows
83         $rows = SQL_NUMROWS($result);
84
85         // Do we have entries?
86         if ($rows > 0) {
87                 // List all entries
88                 $OUT = ''; $SW = 2;
89                 while ($row = SQL_FETCHARRAY($result)) {
90                         // Add color switching
91                         $row['sw'] = $SW;
92
93                         // Add it to network if the type matches selected
94                         if ($row['network_type_id'] == getRequestParameter('network_type_id')) {
95                                 // Matches, then add it for disabling this entry
96                                 $GLOBALS['network_translations_disabled'][$row['network_array_index']] = true;
97                         } // END - if
98
99                         // Add row template and switch color
100                         $OUT .= loadTemplate('admin_list_network_translations_row', true, $row);
101                         $SW = 3 - $SW;
102                 } // END - while
103
104                 // Prepare data for template
105                 $content = array(
106                         'rows' => $OUT,
107                 );
108
109                 // Load main template
110                 loadTemplate('admin_list_network_translations', false, $content);
111         } else {
112                 // No entries found
113                 loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_TRANSLATIONS_404', $networkData['network_type_handle']));
114         }
115
116         // Free result
117         SQL_FREERESULT($result);
118
119         // Add form for adding new translations pair
120         loadTemplate('admin_add_network_translations');
121 } else {
122         // Generate type-selection box
123         outputHtml(generateAdminDistinctNetworkTypeList());
124 }
125
126 // [EOF]
127 ?>