From edd3379d2d7f1e3295002c1a860b6aae9499d81b Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Wed, 25 Mar 2015 19:23:12 -0400 Subject: [PATCH] Added autocomplete to member search in dashboard widget. --- classes/data/dataMembers.php | 18 +++++---- controllers/admin.php | 6 ++- css/admin.css | 2 +- js/admin.js | 10 +++-- ...40ebc45e387f5f95c45e90.file.index.html.php | 14 ++++--- views/admin/dashboardWidget/index.html | 39 ++++++++++++------- views/admin/member/index.html | 4 +- 7 files changed, 60 insertions(+), 33 deletions(-) diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php index e9389c0c..6929d50f 100644 --- a/classes/data/dataMembers.php +++ b/classes/data/dataMembers.php @@ -195,13 +195,17 @@ class GlmDataMembers extends GlmDataAbstract { public function getSimpleMembersList() { - $memberList = $this->wpdb->get_results( - " - SELECT id, name - FROM ".$this->table." - ;", - ARRAY_A - ); + // Save the current fields array and make a copy + $fSave = $this->fields; + $f = $fSave; + + // Remove what we don't want form the copy and get the list + unset($f['access'], $f['member_type'], $f['created']); + $this->fields = $f; + $memberList = $this->getList(); + + // Restore the fields list + $this->fields = $fSave; return $memberList; } diff --git a/controllers/admin.php b/controllers/admin.php index b9f2aadf..ed4c0377 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -229,11 +229,15 @@ class glmMembersAdmin extends GlmPluginSupport public function glmMembersAdminScripts () { + // jQuery scripts wp_enqueue_script('jquery'); wp_enqueue_script('jquery-style'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-dialog'); - wp_enqueue_style("wp-jquery-ui-dialog"); + wp_enqueue_script('jquery-ui-autocomplete'); + + // jQuery UI Style + wp_enqueue_style('wp-jquery-ui-dialog'); wp_enqueue_media(); wp_register_script('glm-members-admin-js', diff --git a/css/admin.css b/css/admin.css index f2938f4d..66cba49b 100644 --- a/css/admin.css +++ b/css/admin.css @@ -121,7 +121,7 @@ font-weight: bold; } .glm-admin-table-active { - background: lightblue; + background: #99FFFF; } .glm-admin-image-edit-table { border: 2px #ddd solid; diff --git a/js/admin.js b/js/admin.js index 5c614efb..564f1eb5 100644 --- a/js/admin.js +++ b/js/admin.js @@ -1,7 +1,12 @@ -// Use media uploaded for all file/image uploads +// Other needed JS code + jQuery(document).ready(function($){ - + + /* + * Use media uploaded for all file/image uploads + */ + var custom_uploader; $('.glm-protp-upload-button').click(function(e) { @@ -36,5 +41,4 @@ jQuery(document).ready(function($){ }); - }); \ No newline at end of file diff --git a/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php b/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php index 742809d0..dd04776e 100644 --- a/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php +++ b/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '1be35689c5d30d774f40ebc45e387f5f95c45e90' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html', - 1 => 1426784332, + 1 => 1427321829, 2 => 'file', ), ), @@ -158,14 +158,16 @@ $_smarty_tpl->tpl_vars['v']->_loop = true; Access + Reference Name Created Last Update - Reference Name - tpl_vars["i"] = new Smarty_variable("0", null, 0);?> + tpl_vars["i"])) {$_smarty_tpl->tpl_vars["i"] = clone $_smarty_tpl->tpl_vars["i"]; +$_smarty_tpl->tpl_vars["i"]->value = "0"; $_smarty_tpl->tpl_vars["i"]->nocache = null; $_smarty_tpl->tpl_vars["i"]->scope = 0; +} else $_smarty_tpl->tpl_vars["i"] = new Smarty_variable("0", null, 0);?> tpl_vars['m'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['m']->_loop = false; $_from = $_smarty_tpl->tpl_vars['memberInfoRecords']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');} foreach ($_from as $_smarty_tpl->tpl_vars['m']->key => $_smarty_tpl->tpl_vars['m']->value) { @@ -182,11 +184,11 @@ $_smarty_tpl->tpl_vars['m']->_loop = true; &id=tpl_vars['m']->value['id'];?> "tpl_vars['m']->value['status']['value']==$_smarty_tpl->tpl_vars['statusPending']->value) {?> class="glm-notice">tpl_vars['m']->value['status']['name'];?> + tpl_vars['m']->value['reference_name'];?> + tpl_vars['m']->value['create_time']['datetime'];?> tpl_vars['m']->value['modify_time']['datetime'];?> - - tpl_vars['m']->value['reference_name'];?> - - Members + + Member Search: {/if} @@ -80,12 +75,30 @@ {if $membersList} {/if} \ No newline at end of file diff --git a/views/admin/member/index.html b/views/admin/member/index.html index d801e61b..c957fb79 100644 --- a/views/admin/member/index.html +++ b/views/admin/member/index.html @@ -92,9 +92,9 @@ Access + Reference Name Created Last Update - Reference Name @@ -107,9 +107,9 @@ {/if} {$m.status.name} + {$m.reference_name} {$m.create_time.datetime} {$m.modify_time.datetime} - {$m.reference_name} Clone  {if $m.status.name != 'Active'}Activate{/if} -- 2.17.1