From 116e735e2ee6ea5485da72f6199e06ece3085b94 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 7 Nov 2018 15:42:11 -0500 Subject: [PATCH] Update for adding county into the member city table. Also more updates for the interactive map. Adding shortcode attributes for bounds and marker colors. --- assets/MapIcons/InteractiveMap/blue.png | Bin 0 -> 800 bytes assets/MapIcons/InteractiveMap/brown.png | Bin 0 -> 795 bytes assets/MapIcons/InteractiveMap/green.png | Bin 0 -> 802 bytes assets/MapIcons/InteractiveMap/grey.png | Bin 0 -> 815 bytes assets/MapIcons/InteractiveMap/orange.png | Bin 0 -> 811 bytes assets/MapIcons/InteractiveMap/purple.png | Bin 0 -> 804 bytes assets/MapIcons/InteractiveMap/red.png | Bin 0 -> 790 bytes assets/bg_caption.jpg | Bin 0 -> 319 bytes classes/data/dataCities.php | 32 ++++-- index.php | 2 +- js/leaflet-area-map.js | 54 ++++++--- models/admin/ajax/citiesMapData.php | 28 +++-- models/admin/ajax/countiesMapData.php | 107 ------------------ models/admin/ajax/membersMapData.php | 6 +- models/admin/settings/cities.php | 6 + models/front/members/interactivemap.php | 33 +++++- setup/databaseScripts/1.1.41-steve | 0 ...1.1.42.sql => create_database_V1.1.43.sql} | 1 + setup/databaseScripts/dbVersions.php | 1 + .../update_database_V1.1.43.sql | 11 ++ setup/shortcodes.php | 7 +- views/admin/settings/cities.html | 54 +++++++-- views/front/members/interactivemap.html | 22 +++- 23 files changed, 197 insertions(+), 167 deletions(-) create mode 100644 assets/MapIcons/InteractiveMap/blue.png create mode 100644 assets/MapIcons/InteractiveMap/brown.png create mode 100644 assets/MapIcons/InteractiveMap/green.png create mode 100644 assets/MapIcons/InteractiveMap/grey.png create mode 100644 assets/MapIcons/InteractiveMap/orange.png create mode 100644 assets/MapIcons/InteractiveMap/purple.png create mode 100644 assets/MapIcons/InteractiveMap/red.png create mode 100755 assets/bg_caption.jpg delete mode 100644 models/admin/ajax/countiesMapData.php delete mode 100644 setup/databaseScripts/1.1.41-steve rename setup/databaseScripts/{create_database_V1.1.42.sql => create_database_V1.1.43.sql} (99%) create mode 100755 setup/databaseScripts/update_database_V1.1.43.sql diff --git a/assets/MapIcons/InteractiveMap/blue.png b/assets/MapIcons/InteractiveMap/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..ad0802bd060b234e9fe7cb744cff00c506e4a171 GIT binary patch literal 800 zcmV+*1K<3KP)n;z^CB6MvpMh81Z7}2Fm6iJX5J@iF~ppTPvN(kyu^g)-% zK#4xE1kHn5NP?Ak(ejJUb{%(T+-b+zx5LhmAFDgAK9?7s_j!KI!@Tb+v3b-1^*}Ws z18HCi=m);%=v^0wfzNgEep)U-%a z(e;{|XOxuG=L7+YiuU67htagoFxU&g;7T+EbXHbgRZ2^bdIH^0ln@04K6JhB5bzjC z$j)A~qU`ZiRGiro=tg<@X;ih!2Q)+Gm;f}Em7PG63iCoGsgPjs1VE#U%0R8p7tRZG z!{<8yPz%U1paQC@hPH(|{VJfk<0Hhj%vJp|kOEScHN7p==}!SE_dbsq#^AP4r+*Ac zyW@9hS_eW{d4WPKqiG!gUGV=%-LtGYJsN$O7aEN|!m{Rc;2!+HQ96(?jKL#*e;8G* z@(dcr5Hm9u0s8{bvl0auf^>O2{x)1vau7w?ofAwZN12>Fg%HVh;HH}|SX1{-2y0&= z(X&4oJcca$Hw0~afr*Ke*mmp%(6n+-&QjmByc`*wp1wrpEzTaZv)8b!x$(8&MyLs# z()HeDP3z1G>UzKPKy!}F|Hz2~d;Cvw(T~aG2truyOVpjK!3+9Dh!jgp!=zF_ z0R}wuc#8Roin9W+f#O`nUcMAya%pJ@V3N#@+Y$7SGx{$t#a_{vZ6^TYJBj{w*4dpz eXPkAyOYuKNuNwdTL_qog0000QGPw zk&sCAA|kPhF1w|rtGMg#>^h4(+s^zt>@2>mJLBs2@`LAjz8~ht^E|)tP+1*7H*gG) z01NmFi~-XQ-W|FK`~XBiQACHTiqj1ZqC-_hKv4uB?EJ-YW>1;eJrCSCSzphE=4P7e z>UI<@X0wbeEHIf!AmBc5vl8@yBFh84ZEbX@s^fL0l1W~K!x*MH2wW@0Y}^yDr0&K>R7I%;`k^=`06k}eL1a(4zBx%Se3 z$1#Pd3TO(!csvg97B)s|NHYxmb1YUBbTk%2GYlOVf{l&RfwgEleW}&wL#?TC4UA?o z3`ZhZLR<$%HbViv3s8Tqu67;w`#I|MIszATohMUMu19yYwfZmx@sxVRP z=njQ7jmbm;;0nclI6?s?fk*G==P6j$mV^M_&(8zA0!GW3E3N5W%`kG~+rBoMPV-0C z0dDVRtOQ*Fo{udpZ3%u^UWVf6gsOo8JdS0v#Ijica;8ZrnFM%R$>ao`0KztinN*5` zW#zEfv05m=`&mr`z&=MP)A7ARKmFBpOd*ICU!spr1~<_0f@Lw6$*`Ks0ep4gai#dV zrX~THfa7c9_IEP(E0Y13qquPg0!<{=*8%>xDRv7@=1dbHbCA##`*ihda0^|u&);r} Z{{ypk9Fh+|qk8}V002ovPDHLkV1g1vXyX6? literal 0 HcmV?d00001 diff --git a/assets/MapIcons/InteractiveMap/green.png b/assets/MapIcons/InteractiveMap/green.png new file mode 100644 index 0000000000000000000000000000000000000000..5aab9198a79bf9619117fba4fceed362cdad2a60 GIT binary patch literal 802 zcmV+-1Ks?IP)A!Zo*A7PkIoDdsI?L-gh;yJA}I)0LH-9pAVF?g6x6oMs&)lN1wpius6|2| zL_#9bMMOeGr77_S-kRfF&N(x4&U`KAOits`Igb7|AAIlod%oNIejavL8_)?H0VE&? zEC8dxR2lC!bphW2A%|rVYzqqIlp=y{K_Q1_0SG(ZnAU5)oj? z33}Zld+sz}YbMYdaK4lh`40K;xA;knCpyRx1HKkRn}Bx>mm0iEyW$F1kT>i_@=0hj z+Iiq5kdW+HuN;;Gq0Z2rfCbfe*5i$M13)k2%LJgi?o1t?DyMfVFHe;R<+K9OU4Tl! zF@KA{B49zb{}>=ifDiC_L*9KsZNCrj6^@TU>vj3*p{+N_rUpy4X{_b3Ymm;j!xzh6g~CEFFSF}MNn1{iTN?|f-+-&9S*uD^fM zqdLaC0dRLG<8IJZ;ML~n=6{pwXBG0LGg%1~;8}V(O?o*EK+edKnoI$_*v(W9Iu6X* zAhc->VG0Ag9V>+b3~DnP0I8W2`*^Ml~ z7Z)B^S__>E3BUqs$|bwmDZrfmO9z-E-*E>5UC*v(0p{H#yM_MA899J>xx~FdSM726 gAfZe4_}fkLUzheAR?`UDasU7T07*qoM6N<$f-u%)vj6}9 literal 0 HcmV?d00001 diff --git a/assets/MapIcons/InteractiveMap/grey.png b/assets/MapIcons/InteractiveMap/grey.png new file mode 100644 index 0000000000000000000000000000000000000000..47e7520e1bbfd927e14826e5989a854bf6b3b3b1 GIT binary patch literal 815 zcmV+~1JL}5P)lTVb}&~>$(MIW%BL;&($g(W_ ze!qxBA|e`%W;}ksU&yj73x9DIwt`i6-Bw;-rim`5I~Y7Dk>_No1422 zya5u%bgsXyuCB7Dr{_{YUEST?*le~+pdZe*2|$O_>BM9*l>{}JOgNoRfDRpM1njM? zttA0$8Q!>X#5 z1x@?IKuT}l=k4OCSXMNv3CJ$(wyUW5XusZ{F5^z?MA!{NYcwH5@ft*z19+snbh!8q_j zk7v72-&w8J&Z(&>YHDh70(W+HkYyQ7)7}G*F6N9`=J#!FZLKPbl6UV84-cbh+6K_~ ze=ZyJ5ah4ZL-`-5EiT#{*|uXEl#EukHXM5D189G%A*tmxaY* z5kO}?Q@%<8z5yG-U=V;%C`2-uJS2S_ON9b_nxCHsAU)1<$raBg*=#n8a5yaL>+1#Z zq+B4tO+a`&9{uOxULivAa<3| tKZ!&FVD~Da+vzcWl~Dat`=gl2e*s0-F}Eu{_EP`=002ovPDHLkV1k&SW_SPq literal 0 HcmV?d00001 diff --git a/assets/MapIcons/InteractiveMap/orange.png b/assets/MapIcons/InteractiveMap/orange.png new file mode 100644 index 0000000000000000000000000000000000000000..e9157f216c906f5f5f5a348f99f87305361bf451 GIT binary patch literal 811 zcmV+`1JwM9P)0i zi~-Mp_i?=csRZZ&M3zGmrMa>=up?EJ=E@?=Aqha3`I2a6OO)7oi-lABx7n#GN+)kk z3YK|Q{ogb$b@{mAQV@a*!0A}fiy3xH^_B9Kl;+BD$LaW>a`_5NLdam>9Pgqh*}IZ z0@IS2JD#0sO|Q&PTNE&)BfHXApJ`18jze%w0Lm(M*s)m`HpY_83Kcu;0A(Sl1Z*kV zU`vi@sxZd}umzALKnCP2N0M!tGW{|jhsH-N2^r~^02NTjCiNvjO}`4Lq4zx0H5ynF z)btMlMri!@<~~1alFbHmXzud^w8Pv=)w?~0_j0!{DQLqBA8wD~1?pk$MR|eg?k|CT z1vxV7GZWv0=U)O;-SnaxoCKWVP=HsuVAbtGC4bK*nKdh<=#((^f72*$^56@II^b+5 zKEI_7RVVlUu$ot%mr8~`+Rqr&AD=;4<0QXlL$6%|-;Tzn+EQ>bR1D0yMb3YrOlR0Wjqk z+#6B>uEjFNgZ2W$cL!AfoFgiVCj6MsFhkJI>3trJPGO7v4S)K=s@anL3_5ZO%cGyM2Zs`AKl5kCU)0(g`U`qC*mdpoao;w|$QY-c_?&)}~?l3KD4xNpR*88y9ji~Vs= zRSz|#H3fkHm5xe0B_5{3(@h$h41CLkUIX5DT2oC;{DxuO}j-CYWFLwZaA+8Zx5VzpRvJM+kDvC?$0383A8NB_IW)_7C>Y1l9d1AZ6_Hav&Z!6IAyv z1DetPh%f9z6>3pHRjByFK7bK89I1X;kt5@O#*2bZgeH&`IRf;<;YLM(a3B%5<0+06u>7C?wROJQ*CK26}F0kz|G_)1KR_nM5+&XYQ&GP&_`9M zHx^y-eOE{c%@6Gi<(=K(-C<-!UOf)X1x)~V z7h{Xcba*-|a3!{aKjH_tNBTVqLIGxgS0leiP=s{{CbOAyK>?o0ik#5r z@4o`^02_%7fG4?(`Jg+%+sV+;%S?r)AU!(s#XtdG2a`d9sUQGxEzVqY4&Y5bQz57y zSe=c`0V8KRNz9PVly`dSl3%$C%tj!0^QSF|7oV!EObAv#R2}FCv-_dkdPt(0000MRDioNnr!G=|fCjx>mJS`fBm_l=3J*pU6%<5=UJkw75{#mv5F&^L zX%8YvRu*UlAtWVUlFG&0+;AOtUYwm@hnYdsad%z)UIu>8^ZoF9=6RkOiTv6D>;{?u z8E}A~zTF;l*P?W+~w8mIN2tqESv(SF^LC zVpYxaNj)bNm;5KkEAM{RCmQQ!r)DTnEg5?Zkvz(flL35lg;EaDBT9$LVLXxgL ztE*#ABvKFvu)VB|)^M0!O>4=)U*N-XXg%=a^46_oZP92^Kwk}tf-1|r(e-`66JTEU zVx5hOq8_iRS{KmQv8pPX6h#F(!5tHTw)V{c4 zy8dQBmVt7hyg^Ym1oiyoK)GK&VnfLP{W4$y)-T)M5Y+QqfaUM=_^_^T2IpBBZhIHB@&@&9g{F( z7@SR|$iaDFa5)s<9(Bb~ZMruN# zfUv8-xg7harbycMbKubOm>iIQ;&(1Lb}p65JG+-=XGz-j1aM+yEC^}SCi)i^0C=P8m_itM z>sTrjpl`_g*t~UbIY>aq*9(0$YMLwx!LVTf3>4uhs9He8>+6N&PE_k=Kmk%6)zt#X z0R?|%#gq>)IpUT+iMw%|0{t_&xCrp0nB-!i>3PQi$ZRHb#(O3=6FTKRzZaAI53(u_ USI^N$umAu607*qoM6N<$f=32k{r~^~ literal 0 HcmV?d00001 diff --git a/assets/bg_caption.jpg b/assets/bg_caption.jpg new file mode 100755 index 0000000000000000000000000000000000000000..742f5df37b9d34e6de43909abff925357194b63a GIT binary patch literal 319 zcmZXOze>YU6vn@kG$2hh_q1s*+{!I9v>6Ibq-2yvkb-XF8)zKF!O6khU0j{|C>4AH zC;u!yfcgs8FmcV_14{y$|Zb4`Pu%dpjb5LKOU7%iz zA@_khs4xtpP(_i_@ph~SiBid6sQ(yRZ3Jy?I?l$a&GY#@&#O&{vVbvOH9)5 zCuU;It}&A$wL)4EV(J0hRtg3nms>1BWQ_`Rabd-wJWZKE>+ literal 0 HcmV?d00001 diff --git a/classes/data/dataCities.php b/classes/data/dataCities.php index 846b2893..57681df6 100644 --- a/classes/data/dataCities.php +++ b/classes/data/dataCities.php @@ -109,20 +109,34 @@ class GlmDataCities extends GlmDataAbstract $this->fields = array( 'id' => array( - 'field' => 'id', - 'type' => 'integer', + 'field' => 'id', + 'type' => 'integer', 'view_only' => true, - 'use' => 'a' + 'use' => 'a' ), // Name 'name' => array( - 'field' => 'name', - 'type' => 'text', + 'field' => 'name', + 'type' => 'text', 'required' => true, - 'unique' => true, - 'use' => 'a' - ) + 'unique' => true, + 'use' => 'a' + ), + + // County + 'county' => array( + 'field' => 'county', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'counties', + 'p_field' => 'id', + 'p_orderby' => 'name', + 'p_blank' => true, + 'force_list' => false, + 'required' => false, + 'use' => 'a', + ), + ); @@ -213,4 +227,4 @@ class GlmDataCities extends GlmDataAbstract } } -?> \ No newline at end of file +?> diff --git a/index.php b/index.php index a13eb279..3a15559c 100755 --- a/index.php +++ b/index.php @@ -48,7 +48,7 @@ if (!defined('ABSPATH')) { */ define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.45'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.42'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.43'); // Check if plugin version is not current in WordPress option and if needed updated it if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { diff --git a/js/leaflet-area-map.js b/js/leaflet-area-map.js index 94d12d9e..2b8a430e 100644 --- a/js/leaflet-area-map.js +++ b/js/leaflet-area-map.js @@ -65,7 +65,6 @@ var GlmMap = { cache: false, dataType: 'json', success: function( mapData ){ - console.log( 'mapData: ', mapData ); GlmMap._centerCity( mapData ) } }); @@ -76,11 +75,10 @@ var GlmMap = { GlmMap._hideLocations(); var params = "county_id=" + jQuery(this).data('id'); jQuery.ajax({ - url: glm_ajax_url + '?action=glm_members_admin_ajax&glm_action=countiesMapData&' + params, + url: glm_ajax_url + '?action=glm_members_admin_ajax&glm_action=citiesMapData&' + params, cache: false, dataType: 'json', success: function( mapData ){ - console.log( 'mapData: ', mapData ); GlmMap._centerCounty( mapData ) } }); @@ -146,7 +144,6 @@ var GlmMap = { _loadData: function(markers) { var colorMarker = ''; - // var markers = data.documentElement.getElementsByTagName("marker"); for (i = 0; i < markers.length; i++) { var name = markers[i].member_name; var street = markers[i].addr1; @@ -169,8 +166,25 @@ var GlmMap = { var plannerText = '';//markers[i].getAttribute('plannerText'); var moreInfoUrl = '';//markers[i].getAttribute('moreInfoUrl'); var markerColor = markers[i].color;//getAttribute('iconUrl'); + var category = markers[i].category; + + // Check if there's bounds + if ( glm_lat_bounds ) { + var latbounds = glm_lat_bounds.split(','); + if ( parseFloat(lat) < parseFloat(latbounds[0]) || parseFloat(lat) > parseFloat(latbounds[1]) ) { + // out of bounds + continue; + } + } + if ( glm_lon_bounds ) { + var lonbounds = glm_lon_bounds.split(','); + if ( parseFloat(lng) < parseFloat(lonbounds[0]) || parseFloat(lng) > parseFloat(lonbounds[1]) ) { + // out of bounds + continue; + } + } - var html = ''; + var html = '
'; if (street == null) { street = ''; } @@ -183,7 +197,7 @@ var GlmMap = { if (zip == null) { zip = ''; } - html += ' {/if} {/foreach} @@ -148,9 +180,15 @@ }); $('.editCity').click( function() { var cityID = $(this).attr('data-cityID'); + var county = $(this).data('county'); var cityName = $(this).text(); $('#editCityID').val(cityID); $('#editCityName').val(cityName.trim()); + if ( county ) { + $('#editCounty').val(county); + } else { + $('#editCounty').val(0); + } $("#editCityDialog").dialog("open"); }); $('#editCityCancel').click( function() { @@ -169,13 +207,13 @@ $('#deleteCityCancel').click( function() { $("#deleteCityDialog").dialog("close"); }); - + var citiesWithMembers = '{$citiesWithMembersJSON}'; citiesWithMembers = JSON.parse(citiesWithMembers); $('.deleteCityWithMembersButton').click( function() { - + id = $(this).attr('data-cityID'); - + var citiesString = '
    '; //console.log(citiesString); $.each(citiesWithMembers[id], function(memberID, memberName) { @@ -201,7 +239,7 @@ citiesString += '
  • ' + memberName + '
  • '; }); citiesString += '
'; - + $("#showMembersWithCityDialog .cityMembers").html(citiesString); $("#showMembersWithCityDialog").dialog("open"); }); diff --git a/views/front/members/interactivemap.html b/views/front/members/interactivemap.html index 29054e2e..632213a9 100644 --- a/views/front/members/interactivemap.html +++ b/views/front/members/interactivemap.html @@ -1,11 +1,15 @@ + {literal} {/literal} -- 2.17.1
' + name + '
' + + html += '
' + name + '
' + street + '
' + city + ', ' + state + ' ' + zip; if (phone != '' && phone != null) { @@ -209,20 +223,23 @@ var GlmMap = { html += 'Get Directions'; - defaultMarker = L.AwesomeMarkers.icon({ - prefix: 'fa', - icon: 'dot-circle', - markerColor: 'blue', - }); + if ( category ) { - if ( markerColor ) { - colorMarker = L.AwesomeMarkers.icon({ - prefix: 'fa', - icon: 'dot-circle', - markerColor: markerColor, + var LeafIcon = L.Icon.extend({ + options: { + shadowUrl: 'res/marker-shadow.png' + } }); - var leafletMarker = L.marker([lat, lng], { title: name, icon: colorMarker }) - .bindPopup( html ) + + var iconColor = ( category == 'default' ) ? 'grey': glm_map_colors[category]; + var iconUrl = glm_assets_url + '/MapIcons/InteractiveMap/' + iconColor + '.png'; + + var testIcon = new LeafIcon({ + iconUrl: iconUrl, + iconSize: [21, 34], + }); + var leafletMarker = L.marker([lat, lng], { title: name, icon: testIcon }) + .bindPopup( html, {width: 400} ) .addTo(GlmMap.markerGroup); } else { var leafletMarker = L.marker([lat, lng], { title: name, icon: defaultMarker }) @@ -230,6 +247,7 @@ var GlmMap = { .addTo(GlmMap.markerGroup); } + } GlmMap.leafletMap.addLayer(GlmMap.markerGroup); diff --git a/models/admin/ajax/citiesMapData.php b/models/admin/ajax/citiesMapData.php index eef1892a..640f1333 100644 --- a/models/admin/ajax/citiesMapData.php +++ b/models/admin/ajax/citiesMapData.php @@ -75,6 +75,7 @@ class GlmMembersAdmin_ajax_citiesMapData extends GlmDataCities public function modelAction ( $actionData = false ) { $cityData = array(); + $params = array(); trigger_error( print_r( $_REQUEST, true ), E_USER_NOTICE ); @@ -82,20 +83,25 @@ class GlmMembersAdmin_ajax_citiesMapData extends GlmDataCities trigger_error( print_r( $_REQUEST['values'], true ), E_USER_NOTICE ); } - $city_id = filter_var( $_REQUEST['city_id'], FILTER_VALIDATE_INT ); + $city_id = filter_var( $_REQUEST['city_id'], FILTER_VALIDATE_INT ); + if ( $city_id ) { + $params[] = "id = $city_id"; + } + + $county_id = filter_var( $_REQUEST['county_id'], FILTER_VALIDATE_INT ); + if ( $county_id ) { + $params[] = "county = $county_id"; + } + + $where = ' WHERE ' . implode( " AND ", $params ); - $where = "T.id = $city_id"; + $sql = "SELECT * + FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities"; + $sql .= $where; - $cityData = $this->wpdb->get_results( - $this->wpdb->prepare( - "SELECT * - FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities - WHERE id = %d", - $city_id - ), - ARRAY_A - ); + trigger_error( $sql, E_USER_NOTICE ); + $cityData = $this->wpdb->get_results( $sql, ARRAY_A ); header( 'Content-type: application/json' ); echo json_encode( $cityData ); diff --git a/models/admin/ajax/countiesMapData.php b/models/admin/ajax/countiesMapData.php deleted file mode 100644 index 8733351e..00000000 --- a/models/admin/ajax/countiesMapData.php +++ /dev/null @@ -1,107 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 0.1 - */ - -// Load Members data abstract -require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCounties.php'; - -/* - * This class performs the work of handling images passed to it via - * an AJAX call that goes through the WorPress AJAX Handler. - * - */ -class GlmMembersAdmin_ajax_countiesMapData extends GlmDataCounties -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * Plugin Configuration Data - * - * @var $config - * @access public - */ - public $config; - - /* - * Constructor - * - * This contructor sets up this model. At this time that only includes - * storing away the WordPress data object. - * - * @return object Class object - * - */ - 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); - - } - - /* - * Perform Model Action - * - * This modelAction takes an AJAX image upload and stores the image in the - * media/images directory of the plugin. - * - * This model action does not return, it simply does it's work then calls die(); - * - * @param $_REQUEST['id'] File Library ID - */ - public function modelAction ( $actionData = false ) - { - $countyData = array(); - - trigger_error( print_r( $_REQUEST, true ), E_USER_NOTICE ); - - if ( isset( $_REQUEST['values'] ) ) { - trigger_error( print_r( $_REQUEST['values'], true ), E_USER_NOTICE ); - } - - $county_id = filter_var( $_REQUEST['county_id'], FILTER_VALIDATE_INT ); - - $where = "T.id = $county_id"; - - $countyData = $this->wpdb->get_results( - $this->wpdb->prepare( - "SELECT * - FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "counties - WHERE id = %d", - $county_id - ), - ARRAY_A - ); - - - header( 'Content-type: application/json' ); - echo json_encode( $countyData ); - - exit; - - } - -} diff --git a/models/admin/ajax/membersMapData.php b/models/admin/ajax/membersMapData.php index bbbcf460..38a5eabc 100644 --- a/models/admin/ajax/membersMapData.php +++ b/models/admin/ajax/membersMapData.php @@ -122,9 +122,11 @@ class GlmMembersAdmin_ajax_membersMapData extends GlmDataMemberInfo ARRAY_A ); if ( count( $cats ) > 1 || count( $cats ) == 0 ) { - $memberInfo['color'] = 'blue'; + $memberInfo['color'] = 'grey'; + $memberInfo['category'] = 'default'; } else if ( count( $cats ) == 1 ) { - $memberInfo['color'] = $colorArray[$cats[0]['parent']]; + $memberInfo['color'] = $colorArray[$cats[0]['parent']]; + $memberInfo['category'] = $cats[0]['parent']; } } diff --git a/models/admin/settings/cities.php b/models/admin/settings/cities.php index 2c9378cf..2ee87c1b 100644 --- a/models/admin/settings/cities.php +++ b/models/admin/settings/cities.php @@ -15,6 +15,7 @@ // Load Member Types data abstract require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'; +require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCounties.php'; /* * This class performs the work for the default action of the "Members" menu @@ -102,6 +103,7 @@ class GlmMembersAdmin_settings_cities extends GlmDataCities $success = true; $haveCities = false; $cities = false; + $counties = false; $error = false; // Check if a city ID is supplied @@ -138,6 +140,9 @@ class GlmMembersAdmin_settings_cities extends GlmDataCities // Get a current list of members $cities = $this->getList( '', 'name' ); + $Counties = new GlmDataCounties( $this->wpdb, $this->config ); + $counties = $Counties->getList(); + // If we have list entries - even if it's an empty list $success = true; $haveCities = false; @@ -183,6 +188,7 @@ class GlmMembersAdmin_settings_cities extends GlmDataCities $templateData = array( 'haveCities' => $haveCities, 'cities' => $cities, + 'counties' => $counties, 'citiesWithMembers' => $citiesWithMembers, 'citiesWithMembersJSON' => $citiesWithMembersJSON diff --git a/models/front/members/interactivemap.php b/models/front/members/interactivemap.php index 36ff470b..e0d61a91 100644 --- a/models/front/members/interactivemap.php +++ b/models/front/members/interactivemap.php @@ -99,9 +99,21 @@ class GlmMembersFront_members_interactivemap //extends GlmDataMemberInfo */ public function modelAction ( $actionData = false ) { - $settings = array(); - $success = true; - $mainCats = array(); + $settings = array(); + $success = true; + $mainCats = + $mainColors = + $colors = array(); + $latbounds = + $latbounds = false; + + if ( $actionData['request']['lon-bounds'] ) { + $latbounds = $actionData['request']['lat-bounds']; + } + + if ( $actionData['request']['lon-bounds'] ) { + $lonbounds = $actionData['request']['lon-bounds']; + } if ( $actionData['request']['main-level-cats'] ) { // Setup the main level categories for the Map. @@ -114,6 +126,18 @@ class GlmMembersFront_members_interactivemap //extends GlmDataMemberInfo } } + if ( $actionData['request']['main-level-colors'] ) { + // Setup the main level colors + $mainColorsRequested = explode( ',', $actionData['request']['main-level-colors'] ); + + foreach ( $mainColorsRequested as $k => $v ) { + $mainColors[] = $v; + } + + } + + $colors = array_combine( $mainCats, $mainColors ); + // Need Member Categories (with active members) // Need Cities (with active members) // Need Regions (with active members) @@ -124,6 +148,9 @@ class GlmMembersFront_members_interactivemap //extends GlmDataMemberInfo 'counties' => $this->getCounties(), 'counties' => $this->getCounties(), 'cities' => $this->getCities(), + 'latbounds' => $latbounds, + 'lonbounds' => $lonbounds, + 'colors' => $colors, ); // echo '
$categories: ' . print_r( $this->getMemberCategories(), true ) . '
'; diff --git a/setup/databaseScripts/1.1.41-steve b/setup/databaseScripts/1.1.41-steve deleted file mode 100644 index e69de29b..00000000 diff --git a/setup/databaseScripts/create_database_V1.1.42.sql b/setup/databaseScripts/create_database_V1.1.43.sql similarity index 99% rename from setup/databaseScripts/create_database_V1.1.42.sql rename to setup/databaseScripts/create_database_V1.1.43.sql index 847cf026..ed453876 100755 --- a/setup/databaseScripts/create_database_V1.1.42.sql +++ b/setup/databaseScripts/create_database_V1.1.43.sql @@ -93,6 +93,7 @@ CREATE TABLE {prefix}cities ( name TINYTEXT NULL, -- Name of city lat FLOAT NULL, -- Latitude of city's location lon FLOAT NULL, -- Longitude of city's location + county INT NULL, -- County reference to county table PRIMARY KEY (id) ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 745e8f87..66131ba8 100755 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -74,6 +74,7 @@ $glmMembersDbVersions = array( '1.1.40' => array('version' => '1.1.40', 'tables' => 23, 'date' => '09/25/18'), '1.1.41' => array('version' => '1.1.41', 'tables' => 23, 'date' => '10/12/18'), '1.1.42' => array('version' => '1.1.42', 'tables' => 23, 'date' => '10/29/18'), + '1.1.43' => array('version' => '1.1.43', 'tables' => 23, 'date' => '11/07/18'), ); diff --git a/setup/databaseScripts/update_database_V1.1.43.sql b/setup/databaseScripts/update_database_V1.1.43.sql new file mode 100755 index 00000000..af377a7f --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.43.sql @@ -0,0 +1,11 @@ +-- Gaslight Media Members Database +-- File Created: 2018-10-12 +-- Database Version: 1.1.41 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Add county to cities table +ALTER TABLE {prefix}cities ADD COLUMN county INT NULL; -- County reference to county table + diff --git a/setup/shortcodes.php b/setup/shortcodes.php index ac97f401..91407bcd 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -206,8 +206,11 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) { 'action' => 'interactivemap', 'table' => false, 'attributes' => array( - 'client' => 'uptra', - 'main-level-cats' => false, + 'client' => 'uptra', + 'main-level-cats' => false, + 'main-level-colors' => false, + 'lat-bounds' => false, + 'lon-bounds' => false, ), ), ); diff --git a/views/admin/settings/cities.html b/views/admin/settings/cities.html index cf107281..adf10802 100644 --- a/views/admin/settings/cities.html +++ b/views/admin/settings/cities.html @@ -6,6 +6,9 @@
+ {if !$settings.enable_counties} + + {/if} @@ -13,6 +16,19 @@ + {if $settings.enable_counties} + + + + + {/if}
City Name:
{$terms.term_county_cap}: + +

* Required

Cancel @@ -45,6 +61,9 @@ + {if !$settings.enable_counties} + + {/if} @@ -52,6 +71,19 @@ + {if $settings.enable_counties} + + + + + {/if}
City Name:
{$terms.term_county_cap}: + +

* Required

Cancel @@ -88,7 +120,7 @@
- {$t.name} + {$t.name} @@ -96,12 +128,12 @@ {if $t.id|array_key_exists:$citiesWithMembers} Assigned to {$citiesWithMembers[$t.id]|count} members
view
-
Delete
- {else} +
Delete
+ {else} Not assigned to any members
Delete
{/if} - +