From: Steve Sutton Date: Thu, 23 Jun 2016 20:28:52 +0000 (-0400) Subject: Add filter for the groups. X-Git-Tag: v1.0.0^2~40 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=5fc5b82443d503103fd8588d3b2c5481e34ac358;p=WP-Plugins%2Fglm-member-db-leads.git Add filter for the groups. On the interest list view add a search filter for groups. Using the multiselect plugin that chuck is using elsewhere. --- diff --git a/models/admin/settings/leads.php b/models/admin/settings/leads.php index bac5237..5c2068e 100644 --- a/models/admin/settings/leads.php +++ b/models/admin/settings/leads.php @@ -163,8 +163,20 @@ class GlmMembersAdmin_settings_leads extends GlmDataInterests $option2 = $_REQUEST['option2']; } + $groups = $groupData->getList(); + // Get a current list of interests - $interests = $this->getList(); + $where = null; + if ( isset( $_REQUEST['filterGroups'] ) ) { + // For each selected category + foreach($_REQUEST['filterGroups'] as $c) { + $groups[$c]['selected'] = true; + } + $where = "group_id in (" . implode( ',', $_REQUEST['filterGroups'] ) . ")"; + } + $order = "title"; + $interests = $this->getList( $where, $order ); + //echo '
$interests: ' . print_r($interests, true) . '
'; if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) { @@ -184,7 +196,6 @@ class GlmMembersAdmin_settings_leads extends GlmDataInterests } } - $groups = $groupData->getList(); if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) { glmMembersAdmin::addNotice( $groups, 'DataBlock', 'Interest Groups Data' ); diff --git a/views/admin/settings/leads.html b/views/admin/settings/leads.html index b84d14a..125611b 100644 --- a/views/admin/settings/leads.html +++ b/views/admin/settings/leads.html @@ -5,6 +5,19 @@ Groups +
+ +

+ Filter by Groups: + + +

+
+ - @@ -114,10 +126,7 @@ {/if} -
@@ -99,7 +112,6 @@
InterestUsed With Groups  
- {$t.title} - - {$t.ref_type.title} + {$t.title} {foreach $t.group_id.list as $group} @@ -221,6 +230,11 @@ }); + /* + * For the multiple select + */ + $('#filterGroups').multiselect(); + });