making progress with the modal export form
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 1 Oct 2018 20:40:45 +0000 (16:40 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 1 Oct 2018 20:40:45 +0000 (16:40 -0400)
models/admin/export/index.php
setup/adminHooks.php
views/admin/export/index.html
views/admin/newDashboard/components/buttons.html
views/admin/newDashboard/components/modal.html
views/admin/newDashboard/index.html

index 5d478bb..1460757 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Gaslight Media Members Database
- * Admin File Library Upload
+ * Admin Members Export
  *
  * PHP version 5.5
  *
@@ -13,7 +13,6 @@
  * @link     http://dev.gaslightmedia.com/
  */
 
-require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataFileLibrary.php';
 
 /*
  * This model is called when the "Shortcodes" menu is selected
@@ -65,7 +64,7 @@ class GlmMembersAdmin_export_index
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct(false, false);
+        // parent::__construct(false, false);
 
     }
 
index 5941029..ac5ca93 100644 (file)
@@ -433,7 +433,13 @@ add_filter(
                             'classes'   => '',
                             'data'      => '',
                             'styles'    => ''
-                            
+                        ],
+                        'export-member' => [
+                            'content'       => 'Export',
+                            'url'           => '#',
+                            'classes'       => 'btn-small widget-export-btn waves-effect waves-light btn modal-trigger',
+                            'styles'        => '',
+                            'data'          => 'membersExportModal'
                         ],
                     ],
                 ],
@@ -457,20 +463,18 @@ add_filter(
                     ],
                 ],
                 [
-                    'id'       => 'entityAmount',
-                    'title'    => 'Number of ' . $this->config['terms']['term_member_plur_cap'],
-                    'order'    => 1,
-                    'template' => 'entityAmount',
-                    'table'    => $membersTable,
-                    'url'      => $membersIndexPage . "&option=search",
+                    'id'        => 'entityAmount',
+                    'title'     => 'Number of ' . $this->config['terms']['term_member_plur_cap'],
+                    'order'     => 1,
+                    'template'  => 'entityAmount',
+                    'table'     => $membersTable,
+                    'url'       => $membersIndexPage . "&option=search",
                 ],
                 [
-                    'id'       => 'eventExportModal',
-                    'title'    => 'Export Events',
-                    'order'    => 99,
-                    'template' => 'entityAmount',
-                    'table'    => $membersTable,
-                    'url'      => $membersIndexPage . "&option=search",
+                    'id'        => 'membersExportModal',
+                    'template'  => 'modal',
+                    'order'     => 99,
+                    'form'      => $this->controller('export', 'index', false, true)
                 ],
                 [
                     'id'        => 'textSearch',
index d99f024..fbb09e6 100644 (file)
-    <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
-        <input type="hidden" name="glm_action" value="index" />
-        <input type="hidden" name="option" value="validate" />
-
-        <table class="glm-admin-table" border="0" cellspacing="5" cellpadding="10">
-            <tr>
-                <th>File Type</th>
-                <th>New File</th>
-                <th>Sample File</th>
-                <th>Current File</th>
-                <th>Updated</th>
-            </tr>
-            {$count = 0}
-            {foreach $fileData as $fileHeader => $file}
-            <tr{if $count%2 == 0} class="alternate"{/if}>
-                <td class="glm-import-td">
-                    {$fileHeader}
-                </td>
-                <td class="glm-import-td">
-                    <input type="file" name="{$file.field}">
-                </td>
-                <td class="glm-import-td">
-                    <a href="{$sampleFileUrl}{$file.name}">Sample {$fileHeader} File</a>
-                </td>
-                <td class="glm-import-td">
-                    {if $file.exists}
-                        {$fileHeader} File
-                    {/if}
-                </td>
-                <td class="glm-import-td">
-                    {if $file.exists}
-                        {$file.mtime|date_format:"%D %I:%M %p"}
-                    {/if}
-                </td>
-            </tr>
-            {$count = $count + 1}
+<div id="exportMembersDialog" class="glm-dialog-modal" title="Export {$terms.term_member_cap}">
+        <form id="exportForm" action="{$ajaxUrl}" method="post" enctype="multipart/form-data">
+            <input type="hidden" name="action" value="glm_members_admin_ajax">
+            <input type="hidden" name="glm_action" value="membersListExport">
+            <table class="glm-admin-table">
+                <tr>
+                    <th>Categories: </th>
+                    <td>
+                        <select id="exportFilterCategories" name="filterCategories[]" multiple="multiple" size="1">
+            {foreach from=$categories item=v}
+                                <option value="{$v.id}" data-parent="{$v.parent}"{if $v.selected} selected{/if}>
+                                    {if $v.parent_id}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
+                                </option>
             {/foreach}
-            <tr>
-                <td>Clear Data</td>
-                <td colspan="4">
-                    <input type="hidden" name="clear_data" value="0">
-                    <input type="checkbox" name="clear_data" value="1" checked>
-                </td>
-            </tr>
-        </table>
-        <input type="submit" value="Continue" class="button button-primary submit-import">
-    </form>
-
-{include file='admin/footer.html'}
+                        </select>
+                    </td>
+                </tr>
+                <tr>
+                    <th>Member Types:</th>
+                    <td>
+                        <select id="exportFilterMemberTypes" name="filterMemberTypes">
+                            <option value=""></option>
+                            {foreach $member_types as $type}
+                                <option value="{$type.id}"{if $type.id == $mTypeSelected} selected{/if}>{$type.name}</option>
+                            {/foreach}
+                        </select>
+                    </td>
+                </tr>
+                <tr><th>Show Archived: </th><td><input type="checkbox" name="filterArchived"></td></tr>
+                <tr><th>Featured Only: </th><td><input type="checkbox" name="filterFeatured"></td></tr>
+                <tr><th>Pending Only: </th><td><input type="checkbox" name="filterPending"></td></tr>
+                <tr><th>Name Search: </th><td><input  class="exportMembersSearch glm-form-text-input-medium" type="text" name="text_search" id="autoTest"><br>
+                        Enter any portion of a {$terms.term_member_cap} name and press enter or select any specific {$terms.term_member_cap} found.
+                    </td></tr>
+                <tr>
+                    <th>Fields to export</th>
+                    <td>
+                        <table padding="3">
+                            <tr>
+                                <td colspan="2"><a id="selectAllExportFields">Check All</a> / <a id="unselectAllExportFields">Uncheck All</a></td>
+                            </tr>
+                            <tr>
+                                <td class="exportFieldsTd">
+                                    <input type="checkbox" name="exportId"> {$terms.term_member_cap} ID<br>
+                                    <input type="checkbox" name="exportOldId"> Old {$terms.term_member_cap} ID<br>
+                                    <input type="checkbox" name="exportMember" checked> {$terms.term_member_cap} Name<br>
+                                    <input type="checkbox" name="exportReferenceName"> Profile Reference Name<br>
+                                    <input type="checkbox" name="exportAddr1" checked> Address Line #1<br>
+                                    <input type="checkbox" name="exportAddr2" checked> Address Line #2<br>
+                                    <input type="checkbox" name="exportCity" checked> City<br>
+                                    <input type="checkbox" name="exportState" checked> State<br>
+                                    <input type="checkbox" name="exportZip" checked> ZIP/Postal Code<br>
+                                    <input type="checkbox" name="exportCounty" checked> County <br>
+                                    <input type="checkbox" name="exportRegion" checked> Region <br>
+                                </td>
+                                <td class="exportFieldsTd">
+                                    <input type="checkbox" name="exportPhone" checked> Phone #<br>
+                                    <input type="checkbox" name="exportTollFree" checked> Toll Free<br>
+                                    <input type="checkbox" name="exportEmail" checked> Main E-Mail<br>
+                                    <input type="checkbox" name="exportPriContactName" checked> Primary Contact Name<br>
+                                    <input type="checkbox" name="exportPriContactEmail" checked> Primary Contact E-Mail<br>
+                                    <input type="checkbox" name="exportUrl" checked> Web Address (URL)<br>
+                                    <input type="checkbox" name="exportCategories" checked> Categories<br>
+                                    <input type="checkbox" name="exportMailingAddr1" checked> Mailing Address Line #1<br>
+                                    <input type="checkbox" name="exportMailingAddr2" checked> Mailing Address Line #2<br>
+                                    <input type="checkbox" name="exportMailingCity" checked> Mailing City<br>
+                                    <input type="checkbox" name="exportMailingState" checked> Mailing State<br>
+                                    <input type="checkbox" name="exportMailingZip" checked> Mailing ZIP/Postal Code<br>
+                                </td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+                {* Custom Field Part *}
+                {if apply_filters( 'glm-members-customfields-active', false )}
+                <tr>
+                    <th>Custom Fields</th>
+                    <td>
+                    {$customFields = apply_filters('glm-member-db-fields-get-members-fields', false, 'glm-member-db')}
+                    {if $customFields}
+                        {foreach $customFields as $cf}
+                            <input type="checkbox" name="exportCF[{$cf.id}]" checked> {$cf.field_name} <br>
+                        {/foreach}
+                    {/if}
+                    </td>
+                </tr>
+                {/if}
+                <tr>
+                    <th>Include&nbsp;Clicks&nbsp;&&nbsp;Views</th>
+                    <td>
+                        <table padding="3">
+                            <tr>
+                                <td>
+                                    Month: <input type="text" class="monthPicker" name="monthYear" value="{$monthYear}">
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <input type="checkbox" name="exportClicks"> URL Click Counts<br>
+                                    <input type="checkbox" name="exportViews"> Detail Page View Counts
+                                </td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+                <tr>
+                    <th>Export to: </th>
+                    <td>
+                        <input type="radio" name="type" value="print" checked="checked"> Export for Print<br>
+                        <input type="radio" name="type" value="csv"> Export to Spreadsheet (CSV)
+                    </td>
+                </tr>
+            </table>
+            <a id="exportMembersCancel" class="button button-secondary glm-right">Cancel</a>
+            <input type="submit" value="Export" class="button button-primary">
+        </form>
+    </div>
+</div>
\ No newline at end of file
index 30d0fdd..3f1826c 100644 (file)
@@ -3,8 +3,8 @@
         {foreach $component.buttons as $buttonName => $buttonData}
             <a class="btn btn-small waves-effect waves-light {$buttonName}-button {if $buttonData.classes}{$buttonData.classes}{/if}" 
              style="font-style: normal; {if $buttonData.styles}{$buttonData.styles}{/if}" 
-             href="{if $buttonData.url}{$buttonData.url}{/if}{if  $buttonData.data}export-modal{else}#{/if}"  {if $buttonData.data} data-export={$buttonData.data} {/if}>
-               {if $buttonData.content}{$buttonData.content} {$buttonData.data}{/if}
+             href="{if $buttonData.url}{$buttonData.url}{/if}{if  $buttonData.data}{$buttonData.data}{else}#{/if}"  {if $buttonData.data} data-export={$buttonData.data} {/if}>
+               {if $buttonData.content}{$buttonData.content}{/if}
             </a>
         {/foreach}
     </div>
index 9896264..8814de1 100644 (file)
@@ -1,3 +1,8 @@
 
 
-{$add.result}
\ No newline at end of file
+<div id="{$component.id}" class="glm-dashboard-widget-modal modal" >
+    {$component.form}
+</div>
+<script>
+    
+</script>
\ No newline at end of file
index 7092863..366e9dc 100644 (file)
     </div>    
 </div>
 
-<!-- Modal Structure -->
-<div id="export-modal" class="modal"></div>
-
 <script> 
 
-    // Init 
+    /*
+     *  Init Materialize collapsible
+     */
     jQuery(function($){
         $('.collapsible').collapsible();
+        
+        $('.modal').modal();
     })
 
+    /*
+     *  Text Search Autocomplete
+     */
     function textSearch(textSearchData){
         // Text Search Component
         jQuery(function($){
@@ -34,6 +38,7 @@
                 where       : textSearchData.where
             }
             $('input#'+textSearchData.slug+'-text').autoComplete({
+                minChars: 1,
                 source: function( request, response ) {
                     data.query = request;
                     $.ajax({
                         window.location.replace(textSearchData.resultUrl+searchResults[search].entityID);
                     }
                 },
-                minLength: 1,
             });
         });
     }
 
     /*
-    * Date Search Widget
-    */
+     *  Date Search Widget
+     */
     function dateSearch(dateSearchData){
         jQuery(function($){
 
             })
         });
     }
+
+    /*
+     *  Export Modal
+     */
+    function exportData(exportData){
+        jQuery(function($){
+
+        });
+    }
 </script>
 
 {include file='admin/footer.html'}
\ No newline at end of file