'type' => 'pointer',
'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
'p_field' => 'name',
- 'p_orderby' => 'name',
- 'p_blank' => true,
+ 'p_static' => true,
'required' => true,
'use' => 'a'
),
+ // Member Pointer index
+ 'member_pointer' => array (
+ 'field' => 'member',
+ 'as' => 'member_pointer',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'gle'
+ ),
+
// Reference Name - Not displayed to user
'reference_name' => array (
'field' => 'reference_name',
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Clone Member Information Record
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release glmMemberInfoClone.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This class provides facilities for cloning a complete member information
+ * record including all associated information and images.
+ *
+ */
+class GlmMemberInfoClone
+{
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+
+ /**
+ * Constructor
+ *
+ * Clone a member information record and anything associated with it
+ * to create a new complete member information record that is identical
+ * to the source except that it is set to "pending".
+ *
+ * @param object $wpdb Word Press database object
+ * @param array $config Configuration data
+ * @param integer $memberInfoID ID of the member info record to clone
+ *
+ * @return integer ID of the new cloned member information record
+ * @access public
+ **/
+ function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Check if this is a second call to the activation hook by WordPress to activate this plugin.
+ *
+ * (Yea, I know that's stupid behavior, but there's nothing I can do about it.)
+ * It tells us this is happening by setting the 'action' GET parameter to 'error_scrape',
+ * which is also stupid.
+ *
+ * In this case, we don't want to try again, so output any saved notices from the first pass
+ * and then exit to tell WordPress the plugin didn't install.
+ *
+ * @return void
+ * @access public
+ */
+ public function cloneMemberInfo($id)
+ {
+
+ // Load Member Info Data Class and get info data for later use
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+ $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
+ $memberInfo = $MemberInfo->getEntry($id);
+
+ // Create a new base info record and get its ID - this also copies images to a new name
+ $newID = $MemberInfo->cloneEntry($id);
+
+ // If the clone was successful
+ if ($newID != false) {
+
+ // Update create and update times to now and set info record to pending
+ $t = date('Y-m-d H:i:s', time());
+ $newReferenceName = "CLONED - ".$memberInfo['reference_name'];
+ $sql = "
+ UPDATE ".$MemberInfo->table."
+ SET create_time = '$t', modify_time = '$t', status = ".$this->config['status_numb']['Pending'].", reference_name = '".addslashes($newReferenceName)."'
+ WHERE id = $newID
+ ;";
+ $this->wpdb->query($sql);
+
+ // Duplicate all category_member_info table entries
+ $sql = "
+ INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info
+ (category,member_info)
+ SELECT category, $newID
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info
+ WHERE member_info = $id
+ ;";
+echo $sql;
+ $this->wpdb->query($sql);
+
+ }
+
+ return $newID;
+
+ }
+
+}
+
+?>
\ No newline at end of file
* will not return a list of options.
*/
+ // Get ID field of other table - default to 'id'
+ $p_id = 'id';
+ if(isset($f['p_id'])) {
+ $p_id = $f['p_id'];
+ }
+
+ // Check for WHERE option
+ $where = '';
+ if (isset($f['p_where']) && $f['p_where'] != '') {
+ $where = 'WHERE '.$f['p_where'];
+ }
+
// If 'force_list' or $forEdit also get the options for select, unless 'p_static'
$alwaysList = (isset($f['force_list']) && $f['force_list']);
$pStatic = (isset($f['p_static']) && $f['p_static']);
$p_value = $d;
- // Get pointer options from specified table
+ // Check for ORDER BY option
$order_by = $f['p_field'];
if (isset($f['p_orderby']) && $f['p_orderby']) {
$order_by = $f['p_orderby'];
}
- // Get picklist options from other table
- $where = '';
- if (isset($f['p_where']) && $f['p_where'] != '') {
- $where = 'WHERE '.$f['p_where'];
- }
-
- // Get ID field of other table - default to 'id'
- $p_id = 'id';
- if(isset($f['p_id'])) {
- $p_id = $f['p_id'];
- }
-
// If p_sum is selected, do a special query
if ($pSum) {
} // else p_sum
+ // Not doing list so get value only
+ } else {
+
+ $sql = "
+ SELECT ".$f['p_field']."
+ FROM ".$f['p_table']."
+ WHERE $p_id = $d
+ ";
+ $res = $this->wpdb->get_row($sql, ARRAY_A);
+
+ return $res[$f['p_field']];
+
}
return $d;
$this->fieldData[$as] = array(
'name' => $as,
'store_name' => $v['field'],
+ 'type' => $v['type'],
'required' => (isset($v['required']) && $v['required']),
'submit_error' => false
);
}
/**
- * Detail Method
+ * Get Detail Method
*
* @return void
* @access public
return $detail;
}
+ /**
+ * Clone Entry Method
+ *
+ * @param integer $id ID of entry to clone
+ *
+ * @return integer Entry new entry ID
+ * @access public
+ */
+ public function cloneEntry($id)
+ {
+
+ if ($id-0 == 0) {
+ // echo "DataAbstract.php - getEntry() called with invalid ID";
+ return false;
+ }
+
+ // Build fields list with fiels selected for insert
+ $this->buildFieldsList('i');
+
+ // Build field list string including all but the ID field
+ $fields = '';
+ $imageFields = array();
+ $sep = '';
+ foreach ($this->fieldData as $f) {
+
+ // Add all fields but the ID field to the fields list
+ if ($f['name'] != 'id') {
+ $fields .= $sep.$f['name'];
+ $sep = ', ';
+ }
+
+ // Located any fields that require special processing
+ if ($f['type'] == 'image') {
+ $imageFields[] = $f['name'];
+ }
+ }
+
+ // Assemble query to duplicate the record.
+ $sql = "
+ INSERT INTO ".$this->table."
+ ( $fields )
+ SELECT $fields
+ FROM $this->table
+ WHERE id = $id
+ ;";
+ $this->wpdb->query($sql);
+
+ // Get new ID and data from the new record
+ $newID = $this->wpdb->insert_id;
+
+ // If we have a new record now
+ if($newID) {
+
+ $newData = $this->getEntry($newID);
+
+ // Check for any images that need to be duplicated
+ if (count($imageFields) > 0) {
+
+ $updateSQL = '';
+ $sep = '';
+
+ foreach ($imageFields as $f) {
+
+ // If there's an image referenced
+ if ($newData[$f] != '') {
+
+ // Create new image name
+ $newName = preg_replace('/\d{10}/', time(), $newData[$f]);
+
+ // For each image size
+ while (list($k, $v) = each($this->config['imageSizes'])) {
+
+ // Check if we have that size for the original image, then copy it to the new name
+ if (file_exists(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newData[$f])) {
+ copy(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newData[$f], GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newName);
+ }
+
+ }
+
+ // Add to sql to update this field
+ $updateSQL .= $sep."$f = '$newName'";
+ $sep = ', ';
+
+ }
+
+ }
+
+ // If there were any updates
+ if ($updateSQL != '') {
+
+ $sql = "
+ UPDATE ".$this->table."
+ SET $updateSQL
+ WHERE id = $newID
+ ;";
+ $this->wpdb->query($sql);
+ }
+
+ }
+
+ return $newID;
+ }
+
+ return false;
+
+ }
+
/**
* New Method
*
the data into a single database table or if a composite into
multiple related tables.
+cloneEntry() Makes a copy of the entry with the specified ID and if
+ successful returns the ID of the cloned copy. Also makes
+ duplicates of any images and updates the image names.
+
editEntry() Builds and returns a single simple database table entry or
optionally a single instance of a composite of multiple
related table entries and includes the information necessary
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-27 18:48:22
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-10 11:24:34
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/index.html" */ ?>
<?php /*%%SmartyHeaderCode:43313958054c05ab60b0587-71987387%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'081a36d97cdf30d438a1e104c26a275acc180da0' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/index.html',
- 1 => 1425062899,
+ 1 => 1426001070,
2 => 'file',
),
),
'haveAccommodationTypes' => 0,
'numbMembers' => 0,
'membersPending' => 0,
+ 'pendingList' => 0,
+ 'i' => 0,
+ 'p' => 0,
),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54c05ab60bb1c1_03470573')) {function content_54c05ab60bb1c1_03470573($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/members/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
- <h2>Members Dashboard</h2>
+ <h2>Main Dashboard</h2>
<table class="glm-admin-table">
<?php if (!$_smarty_tpl->tpl_vars['haveMemberTypes']->value) {?>
<table class="glm-admin-table">
<tr><th>Number of Members Listed: </th><td><?php echo $_smarty_tpl->tpl_vars['numbMembers']->value;?>
</td></tr>
- <tr><th<?php if ($_smarty_tpl->tpl_vars['membersPending']->value) {?> class="glm-notice"<?php }?>>Member Pending Data: </th><td><?php echo $_smarty_tpl->tpl_vars['membersPending']->value;?>
-</td></tr>
+ <tr>
+ <th<?php if ($_smarty_tpl->tpl_vars['membersPending']->value) {?> class="glm-notice"<?php }?>>Pending Member Information: </th><td><?php echo $_smarty_tpl->tpl_vars['membersPending']->value;?>
+</td>
+ </tr>
+ </table>
+
+<?php if ($_smarty_tpl->tpl_vars['membersPending']->value) {?>
+ <h2>Pending Member Information</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>Member Name</th>
+ <th>Last Updated</th>
+ <th>Reference Name</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php $_smarty_tpl->tpl_vars["i"] = new Smarty_variable("0", null, 0);?>
+ <?php $_smarty_tpl->tpl_vars['p'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['p']->_loop = false;
+ $_from = $_smarty_tpl->tpl_vars['pendingList']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
+foreach ($_from as $_smarty_tpl->tpl_vars['p']->key => $_smarty_tpl->tpl_vars['p']->value) {
+$_smarty_tpl->tpl_vars['p']->_loop = true;
+?>
+ <?php if ((1 & $_smarty_tpl->tpl_vars['i']->value++ / 1)) {?>
+ <tr>
+ <?php } else { ?>
+ <tr class="alternate">
+ <?php }?>
+ <td>
+ <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-member&glm_action=memberInfo&member=<?php echo $_smarty_tpl->tpl_vars['p']->value['member_pointer'];?>
+&id=<?php echo $_smarty_tpl->tpl_vars['p']->value['id'];?>
+}"><?php echo $_smarty_tpl->tpl_vars['p']->value['member'];?>
+</a>
+ </td>
+ <td>
+ <?php echo $_smarty_tpl->tpl_vars['p']->value['modify_time']['datetime'];?>
+
+ </td>
+ <td>
+ <?php echo $_smarty_tpl->tpl_vars['p']->value['reference_name'];?>
+
+ </td>
+ <td>
+ <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-member&glm_action=memberInfo&member=<?php echo $_smarty_tpl->tpl_vars['p']->value['member_pointer'];?>
+&id=<?php echo $_smarty_tpl->tpl_vars['p']->value['id'];?>
+}" class="button-primary glm-right">Manage</a>
+ </td>
+ </tr>
+ <?php } ?>
+ </tbody>
</table>
+<?php }?>
+
+
<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-30 21:29:52
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-10 11:24:16
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/header.html" */ ?>
<?php /*%%SmartyHeaderCode:41614071154c05ab60be091-67045844%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'15f83071407dddb0b3c23ae1a70b66cefbd681db' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/header.html',
- 1 => 1422653383,
+ 1 => 1426001053,
2 => 'file',
),
),
<h2 class="nav-tab-wrapper">
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">Dashboard</a>
+&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">Main Dashboard</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=list" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='list') {?>-active<?php }?>">List of Members</a>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-06 14:37:59
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-09 19:07:47
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 => 1425670675,
+ 1 => 1425940975,
2 => 'file',
),
),
" class="button-primary glm-button glm-right">Add New Member Information Version</a>
<h3>Member Information Versions</h3>
- <p><input type="checkbox" id="showArchived"<?php if ($_smarty_tpl->tpl_vars['showArchived']->value) {?> checked="checked"<?php }?>> Show archived information </p>
+
+ <span class="glm-right">
+ <p>
+ <input type="checkbox" id="showArchived"<?php if ($_smarty_tpl->tpl_vars['showArchived']->value) {?> checked="checked"<?php }?>> Show archived information
+ </p>
+ </span>
<?php if ($_smarty_tpl->tpl_vars['noActive']->value) {?>
<h3 class="glm-error">There is no active information for this member.</h3>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=memberInfo&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
&id=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
-" class="button-primary glm-right">Manage</a>
+&option=clone" class="button-primary glm-right">Clone</a>
<?php if ($_smarty_tpl->tpl_vars['m']->value['status']['name']!='Active') {?><a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
&activateID=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
-" class="button-primary glm-button glm-right">Activate</a><?php }?>
+" class="button-primary glm-button glm-right">Activate</a><?php }?>
</td>
</tr>
<?php } ?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-06 13:47:52
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-09 14:11:56
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 => 1425667668,
+ 1 => 1425924469,
2 => 'file',
),
),
'variables' =>
array (
'haveFilter' => 0,
- 'filterStatus' => 0,
+ 'filterArchived' => 0,
+ 'filterPending' => 0,
'filterName' => 0,
'haveMembers' => 0,
'members' => 0,
<form class="glm-right" onSubmit="return false;">
<span<?php if ($_smarty_tpl->tpl_vars['haveFilter']->value) {?> class="glm-notice"<?php }?>><b>List Filters:</b> </span>
- <span class="glm-item-container"><input type="checkbox" id="filterPending" class="listFilter"<?php if ($_smarty_tpl->tpl_vars['filterStatus']->value) {?> checked<?php }?>>Has Pending Information</span>
+ <span class="glm-item-container"><input type="checkbox" id="filterArchived" class="listFilter"<?php if ($_smarty_tpl->tpl_vars['filterArchived']->value) {?> checked<?php }?>>Only show Archived</span>
+ <span class="glm-item-container"><input type="checkbox" id="filterPending" class="listFilter"<?php if ($_smarty_tpl->tpl_vars['filterPending']->value) {?> checked<?php }?>>Only show Pending Information</span>
<span class="glm-item-container"><input type="text" id="filterName" class="listFilter" value="<?php echo $_smarty_tpl->tpl_vars['filterName']->value;?>
"> Search</span>
</form>
var filter = '';
- // Check for pending data filter
- if ($("#filterPending").attr('checked')) {
- filter += '&filterPending=true';
+ // Check for archived filter
+ if ($("#filterArchived").attr('checked')) {
+ filter += '&filterArchived=true';
}
+ // Check for pending data filter
+ if ($("#filterPending").attr('checked')) {
+ filter += '&filterPending=true';
+ }
+
// Check for member name filter
var filterName = $("#filterName").val();
if (filterName != '') {
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-24 20:24:15
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-10 11:23:47
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/header.html" */ ?>
<?php /*%%SmartyHeaderCode:145413007654c05ab400d0a2-83797817%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'c74bd17240f8892f8955e8bedbedd434341aeca9' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/header.html',
- 1 => 1424809451,
+ 1 => 1426001022,
2 => 'file',
),
),
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">Dashboard</a>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">Member Dashboard</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=memberInfo&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
$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
}
+ // If we have a member info record, check if it's active
+ if ($haveMemberInfo) {
+
+ // 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);
break;
+ // Clone the member information record.
+ case 'clone':
+
+ // Load Member Info Clone Class
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmMemberInfoClone.php');
+ $CloneMemberInfo = new GlmMemberInfoClone($this->wpdb, $this->config);
+
+ // Clone the current member info
+ $memberInfoID = $CloneMemberInfo->cloneMemberInfo($memberInfoID);
+
+ $MemberInfo = $this->editEntry($memberInfoID);
+
// Default is to display the currently selected member information record in a form for updates
default:
*/
// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
/*
* This class performs the work for the default action of the "Members" menu
* option, which is to display the members dashboard.
*
*/
-class GlmMembersAdmin_members_index extends GlmDataMemberInfo
+class GlmMembersAdmin_members_index extends GlmDataMembers
{
/**
$accommodationTypesStats = $AccommodationTypes->getStats();
$haveAccommodationTypes = ($accommodationTypesStats > 0);
- // Get number of members with pending updates
- $membersPending = $this->getStats('status = '.$this->config['status_numb']['Pending']);
+ // Get number of member information records with pending updates
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+ $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
+ $membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']);
+
+ // If there's members with pending information, list them
+ if ($membersPending > 0) {
+
+ $pendingList = $MemberInfo->getList('status = '.$this->config['status_numb']['Pending']);
+ }
// Compile template data
$templateData = array(
'haveMemberTypes' => $haveMemberTypes,
'haveCategories' => $haveCategories,
'haveRegions' => $haveRegions,
- 'haveAccommodationTypes' => $haveAccommodationTypes
+ 'haveAccommodationTypes' => $haveAccommodationTypes,
+ 'pendingList' => $pendingList
);
// Return status, suggested view, and data to controller
public function modelAction ($redirectData = false)
{
$where = '';
- $filterStatus = false;
+ $filterPending = false;
+ $filterArchived = false;
$filterName = false;
$haveFilter = false;
$haveFilter = true;
}
+ if (isset($_REQUEST['filterArchived'])) {
+ $where .= " T.access = ".$this->config['memb_access_numb']['Archived'];
+ $filterArchived = true;
+ $haveFilter = true;
+ }
+
// Get a current list of members
$list = $this->getList($where);
}
}
- $filterStatus = true;
+ $filterPending = true;
$haveFilter = true;
}
'haveMembers' => $haveMembers,
'members' => $list,
'haveFilter' => $haveFilter,
- 'filterStatus' => $filterStatus,
+ 'filterArchived' => $filterArchived,
+ 'filterPending' => $filterPending,
'filterName' => stripslashes($filterName)
// 'canEdit' => $canEdit
);
<h2>Member Data</h2>
<h2 class="nav-tab-wrapper">
- <a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}" class="nav-tab{if $thisAction==index}-active{/if}">Dashboard</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}" class="nav-tab{if $thisAction==index}-active{/if}">Member Dashboard</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&id={$memberInfoID}" class="nav-tab{if $thisAction==memberInfo}-active{/if} {if !$haveMember || !$haveMemberInfo}disabled{/if}">Member Info</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=locations&member={$memberID}" class="nav-tab{if $thisAction==locations}-active{/if} {if !$haveMember || !$haveMemberInfo}disabled{/if}">Locations</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=facilities&member={$memberID}" class="nav-tab{if $thisAction==facilities}-active{/if} {if !$haveMember || !$haveMemberInfo}disabled{/if}">Facilities</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}" class="button-primary glm-button glm-right">Add New Member Information Version</a>
<h3>Member Information Versions</h3>
- <p><input type="checkbox" id="showArchived"{if $showArchived} checked="checked"{/if}> Show archived information </p>
+
+ <span class="glm-right">
+ <p>
+ <input type="checkbox" id="showArchived"{if $showArchived} checked="checked"{/if}> Show archived information
+ </p>
+ </span>
{if $noActive}
<h3 class="glm-error">There is no active information for this member.</h3>
<td>{$m.modify_time.datetime}</td>
<td>{$m.reference_name}</td>
<td>
- <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&id={$m.id}" class="button-primary glm-right">Manage</a>
- {if $m.status.name != 'Active'}<a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&activateID={$m.id}" class="button-primary glm-button glm-right">Activate</a>{/if}
+ <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&id={$m.id}&option=clone" class="button-primary glm-right">Clone</a>
+ {if $m.status.name != 'Active'}<a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&activateID={$m.id}" class="button-primary glm-button glm-right">Activate</a>{/if}
</td>
</tr>
{/foreach}
<div class="wrap">
<h2>Your Members</h2>
<h2 class="nav-tab-wrapper">
- <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">Dashboard</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">Main Dashboard</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=list" class="nav-tab{if $thisAction==list}-active{/if}">List of Members</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==add}-active{/if} disabled">Reports</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==edit}-active{else} disabled{/if}">Or Something - perahps mailing stuff?</a>
{include file='admin/members/header.html'}
- <h2>Members Dashboard</h2>
+ <h2>Main Dashboard</h2>
<table class="glm-admin-table">
{if !$haveMemberTypes}
<table class="glm-admin-table">
<tr><th>Number of Members Listed: </th><td>{$numbMembers}</td></tr>
- <tr><th{if $membersPending} class="glm-notice"{/if}>Member Pending Data: </th><td>{$membersPending}</td></tr>
+ <tr>
+ <th{if $membersPending} class="glm-notice"{/if}>Pending Member Information: </th><td>{$membersPending}</td>
+ </tr>
</table>
+
+{if $membersPending}
+ <h2>Pending Member Information</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>Member Name</th>
+ <th>Last Updated</th>
+ <th>Reference Name</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+ {assign var="i" value="0"}
+ {foreach $pendingList as $p}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&id={$p.id}}">{$p.member}</a>
+ </td>
+ <td>
+ {$p.modify_time.datetime}
+ </td>
+ <td>
+ {$p.reference_name}
+ </td>
+ <td>
+ <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&id={$p.id}}" class="button-primary glm-right">Manage</a>
+ </td>
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+{/if}
+
+
{include file='admin/footer.html'}
<form class="glm-right" onSubmit="return false;">
<span{if $haveFilter} class="glm-notice"{/if}><b>List Filters:</b> </span>
- <span class="glm-item-container"><input type="checkbox" id="filterPending" class="listFilter"{if $filterStatus} checked{/if}>Has Pending Information</span>
+ <span class="glm-item-container"><input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if}>Only show Archived</span>
+ <span class="glm-item-container"><input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if}>Only show Pending Information</span>
<span class="glm-item-container"><input type="text" id="filterName" class="listFilter" value="{$filterName}"> Search</span>
</form>
var filter = '';
- // Check for pending data filter
- if ($("#filterPending").attr('checked')) {
- filter += '&filterPending=true';
+ // Check for archived filter
+ if ($("#filterArchived").attr('checked')) {
+ filter += '&filterArchived=true';
}
+ // Check for pending data filter
+ if ($("#filterPending").attr('checked')) {
+ filter += '&filterPending=true';
+ }
+
// Check for member name filter
var filterName = $("#filterName").val();
if (filterName != '') {