merging all js scripts from the components into the index.html and only passing objec...
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 1 Oct 2018 18:51:02 +0000 (14:51 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 1 Oct 2018 18:51:02 +0000 (14:51 -0400)
models/admin/export/index.php [new file with mode: 0644]
models/admin/newDashboard/index.php
setup/adminHooks.php
setup/validActions.php
views/admin/export/index.html [new file with mode: 0644]
views/admin/newDashboard/components/buttons.html
views/admin/newDashboard/components/dateSearch.html
views/admin/newDashboard/components/modal.html [new file with mode: 0644]
views/admin/newDashboard/components/textSearch.html
views/admin/newDashboard/index.html

diff --git a/models/admin/export/index.php b/models/admin/export/index.php
new file mode 100644 (file)
index 0000000..5d478bb
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin File Library Upload
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @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
+ *
+ */
+class GlmMembersAdmin_export_index
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct(false, false);
+
+    }
+
+    public function modelAction($actionData = false) {
+
+
+        // Compile template data
+        $templateData = array(
+      
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+            'status'        => true,
+            'modelRedirect' => false,
+            'view'          => 'admin/export/index.html',
+            'data' => $templateData
+        );
+
+    }
+}
index f6c26a1..e2507a8 100644 (file)
@@ -231,6 +231,7 @@ class GlmMembersAdmin_newDashboard_index extends GlmDataMembers
             'detailViewCounts'      => $detailViewCounts,
             'statusPending'         => $this->config['status_numb']['Pending'],
             'addons'                => $addons,
+            'baseUrl'               => GLM_MEMBERS_PLUGIN_URL 
         );
 
         // Return status, suggested view, and data to controller.
index ecd328a..ddd5fde 100644 (file)
@@ -431,6 +431,9 @@ add_filter(
                             'content'   => 'Add Member',
                             'url'       => $memberIndexPage . "&glm_action=memberEdit&option=add",
                             'classes'   => '',
+                            'data'      => '',
+                            'styles'    => ''
+                            
                         ],
                     ],
                 ],
@@ -461,6 +464,14 @@ add_filter(
                     'table'    => $membersTable,
                     'url'      => $membersIndexPage . "&option=search",
                 ],
