New generic template added (new CSS classes), some inconsistencies fixed:
[mailer.git] / inc / modules / admin / what-list_network_types.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 11/11/2009 *
4  * ===================                          Last change: 11/11/2009 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_network_types.php                      *
8  * -------------------------------------------------------------------- *
9  * Short description : List/manage network advertising types            *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Verwaltet Werbearten                             *
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 // These are expert settings!
48 if (doVerifyExpertSettings() != 'agreed') {
49         // Abort here
50         return;
51 } // END - if
52
53 // By default we should display list/add new forms
54 $GLOBALS['network_display'] = true;
55
56 // Handle form here
57 doNetworkHandleForm();
58
59 // Display forms?
60 if ($GLOBALS['network_display'] === false) {
61         // Abort here
62         return;
63 } // END - if
64
65 // Do we have a network selected?
66 if (isGetRequestParameterSet('network')) {
67         // Get its data for template
68         $networkData = getNetworkDataById(getRequestParameter('network'));
69
70         // Init disabled list
71         $networkData['disabled'] = array();
72
73         // Load all advert types for given network
74         $result = SQL_QUERY_ESC("SELECT
75         `network_type_id`, `network_type_handle`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`
76 FROM
77         `{?_MYSQL_PREFIX?}_network_types`
78 WHERE
79         `network_id`=%s
80 ORDER BY
81         `network_type_handle` ASC",
82                 array(getRequestParameter('network')), __FILE__, __LINE__);
83
84         // Do we have entries?
85         if (SQL_NUMROWS($result) > 0) {
86                 // List all entries
87                 $OUT = ''; $SW = 2;
88                 while ($row = SQL_FETCHARRAY($result)) {
89                         // Add/translate some data
90                         $row['sw'] = $SW;
91                         if (trim($row['network_type_banner_url']) == '') $row['network_type_banner_url'] = '---';
92
93                         // Set disabled entry
94                         $networkData['disabled'][$row['network_type_handle']] = true;
95
96                         // Add row template and switch color
97                         $OUT .= loadTemplate('admin_list_network_types_row', true, $row);
98                         $SW = 3 - $SW;
99                 } // END - while
100
101                 // Prepare data for template
102                 $content = array(
103                         'rows'            => $OUT,
104                         'network_id'      => getRequestParameter('network'),
105                         'network_title'   => $networkData['network_title'],
106                         'network_reflink' => $networkData['network_reflink'],
107                 );
108
109                 // Load main template
110                 loadTemplate('admin_list_network_types', false, $content);
111         } else {
112                 // No entries found
113                 loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_TYPES_404', $networkData['network_title']));
114         }
115
116         // Free result
117         SQL_FREERESULT($result);
118
119         // Add type option list
120         $networkData['type_options'] = generateOptionList(
121                 '/ARRAY/',
122                 array(
123                         'banner',
124                         'banner_click',
125                         'banner_view',
126                         'button',
127                         'button_click',
128                         'button_view',
129                         'surfbar',
130                         'surfbar_click',
131                         'surfbar_view',
132                         'focredbanner',
133                         'forcedtextlink',
134                         'textlink',
135                         'textlink_click',
136                         'textlink_view',
137                         'skybanner',
138                         'skybanner_click',
139                         'skybanner_view',
140                         'layer',
141                         'layer_click',
142                         'layer_view',
143                         'popup',
144                         'popdown',
145                         'textmail',
146                         'htmlmail',
147                         'lead',
148                         'sale',
149                         'payperactive',
150                         'pagepeel'
151                 ),
152                 array(
153                         '{--ADMIN_NETWORK_TYPES_BANNER_CLICK_VIEW--}',
154                         '{--ADMIN_NETWORK_TYPES_BANNER_CLICK--}',
155                         '{--ADMIN_NETWORK_TYPES_BANNER_VIEW--}',
156                         '{--ADMIN_NETWORK_TYPES_BUTTON_CLICK_VIEW--}',
157                         '{--ADMIN_NETWORK_TYPES_BUTTON_CLICK--}',
158                         '{--ADMIN_NETWORK_TYPES_BUTTON_VIEW--}',
159                         '{--ADMIN_NETWORK_TYPES_SURFBAR_CLICK_VIEW--}',
160                         '{--ADMIN_NETWORK_TYPES_SURFBAR_CLICK--}',
161                         '{--ADMIN_NETWORK_TYPES_SURFBAR_VIEW--}',
162                         '{--ADMIN_NETWORK_TYPES_FORCED_BANNER--}',
163                         '{--ADMIN_NETWORK_TYPES_FORCED_TEXTLINK--}',
164                         '{--ADMIN_NETWORK_TYPES_TEXTLINK_CLICK_VIEW--}',
165                         '{--ADMIN_NETWORK_TYPES_TEXTLINK_CLICK--}',
166                         '{--ADMIN_NETWORK_TYPES_TEXTLINK_VIEW--}',
167                         '{--ADMIN_NETWORK_TYPES_SKYBANNER_CLICK_VIEW--}',
168                         '{--ADMIN_NETWORK_TYPES_SKYBANNER_CLICK--}',
169                         '{--ADMIN_NETWORK_TYPES_SKYBANNER_VIEW--}',
170                         '{--ADMIN_NETWORK_TYPES_LAYER_CLICK_VIEW--}',
171                         '{--ADMIN_NETWORK_TYPES_LAYER_CLICK--}',
172                         '{--ADMIN_NETWORK_TYPES_LAYER_VIEW--}',
173                         '{--ADMIN_NETWORK_TYPES_POPUP--}',
174                         '{--ADMIN_NETWORK_TYPES_POPDOWN--}',
175                         '{--ADMIN_NETWORK_TYPES_TEXTMAIL--}',
176                         '{--ADMIN_NETWORK_TYPES_HTMLMAIL--}',
177                         '{--ADMIN_NETWORK_TYPES_LEAD--}',
178                         '{--ADMIN_NETWORK_TYPES_SALE--}',
179                         '{--ADMIN_NETWORK_TYPES_PAYPERACTIVE--}',
180                         '{--ADMIN_NETWORK_TYPES_PAGEPEEL--}'
181                 ),
182                 '', '', '',
183                 $networkData['disabled']
184         );
185
186         // Add form for adding new types
187         loadTemplate('admin_add_network_type', false, $networkData);
188 } else {
189         // Generate network list for this script
190         outputHtml(generateAdminNetworkList());
191 }
192
193 // [EOF]
194 ?>