Adding the fields into management page for duration and events.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Aug 2016 18:57:45 +0000 (14:57 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Aug 2016 18:57:45 +0000 (14:57 -0400)
The two fields for ical feed now display in the management list of
feeds. Duration - show hour min sec in template. Events showing how many
insert or updates where done.

models/front/events/icalFeedImport.php
views/admin/management/events.html

index e3a5397..c4cfb11 100644 (file)
@@ -196,8 +196,9 @@ class GlmMembersFront_events_icalFeedImport
                     $event_id  = $this->wpdb->insert_id;
                 }
                 if ( !$event_id ) {
-                    die('something is wrong no event_id');
+                    continue;
                 }
+                ++$number_events;
                 // generate the slug name for this new event
                 $event_abstract = new GlmDataEvents( $this->wpdb, $this->config );
                 $event_abstract->updateSlug( $event_id );
@@ -389,7 +390,6 @@ class GlmMembersFront_events_icalFeedImport
                 );
                 $recurr_id    = $this->wpdb->insert_id;
                 $Recurrences->createRecurrenceTimesEntries( $recurr_id, true, true );
-                ++$number_events;
             }
         }
         if ( !$debug ) {
index c8d5da5..90912cb 100644 (file)
                             <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>{if $feed.duration}
+                                    {***************************************************************************************
+                                    Calculate the duration time in hour:min:sec
+                                    hour = time / 3600
+                                    min  = (time / 60) % 60
+                                    sec  = time % 60
+                                    The smarty way of doing things!
+                                    ****************************************************************************************}
+                                    {math assign="t_hours" equation="t_time / 3600" t_time=$feed.duration format="%d"}
+                                    {math assign="t_minutes" equation="(t_time / 60) % 60" t_time=$feed.duration format="%d"}
+                                    {math assign="t_seconds" equation="t_time % 60" t_time=$feed.duration format="%d"}
+
+                                    {$t_hours}:{$t_minutes}:{$t_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>