*/
// Load glmPluginSupport class
-require_once (GLM_MEMBERS_PLUGIN_DIR . '/classes/glmPluginSupport.php');
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
/*
* This class performs all necessary additional work when this
* @var $Versions
* @access private
*/
- private $dbVersions = array(
+ public $dbVersions = array(
'0.1' => array('version' => '0.1', 'tables' => 24)
);
/*
* Constructor
*
+ * Note that the $noDatabaseCheck is used to access the database versions
+ * without triggering a database check.
+ *
* Performs all the work for this model
*/
- public function __construct ($wpdb)
+ public function __construct ($wpdb, $config, $noDatabaseCheck = false)
{
// This line is for dropping the currrent database version for testing
// delete_option('glmMembersDatabaseDbVersion');
// Save WordPress Database object
$this->wpdb = $wpdb;
+ // Save plugin configuration object
+ $this->config = $config;
- $this->checkErrorScrape();
+ if (!$noDatabaseCheck) {
- // Check the database
- if (!$this->checkDatabase()) {
+ $this->checkErrorScrape();
- // There was some kind of dataase failure, so die to prevent WordPress from marking plugin as activated.
- die();
+ // Check the database
+ if (!$this->checkDatabase()) {
- }
+ // There was some kind of dataase failure, so die to prevent WordPress from marking plugin as activated.
+ die();
- // Add user capabilties
- // $this->addRoleCapability('glm_members_edit', false);
+ }
- // Set current plugin version
- update_option('glmMembersDatbasePluginVersion', GLM_MEMBERS_PLUGIN_VERSION);
+ // Add user capabilties
+ // $this->addRoleCapability('glm_members_edit', false);
+ // Set current plugin version
+ update_option('glmMembersDatbasePluginVersion', GLM_MEMBERS_PLUGIN_VERSION);
+ }
}
/*
* Exp $
* @link http://www.visitgreatlakesbay.org/
*/
-abstract class GlmDataAccommodationTypes extends GlmDataAbstract
+class GlmDataAccommodationTypes extends GlmDataAbstract
{
/**
'use' => 'a'
),
- // Facility Type
- 'facility_type' => array (
- 'field' => 'facility_type',
- 'type' => 'list',
- 'list' => $this->config['facility_type'],
- 'required' => true,
- 'use' => 'a'
- ),
-
// Name
'name' => array(
'field' => 'name',
--- /dev/null
+<?php
+
+/**
+ * GLM Member-DB WordPress Plugin
+ * Amenities 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 $
+ */
+
+/**
+ * EventManagementDataAmenities 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 GlmDataAmenities 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 . 'amenities';
+
+ /*
+ * Table Data Fields
+ */
+ $this->fields = array(
+
+ 'id' => array(
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Facility Type
+ 'facility_type' => array (
+ 'field' => 'facility_type',
+ 'type' => 'list',
+ 'list' => $this->config['facility_type'],
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Name
+ 'name' => array(
+ 'field' => 'name',
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'use' => 'a'
+ ),
+
+ // Uses Value
+ 'uses_value' => array(
+ 'field' => 'uses_value',
+ 'type' => 'checkbox',
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Short Description
+ 'short_descr' => array(
+ 'field' => 'short_descr',
+ 'type' => 'text',
+ 'use' => 'a'
+ )
+
+
+ );
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+ }
+
+ }
+}
+
+?>
\ No newline at end of file
* Exp $
* @link http://www.visitgreatlakesbay.org/
*/
-abstract class GlmDataCategories extends GlmDataAbstract
+class GlmDataCategories extends GlmDataAbstract
{
/**
'p_field' => 'name',
'p_orderby' => 'name',
'p_blank' => true,
-
+ 'force_list' => true,
'required' => false,
'use' => 'a'
),
* Exp $
* @link http://www.visitgreatlakesbay.org/
*/
-abstract class GlmDataCities extends GlmDataAbstract
+class GlmDataCities extends GlmDataAbstract
{
/**
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Plugin
+ * Members Basic 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: dataMemberInfo.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * EventManagementDataMemberInfo class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Members Database Plugin
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMemberInfo.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ * @link http://www.visitgreatlakesbay.org/
+ */
+class GlmDataMemberInfo 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 . 'member_info';
+
+ /*
+ * Table Data Fields
+ */
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Member Pointer
+ 'member' => array (
+ 'field' => 'member',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Status
+ 'status' => array (
+ 'field' => 'status',
+ 'type' => 'list',
+ 'list' => $this->config['status'],
+ 'required' => true,
+ 'default' => $this->config['status_numb']['Pending'],
+ 'use' => 'a'
+ ),
+
+ // Create Time
+ 'create_time' => array (
+ 'field' => 'create_time',
+ 'type' => 'date',
+ 'required' => true,
+ 'default' => 'now',
+ 'use' => 'a'
+ ),
+
+ // Last Modify Time
+ 'modify_time' => array (
+ 'field' => 'modify_time',
+ 'type' => 'date',
+ 'required' => true,
+ 'default' => 'now',
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Short description
+ 'short_descr' => array (
+ 'field' => 'short_descr',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Address Line 1
+ 'addr1' => array (
+ 'field' => 'addr1',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Address Line 2
+ 'addr2' => array (
+ 'field' => 'addr2',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // City
+ 'city' => array (
+ 'field' => 'city',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ 'required' => true,
+ 'force_list' => true,
+ 'use' => 'a'
+ ),
+
+ // State
+ 'state' => array (
+ 'field' => 'state',
+ 'type' => 'list',
+ 'list' => $this->config['states'],
+ 'required' => true,
+ 'default' => 'MI',
+ 'use' => 'a'
+ ),
+
+ // ZIP / Postal Code
+ 'zip' => array (
+ 'field' => 'zip',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Country
+ 'country' => array (
+ 'field' => 'country',
+ 'type' => 'list',
+ 'list' => $this->config['countries'],
+ 'required' => true,
+ 'default' => 'US',
+ 'use' => 'a'
+ ),
+
+ // Latitude
+ 'lat' => array(
+ 'field' => 'lat',
+ 'type' => 'float',
+ 'default' => 45,
+ 'use' => 'a'
+ ),
+
+ // Longitude
+ 'lon' => array(
+ 'field' => 'lon',
+ 'type' => 'float',
+ 'default' => -84,
+ 'use' => 'a'
+ ),
+
+ // Region
+ 'region' => array (
+ 'field' => 'region',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ 'use' => 'a'
+ ),
+
+ // Phone
+ 'phone' => array(
+ 'field' => 'phone',
+ 'type' => 'phone',
+ 'use' => 'a'
+ ),
+
+ // Toll Free
+ 'toll_free' => array(
+ 'field' => 'toll_free',
+ 'type' => 'phone',
+ 'use' => 'a'
+ ),
+
+ // URL
+ 'url' => array(
+ 'field' => 'url',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Logo
+ 'logo' => array(
+ 'field' => 'logo',
+ 'type' => 'image',
+ 'use' => 'a'
+ ),
+
+ // Credit Cards Accepted - multi-pick
+ 'cc_type' => array(
+ 'field' => 'cc_type',
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config['credit_card'],
+ 'default' => 0, // no cards selected
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array (
+ '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'
+ )
+
+ );
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+ }
+
+
+
+ }
+}
+
+?>
\ No newline at end of file
* Exp $
* @link http://www.visitgreatlakesbay.org/
*/
-abstract class GlmDataMemberTypes extends GlmDataAbstract
+class GlmDataMemberTypes extends GlmDataAbstract
{
/**
* Exp $
* @link http://www.visitgreatlakesbay.org/
*/
-abstract class GlmDataMembers extends GlmDataAbstract {
+class GlmDataMembers extends GlmDataAbstract {
/**
* WordPress Database Object
),
// Status
- 'status' => array (
- 'field' => 'status',
+ 'access' => array (
+ 'field' => 'access',
'type' => 'list',
- 'list' => $this->config['status'],
+ 'list' => $this->config['memb_access'],
+ 'l_blank' => true,
'required' => true,
- 'default' => $this->config['status_numb']['Pending'],
+ 'force_list' => true,
'use' => 'a'
),
'p_orderby' => 'name',
'p_blank' => true,
'required' => true,
+ 'force_list' => true,
'use' => 'a'
),
'use' => 'a'
),
- // Description
- 'descr' => array(
- 'field' => 'descr',
- 'type' => 'text',
+ // Date created
+ 'created' => array (
+ 'field' => 'created',
+ 'type' => 'date',
'required' => true,
'use' => 'a'
- ),
-
- // Short description
- 'short_descr' => array (
- 'field' => 'short_descr',
- 'type' => 'text',
- 'required' => true,
- 'use' => 'a'
- ),
-
- // Address Line 1
- 'addr1' => array (
- 'field' => 'addr1',
- 'type' => 'text',
- 'use' => 'a'
- ),
-
- // Address Line 2
- 'addr2' => array (
- 'field' => 'addr2',
- 'type' => 'text',
- 'use' => 'a'
- ),
-
- // Address Line 1
- 'addr1' => array (
- 'field' => 'addr1',
- 'type' => 'text',
- 'use' => 'a'
)
-
);
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
* Exp $
* @link http://www.visitgreatlakesbay.org/
*/
-abstract class GlmDataRegions extends GlmDataAbstract
+class GlmDataRegions extends GlmDataAbstract
{
/**
}
+ /*
+ * Sort a database result array (from DataAbstract.php) by parent, child relationships
+ *
+ * @param array $array Array to be sorted
+ * @param string $name Name of array element that represents the text to sort on
+ * @param string $parent Name of the array element that represents the parent ID to sort on
+ *
+ * @return array Sorted array
+ */
+ public static function sortParentChild($array, $name = 'name', $parent = 'parent')
+ {
+
+ if (!is_array($array) || count($array) == 0) {
+ return false;
+ }
+
+ // Do a sort by custom function with it included in the call
+ // This lets me directly use $name and $parent in the sort function
+ uasort($array, function ($a, $b) use ($name, $parent) {
+
+ // If there's a parent, append the name of this entry to the parent
+ // The '~~~' simply keeps appended strings from any chance of a match with something else
+ if ($a[$parent]['value']) {
+ $aVal = $a[$parent]['name'].'~~~'.$a['name'];
+ } else {
+ // Otheriwse just use the name.
+ $aVal = $a['name'];
+ }
+
+ // Same for b value
+ if ($b[$parent]['value']) {
+ $bVal = $b[$parent]['name'].'~~~'.$b['name'];
+ } else {
+ $bVal = $b['name'];
+ }
+
+ if ($aVal > $bVal) {
+ return 1;
+ }
+
+ if ($aVal < $bVal) {
+ return -1;
+ }
+
+ return 0;
+
+ });
+
+ return $array;
+ }
+
}
;
; Entry Status Types
;
-status[10] = 'Active'
-status[20] = 'Inactive'
+status[10] = 'Inactive'
+status[20] = 'Active'
status[30] = 'Pending Review'
status[40] = 'Archived'
-status_numb['None'] = 0
-status_numb['Active'] = 10
-status_numb['Inactive'] = 20
+status_numb['Inactive'] = 10
+status_numb['Active'] = 20
status_numb['Pending'] = 30
status_numb['Archived'] = 40
+;
+; 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_numb['Inactive'] = 10
+memb_access_numb['NoAccess'] = 20
+memb_access_numb['Moderated'] = 30
+memb_access_numb['Full'] = 40
+memb_access_numb['Archived'] = 90
+
;
; Entity Reference Type
;
;
; Facility Type
;
-facility_type[0] = 'None'
facility_type[10] = 'Hotel - Motel'
facility_type[20] = 'Bed and Breakfast'
facility_type[30] = 'Restaurant'
facility_type[40] = 'Golf'
-facility_type_numb['None'] = 0
facility_type_numb['HotelMotel'] = 10
facility_type_numb['BedAndBreakfast'] = 20
facility_type_numb['Restaurant'] = 30
payment_type_numb['DebitCard'] = 50
payment_type_numb['PayPal'] = 60
+;
+; Credit Cards
+; numbers are an exponent of 2 that represent the bit position
+; in a bitmap - so it starts with 0
+;
+credit_card[0] = 'Visa'
+credit_card[1] = 'MasterCard'
+credit_card[2] = 'American Express'
+credit_card[3] = 'Discover'
+credit_card[4] = 'Diners Club'
+
+credit_card_numb['Visa'] = 0
+credit_card_numb['MasterCard'] = 1
+credit_card_numb['American Express'] = 2
+credit_card_numb['Discover'] = 3
+credit_card_numb['Diners Club'] = 4
+
+; Credit Card validation strings (regular expression)
+credit_card_verify[0] = '^4.{15}$|^4.{12}$'
+credit_card_verify[1] = '^5[1-5].{14}$'
+credit_card_verify[2] = '^3[47].{13}$'
+credit_card_verify[3] = '^6011.{12}$'
+credit_card_verify[4] = '^30[0-5].{11}$|^3[68].{12}$'
+
; Days of the week - numbers are an exponent of 2 that represent the bit position
-days[0] = "Sunday"
-days[1] = "Monday"
-days[2] = "Tuesday"
-days[3] = "Wednesday"
-days[4] = "Thursday"
-days[5] = "Friday"
-days[6] = "Saturday"
+days[0] = 'Sunday'
+days[1] = 'Monday'
+days[2] = 'Tuesday'
+days[3] = 'Wednesday'
+days[4] = 'Thursday'
+days[5] = 'Friday'
+days[6] = 'Saturday'
;
; Common Terms/Phrases
),
'member' => array(
'index', // Member Dashboard
- 'member',
+ 'memberInfo',
'locations',
'facilities',
'activities',
'categories',
'cities',
'regions',
- 'accommodationTypes'
+ 'accommodationTypes',
+ 'amenities',
+ 'development'
),
'error' => array(
'index',
);
// Load glmPluginSupport class
-require_once (GLM_MEMBERS_PLUGIN_DIR . '/classes/glmPluginSupport.php');
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
/**
* Admin Controller Class
wp_register_script('glm-members-admin-js',
GLM_MEMBERS_PLUGIN_URL . 'js/admin.js',
array(
- 'jquery'
+ 'jquery'
));
wp_enqueue_script('glm-members-admin-js');
* when building
* its Dashboard menus.
*
+ * add menu function reference
+ * add_menu_page( $page_title, $menu_title, $capability, $menu_slub, $function, $icon_url, $position)
+ * add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function)
+ *
* (no prameters)
*
* @return void
{
// Add a new main menu item for management and display of Members
- add_menu_page('Members', 'Members', 'read',
+ add_menu_page('Members', 'Member DB', 'read',
'glm-members-admin-menu-members',
array(
$this,
'glmMembersAdminMenuMembers'
+ ), false, '20.2375');
+
+ /*
+ * Add a submenu for the "Members" section
+ * Note that this uses the main menu item's slug for both the parent and menu slug
+ * to create a sub-menu with a title different from the main menu totle
+ */
+ add_submenu_page('glm-members-admin-menu-members', 'Members',
+ 'Members', 'glm_members_member', 'glm-members-admin-menu-members',
+ array(
+ $this,
+ 'glmMembersAdminMenuMembers'
+ ));
+
+ // Add a submenu for TESTING
+ add_submenu_page('glm-members-admin-menu-members', 'Member List',
+ ' Member List', 'glm_members_member', 'glm-members-admin-menu-members-list',
+ array(
+ $this,
+ 'glmMembersAdminMenuMembersList'
));
+ // Add a submenu for the "Member" section
add_submenu_page('glm-members-admin-menu-members', 'Member Information',
- 'Member', 'glm_members_member', 'glm-members-admin-menu-member',
+ 'Member Data', 'glm_members_member', 'glm-members-admin-menu-member',
array(
$this,
'glmMembersAdminMenuMember'
));
+ // Add a submenu for the "Configure" section
add_submenu_page('glm-members-admin-menu-members',
'Configure Members Database', 'Configure',
'glm_members_configure', 'glm-members-admin-menu-configure',
$this->controller('members');
}
+ // A test third-level admin menu
+ public function glmMembersAdminMenuMembersList()
+ {
+ $this->controller('members', 'list');
+ }
+
// Add Sub Menu Items
public function glmMembersAdminMenuMember ()
{
* @return void
* @access public
*/
- public function controller ($menuItem)
+ public function controller ($menuItem, $action = false)
{
$errorMsg = '';
$this->addNotice('<pre>'.print_r($this->config,1).'</pre>', 'DataBlock', 'Configuration Settings');
$this->addNotice("<pre>".print_r($_REQUEST,1)."</pre>", 'DataBlock', "Request Data");
+ if (isset($_FILES)) {
+ $this->addNotice("<pre>".print_r($_FILES,1)."</pre>", 'DataBlock', "Request Files Data");
+ }
}
/*
* Determine model to execute
*/
- // Default action is "index"
- $action = 'index';
+ // Default action is "index" if an action wasn't specified in the controller call
+ if (!$action) {
+ $action = 'index';
+ }
- // Get any requested "action" from a form submission modify path/name
- // accordingly
+ // Get any requested "action" from a form submission and modify path/name
+ // accordingly. This modifies the previously set $action.
if (isset($_REQUEST['glm_action']) && $_REQUEST['glm_action'] != '') {
$a = sanitize_text_field($_REQUEST['glm_action']);
if ($a != '') {
*/
// Build model and path and class names
- $modelName = GLM_MEMBERS_PLUGIN_DIR . '/models/admin/' . $menuItem .
+ $modelName = GLM_MEMBERS_PLUGIN_PATH . '/models/admin/' . $menuItem .
'/' . $action . '.php';
$className = 'GlmMembersAdmin_' . $menuItem . '_' . $action;
}
// Check for invalid or missing view file
- if (!$view || !is_file(GLM_MEMBERS_PLUGIN_DIR . '/views/'.$view)) {
+ if (!$view || !is_file(GLM_MEMBERS_PLUGIN_PATH . '/views/'.$view)) {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
$this->addNotice("<b>Error in Admin Controller:</b> Requested View file doesn't exist - ".$view, 'Alert');
*/
// Load Smarty Template support
- require (GLM_MEMBERS_PLUGIN_DIR . '/lib/smartyTemplateSupport.php');
+ require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
$smarty = new smartyTemplateSupport();
// Add standard template parameters
$smarty->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
- $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL );
+ $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 ( 'thisYear', date ( 'Y' ) );
);
// Load glmPluginSupport class
-require_once (GLM_MEMBERS_PLUGIN_DIR . '/classes/glmPluginSupport.php');
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
/*
* This class controls which models are use for front-end functionality
*/
// Build model and path and class names
- $modelName = GLM_MEMBERS_PLUGIN_DIR . '/models/front/' . $menuItem .
+ $modelName = GLM_MEMBERS_PLUGIN_PATH . '/models/front/' . $menuItem .
'/' . $action . '.php';
$className = 'GlmMembersFront_' . $menuItem . '_' . $action;
// Check for invalid or missing view file
if (! $view || ! is_file(
- GLM_MEMBERS_PLUGIN_DIR . '/views/' . $view)) {
+ GLM_MEMBERS_PLUGIN_PATH . '/views/' . $view)) {
$modelRedirect = true;
$menuItem = 'error';
$action = 'index';
*/
// Load Smarty Template support
- require (GLM_MEMBERS_PLUGIN_DIR . '/lib/smartyTemplateSupport.php');
+ require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
$smarty = new smartyTemplateSupport();
// Add standard parameters
$smarty->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
- $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL );
+ $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL );
$smarty->templateAssign ( 'thisPage', $_REQUEST['page']);
$smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
$smarty->templateAssign ( 'thisYear', date ( 'Y' ) );
.glm-right {
float: right;
}
+.glm-left {
+ float: left;
+}
+.glm-indent {
+ padding-left: 2em;
+}
.glm-copyright {
text-align: center;
padding: 1em;
background-color: #fff;
}
+.glm-item-container {
+ border: 1px #ccc solid;
+ padding: .2em;
+ background: #f8f8f8;
+}
/* Admin Tabs */
.nav-tab {
/* Admin Forms */
.glm-form-bad-input {
background: #FFaBa9;
+ padding: .2em;
}
.glm-form-text-input {
width: 90%;
}
+.glm-form-text-input-short {
+ width: 10em;
+}
.glm-form-textarea {
width: 90%;
}
/* Admin table additions */
.glm-admin-table {
- border: 3px #ddd solid !important;
+ width: 95%;
+ margin-bottom: 5px;
}
-.glm-admin-table thead th{
- border-bottom: 3px #ddd solid !important;
- font-size: 15px;
- font-weight: bold;
-}
-.glm-table-fieldname {
+.glm-admin-table th {
text-align: left;
vertical-align: top;
white-space: nowrap;
padding-right: 1em;
+ padding-bottom: .4em;
+ width: 10px; /* used to keep header fields on a line with td's to as narrow as they can be without breaking the text */
+}
+.glm-admin-table td {
+ text-align: left;
+ vertical-align: top;
+ padding-bottom: .4em;
+}
+.glm-admin-table thead th{
+ font-size: 15px;
+ font-weight: bold;
}
/* Overlay dialog box */
display: none;
}
+/* Dynamic Select Active Values Box */
+.glm-dynSelect-box {
+ border: 2px #ddd solid;
+ min-height: 2.5em;
+ min-width: 100px;
+ float: left;
+ background: #fff;
+ margin: .2em;
+}
+.glm-dynSelect-item {
+ border: 2px #ddd solid;
+ border-radius: 5px;
+ background: #eee;
+ float: left;
+ padding: .2em;
+ margin: .4em;
+}
+.glm-dynSelect-delete {
+ font-weight: bold;
+ font-size: 1.1em;
+ color: #bbb;
+ border-left: 2px #ccc solid;
+ padding-left: .5em;
+ margin-left: .5em;
+}
+.glm-dynSelect-delete:hover {
+ font-size: 1.1em;
+ color: #000;
+}
+
+/* Map Edit */
+.glm-map-edit {
+ width:320px;
+ height:200px;
+ border: 2px black solid;
+}
+
/* Debug Window */
#glm-debug-header {
font-weight: bold;
*/
// Load glmPluginSupport class
-require_once (GLM_MEMBERS_PLUGIN_DIR . '/classes/glmPluginSupport.php');
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
/*
* This class performs all necessary additional work when this
* Set standard defined parameters
*/
-// Determine current http/https protocol
-$pageProtocol = 'http';
-if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
- $pageProtocol = 'https';
-}
-define('GLM_MEMBERS_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
+define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Members Database');
+define('GLM_MEMBERS_PLUGIN_DIR', 'glm-members-db');
// Debug Options
define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', true);
define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', true);
define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', true);
+// Determine current http/https protocol
+$pageProtocol = 'http';
+if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
+ $pageProtocol = 'https';
+}
+define('GLM_MEMBERS_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
+
// Plugin Versions
define('GLM_MEMBERS_PLUGIN_VERSION', 0.1);
define('GLM_MEMBERS_PLUGIN_DB_VERSION', 0.1);
// URLs
define('GLM_MEMBERS_PLUGIN_URL', plugin_dir_url(__FILE__));
+
$pageUri = explode('?', $_SERVER['REQUEST_URI']); // Bust this up to access URL path and script name only
-define('GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL', $pageProtocol.'://'.$_SERVER['SERVER_NAME'].$pageUri[0]);
+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]);
// Directories
-define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Members Database');
-define('GLM_MEMBERS_PLUGIN_DIR', dirname(__FILE__));
+define('GLM_MEMBERS_PLUGIN_PATH', dirname(__FILE__));
define('GLM_MEMBERS_PLUGIN_DB_SCRIPTS', dirname(__FILE__).'/misc/databaseScripts');
-define('GLM_MEMBERS_PLUGIN_CLASS_DIR', GLM_MEMBERS_PLUGIN_DIR.'/classes');
-define('GLM_MEMBERS_PLUGIN_LIB_DIR', GLM_MEMBERS_PLUGIN_DIR.'/lib');
+define('GLM_MEMBERS_PLUGIN_CLASS_PATH', GLM_MEMBERS_PLUGIN_PATH.'/classes');
+define('GLM_MEMBERS_PLUGIN_LIB_PATH', GLM_MEMBERS_PLUGIN_PATH.'/lib');
// Database table prefixes
global $wpdb;
require_once('defines.php');
// Get plugin configuration - Just use common section for now, we'll deal with others later
-$configData = parse_ini_file(GLM_MEMBERS_PLUGIN_DIR.'/config/plugin.ini', true);
+$configData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/plugin.ini', true);
$config = $configData['common'];
// Get additional configuration data
-$stateData = parse_ini_file(GLM_MEMBERS_PLUGIN_DIR.'/config/states.ini');
+$stateData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/states.ini');
$config['states'] = $stateData['states'];
-$countryData = parse_ini_file(GLM_MEMBERS_PLUGIN_DIR.'/config/countries.ini');
+$countryData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/countries.ini');
$config['countries'] = $countryData['countries'];
// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything.
function glmMembersPluginActivate ()
{
global $wpdb;
- require_once (GLM_MEMBERS_PLUGIN_DIR . '/activate.php');
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php');
new glmMembersPluginActivate($wpdb);
}
register_activation_hook(__FILE__, 'glmMembersPluginActivate');
function glmMembersPluginDeactivate ()
{
global $wpdb;
- require_once (GLM_MEMBERS_PLUGIN_DIR . '/deactivate.php');
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php');
$x = new glmMembersPluginDeactivate($wpdb);
return false;
}
*/
// Load data abstract
-require_once(GLM_MEMBERS_PLUGIN_LIB_DIR.'/GlmDataAbstract/DataAbstract.php');
+require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php');
/*
*
glmMembersAdminNotices(true);
exit;
} elseif (is_admin()) {
- require_once (GLM_MEMBERS_PLUGIN_DIR . '/controllers/admin.php');
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php');
new glmMembersAdmin($wpdb, $config);
} else {
- require_once (GLM_MEMBERS_PLUGIN_DIR . '/controllers/front.php');
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/front.php');
new glmMembersFront($wpdb, $config);
}
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/!svn/ver/16469/CommonApps/Public/geolocation-edit
+END
+jquery.geolocation.edit.0.0.9.js
+K 25
+svn:wc:ra_dav:version-url
+V 87
+/svn/!svn/ver/16469/CommonApps/Public/geolocation-edit/jquery.geolocation.edit.0.0.9.js
+END
+jquery.geolocation.edit.min.0.0.9.js
+K 25
+svn:wc:ra_dav:version-url
+V 91
+/svn/!svn/ver/16469/CommonApps/Public/geolocation-edit/jquery.geolocation.edit.min.0.0.9.js
+END
--- /dev/null
+10
+
+dir
+22275
+http://cvs2.gaslightmedia.com/svn/CommonApps/Public/geolocation-edit
+http://cvs2.gaslightmedia.com/svn
+
+
+
+2013-05-30T18:34:24.204349Z
+16469
+cscott
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+a51af99c-7783-4ee7-b607-eba6a9487a3a
+\f
+jquery.geolocation.edit.0.0.9.js
+file
+
+
+
+
+2014-09-04T18:56:23.889900Z
+153c4f4f804859076e3858fdf6956005
+2013-05-30T18:34:24.204349Z
+16469
+cscott
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+5417
+\f
+jquery.geolocation.edit.min.0.0.9.js
+file
+
+
+
+
+2014-09-04T18:56:23.889900Z
+a8fe8b4e6ccf1a6f471eac5baea62c7f
+2013-05-30T18:34:24.204349Z
+16469
+cscott
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2678
+\f
--- /dev/null
+/**
+ * jQuery geolocation.edit plugin
+ * Copyright (c) 2012 Milos Popovic <the.elephant@gmail.com>
+ *
+ * Freely distributable under the MIT license.
+ *
+ * @version 0.0.8 (2013-02-08)
+ * @see http://github.com/miloss/jquery-geolocation-edit
+ */
+
+(function ($) {
+ var inits
+ , methods = {}
+ , loadScript;
+
+ // Queued initializations
+ inits = [];
+
+
+ // 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;
+ }
+
+ // 1. Create options for map init
+ // 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);
+
+ // 2. Init map and marker - per coordinates
+ llat = parseFloat( $( opts.lat ).val() );
+ llng = parseFloat( $( opts.lng ).val() );
+
+ if ( !isNaN(llat) && !isNaN(llng) ) {
+ llocation = new google.maps.LatLng(llat, llng);
+ $(this).geolocate({}, 'initMap', llocation);
+ }
+
+ // 3. Bind fields actions - coordinates (future?)
+ if ( opts.changeOnEdit ) {
+ $( opts.lat ).change(function () { /* ... */ });
+ $( opts.lng ).change(function () { /* ... */ });
+ }
+
+ // 4. Bind field actions - address
+ 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)
+ , map
+ , markerOptions
+ , marker
+ , opts = $.data(self, 'opts');
+
+ map = new google.maps.Map(self, $.extend({
+ center: location
+ }, opts.mapOptions));
+
+ markerOptions = $.extend({
+ map: map,
+ position: location
+ }, opts.markerOptions);
+
+ marker = new google.maps.Marker(markerOptions);
+
+ $.data(self, 'map', map);
+ $.data(self, 'marker', marker);
+
+ google.maps.event.addListener(marker, 'dragend', function () {
+ $(self).geolocate({}, 'getMarkerLocation');
+ });
+ };
+
+
+ /**
+ * Make Google Geocoding call with provided address
+ */
+ methods.callGeocoding = function () {
+ var self = $(this).get(0)
+ , addr = ''
+ , opts = $.data(self, 'opts')
+ , len = opts.address.length
+ , geo
+ , cbfunc = opts.geoCallback;
+
+ // 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
+ // -----------------
+
+ // loadScript, 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);
--- /dev/null
+// jQuery geolocation.edit plugin v0.0.8 (2013-02-08)
+// Copyright (c) 2012 Milos Popovic <the.elephant@gmail.com>
+// Freely distributable under the MIT license.
+// see: http://github.com/miloss/jquery-geolocation-edit
+(function(a){var g,e={},h;g=[];e.main=function(b){var c=this,d,f,e;if("undefined"===typeof b.lat||"undefined"===typeof b.lng)a.error("Please provide 'lat' and 'lng' options for jQuery.geolocate");else if("undefined"===typeof google||"undefined"===typeof google.maps)g.push(function(){a(c).geolocate(b)}),h();else if(d=a.extend(!0,{address:[],changeOnEdit:!1,mapOptions:{zoom:14,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:!1,streetViewControl:!1},markerOptions:{draggable:!0,animation:google.maps.Animation.DROP}, geoCallback:function(){}},b),a(this).data("opts",d),f=parseFloat(a(d.lat).val()),e=parseFloat(a(d.lng).val()),!isNaN(f)&&!isNaN(e)&&(f=new google.maps.LatLng(f,e),a(this).geolocate({},"initMap",f)),d.changeOnEdit&&(a(d.lat).change(function(){}),a(d.lng).change(function(){})),e=d.address.length,0<e)for(f=0;f<e;f++)a(d.address[f]).change(function(){a(c).geolocate({},"callGeocoding")})};e.initMap=function(b){var c=a(this).get(0),d,e=a.data(c,"opts");d=new google.maps.Map(c,a.extend({center:b},e.mapOptions)); b=a.extend({map:d,position:b},e.markerOptions);b=new google.maps.Marker(b);a.data(c,"map",d);a.data(c,"marker",b);google.maps.event.addListener(b,"dragend",function(){a(c).geolocate({},"getMarkerLocation")})};e.callGeocoding=function(){for(var b=a(this).get(0),c="",d=a.data(b,"opts"),e=d.address.length,g=d.geoCallback;e--;)c+=a(d.address[e]).val();(new google.maps.Geocoder).geocode({address:c},function(c,e){var d,f,j,h;g(c,e);f=c[0];"undefined"!==typeof f&&(j=a.data(b,"map"),h=a.data(b,"marker"), d=f.geometry.location,j.panToBounds(f.geometry.viewport),j.panTo(d),h.setPosition(d),a(b).geolocate({},"getMarkerLocation"))})};e.getMarkerLocation=function(){var b=a(this).get(0),c=a.data(b,"marker"),b=a.data(b,"opts"),c=c.getPosition();a(b.lat).val(c.lat());a(b.lng).val(c.lng())};a.fn.geolocate=function(b,c){var d=Array.prototype.slice;if("undefined"===typeof c){if("string"===typeof b&&"undefined"!==typeof e[b])return e[b].apply(this,d.call(arguments,1));a(this).geolocate({},"main",b)}else{if(e[c])return e[c].apply(this, d.call(arguments,2));a.error("Method "+c+" does not exist on jQuery.geolocate")}return this};a.fn.geolocateGMapsLoaded=function(){for(;g.length;)g.shift()()};var k=!1;h=function(){var a;k||(k=!0,a=document.createElement("script"),a.type="text/javascript",a.src="http://maps.googleapis.com/maps/api/js?sensor=false&callback=$.fn.geolocateGMapsLoaded",document.body.appendChild(a))}})(jQuery);
--- /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);
--- /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
+ */
+
--- /dev/null
+// jQuery geolocation.edit plugin v0.0.11 (2014-06-01)
+// Copyright (c) 2012 Milos Popovic <the.elephant@gmail.com>
+// Freely distributable under the MIT license.
+// see: http://github.com/miloss/jquery-geolocation-edit
+(function(a){var h,g,k;h=[];g={main:function(c){var b=this,d,f,e;if("undefined"===typeof c.lat||"undefined"===typeof c.lng)a.error("Please provide 'lat' and 'lng' options for jQuery.geolocate");else if("undefined"===typeof google||"undefined"===typeof google.maps)h.push(function(){a(b).geolocate(c)}),k();else if(d=a.extend(!0,{address:[],changeOnEdit:!1,mapOptions:{zoom:14,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:!1,streetViewControl:!1},markerOptions:{draggable:!0,animation:google.maps.Animation.DROP}, geoCallback:function(){}},c),a(this).data("opts",d),f=parseFloat(a(d.lat).val()),e=parseFloat(a(d.lng).val()),isNaN(f)&&(f=0),isNaN(e)&&(e=0),f=new google.maps.LatLng(f,e),a(this).geolocate({},"initMap",f),d.changeOnEdit&&(a(d.lat).change(function(){}),a(d.lng).change(function(){})),e=d.address.length,0<e)for(f=0;f<e;f++)a(d.address[f]).change(function(){a(b).geolocate({},"callGeocoding")})},initMap:function(c){var b=a(this).get(0),d=google.maps,f,e=a.data(b,"opts");f=new d.Map(b,a.extend({center:c}, e.mapOptions));c=a.extend({map:f,position:c},e.markerOptions);c=new d.Marker(c);a.data(b,"map",f);a.data(b,"marker",c);d.event.addListener(c,"dragend",function(){a(b).geolocate({},"getMarkerLocation")})},callGeocoding:function(){for(var c=a(this).get(0),b=a.data(c,"opts"),d=b.address.length,f=b.geoCallback,e="";d--;)e+=a(b.address[d]).val();(new google.maps.Geocoder).geocode({address:e},function(b,d){var e,g,h,k;f(b,d);g=b[0];"undefined"!==typeof g&&(h=a.data(c,"map"),k=a.data(c,"marker"),e=g.geometry.location, h.panToBounds(g.geometry.viewport),h.panTo(e),k.setPosition(e),a(c).geolocate({},"getMarkerLocation"))})},getMarkerLocation:function(){var c=a(this).get(0),b=a.data(c,"marker"),c=a.data(c,"opts"),b=b.getPosition();a(c.lat).val(b.lat());a(c.lng).val(b.lng())}};a.fn.geolocate=function(c,b){var d=Array.prototype.slice;if("undefined"===typeof b){if("string"===typeof c&&"undefined"!==typeof g[c])return g[c].apply(this,d.call(arguments,1));a(this).geolocate({},"main",c)}else{if(g[b])return g[b].apply(this, d.call(arguments,2));a.error("Method "+b+" does not exist on jQuery.geolocate")}return this};a.fn.geolocateGMapsLoaded=function(){for(;h.length;)h.shift()()};k=function(){var a=!1;return function(){var b;a||(a=!0,b=document.createElement("script"),b.type="text/javascript",b.src="http://maps.googleapis.com/maps/api/js?sensor=false&callback=$.fn.geolocateGMapsLoaded",document.body.appendChild(b))}}()})(jQuery);
\ No newline at end of file
$in = ($in - 0);
// Check min/max limits
- if ($f['minValue'] && $in < $f['minValue']) {
+ if (isset($f['minValue']) && $f['minValue'] && $in < $f['minValue']) {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Input is less than the minimum permitted value of '.$f['minValue'].'.';
return $in;
}
- if ($f['maxValue'] && $in > $f['maxValue']) {
+ if (isset($f['maxValue']) && $f['maxValue'] && $in > $f['maxValue']) {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Input is greater than the maximum permitted value of '.$f['maxValue'].'.';
return $in;
function floatOutput($f, $d)
{
// if a format is specified
- if ($f['output_format']) {
+ if (isset($f['output_format']) && $f['output_format']) {
$d = sprintf('%'.$f['output_format'].'f', ($d - 0));
}
}
// if a format is specified
- if ($f['output_format']) {
+ if (isset($f['output_format']) && $f['output_format'] != '') {
$in = sprintf('%'.$f['output_format'].'f', ($in - 0));
}
$in = $_REQUEST[$as];
// Check for required field
- if ($f['required'] && trim($in) == '') {
+ if (isset($f['required']) && $f['required'] && trim($in) == '') {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Required input not provided.';
return $in;
$in = $in - 0;
// Check min/max limits
- if ($f['minValue'] && $in < $f['minValue']) {
+ if (isset($f['minValue']) && $f['minValue'] && $in < $f['minValue']) {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Input is less than the minimum permitted value of '.$f['minValue'].'.';
return $in;
}
- if ($f['maxValue'] && $in > $f['maxValue']) {
+ if (isset($f['maxValue']) && $f['maxValue'] && $in > $f['maxValue']) {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Input is greater than the maximum permitted value of '.$f['maxValue'].'.';
return $in;
}
// if a format is specified
- if ($f['output_format']) {
+ if (isset($f['output_format']) && $f['output_format']) {
$in = sprintf('%'.$f['output_format'].'f', ($in - 0));
}
*/
function pointerField($f)
{
-
- // Get ID field of other table - default to 'id'
- $p_id = 'id';
- if(isset($f['p_id'])) {
- $p_id = $f['p_id'];
- }
-
- // Check if there's a specified WHERE clause
- $where = $p_id." = T.".$f['field'];
- if (isset($f['p_where']) && $f['p_where']) {
- $where = $f['p_where'];
- }
-
- // Check if there's an addional FROM tables
- $from = '';
- if (isset($f['p_from']) && $f['p_from']) {
- $from = ', '.$f['p_from'];
- }
-
- // Check if the results from this pointer is to be summed
- $field_val = $f['p_field'];
- if (isset($f['p_sum']) && $f['p_sum']) {
- $field_val = 'COALESCE(sum('.$field_val.'), 0) ';
- }
-
- // Check for "as" option
- $as = $f['field'];
- if (isset($f['as']) && $f['as'] != '') {
- $as = $f['as'];
- }
-
- $field = "
- COALESCE(
- (
- SELECT ".$field_val."
- FROM ".$f['p_table']."
- $from
- WHERE $where
- ), null
- ) AS $as
- ";
-
- return $field;
+ return 'T.'.$f['field'];
}
function pointerOptions($f)
{
function pointerOutput($f, $d, $forEdit = false, $id = false, $idfield = 'id')
{
- // If the operation is Edit then we need to also get the options for select (unless it's p_static)
- if ($forEdit && !(isset($f['p_static']) && $f['p_static'] === true)) {
+ // 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 ) {
- // Get current value of pointer
- if ($id) {
- $sql = "
- SELECT ".$f['field']." AS id
- FROM ".$this->table."
- WHERE $idfield = $id
- ";
- $p_data = $this->wpdb->get_row($sql, ARRAY_A);
- $p_value = $p_data['id'];
- }
+ $p_value = $d;
// Get pointer options from specified table
$order_by = $f['p_field'];
";
$p_list = $this->wpdb->get_results($sql, ARRAY_A);
+ // Get field name
+ $as = $f['field'];
+ if (isset($f['as']) && $f['as'] != '') {
+ $as = $f['as'];
+ }
+
// If this is not a "new", then do these things
if ($op != 'n') {
- // Pointers are treated as integers except that there's no min/max
-
- $in = $_REQUEST[$as];
+ // Get selected - Pointers are treated as integers except that there's no min/max
+ $in = $_REQUEST[$as]-0;
// Check for required field
- if ($f['required'] && trim($in) == '') {
+ if (isset($f['required']) && $f['required'] && trim($in) == '') {
$this->inputFieldStatus = false;
$this->inputErrorReason = 'Required input not provided.';
// return $in;
} else {
// Only worry about no options if the field is required.\r
- if ($f['required']) {\r
+ if (isset($f['required']) && $f['required']) {\r
// There were no results from the\r
$this->inputFieldStatus = false;\r
$this->inputErrorReason = 'No options were available for this pick list.';\r
} // if $op
$r = array(
- 'value' => $in,
+ 'value' => $in,
'name' => $selected_name,
'nameEsc' => addslashes($selected_name),
- 'list' => $pick_list
+ 'list' => $pick_list
);
return $r;
// Build list array
$list = array();
+
+ // If list should have a blank entry
+ if (isset($f['l_blank']) && $f['l_blank']) {
+ $list[null] = array(
+ 'name' => '',
+ 'nameEsc' => '',
+ 'value' => null,
+ 'default' => false
+ );
+ }
+
+ // Add list entries
while (list($k, $v) = each($f['list'])) {
$list[$k] = array(
'name' => $v,
);
// if the list is not required, dump it now. (List, Get, Delete, Confirm delete)
- if (in_array($op, array('l', 'g', 'd', 'c'))) {
+ $forceList = (isset($f['force_list']) && $f['force_list']);
+ if (!$forceList && !$forEdit && in_array($op, array('l', 'g', 'd', 'c'))) {
$r['list'] = false;
}
// Build list array
$list = array();
+
+ // If list should have a blank entry
+ if (isset($f['l_blank']) && $f['l_blank']) {
+ $list[null] = array(
+ 'name' => '',
+ 'nameEsc' => '',
+ 'value' => null,
+ 'default' => false
+ );
+ }
+
+ // Add list entries
while (list($k, $v) = each($f['list'])) {
$list[$k] = array(
'name' => $v,
if ($op == 'n' && isset($f['default'])) {
$in = $f['default'];
// Otherwise, create bitmap from input selection - multi-pick
- } elseif (is_array($_REQUEST[$as]) && count($_REQUEST[$as]) > 0) {
+ } elseif (isset($_REQUEST[$as]) && is_array($_REQUEST[$as]) && count($_REQUEST[$as]) > 0) {
foreach ($_REQUEST[$as] as $bit) {
// Make sure it's a number that's less than 32 - Using integer (32 bits?)
if ($bit == ($bit-0) && $bit < 32) {
if (isset($f['minValue']) && ($f['minValue']-0) > 0) {
$min = $f['minValue']-0;
} else {
- $min = strtotime('-6 months');
+ $min = strtotime('10 years');
}
if (isset($f['maxValue']) && ($f['maxValue']-0) > 0) {
$max = $f['maxValue']-0;
} else {
- $max = strtotime('+24 months');
+ $max = strtotime('+10 years');
}
// Get time stamp for retrieved data
if (isset($f['minValue']) && ($f['minValue']-0) > 0) {
$min = $f['minValue']-0;
} else {
- $min = strtotime('-6 months');
+ $min = strtotime('-10 years');
}
if (isset($f['maxValue']) && ($f['maxValue']-0) > 0) {
$max = $f['maxValue']-0;
} else {
- $max = strtotime('+24 months');
+ $max = strtotime('+ years');
}
// Build picklists for date input
// 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 {
+ // Otherwise we should be getting input from the user
+ } else {
$this->inputErrorReason = false;
-
- // Check for pick-list date input
$in_type = false;
+ $in = false;
+
+ // If we're getting separate month, day, year
if (isset($_REQUEST[$as.'_month'])) {
// Looks like we have picklist input
$in = strtotime($_REQUEST[$as.'_month'].'/'.$_REQUEST[$as.'_day'].'/'.$_REQUEST[$as.'_year']);
$in_type = 'pick';
+ // Look for plain text input
} elseif (isset($_REQUEST[$as])) {
-
- // Looks like it's plain text input
$in = strtotime($_REQUEST[$as]);
-
$in_type = 'text';
-
}
// check if the input time was invalid
- if ($f['required'] && $in == false) {
+ if (isset($f['required']) && $f['required'] && $in == false) {
$this->inputErrorReason = 'Date supplied is invalid.';
$this->inputFieldStatus = false;
$in = time();
// Use default format unless there's a date format spec?
$format = ('m/d/Y');
- if ($f['format']) {
+ if (isset($f['format']) && $f['format']) {
$format = $f['format'];
}
$this->inputErrorReason = 'Required date not supplied.';
$this->inputFieldStatus = false;
// Check for valid date range
- } elseif ($f['minValue'] && $in < $f['minValue']) {
+ } elseif (isset($f['minValue']) && $f['minValue'] && $in < $f['minValue']) {
$this->inputErrorReason = 'Date earlier than permitted ('.date($format, $f['minValue']).').';
$this->inputFieldStatus = false;
- } elseif ($f['maxValue'] && $in > $f['maxValue']) {
+ } elseif (isset($f['maxValue']) && $f['maxValue'] && $in > $f['maxValue']) {
$this->inputErrorReason = 'Date later than permitted ('.date($format, $f['maxValue']).').';
$this->inputFieldStatus = false;
}
$text_date = '';
}
+ // Create MYSQL compatible date input
+ $sqlDate = date('Y-m-d', $in);
+
// If the field validated and it's supposed to be unique
if ($this->inputFieldStatus && $this->inputFieldStatus && isset($f['unique']) && $f['unique']) {
FROM "
.$this->table."
WHERE "
- .$f['field']." = '$text_date';
+ .$f['field']." = '$sqlDate';
";
// If there's an ID field, then this must be an update rather than an insert
}
function dateStore($in, $f)
{
+
// Check if there's no date then supply null
if ($in['date'] != '') {
- return "'".addslashes($in['date'])."'";
+
+ // Create MYSQL compatible date input
+ $sqlDate = date('Y-m-d', strtotime($in['date']));
+
+ return "'$sqlDate'";
+
} else {
return "null";
}
'default' => false
);
}
- $min_list = array(
- 0 => array('name' => '00', value => 0, 'default' => false),
- 15 => array('name' => '15', value => 15, 'default' => false),
- 30 => array('name' => '30', value => 30, 'default' => false),
- 45 => array('name' => '45', value => 45, 'default' => false)
- );
+ $min_list = array();
+ for ($m=0 ; $m<60 ; $m++) {
+ $min_list[$m] = array('name' => ($m < 10 ? '0' : '').$m, 'value' => $m, 'default' => false);
+ }
$ampm_list = array(
- 'A' => array('name' => 'AM', value => 'A', 'default' => false),
- 'P' => array('name' => 'PM', value => 'P', 'default' => false)
+ 'A' => array('name' => 'AM', 'value' => 'A', 'default' => false),
+ 'P' => array('name' => 'PM', 'value' => 'P', 'default' => false)
);
-
$time_list = array(
'hour' => $hour_list,
'min' => $min_list,
$hour -= 12;
}
- // We're doing only 15 min intervals so force to that
- $min = (floor($t[1] / 15) * 15);
+ $min = $t[1];
$time_list['hour'][$hour]['default'] = true;
$time_list['min'][$min]['default'] = true;
// We have a time value so set Hours Pick
$time_list['hour'][$hour]['default'] = true;
-
- // We're doing only 15 min intervals so force to that
- $min = (floor($min / 15) * 15);
$time_list['min'][$min]['default'] = true;
if ($ampm == 'PM') {
$current_img = false;
// Setup Image server access
- require_once IMAGE_SERVER_ABSTRACT;
- $imServer = new ImageServerAbstract();
+// require_once IMAGE_SERVER_ABSTRACT;
+// $imServer = new ImageServerAbstract();
// Check if there's an existing image
if ($id != false) {
// Is there a new image being uploaded
$new = false;
- if (is_array($_FILES[$as.'_new']) && $_FILES[$as.'_new']['tmp_name'] != '') {
+ if (isset($_FILES[$as.'_new']) && is_array($_FILES[$as.'_new']) && $_FILES[$as.'_new']['tmp_name'] != '') {
$new = true;
}
// If there a request to delete an existing image or a new image and there's a current image
- if (($_REQUEST[$as."_delete"] == 'on' || $new) && $current_img != false) {
- $imServer->imageDelete($current_img);
+ if (isset($_REQUEST[$as."_delete"]) && ($_REQUEST[$as."_delete"] == 'on' || $new) && $current_img != false) {
+// $imServer->imageDelete($current_img);
$current_img = '';
}
// If there's a new image, try to store that one
if ($new) {
- $current_img = $imServer->imageUpload($as.'_new');
+
+// $current_img = $imServer->imageUpload($as.'_new');
+
+
}
return $current_img;
$this->select .= $sep.$field;
// If the field has an "AS" specifier, use that as the field name
- $as = $v['field'];
+ $as = trim($v['field']);
$asFieldUsed = false;
if (isset($v['as']) && $v['as'] != false && trim($v['as']) != '') {
- $this->select .= ' AS '.$v['as'];
- $as = $v['as'];
+ $as = trim($v['as']);
+ $this->select .= ' AS '.$as;
$asFieldUsed = true;
}
}
// Check for "as" output field name
- $as = $v['field'];
+ $as = trim($v['field']);
if (isset($v['as']) && $v['as'] != false && trim($v['as'] != '')) {
- $as = $v['as'];
+ $as = trim($v['as']);
}
// Get the current field data
// Call field processing function based on field tye
$out = $this->{$type.'Output'}($v, $d, $forEdit, $id, $idfield, $op);
-
$data[$as] = $out;
if($forEdit) {
}
if ($forEdit) {
- return array(
+ $r = array(
'status' => true,
'fieldData' => $data,
'fieldRequired' => $fieldRequired,
'fieldFail' => $fieldFail
);
+
+ return $r;
}
return $data;
}
}
// Check for "as" output field name
- $as = $v['field'];
+ $as = trim($v['field']);
if (isset($v['as']) && $v['as'] != false && trim($v['as']) != '') {
- $as = $v['as'];
+ $as = trim($v['as']);
}
// Check if this is a vew only field.
FROM $this->table
WHERE $where;";
+ $stats = $this->wpdb->get_row($sql, ARRAY_A);
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getStats() query");
+ glmMembersAdmin::addNotice($stats, 'DataBlock', "Stats Data");
}
- $stats = $this->wpdb->get_row($sql, ARRAY_A);
-
return $stats['count'];
}
public function getList($where = '', $order = '')
{
- $this->optionIncludeSelectListData = false;
-
// Get field specifications for this instance
$this->buildFieldsList('l');
";
}
- 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);
while (list($k, $v) = each($list)) {
$list[$k] = $this->processOutputData($v, 'l');
}
-//echo "<pre>".print_r($list,1)."</pre>";
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query");
+ glmMembersAdmin::addNotice($list, 'DataBlock', "getList() data");
+ }
return $list;
}
* @return void
* @access public
*/
- public function getEntry($id, $idfield = 'id', $where = '')
+ public function getEntry($id, $idfield = 'id', $where = '', $forEdit = false)
{
if ($id-0 == 0) {
// echo "DataAbstract.php - getEntry() called with invalid ID";
WHERE $idfield = $id
$where
;";
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getEntry() query");
- }
-
$detail = $this->wpdb->get_row($sql, ARRAY_A);
// If nothing was found, simply return false
}
// Process individual fields
- $detail = $this->processOutputData($detail, 'g');
+ $detail = $this->processOutputData($detail, 'g', $forEdit);
+
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getEntry() query");
+ glmMembersAdmin::addNotice($detail, 'DataBlock', "getEntry() data");
+ }
return $detail;
}
$r = $this->processInputData('n');
$r['fieldFail'] = false;
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($r, 'DataBlock', "newEntry() data");
+ }
+
return $r;
}
( $fields ) VALUES ( $vals );
";
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($sql, 'DataBlock', "insertEntry() Query");
+ }
+
// Now store the field data
$this->wpdb->query($sql);
+ $queryError = $this->wpdb->last_error;
+
+ // If there were no errors
+ if (trim($queryError) != '') {
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice(
+ 'insertEntry() Query Failure<br>'
+ .' Error Message: '.$queryError.'<br>'
+ .' Table: '.$this->table, 'Alert');
+ }
+ }
+
+
// Get the current ID value and set that in the session
- $r['insertedID'] = $this->wpdb->insert_id;
+ $r['fieldData']['id'] = $this->wpdb->insert_id;
+ } else {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - insertEntry() query");
+ glmMembersAdmin::addNotice(' insertEntry() requested to NOT store new entry!', 'Process');
}
+ }
- // Get the data again for output
- $r['fieldData'] = $this->getEntry($r['insertedID']);
-
+ } else {
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice('  checkOther() returned bad status.', 'Process');
}
+ }
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($r, 'DataBlock', "DataAbstract - insertEntry() failure data");
}
return $r;
FROM $this->table T
WHERE $idfield = $id
;";
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - editEntry() query");
- }
-
$detail = $this->wpdb->get_row($sql, ARRAY_A);
// Check for failure retrieving data
// Process individual fields
$detail = $this->processOutputData($detail, 'e', true, $id, $idfield);
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - editEntry() query");
+ glmMembersAdmin::addNotice($detail, 'DataBlock', "editEntry() data");
+ }
+
+
return $detail;
}
if (isset($v['view_only']) && $v['view_only']) {
// Check for "as" output field name
- $as = $v['field'];
+ $as = trim($v['field']);
if (isset($v['as']) && $v['as'] != false && trim($v['as']) != '' ) {
- $as = $v['as'];
+ $as = trim($v['as']);
}
$r['fieldData'][$as] = $stored[$as];
WHERE $idField = $id;
";
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - updateEntry() query");
- }
-
// Now store the field data
$this->wpdb->query($sql, ARRAY_A);
// Get the data again for output
$r['fieldData'] = $this->getEntry($id, $idField);
+
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($r, 'DataBlock', "updateEntry() data");
}
return $r;
}
}
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($detail, 'DataBlock', "deleteEntry() data");
+ }
+
return $detail;
}
'minLength' Minimum length for an input field
'maxLength' Maximum length for an input field
+'force_list' Always provide the picklist tables (p_static overrides)
+
'p_table' Table to get related data from for pointer types
'p_field' Field to get related data from for field types
'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'.
'list_keytype' Type of key field (default is 'text')
'text' A Text key - expects a text field in the database
/*
* Load and instatiate Smarty Templates
*/
- require (GLM_MEMBERS_PLUGIN_DIR . '/lib/Smarty-3.1.21/libs/Smarty.class.php');
+ require (GLM_MEMBERS_PLUGIN_PATH . '/lib/Smarty-3.1.21/libs/Smarty.class.php');
$this->template = new Smarty ();
/*
* Configure Smarty Templates for this site
*/
- $this->template->setTemplateDir ( GLM_MEMBERS_PLUGIN_DIR . '/views' );
- $this->template->setCompileDir ( GLM_MEMBERS_PLUGIN_DIR . '/misc/smarty/templates_c' );
- $this->template->setCacheDir ( GLM_MEMBERS_PLUGIN_DIR . '/misc/smarty/cache' );
- $this->template->setConfigDir ( GLM_MEMBERS_PLUGIN_DIR . '/misc/smarty/configs' );
+ $this->template->setTemplateDir ( GLM_MEMBERS_PLUGIN_PATH . '/views' );
+ $this->template->setCompileDir ( GLM_MEMBERS_PLUGIN_PATH . '/misc/smarty/templates_c' );
+ $this->template->setCacheDir ( GLM_MEMBERS_PLUGIN_PATH . '/misc/smarty/cache' );
+ $this->template->setConfigDir ( GLM_MEMBERS_PLUGIN_PATH . '/misc/smarty/configs' );
}
/*
-- To permit each query below to be executed separately,
-- all queries must be separated by a line with ----
-CREATE TABLE {prefix}members (
+
+CREATE TABLE {prefix}accommodation_types (
id INT NOT NULL AUTO_INCREMENT,
- active BOOLEAN NULL,
- date_created TIMESTAMP NULL,
+ facility_type INT NULL,
name TINYTEXT NULL,
- data_records INT NULL,
+ descr TEXT NULL,
+ short_descr TINYTEXT NULL,
PRIMARY KEY (id),
+ INDEX(facility_type),
INDEX(name(20))
);
----
-CREATE TABLE {prefix}member_type (
+CREATE TABLE {prefix}accommodations (
id INT NOT NULL AUTO_INCREMENT,
+ active BOOLEAN NULL,
name TINYTEXT NULL,
- descr TINYTEXT NULL,
- PRIMARY KEY (id)
+ accommodation_type INT NULL,
+ descr TEXT NULL,
+ short_descr TINYTEXT NULL,
+ quant INT NULL,
+ reservation_url TINYTEXT NULL,
+ reservation_id TINYTEXT NULL,
+ year_round TINYINT(1) NULL,
+ ref_type INT NULL,
+ ref_dest INT NULL,
+ PRIMARY KEY (id),
+ INDEX(accommodation_type),
+ INDEX(name(20)),
+ INDEX(ref_type),
+ INDEX(ref_dest)
);
----
-CREATE TABLE {prefix}cities (
+CREATE TABLE {prefix}accounts (
id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NULL,
- PRIMARY KEY (id)
+ member INT NULL,
+ payment_type INT NULL,
+ invoice_delivery INT NULL,
+ PRIMARY KEY (id),
+ INDEX(member)
);
----
-CREATE TABLE {prefix}regions (
+CREATE TABLE {prefix}activties (
id INT NOT NULL AUTO_INCREMENT,
- active TINYINT(1) NULL,
+ active BOOLEAN NULL,
+ activity_type INT NULL,
+ facility INT NULL,
name TINYTEXT NULL,
descr TEXT NULL,
short_descr TINYTEXT NULL,
- PRIMARY KEY (id)
+ phone TINYTEXT NULL,
+ url TINYTEXT NULL,
+ notes TEXT NULL,
+ create_time TIMESTAMP NULL,
+ modify_time TIMESTAMP NULL,
+ ref_type INT NULL,
+ ref_dest INT NULL,
+ PRIMARY KEY (id),
+ INDEX(activity_type),
+ INDEX(name(20)),
+ INDEX(ref_type),
+ INDEX(ref_dest)
);
----
-CREATE TABLE {prefix}member_data (
+CREATE TABLE {prefix}amenities (
id INT NOT NULL AUTO_INCREMENT,
- member INT NULL,
- status INT NULL,
- member_type INT NULL,
+ active TINYINT(1) NULL,
+ 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,
- zip TINYTEXT NULL,
- lat FLOAT NULL,
- lon FLOAT NULL,
- region INT NULL,
- phone TINYTEXT NULL,
- toll_free TINYTEXT NULL,
- url TINYTEXT NULL,
- logo TINYTEXT NULL,
- cc_type INT NULL,
- join_date DATE NULL,
- notes TEXT NULL,
- create_time TIMESTAMP NULL,
- modify_time TIMESTAMP NULL,
+ facility_type INT NULL,
+ uses_value BOOLEAN NULL,
PRIMARY KEY (id),
- INDEX(status),
- INDEX(city),
- INDEX(zip(10)),
- INDEX(lat),
- INDEX(lon),
- INDEX(region)
+ INDEX(name(20))
);
----
-CREATE TABLE {prefix}locations (
+CREATE TABLE {prefix}amenity_ref (
+ id INT NOT NULL AUTO_INCREMENT,
+ amenity INT NULL,
+ ref_type INT NULL,
+ ref_dest INT NULL,
+ amenity_value TINYTEXT NULL,
+ PRIMARY KEY (id),
+ INDEX(ref_type),
+ INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}categories (
id INT NOT NULL AUTO_INCREMENT,
- active BOOLEAN NULL,
- location_type INT NULL,
- member INT NULL,
name TINYTEXT NULL,
descr TEXT NULL,
short_descr TINYTEXT NULL,
+ parent INT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}category_member (
+ id INT NOT NULL AUTO_INCREMENT,
+ category INT NULL,
+ member INT NULL,
+ PRIMARY KEY (id),
+ INDEX(category),
+ INDEX(member)
+);
+
+----
+
+CREATE TABLE {prefix}cities (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}contacts (
+ id INT NOT NULL AUTO_INCREMENT,
+ active BOOLEAN NULL,
+ fname TINYTEXT NULL,
+ lname TINYTEXT NULL,
+ contact_type INT NULL,
+ org TINYTEXT NULL,
addr1 TINYTEXT NULL,
addr2 TINYTEXT NULL,
city INT NULL,
zip TINYTEXT NULL,
lat FLOAT NULL,
lon FLOAT NULL,
- region INT NULL,
- phone TINYTEXT NULL,
- toll_free TINYTEXT NULL,
url TINYTEXT NULL,
- logo TINYTEXT NULL,
+ office_phone TINYTEXT NULL,
+ home_phone TINYTEXT NULL,
+ mobile_phone TINYTEXT NULL,
+ alt_phone TINYTEXT NULL,
+ fax TINYTEXT NULL,
+ email TINYTEXT NULL,
+ alt_email TINYTEXT NULL,
+ password TINYTEXT NULL,
+ permissions TINYTEXT NULL,
notes TEXT NULL,
create_time TIMESTAMP NULL,
modify_time TIMESTAMP NULL,
+ ref_type INT NULL,
+ ref_dest INT NULL,
PRIMARY KEY (id),
- INDEX(name(20)),
+ INDEX(fname(20)),
+ INDEX(lname(20)),
INDEX(city),
INDEX(zip(10)),
INDEX(lat),
INDEX(lon),
- INDEX(region)
+ INDEX(email(20))
);
----
----
-CREATE TABLE {prefix}activties (
- id INT NOT NULL AUTO_INCREMENT,
- active BOOLEAN NULL,
- activity_type INT NULL,
- facility INT NULL,
- name TINYTEXT NULL,
- descr TEXT NULL,
- short_descr TINYTEXT NULL,
- phone TINYTEXT NULL,
- url TINYTEXT NULL,
- notes TEXT NULL,
- create_time TIMESTAMP NULL,
- modify_time TIMESTAMP NULL,
- ref_type INT NULL,
- ref_dest INT NULL,
- PRIMARY KEY (id),
- INDEX(activity_type),
- INDEX(name(20)),
- INDEX(ref_type),
- INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}accommodation_types (
- id INT NOT NULL AUTO_INCREMENT,
- facility_type INT NULL,
- name TINYTEXT NULL,
- descr TEXT NULL,
- short_descr TINYTEXT NULL,
- PRIMARY KEY (id),
- INDEX(facility_type),
- INDEX(name(20))
-);
-
-----
-
-CREATE TABLE {prefix}accommodations (
+CREATE TABLE {prefix}files (
id INT NOT NULL AUTO_INCREMENT,
- active BOOLEAN NULL,
name TINYTEXT NULL,
- accommodation_type INT NULL,
+ file_name TINYTEXT NULL,
descr TEXT NULL,
short_descr TINYTEXT NULL,
- quant INT NULL,
- reservation_url TINYTEXT NULL,
- reservation_id TINYTEXT NULL,
- year_round TINYINT(1) NULL,
+ size INT NULL,
+ pending TINYINT(1) NULL,
+ create_date DATE NULL,
ref_type INT NULL,
ref_dest INT NULL,
PRIMARY KEY (id),
- INDEX(accommodation_type),
INDEX(name(20)),
+ INDEX(file_name(20)),
INDEX(ref_type),
INDEX(ref_dest)
);
----
-CREATE TABLE {prefix}restaurant_types (
+CREATE TABLE {prefix}images (
id INT NOT NULL AUTO_INCREMENT,
- active TINYINT(1) NULL,
name TINYTEXT NULL,
+ file_name TINYTEXT NULL,
descr TEXT NULL,
- short_descr TINYTEXT NULL,
+ caption TINYTEXT NULL,
+ pending TINYINT(1) NULL,
+ position INT NULL,
+ ref_type INT NULL,
+ ref_dest INT NULL,
PRIMARY KEY (id),
- INDEX(name(20))
+ INDEX(name(20)),
+ INDEX(file_name(20)),
+ INDEX(ref_type),
+ INDEX(ref_dest)
);
----
-CREATE TABLE {prefix}restaurants (
+CREATE TABLE {prefix}locations (
id INT NOT NULL AUTO_INCREMENT,
active BOOLEAN NULL,
+ location_type INT NULL,
+ member INT NULL,
name TINYTEXT NULL,
- restaurant_type INT NULL,
descr TEXT NULL,
short_descr TINYTEXT NULL,
- menu TEXT NULL,
- special_menu TEXT NULL,
- url TINYTEXT NULL,
- reservation_url TINYTEXT NULL,
+ addr1 TINYTEXT NULL,
+ addr2 TINYTEXT NULL,
+ city INT NULL,
+ state INT NULL,
+ country INT NULL,
+ zip TINYTEXT NULL,
+ lat FLOAT NULL,
+ lon FLOAT NULL,
+ region INT NULL,
phone TINYTEXT NULL,
- hours_descr TINYTEXT NULL,
- alcohol TINYINT(1) NULL,
- non_smoking TINYINT(1) NULL,
+ toll_free TINYTEXT NULL,
+ url TINYTEXT NULL,
+ logo TINYTEXT NULL,
notes TEXT NULL,
- ref_type INT NULL,
- ref_dest INT NULL,
+ create_time TIMESTAMP NULL,
+ modify_time TIMESTAMP NULL,
PRIMARY KEY (id),
- INDEX(restaurant_type),
INDEX(name(20)),
- INDEX(ref_type),
- INDEX(ref_dest)
+ INDEX(city),
+ INDEX(zip(10)),
+ INDEX(lat),
+ INDEX(lon),
+ INDEX(region)
);
----
----
-CREATE TABLE {prefix}contacts (
+CREATE TABLE {prefix}members (
id INT NOT NULL AUTO_INCREMENT,
- active BOOLEAN NULL,
- fname TINYTEXT NULL,
- lname TINYTEXT NULL,
- contact_type INT NULL,
- org TINYTEXT NULL,
+ access INT NULL,
+ member_type INT NULL,
+ created DATE NULL,
+ name TINYTEXT NULL,
+ PRIMARY KEY (id),
+ INDEX(name(20)),
+ INDEX(created)
+);
+
+----
+
+CREATE TABLE {prefix}member_info (
+ id INT NOT NULL AUTO_INCREMENT,
+ member INT NULL,
+ status INT NULL,
+ descr TEXT NULL,
+ short_descr TINYTEXT NULL,
addr1 TINYTEXT NULL,
addr2 TINYTEXT NULL,
city INT NULL,
zip TINYTEXT NULL,
lat FLOAT NULL,
lon FLOAT NULL,
+ region INT NULL,
+ phone TINYTEXT NULL,
+ toll_free TINYTEXT NULL,
url TINYTEXT NULL,
- office_phone TINYTEXT NULL,
- home_phone TINYTEXT NULL,
- mobile_phone TINYTEXT NULL,
- alt_phone TINYTEXT NULL,
- fax TINYTEXT NULL,
- email TINYTEXT NULL,
- alt_email TINYTEXT NULL,
- password TINYTEXT NULL,
- permissions TINYTEXT NULL,
+ logo TINYTEXT NULL,
+ cc_type INT NULL,
notes TEXT NULL,
create_time TIMESTAMP NULL,
modify_time TIMESTAMP NULL,
- ref_type INT NULL,
- ref_dest INT NULL,
PRIMARY KEY (id),
- INDEX(fname(20)),
- INDEX(lname(20)),
+ INDEX(status),
INDEX(city),
INDEX(zip(10)),
INDEX(lat),
INDEX(lon),
- INDEX(email(20))
+ INDEX(region)
);
----
-CREATE TABLE {prefix}amenities (
+CREATE TABLE {prefix}member_type (
id INT NOT NULL AUTO_INCREMENT,
- active TINYINT(1) NULL,
name TINYTEXT NULL,
- descr TEXT NULL,
- short_descr TINYTEXT NULL,
- facility_type INT NULL,
- PRIMARY KEY (id),
- INDEX(name(20))
+ descr TINYTEXT NULL,
+ PRIMARY KEY (id)
);
----
-CREATE TABLE {prefix}social_media (
+CREATE TABLE {prefix}regions (
id INT NOT NULL AUTO_INCREMENT,
name TINYTEXT NULL,
descr TEXT NULL,
----
-CREATE TABLE {prefix}social_media_ref (
- id INT NOT NULL AUTO_INCREMENT,
- ref_type INT NULL,
- ref_dest INT NULL,
- social_media INT NULL,
- url TINYTEXT NULL,
- PRIMARY KEY (id),
- INDEX(ref_type),
- INDEX(ref_dest),
- INDEX(social_media)
-);
-
-----
-
-CREATE TABLE {prefix}amenity_ref (
- id INT NOT NULL AUTO_INCREMENT,
- amenity INT NULL,
- ref_type INT NULL,
- ref_dest INT NULL,
- PRIMARY KEY (id),
- INDEX(ref_type),
- INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}accounts (
+CREATE TABLE {prefix}restaurant_types (
id INT NOT NULL AUTO_INCREMENT,
- member INT NULL,
- payment_type INT NULL,
- invoice_delivery INT NULL,
+ active TINYINT(1) NULL,
+ name TINYTEXT NULL,
+ descr TEXT NULL,
+ short_descr TINYTEXT NULL,
PRIMARY KEY (id),
- INDEX(member)
+ INDEX(name(20))
);
----
-CREATE TABLE {prefix}categories (
+CREATE TABLE {prefix}restaurants (
id INT NOT NULL AUTO_INCREMENT,
+ active BOOLEAN NULL,
name TINYTEXT NULL,
+ restaurant_type INT NULL,
descr TEXT NULL,
short_descr TINYTEXT NULL,
- parent INT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
-CREATE TABLE {prefix}category_member (
- id INT NOT NULL AUTO_INCREMENT,
- category INT NULL,
- main_category INT NULL,
+ menu TEXT NULL,
+ special_menu TEXT NULL,
+ url TINYTEXT NULL,
+ reservation_url TINYTEXT NULL,
+ phone TINYTEXT NULL,
+ hours_descr TINYTEXT NULL,
+ alcohol TINYINT(1) NULL,
+ non_smoking TINYINT(1) NULL,
+ notes TEXT NULL,
ref_type INT NULL,
ref_dest INT NULL,
PRIMARY KEY (id),
- INDEX(category),
+ INDEX(restaurant_type),
+ INDEX(name(20)),
INDEX(ref_type),
INDEX(ref_dest)
);
----
-CREATE TABLE {prefix}files (
+CREATE TABLE {prefix}social_media (
id INT NOT NULL AUTO_INCREMENT,
name TINYTEXT NULL,
- file_name TINYTEXT NULL,
descr TEXT NULL,
short_descr TINYTEXT NULL,
- size INT NULL,
- pending TINYINT(1) NULL,
- create_date DATE NULL,
- ref_type INT NULL,
- ref_dest INT NULL,
- PRIMARY KEY (id),
- INDEX(name(20)),
- INDEX(file_name(20)),
- INDEX(ref_type),
- INDEX(ref_dest)
+ PRIMARY KEY (id)
);
----
-CREATE TABLE {prefix}images (
+CREATE TABLE {prefix}social_media_ref (
id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NULL,
- file_name TINYTEXT NULL,
- descr TEXT NULL,
- caption TINYTEXT NULL,
- pending TINYINT(1) NULL,
- position INT NULL,
ref_type INT NULL,
ref_dest INT NULL,
+ social_media INT NULL,
+ url TINYTEXT NULL,
PRIMARY KEY (id),
- INDEX(name(20)),
- INDEX(file_name(20)),
INDEX(ref_type),
- INDEX(ref_dest)
+ INDEX(ref_dest),
+ INDEX(social_media)
);
-- Database Deletion Script
DROP TABLE
- {prefix}members,
- {prefix}member_type,
- {prefix}locations,
- {prefix}facilities,
- {prefix}activties,
+ {prefix}accommodation_types,
{prefix}accommodations,
+ {prefix}accounts,
+ {prefix}activties,
+ {prefix}amenities,
+ {prefix}amenity_ref,
+ {prefix}categories,
+ {prefix}category_member,
+ {prefix}cities,
+ {prefix}contacts,
+ {prefix}facilities,
+ {prefix}files,
{prefix}golf,
- {prefix}restaurants,
+ {prefix}images,
+ {prefix}locations,
{prefix}meals,
- {prefix}contacts,
- {prefix}accounts,
- {prefix}amenities,
- {prefix}amenity_member,
- {prefix}categories,
- {prefix}category_member,
- {prefix}files,
- {prefix}images,
- {prefix}regions,
- {prefix}social_media,
- {prefix}social_media_member,
- {prefix}cities
+ {prefix}members,
+ {prefix}member_info,
+ {prefix}member_type,
+ {prefix}regions,
+ {prefix}restaurant_types,
+ {prefix}restaurants,
+ {prefix}social_media,
+ {prefix}social_media_ref
;
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-22 02:04:38
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-05 01:52:25
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 => 1421691086,
+ 1 => 1423101141,
2 => 'file',
),
),
'function' =>
array (
),
+ 'version' => 'Smarty-3.1.21-dev',
+ 'unifunc' => 'content_54c05ab60bb1c1_03470573',
'variables' =>
array (
- 'numbMembers' => 0,
+ 'haveMemberTypes' => 0,
'thisURL' => 0,
+ 'haveCategories' => 0,
+ 'haveRegions' => 0,
+ 'haveAccommodationTypes' => 0,
+ 'numbMembers' => 0,
+ 'membersPending' => 0,
),
'has_nocache_code' => false,
- 'version' => 'Smarty-3.1.21-dev',
- 'unifunc' => 'content_54c05ab60bb1c1_03470573',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54c05ab60bb1c1_03470573')) {function content_54c05ab60bb1c1_03470573($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/members/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
<h2>Members Dashboard</h2>
+ <table class="glm-admin-table">
+<?php if (!$_smarty_tpl->tpl_vars['haveMemberTypes']->value) {?>
+ <tr>
+ <th class="glm-error">You do not have any Member Types setup.</th>
+ <td><a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
+ </tr>
+<?php }?>
+<?php if (!$_smarty_tpl->tpl_vars['haveCategories']->value) {?>
+ <tr>
+ <th><span class="glm-error">You do not have any Member Categories setup.</span></th>
+ <td><a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-configure&glm_action=categories">Click here to add Member Categories.</a></td>
+ </tr>
+<?php }?>
+<?php if (!$_smarty_tpl->tpl_vars['haveRegions']->value) {?>
+ <tr>
+ <th><span class="glm-error">You do not have any Regions setup.</span></th>
+ <td><a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-configure&glm_action=regions">Click here to add Regions.</a></td>
+ </tr>
+<?php }?>
+<?php if (!$_smarty_tpl->tpl_vars['haveAccommodationTypes']->value) {?>
+ <tr>
+ <th><span class="glm-error">You do not have any AccommodationTypes setup.</span></th>
+ <td><a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-configure&glm_action=accommodationTypes">Click here to add AccommodationTypes.</a></td>
+ </tr>
+<?php }?>
<?php if ($_smarty_tpl->tpl_vars['numbMembers']->value==0) {?>
- <p>
- <span class="glm-error">You do not currently have any members listed.</span>
- <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
-?page=glm-members-admin-menu-member&glm_action=member&member_id=">Click here to create your first member.</a>
- </p>
+ <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>
+ </tr>
<?php }?>
+ </table>
- <table>
+ <table class="glm-admin-table">
<tr><th>Number of Members Listed: </th><td><?php echo $_smarty_tpl->tpl_vars['numbMembers']->value;?>
+</td></tr>
+ <tr><th<?php if ($_smarty_tpl->tpl_vars['membersPending']->value) {?> class="glm-notice"<?php }?>>Member Pending Data: </th><td><?php echo $_smarty_tpl->tpl_vars['membersPending']->value;?>
</td></tr>
</table>
<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
<?php }} ?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-22 02:04:38
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-30 21:29:52
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/header.html" */ ?>
<?php /*%%SmartyHeaderCode:41614071154c05ab60be091-67045844%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'15f83071407dddb0b3c23ae1a70b66cefbd681db' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/header.html',
- 1 => 1421691086,
+ 1 => 1422653383,
2 => 'file',
),
),
'function' =>
array (
),
+ 'version' => 'Smarty-3.1.21-dev',
+ 'unifunc' => 'content_54c05ab60d1510_45219092',
'variables' =>
array (
'thisURL' => 0,
'thisAction' => 0,
),
'has_nocache_code' => false,
- 'version' => 'Smarty-3.1.21-dev',
- 'unifunc' => 'content_54c05ab60d1510_45219092',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54c05ab60d1510_45219092')) {function content_54c05ab60d1510_45219092($_smarty_tpl) {?><div class="wrap">
<h2>Your Members</h2>
&glm_action=list" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='list') {?>-active<?php }?>">List of Members</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='add') {?>-active<?php }?>">Reports</a>
+&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='add') {?>-active<?php }?> disabled">Reports</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='edit') {?>-active<?php } else { ?> disabled<?php }?>">Or Something - perahps mailing stuff?</a>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-22 05:39:11
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-06 16:22:14
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 => 1421905148,
+ 1 => 1423239729,
2 => 'file',
),
),
'unifunc' => 'content_54c05abfc64731_62067320',
'variables' =>
array (
- 'deleted' => 0,
+ 'haveMemberTypes' => 0,
+ 'updated' => 0,
+ 'haveMember' => 0,
'member' => 0,
'thisURL' => 0,
'thisPage' => 0,
+ 'v' => 0,
+ 'haveInfoRecords' => 0,
+ 'memberInfoRecords' => 0,
+ 'i' => 0,
+ 'm' => 0,
'memberID' => 0,
),
'has_nocache_code' => false,
<?php if ($_valid && !is_callable('content_54c05abfc64731_62067320')) {function content_54c05abfc64731_62067320($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/member/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
- <?php if (!$_smarty_tpl->tpl_vars['deleted']->value) {?>
- <div id="deleteMemberButton" class="button-primary glm-right">Delete this Member</div>
- <div id="deleteMemberDialog" class="glm-dialog-box" title="Delete Member">
- <center>
- <p>Are you sure you want to delete this member?</p>
- <p><div id="deleteMemberConfirm" class="button-primary">Yes, delete this member</div></p>
- <p><div id="deleteMemberCancel" class="button-primary">No, I don't want to delete this member</div></p>
- </center>
- </div>
- <?php }?>
-
- <h2><?php echo $_smarty_tpl->tpl_vars['member']->value['name'];?>
-</h2>
+<?php if ($_smarty_tpl->tpl_vars['haveMemberTypes']->value) {?>
- <h3 class="glm-notice"></h3>
-
- <table>
- <tr>
- <th class="glm-table-fieldname">Status</th>
- <td<?php if ($_smarty_tpl->tpl_vars['member']->value['status']['name']=='Pending Review') {?> class="glm-notice"<?php } elseif ($_smarty_tpl->tpl_vars['member']->value['status']['name']=='Active') {?> class="glm-active"<?php }?>>
- <?php echo $_smarty_tpl->tpl_vars['member']->value['status']['name'];?>
+ <?php if ($_smarty_tpl->tpl_vars['updated']->value) {?>
+ <h3 class="glm-notice glm-right">Record Updated</h3>
+ <?php }?>
- </td>
- </tr>
- <tr><th class="glm-table-fieldname">Member Name:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['name'];?>
-</td></tr>
- <tr><th class="glm-table-fieldname">Type:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['member_type'];?>
-</td></tr>
- <tr><th class="glm-table-fieldname">Description:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['descr'];?>
-</td></tr>
- <tr><th class="glm-table-fieldname">Short Description:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['short_descr'];?>
+ <h2>
+ <?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
+ <?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['name'];?>
+
+ <?php } else { ?>
+ Add New Member
+ <?php }?>
+ </h2>
+
+
+ <form action="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="index">
+ <?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
+ <input type="hidden" name="option" value="submit">
+ <input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['id'];?>
+">
+ <input type="hidden" name="created" value="<?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['created']['date'];?>
+">
+ <?php } else { ?>
+ <input type="hidden" name="option" value="addNew">
+ <input type="hidden" name="created" value="today">
+ <?php }?>
+
+ <table class="glm-admin-table">
+ <tr>
+ <th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['name']) {?>class="glm-required"<?php }?>>Member Name:</th>
+ <td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['name']) {?>class="glm-form-bad-input"<?php }?>>
+ <input type="text" name="name" value="<?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['name'];?>
+" class="glm-form-text-input">
+ <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['name']) {?><p><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldFail']['name'];?>
+</p><?php }?>
+ </td>
+ </tr>
+ <tr>
+ <th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['access']) {?>class="glm-required"<?php }?>>Access:</th>
+ <td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['access']) {?>class="glm-form-bad-input"<?php }?>>
+ <select name="access">
+ <?php $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
+ $_from = $_smarty_tpl->tpl_vars['member']->value['fieldData']['access']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
+foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value) {
+$_smarty_tpl->tpl_vars['v']->_loop = true;
+?>
+ <option value="<?php echo $_smarty_tpl->tpl_vars['v']->value['value'];?>
+"<?php if ($_smarty_tpl->tpl_vars['v']->value['default']) {?> selected="selected"<?php }?>><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
+</option>
+ <?php } ?>
+ </select>
+ <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['access']) {?><p><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldFail']['access'];?>
+</p><?php }?>
+ </td>
+ </tr>
+ <tr>
+ <th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['member_type']) {?>class="glm-required"<?php }?>>Member Type:</th>
+ <td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['member_type']) {?>class="glm-form-bad-input"<?php }?>>
+ <select name="member_type">
+ <?php $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
+ $_from = $_smarty_tpl->tpl_vars['member']->value['fieldData']['member_type']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
+foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value) {
+$_smarty_tpl->tpl_vars['v']->_loop = true;
+?>
+ <option value="<?php echo $_smarty_tpl->tpl_vars['v']->value['value'];?>
+"<?php if ($_smarty_tpl->tpl_vars['v']->value['default']) {?> selected="selected"<?php }?>><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
+</option>
+ <?php } ?>
+ </select>
+ <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['member_type']) {?><p><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldFail']['member_type'];?>
+</p><?php }?>
+ </td>
+ </tr>
+ <?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
+ <tr><th>Date created:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['created']['date'];?>
</td></tr>
+ <?php }?>
+
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
+ <input type="submit" value="Update member">
+ <?php } else { ?>
+ <input type="submit" value="Add new member">
+ <?php }?>
+ </form>
+
+ <?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
+ <?php if ($_smarty_tpl->tpl_vars['haveInfoRecords']->value) {?>
+ <h3>Member Information Versions</h3>
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>Access:</th>
+ <th>Created</th>
+ <th>Last Update</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php $_smarty_tpl->tpl_vars["i"] = new Smarty_variable("0", null, 0);?>
+ <?php $_smarty_tpl->tpl_vars['m'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['m']->_loop = false;
+ $_from = $_smarty_tpl->tpl_vars['memberInfoRecords']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
+foreach ($_from as $_smarty_tpl->tpl_vars['m']->key => $_smarty_tpl->tpl_vars['m']->value) {
+$_smarty_tpl->tpl_vars['m']->_loop = true;
+?>
+ <?php if ((1 & $_smarty_tpl->tpl_vars['i']->value++ / 1)) {?>
+ <tr>
+ <?php } else { ?>
+ <tr class="alternate">
+ <?php }?>
+ <td><?php echo $_smarty_tpl->tpl_vars['m']->value['status']['name'];?>
+</td>
+ <td><?php echo $_smarty_tpl->tpl_vars['m']->value['create_time']['time'];?>
+</td>
+ <td><?php echo $_smarty_tpl->tpl_vars['m']->value['modify_time']['time'];?>
+</td>
+ </tr>
+ <?php } ?>
+ </tbody>
</table>
-
- <?php echo '<script'; ?>
- type="text/javascript">
- jQuery(document).ready(function($) {
- $("#deleteMemberDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $('#deleteMemberButton').click( function() {
- $("#deleteMemberDialog").dialog("open");
- });
- $('#deleteMemberConfirm').click( function() {
- $("#deleteMemberDialog").dialog("close");
- window.location.href = "<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+ <?php } else { ?>
+ <h3 class="glm-notice">You do not yet have any member information entered.</h3>
+ <p><a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=index&option=delete&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-";
- });
- $('#deleteMemberCancel').click( function() {
- $("#deleteMemberDialog").dialog("close");
- });
+&glm_action=memberInfo&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+">Click here too start entering information for this member.</a></p>
+ <?php }?>
+ <?php }?>
+
+<?php } else { ?>
+ <h3 class="glm-error">You do not have any Member Types setup.</h3>
+ <p>You must have at least one Member Type to add a new member.</p>
+ <td><a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
+<?php }?>
- });
- <?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-01-22 02:04:35
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-27 09:22:21
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/member.html" */ ?>
<?php /*%%SmartyHeaderCode:101324643954c05ab3f0e228-27454872%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'25c8610e0e0bacafec3046a296066e9f8eceedae' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/member.html',
- 1 => 1421872896,
+ 1 => 1422350538,
2 => 'file',
),
),
'function' =>
array (
),
+ 'version' => 'Smarty-3.1.21-dev',
+ 'unifunc' => 'content_54c05ab4009233_84144294',
'variables' =>
array (
'haveMember' => 0,
'v' => 0,
),
'has_nocache_code' => false,
- 'version' => 'Smarty-3.1.21-dev',
- 'unifunc' => 'content_54c05ab4009233_84144294',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54c05ab4009233_84144294')) {function content_54c05ab4009233_84144294($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/member/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+ <p>Note: Members will not have access to this tab.</p>
+
<?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
<h2>Edit Member</h2>
<?php } else { ?>
<input type="hidden" name="option" value="addNew">
<?php }?>
- <table class="form-table">
+ <table class="glm-admin-table">
<tr>
<th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['name']) {?>class="glm-required"<?php }?>>Member Name:</th>
<td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['name']) {?>class="glm-form-bad-input"<?php }?>>
</td>
</tr>
<tr>
- <th>Active:</th>
+ <th>Status:</th>
<td>
<select name="status">
<?php $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-22 10:13:18
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-27 02:35:45
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/header.html" */ ?>
<?php /*%%SmartyHeaderCode:124095827254c0496da79607-59867625%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'3ec5bcbe581d6335e06bc6c9474f73121a83d59b' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/header.html',
- 1 => 1421921594,
+ 1 => 1422326142,
2 => 'file',
),
),
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=accommodationTypes" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='accommodationTypes') {?>-active<?php }?>">Accommodation Types</a>
+ <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=amenities" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='amenities') {?>-active<?php }?>">Amenities</a>
+ <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=development" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='development') {?>-active<?php }?>">Development</a>
</h2>
<div id="glm-admin-content-container">
<?php }} ?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-22 05:35:31
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-01 18:26:59
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 => 1421904927,
+ 1 => 1422815211,
2 => 'file',
),
),
'unifunc' => 'content_54c05ab8e47dd3_05464531',
'variables' =>
array (
+ 'haveFilter' => 0,
+ 'filterStatus' => 0,
+ 'filterName' => 0,
'haveMembers' => 0,
'members' => 0,
'i' => 0,
- 'thisURL' => 0,
'm' => 0,
+ 'thisURL' => 0,
+ 'thisPage' => 0,
),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54c05ab8e47dd3_05464531')) {function content_54c05ab8e47dd3_05464531($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/members/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+ <form class="glm-right" onSubmit="return false;">
+ <span<?php if ($_smarty_tpl->tpl_vars['haveFilter']->value) {?> class="glm-notice"<?php }?>><b>List Filters:</b> </span>
+ <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
+ </form>
+
<h2>List of Members</h2>
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
+ <th>Access</th>
<th>Member Name</th>
- <th>Type</th>
+ <th>Member Type</th>
+ <th>Date Created</th>
<th> </th>
</tr>
</thead>
<?php } else { ?>
<tr class="alternate">
<?php }?>
+ <td>
+ <?php echo $_smarty_tpl->tpl_vars['m']->value['access']['name'];?>
+
+ </td>
<td>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
-?page=glm-members-admin-menu-member&glm_action=index&member_id=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
+?page=glm-members-admin-menu-member&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['m']->value['name'];?>
</a>
</td>
<td>
- <?php echo $_smarty_tpl->tpl_vars['m']->value['member_type'];?>
+ <?php echo $_smarty_tpl->tpl_vars['m']->value['member_type']['name'];?>
+
+ </td>
+ <td>
+ <?php echo $_smarty_tpl->tpl_vars['m']->value['created']['date'];?>
</td>
<td>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
-?page=glm-members-admin-menu-member&glm_action=index&member_id=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
+?page=glm-members-admin-menu-member&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
" class="button-primary glm-right">Manage</a>
</td>
</tr>
</tbody>
</table>
+ <?php echo '<script'; ?>
+ type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ // Filter triggers
+ $(".listFilter" ).change( function() {
+
+ var filter = '';
+
+ // Check for pending data filter
+ if ($("#filterPending").attr('checked')) {
+ filter += '&filterPending=true';
+ }
+
+ // Check for member name filter
+ var filterName = $("#filterName").val();
+ if (filterName != '') {
+ filter += '&filterName=' + encodeURIComponent(filterName).replace(/%20/g,'+');
+ }
+
+ window.location.href = "<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=list" + filter;
+
+ return false;
+ });
+ });
+ <?php echo '</script'; ?>
+>
+
+
<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
<?php }} ?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-22 02:04:35
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-02-01 18:25:01
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 => 1421691086,
+ 1 => 1422815090,
2 => 'file',
),
),
'function' =>
array (
),
+ 'version' => 'Smarty-3.1.21-dev',
+ 'unifunc' => 'content_54c05ab4030650_34922061',
'variables' =>
array (
'thisURL' => 0,
'memberID' => 0,
'thisAction' => 0,
'haveMember' => 0,
+ 'haveMemberInfo' => 0,
),
'has_nocache_code' => false,
- 'version' => 'Smarty-3.1.21-dev',
- 'unifunc' => 'content_54c05ab4030650_34922061',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54c05ab4030650_34922061')) {function content_54c05ab4030650_34922061($_smarty_tpl) {?><div class="wrap">
- <h2>Member Information</h2>
+ <h2>Member Data</h2>
<h2 class="nav-tab-wrapper">
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=index&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Dashboard</a>
+&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">Dashboard</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=member&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='member'||!$_smarty_tpl->tpl_vars['haveMember']->value) {?>-active<?php }?>">Member</a>
+&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>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=locations&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='locations') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Locations</a>
+&glm_action=locations&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='locations') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value||!$_smarty_tpl->tpl_vars['haveMemberInfo']->value) {?>disabled<?php }?>">Locations</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=facilities&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='facilities') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Facilities</a>
+&glm_action=facilities&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='facilities') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value||!$_smarty_tpl->tpl_vars['haveMemberInfo']->value) {?>disabled<?php }?>">Facilities</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=attractions&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='attractions') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Attractions</a>
+&glm_action=attractions&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='attractions') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value||!$_smarty_tpl->tpl_vars['haveMemberInfo']->value) {?>disabled<?php }?>">Attractions</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=contacts&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
-" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='contacts') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Contacts</a>
+&glm_action=contacts&member=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='contacts') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value||!$_smarty_tpl->tpl_vars['haveMemberInfo']->value) {?>disabled<?php }?>">Contacts</a>
</h2>
<div id="glm-admin-content-container">
*/
// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataAccommodationTypes.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php');
/*
* This class performs the work for the default action of the "Members" menu
// Compile template data
$templateData = array(
- 'haveRegions' => $haveAccommodationTypes,
+ 'haveAccommodationTypes' => $haveAccommodationTypes,
'accommodationTypes' => $accommodationTypes
);
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Amenitiess List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Amenities data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_configure_amenities extends GlmDataAmenities
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct($this->wpdb, $this->config);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($redirectData = false)
+ {
+
+ $success = true;
+ $haveAmenities = false;
+ $amenities = false;
+ $error = false;
+
+ $newAmenity = $this->newEntry();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($newAmenity, 'DataBlock', 'New Amenity Data');
+ }
+
+ if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
+
+ $amenities = $this->insertEntry();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice(' New Entry Added ', 'Process');
+ }
+ }
+
+ if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['amenityID'])) {
+
+ $id = $_REQUEST['amenityID']-0;
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice(' Entry Deleted: id = '.$id, 'Process');
+ }
+
+ }
+
+ // Check if a amenity ID is supplied
+ if (isset($_REQUEST['amenity_id'])) {
+ // Make sure it's a number
+ $amenityID = $_REQUEST['amenity_id']-0;
+ }
+
+ // Check for action option
+ $option = false;
+ if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+ $option = $_REQUEST['option'];
+ }
+
+ // Get a current list of amenities
+ $amenities = $this->getList();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($amenities, 'DataBlock', 'Amenities Data');
+ }
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveAmenities = false;
+ if ($amenities !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($amenities) > 0) {
+ $haveAmenities = true;
+ }
+ }
+
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($amenities, 'DataBlock', 'Amenities Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveAmenities' => $haveAmenities,
+ 'amenities' => $amenities,
+ 'newAmenity' => $newAmenity
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/configure/amenities.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
*/
// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataCategories.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
/*
* This class performs the work for the default action of the "Members" menu
);
}
+ // Sort results by higherarchy (Parent/Child and Alpha)
+ $categories = glmMembersAdmin::sortParentChild($categories);
+
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($categories, 'DataBlock', 'Categories Data');
}
*/
// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataCities.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
/*
* This class performs the work for the default action of the "Members" menu
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Development
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_configure_development
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($redirectData = false)
+ {
+
+ // Get current database version
+ $dbVersion = GLM_MEMBERS_PLUGIN_DB_VERSION;
+ settype($dbVersion, 'string');
+
+ $resultMessage = '';
+
+ // Load database activation class to get access to database version information
+ require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php');
+ $activate = new glmMembersPluginActivate($this->wpdb, $this->config, true);
+
+ $option = '';
+ if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') {
+ $option = $_REQUEST['option'];
+ }
+
+ switch($option) {
+
+ case 'drop':
+ case 'reset':
+
+ // Read in Database deletion script - assumes the current db version.
+ $sqlFile = GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/drop_database_V'.$dbVersion.'.sql';
+ $sql = file_get_contents($sqlFile);
+
+ // Replace {prefix} with table name prefix
+ $sql = str_replace('{prefix}', GLM_MEMBERS_PLUGIN_DB_PREFIX, $sql);
+
+ // Removing the tables using the script
+ $this->wpdb->query($sql);
+
+ $resultMessage .= 'Database deleted<br>';
+
+ if ($option != 'reset') {
+ break;
+ }
+
+ case 'create':
+
+ // Read in Database creation script
+ $sqlFile = GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/create_database_V'.$dbVersion.'.sql';
+ $sql = file_get_contents($sqlFile);
+
+ // Replace {prefix} with table name prefix
+ $sql = str_replace('{prefix}', GLM_MEMBERS_PLUGIN_DB_PREFIX, $sql);
+
+ // Split script into separate queries by looking for lines with only "---"
+ $queries = preg_split('/^----$/m', $sql);
+
+ // Try executing all queries to build database
+ do {
+ $q = current($queries);
+ $this->wpdb->query($q);
+ $queryError = $this->wpdb->last_error;
+ } while ($queryError == '' && next($queries));
+
+ // If there were no errors
+ if (trim($queryError) == '') {
+
+ // Notify the user that the database has been installed
+ $resultMessage .= 'New database tables installed for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin.<br>';
+
+ // Save the version of the installed database
+ update_option('glmMembersDatabaseDbVersion', $dbVersion);
+
+
+ } else {
+ $resultMessage .= 'Failure installing database tables for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin.<br>';
+ $resultMessage .= '<b>Database Installation Error:</b> <br>';
+ }
+
+ break;
+
+ case 'list':
+
+ // Check if the database version set for this plugin is invalid.
+ if (!isset($activate->dbVersions[$dbVersion])) {
+ $resultMessage .= "The last database version set for the ".GLM_MEMBERS_PLUGIN_NAME." (V$dbVersion) isn't valid.<br>";
+ break;
+ }
+
+ // Get the number of tables for this plugin database version that should exist.
+ $tables = $activate->dbVersions[$dbVersion]['tables'];
+
+ // Get the number of tables for this plugin that do currently exist.
+ $existingTables = $this->wpdb->get_results("
+ SELECT table_name
+ FROM information_schema.tables
+ WHERE table_name like '".GLM_MEMBERS_PLUGIN_DB_PREFIX."%';
+ ", ARRAY_A);
+
+ if (is_array($existingTables)) {
+ $resultMessage .= '<b>Current database tables</b><br><ul>';
+ foreach($existingTables as $t){
+ $resultMessage .= "<li>".$t['table_name'].'</li><br>';
+ }
+ $resultMessage .= '</ul>';
+ } else {
+ $resultMessage .= '<b>No tables currently exist</b><br>';
+ }
+
+ break;
+
+ default:
+
+ break;
+
+ }
+
+
+ $templateData = array(
+ 'resultMessage' => $resultMessage
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/configure/development.html',
+ 'data' => $templateData
+ );
+
+ }
+
+}
+
+?>
\ No newline at end of file
*/
// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMemberTypes.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php');
/*
* This class performs the work for the default action of the "Members" menu
*/
// Load Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataRegions.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php');
/*
* This class performs the work for the default action of the "Members" menu
*/
// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMembers.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
/*
* This class performs the work for the default action of the "Members" menu
$haveMember = false;
$memberData = false;
$memberID = 0;
- $deleted = false;
+ $archived = false;
+ $updated = false;
+ $haveMemberInfo = false;
+
+ // Check for required Member Types
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php');
+ $MemberTypes = new GlmDataMemberTypes($this->wpdb, $this->config);
+ $memberTypesStats = $MemberTypes->getStats();
+ $haveMemberTypes = ($memberTypesStats > 0);
// Check if a redirecting model supplied the member ID
if (isset($redirectData['memberID'])) {
$memberID = $redirectData['memberID'];
- // Otherwise check if one was supplied by the user
- } elseif (isset($_REQUEST['member_id'])) {
+ // Otherwise check if one was supplied by the user or passed from somewhere else
+ } elseif (isset($_REQUEST['id'])) {
// Make sure it's a number
- $memberID = $_REQUEST['member_id']-0;
+ $memberID = $_REQUEST['id']-0;
+ } elseif (isset($_REQUEST['member'])) {
+ $memberID = $_REQUEST['member']-0;
}
- // If we don't have a member ID, assume this is to add a member and go do that
+ // If we don't have a member ID, setup to add a new member
if ($memberID <= 0) {
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice(' No member ID supplied.', 'Process');
+ // If this is a new member submission
+ if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
+
+ // Attempt to add the new member
+ $memberData = $this->insertEntry();
+ if($memberData['status']) {
+ $memberID = $memberData['fieldData']['id'];
+ $haveMember = true;
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice(' Added new member: ID = '.$memberID, 'Process');
+ glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data');
+ }
+
+
+ // Otherwise setup to get new mmember data
+ } else {
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice(' No member ID supplied.', 'Process');
+ }
+
+ // Setup to add a new member
+ $memberData = $this->newEntry();
}
- return array(
- 'status' => $success,
- 'menuItemRedirect' => false,
- 'modelRedirect' => 'member',
- 'view' => 'admin/member/member.html',
- 'data' => array(
- 'haveMember' => false,
- )
- );
- }
+ // Otherwise if this is a member update
+ } elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice("<b> Member ID specified:</b> $memberID", 'Process');
- }
+ $memberData = $this->updateEntry($memberID);
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> Member Update:</b> $memberID", 'Process');
+ }
- // If a delete request has been made, try to delete the member without confirmation
- if(isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete') {
- $memberData = $this->deleteEntry($memberID, true);
- $deleted = $memberData['deleteConfirmed'];
- $memberID = 0;
- $haveMember = false;
+ // If update was successful then use editEntry() to setup for the edit again.
+ if ($memberData['status']) {
+ $memberData = $this->editEntry($memberID);
+ $updated = true;
+ }
+
+ $haveMember = true;
+ // Otherwise, have a member, get the base member data
} else {
- // Try to get existing member data
- $memberData = $this->getEntry($memberID);
- }
- // Check that we have data for the specified member ID
- if (!$deleted && $memberData !== false) {
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> Member ID specified:</b> $memberID", 'Process');
+ }
+
+ // Try to get existing member data
+ $memberData = $this->editEntry($memberID);
$haveMember = true;
+
}
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data');
}
+ // If we have a member then also get a list of member info records
+ $haveInfoRecords = false;
+ $memberInfoRecords = false;
+ if ($haveMember) {
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+ $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
+ $memberInfoRecords = $MemberInfo->getList($memberID);
+
+ // Check if any members returned
+ if (is_array($memberInfoRecords) && count($memberInfoRecords) > 0) {
+ $haveInfoRecords = true;
+ }
+ }
+
// Compile template data
$templateData = array(
+ 'haveMemberTypes' => $haveMemberTypes,
'haveMember' => $haveMember,
'memberID' => $memberID,
'member' => $memberData,
- 'deleted' => $deleted
+ 'haveInfoRecords' => $haveInfoRecords,
+ 'memberInfoRecords' => $memberInfoRecords,
+ 'haveMemberInfo' => $haveMemberInfo,
+ 'updated' => $updated
);
// Return status, suggested view, and data to controller
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Member Basic Info Edit
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Members data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct($this->wpdb, $this->config);
+
+ // Add scrips and css
+ add_action('glm_members_memberInfo_enqueue_scripts',
+ array(
+ $this,
+ 'glmMembersMemberInfoScripts'
+ )
+ );
+
+
+ }
+
+ /**
+ * Setup inclusion of needed scripts
+ *
+ * This method is called by an add_action() hook setup in the contructor.
+ *
+ * (no prameters)
+ *
+ * @return void
+ * @access public
+ */
+ public function glmMembersMemberInfoScripts ()
+ {
+/* Not working at this time
+ // Enqueue Geolocation Edit Script
+ wp_register_script('glm-members-geo-js',
+ GLM_MEMBERS_PLUGIN_URL . 'js/geolocation-edit/jquery.geolocation.edit.0.0.11.js',
+ array(
+ 'jquery'
+ )
+ );
+ wp_enqueue_script('glm-members-geo-js');
+*/
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($redirectData = false)
+ {
+
+ $success = true;
+ $memberID = 0;
+ $haveMember = false;
+ $memberInfoID = 0;
+ $haveMemberInfo = 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
+ $option = false;
+ if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+ $option = $_REQUEST['option'];
+ }
+
+ // Get supplied member ID
+ if (isset($_REQUEST['member'])) {
+ $memberID = $_REQUEST['member']-0;
+ }
+
+ // If member ID not supplied - we shouldn't be here
+ if ($memberID <= 0) {
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> Member ID expected but no ID was supplied.", 'Alert');
+ }
+
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+
+ // Otherwise get member base data
+ } else {
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
+ $Members = new GlmDataMembers($this->wpdb, $this->config);
+ $memberData = $Members->getEntry($memberID);
+ $haveMember = true;
+ }
+
+ // Get member info record ID
+ if (isset($_REQUEST['member_info_id'])) {
+ $memberInfoID = $_REQUEST['member_info_id']-0;
+ $haveMemberInfo = true;
+ }
+
+ // If no member info record, assume that we need to create the first record
+ if ($memberInfoID <= 0 && $option != 'addNew') {
+ $option = 'create';
+ }
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> Option specified:</b> $option", 'Process');
+ }
+
+ // Perform requested option
+ switch ($option) {
+
+ case 'new':
+
+ $MemberInfo = $this->newEntry();
+
+ break;
+
+ case 'submit':
+
+ if ($haveMemberInfo) {
+ // Update the member data
+ $MemberInfo = $this->updateEntry($memberID);
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> No member information exists, assuming this is a new submission.", 'Process');
+ }
+
+ break;
+ }
+
+ case 'addNew':
+
+ // Insert the new member into the database
+ $MemberInfo = $this->insertEntry();
+
+ break;
+
+ case 'create':
+
+ $MemberInfo = $this->newEntry();
+
+ break;
+
+ default:
+
+ // Edit the existing member
+ $MemberInfo = $this->getEntry($memberInfoID);
+
+ // If we have member data, say so
+ if (is_array($MemberInfo) && $MemberInfo['status']) {
+ $haveMemberInfo = true;
+
+ // Otherwise
+ } else {
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice("<b> Specified Member Information Record ID is invalid:</b> $memberInfoID", 'Alert');
+ }
+
+ $error = true;
+
+ }
+
+ break;
+
+
+
+ }
+
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($MemberInfo, 'DataBlock', 'Member Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'haveMember' => $haveMember,
+ 'memberID' => $memberID,
+ 'member' => $memberData,
+ 'haveMemberInfo' => $haveMemberInfo,
+ 'memberInfoID' => $memberInfoID,
+ 'memberInfo' => $MemberInfo,
+ 'haveCategories' => $haveCategories,
+ 'categories' => $categories
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/member/memberInfo.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
*/
// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMembers.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
/*
* This class performs the work for the default action of the "Members" menu
* option, which is to display the members dashboard.
*
*/
-class GlmMembersAdmin_members_index extends GlmDataMembers
+class GlmMembersAdmin_members_index extends GlmDataMemberInfo
{
/**
{
$success = true;
- // Get a current list of members
+ // Get stats on the current list of members
$stats = $this->getStats();
-/*
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($stats, 'DataBlock', 'Member Data');
- }
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveMembers = false;
- if ($list !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($list) > 0) {
- $haveMembers = true;
- }
- }
-
- // Determine if current user can add, edit, delete member data
- $canEdit = current_user_can('glm_members_edit');
-*/
+ // Check for required Member Types
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php');
+ $MemberTypes = new GlmDataMemberTypes($this->wpdb, $this->config);
+ $memberTypesStats = $MemberTypes->getStats();
+ $haveMemberTypes = ($memberTypesStats > 0);
+
+ // Check for required Categories
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+ $Categories = new GlmDataCategories($this->wpdb, $this->config);
+ $categoriesStats = $Categories->getStats();
+ $haveCategories = ($categoriesStats > 0);
+
+ // Check for required Regions
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php');
+ $Regions = new GlmDataRegions($this->wpdb, $this->config);
+ $regionsStats = $Regions->getStats();
+ $haveRegions = ($regionsStats > 0);
+
+ // Check for required Accommodation Types
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php');
+ $AccommodationTypes = new GlmDataAccommodationTypes($this->wpdb, $this->config);
+ $accommodationTypesStats = $AccommodationTypes->getStats();
+ $haveAccommodationTypes = ($accommodationTypesStats > 0);
+
+ // Get number of members with pending updates
+ $membersPending = $this->getStats('status = '.$this->config['status_numb']['Pending']);
// Compile template data
$templateData = array(
- 'numbMembers' => $stats
+ 'numbMembers' => $stats,
+ 'membersPending' => $membersPending,
+ 'haveMemberTypes' => $haveMemberTypes,
+ 'haveCategories' => $haveCategories,
+ 'haveRegions' => $haveRegions,
+ 'haveAccommodationTypes' => $haveAccommodationTypes
);
// Return status, suggested view, and data to controller
*/
// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMembers.php');
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
/*
* This class performs the work for the default action of the "Members" menu
*/
public function modelAction ($redirectData = false)
{
+ $where = '';
+ $filterStatus = false;
+ $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%'";
+ $haveFilter = true;
+ }
// Get a current list of members
- $list = $this->getList();
+ $list = $this->getList($where);
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data');
}
// Determine if current user can add, edit, delete member data
- $canEdit = current_user_can('glm_members_edit');
+// $canEdit = current_user_can('glm_members_edit');
// Compile template data
$templateData = array(
'haveMembers' => $haveMembers,
'members' => $list,
- 'canEdit' => $canEdit
+ 'haveFilter' => $haveFilter,
+ 'filterStatus' => $filterStatus,
+ 'filterName' => stripslashes($filterName)
+// 'canEdit' => $canEdit
);
// Return status, suggested view, and data to controller
<input type="hidden" name="glm_action" value="accommodationTypes">
<input type="hidden" name="option" value="addNew">
- <table class="form-table">
+ <table class="glm-admin-table">
<tr>
<th class="glm-required">Accommodation Type Name:</th>
<td>
--- /dev/null
+{include file='admin/configure/header.html'}
+
+ <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>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th class="glm-required">Facility Type:</th>
+ <td>
+ <select 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 type="checkbox" name="uses_value"></td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <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="newAmenityCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new Amenity">
+
+ </form>
+ </div>
+ <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>
+ </center>
+ </div>
+
+
+ <h2>Amenities</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>Amenity</th>
+ <th>Facility Type</th>
+ <th>Uses Value</th>
+ <th>Description</th>
+ <th>Short Description</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+{if $haveAmenities}
+ {assign var="i" value="0"}
+ {foreach $amenities as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ {$t.name}
+ </td>
+ <td>
+ {$t.facility_type.name}
+ </td>
+ <td>
+ {$t.uses_value.name}
+ </td>
+ <td>
+ {$t.descr}
+ </td>
+ <td>
+ {$t.short_descr}
+ </td>
+ <td>
+ <div class="deleteAmenityButton button-primary glm-right" data-amenityID="{$t.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+{else}
+ <tr class="alternate"><td colspan="2">(no amenities listed)</td></tr>
+{/if}
+ </tbody>
+ </table>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newAmenityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteAmenityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newAmenityButton').click( function() {
+ $("#newAmenityDialog").dialog("open");
+ });
+ $('#newAmenityCancel').click( function() {
+ $("#newAmenityDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteAmenityButton').click( function() {
+ id = $(this).attr('data-amenityID');
+ $("#deleteAmenityDialog").dialog("open");
+ });
+ $('#deleteAmenityConfirm').click( function() {
+ $("#deleteAmenityDialog").dialog("close");
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=amenities&option=delete&amenityID=" + id;
+ });
+ $('#deleteAmenityCancel').click( function() {
+ $("#deleteAmenityDialog").dialog("close");
+ });
+
+ });
+ </script>
+
+{include file='admin/footer.html'}
<input type="hidden" name="glm_action" value="categories">
<input type="hidden" name="option" value="addNew">
- <table class="form-table">
+ <table class="glm-admin-table">
<tr>
<th class="glm-required">Category Name:</th>
<td>
<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>
<thead>
<tr>
<th>Category</th>
- <th>Parent</th>
<th>Description</th>
<th>Short Description</th>
<th> </th>
<tr class="alternate">
{/if}
<td>
- {$t.name}
- </td>
- <td>
- {$t.parent}
+ <span{if $t.parent.value} class="glm-indent"{/if}>
+ {$t.name}
+ </span>
</td>
<td>
{$t.descr}
<input type="hidden" name="glm_action" value="cities">
<input type="hidden" name="option" value="addNew">
- <table class="form-table">
+ <table class="glm-admin-table">
<tr>
<th class="glm-required">City Name:</th>
<td>
--- /dev/null
+{include file='admin/configure/header.html'}
+
+ <p>Note: Customers will not have access to this tab.</p>
+
+ <h2>Development Activities</h2>
+
+ <ul>
+ <li>
+ <H3>Database</H3>
+ <ul>
+ <li><a href="{$thisURL}?page={$thisPage}&glm_action=development&option=drop">Drop database tables</a> (WARNING: Destroys all current data)</li>
+ <li><a href="{$thisURL}?page={$thisPage}&glm_action=development&option=create">Create database tables</a></li>
+ <li><a href="{$thisURL}?page={$thisPage}&glm_action=development&option=reset">Fully Reset Database (drop/create)</a> (WARNING: Destroys all current data)</li>
+ <li><a href="{$thisURL}?page={$thisPage}&glm_action=development&option=list">List database tables</a></li>
+ </ul>
+ </li>
+ </ul>
+{if $resultMessage}
+ <div>
+ <h3>Results</h3>
+ {$resultMessage}
+ </div>
+{/if}
+
+{include file='admin/footer.html'}
<a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==cities}-active{/if}">Cities</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=regions" class="nav-tab{if $thisAction==regions}-active{/if}">Regions</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=accommodationTypes" class="nav-tab{if $thisAction==accommodationTypes}-active{/if}">Accommodation Types</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=amenities" class="nav-tab{if $thisAction==amenities}-active{/if}">Amenities</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=development" class="nav-tab{if $thisAction==development}-active{/if}">Development</a>
</h2>
<div id="glm-admin-content-container">
\ No newline at end of file
<input type="hidden" name="glm_action" value="memberTypes">
<input type="hidden" name="option" value="addNew">
- <table class="form-table">
+ <table class="glm-admin-table">
<tr>
<th class="glm-required">Member Type Name:</th>
<td>
<input type="hidden" name="glm_action" value="regions">
<input type="hidden" name="option" value="addNew">
- <table class="form-table">
+ <table class="glm-admin-table">
<tr>
<th class="glm-required">Region Name:</th>
<td>
<div class="wrap">
- <h2>Member Information</h2>
+ <h2>Member Data</h2>
<h2 class="nav-tab-wrapper">
- <a href="{$thisURL}?page={$thisPage}&glm_action=index&member_id={$memberID}" class="nav-tab{if $thisAction==index}-active{/if} {if !$haveMember}disabled{/if}">Dashboard</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=member&member_id={$memberID}" class="nav-tab{if $thisAction==member || !$haveMember}-active{/if}">Member</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=locations&member_id={$memberID}" class="nav-tab{if $thisAction==locations}-active{/if} {if !$haveMember}disabled{/if}">Locations</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=facilities&member_id={$memberID}" class="nav-tab{if $thisAction==facilities}-active{/if} {if !$haveMember}disabled{/if}">Facilities</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=attractions&member_id={$memberID}" class="nav-tab{if $thisAction==attractions}-active{/if} {if !$haveMember}disabled{/if}">Attractions</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=contacts&member_id={$memberID}" class="nav-tab{if $thisAction==contacts}-active{/if} {if !$haveMember}disabled{/if}">Contacts</a>
+ <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=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>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=contacts&member={$memberID}" class="nav-tab{if $thisAction==contacts}-active{/if} {if !$haveMember || !$haveMemberInfo}disabled{/if}">Contacts</a>
</h2>
<div id="glm-admin-content-container">
{include file='admin/member/header.html'}
- {if !$deleted}
- <div id="deleteMemberButton" class="button-primary glm-right">Delete this Member</div>
- <div id="deleteMemberDialog" class="glm-dialog-box" title="Delete Member">
- <center>
- <p>Are you sure you want to delete this member?</p>
- <p><div id="deleteMemberConfirm" class="button-primary">Yes, delete this member</div></p>
- <p><div id="deleteMemberCancel" class="button-primary">No, I don't want to delete this member</div></p>
- </center>
- </div>
- {/if}
-
- <h2>{$member.name}</h2>
+{if $haveMemberTypes}
- <h3 class="glm-notice"></h3>
-
- <table>
- <tr>
- <th class="glm-table-fieldname">Status</th>
- <td{if $member.status.name == 'Pending Review'} class="glm-notice"{elseif $member.status.name == 'Active'} class="glm-active"{/if}>
- {$member.status.name}
- </td>
- </tr>
- <tr><th class="glm-table-fieldname">Member Name:</th><td>{$member.name}</td></tr>
- <tr><th class="glm-table-fieldname">Type:</th><td>{$member.member_type}</td></tr>
- <tr><th class="glm-table-fieldname">Description:</th><td>{$member.descr}</td></tr>
- <tr><th class="glm-table-fieldname">Short Description:</th><td>{$member.short_descr}</td></tr>
- </table>
-
- <script type="text/javascript">
- jQuery(document).ready(function($) {
- $("#deleteMemberDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $('#deleteMemberButton').click( function() {
- $("#deleteMemberDialog").dialog("open");
- });
- $('#deleteMemberConfirm').click( function() {
- $("#deleteMemberDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=index&option=delete&member_id={$memberID}";
- });
- $('#deleteMemberCancel').click( function() {
- $("#deleteMemberDialog").dialog("close");
- });
+ {if $updated}
+ <h3 class="glm-notice glm-right">Record Updated</h3>
+ {/if}
+
+ <h2>
+ {if $haveMember}
+ {$member.fieldData.name}
+ {else}
+ Add New Member
+ {/if}
+ </h2>
- });
- </script>
+
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="index">
+ {if $haveMember}
+ <input type="hidden" name="option" value="submit">
+ <input type="hidden" name="id" value="{$member.fieldData.id}">
+ <input type="hidden" name="created" value="{$member.fieldData.created.date}">
+ {else}
+ <input type="hidden" name="option" value="addNew">
+ <input type="hidden" name="created" value="today">
+ {/if}
+ <table class="glm-admin-table">
+ <tr>
+ <th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
+ <td {if $member.fieldFail.name}class="glm-form-bad-input"{/if}>
+ <input type="text" name="name" value="{$member.fieldData.name}" class="glm-form-text-input">
+ {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th {if $member.fieldRequired.access}class="glm-required"{/if}>Access:</th>
+ <td {if $member.fieldFail.access}class="glm-form-bad-input"{/if}>
+ <select name="access">
+ {foreach from=$member.fieldData.access.list item=v}
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
+ {/foreach}
+ </select>
+ {if $member.fieldFail.access}<p>{$member.fieldFail.access}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th {if $member.fieldRequired.member_type}class="glm-required"{/if}>Member Type:</th>
+ <td {if $member.fieldFail.member_type}class="glm-form-bad-input"{/if}>
+ <select name="member_type">
+ {foreach from=$member.fieldData.member_type.list item=v}
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
+ {/foreach}
+ </select>
+ {if $member.fieldFail.member_type}<p>{$member.fieldFail.member_type}</p>{/if}
+ </td>
+ </tr>
+ {if $haveMember}
+ <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>
+ {/if}
+
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ {if $haveMember}
+ <input type="submit" value="Update member">
+ {else}
+ <input type="submit" value="Add new member">
+ {/if}
+ </form>
+
+ {if $haveMember}
+ {if $haveInfoRecords}
+ <h3>Member Information Versions</h3>
+ <table class="wp-list-table widefat fixed posts glm-admin-table"">
+ <thead>
+ <tr>
+ <th>Access:</th>
+ <th>Created</th>
+ <th>Last Update</th>
+ </tr>
+ </thead>
+ <tbody>
+ {assign var="i" value="0"}
+ {foreach $memberInfoRecords as $m}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>{$m.status.name}</td>
+ <td>{$m.create_time.time}</td>
+ <td>{$m.modify_time.time}</td>
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+ {else}
+ <h3 class="glm-notice">You do not yet have any member information entered.</h3>
+ <p><a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}">Click here too start entering information for this member.</a></p>
+ {/if}
+ {/if}
+
+{else}
+ <h3 class="glm-error">You do not have any Member Types setup.</h3>
+ <p>You must have at least one Member Type to add a new member.</p>
+ <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
+{/if}
+
{include file='admin/footer.html'}
--- /dev/null
+{include file='admin/member/header.html'}
+
+ {if $haveMemberInfo}
+ <h2>Edit Member Information</h2>
+ {else}
+ <h2>Add New Member Information</h2>
+ {/if}
+
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="memberInfo">
+ <input type="hidden" name="member" value="{$member.id}">
+ {if $haveMemberInfo}
+ <input type="hidden" name="option" value="submit">
+ {else}
+ <input type="hidden" name="option" value="addNew">
+ {/if}
+
+ <table class="glm-admin-table">
+ <tr>
+ <th>Member Name:</th>
+ <td>{$member.name}</td>
+ </tr>
+ <tr>
+ <th>Member Type:</th>
+ <td>{$member.member_type.name}</td>
+ </tr>
+ <tr>
+ <th>Access:</th>
+ <td>{$member.access.name}</td>
+ </tr>
+ <tr><td colspan="2"> </td></tr>
+ <tr>
+ <th>Member Info Status:</th>
+ <td>
+ <select name="status">
+ {foreach from=$memberInfo.fieldData.status.list item=v}
+ <option value="{$v.value}"{if $v.default} selected{/if}>{$v.name}</option>
+ {/foreach}
+ </select>
+ {if $memberInfo.fieldFail.status}<p>{$memberInfo.fieldFail.status}</p>{/if}
+ </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>
+ </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}
+ </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>
+ {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">
+ {if $memberInfo.fieldFail.short_descr}<p>{$memberInfo.fieldFail.short_descr}</p>{/if}
+ </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">
+ {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">
+ {if $memberInfo.fieldFail.addr2}<p>{$memberInfo.fieldFail.addr2}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th>City</th>
+ <td class="glm-item-container">
+ <!-- Add new city dialog -->
+ <div id="newCityButton" class="button-primary glm-right">Add a new City</div>
+ <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">City Name:</th>
+ <td id="newCityNameTD">
+ <input id="newCityName" type="text" name="newCityName" class="glm-form-text-input">
+ <div id="newCityNameRequired"></div>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newCityCancel" class="button-primary glm-right">Cancel</a>
+ <input id="newCitySubmit" type="submit" value="Add new City">
+ </div>
+ <!-- City Selection -->
+ <select name="city" id="city">
+ {foreach from=$memberInfo.fieldData.city.list item=v}
+ <option value="{$v.value}">
+ {$v.name}
+ </option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <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">
+ {foreach from=$memberInfo.fieldData.state.list item=v}
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+ {$v.name}
+ </option>
+ {/foreach}
+ </select>
+ {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">
+ {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">
+ {foreach from=$memberInfo.fieldData.country.list item=v}
+ <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+ {$v.name}
+ </option>
+ {/foreach}
+ </select>
+ {if $memberInfo.fieldFail.country}<p>{$memberInfo.fieldFail.country}</p>{/if}
+ </td>
+ </tr>
+ <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
+ <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>
+-->
+ </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">
+ {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">
+ {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.fieldFail.url}<p>{$memberInfo.fieldFail.url}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th {if $memberInfo.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
+ <td {if $memberInfo.fieldFail.logo}class="glm-form-bad-input"{/if}>
+ <input type="text" name="logo" value="{$memberInfo.fieldData.logo}" class="glm-form-text-input">
+ {if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <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>
+ {/foreach}
+ {if $memberInfo.fieldFail.cc_type}<p>{$memberInfo.fieldFail.cc_type}</p>{/if}
+ </td>
+ </tr>
+ <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>
+ {if $memberInfo.fieldFail.notes}<p>{$memberInfo.fieldFail.notes}</p>{/if}
+ </td>
+ </tr>
+ <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>
+ {/if}
+ <input type="file" name="logo">
+ {if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}
+ </td>
+ </tr>
+
+
+
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <input type="submit" name="Add new member">
+ </form>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ /*
+ * Category Selection
+ */
+
+ // Action to select a category
+ $('#categorySelect').change( function() {
+
+ // Get the ID and name of the category
+ var catValue = $('#categorySelect').val();
+ var catName = $('#categorySelect').find(':selected').text();
+
+ // Check if the category has already been added
+ var found = false;
+ $(".glm-members-catgegory").each( function() {
+ var id = $(this).attr('data-id');
+ if (id == catValue) {
+ found = true;
+ }
+ });
+
+ // 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>'
+ + '<input type="hidden" name="category[' + catValue + ']" value="' + catValue + '"></div>');
+ }
+
+ // Reset picklist
+ $('#categorySelect').val('');
+
+ });
+
+ // Action to de-select a category
+ $('.catDelete').live('click', function() {
+ var id = $(this).attr('data-id');
+ $(".glm-members-category, [data-id='" + id + "']").remove();
+ });
+
+ /*
+ * New Category Dialog
+ */
+
+ var newCat = 0; // Used for new category numbering (new cats are negative numbers)
+
+ // Setup dialog box for adding a new category
+ $("#newCategoryDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ // Ad a new category button action - pop-up dialog
+ $('#newCategoryButton').click( function() {
+ $("#newCategoryDialog").dialog("open");
+ });
+
+ // Submit new category
+ $('#newCategorySubmit').click( function() {
+
+ // Assign new cat number
+ newCat--;
+
+ // Get new category information
+ var newCatName = $('#newCatName').val();
+ var newCatParent = $('#newCatParent').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;
+ }
+
+ // 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>'
+ + '<input type="hidden" name="category[' + newCat + ']" value="' + newCat + '">'
+ + '<input type="hidden" name="newCategory[' + newCat + ']" value="' + newCatName + '">'
+ + '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
+ + '</div>');
+
+ // Clear the dialog input fields
+ $('#newCatName').val('');
+ $('#newCatParent').val('');
+
+ $("#newCategoryDialog").dialog("close");
+
+ });
+ $('#newCategoryCancel').click( function() {
+ $("#newCategoryDialog").dialog("close");
+ });
+
+ // Setup dialog box for adding a new category
+ $("#newCategoryDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ /*
+ * New City Dialog
+ */
+
+ // Setup dialog box for adding a new city
+ $("#newCityDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $('#newCityCancel').click( function() {
+ $("#newCityDialog").dialog("close");
+ });
+
+ // Ad a new city button action - pop-up dialog
+ $('#newCityButton').click( function() {
+ $("#newCityDialog").dialog("open");
+ });
+
+ // Submit new city
+ var newCityAdded = false;
+ $('#newCitySubmit').click( function() {
+
+ // Get new city name
+ var newCityName = $('#newCityName').val();
+
+ // If no name is supplied, notify used it's required
+ if (newCityName == '') {
+ $('#newCityNameTD').addClass('glm-form-bad-input');
+ $('#newCityNameRequired').text('A city name is required!');
+ return false;
+ }
+
+ // Add new city name to picklist and for storing - Only one permitted per submission
+ if (newCityAdded) {
+
+ // New city already added, so just update the name and select that one
+ $('#city').val(-1);
+ $('#city option:selected').text(newCityName);
+
+ } else {
+
+ // Add the new city name to the city picklist
+ $('#city').append('<option value="-1">' + newCityName + '</option>');
+ $('#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");
+ });
+
+
+ /*
+ * Map operations
+ */
+
+ // 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"
+ }
+
+ });
+ */
+ });
+ </script>
+
+
+{include file='admin/footer.html'}
<h2 class="nav-tab-wrapper">
<a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">Dashboard</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=list" class="nav-tab{if $thisAction==list}-active{/if}">List of Members</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==add}-active{/if}">Reports</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==add}-active{/if} disabled">Reports</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==edit}-active{else} disabled{/if}">Or Something - perahps mailing stuff?</a>
</h2>
<div id="glm-admin-content-container">
<h2>Members Dashboard</h2>
+ <table class="glm-admin-table">
+{if !$haveMemberTypes}
+ <tr>
+ <th class="glm-error">You do not have any Member Types setup.</th>
+ <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types.</a></td>
+ </tr>
+{/if}
+{if !$haveCategories}
+ <tr>
+ <th><span class="glm-error">You do not have any Member Categories setup.</span></th>
+ <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=categories">Click here to add Member Categories.</a></td>
+ </tr>
+{/if}
+{if !$haveRegions}
+ <tr>
+ <th><span class="glm-error">You do not have any Regions setup.</span></th>
+ <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=regions">Click here to add Regions.</a></td>
+ </tr>
+{/if}
+{if !$haveAccommodationTypes}
+ <tr>
+ <th><span class="glm-error">You do not have any AccommodationTypes setup.</span></th>
+ <td><a href="{$thisURL}?page=glm-members-admin-menu-configure&glm_action=accommodationTypes">Click here to add AccommodationTypes.</a></td>
+ </tr>
+{/if}
{if $numbMembers == 0}
- <p>
- <span class="glm-error">You do not currently have any members listed.</span>
- <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=member&member_id=">Click here to create your first member.</a>
- </p>
+ <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>
+ </tr>
{/if}
+ </table>
- <table>
+ <table class="glm-admin-table">
<tr><th>Number of Members Listed: </th><td>{$numbMembers}</td></tr>
+ <tr><th{if $membersPending} class="glm-notice"{/if}>Member Pending Data: </th><td>{$membersPending}</td></tr>
</table>
{include file='admin/footer.html'}
+
{include file='admin/members/header.html'}
+ <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
+ </form>
+
<h2>List of Members</h2>
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
+ <th>Access</th>
<th>Member Name</th>
- <th>Type</th>
+ <th>Member Type</th>
+ <th>Date Created</th>
<th> </th>
</tr>
</thead>
<tr class="alternate">
{/if}
<td>
- <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member_id={$m.id}">{$m.name}</a>
+ {$m.access.name}
+ </td>
+ <td>
+ <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}">{$m.name}</a>
</td>
<td>
- {$m.member_type}
+ {$m.member_type.name}
</td>
<td>
- <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member_id={$m.id}" class="button-primary glm-right">Manage</a>
+ {$m.created.date}
+ </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>
</tr>
{/foreach}
</tbody>
</table>
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ // Filter triggers
+ $(".listFilter" ).change( function() {
+
+ var filter = '';
+
+ // Check for pending data filter
+ if ($("#filterPending").attr('checked')) {
+ filter += '&filterPending=true';
+ }
+
+ // Check for member name filter
+ var filterName = $("#filterName").val();
+ if (filterName != '') {
+ filter += '&filterName=' + encodeURIComponent(filterName).replace(/%20/g,'+');
+ }
+
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=list" + filter;
+
+ return false;
+ });
+ });
+ </script>
+
+
{include file='admin/footer.html'}