]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-admins_mails.php
A lot code rewritten:
[mailer.git] / inc / modules / admin / what-admins_mails.php
index d29061a01ee36fd10d0198370e34662dff40bfeb..6873a5889edd11ad95947e928be4676aa90e3fd7 100644 (file)
@@ -45,12 +45,12 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
-if (isPostRequestParameterSet('edit')) {
+if (isFormSent('edit')) {
        // Check if entires are checked
        if (countPostSelection() > 0) {
                // Add option for events
                $adminsList = generateOptionList('admins', 'id', 'login', '', 'email');
-               $SW = 2; $rows = '';
+               $rows = '';
                foreach (postRequestParameter('sel') as $template => $sel) {
                        // First of all load data from DB
                        $result = SQL_QUERY_ESC("SELECT `admin_id`, `id` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `id` ASC",
@@ -58,18 +58,18 @@ if (isPostRequestParameterSet('edit')) {
                        $OUT = '';
                        $adminId2 = '0'; $id = '0';
                        while ($content = SQL_FETCHARRAY($result)) {
-                               // @TODO Can this be rewritten???
-                               $OUT .= "<select name=\"admin_id[".$content['id']."]\" size=\"1\" class=\"admin_select\">
-<option value=\"0\"";
+                               // @TODO Can this be rewritten to an API function?
+                               $OUT .= '<select name="admin_id[' . $content['id'] . ']" size="1" class="admin_select">
+<option value="0"';
                                if ($content['admin_id'] == '0') $OUT .= ' selected="selected"';
-                               $OUT .=">{--ADMINS_ALL_ADMINS--}</option>\n";
+                               $OUT .= '>{--ADMINS_ALL_ADMINS--}</option>';
                                if (isExtensionActive('events')) {
-                                       $OUT .= "<option value=\"-1\"";
+                                       $OUT .= '<option value="-1"';
                                        if ($content['admin_id'] == '-1') $OUT .= ' selected="selected"';
-                                       $OUT .= ">{--ADMINS_TO_USER_EVENTS--}</option>\n";
+                                       $OUT .= '>{--ADMINS_TO_USER_EVENTS--}</option>';
                                }
                                $OUT .= generateOptionList('admins', 'id', 'login', $content['admin_id'], 'email');
-                               $OUT .= "</select>\n<br />\n";
+                               $OUT .= '</select>';
 
                                // Transfer ids
                                $adminId2 = $content['admin_id'];
@@ -81,7 +81,6 @@ if (isPostRequestParameterSet('edit')) {
 
                        // Prepare content
                        $content['id']            = $id;
-                       $content['sw']            = $SW;
                        $content['mail_template'] = $template;
                        $content['admins']        = $adminsList;
 
@@ -95,14 +94,13 @@ if (isPostRequestParameterSet('edit')) {
 
                        // Start outputing line
                        $rows .= loadTemplate('admin_admins_mails_edit_row', true, $content);
-                       $SW = 3 - $SW;
-               }
+               } // END - foreach
 
                // Edit checked entries
                loadTemplate('admin_admins_mails_edit', false, $rows);
        } else {
                // Nothing selected
-               loadTemplate('admin_settings_saved', false, getMessage('ADMINS_NO_MAIL_CHECKED'));
+               loadTemplate('admin_settings_saved', false, '{--ADMINS_NO_MAIL_CHECKED--}');
        }
 } else {
        // Load all assigned mails
@@ -122,7 +120,7 @@ ORDER BY
 
        if (SQL_NUMROWS($result) > 0) {
                // Shall I change entries?
-               if (isPostRequestParameterSet('change')) {
+               if (isFormSent('change')) {
                        // Init SQLs
                        initSqls();
 
@@ -169,15 +167,10 @@ ORDER BY
                } // END - if
 
                // List found entries
-               $OUT = ''; $SW = 2;
+               $OUT = '';
                while ($content = SQL_FETCHARRAY($result)) {
-                       // Prepare content
-                       $content['sw']   = $SW;
-                       $content['alnk'] = generateAdminLink($content['admin_id']);
-
                        // Load row template
                        $OUT .= loadTemplate('admin_admins_mails_list_row', true, $content);
-                       $SW = 3 - $SW;
                } // END - while
 
                // Free result
@@ -187,7 +180,7 @@ ORDER BY
                loadTemplate('admin_admins_mails_list', false, $OUT);
        } else {
                // No entries found
-               loadTemplate('admin_settings_saved', false, getMessage('ADMINS_MAILS_NO_ENTRIES'));
+               loadTemplate('admin_settings_saved', false, '{--ADMINS_MAILS_NO_ENTRIES--}');
        }
 }