'field' => 'id',
'type' => 'integer',
'view_only' => true,
- 'use' => 'lgd'
+ 'use' => 'a'
),
// Active
'field' => 'descr',
'type' => 'text',
'required' => true,
- 'use' => 'gneud'
+ 'use' => 'a'
),
// Short description
{
$errorMsg = '';
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ $this->addNotice("<pre>".print_r($_REQUEST,1)."</pre>", "Request Data");
+ }
+
/*
* Determine model to execute
*/
// Loop till we have a final action
$loopCheck = 0;
+ $redirectData = false;
do {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
} else {
+ // Check if this is a re-direct with parameters
+ $args = false;
+
+
// Instantiate the model and ask it to perform the work
$model = new $className($this->wpdb, $this->config);
- $results = $model->modelAction();
+ $results = $model->modelAction($redirectData);
// Check if there's been a model redirect request
if ($results['modelRedirect']) {
$menuItem = $results['menuItemRedirect'];
}
+ // Check if there's data to pass to the new model
+ if (isset($results['data']) && count($results['data']) > 0) {
+ $redirectData = $results['data'];
+ }
+
$modelRedirect = true;
}
.glm-required {
color: red !important;
}
-
.glm-error {
color: red;
}
+.glm-notice {
+ color: red;
+}
.glm-copyright {
text-align: center;
width: 90%;
}
+/* Admin table additions */
+.glm-table-fieldname {
+ text-align: left;
+ padding-right: 1em;
+}
+
+
/* Debug Window */
#glm-debug-header {
font-weight: bold;
$in = filter_input(INPUT_POST, $as, $filter, $filter_options);
- if ($f['required'] && trim($in) == '') {
- $this->inputFieldStatus = false;
- $this->inputErrorReason = 'Required input not provided.';
- return $in;
- }
-
// Check for required field
- if ($f['required'] && trim($in) == '') {
+ if (isset($f['required']) && $f['required'] && trim($in) == '') {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Required input not provided.';
return $in;
}
// Check min/max length
- if ($f['minLength'] && strlen($in) < $f['minLength']) {
+ if (isset($f['minLength']) && $f['minLength'] && strlen($in) < $f['minLength']) {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Input is shorter than minimum length of '.$f['minLength'].' characters.';
return $in;
}
- if ($f['maxLength'] && strlen($in) > $f['maxLength']) {
+ if (isset($f['maxLength']) && $f['maxLength'] && strlen($in) > $f['maxLength']) {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Input is longer than maximum length of '.$f['maxLength'].' characters.';
return $in;
// Query table to see if there's a conflict
$sql = "
SELECT COUNT("
- .$f['field'].")
+ .$f['field'].") as count
FROM "
.$this->table."
WHERE "
$sql .= "AND $idField != $id";
}
- $d = $this->wpdb->get_results($sql, ARRAY_A);
+ $d = $this->wpdb->get_row($sql, ARRAY_A);
if ($d['count'] > 0) {
$this->inputFieldStatus = false;
- $this->inputErrorReason = 'This must be unique but it conflicts with another entry.';
+ $this->inputErrorReason = 'This must be unique, but it conflicts with another entry.';
return $in;
}
}
$this->inputFieldStatus = true;
$in = false;
- if (in_array($_REQUEST[$as], $valid)) {
+ if (isset($_REQUEST[$as]) && in_array($_REQUEST[$as], $valid)) {
$in = true;
}
if ($forEdit) {
return array(
+ 'status' => true,
'fieldData' => $data,
'fieldRequired' => $fieldRequired,
'fieldFail' => $fieldFail
//echo "<pre>$sql</pre>";
$list = $this->wpdb->get_results($sql, ARRAY_A);
- if (count($list) == 0)
+ if (count($list) == 0) {
return false;
+ }
// Process individual fields
while (list($k, $v) = each($list)) {
*/
public function insertEntry($store = true)
{
- // Assume everything goes OK.
- $status = true;
$r = $this->processInputData('i');
$this->wpdb->query($sql);
// Get the current ID value and set that in the session
- $sql = "SELECT CURRVAL('".$this->table."_id_seq') ";
- $detail = $this->wpdb->get_row($sql, ARRAY_A);
- $r['insertedID'] = $detail['currval'];
+ $r['insertedID'] = $this->wpdb->insert_id;
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - insertEntry() query");
$detail = $this->wpdb->get_row($sql, ARRAY_A);
+ // Check for failure retrieving data
+ if (!$detail) {
+ return false;
+ }
+
// Process individual fields
$detail = $this->processOutputData($detail, 'e', true, $id, $idfield);
$sep = '';
reset($r['fieldStore']);
+ // Build list of fields that get updated
while (list($k, $v) = each($r['fieldStore'])) {
+ // Determine if the field is supposed to be updated when blank;
+ $noUpdateWhenBlank = (isset($this->fields[$k]['no_update_when_blank']) && $this->fields[$k]['no_update_when_blank']);
+
// If do not store on empty option is set and the value is blank then don't store
// Note that $v also includes single quote marks (') so a length of 2 is actually blank.
- if (!($this->fields[$k]['no_update_when_blank'] && strlen($v) == 2)) {
-
+ if (!($noUpdateWhenBlank && strlen($v) == 2)) {
$sql .= $sep."$k = $v";
$sep = ",\n";
}
'quicktip' Text description of this field and its use.
-'no_update_when_blank' Do not store a new value is the submitted data is blank
+'no_update_when_blank' Do not store a new value if the submitted data is blank
Used particularly for password fields where you only want them updated when the user puts something in
'pw_type' Type of password to require for password fields. (default is normal, 'strong' is for strong passwords with a mix of character types)
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 22:12:00
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 02:20:49
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/badAction.html" */ ?>
<?php /*%%SmartyHeaderCode:210264866954b42dd4bbc715-16113482%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'06926788f51c1a5a54be2a368556f9c37e2780da' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/badAction.html',
- 1 => 1421264558,
+ 1 => 1421285081,
2 => 'file',
),
),
),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
-<?php if ($_valid && !is_callable('content_54b42dd4c09430_68496846')) {function content_54b42dd4c09430_68496846($_smarty_tpl) {?><div class="wrap">
+<?php if ($_valid && !is_callable('content_54b42dd4c09430_68496846')) {function content_54b42dd4c09430_68496846($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/error/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
<h2>Sorry, we've had an error.</h2>
<p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-</div>
+<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
<?php }} ?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 00:32:22
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 02:22:28
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/index.html" */ ?>
<?php /*%%SmartyHeaderCode:206413157254b42f2535e168-27938613%%*/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 => 1421281939,
+ 1 => 1421288544,
2 => 'file',
),
),
'variables' =>
array (
'numbMembers' => 0,
+ 'thisURL' => 0,
),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<h2>Members Dashboard</h2>
- <p>Status and notices go here</p>
+<?php if ($_smarty_tpl->tpl_vars['numbMembers']->value==0) {?>
+ <p>
+ <span class="glm-error">You do not currently have any members listed.</span>
+ <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-member&glm_action=member&member_id=">Click here to create your first member.</a>
+ </p>
+<?php }?>
<table>
<tr><th>Number of Members Listed: </th><td><?php echo $_smarty_tpl->tpl_vars['numbMembers']->value;?>
</td></tr>
-
</table>
<?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-14 21:06:49
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 03:39:59
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html" */ ?>
<?php /*%%SmartyHeaderCode:163797333154b6ac77c986e8-14104892%%*/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 => 1421269603,
+ 1 => 1421293149,
2 => 'file',
),
),
<h2><?php echo $_smarty_tpl->tpl_vars['member']->value['name'];?>
</h2>
- <table>
- <tr><th>Member Name:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['name'];?>
-</tr>
+ <?php if ($_smarty_tpl->tpl_vars['member']->value['active']['value']) {?>
+ <p>This member is active.</p>
+ <?php } else { ?>
+ <h3 class="glm-notice">Member Not Active</h3>
+ <?php }?>
+
+ <table>
+ <tr><th class="glm-table-fieldname">Member Name:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['name'];?>
+</td></tr>
+ <tr><th class="glm-table-fieldname">Description:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['descr'];?>
+</td></tr>
+ <tr><th class="glm-table-fieldname">Short Description:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['short_descr'];?>
+</td></tr>
</table>
<?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-14 21:52:27
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 02:04:44
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/member.html" */ ?>
<?php /*%%SmartyHeaderCode:172471491954b6e51b1368b6-20693769%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'25c8610e0e0bacafec3046a296066e9f8eceedae' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/member.html',
- 1 => 1421272105,
+ 1 => 1421287476,
2 => 'file',
),
),
'function' =>
array (
),
+ 'version' => 'Smarty-3.1.21-dev',
+ 'unifunc' => 'content_54b6e51b158d19_68572085',
'variables' =>
array (
'haveMember' => 0,
'member' => 0,
),
'has_nocache_code' => false,
- 'version' => 'Smarty-3.1.21-dev',
- 'unifunc' => 'content_54b6e51b158d19_68572085',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54b6e51b158d19_68572085')) {function content_54b6e51b158d19_68572085($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/member/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
<form action="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="add">
+ <input type="hidden" name="glm_action" value="member">
+ <?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
<input type="hidden" name="option" value="submit">
+ <input type="hidden" name="member_id" value="<?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['id'];?>
+">
+ <?php } else { ?>
+ <input type="hidden" name="option" value="addNew">
+ <?php }?>
+
<table class="form-table">
<tr>
<th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['name']) {?>class="glm-required"<?php }?>>Member Name:</th>
</p><?php }?>
</td>
</tr>
+ <tr>
+ <th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['short_descr']) {?>class="glm-required"<?php }?>>Short Description:</th>
+ <td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['short_descr']) {?>class="glm-form-bad-input"<?php }?>>
+ <input type="text" name="short_descr" value="<?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['short_descr'];?>
+" class="glm-form-text-input">
+ <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['short_descr']) {?><p><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldFail']['short_descr'];?>
+</p><?php }?>
+ </td>
+ </tr>
</table>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 20:47:26
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 01:57:45
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/footer.html" */ ?>
<?php /*%%SmartyHeaderCode:146319615854b4cb224487c6-63517443%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'50e78f1400d6db96c588c737669426ab57397d1d' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/footer.html',
- 1 => 1421268442,
+ 1 => 1421287062,
2 => 'file',
),
),
<br>
Copyright © 2014-<?php echo $_smarty_tpl->tpl_vars['thisYear']->value;?>
Gaslight Media - All Rights Reserved<br>
+ Phone: 231-487-0692 - E-Mail: info@gaslightmedia.com<br>
<a href="http://www.gaslightmedia.com">http://www.gaslightmedia.com</a>
</div>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 19:42:46
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 01:25:35
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/index.html" */ ?>
<?php /*%%SmartyHeaderCode:204984570454b42e9eaf47c6-75708563%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'60cbe99d19bbec013cbca4d9344f2fd4a4152f52' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/index.html',
- 1 => 1421264555,
+ 1 => 1421285131,
2 => 'file',
),
),
),
'version' => 'Smarty-3.1.21-dev',
'unifunc' => 'content_54b42e9eafe502_03625329',
- 'variables' =>
- array (
- 'errorMsg' => 0,
- ),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
-<?php if ($_valid && !is_callable('content_54b42e9eafe502_03625329')) {function content_54b42e9eafe502_03625329($_smarty_tpl) {?><div class="wrap">
+<?php if ($_valid && !is_callable('content_54b42e9eafe502_03625329')) {function content_54b42e9eafe502_03625329($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/error/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
- <h2>Sorry, we've had an error.</h2>
+ <center>
- <?php if ($_smarty_tpl->tpl_vars['errorMsg']->value) {?>
- <p><?php echo $_smarty_tpl->tpl_vars['errorMsg']->value;?>
-</p>
- <?php } else { ?>
- <p><b>Error: </b>: Unknown error.</p>
- <?php }?>
+ <h3>Sorry, we've had some type of fatal error.</h3>
+
+ <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
+
+ </center>
+
+<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
- <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-
-</div>
<?php }} ?>
--- /dev/null
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-15 01:26:23
+ compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/header.html" */ ?>
+<?php /*%%SmartyHeaderCode:112530116454b716e1691b91-32861276%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
+$_valid = $_smarty_tpl->decodeProperties(array (
+ 'file_dependency' =>
+ array (
+ '6b21e44674b437b1c7d4844f49a7ab41316a5694' =>
+ array (
+ 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/header.html',
+ 1 => 1421285180,
+ 2 => 'file',
+ ),
+ ),
+ 'nocache_hash' => '112530116454b716e1691b91-32861276',
+ 'function' =>
+ array (
+ ),
+ 'version' => 'Smarty-3.1.21-dev',
+ 'unifunc' => 'content_54b716e1693c97_05571152',
+ 'variables' =>
+ array (
+ 'glmPluginName' => 0,
+ ),
+ 'has_nocache_code' => false,
+),false); /*/%%SmartyHeaderCode%%*/?>
+<?php if ($_valid && !is_callable('content_54b716e1693c97_05571152')) {function content_54b716e1693c97_05571152($_smarty_tpl) {?><div class="wrap">
+
+ <h2><?php echo $_smarty_tpl->tpl_vars['glmPluginName']->value;?>
+</h2>
+
+ <?php }} ?>
* produce output.
*
*/
- public function modelAction ()
+ public function modelAction ($redirectData = false)
{
// Determine if current user can add, edit, delete member data
*
* @return array Array containing status, suggested view, and any data
*/
- public function __construct ($wpdb)
+ public function __construct ($wpdb, $config)
{
+
+ // Save WordPress Database object
$this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
}
/*
* produce output.
*
*/
- public function modelAction ()
+ public function modelAction ($redirectData = false)
{
// No work to perform here so just return status
*
* @return array Array containing status, suggested view, and any data
*/
- public function __construct ($wpdb)
+ public function __construct ($wpdb, $config)
{
- // No work to perform here so just return status
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
}
- public function modelAction() {
+ public function modelAction($redirectData = false) {
// Return status, any suggested view, and any data to controller
return array(
* produce output.
*
*/
- public function modelAction ()
+ public function modelAction ($redirectData = false)
{
$success = true;
$memberData = false;
$memberID = 0;
- // Check if a member ID is supplied
- if (isset($_REQUEST['member_id'])) {
+ // Check if a redirecting model supplied the member ID
+ if (isset($redirectData['memberID'])) {
+
+ $memberID = $redirectData['memberID'];
+
+ // Otherwise check if one was supplied by the user
+ } elseif (isset($_REQUEST['member_id'])) {
// Make sure it's a number
$memberID = $_REQUEST['member_id']-0;
}
* produce output.
*
*/
- public function modelAction ()
+ public function modelAction ($redirectData = false)
{
$success = true;
$haveMember = false;
$memberData = false;
$memberID = 0;
+ $error = false;
// Check if a member ID is supplied
if (isset($_REQUEST['member_id'])) {
$memberID = $_REQUEST['member_id']-0;
}
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice("<b> Member ID specified:</b> $memberID");
+ // Check for action option
+ $option = false;
+ if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+ $option = $_REQUEST['option'];
}
- // If we have a member ID, try to get the member data
- if ($memberID > 0) {
- $memberData = $this->editEntry($memberID);
- }
+ // Perform requested option
+ switch ($option) {
+
+ case 'addNew':
+
+ // Insert the new member into the database
+ $memberData = $this->insertEntry();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice('<pre>'.print_r($memberData,1).'</pre>', 'New Member Data');
+ }
+
+ if ($memberData['status']) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'member',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/member/index.html',
+ 'data' => array(
+ 'memberID' => $memberData['fieldData']['id']
+ )
+ );
+ }
+
+ break;
+
+ case 'submit':
+
+ // If we have a member ID
+ if ($memberID > 0) {
+
+ $haveMember = true;
+
+ // Update the member data
+ $memberData = $this->updateEntry($memberID);
+
+ // If the update went well, then redirect to the member status page
+ if ($memberData['status']) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'member',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/member/index.html',
+ 'data' => array(
+ 'memberID' => $memberID
+ )
+ );
+ } else {
+
+
+ }
+
+ // Else if there's no member ID, then we have a problem
+ } else {
+ $error = true;
+ }
+
+ break;
+
+ default:
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> Member ID specified:</b> $memberID");
+ }
+
+ // If we have a member ID, try to get the member data
+ if ($memberID > 0) {
+
+ // Edit the existing member
+ $memberData = $this->editEntry($memberID);
+
+ // If we have member data, say so
+ if (is_array($memberData) && $memberData['status']) {
+ $haveMember = true;
+
+ } else {
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> Specified Member ID is invalid:</b> $memberID");
+ }
+
+ $error = true;
+
+ }
+
+ // Else if there's no member ID, assume entering a new member
+ } else {
+
+ // Ask for new member data
+ $memberData = $this->newEntry();
+
+ }
+
+ break;
- // If we have member data, say so
- if ($memberData !== false) {
- $haveMember = true;
- // Otherwise, we're going setup to enter a new one
- } else {
- $memberData = $this->newEntry();
}
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice("<pre>".print_r($memberData,1)."</pre>", 'Member Data');
}
* produce output.
*
*/
- public function modelAction ()
+ public function modelAction ($redirectData = false)
{
$success = true;
* produce output.
*
*/
- public function modelAction ()
+ public function modelAction ($redirectData = false)
{
// Get a current list of members
-<div class="wrap">
+{include file='admin/error/header.html'}
<h2>Sorry, we've had an error.</h2>
<p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-</div>
+{include file='admin/footer.html'}
--- /dev/null
+<div class="wrap">
+
+ <h2>{$glmPluginName}</h2>
+
+
\ No newline at end of file
-<div class="wrap">
+{include file='admin/error/header.html'}
- <h2>Sorry, we've had an error.</h2>
+ <center>
- {if $errorMsg}
- <p>{$errorMsg}</p>
- {else}
- <p><b>Error: </b>: Unknown error.</p>
- {/if}
+ <h3>Sorry, we've had some type of fatal error.</h3>
+
+ <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
+
+ </center>
+
+{include file='admin/footer.html'}
- <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-
-</div>
<div class="glm-copyright">
{$glmPluginName}<br>
Copyright © 2014-{$thisYear} Gaslight Media - All Rights Reserved<br>
+ Phone: 231-487-0692 - E-Mail: info@gaslightmedia.com<br>
<a href="http://www.gaslightmedia.com">http://www.gaslightmedia.com</a>
</div>
{include file='admin/member/header.html'}
<h2>{$member.name}</h2>
- <table>
- <tr><th>Member Name:</th><td>{$member.name}</tr>
+ {if $member.active.value}
+ <p>This member is active.</p>
+ {else}
+ <h3 class="glm-notice">Member Not Active</h3>
+ {/if}
+
+ <table>
+ <tr><th class="glm-table-fieldname">Member Name:</th><td>{$member.name}</td></tr>
+ <tr><th class="glm-table-fieldname">Description:</th><td>{$member.descr}</td></tr>
+ <tr><th class="glm-table-fieldname">Short Description:</th><td>{$member.short_descr}</td></tr>
</table>
{include file='admin/footer.html'}
{/if}
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="add">
+ <input type="hidden" name="glm_action" value="member">
+ {if $haveMember}
<input type="hidden" name="option" value="submit">
+ <input type="hidden" name="member_id" value="{$member.fieldData.id}">
+ {else}
+ <input type="hidden" name="option" value="addNew">
+ {/if}
+
<table class="form-table">
<tr>
<th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
{if $member.fieldFail.descr}<p>{$member.fieldFail.descr}</p>{/if}
</td>
</tr>
+ <tr>
+ <th {if $member.fieldRequired.short_descr}class="glm-required"{/if}>Short Description:</th>
+ <td {if $member.fieldFail.short_descr}class="glm-form-bad-input"{/if}>
+ <input type="text" name="short_descr" value="{$member.fieldData.short_descr}" class="glm-form-text-input">
+ {if $member.fieldFail.short_descr}<p>{$member.fieldFail.short_descr}</p>{/if}
+ </td>
+ </tr>
</table>
<h2>Members Dashboard</h2>
- <p>Status and notices go here</p>
+{if $numbMembers == 0}
+ <p>
+ <span class="glm-error">You do not currently have any members listed.</span>
+ <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=member&member_id=">Click here to create your first member.</a>
+ </p>
+{/if}
<table>
<tr><th>Number of Members Listed: </th><td>{$numbMembers}</td></tr>
-
</table>
{include file='admin/footer.html'}