'lat' => array(
'field' => 'lat',
'type' => 'float',
- 'default' => 45,
+ 'default' => $this->config['map_default_lat'],
'use' => 'a'
),
'lon' => array(
'field' => 'lon',
'type' => 'float',
- 'default' => -84,
+ 'default' => $this->config['map_default_lon'],
'use' => 'a'
),
; for the project should be the customer's Web site.
; https://accounts.google.com/ServiceLogin
;
-;googleMapsApiKey = 'AIzaSyDWgyf8MeYdxZRHaN73O37vFbkhvPjjNhU'
-googleMapsApiKey = ''
+googleMapsApiKey = 'AIzaSyDWgyf8MeYdxZRHaN73O37vFbkhvPjjNhU'
; General Settings
timezone = America/Detroit
+; Default map location is Gaslight Media office
+map_default_lat = 45.3749
+map_default_lon = -84.9592
;
; Entry Status Types
[chuck:common]
-;admin_debug = true
+admin_debug = true
+googleMapsApiKey = ''
// Otherwise check if one was supplied by the user or passed from somewhere else
} elseif (isset($_REQUEST['id'])) {
+
// Make sure it's a number
$memberID = $_REQUEST['id']-0;
+
+ // Not sure why I have this. Need to look for it.
} elseif (isset($_REQUEST['member'])) {
+
$memberID = $_REQUEST['member']-0;
+
}
- // If we don't have a member ID, setup to add a new member
+ /*
+ *
+ * Setup to add a new member
+ *
+ */
if ($memberID <= 0) {
// If this is a new member submission
if($memberData['status']) {
$memberID = $memberData['fieldData']['id'];
$haveMember = true;
+
+ // Go directly to the member information entry page
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => 'member',
+ 'modelRedirect' => 'memberInfo',
+ 'view' => 'admin/member/memberInfo.html',
+ 'data' => array(
+ 'member' => $memberID
+ )
+ );
+
}
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
// Setup to add a new member
$memberData = $this->newEntry();
+
}
- // Otherwise if this is a member update
+ /*
+ *
+ * Member update
+ *
+ */
} elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
$memberData = $this->updateEntry($memberID);
$haveMember = true;
- // Otherwise, have a member, get the base member data
+ /*
+ *
+ * Get existing base member data
+ *
+ */
} else {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data');
}
+ /*
+ *
+ * Other actions that may be required
+ *
+ */
+
// Check if there's a request to delete a specific member information record
if (isset($_REQUEST['deleteID']) && $_REQUEST['deleteID'] != '') {
}
}
-
// If we have a member then also get a list of member info records
$haveInfoRecords = false;
$memberInfoRecords = false;
$option = $_REQUEST['option'];
}
- // If a member ID is supplied, get that and make sure it's a valid integer
- if (isset($_REQUEST['member'])) {
+ // Check for redirection - Should be from creating a new member
+ if ($redirectData) {
+
+ if (!isset($redirectData['member'])) {
+ $memberID = $redirectData['member']-0;
+ }
+
+ $memberID = $redirectData['member']-0;
+ $option = 'create';
+
+ // Otherwise it should be a user submission
+ } elseif (isset($_REQUEST['member'])) {
$memberID = $_REQUEST['member']-0;
+
+ // If a member info record ID is supplied, get that and make sure it's an integer
+ if (isset($_REQUEST['id'])) {
+ $memberInfoID = $_REQUEST['id']-0;
+ $haveMemberInfo = true;
+
+ // Determine if this is the active record
+ $sql = "
+ SELECT status
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ WHERE id = $memberInfoID
+ ;";
+ $activeTest = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // If it is, then save that
+ if ($activeTest['status'] == $this->config['status_numb']['Active']) {
+ $isActive = true;
+ }
+
+ }
+
}
// If member ID not supplied - we shouldn't be here, so redirect to an error page
'data' => false
);
- // Otherwise get member base data
- } else {
- require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
- $Members = new GlmDataMembers($this->wpdb, $this->config);
- $memberData = $Members->getEntry($memberID);
- $this->fields['logo']['i_prefix'] = 'memb_'.$memberID.'_';
- $haveMember = true;
}
- // If a member info record ID is supplied, get that and make sure it's an integer
- if (isset($_REQUEST['id'])) {
- $memberInfoID = $_REQUEST['id']-0;
- $haveMemberInfo = true;
-
- // Determine if this is the active record
- $sql = "
- SELECT status
- FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
- WHERE id = $memberInfoID
- ;";
- $activeTest = $this->wpdb->get_row($sql, ARRAY_A);
-
- // If it is, then save that
- if ($activeTest['status'] == $this->config['status_numb']['Active']) {
- $isActive = true;
- }
-
- }
+ // Get member base data
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
+ $Members = new GlmDataMembers($this->wpdb, $this->config);
+ $memberData = $Members->getEntry($memberID);
+ $this->fields['logo']['i_prefix'] = 'memb_'.$memberID.'_';
+ $haveMember = true;
// If no member info record, assume that we need to create a new one
if ($memberInfoID <= 0 && $option != 'addNew') {
*/
switch ($option) {
- // Setup to input a nnew member information record
+ // Setup to input a new member information record
case 'create':
$MemberInfo = $this->newEntry();
<td>
<input id="glmLat" name="lat" type="hidden" value="{$memberInfo.fieldData.lat}">
<input id="glmLng" name="lon" type="hidden" value="{$memberInfo.fieldData.lon}">
- <div>
- <input type="hidden" name="lat" id="lat" value="{$memberInfo.fieldData.lat}" class="emTextInputShort">
- <input type="hidden" name="lon" id="lon" value="{$memberInfo.fieldData.lon}" class="emTextInputShort">
- </div>
<p>
MAP USE: Drag the pointer to the desired location for this member.
Use + and - buttons or the mouse wheel to zoom in or out.
*/
// Set default - Need to make this configurable
- var location = new google.maps.LatLng(45, -85)
+ var startLat = $('#glmLat').val();
+ var startLon = $('#glmLng').val();
+ var location = new google.maps.LatLng(startLat, startLon);
var map = new google.maps.Map(document.getElementById('locationMap'), {
- zoom: 14,
+ zoom: 15,
disableDefaultUI: false,
mapTypeId: google.maps.MapTypeId.MAP,
});
// Send to Google Geocoder
geocoder.geocode( { 'address': geoAddress }, function(results, status) {
-
+
// If we have a geocode solution
if (status == google.maps.GeocoderStatus.OK) {
- map.setCenter(results[0].geometry.location);
+
+ // Center the map and locate the marger to the new location
+ map.setCenter(results[0].geometry.location);
marker.setPosition( results[0].geometry.location );
+
+ // Assign the new position to the hidden fields for submission
+ $('#glmLat').val(results[0].geometry.location.lat());
+ $('#glmLng').val(results[0].geometry.location.lng());
// Otherwise tell the user.
} else {