+                [
+                    'id'       => 'eventExportModal',
+                    'title'    => 'Export Events',
+                    'order'    => 99,
+                    'template' => 'entityAmount',
+                    'table'    => $membersTable,
+                    'url'      => $membersIndexPage . "&option=search",
+                ],
                 [
                     'id'        => 'textSearch',
                     'order'     => 2,
index 3be69eb..c67c137 100644 (file)
@@ -103,7 +103,11 @@ $glmMembersValidActions = array(
         ),
         'import' => array(
             'index' => 'glm-member-db'
+        ),
+        'export' => array(
+            'index' => 'glm-member-db'
         )
+
     ),
     'frontActions' => array(
         'members' => array(
diff --git a/views/admin/export/index.html b/views/admin/export/index.html
new file mode 100644 (file)
index 0000000..d99f024
--- /dev/null
@@ -0,0 +1,49 @@
+    <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}
+            {/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'}
index 9fe464c..30d0fdd 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}{else}#{/if}"  {if $buttonData.data} data-export={$buttonData.data} {/if}>
-               {if $buttonData.content}{$buttonData.content}{/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}
             </a>
         {/foreach}
     </div>
index fae42a9..9be4f11 100644 (file)
     </div>
 </div>
 <script>
-    jQuery(function($){
-
-        var date = new Date();
-        var toDate = '', fromDate = '';
-        $('.fromDate').datepicker({
-            format          : 'mm/dd/yyyy',
-            setDefaultDate  : true,
-            defaultDate     : date,
-            autoClose       : true,
-            onClose         : function(){
-                fromDate = '&fromDate=' + $(this)[0].el.value;
-            }
-        });
-        $('.toDate').datepicker({
-            format      : 'mm/dd/yyyy',
-            autoClose   : true,
-            onClose: function(){
-                toDate = '&toDate=' + $(this)[0].el.value;
-            }
-        });
-        $('.date-search-btn').on("click", function(){
-            window.location = '{$component.resultUrl}' +fromDate + toDate;
+        jQuery(function($){
+            dateSearch({
+                resultUrl : '{$component.resultUrl}'
+            })
         })
-    });
-</script>
\ No newline at end of file
+    </script>
\ No newline at end of file
diff --git a/views/admin/newDashboard/components/modal.html b/views/admin/newDashboard/components/modal.html
new file mode 100644 (file)
index 0000000..9896264
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+{$add.result}
\ No newline at end of file
index ab211db..aa54511 100644 (file)
@@ -7,56 +7,11 @@
 </div>
 <script>
     jQuery(function($){
-        let searchResults   = {};
-        let imageUrl        = `{$glmPluginMediaUrl}/images`
-        let data = {
-            action      : 'glm_members_admin_ajax',
-            glm_action  : 'glmTextSearch',
+        textSearch({
             table       : '{$component.table}',
             fields      : '{$component.fields}',
-            where       : '{$component.where}'
-        }
-        $('input#{$addon.slug}-text').autoComplete({
-            source: function( request, response ) {
-                data.query = request;
-                $.ajax({
-                    dataType: "json",
-                    type : 'POST',
-                    url: '{$ajaxUrl}',
-                    data: data,
-                    success: function(data) {
-                        console.log(data.searchData);
-                        if(data.searchData){
-                            let searchDropdown = [];
-                            for(let i = 0;i < data.searchData.length;i++){
-                                let searchTitle = Object.keys(data.searchData[i])[0];
-                                let image       = (data.searchData[i][searchTitle].image) ? data.searchData[i][searchTitle].image : null;
-                                let memberID    = data.searchData[i][searchTitle].memberID;   
-                                let entityID   = data.searchData[i][searchTitle].entityID;              
-                                searchDropdown.push(searchTitle);
-                                {literal} searchResults[searchTitle] = {image: image, memberID: memberID, entityID: entityID}; {/literal}
-                            }   
-                            {literal} response(searchDropdown); {/literal}
-                        }else{
-                            response(['No Results Found'])
-                        }
-                    }
-                });
-            },
-            renderItem: function (item, search){
-                search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
-                var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
-                return '<div class="autocomplete-suggestion" data-langname="'+item[0]+'" data-lang="'+item[1]+'" data-val="'+search+'">'+item.replace(re, "<b>$1</b>")+'</div>';
-   
-            },
-            onSelect: function(e, term, item){
-                let search = $(item).text();
-                console.log(search)
-                if(search !== "No Results Found"){
-                    window.location.replace('{$component.resultUrl}&{$component.entityID}='+searchResults[search].entityID);
-                }
-            },
-            minLength: 1,
-        });
-    });
+            where       : '{$component.where}',
+            searchUrl   : '{$component.resultUrl}'
+        })
+    })
 </script>
\ No newline at end of file
index c3598f4..1b7544b 100644 (file)
         </div>
     </div>    
 </div>
+
+<!-- Modal Structure -->
+<div id="export-modal" class="modal"></div>
+
 <script> 
+
+    // Init 
     jQuery(function($){
-        M.AutoInit();
-        $(".widget-export-btn").on("click", function(){
-            console.log( $(this).data('export') );
-        })
+        $('.collapsible').collapsible();
     })
+
+    function textSearch(textSearchData){
+        // Text Search Component
+        jQuery(function($){
+            let searchResults   = {};
+            let imageUrl        = `{$glmPluginMediaUrl}/images`
+            let data = {
+                action      : 'glm_members_admin_ajax',
+                glm_action  : 'glmTextSearch',
+                table       : textSearchData.table,
+                fields      : textSearchData.fields,
+                where       : textSearchData.where
+            }
+            $('input#{$addon.slug}-text').autoComplete({
+                source: function( request, response ) {
+                    data.query = request;
+                    $.ajax({
+                        dataType: "json",
+                        type : 'POST',
+                        url: '{$ajaxUrl}',
+                        data: data,
+                        success: function(data) {
+                            console.log(data.searchData);
+                            if(data.searchData){
+                                let searchDropdown = [];
+                                for(let i = 0;i < data.searchData.length;i++){
+                                    let searchTitle = Object.keys(data.searchData[i])[0];
+                                    let image       = (data.searchData[i][searchTitle].image) ? data.searchData[i][searchTitle].image : null;
+                                    let memberID    = data.searchData[i][searchTitle].memberID;   
+                                    let entityID   = data.searchData[i][searchTitle].entityID;              
+                                    searchDropdown.push(searchTitle);
+                                    {literal} searchResults[searchTitle] = {image: image, memberID: memberID, entityID: entityID}; {/literal}
+                                }   
+                                {literal} response(searchDropdown); {/literal}
+                            }else{
+                                response(['No Results Found'])
+                            }
+                        }
+                    });
+                },
+                renderItem: function (item, search){
+                    search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+                    var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
+                    return '<div class="autocomplete-suggestion" data-langname="'+item[0]+'" data-lang="'+item[1]+'" data-val="'+search+'">'+item.replace(re, "<b>$1</b>")+'</div>';
+
+                },
+                onSelect: function(e, term, item){
+                    let search = $(item).text();
+                    console.log(search)
+                    if(search !== "No Results Found"){
+                        // window.location.replace('{ $component.resultUrl}&{ $component.entityID}='+searchResults[search].entityID);
+                    }
+                },
+                minLength: 1,
+            });
+        });
+    }
+
+    /*
+    * Date Search Widget
+    */
+    function dateSearch(dateSearchData){
+        jQuery(function($){
+
+            var date = new Date();
+            var toDate = '', fromDate = '';
+            $('.fromDate').datepicker({
+                format          : 'mm/dd/yyyy',
+                setDefaultDate  : true,
+                defaultDate     : date,
+                autoClose       : true,
+                onClose         : function(){
+                    fromDate = '&fromDate=' + $(this)[0].el.value;
+                }
+            });
+            $('.toDate').datepicker({
+                format      : 'mm/dd/yyyy',
+                autoClose   : true,
+                onClose: function(){
+                    toDate = '&toDate=' + $(this)[0].el.value;
+                }
+            });
+            $('.date-search-btn').on("click", function(){
+                window.location = dateSearchData.resultUrl + fromDate + toDate;
+            })
+        });
+    }
 </script>
 
 {include file='admin/footer.html'}
\ No newline at end of file