Lists & filter fixed, use fieldsMap, links fixed
authorLaury GvR <laury@gaslightmedia.com>
Tue, 2 Oct 2018 16:10:18 +0000 (12:10 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 2 Oct 2018 16:10:18 +0000 (12:10 -0400)
Every list now passes a fields map to ensure the field values its
result produces correspond to the expected field names in the
widget component templates. For example, the list.html component
template expects an entity 'name', but packaging plugin passes this
as 'title' - with the map, they are matched.

getList for the lists now use custom fields array to allow this.

Quicklinks, count, and list entity & ref_dest links are now working.

models/admin/newDashboard/index.php
setup/adminHooks.php
views/admin/export/index.html
views/admin/newDashboard/components/buttons.html
views/admin/newDashboard/components/entityAmount.html
views/admin/newDashboard/components/list.html
views/admin/newDashboard/summaryWidget.html

index e2507a8..10e4ded 100644 (file)
@@ -140,59 +140,59 @@ class GlmMembersAdmin_newDashboard_index extends GlmDataMembers
         $thisWeek =  date('Y-m-d', strtotime('-'.date('w').' days'));
         $thisMonth = date('Y-m-d', strtotime('-'.(date('j')-1).' days'));
 
-        $clickThroughCounts = $this->wpdb->get_row("
-            SELECT COALESCE ((
-                        SELECT clicks
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
-                         WHERE member = $memberID
-                           AND stat_type = 1
-                           AND stat_date = '$today'
-                   ), 0) AS day,
-                   COALESCE ((
-                        SELECT clicks
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
-                         WHERE member = $memberID
-                           AND stat_type = 2
-                           AND stat_date = '$thisWeek'
-                   ), 0) AS week,
-                   COALESCE ((
-                        SELECT clicks
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
-                         WHERE member = $memberID
-                           AND stat_type = 3
-                           AND stat_date = '$thisMonth'
-                   ), 0) AS month
-        ", ARRAY_A);
+        // $clickThroughCounts = $this->wpdb->get_row("
+        //     SELECT COALESCE ((
+        //                 SELECT clicks
+        //                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
+        //                  WHERE member = $memberID
+        //                    AND stat_type = 1
+        //                    AND stat_date = '$today'
+        //            ), 0) AS day,
+        //            COALESCE ((
+        //                 SELECT clicks
+        //                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
+        //                  WHERE member = $memberID
+        //                    AND stat_type = 2
+        //                    AND stat_date = '$thisWeek'
+        //            ), 0) AS week,
+        //            COALESCE ((
+        //                 SELECT clicks
+        //                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
+        //                  WHERE member = $memberID
+        //                    AND stat_type = 3
+        //                    AND stat_date = '$thisMonth'
+        //            ), 0) AS month
+        // ", ARRAY_A);
 
-        $detailViewCounts = $this->wpdb->get_row("
-            SELECT COALESCE ((
-                        SELECT clicks
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
-                         WHERE member = $memberID
-                           AND stat_type = 1
-                           AND stat_date = '$today'
-                   ), 0) AS day,
-                   COALESCE ((
-                        SELECT clicks
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
-                         WHERE member = $memberID
-                           AND stat_type = 2
-                           AND stat_date = '$thisWeek'
-                   ), 0) AS week,
-                   COALESCE ((
-                        SELECT clicks
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
-                         WHERE member = $memberID
-                           AND stat_type = 3
-                           AND stat_date = '$thisMonth'
-                   ), 0) AS month
-        ", ARRAY_A);
+        // $detailViewCounts = $this->wpdb->get_row("
+        //     SELECT COALESCE ((
+        //                 SELECT clicks
+        //                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
+        //                  WHERE member = $memberID
+        //                    AND stat_type = 1
+        //                    AND stat_date = '$today'
+        //            ), 0) AS day,
+        //            COALESCE ((
+        //                 SELECT clicks
+        //                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
+        //                  WHERE member = $memberID
+        //                    AND stat_type = 2
+        //                    AND stat_date = '$thisWeek'
+        //            ), 0) AS week,
+        //            COALESCE ((
+        //                 SELECT clicks
+        //                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
+        //                  WHERE member = $memberID
+        //                    AND stat_type = 3
+        //                    AND stat_date = '$thisMonth'
+        //            ), 0) AS month
+        // ", ARRAY_A);
 
         // Setup the data Abstract class for member info.
         require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMemberInfo.php';
         $MemberInfo        = new GlmDataMemberInfo($this->wpdb, $this->config);
         $hideArchived      = " && T.status != ".$this->config['status_numb']['Archived'];
-        $memberInfoRecords = $MemberInfo->getList( "T.member = $memberID" . $hideArchived, 'T.status' );
+        //$memberInfoRecords = $MemberInfo->getList( "T.member = $memberID" . $hideArchived, 'T.status' );
 
         // Check if there's any member information records.
         if (is_array($memberInfoRecords) && count($memberInfoRecords) > 0) {
@@ -208,10 +208,11 @@ class GlmMembersAdmin_newDashboard_index extends GlmDataMembers
                 // $addons[$a['slug']]['index'] = $a['index'];
                 // echo $a['index'];
                 $addons[$a['slug']]['widgetData'] = apply_filters($a['slug'] . "-dashboard-widget", "");
-                $addons[$a['slug']]['widgetData'] = $this->queryWidgetLists($addons[$a['slug']]['widgetData']);
+                //$addons[$a['slug']]['widgetData'] = $this->queryWidgetLists($addons[$a['slug']]['widgetData']);
 
                 // Sort the component list based on the 'order'
                 uasort($addons[$a['slug']]['widgetData']['components'], array($this, 'orderSort') ) ;
+                
             } else {
                 // For testing
                 //  echo "<br>" . $a['slug'] .  " has no filter called " . $a['slug'] . "-dashboard-widget";
@@ -249,46 +250,47 @@ class GlmMembersAdmin_newDashboard_index extends GlmDataMembers
 
     public function queryWidgetLists( &$widgetData = false ) {
         
-        foreach ( $widgetData['components'] as &$widgetComponent ) {
-            $where = " TRUE ";
-            $order = "";
-            $limit = "5";
-            if ( isset($widgetComponent['where']) && $widgetComponent['where'] !== "" ) {
-                $where .= " AND " . $widgetComponent['where'];
-            }
-            if ( isset($widgetComponent['orderBy']) && $widgetComponent['orderBy'] !== "" ) {
-                $order .= " ORDER BY " . $widgetComponent['orderBy'];
-            }
+        // foreach ( $widgetData['components'] as &$widgetComponent ) {
+            // $where = " TRUE ";
+            // $order = "";
+            // $limit = "5";
+            // if ( isset($widgetComponent['where']) && $widgetComponent['where'] !== "" ) {
+            //     $where .= " AND " . $widgetComponent['where'];
+            // }
+            // if ( isset($widgetComponent['orderBy']) && $widgetComponent['orderBy'] !== "" ) {
+            //     $order .= " ORDER BY " . $widgetComponent['orderBy'];
+            // }
+            // echo "<br>Result:" . var_dump( $widgetComponent['result'] );
 
-            if ( $widgetComponent['template'] == 'list' && isset($widgetComponent['fields']) && isset($widgetComponent['table']) ) {
-                $table = $widgetComponent['table'];
-                $fields = $widgetComponent['fields'];
-                $resultsQuery = "SELECT " . $fields . " FROM " . $table . " WHERE" .  $where . $order . " LIMIT " . $limit . ";";
-                //echo "<br>" .$resultsQuery;
-                $widgetComponent['sql'] = $resultsQuery;
-                $widgetComponent['listItems'] = $this->wpdb->get_results($resultsQuery);
+            // if ( $widgetComponent['template'] == 'list' && isset($widgetComponent['fields']) && isset($widgetComponent['table']) ) {
+                // $table = $widgetComponent['table'];
+                // $fields = $widgetComponent['fields'];
+                // $resultsQuery = "SELECT " . $fields . " FROM " . $table . " WHERE" .  $where . $order . " LIMIT " . $limit . ";";
+                // //echo "<br>" .$resultsQuery;
+                // $widgetComponent['sql'] = $resultsQuery;
+                // $widgetComponent['listItems'] = $this->wpdb->get_results($resultsQuery);
 
-                if ( isset($widgetComponent['listItems']) ) {
-                    foreach ( $widgetComponent['listItems'] as &$listItem ) {
-                        if ( isset($listItem->ref_type) ) {
-                            // Get the ref type from the config array - has to be forced lowercase due to inconsistency 
-                            // in url vs config array reference to ref_type (e.g. member vs Member, and member vs members)
-                            $listItem->ref_type = strtolower($this->config['ref_type'][$listItem->ref_type]);
-                        }
-                    }
-                }
+                // if ( isset($widgetComponent['listItems']) ) {
+                //     foreach ( $widgetComponent['listItems'] as &$listItem ) {
+                //         if ( isset($listItem->ref_type) ) {
+                //             // Get the ref type from the config array - has to be forced lowercase due to inconsistency 
+                //             // in url vs config array reference to ref_type (e.g. member vs Member, and member vs members)
+                //             $listItem->ref_type = strtolower($this->config['ref_type'][$listItem->ref_type]);
+                //         }
+                //     }
+                // }
                 // $countQuery = "SELECT COUNT(" . $widgetComponent['entityID'] . ") FROM " . $widgetComponent['table'] . " WHERE " . $where . ";";
                 // $widgetComponent['count'] = $this->wpdb->get_var($countQuery);
 
-            } 
-            if ( isset($widgetComponent['table']) && ($widgetComponent['template'] == 'list' || $widgetComponent['template'] == 'entityAmount') ) {
-                $table = $widgetComponent['table'];
-                $countQuery = "SELECT COUNT(id) FROM " . $widgetComponent['table'] . " WHERE " . $where . ";";
+            // 
+            // if ( isset($widgetComponent['table']) && ($widgetComponent['template'] == 'list' || $widgetComponent['template'] == 'entityAmount') ) {
+                //$table = $widgetComponent['table'];
+                //$countQuery = "SELECT COUNT(id) FROM " . $widgetComponent['table'] . " WHERE " . $where . ";";
                 //echo "<br>" .$countQuery;
-                $widgetComponent['count'] = $this->wpdb->get_var($countQuery);
+                //$widgetComponent['count'] = $this->wpdb->get_var($countQuery);
                 //echo "<pre>" . var_dump($widgetComponent['count']) . "</pre>";
-            }
-        }
+            // }
+        // }
         return $widgetData;
     }
 
index ac5ca93..727979d 100644 (file)
@@ -13,6 +13,8 @@
  * @link     http://dev.gaslightmedia.com/
  */
 
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php';
+
 /*
  * Place Misc Hooks and Filters here. If this file exists, it will be included
  * by the add-on main plugin script.
@@ -412,6 +414,39 @@ add_filter(
         $membersTable = GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info";
         $membersTextTable = GLM_MEMBERS_PLUGIN_DB_PREFIX . "members";
         $membersEditPage = GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE.'member&glm_action=memberInfo';
+        $membersSettingsPage = GLM_MEMBERS_PLUGIN_ADMIN_URL.'?page=glm-members-admin-menu-settings&settingsPage=members';
+        $membersRefLink      = GLM_MEMBERS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-member&glm_action=index';
+
+        $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
+
+        // Set default values for using getList() later, where the custom set of fields below will be used.
+        $where = '';
+        $order = '';
+        $fieldVals = true;
+        $idField = 'id';
+        $start = false;
+        $limit = false;
+    
+        // Save the current fields array and make a copy. Will be restored before the return.
+        $fSave = $MemberInfo->fields;
+
+        // echo "<br><pre>fsave: " . var_dump($fSave) . "</pre><br>";
+    
+        // Remove what we don't want from the copy and get the list
+        $MemberInfo->fields = array(
+            'id'            => $fSave['id'],
+            'reference_name'=> $fSave['reference_name'],
+            'status'        => $fSave['status'],
+            'member_pointer'=> $fSave['member_pointer'],
+            'member'        => $fSave['member'],
+            //'ref_type'      => 'ref_type', // membersInfo has no ref_type field yet
+        );
+
+        // echo "<br><pre>MemberInfo: " . var_dump($MemberInfo->fields) . "</pre><br>";
+
+        // $widgetResult = $MemberInfo->getList('status='.$MemberInfo->config['status_numb']['Pending'], $order, $fieldVals, $idField, $start, $limit);
+
+        // echo "<br><pre>Widgetresult: " . var_dump($widgetResult) . "</pre><br>";
 
         /*
         * For list components: pass ref_type and ref_dest as part of the 'fields' string if you want to
@@ -458,7 +493,7 @@ add_filter(
                         ],
                         'settings' => [
                             'content'   => 'Settings',
-                            'url'       => '#set',
+                            'url'       => $membersSettingsPage,
                         ]
                     ],
                 ],
@@ -467,8 +502,8 @@ add_filter(
                     'title'     => 'Number of ' . $this->config['terms']['term_member_plur_cap'],
                     'order'     => 1,
                     'template'  => 'entityAmount',
-                    'table'     => $membersTable,
                     'url'       => $membersIndexPage . "&option=search",
+                    'result'    => $MemberInfo->getStats(),
                 ],
                 [
                     'id'        => 'membersExportModal',
@@ -487,33 +522,54 @@ add_filter(
                     'resultUrl' => $memberIndexPage . "&glm_action=index&member=",
                 ],
                 [
-                    'id'        => 'pending', 
-                    'title'     => "Pending Member Profiles",
-                    'slug'      => "pending-member-profiles",
-                    'order'     => 3,
-                    'template'  => 'list',
-                    'entityID'  => 'memberInfo',
-                    'table'     => $membersTable,
-                    'fields'    => "id, reference_name as title, member as ref_dest, '10' as ref_type, status",
-                    'where'     => 'status='.$this->config['status_numb']['Pending'],
-                    'url'       => $membersEditPage,
+                    'id'            => 'pending-' . $this->config['terms']['term_member_cap'] . '-profiles', 
+                    'title'         => 'Pending ' . $this->config['terms']['term_member_cap'] . ' Profiles',
+                    'slug'          => 'pending-' . $this->config['terms']['term_member'] . '-profiles',
+                    'order'         => 3,
+                    'template'      => 'list',
+                    'entityID'      => 'memberInfo',
+                    'defaultRefType'=> 'member',
+                    'refLink'       => $membersRefLink,
+                    'url'           => $membersEditPage,
+                    'result'        => $MemberInfo->getList('status='.$MemberInfo->config['status_numb']['Pending'], $order, $fieldVals, $idField, $start, $limit),
+                    'count'         => $MemberInfo->getStats('status='.$MemberInfo->config['status_numb']['Pending'], $order, $fieldVals, $idField, $start, $limit),
+                    'fieldMap'      => [
+                        'id'            => 'id',
+                        'name'          => 'reference_name',
+                        'status'        => 'status',
+                        'ref_dest_id'   => 'member_pointer',
+                        'ref_dest_name' => 'member',
+                        //'ref_type'      => 'ref_type', // membersInfo has no ref_type field yet
+                    ],
                 ],
                 [
-                    'id'        => 'bad-location-data',
-                    'title'     => "Bad Location Data",
-                    'slug'      => "bad-location-data",
-                    'order'     => 4,
-                    'template'  => 'list',
-                    'entityID'  => 'memberInfo',
-                    'table'     => $membersTable,
-                    'fields'    => "id, reference_name as title, member as ref_dest, '10' as ref_type, status",
-                    'where'     => "has_no_map_data='1'",
-                    'url'       => $membersEditPage,
+                    'id'            => 'bad-location-data',
+                    'title'         => "Bad Location Data",
+                    'slug'          => "bad-location-data",
+                    'order'         => 4,
+                    'template'      => 'list',
+                    'entityID'      => 'memberInfo',
+                    'defaultRefType'=> 'member',
+                    'refLink'       => $membersRefLink,
+                    'url'           => $membersEditPage,
+                    'result'        => $MemberInfo->getList("has_no_map_data='1'", $order, $fieldVals, $idField, $start, $limit),
+                    'count'         => $MemberInfo->getStats("has_no_map_data='1'", $order, $fieldVals, $idField, $start, $limit),
+                    'fieldMap'      => [
+                        'id'            => 'id',
+                        'name'          => 'reference_name',
+                        'status'        => 'status',
+                        'ref_dest_id'   => 'member_pointer',
+                        'ref_dest_name' => 'member',
+                        //'ref_type'      => 'ref_type', // membersInfo has no ref_type field yet
+                    ],
                 ],
             ]
         ];
 
-         return $content;
+        // Restore the fields list
+        $MemberInfo->fields = $fSave;
+
+        return $content;
     },
     13,
     1
index af4fb91..8ce1caf 100644 (file)
 <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" multiple 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}
-                        </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></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>
+    <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" multiple 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}
+                    </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}
-                    {/if}
-                    </td>
-                </tr>
+                    </select>
+                </td>
+            </tr>
+            <tr><th>Show Archived: </th><td></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}
-                <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>
+                </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>
\ No newline at end of file
index 3f1826c..94d6727 100644 (file)
@@ -1,9 +1,9 @@
 <div id="{$addon.slug}-dashboard-widget-buttons" class="dashboard-widget-buttons row">
     <div class="s12 col">
         {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}{$buttonData.data}{else}#{/if}"  {if $buttonData.data} data-export={$buttonData.data} {/if}>
+            <a class="btn btn-small waves-effect waves-light {$buttonName}-button {if isset($buttonData.classes)}{$buttonData.classes}{/if}" 
+             style="font-style: normal; {if isset($buttonData.styles)}{$buttonData.styles}{/if}" 
+             href="{if isset($buttonData.url)}{$buttonData.url}{/if}{if isset($buttonData.data)}{$buttonData.data}{else}#{/if}"  {if isset($buttonData.data)} data-export={$buttonData.data} {/if}>
                {if $buttonData.content}{$buttonData.content}{/if}
             </a>
         {/foreach}
index 3d83c6e..f4e810c 100644 (file)
@@ -1,9 +1,9 @@
-<div class="{if $addon.slug}{$addon.slug}-list{/if} list-header"> {if $component.title}{$component.title}:{/if} 
+<div class="{if $addon.slug}{$addon.slug}-count{/if} count-header"> {if $component.title}{$component.title}:{/if} 
     {if $component.url}
         <a href="{$component.url}">
-           {$component.count}
+           {$component.result}
         </a>
     {else}
-        <span>{$component.count}</span>
+        <span>{$component.result}</span>
     {/if}
 </div>
\ No newline at end of file
index 1a3cba2..684f630 100644 (file)
@@ -1,20 +1,55 @@
-<div class="{$component}-list list-header"> {$component.title}: <a href="#">{$component.count}</a> </div>
+<div class="{$component.title}-list list-header"> {$component.title}: <a href="{$component.url}">{$component.count}</a> </div>
 <ul class="collection">
-{foreach $component['listItems'] as $listItem}
+
+{foreach $component['result'] as $listItem}
     {if isset($listItem)}
+
+        {$itemID = false}
+        {$itemName = false}
+        {$itemRefType = false}
+        {$itemRefDestID = false}
+        {$itemRefDestName = false}
+        {$itemExpireDate = false}
+
+        {* Convert mapped values to more easily usable variables *}
+        {if isset($listItem[$component['fieldMap']['id']]) && isset($listItem[$component['fieldMap']['id']])}
+            {$itemID = $listItem[$component['fieldMap']['id']]}
+        {/if}
+        {if isset($listItem[$component['fieldMap']['name']]) && isset($listItem[$component['fieldMap']['name']])}
+            {$itemName = $listItem[$component['fieldMap']['name']]}
+        {/if}
+        {if isset($listItem[$component['fieldMap']['ref_type']]) && isset($listItem[$component['fieldMap']['ref_type']]) }
+            {$itemRefType = $listItem[$component['fieldMap']['ref_type']]['name']|strtolower}
+        {else}
+            {$itemRefType = $component['defaultRefType']}
+        {/if}
+        {if isset($listItem[$component['fieldMap']['ref_dest_id']]) && isset($listItem[$component['fieldMap']['ref_dest_id']])}
+            {$itemRefDestID = $listItem[$component['fieldMap']['ref_dest_id']]}
+        {/if}
+        {if isset($listItem[$component['fieldMap']['ref_dest_name']]) && isset($listItem[$component['fieldMap']['ref_dest_name']])}
+            {$itemRefDestName = $listItem[$component['fieldMap']['ref_dest_name']]}
+        {/if}
+        {if isset($listItem[$component['fieldMap']['expire_date']]) && isset($listItem[$component['fieldMap']['expire_date']])}
+            {$itemExpireDate = $listItem[$component['fieldMap']['expire_date']]}
+        {/if}
+
         <li class="collection-item" style="line-height: 1;padding : 5px 15px;">
-            <a href='{$component.url}{if isset($listItem->ref_dest) && isset($listItem->ref_type)}&{$listItem->ref_type}={$listItem->ref_dest}{/if}&{$component.entityID}={$listItem->id}'
-                    class="collection-item-left{if isset($listItem->expire_date)} tooltipped{/if}"
-                    {if isset($listItem->expire_date)} data-position="top" data-tooltip="expired: {date( 'm/d/Y', strtotime($listItem->expire_date))}"{/if}>
-                <span>{$listItem->title}</span>
-                
-            </a>
-            {if $listItem->ref_dest && $listItem->ref_type}
-                <a class="collection-item-right" href='{$component.url}&{$listItem->ref_type}={$listItem->ref_dest}'>
-                    <span>{$listItem->ref_type}: {$listItem->ref_dest}</span>
+            {if isset($component.url)}
+                <a href='{$component.url}{if $itemRefDestID}&{$itemRefType}={$itemRefDestID}{/if}&{$component.entityID}={$itemID}'
+                    class='collection-item-left{if $itemExpireDate} tooltipped{/if}'
+                    {if $itemExpireDate} data-position="top" data-tooltip="expired: {date( 'm/d/Y', strtotime($itemExpireDate))}"{/if}>
+            {/if}
+                    <span>{$itemName}</span>
+            {if isset($component.url)}
+                </a>
+            {/if}
+            {if $itemRefType && $itemRefDestID && $itemRefDestName}
+                <a class="collection-item-right" href='{$component.refLink}&{$itemRefType}={$itemRefDestID}'>
+                    <span>{$itemRefDestName}</span>
                 </a>
             {/if}
         </li>
+        <br>
     {/if}
 {/foreach}
 </ul>
\ No newline at end of file
index 7470c68..958f488 100644 (file)
@@ -15,6 +15,7 @@
                         {**/if**}
                     {/if}
                 {/foreach}
+            </div>
         </li>
     </ul>
 </div>
\ No newline at end of file