]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/network_functions.php
detectExtraTemplatePath() cached, ext-network continued:
[mailer.git] / inc / libs / network_functions.php
index e90f6340229a7e983c64b1b92569ef7e399003a6..dfa15112c76a72414f199c3333b1d351ea9062b9 100644 (file)
@@ -139,6 +139,42 @@ function doAdminRemoveNetworkEntry ($table, $column, $id, $limit = 1) {
        return SQL_AFFECTEDROWS();
 }
 
+// Generates a list of networks for given script and returns it
+function generateAdminNetworkList () {
+       // Init output
+       $content = '';
+
+       // Query for all networks
+       $result = SQL_QUERY("SELECT
+       `network_id`, `network_title`
+FROM
+       `{?_MYSQL_PREFIX?}_network_data`
+ORDER BY
+       `network_title` ASC", __FILE__, __LINE__);
+
+       // Do we have entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // List all entries
+               $rows = array();
+               while ($row = SQL_FETCHARRAY($result)) {
+                       // Is this valid, then add it
+                       if ((is_array($row)) && (isset($row['network_id']))) $rows[] = $row;
+               } // END - while
+
+               // Generate the selection box
+               $content = generateSelectionBoxFromArray($rows, 'network', 'network_id', 'network_title');
+       } else {
+               // Nothing selected
+               $content = loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ENTRIES_404'));
+       }
+
+       // Free the result
+       SQL_FREERESULT($result);
+
+       // Return the list
+       return $content;
+}
+
 //------------------------------------------------------------------------------
 //                             Call-back functions
 //------------------------------------------------------------------------------