Add the two fields into the management page.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Aug 2016 18:12:31 +0000 (14:12 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Aug 2016 18:12:31 +0000 (14:12 -0400)
So we can see them with their feeds.

classes/data/dataFeedImport.php
models/front/events/icalFeedImport.php
views/admin/management/events.html

index 4444d18..343199b 100644 (file)
@@ -126,7 +126,7 @@ class GlmDataFeedImport extends GlmDataAbstract
             'feed_url' => array (
                 'field' => 'feed_url',
                 'type'  => 'text',
-                'use'  => 'a'
+                'use'   => 'a'
             ),
 
             // Created Date
@@ -140,7 +140,21 @@ class GlmDataFeedImport extends GlmDataAbstract
             'phone' => array (
                 'field' => 'updated',
                 'type'  => 'text',
-                'use'  => 'a'
+                'use'   => 'a'
+            ),
+
+            // Duration
+            'duration' => array(
+                'field' => 'duration',
+                'type'  => 'integer',
+                'use'   => 'a'
+            ),
+
+            // Events
+            'events' => array(
+                'field' => 'events',
+                'type'  => 'integer',
+                'use'   => 'a'
             ),
 
          );
index 79d3761..e3a5397 100644 (file)
@@ -49,6 +49,7 @@ class GlmMembersFront_events_icalFeedImport
     }
     public function importIcalFeed( $feed_id )
     {
+        $start_timer   = time();
         $debug         = false;
         $clear_data    = false;
         $number_events = 0;
@@ -394,6 +395,18 @@ class GlmMembersFront_events_icalFeedImport
         if ( !$debug ) {
             $out = $number_events . ' events imported';
         }
+        $end_timer = time();
+        $this->wpdb->update(
+            GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'feed_import',
+            array(
+                'events'   => $number_events,
+                'duration' => $end_timer - $start_timer
+            ),
+            array( 'id' => $feed_id ),
+            '%d',
+            '%d'
+        );
+
         return $out;
     }
     public function fetchIcalFile( $url )
index 29be050..c8d5da5 100644 (file)
                         <th>Created Date</th>
                         <th>Updated Date</th>
                         <th>Next Run</th>
+                        <th>Events</th>
+                        <th>Duration</th>
                         <th>&nbsp;</th>
                     </tr>
                     {if $import_feeds}
                         {foreach $import_feeds as $key => $feed}
                         <tr>
-                            <td><a href="{$thisUrl}?page={$thisPage}&glm_action=events&option=icalfeed&option2=refresh&id={$feed.id}" class="button">Refresh</a></td>
+                            <td>
+                                <a href="{$thisUrl}?page={$thisPage}&glm_action=events&option=icalfeed&option2=refresh&id={$feed.id}" class="button">Refresh</a>
+                                <a href="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=icalFeedImport&id={$feed.id}">Bump the cron</a>
+                            </td>
                             <td>{$feed.feed_url}</td>
                             <td>{$feed.created}</td>
                             <td>{$feed.updated}</td>
                             <td>{$feed.next_runtime|date_format:"%F %T"}</td>
+                            <td>{$feed.events}</td>
+                            <td>{if $feed.duration}{$feed.duration} Seconds{/if}</td>
                             <td><a href="{$thisUrl}?page={$thisPage}&glm_action=events&option=icalfeed&option2=delete&id={$feed.id}"
                                    onClick="return confirm('This cannot be undone!\nAre you sure?')" class="button">Delete</a></td>
                         </tr>