Adding of network advert types partly finished, hard-coded table type fixed to dynamic
[mailer.git] / inc / modules / admin / what-list_network_types.php
index 4e856c6..41daad9 100644 (file)
@@ -44,11 +44,50 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
+// Handle form here
+doNetworkHandleForm();
+
 // Do we have a network selected?
 if (isGetRequestElementSet('network')) {
        // Get its data for template
        $networkData = getNetworkDataById(getRequestElement('network'));
-       print('<pre>'.print_r($networkData, true).'</pre>');
+
+       // Load all advert types for given network
+       $result = SQL_QUERY_ESC("SELECT
+       `network_type_id`, `network_type_handle`, `network_type_request_url`, `network_type_click_url`, `network_type_banner_url`
+FROM
+       `{?_MYSQL_PREFIX?}_network_types`
+WHERE
+       `network_id`=%s
+ORDER BY
+       `network_type_id` ASC",
+               array(getRequestElement('network')), __FILE__, __LINE__);
+
+       // Do we have entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // List all entries
+               $OUT = ''; $SW = 2;
+               while ($row = SQL_FETCHARRAY($result)) {
+                       // Add/translate some data
+                       $row['sw'] = $SW;
+
+                       // Add row template and switch color
+                       $OUT .= loadTemplate('admin_list_network_types_row', true, $row);
+                       $SW = 3 - $SW;
+               } // END - while
+
+               // Load main template
+               loadTemplate('admin_list_network_types', false, $OUT);
+       } else {
+               // No entries found
+               loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_NETWORK_TYPES_404'), $networkData['network_title']));
+       }
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Add form for adding new types
+       loadTemplate('admin_add_network_type', false, $networkData);
 } else {
        // Generate network list for this script
        outputHtml(generateAdminNetworkList());