Added admin management crons list with proper sorting.
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 26 Apr 2018 19:52:13 +0000 (15:52 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 26 Apr 2018 19:52:13 +0000 (15:52 -0400)
models/admin/management/cron.php
views/admin/management/cron.html

index 18b83dd..c68bb46 100644 (file)
@@ -101,8 +101,10 @@ class GlmMembersAdmin_management_cron
         // Loop through these actions and call what's appropriate for the current time
         if (is_array($cronActions)) {
             if (count($cronActions) > 0) {
+
                 $haveCronActions = true;
 
+                // Sort list by menu then action
                 function sortCrons($a, $b) {
                     if ($a['menu'] < $b['menu']) { return -1; }
                     if ($a['menu'] > $b['menu']) { return 1; }
@@ -110,12 +112,9 @@ class GlmMembersAdmin_management_cron
                     if ($a['action'] > $b['action']) { return 1; }
                     return 0;
                 }
-
                 usort($cronActions, 'sortCrons');
 
             }
-        } else {
-            trigger_error('GLM Associate Cron: Bad request array!', E_USER_WARNING);
         }
 
         $viewData = array(
index 7d30ad5..a632873 100644 (file)
@@ -3,6 +3,7 @@
    <h2>Current Cron Action Requests</h2>
    <div>&nbsp;</div>
     
+{if $haveCronActions}    
     <table width="90%">
         <thead>
             <tr>
             </tr>
         </thead>        
         <tbody>
-{$m = ''}        
-{foreach $cronActions as $ca}
+    {$m = ''}        
+    {foreach $cronActions as $ca}
             <tr>        
                 <td>
-    {if $ca.menu != $m}                
-        {$m = $ca.menu}        
+        {if $ca.menu != $m}                
+            {$m = $ca.menu}        
                     {$ca.menu}
-    {/if}
+        {/if}
                 </td>
                 <td>{$ca.action}</td>
                 <td>
                     {if $ca.params}Yes{else}&nbsp;{/if}
                 </td>
             </tr>  
-{/foreach}            
+    {/foreach}            
         </tbody>    
     </table>
-    
+{else}
+    <p>(No cron action requests listed)</p>
+{/if}    
     
         
 {include file='admin/footer.html'}