function __construct ($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
function __construct ($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
function __construct ($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
function __construct ($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
function __construct ($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
function __construct($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
}
+ /*
+ * Find the active member info record for a specific member ID
+ *
+ * @param integer $member ID of the member
+ *
+ * @return integer Member info record ID or false if not found
+ */
+ public function getActiveInfoForMember($member) {
+
+ $memberID = $member - 0;
+
+ $sql = "
+ SELECT id
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "member_info
+ WHERE member = $memberID
+ AND status = ".$this->config['status_numb']['Active']."
+ ;";
+ $memberInfo = $this->wpdb->get_row($sql, ARRAY_A);
+
+ if ($memberInfo) {
+ return $memberInfo['id'];
+ }
+
+ return false;
+
+ }
+
/*
* Entry Post Processing Call-Back Method
*
public function entryPostProcessing($r, $a)
{
- // Only run these tests for 'l' (getList)
- if ($a != 'l') {
+ // Only run these tests for 'l' (getList) or 'g' (getEntry)
+ if ($a != 'l' && $a != 'g') {
return $r;
}
function __construct ($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
function __construct($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+ }
/*
* Table Name
function __construct ($wpdb, $config)
{
- // Save WordPress Database object
- $this->wpdb = $wpdb;
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
- // Save plugin configuration object
- $this->config = $config;
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
/*
* Table Name
'amenities',
'development'
),
+ 'shortcodes' => array(
+ 'index'
+ ),
'error' => array(
'index',
'badAction'
$this,
'glmMembersAdminMenuConfigure'
));
+
+ // Add a submenu for the "Shortcode Reference" section
+ add_submenu_page('glm-members-admin-menu-members',
+ 'Shortcode Reference', 'Shortcodes',
+ 'glm_members_shortcodes', 'glm-members-admin-menu-shortcodes',
+ array(
+ $this,
+ 'glmMembersAdminMenuShortcodes'
+ ));
+
}
/*
$this->controller('configure');
}
+ public function glmMembersAdminMenuShortcodes ()
+ {
+ $this->controller('shortcodes');
+ }
+
/**
* Admin controller
*
// Loop till we have a final action
$loopCheck = 0;
- $redirectData = false;
+ $actionData = false;
do {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
// Instantiate the model and ask it to perform the work
$model = new $className($this->wpdb, $this->config);
- $results = $model->modelAction($redirectData);
+ $results = $model->modelAction($actionData);
// Check if there's been a model redirect request
if ($results['modelRedirect']) {
// Check if there's data to pass to the new model
if (isset($results['data']) && count($results['data']) > 0) {
- $redirectData = $results['data'];
+ $actionData = $results['data'];
}
$modelRedirect = true;
$GLOBALS['glmMembersFrontValidActions'] = array(
'members' => array(
- 'list'
+ 'list',
+ 'detail'
+ ),
+ 'error' => array(
+ 'index',
+ 'badAction'
)
+
);
// Load glmPluginSupport class
'glmMembersFrontScripts'
));
- add_shortcode('glm-members',
+ add_shortcode('glm-members-list',
+ array(
+ $this,
+ 'controller'
+ ));
+
+ add_shortcode('glm-member-detail',
array(
$this,
'controller'
* @return void
* @access public
*/
- public function controller ($atts, $content = null)
+ public function controller ($atts, $content = null, $shortcode)
{
- // Shortcode Attributes defaults
- $request = shortcode_atts(
- array(
- 'action' => 'index',
- 'option' => false
- ),
- $atts,
- 'glm-members'
- );
+ // Set shortcode attribute defaults
+ switch ($shortcode) {
+
+ case 'glm-members-list':
+ $action = 'list';
+ $request = shortcode_atts(
+ array(
+ 'map' => true,
+ 'category' => false,
+ 'alpha' => false,
+ 'search' => false,
+ 'amenities' => false,
+ 'detail-page' => false
+ ),
+ $atts,
+ 'glm-members'
+ );
+ break;
+
+ case 'glm-member-detail':
+ $action = 'detail';
+ $request = shortcode_atts(
+ array(
+ 'map' => true,
+ 'id' => false
+ ),
+ $atts,
+ 'glm-members'
+ );
+ break;
+
+ }
/*
* Because WordPress insists on forcing the timezone to UTC
// Default action is "index"
$menuItem = 'members';
- $action = 'list';
- $option = false;
-
- // First check shortcode attributes
- if ($request['action']) {
- $action = $request['action'];
- }
- if ($request['option']) {
- $action = $request['option'];
- }
// Get any requested "action" from a form submission - Overrides shortcode attributes
if (isset($_REQUEST['glm_action']) && $_REQUEST['glm_action'] != '') {
// Loop till we have a final action
$loopCheck = 0;
- $redirectData = false;
+ $actionData = array(
+ 'request' => $request
+ );
+
do {
if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
// Verify that we have the requested menu item in the valid actions
if (! isset($GLOBALS['glmMembersFrontValidActions'][$menuItem])) {
-
$modelRedirect = true;
$menuItem = 'error';
$action = 'index';
$className = 'GlmMembersFront_' . $menuItem . '_' . $action;
// If model file doesn't exist - we have an error
- if (! file_exists($modelName)) {
+ if (!file_exists($modelName)) {
$modelRedirect = true;
$menuItem = 'error';
// check for an invalid model class name
if (! class_exists($className)) {
-
$modelRedirect = true;
$menuItem = 'error';
$action = 'index';
// Instantiate the model and ask it to perform the work
$model = new $className($this->wpdb, $this->config);
- $results = $model->modelAction($redirectData);
+ $results = $model->modelAction($actionData);
// Check if there's been a model redirect request
if ($results['modelRedirect']) {
// Check if there's data to pass to the new model
if (isset($results['data']) &&
count($results['data']) > 0) {
- $redirectData = $results['data'];
+ $actionData = $results['data'];
}
$modelRedirect = true;
// This is just a sanity check on this loop to keep it from getting
// out of control
- if (++ $loopCheck > 10) {
- die(
- '<h1>Serious failure looping on model load in "controllers/front.php".</h1>');
+ if (++$loopCheck > 10) {
+ die('<h1>Serious failure looping on model load in "controllers/front.php".</h1>');
}
if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG && $modelRedirect) {
$smarty = new smartyTemplateSupport();
// Add standard parameters
+ $smarty->templateAssign ( 'errorMsg', $errorMsg);
$smarty->templateAssign ( 'frontDebug', GLM_MEMBERS_PLUGIN_FRONT_DEBUG);
$smarty->templateAssign ( 'baseURL', GLM_MEMBERS_PLUGIN_BASE_URL);
$smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL );
$smarty->templateAssign('thisAction', $action);
- // If there's an error message, add that also
- if ($errorMsg != '') {
- $smarty->templateAssign('errorMsg', $errorMsg);
- }
-
// If view debug has been requested
if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
text-align: center;
margin: 2em;
}
+.glm-clear {
+ clear: both;
+}
.glm-button {
margin-left: 4px !important;
.glm-member-list-info {
clear: both;
}
-.glm-member-list-categories {
+.glm-member-list-items {
margin-top: .5em;
}
.glm-map img {
max-width: none !important;
}
+.glm-map-member-name {
+ width: 100%;
+ font-weight: bold;
+ border-bottom: 2px #ccc solid;
+}
\ No newline at end of file
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-09 19:07:47
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-15 10:21:53
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html" */ ?>
<?php /*%%SmartyHeaderCode:94073808254c05abfc4adf1-45287000%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'1be35689c5d30d774f40ebc45e387f5f95c45e90' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html',
- 1 => 1425940975,
+ 1 => 1426429308,
2 => 'file',
),
),
Add New Member
<?php }?>
</h2>
-
<form action="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
<?php }?>
<table class="glm-admin-table">
+ <tr><th>ID</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['id'];?>
+</td></tr>
<tr>
<th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['name']) {?>class="glm-required"<?php }?>>Member Name:</th>
<td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['name']) {?>class="glm-form-bad-input"<?php }?>>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-10 11:33:06
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-15 10:14:45
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/list.html" */ ?>
<?php /*%%SmartyHeaderCode:33593880254c05ab8e362a8-88978550%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'4c287ca0e4946b3d644e61950c851e98e8906d49' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/list.html',
- 1 => 1426001563,
+ 1 => 1426428835,
2 => 'file',
),
),
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
- <th>Access</th>
+ <th>ID</th>
<th>Member Name</th>
+ <th>Access</th>
<th>Member Type</th>
<th>Date Created</th>
<th>Pending</th>
<tr class="alternate">
<?php }?>
<td>
- <?php echo $_smarty_tpl->tpl_vars['m']->value['access']['name'];?>
+ <?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
</td>
<td>
?page=glm-members-admin-menu-member&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['m']->value['name'];?>
</a>
+ </td>
+ <td>
+ <?php echo $_smarty_tpl->tpl_vars['m']->value['access']['name'];?>
+
</td>
<td>
<?php echo $_smarty_tpl->tpl_vars['m']->value['member_type']['name'];?>
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
// Get current database version
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
// Determine if current user can add, edit, delete member data
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
// No work to perform here so just return status
}
- public function modelAction($redirectData = false) {
+ public function modelAction($actionData = false) {
// Return status, any suggested view, and any data to controller
return array(
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
$haveMemberTypes = ($memberTypesStats > 0);
// Check if a redirecting model supplied the member ID
- if (isset($redirectData['memberID'])) {
+ if (isset($actionData['memberID'])) {
- $memberID = $redirectData['memberID'];
+ $memberID = $actionData['memberID'];
// Otherwise check if one was supplied by the user or passed from somewhere else
} elseif (isset($_REQUEST['id'])) {
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
// Add scrips and css
add_action('glm_members_memberInfo_enqueue_scripts',
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
// Set some default values
$success = true;
}
// Check for redirection - Should be from creating a new member
- if ($redirectData) {
+ if ($actionData) {
- if (!isset($redirectData['member'])) {
- $memberID = $redirectData['member']-0;
+ if (!isset($actionData['member'])) {
+ $memberID = $actionData['member']-0;
}
- $memberID = $redirectData['member']-0;
+ $memberID = $actionData['member']-0;
$option = 'create';
// Otherwise it should be a user submission
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$success = true;
// Save plugin configuration object
$this->config = $config;
- // Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ /*
+ * Run constructor for members data class to setup table and fields array
+ *
+ * Since this class is extending GlmDataMembers, it does not need to pass
+ * $wpdb and $config to it in the constructor.
+ */
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$where = '';
$filterPending = false;
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Shortcodes Reference
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called when the "Shortcodes" menu is selected
+ *
+ */
+class GlmMembersAdmin_shortcodes_index
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+
+ /*
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ public function modelAction($actionData = false) {
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'admin/shortcodes/index.html',
+ 'data' => false
+ );
+
+ }
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Front-End Bad Action Error Model
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release front.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called if a bad action has been requested.
+ *
+ */
+class glmMembersFront_error_badAction
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+
+ /*
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ // No work to perform here so just return status
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'front/error/badAction.html',
+ 'data' => false
+ );
+ }
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Front-End Generic Error Model
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release front.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called if there is a generic/unknown error
+ *
+ */
+class GlmMembersFront_error_index
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+
+ /*
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ public function modelAction($actionData = false) {
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'front/error/index.html',
+ 'data' => false
+ );
+
+ }
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Front Member Detail
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Members data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersFront_members_detail extends GlmDataMemberInfo
+{
+
+ /**
+ * 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 method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $where = '';
+ $haveMember = false;
+
+ // If member ID submitted in the URL
+ if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
+
+ $id = ($_REQUEST['id'] - 0);
+
+ // Otherwise if ID from the short-code
+ } elseif (isset($actionData['request']) && isset($actionData['request']['id'])) {
+
+ $id = ($actionData['request']['id'] - 0);
+
+ }
+
+ // Check that ID is a positive value
+ if ($id <= 0) {
+
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'front/error/index.html',
+ 'data' => false
+ );
+
+ }
+
+ // Find the active member info record
+ $memberInfoID = $this->getActiveInfoForMember($id);
+
+ /*
+ * Get data on the specified member
+ */
+ $memberData = $this->getEntry($memberInfoID);
+
+
+ if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+ glmMembersFront::addNotice($memberData, 'DataBlock', 'Member Data');
+ }
+
+ // If we have member data
+ $success = true;
+ $haveMember = false;
+ if ($memberData !== false) {
+
+ $success = true;
+ $haveMember = true;
+
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveMember' => $haveMember,
+ 'member' => $memberData,
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'front/members/detail.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
$this->config = $config;
// Run constructor for members data class
- parent::__construct($this->wpdb, $this->config);
+ parent::__construct(false, false);
}
* produce output.
*
*/
- public function modelAction ($redirectData = false)
+ public function modelAction ($actionData = false)
{
$where = '';
$filterName = false;
$haveFilter = false;
+ // Apply any specified category filter
+
$where .= " T.status = ".$this->config['status_numb']['Active'];
/*
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
+ <th>ID</th>
<th>Category</th>
<th>Description</th>
<th>Short Description</th>
{else}
<tr class="alternate">
{/if}
+ <td>{$t.id}</td>
<td>
<span{if $t.parent.value} class="glm-indent"{/if}>
<a class="editCategory" data-categoryID="{$t.id}" data-categoryParent="{$t.parent.value}">{$t.name}</a>
Add New Member
{/if}
</h2>
-
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="index">
{/if}
<table class="glm-admin-table">
+ <tr><th>ID</th><td>{$member.fieldData.id}</td></tr>
<tr>
<th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
<td {if $member.fieldFail.name}class="glm-form-bad-input"{/if}>
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
- <th>Access</th>
+ <th>ID</th>
<th>Member Name</th>
+ <th>Access</th>
<th>Member Type</th>
<th>Date Created</th>
<th>Pending</th>
<tr class="alternate">
{/if}
<td>
- {$m.access.name}
+ {$m.id}
</td>
<td>
<a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}">{$m.name}</a>
</td>
+ <td>
+ {$m.access.name}
+ </td>
<td>
{$m.member_type.name}
</td>
--- /dev/null
+<div class="wrap">
+
+ <h2>{$glmPluginName}</h2>
+
+
\ No newline at end of file
--- /dev/null
+{include file='admin/shortcodes/header.html'}
+
+ <h2>Shortcodes Reference</h2>
+
+ <p>
+ Listed below are the shortcodes that may be used in this Web site to display
+ member lists, member detail information, maps of members, and other related
+ information. Simply paste these codes into a the text content editor for a page
+ in this Web site. You may also include other text along with the shortcode.
+ Some shortcodes allow for additional "attributes" you can use to more specifically
+ direct what will be displayed on the page.
+ </p><p>
+ When using a Shortcode in a page, be sure to include the "[" and "]" characters.
+ The attributes show below each Shortcode in the table below may be included in the
+ Shortcode to modify behavior of the Shortcode. One or more of these attributes may be
+ inserted into the shortcode. When including multiple attributes in a Shortcode,
+ be sure to leave a space between the attributes. An example is shown below.
+ </p>
+ <p><pre>[glm-members action="list" category="Accommodations"]</pre></p>
+
+ <table class="glm-admin-table">
+ <tr><th>Shortcode</th><th>Attribute</th><th>Attribute Value</th><th>Description</th></tr>
+ <tr>
+ <th colspan="3">[glm-member-list]</th>
+ <td>
+ Displays a list of members and a map with markers for each member. Optionally,
+ the attributes below may used to modify the display of this page.
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <th colspan="2">
+ category="{ category ID(s) }"
+ </th>
+ <td>
+ The "category" attribute is used display only members in a specific category or
+ ctegories. To select multiple categories, separate the categories with a ",".
+ Categories are specified by ID number. The ID for each category is
+ shown in the Member Categories list.
+ </td>
+ </tr>
+ <tr>
+ <th colspan="3">[glm-member-detail]</th>
+ <td>
+ Displays details for a speicif member along with a map showing their location. The
+ "id" attribute below is required to specify which member to display.
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <th colspan="2">
+ id="{ member ID }"
+ </th>
+ <td>
+ This is a required attribute for [glm-member-detail] that specifies the ID of
+ the desired member. The ID for a member is displayed both in the left column
+ of the member list and at the top of the Member Dashboard. Only one ID may
+ be specified.
+ </td>
+ </tr>
+ </table>
+
+{include file='admin/footer.html'}
<h2>Sorry, we've had an error.</h2>
- <p><b>Error: </b>: An invalid action has been specified.</p>
+ <p><b>Error: </b>: An invalid action or Shortcode attribute has been specified.</p>
- {if $errorMsg}<p>{$errorMsg}</p>{/if}
-
<p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
{include file='front/footer.html'}
<div class="wrap">
- <h2>{$glmPluginName}</h2>
\ No newline at end of file
<h3>Sorry, we've had some type of fatal error.</h3>
+ {if $errorMsg}<p>{$errorMsg}</p>{/if}
+
<p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
</center>
--- /dev/null
+{include file='front/members/header.html'}
+
+{if $haveMember}
+
+ <script src="http://maps.googleapis.com/maps/api/js?sensor=true&key={$googleMapsBrowserApiKey}"></script>
+
+ <div id="locationMap" class="glm-map">(map loads here)</div>
+
+
+ <h3>Member Detail</h3>
+
+ <div class="glm-member-list-container">
+ <div class="glm-member-list-image"><img src="{$glmPluginMediaURL}/images/small/{$member.logo}"></div>
+ <div class="glm-member-list-nameAddress">
+ <h2><a href="{$thisURL}?glm_action=detail&id={$member.id}">{$member.member}</a></h2>
+ <p>
+ {if $member.addr1}{$member.addr1}<br>{/if}
+ {if $member.addr2}{$member.addr2}<br>{/if}
+ {if $member.city.name}{$member.city.name}{if $member.state.name}, {/if}{/if}{if $member.state.name}{$member.state.name}{/if}{if $member.zip} {$member.zip}{/if}
+ {if $member.country.name}<br>{$member.country.name}{/if}
+ {if $member.region.value}<p><b>Region:</b> {$member.region.name}</p>{/if}
+ </p>
+ </div>
+ <div class="glm-member-list-info">
+ {if $member.descr}
+ <p>{$member.descr}</p>
+ {else if $member.short_descr}
+ <p>{$member.short_descr}</p>
+ {/if}
+ {if $member.phone}<b>Phone:</b> {$member.phone}<br>{/if}
+ {if $member.toll_free}<b>Toll Free:</b> {$member.toll_free}<br>{/if}
+ {if $member.url}<b>Web site:</b> <a href="{$member.url}">{$member.url}</a><br>{/if}
+ {if $member.categories}
+ <div class="glm-member-list-items">
+ <b>Member Categories</b>
+ <ul>
+ {foreach $member.categories as $c}
+ <li>
+ {if $c.parent_name}{$c.parent_name}: {/if}{$c.name}
+ </li>
+ {/foreach}
+ </ul>
+ </div>
+ {/if}
+ {if $member.cc_type}
+ <div class="glm-member-list-items">
+ <b>Credit Cards Accepted:</b>
+ <ul>
+ {foreach $member.cc_type.names as $c}
+ <li>{$c}</li>
+ {/foreach}
+ </ul>
+ </div>
+ {/if}
+ </div>
+ </div>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ /*
+ * Google Maps
+ * API reference: https://developers.google.com/maps/documentation/javascript/reference
+ */
+
+ function initMap() {
+
+ // Set default - Need to make this configurable
+ var location = new google.maps.LatLng({$member.lat}, {$member.lon});
+ var map = new google.maps.Map(document.getElementById('locationMap'), {
+ zoom: 14,
+ center: location,
+ disableDefaultUI: false,
+ mapTypeId: google.maps.MapTypeId.MAP,
+ });
+
+ // Create a marker for this member
+ var marker = new google.maps.Marker({
+ map: map,
+ position: new google.maps.LatLng({$member.lat}, {$member.lon}),
+ draggable: false,
+ animation: google.maps.Animation.DROP,
+ title: '{$member.member}',
+ descr: ' \
+ <div class="glm-map-member-name">{$member.member}</div> \
+ {if $member.short_descr}{$member.short_descr}<br>{/if} \
+ <a href="{$member.url}" target="memberWebSite">{$member.url}</a><br> \
+ </p>',
+ memberID: {$member.id}
+ });
+
+ }
+
+ // Load map
+ google.maps.event.addDomListener(window, 'load', initMap);
+
+ });
+ </script>
+
+{else}
+ <p>For some reason the specified member was not found. Please try again.</p>
+{/if}
+
+
+{include file='front/footer.html'}
<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>
+ <h2><a href="{$thisURL}?glm_action=detail&id={$m.member_pointer}">{$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}
+ {if $m.region.value}<p><b>Region:</b> {$m.region.name}</p>{/if}
</p>
</div>
<div class="glm-member-list-info">
{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.phone}<b>Phone:</b> {$m.phone}<br>{/if}
+ {if $m.toll_free}<b>Toll Free:</b> {$m.toll_free}<br>{/if}
+ {if $m.url}<b>Web site:</b> <a href="{$m.url}">{$m.url}</a><br>{/if}
{if $m.categories}
- <div class="glm-member-list-categories">
- Member Categories
+ <div class="glm-member-list-items">
+ <b>Member Categories</b>
<ul>
{foreach $m.categories as $c}
<li>
{/foreach}
</ul>
</div>
+ {/if}
+ {if $m.cc_type}
+ <div class="glm-member-list-items">
+ <b>Credit Cards Accepted:</b>
+ <ul>
+ {foreach $m.cc_type.names as $c}
+ <li>{$c}</li>
+ {/foreach}
+ </ul>
+ </div>
{/if}
</div>
</div>
{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://develope {if $m.toll_free}<p>{$m.toll_free}</p>{/if}
-rs.google.com/maps/documentation/javascript/reference
+ * API reference: https://developers.google.com/maps/documentation/javascript/reference
*/
// Set default - Need to make this configurable
var startLon = -84;
var location = new google.maps.LatLng(startLat, startLon);
var map = new google.maps.Map(document.getElementById('locationMap'), {
- maxZoom: 12,
+// maxZoom: 12,
disableDefaultUI: false,
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
- });
+ var infowindow = new google.maps.InfoWindow();
{if $haveMembers}
{foreach $members as $m}
animation: google.maps.Animation.DROP,
title: '{$m.member}',
descr: ' \
- <b>{$m.member}</b><hr> \
- <p>{$m.short_descr}<br> \
+ <div class="glm-map-member-name">{$m.member}</div> \
+ {if $m.short_descr}{$m.short_descr}<br>{/if} \
<a href="{$m.url}" target="memberWebSite">{$m.url}</a><br> \
- <a href="{$thisURL}?action=detail&member={$m.id}">More Info</a> \
+ <a href="{$thisURL}?glm_action=detail&id={$m.member_pointer}"><br>More Info</a> \
</p>',
memberID: {$m.id}
});