*/
function __construct ($wpdb, $config)
{
- parent::__construct($wpdb, $config);
// Save WordPress Database object
$this->wpdb = $wpdb;
*/
function __construct ($wpdb, $config)
{
- parent::__construct($wpdb, $config);
// Save WordPress Database object
$this->wpdb = $wpdb;
*/
function __construct ($wpdb, $config)
{
- parent::__construct($wpdb, $config);
// Save WordPress Database object
$this->wpdb = $wpdb;
*/
function __construct ($wpdb, $config)
{
- parent::__construct($wpdb, $config);
// Save WordPress Database object
$this->wpdb = $wpdb;
*/
function __construct ($wpdb, $config)
{
- parent::__construct($wpdb, $config);
// Save WordPress Database object
$this->wpdb = $wpdb;
* @return void
* @access public
*/
- function __construct($wpdb, $config) {
-
- parent::__construct ( $wpdb, $config );
+ function __construct($wpdb, $config)
+ {
// Save WordPress Database object
$this->wpdb = $wpdb;
glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
}
+ }
-
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+
+ // Only run these tests for 'l' (getList)
+ if ($a != 'l') {
+ return $r;
+ }
+
+ // Get Member Category data for this entry
+ $sql = "
+ SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr,
+ COALESCE (
+ (
+ SELECT name
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories
+ WHERE id = C.parent
+ ), ''
+ ) AS parent_name
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C,
+ ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI
+ WHERE C.id = CMI.category
+ AND CMI.member_info = ".$r['id']."
+ ;";
+ $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
+
+ // Required
+ return $r;
}
+
}
?>
\ No newline at end of file
*/
function __construct ($wpdb, $config)
{
- parent::__construct($wpdb, $config);
// Save WordPress Database object
$this->wpdb = $wpdb;
* @return void
* @access public
*/
- function __construct($wpdb, $config) {
-
- parent::__construct ( $wpdb, $config );
+ function __construct($wpdb, $config)
+ {
// Save WordPress Database object
$this->wpdb = $wpdb;
*/
function __construct ($wpdb, $config)
{
- parent::__construct($wpdb, $config);
// Save WordPress Database object
$this->wpdb = $wpdb;
float: left;
}
-
-.glm-item-container {
+/* Member Containers */
+.glm-member-list-container {
border: 1px #ccc solid;
padding: .4em;
background: #f8f8f8;
+ margin: .4em 0px .4em 0px;
+}
+.glm-member-list-image {
+ float: right;
+}
+.glm-member-list-nameAddress {
+ float: left;
+}
+.glm-member-list-info {
+ clear: both;
+}
+.glm-member-list-categories {
+ margin-top: .5em;
}
/* Map */
+
.glm-map {
- width:90%;
+ width: 100%;
height:400px;
border: 2px black solid;
}
-
-
-.glm-copyright {
- text-align: center;
- margin: 2em;
+/* overrride whatever was causing the 100% width for images in Google Maps */
+.glm-map img {
+ max-width: none !important;
}
--- /dev/null
+,cscott,Ubuntu-1404,13.03.2015 12:40,file:///home/cscott/.config/libreoffice/4;
\ No newline at end of file
*/
public $deleteRestrictions = false;
- /**
- * Constructor
- *
- * @param object $d database connection
- *
- * @return void
- * @access public
- */
- public function __construct($wpdb, $config)
- {
-
- $this->wpdb = $wpdb;
- $this->config = $config;
-
- }
-
/**
* Field processing for various field types
*
if (trim($in) != '' && !is_numeric($in)) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Input is not numeric.';
+ $this->inputErrorReason = 'Input not numeric.';
return $in;
}
if ($in != '' && !is_numeric($in)) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Input is not numeric.';
+ $this->inputErrorReason = 'Input not numeric.';
return $in;
}
if (!is_numeric($in)) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Input is not numeric.';
+ $this->inputErrorReason = 'Input not numeric.';
return $in;
}
if (!is_numeric($in)) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Input is not numeric.';
+ $this->inputErrorReason = 'Input not numeric.';
return $in;
}
if ($in != '' && !is_numeric($in)) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Selected item is not valid.';
+ $this->inputErrorReason = 'Selected item not valid.';
// return $in;
}
if (!is_int($in)) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Selected item is not valid.';
+ $this->inputErrorReason = 'Selected item not valid.';
return $in;
}
// Is it one of the available values
if (isset($f['required']) && $f['required'] && trim($in) == '') {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Required input is not provded.';
+ $this->inputErrorReason = 'Required input not provded.';
}
// Is it a valid value
if (trim($in) != '' && !isset($list[$in])) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Value selected is not valid.';
+ $this->inputErrorReason = 'Value selected not valid.';
}
}
$filter = FILTER_SANITIZE_STRING;
if (isset($f['filter'])) {
if (!is_numeric($f['filter'])) {
- echo "<P> </p><strong>ERROR:</strong> Supplied value for option 'filter' in fields array is not a defined filter for PHP filter_input();";
+ echo "<P> </p><strong>ERROR:</strong> Supplied value for option 'filter' in fields array not a defined filter for PHP filter_input();";
exit;
}
$filter = $f['filter'];
(trim($in['sec']) != '' && !is_numeric($in['sec']))
) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Latitude input is not entirely numeric.';
+ $this->inputErrorReason = 'Latitude input not entirely numeric.';
return $in;
}
(trim($in['sec']) != '' && !is_numeric($in['sec']))
) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'Longitude input is not entirely numeric.';
+ $this->inputErrorReason = 'Longitude input not entirely numeric.';
return $in;
}
}
}
+ //
+ // Check if there's a function to do other checks
+ $data = $this->entryPostProcessing($data, $op);
+
+
if ($forEdit) {
$r = array(
'status' => true,
/**
* Stats Method
*
- * @return void
+ * @param string $where Optional WHERE clause for selection of entries. Defaults to all.
+ *
+ * @return integer Count of records matching $where
* @access public
*/
public function getStats($where = 'true')
}
/**
- * List Method
+ * List Entries Method
*
- * @return void
+ * @param string $where Optional WHERE clause for selection of entries. Defaults to all.
+ * @param string $order Optional ORDER BY clause for sorting of results.
+ * @param boolean $fieldVals Optional flag requesting fields contain array of all possible values.
+ * @param string $idField Optional name of ID field (primary index) to use for result array keys.
+ *
+ * @return array Array containing results
* @access public
*/
- public function getList($where = '', $order = '')
+ public function getList($where = '', $order = '', $fieldVals = true, $idField = 'id')
{
+ // NOTE: $fieldVals not yet implemented
// Get field specifications for this instance
$this->buildFieldsList('l');
glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query");
}
- //echo "<pre>$sql</pre>";
$list = $this->wpdb->get_results($sql, ARRAY_A);
if (count($list) == 0) {
return false;
}
- // Process individual fields
+ // Process field output data for each result - use ID field as key
+ $newList = array();
while (list($k, $v) = each($list)) {
- $list[$k] = $this->processOutputData($v, 'l');
+ $newList[$v['id']] = $this->processOutputData($v, 'l');
}
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($list, 'DataBlock', "getList() data");
+ glmMembersAdmin::addNotice($newList, 'DataBlock', "getList() data");
}
- return $list;
+ return $newList;
}
/**
* @return void
* @access public
*/
- public function getEntry($id, $idfield = 'id', $where = '', $forEdit = false)
+ public function getEntry($id, $idfield = 'id', $where = '', $fieldVals = false)
{
if ($id-0 == 0) {
}
// Process individual fields
- $detail = $this->processOutputData($detail, 'g', $forEdit);
+ $detail = $this->processOutputData($detail, 'g', $fieldVals);
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
/**
* Check Other fields (default function)
* This is here so it doesn't have to be defined in data{xxx}.php file.
- * if it is, be sure to use the following in that function.
- * parent::checkOther($r, $a);
+ * It will be overridden by any method of the same name in the extending code.
*
* @param array $r A result array from one of the other functions
* @param string $a The action type being performed (single letter, i.e. l, g, ...)
return $r;
}
+ /**
+ * Post process an individual result entry.
+ *
+ * This is here so it doesn't have to be defined in data{xxx}.php file.
+ * It will be overridden by any method of the same name in the extending code.
+ *
+ * @param array $r A single result entry
+ * @param string $a The action type being performed (single letter, i.e. l, g, ...)
+ *
+ * @return array Returns supplied result entry as updated
+ * @access public
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
/**
* Store New Method
*
* @return void
* @access public
*/
- public function editEntry($id, $idfield = 'id')
+ public function editEntry($id, $idField = 'id')
{
$this->buildFieldsList('g');
$sql = "SELECT $this->select
FROM $this->table T
- WHERE $idfield = $id
+ WHERE $idField = $id
;";
$detail = $this->wpdb->get_row($sql, ARRAY_A);
}
// Process individual fields
- $detail = $this->processOutputData($detail, 'e', true, $id, $idfield);
+ $detail = $this->processOutputData($detail, 'e', true, $id, $idField);
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - editEntry() query");
$where .= " T.status = ".$this->config['status_numb']['Active'];
- // Get a current list of members
+ /*
+ * Get a current list of members
+ */
+
$list = $this->getList($where);
if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
}
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+
+ // Only run these tests for 'l' (getList)
+ if ($a != 'l') {
+ return $r;
+ }
+
+ // Get Member Category data for this entry
+ $sql = "
+ SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr,
+ COALESCE (
+ (
+ SELECT name
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories
+ WHERE id = C.parent
+ ), ''
+ ) AS parent_name
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C,
+ ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI
+ WHERE C.id = CMI.category
+ AND CMI.member_info = ".$r['id']."
+ ;";
+ $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
+
+ // Required
+ return $r;
+ }
+
+
+
}
{if $haveMembers}
{foreach $members as $m}
- <div class="glm-item-container">
- <div><img src="{$glmPluginMediaURL}/images/small/{$m.logo}"></div>
- <div>
+ <div class="glm-member-list-container">
+ <div class="glm-member-list-image"><img src="{$glmPluginMediaURL}/images/small/{$m.logo}"></div>
+ <div class="glm-member-list-nameAddress">
<h2><a href=""{$thisURL}?action=detail&member={$m.id}">{$m.member}</a></h2>
<p>
{if $m.addr1}{$m.addr1}<br>{/if}
{if $m.addr2}{$m.addr2}<br>{/if}
{if $m.city.name}{$m.city.name}{if $m.state.name}, {/if}{/if}{if $m.state.name}{$m.state.name}{/if}{if $m.zip} {$m.zip}{/if}
{if $m.country.name}<br>{$m.country.name}{/if}
+ {if $m.region.value}<p>Region: {$m.region.name}</p>{/if}
</p>
-
-
+ </div>
+ <div class="glm-member-list-info">
{if $m.descr}
<p>{$m.descr}</p>
{else if $m.short_descr}
<p>{$m.short_descr}</p>
+ {/if}
+ {if $m.phone}Phone: {$m.phone}<br>{/if}
+ {if $m.toll_free}Toll Free: {$m.toll_free}<br>{/if}
+ {if $m.url}Web site: <a href="{$m.url}">{$m.url}</a><br>{/if}
+ {if $m.categories}
+ <div class="glm-member-list-categories">
+ Member Categories
+ <ul>
+ {foreach $m.categories as $c}
+ <li>
+ {if $c.parent_name}{$c.parent_name}: {/if}{$c.name}
+ </li>
+ {/foreach}
+ </ul>
+ </div>
{/if}
</div>
-
</div>
+
{/foreach}
{else}
<div>(no members listed)</div>
{/if}
+ {if $m.toll_free}<p>{$m.toll_free}</p>{/if}
<script type="text/javascript">
jQuery(document).ready(function($) {
/*
* Google Maps
- * API reference: https://developers.google.com/maps/documentation/javascript/reference
+ * API reference: https://develope {if $m.toll_free}<p>{$m.toll_free}</p>{/if}
+rs.google.com/maps/documentation/javascript/reference
*/
// Set default - Need to make this configurable
mapTypeId: google.maps.MapTypeId.MAP,
});
var geocoder = new google.maps.Geocoder();
-
var bounds = new google.maps.LatLngBounds();
+ var infowindow = new google.maps.InfoWindow({
+ maxWidth: 300
+ });
{if $haveMembers}
{foreach $members as $m}
position: new google.maps.LatLng({$m.lat}, {$m.lon}),
draggable: false,
animation: google.maps.Animation.DROP,
- title: "{$m.member}",
+ title: '{$m.member}',
+ descr: ' \
+ <b>{$m.member}</b><hr> \
+ <p>{$m.short_descr}<br> \
+ <a href="{$m.url}" target="memberWebSite">{$m.url}</a><br> \
+ <a href="{$thisURL}?action=detail&member={$m.id}">More Info</a> \
+ </p>',
memberID: {$m.id}
});
-
+
// Add a click listener for this marker
marker.addListener('click', function() {
- markerSelected(this);
+ infowindow.setOptions({
+ content: this.descr
+ });
+ infowindow.open(map,this);
});
// Extend the map bounds to include this marker
{/foreach}
{/if}
- // Marker click events - Send to detail page
- function markerSelected(t) {
- window.location.replace("{$thisURL}?action=detail&member=" + this.memberID);
- }
-
// Fit map to bounds of all markers
map.fitBounds(bounds);
-
-
+
});
</script>