Add categories and date time to export.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 2 Apr 2018 19:35:11 +0000 (15:35 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 2 Apr 2018 19:35:11 +0000 (15:35 -0400)
Categories (one per column)
date and time in starting_date and ending_date columns.

models/admin/ajax/eventsListExport.php
views/admin/ajax/eventsListExport.html
views/admin/ajax/eventsListExportCsv.html

index 6c134a2..a0e0223 100644 (file)
@@ -232,10 +232,22 @@ class GlmMembersAdmin_ajax_eventsListExport extends GlmDataEvents
             ";
         }
 
+        // Get a list of event categories
+        $sql = "
+        SELECT C.id,C.name,C.parent,
+            COALESCE ((SELECT name
+                   FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "categories
+                  WHERE id = C.parent), '') AS parent_name
+          FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "categories C
+        ORDER BY C.parent,C.name";
+        $category_data = $this->wpdb->get_results( $sql, ARRAY_A );
+
         // Get a current list of events without paging
-        $orderBy = "(select min(start_time) FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times WHERE T.id = event),name";
+        $orderBy                = "(select min(start_time) FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times WHERE T.id = event),name";
         $this->postCategories   = true;
         $this->postAddLocations = true;
+        $this->postAddTimes     = true;
+
         $list = $this->getList( $where, $orderBy, true );
 
         // If we have list entries - even if it's an empty list
index ef8c265..14f41d7 100644 (file)
@@ -14,6 +14,8 @@
                     {if $select.exportName}<th align="left">Event Name</th>{/if}
                     {if $select.exportMember}<th align="left">{$terms.term_member_cap} Name</th>{/if}
                     {if $select.exportStatus}<th align="left">Status</th>{/if}
+                    <th>Starting Date</th>
+                    <th>Ending Date</th>
                     {if $select.exportFeatured}<th align="left">Featured</th>{/if}
                     {if $select.exportIntro}<th align="left">Intro</th>{/if}
                     {if $select.exportDescr}<th align="left">Description</th>{/if}
@@ -53,6 +55,8 @@
                     {if $select.exportName}<td>{$event.name}</td>{/if}
                     {if $select.exportMember}<td>{$event.ref_dest}</td>{/if}
                     {if $select.exportStatus}<td>{$event.status.name}</td>{/if}
+                    <td>{$event.starting_date}</td>
+                    <td>{$event.ending_date}</td>
                     {if $select.exportFeatured}<td>{$event.featured.name}</td>{/if}
                     {if $select.exportIntro}<td>{$event.intro}</td>{/if}
                     {if $select.exportDescr}<td>{$event.descr}</td>{/if}
index 7238fad..75c0b9c 100644 (file)
@@ -1,10 +1,8 @@
 {if $haveEvents}
-
 {if $select.exportId}"ID",{/if}
 {if $select.exportName}"Event Name",{/if}
 {if $select.exportMember}"{$terms.term_member_cap} Name",{/if}
-{if $select.exportStatus}"Status",{/if}
-{if $select.exportFeatured}"Featured",{/if}
+{if $select.exportStatus}"Status",{/if} "Starting Date", "Ending Date", {if $select.exportFeatured}"Featured",{/if}
 {if $select.exportIntro}"Intro",{/if}
 {if $select.exportDescr}"Description",{/if}
 {if $select.exportFree}"Free",{/if}
@@ -32,8 +30,7 @@
 {if $select.exportId}"{$event.id}",{/if}
 {if $select.exportName}"{$event.name}",{/if}
 {if $select.exportMember}"{$event.ref_dest}",{/if}
-{if $select.exportStatus}"{$event.status.name}",{/if}
-{if $select.exportFeatured}"{$event.featured.value}",{/if}
+{if $select.exportStatus}"{$event.status.name}",{/if} "{$event.starting_date}", "{$event.ending_date}", {if $select.exportFeatured}"{$event.featured.name}",{/if}
 {if $select.exportIntro}"{$event.intro}",{/if}
 {if $select.exportDescr}"{$event.descr}",{/if}
 {if $select.exportFree}"{$event.free}",{/if}