]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_cats.php
Continued a bit:
[mailer.git] / inc / modules / admin / what-list_cats.php
index de20d59bf14a8e505208c52a5d75585f7519e0c5..9c170d0f5c07da921854a1838c46824e4cb4d01d 100644 (file)
@@ -44,9 +44,6 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-// Init variable to avoid a notice
-$CATS = '';
-
 if (isFormSent('add')) {
        // Default message
        $content = '<span class="bad">{--CATEGORY_ALREADY_EXISTS--}</span>';
@@ -117,11 +114,11 @@ if (isFormSent('add')) {
        $OUT = '';
        foreach (postRequestElement('sel') as $id => $value) {
                // Load row template and switch colors
-               $OUT .= loadTemplate('admin_delete_cats_row', TRUE, $id);
+               $OUT .= loadTemplate('admin_delete_categories_row', TRUE, $id);
        } // END - foreach
 
        // Load main template
-       loadTemplate('admin_delete_cats', FALSE, $OUT);
+       loadTemplate('admin_delete_categories', FALSE, $OUT);
 } elseif ((isFormSent('edit')) && (ifPostContainsSelections())) {
        // Edit categories
        $OUT = '';
@@ -138,14 +135,14 @@ if (isFormSent('add')) {
                $content['visible_selection'] = addSelectionBox('yn', $content['visible'], 'visible', $content['id']);
 
                // Load row template and switch colors
-               $OUT .= loadTemplate('admin_edit_cats_row', TRUE, $content);
+               $OUT .= loadTemplate('admin_edit_categories_row', TRUE, $content);
        } // END - foreach
 
        // Load main template
-       loadTemplate('admin_edit_cats', FALSE, $OUT);
+       loadTemplate('admin_edit_categories', FALSE, $OUT);
 } else {
        // Init variable here
-       $CATS = '';
+       $categoryOptions = '';
 
        // Load all categories
        $result = sqlQuery("SELECT
@@ -164,26 +161,30 @@ ORDER BY
 
                // List already existing categories for editing
                while ($content = sqlFetchArray($result)) {
-                       // Put cat descriptions into variable for the selection box
-                       if (strlen($content['cat']) > 40) $content['cat'] = substr($content['cat'], 0, 37) . '...';
-                       $CATS .= '<option value="' . $content['sort'] . '">' . $content['cat'] . '</option>';
+                       // Is the category's name to long?
+                       if (strlen($content['cat']) > 40) {
+                               // Put cat descriptions into variable for the selection box
+                               $content['cat'] = substr($content['cat'], 0, 37) . '...';
+                       } // END - if
+
+                       $categoryOptions .= '<option value="' . $content['sort'] . '">' . $content['cat'] . '</option>';
 
                        // Load row template and switch color
-                       $OUT .= loadTemplate('admin_list_cats_row', TRUE, $content);
+                       $OUT .= loadTemplate('admin_list_categories_row', TRUE, $content);
                } // END - while
 
                // Free memory
                sqlFreeResult($result);
 
                // Load main template
-               loadTemplate('admin_list_cats', FALSE, $OUT);
+               loadTemplate('admin_list_categories', FALSE, $OUT);
        } // END - if
 
        // Remember in array
-       $content['cats'] = $CATS;
+       $content['cats'] = $categoryOptions;
 
        // Form to add a new category
-       loadTemplate('admin_add_cat', FALSE, $content);
+       loadTemplate('admin_add_category', FALSE, $content);
 }
 
 // [EOF]