}
}
+
+ /**
+ * Add a category using supplied parameters
+ *
+ * @param string $name Category Name
+ * @param mixed $parent Existing Parent ID or name of parent to add
+ *
+ * @return integer ID of new category or false if failed
+ *
+ * @access public
+ */
+
+ public function addCategory($name, $parent) {
+
+ $categoryID = false;
+ $parentID = false;
+
+ // Filter new category name
+ $name = filter_var($name);
+ if ($name == false || trim($name) == '') {
+ return false;
+ }
+
+ // Determine parent supplied as an ID
+
+ $parentInt = $parent - 0;
+ if (is_int($parent) && $parentInt > 0) {
+
+ // If it's not positive, then fail
+ if ($parent <= 0) {
+ return false;
+ }
+
+ // Check that parent exists
+ $sql = "
+ SELECT COUNT(id) AS count
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
+ WHERE id = $parent
+ ;";
+ $test = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // Should be only one entry if the parent category exists
+ if ($test['count'] != 1) {
+ return false;
+ }
+
+ $parentID = $parent;
+
+ // Else check to see if parent was supplied as a name
+ } elseif ($parent != '') {
+
+ $parent = filter_var($parent);
+
+ // If the name didn't pass the filer then fail
+ if ($parent == false) {
+ return false;
+ }
+
+ // Check if the name already exists
+ $sql = "
+ SELECT id
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cateogries
+ WHERE name = '$parent'
+ ;";
+ $parentCategory = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // If we found the parent ID
+ if ($parentCategory['id']) {
+
+ // Set that as the parent ID for the new category
+ $parentID = $parentCategory['id'];
+
+ // Otherwise, try to add the parent category
+ } else {
+
+ // Add the parent as a new category
+ $sql = "
+ INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
+ ( name, parent )
+ VALUES
+ ( '".addslashes($parent)."', 0 )
+ ;";
+ $this->wpdb->query($sql);
+ $parentID = $this->wpdb->insert_id;
+
+ // Check if it didn't store properly
+ if (!$parentID) {
+ return false;
+ }
+
+ }
+
+ // Otherwise the categroy being added has no parent
+ } else {
+ $parentID = 0;
+ }
+
+ // Check if the new category name/parent already exists
+ $sql = "
+ SELECT id
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cateogry
+ WHERE name = '$name'
+ AND parent = $parentID
+ ;";
+ $existing = $this->wpdb->get_row($sql, ARRAY_A);
+
+ if ($existing['id']) {
+
+ $categoryID = $existing['id'];
+
+ } else {
+
+ // Try to add the new category
+ $sql = "
+ INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
+ ( name, parent )
+ VALUES
+ ( '".addslashes($name)."', $parentID )
+ ;";
+ $this->wpdb->query($sql);
+ $categoryID = $this->wpdb->insert_id;
+
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice("Category added: name = $name, parent = $parent, ID = $categoryID", 'DataBlock', "addCategory()");
+ }
+
+ return $categoryID;
+
+ }
+
+ /**
+ * Get categories list sorted by parent/child then alpha
+ *
+ * @return array Array of categories
+ *
+ * @access public
+ */
+
+ public function getListSortedParentChild() {
+
+ $categories = $this->getList();
+
+ $categories = glmMembersAdmin::sortParentChild($categories);
+
+ return $categories;
+
+ }
+
+ /*
+ * Check other requirements
+ *
+ * When deleteing categories, check for references in sub-categories and set them to no parent.
+ *
+ */
+ function checkOther($r, $a)
+ {
+ // Required
+ parent::checkOther($r, $a);
+
+ // If there's a valid category ID
+ if (isset($r['id']) && $r['id'] > 0) {
+
+ // Set any parent references with this ID to 0
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
+ SET parent = 0
+ WHERE parent = ".$r['id']."
+ ;";
+ $this->wpdb->query($sql);
+
+ }
+
+ return $r;
+ }
+
+
}
?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * GLM Member-DB WordPress Plugin
+ * Category - Member Info data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * EventManagementDataCategories class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ * @link http://www.visitgreatlakesbay.org/
+ */
+class GlmDataCategoryMemberInfo extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table;
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d
+ * database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct ($wpdb, $config)
+ {
+ parent::__construct($wpdb, $config);
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'category_member_info';
+
+ /*
+ * Table Data Fields
+ */
+ $this->fields = array(
+
+ 'id' => array(
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Category ID
+ 'category' => array(
+ 'field' => 'category',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Member Info ID
+ 'member_info' => array(
+ 'field' => 'member_info',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Category Name
+ 'category_name' => array(
+ 'field' => 'category',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'categories',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'use' => 'gl'
+ )
+
+ );
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+ }
+
+ }
+
+ /**
+ * Get list of categories with parent information
+ *
+ * @param integer $memberInfoID Optional member_info ID to match
+ * Used to find all categories for a particular member_info ID
+ *
+ * @param integer $category Optional category ID to match
+ * Used to find all member_info records for a particular category
+ *
+ * NOTE: Both parameters above can't be used at the same time
+ *
+ * @return array List of selected categories
+ *
+ * @access public
+ */
+
+ public function getListWithParents($memberInfoID = false, $category = false) {
+
+ $where = '';
+
+ if ($category) {
+ $where = "WHERE T.category = $category";
+ } elseif ($memberInfoID) {
+ $where = "WHERE T.member_info = $memberInfoID";
+ }
+
+ $sql = "
+ SELECT T.category, T.member_info,
+ (
+ SELECT name
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
+ WHERE id = T.category
+ ) AS category_name,
+ (
+ SELECT parent
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
+ WHERE id = T.category
+ ) AS category_parent,
+ COALESCE (
+ (
+ SELECT name
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories
+ WHERE id = category_parent
+ ),
+ ''
+ ) AS parent_name
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info T
+ $where
+ ;";
+ $list = $this->wpdb->get_results($sql, ARRAY_A);
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getListWithParents() query");
+ glmMembersAdmin::addNotice($list, 'DataBlock', 'getListWithParents() data');
+ }
+
+ return $list;
+
+ }
+
+ /**
+ * Use supplied category ID list to set selected categories for this
+ * member information record. Any others that were set will be cleared.
+ *
+ * @param integer $memberInfoID Member Information Record ID
+ * @param array $selectedCategories Array of selected category IDs (key is also category ID)
+ *
+ * @return array List of selected categories
+ *
+ * @access public
+ */
+
+ public function setMemberInfoCategories($memberInfoID, $selectedCategories) {
+
+ // Check supplied data
+ if (!is_int($memberInfoID) || $memberInfoID <=0 || !is_array($selectedCategories) || count($selectedCategories) == 0 ) {
+ return false;
+ }
+
+ // Get current list
+ $current = $this->getList($memberInfoID);
+
+ // If we have any currently selected categories
+ if (is_array($current) && count($current) > 0) {
+
+ // For each category in the list
+ foreach ($current as $key => $val) {
+
+ $current[$key]['selected'] = false;
+
+ // Delete existing ones from the supplied selection list and mark selected ones in the current list
+ if (isset($selectedCategories[$val['id']])) {
+
+ unset($selectedCategories[$val['id']]);
+
+ $current[$key]['selected'] = true;
+
+ }
+
+ }
+
+ }
+
+ // For each remaining selected category, add the category
+ foreach ($selectedCategories as $s) {
+
+ // Add the category
+ $sql = "
+ INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info
+ ( category, member_info )
+ VALUES
+ ( $s, $memberInfoID )
+ ;";
+ $this->wpdb->query($sql);
+
+
+ }
+
+ // For any existing categories listed that aren't marked as selected, remove them
+ foreach ($current as $key => $val) {
+
+ if (!$val['selected']) {
+
+ // Delete the entry
+ // Add the category
+ $sql = "
+ DELETE FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info
+ WHERE id = ".$val['id']."
+ ;";
+ $this->wpdb->query($sql);
+
+ }
+ }
+
+ // Get new list and return it
+ $current = $this->getList($memberInfoID);
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($current, 'DataBlock', 'Currently Selected Member Categories');
+ }
+
+ return $current;
+ }
+}
+
+?>
\ No newline at end of file
}
}
+
+ /**
+ * Add a city to the city table.
+ *
+ * This function is provided so cities may be added by other code instead of as a user submission.
+ *
+ * @param string $cityName Name of the city to add
+ *
+ * @return integer ID of the city just added, the id of an existing record matching the city name, or false
+ *
+ * @access public
+ */
+
+ public function addCity($cityName) {
+
+echo "addCity()<br>";
+
+ // Check that we have a good name
+ $cName = trim($cityName);
+ if ($cName == '') {
+ return false;
+ }
+
+ // Check if the city name already exists
+ $sql = "
+ SELECT id
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cities
+ WHERE name = '$cName'
+ ;";
+ $cFound = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // If it already exists, then just retun the id for the existing entry.
+ if (count($cFound) > 0) {
+ return $cFound['id'];
+ }
+
+ // Try to add the city name
+ $sql = "
+ INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cities
+ ( name )
+ VALUES
+ ( '$cName' )
+ ;";
+ $this->wpdb->query($sql);
+ $id = $this->wpdb->insert_id;
+
+ // Return the new city id or false if the query failed
+ return $id;
+
+ }
}
?>
\ No newline at end of file
'use' => 'a'
),
+ // Reference Name - Not displayed to user
+ 'reference_name' => array (
+ 'field' => 'reference_name',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
// Status
'status' => array (
'field' => 'status',
'list' => $this->config['status'],
'required' => true,
'default' => $this->config['status_numb']['Pending'],
+ 'force_list' => true,
'use' => 'a'
),
// Create Time
'create_time' => array (
'field' => 'create_time',
- 'type' => 'date',
- 'required' => true,
- 'default' => 'now',
- 'use' => 'a'
+ 'type' => 'datetime',
+ 'use' => 'lgie'
),
// Last Modify Time
'modify_time' => array (
'field' => 'modify_time',
- 'type' => 'date',
- 'required' => true,
- 'default' => 'now',
+ 'type' => 'datetime',
'use' => 'a'
),
'descr' => array(
'field' => 'descr',
'type' => 'text',
- 'required' => true,
'use' => 'a'
),
'short_descr' => array (
'field' => 'short_descr',
'type' => 'text',
- 'required' => true,
'use' => 'a'
),
'p_field' => 'name',
'p_orderby' => 'name',
'p_blank' => true,
- 'required' => true,
'force_list' => true,
'use' => 'a'
),
'field' => 'state',
'type' => 'list',
'list' => $this->config['states'],
- 'required' => true,
'default' => 'MI',
+ 'force_list' => true,
'use' => 'a'
),
'field' => 'country',
'type' => 'list',
'list' => $this->config['countries'],
- 'required' => true,
'default' => 'US',
+ 'force_list' => true,
'use' => 'a'
),
'p_field' => 'name',
'p_orderby' => 'name',
'p_blank' => true,
+ 'force_list' => true,
'use' => 'a'
),
'field' => 'notes',
'type' => 'text',
'use' => 'a'
- ),
-
- // Create time
- 'create_time' => array (
- 'field' => 'create_time',
- 'type' => 'time',
- 'required' => true,
- 'use' => 'a'
- ),
-
- // Modify time
- 'modify_time' => array (
- 'field' => 'modify_time',
- 'type' => 'time',
- 'required' => true,
- 'use' => 'a'
)
);
'type' => 'date',
'required' => true,
'use' => 'a'
+ ),
+
+ /*
+ * Has pending information
+ *
+ * This is returning the sum of the ID field for all matching entries in the other table
+ * where the ID of the member entry is equal to the 'member' column in the member_info
+ * table and only for those entries where the status column is set to Pending.
+ *
+ * If this returns a value of 0, there are no pending informaation records for this member.
+ * If it returns a positive value, there are. The actual positive number returned is
+ * of course not anything useable, only that it's positive.
+ *
+ */
+ 'pending' => array (
+ 'field' => 'id',
+ 'as' => 'pending',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_info',
+ 'p_field' => 'member',
+ 'p_id' => 'member',
+ 'p_where' => 'status = '.$this->config['status_numb']['Pending'],
+ 'p_sum' => true,
+ 'use' => 'gl'
)
);
glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
}
-
-
}
}
; Custom configurations for development and developer configuration at bottom of file.
;
+; Image sizes array is outsize of the sections below and is added to $config after the section is selected.
+; Any sizes added to this section will used by the Data Abstract to generate that size when images are uploaded.
+; Crop value:
+; 1. If false (default), images will not be cropped.
+; 2. If an array in the form of array( x_crop_position, y_crop_position ):
+; x_crop_position accepts 'left' 'center', or 'right'.
+; y_crop_position accepts 'top', 'center', or 'bottom'.
+; Images will be cropped to the specified dimensions within the defined crop area.
+
+[imageSizes]
+
+large['width'] = 800
+large['height'] = false
+large['crop'] = false
+
+medium['width'] = 400
+medium['height'] = false
+medium['crop'] = false
+
+small['width'] = 200
+small['height'] = false
+small['crop'] = false
+
+thumb['width'] = 60
+thumb['height'] = false
+thumb['crop'] = false
+
[common]
+;
+; Google Maps Browser API Key
+; Account: cscott.glm@gmail.com
+; Need to create a new key for each "Project", referrer
+; for the project should be the customer's Web site.
+;
+googleMapsApiKey = '' ;'AIzaSyDWgyf8MeYdxZRHaN73O37vFbkhvPjjNhU'
+
+; General Settings
+timezone = America/Detroit
+
;
; Entry Status Types
;
-status[10] = 'Inactive'
-status[20] = 'Active'
-status[30] = 'Pending Review'
-status[40] = 'Archived'
+status[10] = 'Active'
+status[20] = 'Pending Review'
+status[30] = 'Inactive'
+status[90] = 'Archived'
-status_numb['Inactive'] = 10
-status_numb['Active'] = 20
-status_numb['Pending'] = 30
-status_numb['Archived'] = 40
+status_numb['Active'] = 10
+status_numb['Pending'] = 20
+status_numb['Inactive'] = 30
+status_numb['Archived'] = 90
;
; Member Access Levels
;
-memb_access[10] = 'Inactive'
-memb_access[20] = 'Active, No Memb Access'
-memb_access[30] = 'Active, Moderated'
-memb_access[40] = 'Active, Full Access'
-memb_access[90] = 'Archived'
+memb_access[10] = 'Not Displayed'
+memb_access[20] = 'Display, No Memb Access'
+memb_access[30] = 'Display, Moderated'
+memb_access[40] = 'Display, Full Access'
+memb_access[90] = 'Not Displayed, Archived'
-memb_access_numb['Inactive'] = 10
+memb_access_numb['NotDisplayed'] = 10
memb_access_numb['NoAccess'] = 20
memb_access_numb['Moderated'] = 30
memb_access_numb['Full'] = 40
$this,
'glmMembersAdminScripts'
));
+
}
/**
// Add a submenu for the "Member" section
add_submenu_page('glm-members-admin-menu-members', 'Member Information',
- 'Member Data', 'glm_members_member', 'glm-members-admin-menu-member',
+ 'Add Member', 'glm_members_member', 'glm-members-admin-menu-member',
array(
$this,
'glmMembersAdminMenuMember'
{
$errorMsg = '';
+ /*
+ * Because WordPress insists on forcing the timezone to UTC
+ * we need to save the current timezone setting, set the one
+ * we want to use, and then restore it after we're all done
+ * (see bottom of this script).
+ */
+ $defaultTimeZone = date_default_timezone_get();
+ date_default_timezone_set($this->config['timezone']);
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
// If debug is VERBOSE
$smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL );
$smarty->templateAssign ( 'thisPage', $_REQUEST['page']);
$smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
+ $smarty->templateAssign ( 'glmPluginMediaURL', GLM_MEMBERS_PLUGIN_MEDIA_URL );
$smarty->templateAssign ( 'thisYear', date ( 'Y' ) );
$smarty->templateAssign ( $this->config['term']);
$smarty->templateAssign ( $this->config['phrase']);
+ $smarty->templateAssign ( 'googleMapsBrowserApiKey', $this->config['googleMapsApiKey']);
// Add data from model to Smarty template
if (is_array($results['data']) && count($results['data']) > 0) {
// Generate output from model data and view
$smarty->template->display($view);
+
+ // Restore timezone that was set before our code was called
+ date_default_timezone_set($defaultTimeZone);
+
}
+
}
'option' => false
), $atts);
-
-
-
-
-
+ /*
+ * Because WordPress insists on forcing the timezone to UTC
+ * we need to save the current timezone setting, set the one
+ * we want to use, and then restore it after we're all done
+ * (see bottom of this script).
+ */
+ $defaultTimeZone = date_default_timezone_get();
+ date_default_timezone_set($this->config['timezone']);
$errorMsg = '';
// Add standard parameters
$smarty->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
+ $smarty->templateAssign ( 'baseURL', GLM_MEMBERS_PLUGIN_BASE_URL);
$smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL );
$smarty->templateAssign ( 'thisPage', $_REQUEST['page']);
$smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
+ $smarty->templateAssign ( 'glmPluginMediaURL', GLM_MEMBERS_PLUGIN_MEDIA_URL );
$smarty->templateAssign ( 'thisYear', date ( 'Y' ) );
+ $smarty->templateAssign ( $this->config['term']);
+ $smarty->templateAssign ( $this->config['phrase']);
// Add all terms and phrases from the config/plugin.ini file
$smarty->templateAssign ( 'terms', $this->config->term);
// Generate output from model data and view
$smarty->template->display($view);
+
+ // Restore timezone that was set before our code was called
+ date_default_timezone_set($defaultTimeZone);
+
}
}
?>
\ No newline at end of file
.glm-indent {
padding-left: 2em;
}
-
+.glm-center {
+ text-align: center;
+}
.glm-copyright {
text-align: center;
margin: 2em;
}
+.glm-button {
+ margin-left: 4px !important;
+ margin-right: 4px !important;
+}
+
/* Admin Area - General */
#glm-admin-content-container {
border: 1px #ccc solid;
}
.glm-item-container {
border: 1px #ccc solid;
- padding: .2em;
+ padding: .4em;
background: #f8f8f8;
}
/* Admin Tabs */
+
+.nav-tab-wrapper {
+ white-space: nowrap;
+ height: 1.5em;
+}
.nav-tab {
- font-size: 15px !important;
+ font-size: 1.1vw !important;
font-weight: bold;
+ padding: 0px 8px 4px 8px !important;
}
.nav-tab-active {
- font-size: 15px !important;
font-weight: bold; var_dump($memberData);
-
+ font-size: 1.1vw !important;
text-decoration: none;
border: 2px #ccc solid;
border-bottom: 0px;
- padding: 6px 10px 8px 10px;
+ padding: 8px 8px 10px 8px !important;
+ margin-bottom: 10px;
background-color: #f8f8f8;
}
.disabled {
width: 90%;
}
.glm-form-text-input-short {
- width: 10em;
+ width: 15em;
+}
+.glm-form-text-input-medium {
+ width: 30em;
}
.glm-form-textarea {
width: 90%;
font-size: 15px;
font-weight: bold;
}
+.glm-admin-table-active {
+ background: lightblue;
+}
+.glm-admin-image-edit-table {
+ border: 2px #ddd solid;
+}
+.glm-admin-image-edit-table td {
+ padding: 5px;
+}
+
/* Overlay dialog box */
.glm-dialog-box {
/* Map Edit */
.glm-map-edit {
- width:320px;
- height:200px;
+ width:90%;
+ height:400px;
border: 2px black solid;
}
*/
define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Members Database');
-define('GLM_MEMBERS_PLUGIN_DIR', 'glm-members-db');
+define('GLM_MEMBERS_PLUGIN_DIR', 'glm-member-db');
// Debug Options
define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', true);
$pageUri = explode('?', $_SERVER['REQUEST_URI']); // Bust this up to access URL path and script name only
define('GLM_MEMBERS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_PLUGIN_DIR);
define('GLM_MEMBERS_PLUGIN_CURRENT_URL', $pageProtocol.'://'.$_SERVER['SERVER_NAME'].$pageUri[0]);
+define('GLM_MEMBERS_PLUGIN_MEDIA_URL', WP_CONTENT_URL.'/plugins/'.GLM_MEMBERS_PLUGIN_DIR.'/media');
// Directories
define('GLM_MEMBERS_PLUGIN_PATH', dirname(__FILE__));
define('GLM_MEMBERS_PLUGIN_DB_SCRIPTS', dirname(__FILE__).'/misc/databaseScripts');
define('GLM_MEMBERS_PLUGIN_CLASS_PATH', GLM_MEMBERS_PLUGIN_PATH.'/classes');
define('GLM_MEMBERS_PLUGIN_LIB_PATH', GLM_MEMBERS_PLUGIN_PATH.'/lib');
+define('GLM_MEMBERS_PLUGIN_IMAGES_PATH', GLM_MEMBERS_PLUGIN_PATH.'/media/images');
+define('GLM_MEMBERS_PLUGIN_CONFIG_PATH', GLM_MEMBERS_PLUGIN_PATH.'/config');
+
// Database table prefixes
global $wpdb;
// Get plugin configuration - Just use common section for now, we'll deal with others later
$configData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/plugin.ini', true);
$config = $configData['common'];
+$config['imageSizes'] = $configData['imageSizes'];
// Get additional configuration data
$stateData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/states.ini');
add_action('admin_notices','glmMembersAdminNotices');
}
-
-
-
-
-
?>
\ No newline at end of file
--- /dev/null
+/**
+ * jQuery geolocation.edit plugin
+ * Copyright (c) 2012 Milos Popovic <the.elephant@gmail.com>
+ *
+ * Freely distributable under the MIT license.
+ *
+ * @version 0.0.11 (2014-06-01)
+ * @see http://github.com/miloss/jquery-geolocation-edit
+ */
+
+(function ($) {
+ var inits
+ , methods
+ , loadScript;
+
+ // Queued initializations
+ inits = [];
+ // Methods container object
+ methods = {};
+
+
+ // Plugin methods
+ // --------------
+
+ /**
+ * Main execution method
+ * @param {Object} options Passed plugin options
+ */
+ methods.main = function (options) {
+ var selector = this
+ , opts
+ , llat, llng, llocation
+ , i, addrlen;
+
+ // Check for required fields
+ if (typeof options.lat === "undefined" ||
+ typeof options.lng === "undefined") {
+ $.error("Please provide 'lat' and 'lng' options for jQuery.geolocate");
+ return;
+ }
+
+ // If GoogleMaps not loaded - push init to queue and go on
+ if (typeof google === "undefined" ||
+ typeof google.maps === "undefined") {
+ inits.push(function () {
+ $(selector).geolocate(options);
+ });
+ loadScript();
+ return;
+ }
+
+ // Extend default options
+ opts = $.extend(true, {
+ address: [],
+ changeOnEdit: false,
+ mapOptions: {
+ zoom: 14,
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
+ mapTypeControl: false,
+ streetViewControl: false
+ },
+ markerOptions: {
+ draggable:true,
+ animation: google.maps.Animation.DROP
+ },
+ geoCallback: function(){}
+ }, options);
+
+ $(this).data('opts', opts);
+
+ // Init map and marker - per coordinates
+ llat = parseFloat( $( opts.lat ).val() );
+ llng = parseFloat( $( opts.lng ).val() );
+ if (isNaN(llat)) {
+ llat = 0;
+ }
+ if (isNaN(llng)) {
+ llng = 0;
+ }
+
+ llocation = new google.maps.LatLng(llat, llng);
+ $(this).geolocate({}, 'initMap', llocation);
+
+ // Bind actions - coordinates fields (future?)
+ if ( opts.changeOnEdit ) {
+ $( opts.lat ).change(function () { /* ... */ });
+ $( opts.lng ).change(function () { /* ... */ });
+ }
+
+ // Bind actions - address field
+ addrlen = opts.address.length;
+ if (addrlen > 0) {
+ for (i=0; i<addrlen; i++) {
+ $( opts.address[i] ).change(function () {
+ $(selector).geolocate({}, 'callGeocoding');
+ });
+ }
+ }
+ };
+
+
+ /**
+ * Initialize GoogleMaps Map on page
+ * @param {LatLng} location GoogleMaps object
+ */
+ methods.initMap = function (location) {
+ var self = $(this).get(0)
+ , gmaps = google.maps
+ , map
+ , markerOptions
+ , marker
+ , opts = $.data(self, 'opts');
+
+ map = new gmaps.Map(self, $.extend({
+ center: location
+ }, opts.mapOptions));
+
+ markerOptions = $.extend({
+ map: map,
+ position: location
+ }, opts.markerOptions);
+
+ marker = new gmaps.Marker(markerOptions);
+
+ $.data(self, 'map', map);
+ $.data(self, 'marker', marker);
+
+ gmaps.event.addListener(marker, 'dragend', function () {
+ $(self).geolocate({}, 'getMarkerLocation');
+ });
+ };
+
+
+ /**
+ * Make Google Geocoding call with provided address
+ */
+ methods.callGeocoding = function () {
+ var self = $(this).get(0)
+ , opts = $.data(self, 'opts')
+ , len = opts.address.length
+ , cbfunc = opts.geoCallback
+ , addr = ''
+ , geo;
+
+
+ // Get address
+ while (len--) {
+ addr += $( opts.address[len] ).val();
+ }
+
+ // Make request
+ geo = new google.maps.Geocoder();
+
+ // Geocoder response
+ geo.geocode({
+ address: addr
+ }, function (data, status) {
+ var loc, first, map, marker;
+
+ cbfunc(data, status);
+
+ first = data[0];
+ if (typeof first === "undefined") return;
+
+ map = $.data(self, "map");
+ marker = $.data(self, "marker");
+
+ loc = first.geometry.location;
+ map.panToBounds( first.geometry.viewport );
+ map.panTo( loc );
+ marker.setPosition( loc );
+ $(self).geolocate({}, "getMarkerLocation");
+ });
+ };
+
+
+ /**
+ * Copy marker position to coordinates fields
+ */
+ methods.getMarkerLocation = function () {
+ var self = $(this).get(0)
+ , mrk = $.data(self, 'marker')
+ , opts = $.data(self, 'opts')
+ , pos = mrk.getPosition();
+
+ $( opts.lat ).val( pos.lat() );
+ $( opts.lng ).val( pos.lng() );
+ };
+
+
+ // Plugin function
+ // Call appropriate method, or execute "main"
+ $.fn.geolocate = function (os, method) {
+ var pslice = Array.prototype.slice;
+
+ if ( typeof method === 'undefined' ) {
+
+ // Only method passed (as 1st parameter)
+ if ( typeof os === "string" && typeof methods[os] !== "undefined" ) {
+ return methods[ os ].apply( this, pslice.call( arguments, 1 ));
+ } else {
+ $(this).geolocate({}, 'main', os);
+ }
+
+ } else if ( methods[method] ) {
+ return methods[ method ].apply( this, pslice.call( arguments, 2 ));
+
+ } else {
+ $.error( "Method " + method + " does not exist on jQuery.geolocate" );
+
+ }
+
+ return this;
+ };
+
+
+ // Callback to GoogleMaps async loading
+ // FIXME find non-jQuery.fn-polluting solution
+ $.fn.geolocateGMapsLoaded = function () {
+ while (inits.length) {
+ inits.shift()();
+ }
+ };
+
+
+ // Private functions
+ // -----------------
+
+ // Load GoogleMaps, we want to do it only once
+ loadScript = (function(){
+ var ran = false;
+
+ return function () {
+ var script;
+ if (ran) return;
+ ran = true;
+
+ script = document.createElement("script");
+ script.type = "text/javascript";
+ script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=$.fn.geolocateGMapsLoaded";
+ document.body.appendChild(script);
+ };
+ })();
+
+})(jQuery);
* @license http://www.gaslightmedia.com Gaslightmedia
* @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
*/
-\r
+
/**\r
* DataAbstract\r
*\r
\r
abstract class GlmDataAbstract
{
+
+
/**
* Configuration information object
* @var $ini
'email',
'date',
'time',
+ 'datetime', // Full date and time
'phone',
'image',
'latitude',
*\r
* @access public\r
*/\r
- public $optionIncludeSelectListData = true;\r
-
+ public $optionIncludeSelectListData = true;
/**
* Delete Restrictions - Not fully sorted out yet
*
return $in;
}
- if (!is_numeric($in)) {
+ if ($in != '' && !is_numeric($in)) {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Input is not numeric.';
return $in;
}
function pointerOutput($f, $d, $forEdit = false, $id = false, $idfield = 'id')
{
+ /*
+ * This function will only return the value of the pointer field unless one
+ * of the following situations occurs.
+ * $forEdit is true to force the pointer options for an edit form
+ * 'force_list' option is true
+ * 'p_static' option true to force only the pointer field value to be returned
+ *
+ * if 'p_sum' is true, then this function will look up the values from the
+ * specified field in the other table to get the summ of all values, but
+ * will not return a list of options.
+ */
// 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']);
- if (($alwaysList || $forEdit) && !$pStatic ) {
+ $pSum = (isset($f['p_sum']) && $f['p_sum']);
+ if (($alwaysList || $forEdit || $pSum) && !$pStatic ) {
$p_value = $d;
// Get pointer options from specified table
$order_by = $f['p_field'];
- if ($f['p_orderby']) {
+ 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']) {
+ if (isset($f['p_where']) && $f['p_where'] != '') {
$where = 'WHERE '.$f['p_where'];
}
$p_id = $f['p_id'];
}
- $sql = "
- SELECT ".$p_id." AS p_id,
- ".$f['p_field']." AS p_value
- FROM ".$f['p_table']."
- $where
- ORDER BY $order_by
- ";
- $p_list = $this->wpdb->get_results($sql, ARRAY_A);
+ // If p_sum is selected, do a special query
+ if ($pSum) {
- // Build pick select table
- $pick_select = false;
- $selected_name = '';
- $pick_list = array();
+ $sql = "
+ SELECT COALESCE(SUM(".$f['p_field']."), 0) AS p_sum
+ FROM ".$f['p_table']."
+ $where
+ AND $p_id = $p_value
+ ";
+ $res = $this->wpdb->get_row($sql, ARRAY_A);
- $blankText = '';
- if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') {
- $blankText = $f['p_blank_text'];
- }
- if (isset($f['p_blank']) && $f['p_blank']) {
- $pick_list[0] = array(\r
- 'value' => '',\r
- 'name' => $blankText,\r
- 'default' => (!$p_value)\r
- );\r
- }
-
- if (count($p_list) > 0) {
-
- reset($p_list);
- foreach ($p_list as $p) {
-
- if ($this->optionIncludeSelectListData) {
- $pick_list[$p['p_id']] = array(
- 'value' => $p['p_id'],
- 'name' => $p['p_value'],
- 'nameEsc' => addslashes($p['p_value']),
- 'default' => ($p['p_id'] == $p_value)
- );
- }
-
- // Check for selected option
- if ($p['p_id'] == $p_value) {
- $selected_name = $p['p_value'];
- }
+ return $res['p_sum'];
+ } else {
+
+
+ $sql = "
+ SELECT ".$p_id." AS p_id,
+ ".$f['p_field']." AS p_value
+ FROM ".$f['p_table']."
+ $where
+ ORDER BY $order_by
+ ";
+ $p_list = $this->wpdb->get_results($sql, ARRAY_A);
+
+
+ // Build pick select table
+ $pick_select = false;
+ $selected_name = '';
+ $pick_list = array();
+
+ $blankText = '';
+ if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') {
+ $blankText = $f['p_blank_text'];
+ }
+ if (isset($f['p_blank']) && $f['p_blank']) {
+ $pick_list[0] = array(\r
+ 'value' => '',\r
+ 'name' => $blankText,\r
+ 'default' => (!$p_value)\r
+ );\r
}
- } else {
+ if (count($p_list) > 0) {
- // There were no results from the
- $this->inputFieldStatus = false;
- $this->inputErrorReason = 'No options were available for this pick list.';
+ reset($p_list);
+ foreach ($p_list as $p) {
- }
+ if ($this->optionIncludeSelectListData) {
+ $pick_list[$p['p_id']] = array(
+ 'value' => $p['p_id'],
+ 'name' => $p['p_value'],
+ 'nameEsc' => addslashes($p['p_value']),
+ 'default' => ($p['p_id'] == $p_value)
+ );
+ }
- $r = array(
- 'value' => $p_value,
- 'name' => $selected_name,
- 'nameEsc' => addslashes($selected_name),
- 'list' => $pick_list
- );
+ // Check for selected option
+ if ($p['p_id'] == $p_value) {
+ $selected_name = $p['p_value'];
+ }
- return $r;
+ }
+
+ } else {
+
+ // There were no results from the
+ $this->inputFieldStatus = false;
+ $this->inputErrorReason = 'No options were available for this pick list.';
+
+ }
+
+ $r = array(
+ 'value' => $p_value,
+ 'name' => $selected_name,
+ 'nameEsc' => addslashes($selected_name),
+ 'list' => $pick_list
+ );
+
+ return $r;
+
+ } // else p_sum
}
$in = ($f['default']);
}
- // Otherwise check for input data
- } else {
+ // Otherwise check for input data
+ } else {
// Sanitize currently selected value
$in = filter_input(INPUT_POST, $as, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
// Is it one of the available values
- if ($f['required'] && trim($in) == '') {
+ if (isset($f['required']) && $f['required'] && trim($in) == '') {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Required input is not provded.';
}
/*
* Date Field Processing
*/
- // Support function to build picklists for Date field
- function buildDateFieldLists($min, $max)
- {
-
- if (!$this->optionIncludeSelectListData) {
- return false;\r
- }
-
- // Default date input lists
- $month_list = array(
- 1 => array('name' => 'Jan', 'value' => 1, 'default' => false),
- 2 => array('name' => 'Feb', 'value' => 2, 'default' => false),
- 3 => array('name' => 'Mar', 'value' => 3, 'default' => false),
- 4 => array('name' => 'Apr', 'value' => 4, 'default' => false),
- 5 => array('name' => 'May', 'value' => 5, 'default' => false),
- 6 => array('name' => 'Jun', 'value' => 6, 'default' => false),
- 7 => array('name' => 'Jul', 'value' => 7, 'default' => false),
- 8 => array('name' => 'Aug', 'value' => 8, 'default' => false),
- 9 => array('name' => 'Sep', 'value' => 9, 'default' => false),
- 10 => array('name' => 'Oct', 'value' => 10, 'default' => false),
- 11 => array('name' => 'Nov', 'value' => 11, 'default' => false),
- 12 => array('name' => 'Dec', 'value' => 12, 'default' => false),
- );
- $day_list = array();
- for ($i = 1; $i <= 31; $i++) {
- $day_list[$i] = array('name' => $i, 'value' => $i, 'default' => false);
- }
- $year_list = array();
-
- $min_year = date('Y', $min);
- $max_year = date('Y', $max);
- for ($i = $min_year; $i <= $max_year; $i++) {
- $year_list[$i] = array('name' => $i, 'value' => $i, 'default' => false);
- }
-
- $date_list = array(
- 'month' => $month_list,
- 'day' => $day_list,
- 'year' => $year_list,
- 'min' => date('m/d/Y',$min),
- 'max' => date('m/d/Y',$max)
- );
-
- return $date_list;
- }
function dateField($f)
{
return 'T.'.$f['field'];
$def_day = date('j', $t);\r
$date_list['day'][$def_day]['default'] = true;\r
$def_year = date('Y', $t);\r
- $date_list['year'][$def_year]['default'] = true;\r
+ $date_list['year'][$def_year]['default'] = true;
$out['date_list'] = $date_list;\r
}\r
return "'".$in['time_store']."'";
}
+ /*
+ * datetime (date and time) Field Processing
+ */
+ function datetimeField($f)
+ {
+ return 'T.'.$f['field'];
+ }
+ function datetimeOptions($f)
+ {
+ return false;
+ }
+ function datetimeOutput($f, $d)
+ {
+
+ // Check for min/max date values
+ if (isset($f['minValue']) && ($f['minValue']-0) > 0) {
+ $min = $f['minValue']-0;
+ } else {
+ $min = strtotime('-10 years');
+ }
+ if (isset($f['maxValue']) && ($f['maxValue']-0) > 0) {
+ $max = $f['maxValue']-0;
+ } else {
+ $max = strtotime('+10 years');
+ }
+
+ // Check if it's a valid time (MySQL returns 0000-00-00 00:00:00 for a null time, which maps to a timestamp = -62169984000)
+ $haveDatetime = true;
+ if (substr($d, 0, 4) == '0000') {
+
+ // No valid time retrieved
+ $haveDateTime = false;
+ $text_datetime = '';
+ $t = 0;
+
+ } else {
+
+ // Get time stamp for retrieved data
+ $t = strtotime($d);
+
+ // Set text format for return
+ $format = 'm/d/Y h:i A';
+ if (isset($f['format']) && $f['format'] != false) {
+ $format = $f['format'];
+ }
+
+ // If there was a date stored, then display it, otherwise blank
+ if ($d != '') {
+ $text_datetime = date($format, $t);
+ } else {
+ $text_datetime = '';
+ }
+
+ }
+
+ // Build return array
+ $out = array(
+ 'datetime' => $text_datetime,
+ 'timestamp' => $t
+ );
+
+ // Build picklists for date input
+ $date_list = false;
+ if ($this->optionIncludeSelectListData) {
+
+ $date_list = $this->buildDateFieldLists($min, $max, true);
+
+ if ($haveDatetime) {
+
+ // Get default values for list selection and set in date_list array
+ $def_month = date('n', $t);
+ $date_list['month'][$def_month]['default'] = true;
+ $def_day = date('j', $t);
+ $date_list['day'][$def_day]['default'] = true;
+ $def_year = date('Y', $t);
+ $date_list['year'][$def_year]['default'] = true;
+ $def_hour = date('h', $t);
+ $date_list['hour'][($def_hour-0)]['default'] = true;
+ $def_min = date('i', $t);
+ $date_list['minute'][$def_min]['default'] = true;
+ $def_ampm = date('a', $t);
+ $date_list['ampm'][$def_ampm]['default'] = true;
+
+ }
+
+ $out['date_list'] = $date_list;
+ }
+
+ return $out;
+ }
+ function datetimeInput($as, $f, $id, $idfield, $op)
+ {
+ $this->inputFieldStatus = true;
+
+ // Check for min/max date values
+ if (isset($f['minValue']) && ($f['minValue']-0) > 0) {
+ $min = $f['minValue']-0;
+ } else {
+ $min = strtotime('-10 years');
+ }
+ if (isset($f['maxValue']) && ($f['maxValue']-0) > 0) {
+ $max = $f['maxValue']-0;
+ } else {
+ $max = strtotime('+10 years');
+ }
+
+ // Build picklists for date input
+ $date_list = $this->buildDateFieldLists($min, $max, true);
+
+ // If this is setup for a new entry, then just return default value
+ if ($op == 'n') {
+
+ $in = time(); // Assume current time
+
+ // Check for a specified default
+ if (isset($f['default']) && $f['default'] != false) {
+ $in = ($f['default']);
+ }
+
+ // Otherwise we should be getting input from the user
+ } else {
+
+ $this->inputErrorReason = false;
+ $in_type = false;
+ $in = false;
+
+ // If we're getting separate month, day, year, hour, min, ampm
+ if (isset($_REQUEST[$as.'_month'])) {
+
+ // Looks like we have picklist input
+ $in = strtotime($_REQUEST[$as.'_month'].'/'.$_REQUEST[$as.'_day'].'/'.$_REQUEST[$as.'_year'].' '.$_REQUEST[$as.'_hour'].':'.$_REQUEST[$as.'_min'].' '.$_REQUEST[$as.'_ampm']);
+ $in_type = 'pick';
+
+ // Look for plain text input
+ } elseif (isset($_REQUEST[$as])) {
+ $in = strtotime($_REQUEST[$as]);
+ $in_type = 'text';
+ }
+
+ // check if the input time was invalid
+ if (isset($f['required']) && $f['required'] && $in == false) {
+ $this->inputErrorReason = 'Date supplied is invalid.';
+ $this->inputFieldStatus = false;
+ $in = time();
+ }
+
+ } // get input from user
+
+ // Force to be numeric - Must be time stamp at this point
+ $in = ($in - 0);
+
+ // Use default format unless there's a date format spec?
+ $format = ('m/d/Y h:i A');
+ if (isset($f['format']) && $f['format']) {
+ $format = $f['format'];
+ }
+
+ // Check for required input - Can't be 0 (epoch)
+ if (isset($f['required']) && $f['required']) {
+ if ($in == 0) {
+ $this->inputErrorReason = 'Required date not supplied.';
+ $this->inputFieldStatus = false;
+ // Check for valid date range
+ } elseif (isset($f['minValue']) && $f['minValue'] && $in < $f['minValue']) {
+ $this->inputErrorReason = 'Date earlier than permitted ('.date($format, $f['minValue']).').';
+ $this->inputFieldStatus = false;
+ } elseif (isset($f['maxValue']) && $f['maxValue'] && $in > $f['maxValue']) {
+ $this->inputErrorReason = 'Date later than permitted ('.date($format, $f['maxValue']).').';
+ $this->inputFieldStatus = false;
+ }
+ }
+
+ // Use specified format to clean up date
+ if ($in > 0) {
+ $text_date = date($format, $in);
+ } else {
+ $text_date = '';
+ }
+
+ // Create MYSQL compatible date input
+ $sqlDate = date('Y-m-d H:i:s', $in);
+
+ // If the field validated and it's supposed to be unique
+ if ($this->inputFieldStatus && $this->inputFieldStatus && isset($f['unique']) && $f['unique']) {
+
+ // Query table to see if there's a conflict
+ $sql = "
+ SELECT COUNT(".$f['field'].")
+ FROM ".$this->table."
+ WHERE ".$f['field']." = '$sqlDate';
+ ";
+
+ // If there's an ID field, then this must be an update rather than an insert
+ if ($id != false && $idField != false) {
+ // Add clause to check if not the current record
+ $sql .= "AND $idField != $id";
+ }
+
+ $d = $this->wpdb->get_results($sql, ARRAY_A);
+
+ if ($d['count'] > 0) {
+ $this->inputFieldStatus = false;
+ $this->inputErrorReason = 'This must unique but it conflicts with another entry.';
+ return $in;
+ }
+ }
+
+ // Get default values for list selection and set in date_list array
+ if ($text_date != '') {
+ $def_month = date('n', $in);
+ $date_list['month'][$def_month]['default'] = true;
+ $def_day = date('j', $in);
+ $date_list['day'][$def_day]['default'] = true;
+ $def_year = date('Y', $in);
+ $date_list['year'][$def_year]['default'] = true;
+ $def_hour = date('h', $in);
+ $date_list['hour'][($def_hour-0)]['default'] = true;
+ $def_min = date('i', $in);
+ $date_list['minute'][$def_min]['default'] = true;
+ $def_ampm = date('a', $in);
+ $date_list['ampm'][$def_ampm]['default'] = true;
+ }
+
+ // Build return array
+ $v = array(
+ 'datetime' => $text_date,
+ 'timestamp' => $in,
+ 'date_list' => $date_list,
+ );
+
+ return $v;
+
+ }
+ function datetimeStore($in, $f)
+ {
+
+ // Check if there's no date then supply null
+ if ($in['datetime'] != '') {
+
+ // Create MYSQL compatible date input
+ $sqlDate = date('Y-m-d H:i:s', strtotime($in['datetime']));
+
+ return "'$sqlDate'";
+
+ } else {
+ return "null";
+ }
+ }
+
+
/*
* Phone Field Processing
*/
}
function imageInput($as, $f, $id, $idfield, $op)
{
-echo "DDDDD";
$haveNewImage = false;
$in = '';
return $in;
}
-echo "222";
- $current_img = false;
- // Setup Image server access
-// require_once IMAGE_SERVER_ABSTRACT;
-// $imServer = new ImageServerAbstract();
+ $current_img = false;
// Check if there's an existing image
if ($id != false) {
$sql = "SELECT $as
FROM $this->table
WHERE $idfield = $id;";
-
- $d = $this->wpdb->get_results($sql, ARRAY_A);
+ $d = $this->wpdb->get_row($sql, ARRAY_A);
if (trim($d[$as]) != '') {
$current_img = $d[$as];
// If there a request to delete an existing image or a new image and there's a current image
if (isset($_REQUEST[$as."_delete"]) && ($_REQUEST[$as."_delete"] == 'on' || $new) && $current_img != false) {
-// $imServer->imageDelete($current_img);
+
+ // Scan all the image size directories and remove this image
+ while (list($k, $v) = each($this->config['imageSizes'])) {
+ unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$current_img);
+ }
+
$current_img = '';
+
}
-echo "3333";
+
// Is there a new image being uploaded
if (isset($_FILES[$as.'_new']) && is_array($_FILES[$as.'_new']) && $_FILES[$as.'_new']['tmp_name'] != '') {
- $tmpImg = $_FILES[$as.'_new']['tmp_name'];
-
-$imgSize = filesize ( $tmpImg );
-echo "Getting $tmpImg - Size = $imgSize<br>";
- $newImage = wp_get_image_editor($tmpImg);
+ // Get new image using temporary file name
+ $newImage = wp_get_image_editor($_FILES[$as.'_new']['tmp_name']);
// If we have a good image
if ( ! is_wp_error( $newImage ) ) {
- // Get image temp file name
+ // Check if there's a prefix that should be included in the image file name
+ $prefix = '';
+ if (isset($f['i_prefix']) && trim($f['i_prefix']) != '') {
+ $prefix = $f['i_prefix'];
+ }
+
+ // Get the desired file name and add a timestamp to it to ensure that it's unique
+ $fInfo = pathinfo($_FILES[$as.'_new']['name']);
+ $newFilename = $prefix.$fInfo['filename'].'_'.time().'.'.$fInfo['extension'];
+
+ // Get image temp file name - Not currently using, but should be using to check for resizing sanity
$size = $newImage->get_size();
-echo "Size = $size<br>";
- $type = $newImage->get_mime_type();
-echo "Type = $type<br>";
+
+ // Try to store the image using that file name in the 'original' directory
+ $storedImage = $newImage->save( GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$newFilename );
+
+ // Now resize the images using $sizeArray
+ $sizes = $newImage->multi_resize($this->config['imageSizes']);
+
+ // Finally, move the files to the various size directories and rename them back to the correct name
+ while (list($k, $v) = each($this->config['imageSizes'])) {
+
+ // Check if size directory needs to be made
+ if (!file_exists(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k)) {
+ mkdir(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k);
+ }
+
+ // If there's an entry in the $sizes array, it means that the image resized to this size
+ if (isset($sizes[$k])) {
+
+ // Move resized file to desired direectory
+ rename(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$sizes[$k]['file'], GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newFilename);
+
+ } else {
+
+ // Image didn't resize to this size, probably because it was smaller than the destination size (silly WP Image Editor class) - so just use the original
+ copy(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$newFilename, GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newFilename);
+
+ }
+ }
+
+ // Remove original
+ unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$newFilename);
+
+ $current_img = $newFilename;
+
} else {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($newImage, 'DataBlock', "DataAbstract - imageInput() wp_get_image_editor($tmpFile) Error");
}
-echo "Bad image file or some such thing<br>";
}
}
$asFieldUsed = true;
}
- // If field type is pointer and we don't have AS then do it with default
- if ($v['type'] == 'pointer' && ($asFieldUsed)) {
- $this->select .= 'AS '.$v['field'];
- }
-
// Get this field specification
$this->fieldData[$as] = array(
'name' => $as,
}
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($this->fieldData, 'DataBlock', "buildFieldsList() data");
+ }
+
return;
}
$d = $data[$as];
}
- // Call field processing function based on field tye
+ // Call field processing function based on field type
$out = $this->{$type.'Output'}($v, $d, $forEdit, $id, $idfield, $op);
$data[$as] = $out;
*/
public function getStats($where = 'true')
{
+
$sql = "SELECT count(DISTINCT id) as count
FROM $this->table
WHERE $where;";
";
}
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query");
+ }
+
//echo "<pre>$sql</pre>";
$list = $this->wpdb->get_results($sql, ARRAY_A);
}
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query");
glmMembersAdmin::addNotice($list, 'DataBlock', "getList() data");
}
*/
public function getEntry($id, $idfield = 'id', $where = '', $forEdit = false)
{
+
if ($id-0 == 0) {
// echo "DataAbstract.php - getEntry() called with invalid ID";
return false;
$r = $this->processInputData('n');
$r['fieldFail'] = false;
+ // Check if there's a function to do other checks
+ $r = $this->checkOther($r, 'n');
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($r, 'DataBlock', "newEntry() data");
}
* 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);
+ * parent::checkOther($r, $a);
*
- * @return void
+ * @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 array Returns supplied result array as updated
* @access public
*/
- public function checkOther($r)
+ public function checkOther($r, $a)
{
return $r;
}
$r = $this->processInputData('i');
// Check if there's a function to do other checks
- $r = $this->checkOther($r);
+ $r = $this->checkOther($r, 'i');
// If input is OK, try to store
if ($r['status']) {
}
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($r, 'DataBlock', "DataAbstract - insertEntry() failure data");
+ glmMembersAdmin::addNotice($r, 'DataBlock', "DataAbstract - insertEntry() data");
}
return $r;
}
// Check if there's a function to do other checks
- $r = $this->checkOther($r);
+ $r = $this->checkOther($r, 'u');
// If input is OK, and we haven't been told not to, try to store
if ($r['status'] && $store) {
// Get the current record data
$detail = $this->getEntry($id, $idField);
+ // Check if there's a function to do other checks
+ if ($confirm) {
+ $detail = $this->checkOther($detail, 'd');
+ }
+
// Add delete confirmation request flag
$detail['delete'] = true;
* min Minutes
* sec Seconds
*/
-
public function f2LatLon($d, $LatLon, $type, $precision)
{
return $r;
}
+
+ /*
+ * Support function to build picklists for Date field
+ *
+ * @return array
+ */
+ public function buildDateFieldLists($min, $max, $time = false)
+ {
+
+ if (!$this->optionIncludeSelectListData) {
+ return false;
+ }
+
+ // Default date input lists
+ $month_list = array(
+ 1 => array('name' => 'Jan', 'value' => 1, 'default' => false),
+ 2 => array('name' => 'Feb', 'value' => 2, 'default' => false),
+ 3 => array('name' => 'Mar', 'value' => 3, 'default' => false),
+ 4 => array('name' => 'Apr', 'value' => 4, 'default' => false),
+ 5 => array('name' => 'May', 'value' => 5, 'default' => false),
+ 6 => array('name' => 'Jun', 'value' => 6, 'default' => false),
+ 7 => array('name' => 'Jul', 'value' => 7, 'default' => false),
+ 8 => array('name' => 'Aug', 'value' => 8, 'default' => false),
+ 9 => array('name' => 'Sep', 'value' => 9, 'default' => false),
+ 10 => array('name' => 'Oct', 'value' => 10, 'default' => false),
+ 11 => array('name' => 'Nov', 'value' => 11, 'default' => false),
+ 12 => array('name' => 'Dec', 'value' => 12, 'default' => false),
+ );
+ $day_list = array();
+ for ($i = 1; $i <= 31; $i++) {
+ $day_list[$i] = array('name' => $i, 'value' => $i, 'default' => false);
+ }
+
+ $year_list = array();
+ $min_year = date('Y', $min);
+ $max_year = date('Y', $max);
+ for ($i = $min_year; $i <= $max_year; $i++) {
+ $year_list[$i] = array('name' => $i, 'value' => $i, 'default' => false);
+ }
+
+ if ($time) {
+
+ $hour_list = array();
+ for ($i = 1; $i < 12; $i++) {
+ $hour_list[$i] = array('name' => sprintf("%02d", $i), 'value' => $i, 'default' => false);
+ }
+
+ $min_list = array();
+ for ($i = 0; $i < 60; $i++) {
+ $min_list[$i] = array('name' => sprintf("%02d", $i), 'value' => $i, 'default' => false);
+ }
+
+ $ampm_list = array(
+ 'am' => array('name' => 'AM', 'value' => 'am', 'default' => false),
+ 'pm' => array('name' => 'PM', 'value' => 'pm', 'default' => false)
+ );
+ }
+
+ $date_list = array(
+ 'month' => $month_list,
+ 'day' => $day_list,
+ 'year' => $year_list,
+ 'min' => date('m/d/Y',$min),
+ 'max' => date('m/d/Y',$max)
+ );
+
+ if ($time) {
+ $date_list['hour'] = $hour_list;
+ $date_list['minute'] = $min_list;
+ $date_list['ampm'] = $ampm_list;
+ }
+
+ return $date_list;
+ }
+
+
}
?>
\ No newline at end of file
GlmDataAbstract.php Documentation
-------------------------------------------
+
+**** Need to add 'PreDelete" and "PostDelete" capability for things like images and other related stuff ****
+
+
+
This file is an abstract layer for all standard database operations. It
provides the following.
getList() Builds and returns a list of database entries according to
the field definitions array.
+ Parameters:
+ $where Optional SQL "WHERE" clause
+ $order Optional SQL "ORDER BY" clause
+
getEntry() Builds and returns a single simple database table entry or
optionally a single instance of a composite of multiple
related table entries.
can be used to intercept the insert and update process, run
checks on data that was submitted, alter data, add fieldFail
data, and chage the result status. The function is passed the
- entire result array ($r) and should return the same when done
+ entire result array ($r) and the action character ($a)
+ and should return the same when done
performing checks and updates. This is not required when calling
DataAbstract since there is a stub checkOther() method there.
An example follows showing how to hook into checkOther() in
DataAbstract and make additional checks ...
- function checkOther($r)
+ function checkOther($r, $a)
{
// Required
- parent::checkOther($r);
+ parent::checkOther($r, $a);
// ---- Perform test and changes ----
any supplied "%" characters and properly formatting for output.
pointer An integer field being used as a pointer to other table entries.
+ NOTE: Pointer processing is performed after the table data is
+ queried. Because of this, it's not possible to use a 'where' option
+ to select those results. The 'where' option would only operate
+ on the value of the pointer, not what it's pointing to.
list An integer field being used as a pointer to a list of possible
values useable for radio buttons and picklists.
time A timestamp field represented as a time value.
+datetime A timestamp filed represented as a date AND time value.
+
phone A text field expecting and returning text formatted as a Phone
number.
Field Specifications:
-(array index) The array index is only used to permit multiple entries for the
- same database field. This permits including the field several
- times so it can be processed differently based on the operation
- being performed or can be displayed multiple time but each in a
- different way.
-
-'field' Name of field in database table
-
-'as' Name to use for this field for all operations other than for talking
- with the database. Doing this keeps any possible multiple instances
- of use of a single database field separate. (see array index above)
-
- If this is not specified, then the actual database field name is
- used for these purposes.
-
-
-'type' Type of field - Possible field types are...
-
- 'integer',
- 'float',
- 'money',
- 'percent',
- 'pointer',
- 'list',
- 'text',
- 'password',
- 'checkbox',
- 'email',
- 'date',
- 'time',
- 'phone',
- 'image',
- 'latitude', Data is an array of (dir,deg,min,sec);
- 'longitude' " " "
- "dir" is - for West and South
-
-'filter' Optional filter - See PHP filter_input() "filter" parameter.
- Currently only for type "text"
- FILTER_SANITIZE_FULL_SPECIAL_CHARS does not seem to be defined at this time.
- FILTER_SANITIZE_MAGIC_QUOTES seems to be good for permitting HTML
-
-'filter_options' Optional filter options - See PHP filter_input() "options" parameter.
- Currently only for type "text".
-
-'required' If set and true, field data must be supplied
-
-'unique' If set and true, must be a unique value
-
-'default' If set and true use this value as the default for input fields.
- Dates/times are expected to be timestamps
- There is no default image capability
-
-'use' Character(s) that indicate which operations to use this field with.
-
- l = Listing records
- g = Get - Displaying a record
- n = Setup input for a new record
- i = Insert new record
- e = Edit an existing record
- u = Update an edited record
- d = Ask for verification of deletion of a record
- c = Confirm delete and delete record.
- a = All above operations
-
-'minValue' Minimum acceptable value (numeric)
- Dates are specified as timestamp
-
-'maxValue' Maximum acceptable value (numeric)
- Dates are specified as timestamp
+(array index) The array index is only used to permit multiple entries for the
+ same database field. This permits including the field several
+ times so it can be processed differently based on the operation
+ being performed or can be displayed multiple time but each in a
+ different way.
+
+'field' Name of field in database table
+
+'as' Name to use for this field for all operations other than for talking
+ with the database. Doing this keeps any possible multiple instances
+ of use of a single database field separate. (see array index above)
+
+ If this is not specified, then the actual database field name is
+ used for these purposes.
+
+
+'type' Type of field - Possible field types are...
+
+ 'integer',
+ 'float',
+ 'money',
+ 'percent',
+ 'pointer',
+ 'list',
+ 'text',
+ 'password',
+ 'checkbox',
+ 'email',
+ 'date',
+ 'time',
+ 'phone',
+ 'image',
+ 'latitude', Data is an array of (dir,deg,min,sec);
+ 'longitude' " " "
+ "dir" is - for West and South
+
+'filter' Optional filter - See PHP filter_input() "filter" parameter.
+ Currently only for type "text"
+ FILTER_SANITIZE_FULL_SPECIAL_CHARS does not seem to be defined at this time.
+ FILTER_SANITIZE_MAGIC_QUOTES seems to be good for permitting HTML
+
+'filter_options' Optional filter options - See PHP filter_input() "options" parameter.
+ Currently only for type "text".
+
+'required' If set and true, field data must be supplied
+
+'unique' If set and true, must be a unique value
+
+'default' If set and true use this value as the default for input fields.
+ Dates/times are expected to be timestamps
+ There is no default image capability
+
+'use' Character(s) that indicate which operations to use this field with.
+
+ l = Listing records
+ g = Get - Displaying a record
+ n = Setup input for a new record
+ i = Insert new record
+ e = Edit an existing record
+ u = Update an edited record
+ d = Ask for verification of deletion of a record
+ c = Confirm delete and delete record.
+ a = All above operations
+
+'minValue' Minimum acceptable value (numeric)
+ Dates are specified as timestamp
+
+'maxValue' Maximum acceptable value (numeric)
+ Dates are specified as timestamp
-'minLength' Minimum length for an input field
-'maxLength' Maximum length for an input field
+'minLength' Minimum length for an input field
+'maxLength' Maximum length for an input field
-'force_list' Always provide the picklist tables (p_static overrides)
+'force_list' Always provide the picklist tables (p_static overrides)
-'p_table' Table to get related data from for pointer types
+'p_table' Table to get related data from for pointer types
-'p_field' Field to get related data from for field types
+'p_field' Field to get related data from for pointer types
-'p_id' name of ID field in related data table
+'p_id' name of ID field in related data table
-'p_where' Additional WHERE clause for getting possible values from related table.
- "T." refers to the primary table
+'p_where' Additional WHERE clause for getting possible values from related table.
+ "T." refers to the primary table
-'p_from' Additional FROM tables for getting possible values from related table.
+'p_from' Additional FROM tables for getting possible values from related table.
See example in dataMembers.php
-'p_blank' If set or true provide a "blank" option for pointer input
+'p_blank' If set or true provide a "blank" option for pointer input
-'p_blank_text' If set, use this as the text for the 'p_blank' option
+'p_blank_text' If set, use this as the text for the 'p_blank' option
-'p_sort' Optional ORDER BY sort clause (i.e. "name, age DESC") - May not be functional yet.
+'p_sort' Optional ORDER BY sort clause (i.e. "name, age DESC") - May not be functional yet.
-'p_orderby' Optional "ORDER BY" clause for results from table pointed to by pointer
+'p_orderby' Optional "ORDER BY" clause for results from table pointed to by pointer
-'p_autoadd' Option to permit the addition of a new entry using a text input field
+'p_autoadd' Option to permit the addition of a new entry using a text input field
-'p_sum' If true causes a numeric sum of all returned values from the target table/column
+'p_sum' If true causes a numeric sum of all returned values from the target table/column
-'p_static' A static pointer that does not do a lookup for a list of values, only a single value reference
+'p_static' A static pointer that does not do a lookup for a list of values, only a single value reference
-'output_type' Optional type to use for output. Useful with pointers.
+'output_type' Optional type to use for output. Useful with pointers.
-'latlon_type' Optional specification for lat/lon output (DMS, DM, or D)
+'latlon_type' Optional specification for lat/lon output (DMS, DM, or D)
-'view_only' View only field, do not check for input or store, only provide data from record.
+'view_only' View only field, do not check for input or store, only provide data from record.
-'list' Required with field type 'list' - includes simple array where...
- array key is value for option
- array value is name for option
+'list' Required with field type 'list' - includes simple array where...
+ array key is value for option
+ array value is name for option
-'l_blank] Provide a blank entry for type 'list'.
+'l_blank] Provide a blank entry for type 'list'.
'list_keytype' Type of key field (default is 'text')
- 'text' A Text key - expects a text field in the database
- 'int' An Integer key - expects a numeric field in the database
+ 'text' A Text key - expects a text field in the database
+ 'int' An Integer key - expects a numeric field in the database
-'output_format' Optional output format specification as would be used in printf()
- Use only the actual format and not the type identifier (i.e. "02.2" rather than "%f02.2")
+'output_format' Optional output format specification as would be used in printf()
+ Use only the actual format and not the type identifier (i.e. "02.2" rather than "%f02.2")
-'no_stripslashes' Don't strip slashes when recalling this field from the database.
+'no_stripslashes' Don't strip slashes when recalling this field from the database.
-'quicktip' Text description of this field and its use.
+'quicktip' Text description of this field and its use.
-'no_update_when_blank' Do not store a new value if 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)
+'pw_type' Type of password to require for password fields. (default is normal, 'strong' is for strong passwords with a mix of character types)
+'i_prefix' Optional string prefix to be attached to the beginning of a stored image. May be used to categorize images
+ or associate an image with a particular entity. Note that no delimiter is added, so if you want want (i.e. '_'), you need to include that.
Data specification for various types
------------------------------------
----
-CREATE TABLE {prefix}category_member (
+CREATE TABLE {prefix}category_member_info (
id INT NOT NULL AUTO_INCREMENT,
category INT NULL,
- member INT NULL,
+ member_info INT NULL,
PRIMARY KEY (id),
+ CONSTRAINT categories_fk_1
+ FOREIGN KEY (category)
+ REFERENCES {prefix}categories (id)
+ ON DELETE CASCADE,
INDEX(category),
- INDEX(member)
+ INDEX(member_info)
);
----
id INT NOT NULL AUTO_INCREMENT,
member INT NULL,
status INT NULL,
+ reference_name TINYTEXT NULL,
descr TEXT NULL,
short_descr TINYTEXT NULL,
addr1 TINYTEXT NULL,
addr2 TINYTEXT NULL,
city INT NULL,
- state INT NULL,
- country INT NULL,
+ state TINYTEXT NULL,
+ country TINYTEXT NULL,
zip TINYTEXT NULL,
lat FLOAT NULL,
lon FLOAT NULL,
{prefix}amenities,
{prefix}amenity_ref,
{prefix}categories,
- {prefix}category_member,
+ {prefix}category_member_info,
{prefix}cities,
{prefix}contacts,
{prefix}facilities,
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-05 01:52:25
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-27 18:48:22
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 => 1423101141,
+ 1 => 1425062899,
2 => 'file',
),
),
<tr>
<th> <span class="glm-error">You do not have any members listed.</span></th>
<td><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></td>
+?page=glm-members-admin-menu-member&glm_action=index&member_id=">Click here to create your first member.</a></td>
</tr>
<?php }?>
</table>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-06 16:22:14
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-06 14:37:59
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 => 1423239729,
+ 1 => 1425670675,
2 => 'file',
),
),
'thisPage' => 0,
'v' => 0,
'haveInfoRecords' => 0,
+ 'memberID' => 0,
+ 'showArchived' => 0,
+ 'noActive' => 0,
'memberInfoRecords' => 0,
'i' => 0,
'm' => 0,
- 'memberID' => 0,
+ 'statusPending' => 0,
),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<input type="submit" value="Add new member">
<?php }?>
</form>
+
+ <p> </p>
<?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
<?php if ($_smarty_tpl->tpl_vars['haveInfoRecords']->value) {?>
+
+ <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;?>
+" 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>
+
+ <?php if ($_smarty_tpl->tpl_vars['noActive']->value) {?>
+ <h3 class="glm-error">There is no active information for this member.</h3>
+ <?php }?>
+
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
- <th>Access:</th>
+ <th>Access</th>
<th>Created</th>
<th>Last Update</th>
+ <th>Reference Name</th>
+ <th> </th>
</tr>
</thead>
<tbody>
<?php if ((1 & $_smarty_tpl->tpl_vars['i']->value++ / 1)) {?>
<tr>
<?php } else { ?>
- <tr class="alternate">
+ <tr class="alternate<?php if ($_smarty_tpl->tpl_vars['m']->value['status']['name']=='Active') {?> glm-admin-table-active<?php }?>">
<?php }?>
- <td><?php echo $_smarty_tpl->tpl_vars['m']->value['status']['name'];?>
+ <td><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;?>
+&id=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
+"<?php if ($_smarty_tpl->tpl_vars['m']->value['status']['value']==$_smarty_tpl->tpl_vars['statusPending']->value) {?> class="glm-notice"<?php }?>><?php echo $_smarty_tpl->tpl_vars['m']->value['status']['name'];?>
+</a></td>
+ <td><?php echo $_smarty_tpl->tpl_vars['m']->value['create_time']['datetime'];?>
</td>
- <td><?php echo $_smarty_tpl->tpl_vars['m']->value['create_time']['time'];?>
+ <td><?php echo $_smarty_tpl->tpl_vars['m']->value['modify_time']['datetime'];?>
</td>
- <td><?php echo $_smarty_tpl->tpl_vars['m']->value['modify_time']['time'];?>
+ <td><?php echo $_smarty_tpl->tpl_vars['m']->value['reference_name'];?>
</td>
+ <td>
+ <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;?>
+&id=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
+" class="button-primary glm-right">Manage</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 }?>
+ </td>
</tr>
<?php } ?>
</tbody>
?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
<?php }?>
+ <?php echo '<script'; ?>
+ type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $('#showArchived').click( function() {
+ checked = 'false';
+ if ($(this).attr('checked') == 'checked') {
+ checked = 'true';
+ }
+ window.location.replace("<?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;?>
+&showArchived=" + checked);
+ });
+
+ });
+ <?php echo '</script'; ?>
+>
+
<?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-02-01 18:26:59
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-06 13:47:52
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 => 1422815211,
+ 1 => 1425667668,
2 => 'file',
),
),
<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>
- <input type="checkbox" id="filterPending" class="listFilter"<?php if ($_smarty_tpl->tpl_vars['filterStatus']->value) {?> checked<?php }?>>Pending
- <input type="text" id="filterName" class="listFilter" value="<?php echo $_smarty_tpl->tpl_vars['filterName']->value;?>
-"> Search
+ <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="text" id="filterName" class="listFilter" value="<?php echo $_smarty_tpl->tpl_vars['filterName']->value;?>
+"> Search</span>
</form>
<h2>List of Members</h2>
<th>Member Name</th>
<th>Member Type</th>
<th>Date Created</th>
+ <th>Pending</th>
<th> </th>
</tr>
</thead>
<?php echo $_smarty_tpl->tpl_vars['m']->value['created']['date'];?>
</td>
+ <td>
+ <?php if ($_smarty_tpl->tpl_vars['m']->value['pending']>0) {?><span class="glm-notice">Pending</span><?php }?>
+ </td>
<td>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=glm-members-admin-menu-member&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-01 18:25:01
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-24 20:24:15
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 => 1422815090,
+ 1 => 1424809451,
2 => 'file',
),
),
'thisPage' => 0,
'memberID' => 0,
'thisAction' => 0,
+ 'memberInfoID' => 0,
'haveMember' => 0,
'haveMemberInfo' => 0,
),
<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;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='memberInfo') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Member Info</a>
+&id=<?php echo $_smarty_tpl->tpl_vars['memberInfoID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='memberInfo') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value||!$_smarty_tpl->tpl_vars['haveMemberInfo']->value) {?>disabled<?php }?>">Member Info</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=locations&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
$accommodationTypes = false;
$error = false;
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
-
- $accommodationTypes = $this->insertEntry();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' New Entry Added ', 'Process');
- }
+ // Check for accommodation type id
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
}
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['accommodationTypeID'])) {
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
- $id = $_REQUEST['accommodationTypeID']-0;
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
+ switch($_REQUEST['option']) {
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' Entry Deleted: id = '.$id, 'Process');
- }
+ case 'addNew':
+ $this->insertEntry();
+ break;
- }
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
- // Check if a accommodation type ID is supplied
- if (isset($_REQUEST['accommodationType_id'])) {
- // Make sure it's a number
- $accommodationTypeID = $_REQUEST['accommodationType_id']-0;
- }
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
- // Check for action option
- $option = false;
- if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
- $option = $_REQUEST['option'];
- }
+ }
-// Check for options
+ }
// Get a current list of accommodation types
$accommodationTypes = $this->getList();
$amenities = false;
$error = false;
+
$newAmenity = $this->newEntry();
+ // Check if a category ID is supplied
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
+
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
+
+ }
+
+ }
+
+
+/*
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($newAmenity, 'DataBlock', 'New Amenity Data');
}
if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
$option = $_REQUEST['option'];
}
+*/
// Get a current list of amenities
$amenities = $this->getList();
$categories = false;
$error = false;
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
-
- $categories = $this->insertEntry();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' New Entry Added ', 'Process');
- glmMembersAdmin::addNotice($categories, 'DataBlock', 'New Member Category Data');
- }
+ // Check if a category ID is supplied
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
}
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['categoryID'])) {
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
- $id = $_REQUEST['categoryID']-0;
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
+ switch($_REQUEST['option']) {
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' Entry Deleted: id = '.$id, 'Process');
- }
+ case 'addNew':
+ $this->insertEntry();
+ break;
- }
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
- // Check if a category ID is supplied
- if (isset($_REQUEST['category_id'])) {
- // Make sure it's a number
- $categoryID = $_REQUEST['category_id']-0;
- }
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
- // Check for action option
- $option = false;
- if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
- $option = $_REQUEST['option'];
- }
+ }
-// Check for options
+ }
- // Get a current list of members
+ // Get a current list of categories
$categories = $this->getList();
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
$cities = false;
$error = false;
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
- $cities = $this->insertEntry();
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' New Entry Added ', 'Process');
- }
+ // Check if a city ID is supplied
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
}
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['cityID'])) {
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
- $id = $_REQUEST['cityID']-0;
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
+ switch($_REQUEST['option']) {
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' Entry Deleted: id = '.$id, 'Process');
- }
+ case 'addNew':
+ $this->insertEntry();
+ break;
- }
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
- // Check if a city ID is supplied
- if (isset($_REQUEST['city_id'])) {
- // Make sure it's a number
- $cityID = $_REQUEST['city_id']-0;
- }
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
- // Check for action option
- $option = false;
- if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
- $option = $_REQUEST['option'];
- }
+ }
-// Check for options
+ }
// Get a current list of members
$cities = $this->getList();
$memberTypes = false;
$error = false;
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
- $memberData = $this->insertEntry();
+ // Check for member type id
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
}
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['memberTypeID'])) {
- $id = $_REQUEST['memberTypeID']-0;
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
- }
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
- // Check if a member ID is supplied
- if (isset($_REQUEST['member_id'])) {
- // Make sure it's a number
- $memberID = $_REQUEST['member_id']-0;
- }
+ switch($_REQUEST['option']) {
- // Check for action option
- $option = false;
- if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
- $option = $_REQUEST['option'];
- }
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
-// Check for options
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
+
+ }
+
+ }
- // Get a current list of members
+ // Get a current list of member types
$memberTypes = $this->getList();
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
$regions = false;
$error = false;
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
-
- $regions = $this->insertEntry();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' New Entry Added ', 'Process');
- }
+ // Check for region id
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
}
- if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['regionID'])) {
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
- $id = $_REQUEST['regionID']-0;
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
+ switch($_REQUEST['option']) {
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' Entry Deleted: id = '.$id, 'Process');
- }
+ case 'addNew':
+ $this->insertEntry();
+ break;
- }
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
- // Check if a region ID is supplied
- if (isset($_REQUEST['region_id'])) {
- // Make sure it's a number
- $regionID = $_REQUEST['region_id']-0;
- }
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
- // Check for action option
- $option = false;
- if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
- $option = $_REQUEST['option'];
- }
+ }
-// Check for options
+ }
// Get a current list of members
$regions = $this->getList();
glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data');
}
+ // Check if there's a request to delete a specific member information record
+ if (isset($_REQUEST['deleteID']) && $_REQUEST['deleteID'] != '') {
+
+ // Make sure ID is a number
+ $delID = $_REQUEST['deleteID']-0;
+
+ // Make sure it's positive integer
+ if ($delID > 0 && is_int($delID)) {
+
+ // Delete the selected record
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ SET status = ".$this->config['status_numb']['Archived']."
+ WHERE id = $delID
+ ;";
+ $this->wpdb->query($sql);
+
+ }
+ }
+
+ // Check if there's a request to activate a specific member information record
+ if (isset($_REQUEST['activateID']) && $_REQUEST['activateID'] != '') {
+
+ $activateID = $_REQUEST['activateID']-0;
+
+ // If the ID is sane, try to activate this recored
+ if ($activateID > 0) {
+
+ // Make sure we have a good ID
+ $sql = "
+ SELECT id
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ WHERE id = $activateID
+ ;";
+ $idTest = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // If we do, then activate it
+ if($idTest != null) {
+
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ SET status = ".$this->config['status_numb']['Inactive']."
+ WHERE status = ".$this->config['status_numb']['Active']."
+ ;";
+ $this->wpdb->query($sql);
+
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ SET status = ".$this->config['status_numb']['Active']."
+ WHERE id = $activateID
+ ;";
+ $this->wpdb->query($sql);
+
+ }
+
+
+ }
+ }
+
+
// If we have a member then also get a list of member info records
$haveInfoRecords = false;
$memberInfoRecords = false;
+ $noActive = false;
+ $showArchived = false;
if ($haveMember) {
+
+ // Hide archived unless instructed otherwise
+ $hideArchived = '';
+ if (!isset($_REQUEST['showArchived']) || $_REQUEST['showArchived'] != 'true') {
+ $hideArchived = " && T.status != ".$this->config['status_numb']['Archived'];
+ } else {
+ $showArchived = true;
+ }
+
require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
$MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
- $memberInfoRecords = $MemberInfo->getList($memberID);
+ $memberInfoRecords = $MemberInfo->getList("T.member = $memberID".$hideArchived, 'T.status');
- // Check if any members returned
+ // Check if there's any member information records
if (is_array($memberInfoRecords) && count($memberInfoRecords) > 0) {
$haveInfoRecords = true;
}
+
+ // Determine if there are any active info records for this member
+ $sql = "
+ SELECT count(id) as numbActive
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ WHERE status = ".$this->config['status_numb']['Active']."
+ ;";
+ $activeTest = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // If count is 0 then there are no active info records
+ if ($activeTest['numbActive'] == 0) {
+ $noActive = true;
+ }
+
}
// Compile template data
'member' => $memberData,
'haveInfoRecords' => $haveInfoRecords,
'memberInfoRecords' => $memberInfoRecords,
+ 'noActive' => $noActive,
+ 'showArchived' => $showArchived,
'haveMemberInfo' => $haveMemberInfo,
- 'updated' => $updated
+ 'updated' => $updated,
+ 'statusPending' => $this->config['status_numb']['Pending']
);
// Return status, suggested view, and data to controller
*/
public function modelAction ($redirectData = false)
{
-
+ // Set some default values
$success = true;
$memberID = 0;
$haveMember = false;
$memberInfoID = 0;
$haveMemberInfo = false;
+ $isActive = false;
+ $noActive = false;
$categories = false;
$haveCategories = false;
$regions = false;
$haveRegions = false;
$error = false;
- // Get sorted list of categories
- require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
- $Categories = new GlmDataCategories($this->wpdb, $this->config);
- $categories = $Categories->getList();
- if (is_array($categories) && count($categories) > 0) {
-
- // Sort results by higherarchy (Parent/Child and Alpha)
- $categories = glmMembersAdmin::sortParentChild($categories);
- $haveCategories = true;
-
- }
-
- // Check for action option
+ // Check for action option - Should be one of the values in the "switch" statement below
$option = false;
if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
$option = $_REQUEST['option'];
}
- // Get supplied member ID
+ // If a member ID is supplied, get that and make sure it's a valid integer
if (isset($_REQUEST['member'])) {
$memberID = $_REQUEST['member']-0;
}
- // If member ID not supplied - we shouldn't be here
+ // If member ID not supplied - we shouldn't be here, so redirect to an error page
if ($memberID <= 0) {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
$Members = new GlmDataMembers($this->wpdb, $this->config);
$memberData = $Members->getEntry($memberID);
+ $this->fields['logo']['i_prefix'] = 'memb_'.$memberID.'_';
$haveMember = true;
}
- // Get member info record ID
- if (isset($_REQUEST['member_info_id'])) {
- $memberInfoID = $_REQUEST['member_info_id']-0;
+ // If a member info record ID is supplied, get that and make sure it's an integer
+ if (isset($_REQUEST['id'])) {
+ $memberInfoID = $_REQUEST['id']-0;
$haveMemberInfo = true;
+
+ // Determine if this is the active record
+ $sql = "
+ SELECT status
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ WHERE id = $memberInfoID
+ ;";
+ $activeTest = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // If it is, then save that
+ if ($activeTest['status'] == $this->config['status_numb']['Active']) {
+ $isActive = true;
+ }
+
}
- // If no member info record, assume that we need to create the first record
+ // If no member info record, assume that we need to create a new one
if ($memberInfoID <= 0 && $option != 'addNew') {
$option = 'create';
}
glmMembersAdmin::addNotice("<b> Option specified:</b> $option", 'Process');
}
- // Perform requested option
+ /*
+ * Perform requested action
+ */
switch ($option) {
- case 'new':
+ // Setup to input a nnew member information record
+ case 'create':
$MemberInfo = $this->newEntry();
break;
+ // Process submission of a member information record update
case 'submit':
if ($haveMemberInfo) {
- // Update the member data
- $MemberInfo = $this->updateEntry($memberID);
+
+ // Update the member Info data
+ $MemberInfo = $this->updateEntry($memberInfoID);
+
+ break;
+ } else {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
glmMembersAdmin::addNotice("<b> No member information exists, assuming this is a new submission.", 'Process');
}
- break;
+ // Note that if we don't have an existing member info record, we fall through to "addNew" below.
+
}
+ // Add the new member information record
case 'addNew':
// Insert the new member into the database
$MemberInfo = $this->insertEntry();
+ if ($MemberInfo['status']) {
+ $memberInfoID = $MemberInfo['fieldData']['id'];
+ $haveMemberInfo = true;
+ }
break;
- case 'create':
-
- $MemberInfo = $this->newEntry();
-
- break;
-
+ // Default is to display the currently selected member information record in a form for updates
default:
// Edit the existing member
- $MemberInfo = $this->getEntry($memberInfoID);
+ $MemberInfo = $this->editEntry($memberInfoID);
// If we have member data, say so
if (is_array($MemberInfo) && $MemberInfo['status']) {
+
$haveMemberInfo = true;
// Otherwise
break;
+ }
+
+ // If we have a member ID and this was a submission with a new city (id < 0)
+ if ($memberInfoID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') {
+ // Clean up city name
+ $cName = trim(filter_var($_REQUEST['newCityName']));
+
+ // Try to add the city
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
+ $Cities = new GlmDataCities($this->wpdb, $this->config);
+ $cID = $Cities->addCity($cName);
+
+ // If we got a city id back
+ if (is_int($cID) && $cID > 0) {
+
+ // Update the city selected for this memberInfo record
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ SET city = $cID
+ WHERE id = $memberInfoID
+ ;";
+ $this->wpdb->query($sql);
+
+ // Get updated member information for editing.
+ $MemberInfo = $this->editEntry($memberInfoID);
+ }
}
}
+ /*
+ * Get a sorted list of categories.
+ * These will be sorted so sub-categories fall under their
+ * respective category.
+ */
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+ $Categories = new GlmDataCategories($this->wpdb, $this->config);
+ $categories = $Categories->getListSortedParentChild();
+ if (is_array($categories) && count($categories) > 0) {
+ $haveCategories = true;
+ }
+
+ // Lastly, if we have member info, and if this record is active, we need to check for other active records and other things
+ $categoryMemberInfo = false;
+ if ($haveMemberInfo) {
+
+// *** Need to Modularize this
+
+ // 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 the current record is now active and wasn't before
+ if ($activeTest['status'] == $this->config['status_numb']['Active'] && !$isActive) {
+
+ // Change any others for this member to inactive
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ SET status = ".$this->config['status_numb']['Inactive']."
+ WHERE status = ".$this->config['status_numb']['Active']."
+ AND id != $memberInfoID
+ ;";
+ $this->wpdb->query($sql);
+
+ }
+
+ // Instatiate categoryMemberInfo class
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php');
+ $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config);
+
+ // Get any selected categories
+ $selectedCategories = array();
+ $newCategory = false;
+ if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) {
+
+ /*
+ * For each selected category
+ *
+ * Note that categories are submitted with either a positive key, which indicates
+ * that it represents an existing category, or a negative key, which indicates
+ * that the user is trying to add it to the list of categories.
+ *
+ */
+ foreach ($_REQUEST['category'] as $key) {
+
+ // Make sure key is an integer
+ $key = intval($key -0);
+
+ // If negative, this is a new category that needs to be added to the category table
+ if ($key < 0) {
+
+ $newCategory = true;
+
+ // Check if a parent is specied
+ $parent = 0;
+ if ($_REQUEST['newCatParent'][$key] != '') {
+ $parent = $_REQUEST['newCatParent'][$key] -0;
+ } elseif ($_REQUEST['newCatParentName'][$key]) {
+ $parent = $_REQUEST['newCatParentName'][$key];
+ }
+
+ // Clean up the category name
+ $category = filter_var($_REQUEST['newCategory'][$key]);
+
+ // Add it to the category table and get the new category ID
+ $categoryID = $Categories->addCategory($category, $parent);
+
+ // If we got a new category ID, ad it to the array of currently selected categoryMemberInfo records
+ if ($categoryID) {
+ $selectedCategories[$categoryID] = $categoryID;
+ }
+
+ // Otherwise if it's positive, the category is an existing one
+ } else if ($key > 0) {
+
+ $selectedCategories[$key] = $key;
+
+ }
+ // A zero index should never happen, but we ignore them anyway
+
+ // If there's selected categories
+ if (count($selectedCategories) > 0) {
+
+ // Update the selected categories for this member information record, returns new list
+ $categoryMemberInfo = $CategoryMemberInfo->setMemberInfoCategories($memberInfoID, $selectedCategories);
+
+ }
+
+ // If there's been a new category
+ if ($newCategory) {
+
+ // Get the full category list again
+ $categories = $Categories->getListSortedParentChild();
+
+ }
+
+ } // For each category being submitted
+
+ } // If there's any categories selected
+
+ // Now get the (possibly updated) category list for this member info record
+ $categoryMemberInfo = $CategoryMemberInfo->getListWithParents($memberInfoID);
+
+ } // Have member info
+
+ // If we have a member record
+ if ($haveMember) {
+
+ // Determine if there are any active info records for this member
+ $sql = "
+ SELECT count(id) as numbActive
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ WHERE status = ".$this->config['status_numb']['Active']."
+ ;";
+ $activeTest = $this->wpdb->get_row($sql, ARRAY_A);
+
+ // If count is 0 then there are no active info records
+ if ($activeTest['numbActive'] == 0) {
+ $noActive = true;
+ }
+
+ }
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($MemberInfo, 'DataBlock', 'Member Data');
}
'memberInfoID' => $memberInfoID,
'memberInfo' => $MemberInfo,
'haveCategories' => $haveCategories,
- 'categories' => $categories
+ 'categories' => $categories,
+ 'categoryMemberInfo' => $categoryMemberInfo,
+ 'noActive' => $noActive,
+ 'time' => time()
);
// Return status, suggested view, and data to controller
}
-?>
\ No newline at end of file
+?>
$filterName = false;
$haveFilter = false;
- // Check for list filters
- if (isset($_REQUEST['filterPending'])) {
- $where .= 'T.status = '.$this->config['status_numb']['Pending'];
- $filterStatus = true;
- $haveFilter = true;
- }
if (isset($_REQUEST['filterName'])) {
$filterName = $_REQUEST['filterName'];
$where .= "T.name like '%$filterName%'";
// Get a current list of members
$list = $this->getList($where);
+ /*
+ * Check for list filters
+ *
+ * Note that since the pointer processing in the data abstract takes place after the
+ * query of the table data, and that the pending value is actually a sum() of the
+ * id field values for member_info table generated using the pointer p_sum options,
+ * we can't use a common where clause to select it.
+ */
+ if (isset($_REQUEST['filterPending'])) {
+
+ foreach($list as $k => $v) {
+ if ($v['pending'] == 0) {
+ unset($list[$k]);
+ }
+ }
+
+ $filterStatus = true;
+ $haveFilter = true;
+ }
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data');
}
{include file='admin/configure/header.html'}
+ <!-- Add Accommodation Type Button and Dialog Box -->
<div id="newAccommodationTypeButton" class="button-primary glm-right">Add a Accommodation Type</div>
<div id="newAccommodationTypeDialog" class="glm-dialog-box" title="Enter a New Accommodation Type">
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="accommodationTypes">
<input type="hidden" name="option" value="addNew">
-
<table class="glm-admin-table">
<tr>
<th class="glm-required">Accommodation Type Name:</th>
<input type="text" name="short_descr" class="glm-form-text-input">
</td>
</tr>
-
-
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newAccommodationTypeCancel" class="button-primary glm-right">Cancel</a>
<input type="submit" value="Add new Accommodation Type">
-
</form>
</div>
+
+ <!-- Delete Accommodation Type Button -->
<div id="deleteAccommodationTypeDialog" class="glm-dialog-box" title="Delete Accommodation Type">
<center>
<p>Are you sure you want to delete this accommodation type?</p>
<p><div id="deleteAccommodationTypeConfirm" class="button-primary">Yes, delete this accommodation type</div></p>
- <p><div id="deleteAccommodationTypeCancel" class="button-primary">No, I don't want to delete this accommodation</div></p>
+ <p><div id="deleteAccommodationTypeCancel" class="button-primary">Cancel</div></p>
</center>
</div>
-
+
+ <!-- Edit Accommodation Type Dialog Box -->
+ <div id="editAccommodationTypeDialog" class="glm-dialog-box" title="Enter a New Accommodation Type">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="accommodationTypes">
+ <input type="hidden" name="option" value="update">
+ <input id="editAccommodationTypeID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Accommodation Type Name:</th>
+ <td>
+ <input id="editAccommodationTypeName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editAccommodationTypeDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input id="editAccommodationTypeShortDescr" type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editAccommodationTypeCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Accommodation Type">
+ </form>
+ </div>
<h2>Accommodation Types</h2>
<tr class="alternate">
{/if}
<td>
- {$t.name}
+ <a class="editAccommodationType" data-accommodationTypeID="{$t.id}">{$t.name}</a>
</td>
- <td>
+ <td id="editAccommodationTypeDescr_{$t.id}">
{$t.descr}
</td>
- <td>
+ <td id="editAccommodationTypeShortDescr_{$t.id}">
{$t.short_descr}
</td>
<td>
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
+ $("#editAccommodationTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
$("#deleteAccommodationTypeDialog").dialog({
autoOpen: false,
minWidth: 400,
$('#newAccommodationTypeButton').click( function() {
$("#newAccommodationTypeDialog").dialog("open");
});
+ $('.editAccommodationType').click( function() {
+ var accommodationTypeID = $(this).attr('data-accommodationTypeID');
+ var accommodationTypeName = $(this).text();
+ var accommodationTypeDescr = $('#editAccommodationTypeDescr_' + accommodationTypeID).html();
+ var accommodationTypeShortDescr = $('#editAccommodationTypeShortDescr_' + accommodationTypeID).html();
+ $('#editAccommodationTypeID').val(accommodationTypeID);
+ $('#editAccommodationTypeName').val(accommodationTypeName.trim());
+ $('#editAccommodationTypeDescr').val(accommodationTypeDescr.trim());
+ $('#editAccommodationTypeShortDescr').val(accommodationTypeShortDescr.trim());
+ $("#editAccommodationTypeDialog").dialog("open");
+ });
+ $('#editAccommodationTypeCancel').click( function() {
+ $("#editAccommodationTypeDialog").dialog("close");
+ });
$('#newAccommodationTypeCancel').click( function() {
$("#newAccommodationTypeDialog").dialog("close");
});
});
$('#deleteAccommodationTypeConfirm').click( function() {
$("#deleteAccommodationTypeDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=accommodationTypes&option=delete&accommodationTypeID=" + id;
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=accommodationTypes&option=delete&id=" + id;
});
$('#deleteAccommodationTypeCancel').click( function() {
$("#deleteAccommodationTypeDialog").dialog("close");
{include file='admin/configure/header.html'}
+ <!-- Add Amenities Button and Dialog Box -->
<div id="newAmenityButton" class="button-primary glm-right">Add a Amenity</div>
<div id="newAmenityDialog" class="glm-dialog-box" title="Enter a New Amenity">
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="amenities">
<input type="hidden" name="option" value="addNew">
-
<table class="glm-admin-table">
<tr>
<th class="glm-required">Amenity Name:</th>
<input type="text" name="short_descr" class="glm-form-text-input">
</td>
</tr>
-
-
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newAmenityCancel" class="button-primary glm-right">Cancel</a>
</form>
</div>
+
+ <!-- Delete Amenities Button -->
<div id="deleteAmenityDialog" class="glm-dialog-box" title="Delete Amenity">
<center>
<p>Are you sure you want to delete this accommodation type?</p>
<p><div id="deleteAmenityConfirm" class="button-primary">Yes, delete this accommodation type</div></p>
- <p><div id="deleteAmenityCancel" class="button-primary">No, I don't want to delete this accommodation</div></p>
+ <p><div id="deleteAmenityCancel" class="button-primary">Cancel</div></p>
</center>
</div>
+
+ <!-- Edit Amenities Dialog Box -->
+ <div id="editAmenityDialog" class="glm-dialog-box" title="Edit this Amenity">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="amenities">
+ <input type="hidden" name="option" value="update">
+ <input id="editAmenityID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Amenity Name:</th>
+ <td>
+ <input id="editAmenityName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th class="glm-required">Facility Type:</th>
+ <td>
+ <select id="editAmenityFacility" name="facility_type">
+ <option value=""></option>
+ {foreach from=$newAmenity.fieldData.facility_type.list item=v}
+ <option value="{$v.value}">{$v.name}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Uses a value:</th>
+ <td><input id="editAmenityUsesValue" type="checkbox" name="uses_value"></td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editAmenityDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input id="editAmenityShortDescr" type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editAmenityCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Amenity">
+
+ </form>
+ </div>
<h2>Amenities</h2>
<tr class="alternate">
{/if}
<td>
- {$t.name}
+ <a class="editAmenity" data-amenityID="{$t.id}" data-facilityTypeID="{$t.facility_type.value}" data-amenityUsesValue="{$t.uses_value.value}">{$t.name}</a>
</td>
- <td>
+ <td id="editAmenityFacilityType_{$t.id}">
{$t.facility_type.name}
</td>
- <td>
+ <td id="editAmenityUsesValue_{$t.id}" >
{$t.uses_value.name}
</td>
- <td>
+ <td id="editAmenityDescr_{$t.id}">
{$t.descr}
</td>
- <td>
+ <td id="editAmenityShortDescr_{$t.id}">
{$t.short_descr}
</td>
<td>
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
+ $("#editAmenityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
$("#deleteAmenityDialog").dialog({
autoOpen: false,
minWidth: 400,
$('#newAmenityButton').click( function() {
$("#newAmenityDialog").dialog("open");
});
+ $('.editAmenity').click( function() {
+ var amenityID = $(this).attr('data-amenityID');
+ var amenityName = $(this).text();
+ var amenityFacilityTypeID = $(this).attr('data-facilityTypeID');
+ var amenityUsesValue = parseInt($(this).attr('data-amenityUsesValue'));
+ var amenityDescr = $('#editAmenityDescr_' + amenityID).html();
+ var amenityShortDescr = $('#editAmenityShortDescr_' + amenityID).html();
+ $('#editAmenityID').val(amenityID);
+ $('#editAmenityName').val(amenityName.trim());
+ $('#editAmenityFacility').val(amenityFacilityTypeID);
+ $('#editAmenityUsesValue').prop('checked', amenityUsesValue);
+ $('#editAmenityDescr').val(amenityDescr.trim());
+ $('#editAmenityShortDescr').val(amenityShortDescr.trim());
+ $("#editAmenityDialog").dialog("open");
+ });
+ $('#editAmenityCancel').click( function() {
+ $("#editAmenityDialog").dialog("close");
+ });
$('#newAmenityCancel').click( function() {
$("#newAmenityDialog").dialog("close");
});
});
$('#deleteAmenityConfirm').click( function() {
$("#deleteAmenityDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=amenities&option=delete&amenityID=" + id;
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=amenities&option=delete&id=" + id;
});
$('#deleteAmenityCancel').click( function() {
$("#deleteAmenityDialog").dialog("close");
{include file='admin/configure/header.html'}
+ <!-- Add Categories Button and Dialog Box -->
<div id="newCategoryButton" class="button-primary glm-right">Add a Category</div>
<div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
{/foreach}
{/if}
</select>
-
</td>
</tr>
<tr>
</td>
</tr>
<tr>
- <th>Description:</th>
+ <th>Short Description:</th>
<td>
<input type="text" name="short_descr" class="glm-form-text-input">
</td>
</tr>
-
-
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newCategoryCancel" class="button-primary glm-right">Cancel</a>
<input type="submit" value="Add new Category">
-
</form>
</div>
+
+ <!-- Delete Category Button and Dialog Box -->
<div id="deleteCategoryDialog" class="glm-dialog-box" title="Delete Category">
<center>
<p>Are you sure you want to delete this category?</p>
<p><div id="deleteCategoryConfirm" class="button-primary">Yes, delete this category</div></p>
- <p><div id="deleteCategoryCancel" class="button-primary">No, I don't want to delete this category</div></p>
+ <p><div id="deleteCategoryCancel" class="button-primary">Cancel</div></p>
</center>
</div>
-
+
+ <!-- Edit Category Dialog Box -->
+ <div id="editCategoryDialog" class="glm-dialog-box" title="Edit this Category">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="categories">
+ <input type="hidden" name="option" value="update">
+ <input id="editCategoryID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Category Name:</th>
+ <td>
+ <input id="editCategoryName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Parent Category:</th>
+ <td>
+ <select id="editCategoryParent" name="parent">
+ <option value=""></option>
+ {if $haveCategories}
+ {foreach $categories as $t}
+ {if !$t.parent.value} <!-- don't show child categories -->
+ <option value="{$t.id}">{$t.name}</option>
+ {/if}
+ {/foreach}
+ {/if}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editCategoryDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input id="editCategoryShortDescr" type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editCategoryCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Category">
+ </form>
+ </div>
<h2>Categories</h2>
{/if}
<td>
<span{if $t.parent.value} class="glm-indent"{/if}>
- {$t.name}
+ <a class="editCategory" data-categoryID="{$t.id}" data-categoryParent="{$t.parent.value}">{$t.name}</a>
</span>
</td>
- <td>
+ <td id="editCategoryDescr_{$t.id}">
{$t.descr}
</td>
- <td>
+ <td id="editCategoryShortDescr_{$t.id}">
{$t.short_descr}
</td>
<td>
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
+ $("#editCategoryDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
$("#deleteCategoryDialog").dialog({
autoOpen: false,
minWidth: 400,
$('#newCategoryButton').click( function() {
$("#newCategoryDialog").dialog("open");
});
+ $('.editCategory').click( function() {
+ var catID = $(this).attr('data-categoryID');
+ var catName = $(this).text();
+ var catParent = $(this).attr('data-categoryParent');
+ var catDescr = $('#editCategoryDescr_' + catID).html();
+ var catShortDescr = $('#editCategoryShortDescr_' + catID).html();
+ $('#editCategoryID').val(catID);
+ $('#editCategoryName').val(catName.trim());
+ $('#editCategoryParent').val(catParent);
+ $('#editCategoryDescr').val(catDescr.trim());
+ $('#editCategoryShortDescr').val(catShortDescr.trim());
+ $("#editCategoryDialog").dialog("open");
+ });
+ $('#editCategoryCancel').click( function() {
+ $("#editCategoryDialog").dialog("close");
+ });
$('#newCategoryCancel').click( function() {
$("#newCategoryDialog").dialog("close");
});
});
$('#deleteCategoryConfirm').click( function() {
$("#deleteCategoryDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=categories&option=delete&categoryID=" + id;
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=categories&option=delete&id=" + id;
});
$('#deleteCategoryCancel').click( function() {
$("#deleteCategoryDialog").dialog("close");
{include file='admin/configure/header.html'}
+ <!-- Add City Button and Dialog Box -->
<div id="newCityButton" class="button-primary glm-right">Add a City</div>
<div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="cities">
<input type="hidden" name="option" value="addNew">
-
<table class="glm-admin-table">
<tr>
<th class="glm-required">City Name:</th>
<input type="text" name="name" class="glm-form-text-input">
</td>
</tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
-
-
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newCityCancel" class="button-primary glm-right">Cancel</a>
<input type="submit" value="Add new City">
-
</form>
</div>
+
+ <!-- Delete City Dialog Box -->
<div id="deleteCityDialog" class="glm-dialog-box" title="Delete City">
<center>
<p>Are you sure you want to delete this city?</p>
<p><div id="deleteCityConfirm" class="button-primary">Yes, delete this city</div></p>
- <p><div id="deleteCityCancel" class="button-primary">No, I don't want to delete this city</div></p>
+ <p><div id="deleteCityCancel" class="button-primary">Cancel</div></p>
</center>
</div>
-
+
+ <!-- Edit City Dialog Box -->
+ <div id="editCityDialog" class="glm-dialog-box" title="Edit this City">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="cities">
+ <input type="hidden" name="option" value="update">
+ <input id="editCityID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">City Name:</th>
+ <td>
+ <input id="editCityName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newCityCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this City">
+ </form>
+ </div>
<h2>Cities</h2>
<tr class="alternate">
{/if}
<td>
- {$t.name}
+ <a class="editCity" data-cityID="{$t.id}">{$t.name}</a>
</td>
<td>
<div class="deleteCityButton button-primary glm-right" data-cityID="{$t.id}">Delete</div>
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
+ $("#editCityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
$("#deleteCityDialog").dialog({
autoOpen: false,
minWidth: 400,
$('#newCityCancel').click( function() {
$("#newCityDialog").dialog("close");
});
+ $('.editCity').click( function() {
+ var cityID = $(this).attr('data-cityID');
+ var cityName = $(this).text();
+ $('#editCityID').val(cityID);
+ $('#editCityName').val(cityName.trim());
+ $("#editCityDialog").dialog("open");
+ });
+ $('#editCityCancel').click( function() {
+ $("#editCityDialog").dialog("close");
+ });
var id = false;
$('.deleteCityButton').click( function() {
});
$('#deleteCityConfirm').click( function() {
$("#deleteCityDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=delete&cityID=" + id;
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=delete&id=" + id;
});
$('#deleteCityCancel').click( function() {
$("#deleteCityDialog").dialog("close");
{include file='admin/configure/header.html'}
- <div id="newMemberTypeButton" class="button-primary glm-right">Add a Member Type</div>
+ <!-- Add Member Type Button and Dialog Box -->
+ <div id="newMemberTypeButton" class="button-primary glm-right">Add a Member Type</div>
<div id="newMemberTypeDialog" class="glm-dialog-box" title="Enter New Member Type">
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="memberTypes">
<textarea name="descr" class="glm-form-textarea"></textarea>
</td>
</tr>
-
-
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newMemberTypeCancel" class="button-primary glm-right">Cancel</a>
<input type="submit" value="Add new member type">
-
</form>
</div>
+
+ <!-- Delete Member Dialog Box -->
<div id="deleteMemberTypeDialog" class="glm-dialog-box" title="Delete Member Type">
<center>
<p>Are you sure you want to delete this member type?</p>
<p><div id="deleteMemberTypeConfirm" class="button-primary">Yes, delete this member type</div></p>
- <p><div id="deleteMemberTypeCancel" class="button-primary">No, I don't want to delete this member type</div></p>
+ <p><div id="deleteMemberTypeCancel" class="button-primary">Cancel</div></p>
</center>
</div>
+ <!-- Edit Member Type Dialog Box -->
+ <div id="editMemberTypeDialog" class="glm-dialog-box" title="Edit Member Type">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="memberTypes">
+ <input type="hidden" name="option" value="update">
+ <input id="editMemberTypeID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Member Type Name:</th>
+ <td>
+ <input id="editMemberTypeName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editMemberTypeDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editMemberTypeCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this member type">
+ </form>
+ </div>
<h2>Member Types</h2>
<tr class="alternate">
{/if}
<td>
- {$t.name}
+ <a class="editMemberType" data-memberTypeID="{$t.id}">{$t.name}</a>
</td>
- <td>
+ <td id="editMemberTypeDescr_{$t.id}">
{$t.descr}
</td>
<td>
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
+ $("#editMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
$("#deleteMemberTypeDialog").dialog({
autoOpen: false,
minWidth: 400,
$('#newMemberTypeButton').click( function() {
$("#newMemberTypeDialog").dialog("open");
});
+ $('.editMemberType').click( function() {
+ var typeID = $(this).attr('data-memberTypeID');
+ var typeName = $(this).text();
+ var typeDescr = $('#editMemberTypeDescr_' + typeID).html();
+ $('#editMemberTypeID').val(typeID);
+ $('#editMemberTypeName').val(typeName.trim());
+ $('#editMemberTypeDescr').val(typeDescr.trim());
+ $("#editMemberTypeDialog").dialog("open");
+ });
+ $('#editMemberTypeCancel').click( function() {
+ $("#editMemberTypeDialog").dialog("close");
+ });
$('#newMemberTypeCancel').click( function() {
$("#newMemberTypeDialog").dialog("close");
});
});
$('#deleteMemberTypeConfirm').click( function() {
$("#deleteMemberTypeDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=memberTypes&option=delete&memberTypeID=" + id;
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=memberTypes&option=delete&id=" + id;
});
$('#deleteMemberTypeCancel').click( function() {
$("#deleteMemberTypeDialog").dialog("close");
{include file='admin/configure/header.html'}
+ <!-- Add Regions Button and Dialog Box -->
<div id="newRegionButton" class="button-primary glm-right">Add a Region</div>
<div id="newRegionDialog" class="glm-dialog-box" title="Enter a New Region">
<form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="regions">
<input type="hidden" name="option" value="addNew">
-
<table class="glm-admin-table">
<tr>
<th class="glm-required">Region Name:</th>
</td>
</tr>
<tr>
- <th>Description:</th>
+ <th>Short Description:</th>
<td>
<input type="text" name="short_descr" class="glm-form-text-input">
</td>
</tr>
-
-
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newRegionCancel" class="button-primary glm-right">Cancel</a>
<input type="submit" value="Add new Region">
-
</form>
</div>
+
+ <!-- Add Regions Button -->
<div id="deleteRegionDialog" class="glm-dialog-box" title="Delete Region">
<center>
<p>Are you sure you want to delete this region?</p>
<p><div id="deleteRegionConfirm" class="button-primary">Yes, delete this region</div></p>
- <p><div id="deleteRegionCancel" class="button-primary">No, I don't want to delete this region</div></p>
+ <p><div id="deleteRegionCancel" class="button-primary">Cancel</div></p>
</center>
</div>
-
+
+ <!-- Edit Regions Dialog Box -->
+ <div id="editRegionDialog" class="glm-dialog-box" title="Edit this Region">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="regions">
+ <input type="hidden" name="option" value="update">
+ <input id="editRegionID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Region Name:</th>
+ <td>
+ <input id="editRegionName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editRegionDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th>Short Description:</th>
+ <td>
+ <input id="editRegionShortDescr" type="text" name="short_descr" class="glm-form-text-input">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editRegionCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Region">
+ </form>
+ </div>
<h2>Regions</h2>
<tr class="alternate">
{/if}
<td>
- {$t.name}
+ <a class="editRegion" data-regionID="{$t.id}">{$t.name}</a>
</td>
- <td>
+ <td id="editRegionDescr_{$t.id}">
{$t.descr}
</td>
- <td>
+ <td id="editRegionShortDescr_{$t.id}">
{$t.short_descr}
</td>
<td>
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
+ $("#editRegionDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
$("#deleteRegionDialog").dialog({
autoOpen: false,
minWidth: 400,
$('#newRegionButton').click( function() {
$("#newRegionDialog").dialog("open");
});
+ $('.editRegion').click( function() {
+ var regionID = $(this).attr('data-regionID');
+ var regionName = $(this).text();
+ var regionDescr = $('#editRegionDescr_' + regionID).html();
+ var regionShortDescr = $('#editRegionShortDescr_' + regionID).html();
+ $('#editRegionID').val(regionID);
+ $('#editRegionName').val(regionName.trim());
+ $('#editRegionDescr').val(regionDescr.trim());
+ $('#editRegionShortDescr').val(regionShortDescr.trim());
+ $("#editRegionDialog").dialog("open");
+ });
+ $('#editRegionCancel').click( function() {
+ $("#editRegionDialog").dialog("close");
+ });
$('#newRegionCancel').click( function() {
$("#newRegionDialog").dialog("close");
});
});
$('#deleteRegionConfirm').click( function() {
$("#deleteRegionDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=delete®ionID=" + id;
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=delete&id=" + id;
});
$('#deleteRegionCancel').click( function() {
$("#deleteRegionDialog").dialog("close");
<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=memberInfo&member={$memberID}" class="nav-tab{if $thisAction==memberInfo}-active{/if} {if !$haveMember}disabled{/if}">Member Info</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=attractions&member={$memberID}" class="nav-tab{if $thisAction==attractions}-active{/if} {if !$haveMember || !$haveMemberInfo}disabled{/if}">Attractions</a>
<input type="submit" value="Add new member">
{/if}
</form>
+
+ <p> </p>
{if $haveMember}
{if $haveInfoRecords}
+
+ <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>
+
+ {if $noActive}
+ <h3 class="glm-error">There is no active information for this member.</h3>
+ {/if}
+
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
- <th>Access:</th>
+ <th>Access</th>
<th>Created</th>
<th>Last Update</th>
+ <th>Reference Name</th>
+ <th> </th>
</tr>
</thead>
<tbody>
{if $i++ is odd by 1}
<tr>
{else}
- <tr class="alternate">
+ <tr class="alternate{if $m.status.name == 'Active'} glm-admin-table-active{/if}">
{/if}
- <td>{$m.status.name}</td>
- <td>{$m.create_time.time}</td>
- <td>{$m.modify_time.time}</td>
+ <td><a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&id={$m.id}"{if $m.status.value == $statusPending} class="glm-notice"{/if}>{$m.status.name}</a></td>
+ <td>{$m.create_time.datetime}</td>
+ <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}
+ </td>
</tr>
{/foreach}
</tbody>
<td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
{/if}
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $('#showArchived').click( function() {
+ checked = 'false';
+ if ($(this).attr('checked') == 'checked') {
+ checked = 'true';
+ }
+ window.location.replace("{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&showArchived=" + checked);
+ });
+
+ });
+ </script>
+
{include file='admin/footer.html'}
{include file='admin/member/header.html'}
+
+ <script src="http://maps.googleapis.com/maps/api/js?sensor=true&key={$googleMapsBrowserApiKey}"></script>
{if $haveMemberInfo}
+ <!-- Delete Member Information dialog -->
+ <div id="deleteMemberInfoButton" class="button-primary glm-right">Archive this Member Information</div>
+ <div id="deleteMemberInfoDialog" class="glm-dialog-box" title="Delete Member Information">
+ <center>
+ <p><a id="deleteMemberInfoCancel" class="button-primary">Cancel</a></p>
+ <p><input id="deleteMemberInfoSubmit" type="submit" value="Archive this Member Information record"></p>
+ </center>
+ <p>
+ NOTE: Archived member information records are not listed in the the member Dashboard by default but
+ may be shown using the "Show archived information" checkbox on that page.
+ </p>
+
+ </div>
+
<h2>Edit Member Information</h2>
{else}
<h2>Add New Member Information</h2>
<input type="hidden" name="member" value="{$member.id}">
{if $haveMemberInfo}
<input type="hidden" name="option" value="submit">
+ <input type="hidden" name="id" value="{$memberInfo.fieldData.id}">
+ <input type="hidden" name="modify_time" value="now">
{else}
<input type="hidden" name="option" value="addNew">
+ <input type="hidden" name="create_time" value="now">
{/if}
-
+
<table class="glm-admin-table">
<tr>
<th>Member Name:</th>
<th>Member Type:</th>
<td>{$member.member_type.name}</td>
</tr>
+ {if $haveMemberInfo}
<tr>
<th>Access:</th>
<td>{$member.access.name}</td>
- </tr>
+ </tr>
+ {/if}
+ {if $noActive}
+ <tr><td colspan="2"><h3 class="glm-error">You do not have any active information for this member.</h3></td></tr>
+ {/if}
<tr><td colspan="2"> </td></tr>
<tr>
- <th>Member Info Status:</th>
+ {if $haveMemberInfo}
+ <tr>
+ <th>Created:</th>
+ <td>{$memberInfo.fieldData.create_time.datetime}</td>
+ </tr>
+ <tr>
+ <th>Last Updated:</th>
+ <td>{$memberInfo.fieldData.modify_time.datetime}</td>
+ </tr>
+ {/if}
+ <th>Member Info Status:</th>
<td>
<select name="status">
{foreach from=$memberInfo.fieldData.status.list item=v}
</td>
</tr>
<tr>
- <th>Categories</th>
- <td class="glm-item-container">
- <!-- Add new category dialog -->
- <div id="newCategoryButton" class="button-primary glm-right">Add a new Category</div>
- <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Category Name:</th>
- <td id="newCatNameTD">
- <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
- <div id="newCatNameRequired"></div>
- </td>
- </tr>
- <tr>
- <th>Parent Category:</th>
- <td>
- <select id="newCatParent" name="newCatParent">
- <option value=""></option>
- {if $haveCategories}
- {foreach $categories as $t}
- {if !$t.parent.value} <!-- don't show child categories -->
- <option value="{$t.id}">{$t.name}</option>
- {/if}
- {/foreach}
- {/if}
- </select>
-
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newCategoryCancel" class="button-primary glm-right">Cancel</a>
- <input id="newCategorySubmit" type="submit" value="Add new Category">
- </div>
- <!-- Category Selection -->
- <select name="categorySelect" id="categorySelect">
- <option id="categoryNone" value=""></option>
- {foreach from=$categories item=v}
- <option value="{$v.id}">
- {if $v.parent.value} {/if}{$v.name}
- </option>
- {/foreach}
- </select> Select a category to add to box below.<br>
- <div id="activeCategories" class="glm-dynSelect-box">
- </div>
+ <td> </td>
+ <td>
+ <h3>Descriptions</h3>
</td>
</tr>
<tr>
- <tr>
- <th {if $memberInfo.fieldRequired.region}class="glm-required"{/if}>Region:</th>
- <td {if $memberInfo.fieldFail.region}class="glm-form-bad-input"{/if}>
- <select name="region">
- {foreach from=$memberInfo.fieldData.region.list item=v}
- <option value="{$v.id}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
- {/foreach}
- </select>
- {if $memberInfo.fieldFail.region}<p>{$memberInfo.fieldFail.region}</p>{/if}
+ <th {if $memberInfo.fieldRequired.reference_name}class="glm-required"{/if}>Reference Name:</th>
+ <td {if $memberInfo.fieldFail.reference_name}class="glm-form-bad-input"{/if}>
+ <input type="text" name="reference_name" value="{$memberInfo.fieldData.reference_name}" class="glm-form-text-input" placeholder="Name of this member information record for reference only. Not displayed to user.">
+ {if $memberInfo.fieldFail.reference_name}<p>{$memberInfo.fieldFail.reference_name}</p>{/if}
</td>
</tr>
- </tr>
<tr>
<th {if $memberInfo.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
<td {if $memberInfo.fieldFail.descr}class="glm-form-bad-input"{/if}>
- <textarea name="descr" class="glm-form-textarea">{$memberInfo.fieldData.descr}</textarea>
+ <textarea name="descr" class="glm-form-textarea" placeholder="General description of the member.">{$memberInfo.fieldData.descr}</textarea>
{if $memberInfo.fieldFail.descr}<p>{$memberInfo.fieldFail.descr}</p>{/if}
</td>
</tr>
<tr>
<th {if $memberInfo.fieldRequired.short_descr}class="glm-required"{/if}>Short Description:</th>
<td {if $memberInfo.fieldFail.short_descr}class="glm-form-bad-input"{/if}>
- <input type="text" name="short_descr" value="{$memberInfo.fieldData.short_descr}" class="glm-form-text-input">
+ <input type="text" name="short_descr" value="{$memberInfo.fieldData.short_descr}" class="glm-form-text-input" placeholder="A short, one line, description of the member.">
{if $memberInfo.fieldFail.short_descr}<p>{$memberInfo.fieldFail.short_descr}</p>{/if}
</td>
</tr>
+ <tr>
+ <td> </td>
+ <td>
+ <h3>Member Address</h3>
+ <p>The map below will display the likely location as you enter or edit the address.</p>
+ </td>
+ </tr>
<tr>
<th {if $memberInfo.fieldRequired.addr1}class="glm-required"{/if}>Address Line 1:</th>
<td {if $memberInfo.fieldFail.addr1}class="glm-form-bad-input"{/if}>
- <input type="text" id="addr1" name="addr1" value="{$memberInfo.fieldData.addr1}" class="glm-form-text-input">
+ <input type="text" id="addr1" name="addr1" value="{$memberInfo.fieldData.addr1}" class="glm-form-text-input glm-geocodeAction">
{if $memberInfo.fieldFail.addr1}<p>{$memberInfo.fieldFail.addr1}</p>{/if}
</td>
</tr>
<tr>
<th {if $memberInfo.fieldRequired.addr2}class="glm-required"{/if}>Address Line 2:</th>
<td {if $memberInfo.fieldFail.addr2}class="glm-form-bad-input"{/if}>
- <input type="text" name="addr2" value="{$memberInfo.fieldData.addr2}" class="glm-form-text-input">
+ <input id="addr2" type="text" name="addr2" value="{$memberInfo.fieldData.addr2}" class="glm-form-text-input glm-geocodeAction">
{if $memberInfo.fieldFail.addr2}<p>{$memberInfo.fieldFail.addr2}</p>{/if}
</td>
</tr>
<input id="newCitySubmit" type="submit" value="Add new City">
</div>
<!-- City Selection -->
- <select name="city" id="city">
+ <input id="cityName" type="hidden" name="newCityName" value=""><!-- this field is only used if adding a new city to pass the new name -->
+ <select name="city" id="city" class="glm-geocodeAction">
{foreach from=$memberInfo.fieldData.city.list item=v}
- <option value="{$v.value}">
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
{$v.name}
</option>
{/foreach}
<tr>
<th {if $memberInfo.fieldRequired.state}class="glm-required"{/if}>State:</th>
<td {if $memberInfo.fieldFail.state}class="glm-form-bad-input"{/if}>
- <select name="state">
+ <select id="state" name="state" class="glm-geocodeAction">
{foreach from=$memberInfo.fieldData.state.list item=v}
<option value="{$v.value}"{if $v.default} selected="selected"{/if}>
{$v.name}
{if $memberInfo.fieldFail.state}<p>{$memberInfo.fieldFail.state}</p>{/if}
</td>
</tr>
-
-
<tr>
<th {if $memberInfo.fieldRequired.zip}class="glm-required"{/if}>ZIP / Postal Code:</th>
<td {if $memberInfo.fieldFail.zip}class="glm-form-bad-input"{/if}>
- <input type="text" name="zip" value="{$memberInfo.fieldData.zip}" class="glm-form-text-input-short">
+ <input id="zip" type="text" name="zip" value="{$memberInfo.fieldData.zip}" class="glm-form-text-input-short glm-geocodeAction">
{if $memberInfo.fieldFail.zip}<p>{$memberInfo.fieldFail.zip}</p>{/if}
</td>
</tr>
-
-
<tr>
<th {if $memberInfo.fieldRequired.country}class="glm-required"{/if}>Country:</th>
<td {if $memberInfo.fieldFail.country}class="glm-form-bad-input"{/if}>
- <select name="country">
+ <select id="country" name="country" class="glm-geocodeAction">
{foreach from=$memberInfo.fieldData.country.list item=v}
<option value="{$v.value}"{if $v.default} selected="selected"{/if}>
- {$v.name}
+ {$v.name} {$v.value}
</option>
{/foreach}
</select>
<tr>
{if $memberInfo.fieldRequired.lat}<th class="emRequiredInputField">{else}<th>{/if}Location:</th>
<td>
- Latitude: <input name="lat" type="text" value="{$memberInfo.fieldData.zip}"><br>
- Longitude: <input name="lon" type="text" value="{$memberInfo.fieldData.zip}"><br>
- (Temporary till we get the auto locate map working)
-<!-- Not working yet
+ <input id="glmLat" name="lat" type="hidden" value="{$memberInfo.fieldData.lat}">
+ <input id="glmLng" name="lon" type="hidden" value="{$memberInfo.fieldData.lon}">
<div>
<input type="hidden" name="lat" id="lat" value="{$memberInfo.fieldData.lat}" class="emTextInputShort">
<input type="hidden" name="lon" id="lon" value="{$memberInfo.fieldData.lon}" class="emTextInputShort">
</div>
- <p>
- This map will try to find the new location whenever you change the address entered above.
- </p>
- <div id="locationMap" class="glm-map-edit">(map loads here)</div>
<p>
MAP USE: Drag the pointer to the desired location for this member.
Use + and - buttons or the mouse wheel to zoom in or out.
Click and drag anywhere else on the map to move to another area.
</p>
--->
+ <div id="locationMap" class="glm-map-edit">(map loads here)</div>
+ position: <span id="mapPosition">Lat {$memberInfo.fieldData.lat}, Lon {$memberInfo.fieldData.lon}</span>
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td>
+ <h3>Other Information</h3>
+ </td>
+ </tr>
+ <tr>
+ <th>Categories</th>
+ <td class="glm-item-container">
+ <!-- Add new category dialog -->
+ <div id="newCategoryButton" class="button-primary glm-right">Add a new Category</div>
+ <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Category Name:</th>
+ <td id="newCatNameTD">
+ <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
+ <div id="newCatNameRequired"></div>
+ </td>
+ </tr>
+ <tr>
+ <th>Parent Category:</th>
+ <td>
+ <select id="newCatParent" name="newCatParent">
+ <option value=""></option>
+ {if $haveCategories}
+ {foreach $categories as $t}
+ {if !$t.parent.value} <!-- don't show child categories -->
+ <option value="{$t.id}" data-parent="{$t.name}">{$t.name}</option>
+ {/if}
+ {/foreach}
+ {/if}
+ </select>
+ <br>OR<br>
+ <input id="newCatParentName" type="text" name="newCatParentName" placeholder="Enter a new parent name.">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newCategoryCancel" class="button-primary glm-right">Cancel</a>
+ <input id="newCategorySubmit" type="submit" value="Add new Category">
+ </div>
+ <!-- Category Selection -->
+ <select name="categorySelect" id="categorySelect">
+ <option id="categoryNone" value=""></option>
+ {foreach from=$categories item=v}
+ <option value="{$v.id}" data-parent="{$v.parent.name}">
+ {if $v.parent.value} {/if}{$v.name}
+ </option>
+ {/foreach}
+ </select> Select a category to add to box below.<br>
+ <div id="activeCategories" class="glm-dynSelect-box">
+ {if $categoryMemberInfo}
+ {foreach from=$categoryMemberInfo item=c}
+ <div data-id="{$c.category}" class="glm-dynSelect-item glm-members-catgegory">
+ {if $c.category_parent}{$c.parent_name}: {/if}{$c.category_name}
+ <span data-id="{$c.category}" class="glm-dynSelect-delete catDelete">X</span>
+ <input type="hidden" name="category[{$c.category}]" value="{$c.category}">
+ </div>
+ {/foreach}
+ {/if}
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <th {if $memberInfo.fieldRequired.region}class="glm-required"{/if}>Region:</th>
+ <td {if $memberInfo.fieldFail.region}class="glm-form-bad-input"{/if}>
+ <select name="region">
+ {foreach from=$memberInfo.fieldData.region.list item=v}
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
+ {/foreach}
+ </select>
+ {if $memberInfo.fieldFail.region}<p>{$memberInfo.fieldFail.region}</p>{/if}
</td>
</tr>
<tr>
<th {if $memberInfo.fieldRequired.phone}class="glm-required"{/if}>Phone #:</th>
<td {if $memberInfo.fieldFail.phone}class="glm-form-bad-input"{/if}>
- <input type="text" name="phone" value="{$memberInfo.fieldData.phone}" class="glm-form-text-input-short">
+ <input type="text" name="phone" value="{$memberInfo.fieldData.phone}" class="glm-form-text-input-short" placeholder="ex: 123-456-7890 ext 123">
{if $memberInfo.fieldFail.phone}<p>{$memberInfo.fieldFail.phone}</p>{/if}
</td>
</tr>
<tr>
<th {if $memberInfo.fieldRequired.toll_free}class="glm-required"{/if}>Toll Free #:</th>
<td {if $memberInfo.fieldFail.toll_free}class="glm-form-bad-input"{/if}>
- <input type="text" name="toll_free" value="{$memberInfo.fieldData.toll_free}" class="glm-form-text-input-short">
+ <input type="text" name="toll_free" value="{$memberInfo.fieldData.toll_free}" class="glm-form-text-input-short" placeholder="ex: 800-123-4567">
{if $memberInfo.fieldFail.toll_free}<p>{$memberInfo.fieldFail.toll_free}</p>{/if}
</td>
</tr>
<tr>
<th {if $memberInfo.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
<td {if $memberInfo.fieldFail.url}class="glm-form-bad-input"{/if}>
- <input type="text" name="url" value="{$memberInfo.fieldData.url}" class="glm-form-text-input-short"> (ex: http://www.gaslightmedia.com)
+ {if $memberInfo.fieldData.url}
+ <a class="button-primary glm-right" href="{$memberInfo.fieldData.url}" target="urlTarget">Test Link</a>
+ {/if}
+ <input type="text" name="url" value="{$memberInfo.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
{if $memberInfo.fieldFail.url}<p>{$memberInfo.fieldFail.url}</p>{/if}
</td>
</tr>
<th {if $memberInfo.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
<td {if $memberInfo.fieldFail.logo}class="glm-form-bad-input"{/if}>
{if $memberInfo.fieldData.logo}
- <img src=""> <input type="checkbox" name="logo_del"> Delete Image<br>
+
+ <!-- Add new category dialog -->
+ <div id="largeLogoDialog" class="glm-dialog-box" title="Large sized image">
+ <img src="{$glmPluginMediaURL}/images/large/{$memberInfo.fieldData.logo}">
+ <a id="largeLogoCancel" class="button-primary glm-right">Close</a><br>
+ </div>
+
+ <table class="glm-admin-image-edit-table">
+ <tr>
+ <td><img src="{$glmPluginMediaURL}/images/small/{$memberInfo.fieldData.logo}"></td>
+ <td>
+ <input type="checkbox" name="logo_delete"> Delete Image<br>
+ {$memberInfo.fieldData.logo}<br>
+ <p><div id="largeLogoButton" class="button-primary">Show Large Logo Image</div></p>
+ </td>
+
+ </tr>
+ </table>
{/if}
<input type="file" name="logo_new">
{if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}
<th {if $memberInfo.fieldRequired.cc_type}class="glm-required"{/if}>Credit Cards Accepted:</th>
<td {if $memberInfo.fieldFail.cc_type}class="glm-form-bad-input"{/if}>
{foreach from=$memberInfo.fieldData.cc_type.bitmap item=v}
- <input type="checkbox" name="cc_type" value="{$v.value}"> {$v.name}<br>
+ <input type="checkbox" name="cc_type[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
{/foreach}
{if $memberInfo.fieldFail.cc_type}<p>{$memberInfo.fieldFail.cc_type}</p>{/if}
</td>
<tr>
<th {if $memberInfo.fieldRequired.notes}class="glm-required"{/if}>Notes:</th>
<td {if $memberInfo.fieldFail.notes}class="glm-form-bad-input"{/if}>
- <textarea name="notes" class="glm-form-textarea">{$memberInfo.fieldData.notes}</textarea>
+ <textarea name="notes" class="glm-form-textarea" placeholder="For reference only. Not displayed to users.">{$memberInfo.fieldData.notes}</textarea>
{if $memberInfo.fieldFail.notes}<p>{$memberInfo.fieldFail.notes}</p>{/if}
</td>
</tr>
-
-
-
</table>
<p><span class="glm-required">*</span> Required</p>
<input type="submit" name="Add new member">
// Action to select a category
$('#categorySelect').change( function() {
- // Get the ID and name of the category
+ // Get the ID, name, and parent of the category
var catValue = $('#categorySelect').val();
var catName = $('#categorySelect').find(':selected').text();
+ var catParent = $('#categorySelect').find(':selected').attr('data-parent');
// Check if the category has already been added
var found = false;
}
});
+ // Check if there's a parent
+ parentName = '';
+ if (catParent != '') {
+ parentName = catParent + ': ';
+ }
+
// If not found, Add the category
if (!found) {
$('#activeCategories').append('<div data-id="' + catValue
+ '" class="glm-dynSelect-item glm-members-catgegory">'
- + catName.trim() + ' <span data-id="' + catValue + '" class="glm-dynSelect-delete catDelete">X</span>'
+ + parentName + catName.trim() + ' <span data-id="' + catValue + '" class="glm-dynSelect-delete catDelete">X</span>'
+ '<input type="hidden" name="category[' + catValue + ']" value="' + catValue + '"></div>');
}
// Submit new category
$('#newCategorySubmit').click( function() {
+
// Assign new cat number
newCat--;
// Get new category information
var newCatName = $('#newCatName').val();
var newCatParent = $('#newCatParent').val();
+ var catParent = $('#newCatParent').find(':selected').attr('data-parent');
+ var newCatParentName = $('#newCatParentName').val();
// If there's no name, tell the user we need one.
if (newCatName == '') {
-
$('#newCatNameTD').addClass('glm-form-bad-input');
$('#newCatNameRequired').text('A catogory name is required!');
return false;
}
-
+
+ // Check if there's a parent, get the name - new parent name overrides selected parent
+ parentName = '';
+ if (newCatParentName && newCatParentName != '') {
+ parentName = newCatParentName + ': ';
+ } else if (catParent && catParent != '') {
+ parentName = catParent + ': ';
+ }
+
// Add the new category to the active categories list
$('#activeCategories').append('<div data-id="' + newCat
+ '" class="glm-dynSelect-item glm-members-catgegory">'
- + newCatName.trim() + ' <span data-id="' + newCat + '" class="glm-dynSelect-delete catDelete">X</span>'
+ + parentName + newCatName.trim() + ' <span data-id="' + newCat + '" class="glm-dynSelect-delete catDelete">X</span>'
+ '<input type="hidden" name="category[' + newCat + ']" value="' + newCat + '">'
+ '<input type="hidden" name="newCategory[' + newCat + ']" value="' + newCatName + '">'
- + '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
+ + '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
+ + '<input type="hidden" name="newCatParentName[' + newCat + ']" value="' + newCatParentName + '">'
+ '</div>');
// Clear the dialog input fields
$('#newCatName').val('');
- $('#newCatParent').val('');
+ $('#newCatParent').val('');
+ $('#newCatParentName').val('');
$("#newCategoryDialog").dialog("close");
return false;
}
+ // Add new city name to the hidden field that will pass the new name to PHP.
+ $('#cityName').val(newCityName);
+
// Add new city name to picklist and for storing - Only one permitted per submission
if (newCityAdded) {
$('#city').val(-1);
$('#newCityNameTD').append('<input type="hidden" name="newCity" value="' + newCityName + '">');
newCityAdded = true;
-
+
}
// Clear new city name from form
$('#newCityName').val('');
$("#newCityDialog").dialog("close");
+
+ glmGeocode();
+
});
-
/*
- * Map operations
+ * Large Logo Dialog
*/
- // Code to kick off the geolocation-edit feature
- // requires js/geolocation-edit/jquery.geolocation.edit.min.0.0.11.js
-/*
- $("#locationMap").geolocate({
-
- lat: "#lat",
- lng: "#lon",
- address: [
- "#addr1",
- "#city",
- "#zip"
- ],
- mapOptions: {
- disableDefaultUI: false,
- mapTypeControl: true,
- mapTypeId: "roadmap",
- zoom: 16
- },
- markerOptions: {
- title: "This is your selected location"
- }
+ // Setup dialog box for showing enlarged logo image
+ x = $("#largeLogoDialog").dialog({
+ autoOpen: false,
+ resizable: false,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $('#largeLogoCancel').click( function() {
+ $("#largeLogoDialog").dialog("close");
+ });
+
+ // Show large logo image - pop-up dialog - resize at time of pop-up
+ $('#largeLogoButton').click( function() {
+ $("#largeLogoDialog").dialog("open");
+ $( "#largeLogoDialog" ).dialog( "option", "position", { my: "center", at: "center", of: window } );
+ var newWidth = $(window).width() * .8;
+ $( "#largeLogoDialog" ).dialog( "option", "width", newWidth );
+ });
+
+ // Resize whenever window size changes
+ $(window).resize(function(){
+ $( "#largeLogoDialog" ).dialog( "option", "position", { my: "center", at: "center", of: window } );
+ var newWidth = $(window).width() * .8;
+ $( "#largeLogoDialog" ).dialog( "option", "width", newWidth );
+ });
+
+ {if $haveMemberInfo}
+ // Delete Member Info dialog
+ $("#deleteMemberInfoDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $('#deleteMemberInfoButton').click( function() {
+ $('#deleteMemberInfoDialog').dialog('open');
+ });
+ $('#deleteMemberInfoCancel').click( function() {
+ $("#deleteMemberInfoDialog").dialog("close");
+ });
+ $('#deleteMemberInfoSubmit').click( function() {
+ window.location.replace("{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&deleteID={$memberInfo.fieldData.id}");
+ });
+ {/if}
+ /*
+ * Map operations
+ */
+ //show error if location can't be found
+ function showError() {
+ alert("Location can't be found");
+ }
+
+ /*
+ * Google Maps
+ * API reference: https://developers.google.com/maps/documentation/javascript/reference
+ */
+
+ // Set default - Need to make this configurable
+ var location = new google.maps.LatLng(45, -85)
+ var map = new google.maps.Map(document.getElementById('locationMap'), {
+ zoom: 14,
+ disableDefaultUI: false,
+ mapTypeId: google.maps.MapTypeId.MAP,
+ });
+ var geocoder = new google.maps.Geocoder();
+ var marker = new google.maps.Marker({
+ map: map,
+ position: location,
+ draggable: true,
+ animation: google.maps.Animation.DROP,
+ title: "This is your location"
+ });
+ map.setCenter(location);
+
+ // Listen for an end of drag event for the map marker
+ google.maps.event.addListener(marker,'dragend',function(event) {
+
+ // Get the end postion
+ glmLat = this.position.lat();
+ glmLng = this.position.lng();
+
+ // Assign it to the hidden fields for submission
+ $('#glmLat').val(glmLat);
+ $('#glmLng').val(glmLng);
+
+ // Also display it to the user
+ $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
+ });
+
+ // Resubmit geocoding when address changes
+ function glmGeocode() {
+
+ // Get all address parts
+ var geoAddr1 = $('#addr1').val().trim();
+ var geoAddr2 = $('#addr2').val().trim();
+ var geoCity = $('#city').find('option:selected').text().trim();
+ var geoState = $('#state').find('option:selected').text().trim();
+ var geoZIP = $('#zip').val().trim();
+ var geoCountry = $('#country').find('option:selected').text().trim();
+
+ // Assemble address string for
+ var geoAddress = '{$member.name}' + ', ' + geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
+
+ // Send to Google Geocoder
+ geocoder.geocode( { 'address': geoAddress }, function(results, status) {
+
+ // If we have a geocode solution
+ if (status == google.maps.GeocoderStatus.OK) {
+ map.setCenter(results[0].geometry.location);
+ marker.setPosition( results[0].geometry.location );
+
+ // Otherwise tell the user.
+ } else {
+alert(status + ' - ' + geoAddress);
+ $('#mapPosition').html('<span class="glm-notice">Not able to estimate position from the above address.</span>');
+ }
+ });
+ }
+
+ $('.glm-geocodeAction').change( function() {
+ glmGeocode();
});
- */
+
});
</script>
{if $numbMembers == 0}
<tr>
<th> <span class="glm-error">You do not have any members listed.</span></th>
- <td><a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=member&member_id=">Click here to create your first member.</a></td>
+ <td><a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member_id=">Click here to create your first member.</a></td>
</tr>
{/if}
</table>
<form class="glm-right" onSubmit="return false;">
<span{if $haveFilter} class="glm-notice"{/if}><b>List Filters:</b> </span>
- <input type="checkbox" id="filterPending" class="listFilter"{if $filterStatus} checked{/if}>Pending
- <input type="text" id="filterName" class="listFilter" value="{$filterName}"> Search
+ <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="text" id="filterName" class="listFilter" value="{$filterName}"> Search</span>
</form>
<h2>List of Members</h2>
<th>Member Name</th>
<th>Member Type</th>
<th>Date Created</th>
+ <th>Pending</th>
<th> </th>
</tr>
</thead>
<td>
{$m.created.date}
</td>
+ <td>
+ {if $m.pending > 0}<span class="glm-notice">Pending</span>{/if}
+ </td>
<td>
<a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}" class="button-primary glm-right">Manage</a>
</td>