* @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 GlmDataAccommodationTypes extends GlmDataAbstract
{
* @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
{
* @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 GlmDataCategories extends GlmDataAbstract
{
* @license http://www.gaslightmedia.com Gaslightmedia
* @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
* Exp $
- * @link http://www.visitgreatlakesbay.org/
*/
class GlmDataCategoryMemberInfo extends GlmDataAbstract
{
* @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 GlmDataCities extends GlmDataAbstract
{
* @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
{
* @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 GlmDataMemberTypes extends GlmDataAbstract
{
* @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 GlmDataMembers extends GlmDataAbstract {
* @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 GlmDataRegions extends GlmDataAbstract
{
--- /dev/null
+<?php
+
+/**
+ * GLM Member-DB WordPress Plugin
+ * General Settings 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: dataSettingsGeneral.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * EventManagementDataSettingsGeneral 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 $
+ */
+class GlmDataSettingsGeneral 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)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'settings_general';
+
+ /*
+ * Table Data Fields
+ */
+ $this->fields = array(
+
+ 'id' => array(
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ /*
+ * Debug Options
+ */
+
+ // Adming Debug
+ 'admin_debug' => array(
+ 'field' => 'admin_debug',
+ 'type' => 'boolean',
+ 'use' => 'a'
+ ),
+
+ // Adming Debug Verbose
+ 'admin_debug_verbose' => array(
+ 'field' => 'admin_debug_verbose',
+ 'type' => 'boolean',
+ 'use' => 'a'
+ ),
+
+ // Front-end Debug
+ 'front_debug' => array(
+ 'field' => 'front_debug',
+ 'type' => 'boolean',
+ 'use' => 'a'
+ ),
+
+ // Front-end Debug Verbose
+ 'front_debug_verbose' => array(
+ 'field' => 'front_debug_verbose',
+ 'type' => 'checkbox',
+ 'use' => 'a'
+ ),
+
+ /*
+ * Google Maps
+ */
+
+ // Google Maps API Key
+ 'google_maps_api_key' => array(
+ 'field' => 'google_maps_api_key',
+ 'type' => 'text',
+ 'use' => 'lg'
+ ),
+
+ // Google Maps Default Latitude
+ 'maps_default_lat' => array(
+ 'field' => 'maps_default_lat',
+ 'type' => 'float',
+ 'use' => 'a'
+ ),
+
+ // Google Maps Default Longitude
+ 'maps_default_lon' => array(
+ 'field' => 'maps_default_lon',
+ 'type' => 'float',
+ 'use' => 'a'
+ ),
+
+ /*
+ * Misc Settings
+ */
+
+ // Time Zone
+ 'time_zone' => array(
+ 'field' => 'time_zone',
+ 'type' => 'text',
+ 'use' => 'lg'
+ ),
+
+ /*
+ * Front-end Member Search Options
+ */
+
+ // Front-end Listings - Show Map
+ 'list_show_map' => array(
+ 'field' => 'list_show_map',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show List
+ 'list_show_list' => array(
+ 'field' => 'list_show_list',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Search Form
+ 'list_show_search' => array(
+ 'field' => 'list_show_search',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Search Text
+ 'list_show_search_text' => array(
+ 'field' => 'list_show_search_text',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Search Category
+ 'list_show_search_category' => array(
+ 'field' => 'list_show_search_category',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Search Amenities
+ 'list_show_search_amenities' => array(
+ 'field' => 'list_show_search_amenities',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Search Alpha
+ 'list_show_search_alpha' => array(
+ 'field' => 'list_show_search_alpha',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ /*
+ * Front-end Member Listing Options
+ */
+
+ // Front-end Listings - Show Detail Link
+ 'list_show_detail_link' => array(
+ 'field' => 'list_show_detail_link',
+ 'type' => 'checkbox',
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Logo
+ 'list_show_logo' => array(
+ 'field' => 'list_show_logo',
+ 'type' => 'checkbox',
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Logo Size
+ 'list_logo_size' => array(
+ 'field' => 'list_logo_size',
+ 'type' => 'list',
+ 'list' => $this->config['image_sizes'],
+ 'required' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Address
+ 'list_show_address' => array(
+ 'field' => 'list_show_address',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Street
+ 'list_show_street' => array(
+ 'field' => 'list_show_Street',
+ 'type' => 'checkbox',
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show City, State, ZIP
+ 'list_show_citystatezip' => array(
+ 'field' => 'list_show_citystatezip',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show country
+ 'list_show_country' => array(
+ 'field' => 'list_show_country',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Region
+ 'list_show_region' => array(
+ 'field' => 'list_show_region',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Description
+ 'list_show_descr' => array(
+ 'field' => 'list_show_descr',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Short Description
+ 'list_show_short_descr' => array(
+ 'field' => 'list_show_short_descr',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show phone
+ 'list_show_phone' => array(
+ 'field' => 'list_show_phone',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Toll Free
+ 'list_show_tollfree' => array(
+ 'field' => 'list_show_tollfree',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show URL
+ 'list_show_url' => array(
+ 'field' => 'list_show_url',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Categories
+ 'list_show_categories' => array(
+ 'field' => 'list_show_categories',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Credit Cards
+ 'list_show_logo' => array(
+ 'field' => 'list_show_creditcards',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'use' => 'lg'
+ ),
+
+ // Front-end Listings - Show Amenities
+ 'list_show_amenities' => array(
+ 'field' => 'list_show_amenities',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+
+
+
+
+
+
+ );
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+ }
+
+ }
+}
+
+?>
\ No newline at end of file
default;
$notices = get_option('glmMembersAdminNotices');
$notices[] = $message;
+//$notices = array();
update_option('glmMembersAdminNotices', $notices);
break;
[common]
+image_sizes['large'] = 'Large'
+image_sizes['medium'] = 'Medium'
+image_sizes['small'] = 'Small'
+image_sizes['thumb'] = 'Thumbnail'
+
;
; Site Configuration Options
;
'index'
),
'members' => array(
- 'index', // member list
+ 'index', // member list
'list',
'reports',
'other'
),
'member' => array(
- 'index', // Member Dashboard
+ 'index', // Member Dashboard
'memberInfo',
'locations',
'facilities',
)
,
'configure' => array(
- 'index',
- 'memberTypes',
+ 'index', // Member Types
'categories',
'cities',
'regions',
'accommodationTypes',
'amenities',
+ ),
+ 'settings' => array(
+ 'index', // General Options
'development'
),
'shortcodes' => array(
// Load glmPluginSupport class
require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
+// Load Smarty Template Support
+require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
+
/**
* Admin Controller Class
*
));
+/*
+ add_action( 'admin_init',
+ array(
+ $this,
+ 'glmMembersAdminSettingsInit'
+ ));
+*/
}
/**
'glmMembersAdminMenuConfigure'
));
+ // Add a submenu for the "Settings" section
+ add_submenu_page('glm-members-admin-menu-members',
+ 'Member DB Settings', 'Settings',
+ 'glm_members_settings', 'glm-members-admin-menu-settings',
+ array(
+ $this,
+ 'glmMembersAdminMenuSettings'
+ ));
+
// Add a submenu for the "Shortcode Reference" section
add_submenu_page('glm-members-admin-menu-members',
'Shortcode Reference', 'Shortcodes',
public function glmMembersAdminDashboardWidget ()
{
- wp_add_dashboard_widget(
- 'glm_members_admin_dashboard_widget',
- 'Member DB Summary',
- array(
- $this,
- 'glmMembersAdminDashboardContent'
- )
- );
+ if ( current_user_can( 'glm_members_info' ) ) {
+ wp_add_dashboard_widget(
+ 'glm_members_admin_dashboard_widget',
+ 'Member DB Summary',
+ array(
+ $this,
+ 'glmMembersAdminDashboardContent'
+ )
+ );
+
+ }
}
/**
$this->controller('configure');
}
+ public function glmMembersAdminMenuSettings ()
+ {
+ $this->controller('settings');
+ }
+
public function glmMembersAdminMenuShortcodes ()
{
$this->controller('shortcodes');
*/
// Load Smarty Template support
- require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
$smarty = new smartyTemplateSupport();
// Add standard template parameters
$templateVars = '<pre>' . print_r($x, 1) . '</pre>';
glmMembersAdmin::addNotice($templateVars, 'Template Parameters', 'Process');
+
}
// Generate output from model data and view
+
$smarty->template->display($view);
// Restore timezone that was set before our code was called
$output .= '<li><a href="#'.++$n.'">'.$d['title'].'</a></li>';
}
}
+
$output .= '</ul></div><hr>';
if (is_array($dataBlocks)) {
reset($dataBlocks);
';
}
}
+
delete_option('glmMembersAdminNoticeDataBlocks');
echo $output.'
----
+CREATE TABLE {prefix}settings_general (
+ id INT NOT NULL AUTO_INCREMENT,
+ admin_debug BOOLEAN NULL,
+ admin_debug_verbose BOOLEAN NULL,
+ front_debug BOOLEAN NULL,
+ front_debug_verbose BOOLEAN NULL,
+ google_maps_api_key TINYTEXT NULL,
+ maps_default_lat FLOAT NULL,
+ maps_default_lon FLOAT NULL,
+ time_zone TINYTEXT NULL,
+ list_show_map BOOLEAN NULL,
+ list_show_list BOOLEAN NULL,
+ list_show_search BOOLEAN NULL,
+ list_show_search_category BOOLEAN NULL,
+ list_show_search_amenities BOOLEAN NULL,
+ list_show_search_alphja BOOLEAN NULL,
+ list_show_detail_link BOOLEAN NULL,
+ list_show_logo BOOLEAN NULL,
+ list_logo_size TINYTEXT NULL,
+ list_show_address BOOLEAN NULL,
+ list_show_street BOOLEAN NULL,
+ list_show_citystatezip BOOLEAN NULL,
+ list_show_country BOOLEAN NULL,
+ list_show_region BOOLEAN NULL,
+ list_show_descr BOOLEAN NULL,
+ list_show_short_descr BOOLEAN NULL,
+ list_show_phone BOOLEAN NULL,
+ list_show_tollfree BOOLEAN NULL,
+ list_show_url BOOLEAN NULL,
+ list_show_categories BOOLEAN NULL,
+ list_show_creditcards BOOLEAN NULL,
+ list_show_amenities BOOLEAN NULL,
+
+ PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}settings_terms (
+ id INT NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+);
+
+----
+
CREATE TABLE {prefix}social_media (
id INT NOT NULL AUTO_INCREMENT,
name TINYTEXT NULL,
{prefix}regions,
{prefix}restaurant_types,
{prefix}restaurants,
+ {prefix}settings_general,
+ {prefix}settings_terms,
{prefix}social_media,
{prefix}social_media_ref
;
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-27 02:35:45
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-06-03 13:48:24
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 => 1422326142,
+ 1 => 1433353557,
2 => 'file',
),
),
<h2 class="nav-tab-wrapper">
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">General Options</a>
- <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
-?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=memberTypes" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='memberTypes') {?>-active<?php }?>">Member Types</a>
+&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">Member Types</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
&glm_action=categories" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='categories') {?>-active<?php }?>">Member Categories</a>
<a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=cities" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='cities') {?>-active<?php }?>">Cities</a>
- <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
-?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=regions" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='regions') {?>-active<?php }?>">Regions</a>
- <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>
+&glm_action=cities" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='cities') {?>-active<?php }?>">Cities</a>
+ <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=regions" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='regions') {?>-active<?php }?>">Regions</a>
</h2>
<div id="glm-admin-content-container">
<?php }} ?>
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-22 00:50:53
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-06-03 14:05:40
compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/index.html" */ ?>
<?php /*%%SmartyHeaderCode:135960089454c0496da6c5c6-30692976%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'47fb9b803e7138d215645f3c977b0b1dc2a9e718' =>
array (
0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/index.html',
- 1 => 1421691086,
+ 1 => 1433354735,
2 => 'file',
),
),
'function' =>
array (
),
- 'has_nocache_code' => false,
'version' => 'Smarty-3.1.21-dev',
'unifunc' => 'content_54c0496da75c57_83289225',
+ 'variables' =>
+ array (
+ 'thisURL' => 0,
+ 'thisPage' => 0,
+ 'haveMemberTypes' => 0,
+ 'memberTypes' => 0,
+ 'i' => 0,
+ 't' => 0,
+ ),
+ 'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54c0496da75c57_83289225')) {function content_54c0496da75c57_83289225($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/configure/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
+ <!-- Add Member Type Button and Dialog Box -->
+ <div id="newMemberTypeButton" class="button-primary glm-right">Add a Member Type</div>
+ <div id="newMemberTypeDialog" class="glm-dialog-box" title="Enter New Member Type">
+ <form action="<?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">
+ <input type="hidden" name="option" value="addNew">
+
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Member Type Name:</th>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newMemberTypeCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new member type">
+ </form>
+ </div>
+
+ <!-- Delete Member Dialog Box -->
+ <div id="deleteMemberTypeDialog" class="glm-dialog-box" title="Delete Member Type">
+ <center>
+ <p>Are you sure you want to delete this member type?</p>
+ <p><div id="deleteMemberTypeConfirm" class="button-primary">Yes, delete this member type</div></p>
+ <p><div id="deleteMemberTypeCancel" class="button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit Member Type Dialog Box -->
+ <div id="editMemberTypeDialog" class="glm-dialog-box" title="Edit Member Type">
+ <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">
+ <input type="hidden" name="option" value="update">
+ <input id="editMemberTypeID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Member Type Name:</th>
+ <td>
+ <input id="editMemberTypeName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editMemberTypeDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editMemberTypeCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this member type">
+ </form>
+ </div>
- <h2>General Configuration</h2>
-
- <p>General configuration options go here.</p>
-
+ <h2>Member Types</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th>Member Type</th>
+ <th>Description</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+<?php if ($_smarty_tpl->tpl_vars['haveMemberTypes']->value) {?>
+ <?php if (isset($_smarty_tpl->tpl_vars["i"])) {$_smarty_tpl->tpl_vars["i"] = clone $_smarty_tpl->tpl_vars["i"];
+$_smarty_tpl->tpl_vars["i"]->value = "0"; $_smarty_tpl->tpl_vars["i"]->nocache = null; $_smarty_tpl->tpl_vars["i"]->scope = 0;
+} else $_smarty_tpl->tpl_vars["i"] = new Smarty_variable("0", null, 0);?>
+ <?php $_smarty_tpl->tpl_vars['t'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['t']->_loop = false;
+ $_from = $_smarty_tpl->tpl_vars['memberTypes']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
+foreach ($_from as $_smarty_tpl->tpl_vars['t']->key => $_smarty_tpl->tpl_vars['t']->value) {
+$_smarty_tpl->tpl_vars['t']->_loop = true;
+?>
+ <?php if ((1 & $_smarty_tpl->tpl_vars['i']->value++ / 1)) {?>
+ <tr>
+ <?php } else { ?>
+ <tr class="alternate">
+ <?php }?>
+ <td>
+ <a class="editMemberType" data-memberTypeID="<?php echo $_smarty_tpl->tpl_vars['t']->value['id'];?>
+"><?php echo $_smarty_tpl->tpl_vars['t']->value['name'];?>
+</a>
+ </td>
+ <td id="editMemberTypeDescr_<?php echo $_smarty_tpl->tpl_vars['t']->value['id'];?>
+">
+ <?php echo $_smarty_tpl->tpl_vars['t']->value['descr'];?>
+
+ </td>
+ <td>
+ <div class="deleteMemberTypeButton button-primary glm-right" data-memberTypeID="<?php echo $_smarty_tpl->tpl_vars['t']->value['id'];?>
+">Delete</div>
+ </td>
+ </tr>
+ <?php } ?>
+<?php } else { ?>
+ <tr class="alternate"><td colspan="2">(no member types listed)</td></tr>
+<?php }?>
+ </tbody>
+ </table>
+
+ <?php echo '<script'; ?>
+ type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newMemberTypeButton').click( function() {
+ $("#newMemberTypeDialog").dialog("open");
+ });
+ $('.editMemberType').click( function() {
+ var typeID = $(this).attr('data-memberTypeID');
+ var typeName = $(this).text();
+ var typeDescr = $('#editMemberTypeDescr_' + typeID).html();
+ $('#editMemberTypeID').val(typeID);
+ $('#editMemberTypeName').val(typeName.trim());
+ $('#editMemberTypeDescr').val(typeDescr.trim());
+ $("#editMemberTypeDialog").dialog("open");
+ });
+ $('#editMemberTypeCancel').click( function() {
+ $("#editMemberTypeDialog").dialog("close");
+ });
+ $('#newMemberTypeCancel').click( function() {
+ $("#newMemberTypeDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteMemberTypeButton').click( function() {
+ id = $(this).attr('data-memberTypeID');
+ $("#deleteMemberTypeDialog").dialog("open");
+ });
+ $('#deleteMemberTypeConfirm').click( function() {
+ $("#deleteMemberTypeDialog").dialog("close");
+ window.location.href = "<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=index&option=delete&id=" + id;
+ });
+ $('#deleteMemberTypeCancel').click( function() {
+ $("#deleteMemberTypeDialog").dialog("close");
+ });
+
+ });
+ <?php echo '</script'; ?>
+>
+
<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
<?php }} ?>
+++ /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 ($actionData = false)
- {
-
- // Get current database version
- $dbVersion = GLM_MEMBERS_PLUGIN_DB_VERSION;
- settype($dbVersion, 'string');
-
- $templateData['resultMessage'] = '';
- $templateData['success'] = false;
- $templateData['haveNotices'] = false;
- $notices = array();
- $templateData['haveMembers'] = false;
- $templateData['import'] = false;
- $templateData['importNotice'] = false;
- $templateData['haveDatabaseTableList'] = false;
-
- // 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 'import_connections':
-
- // Load Member Info Data Class and get info data for later use
- require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmMemberImportFromConnections.php');
- $Connections = new GlmMemberImportFromConnections($this->wpdb, $this->config);
-
- if (isset($_REQUEST['import']) && $_REQUEST['import'] == 'now') {
-
- // Reset the database
- if (!$this->deleteDataTables($dbVersion)) {
- glmMembersAdmin::addNotice('<b>Unable to delete the database tables while resetting the database.</b><br>', 'AdminError');
- break;
- }
- if (!$this->createDataTables($dbVersion)) {
- glmMembersAdmin::addNotice('<b>Unable to create the database tables while resetting the database.</b><br>', 'AdminError');
- break;
- }
- glmMembersAdmin::addNotice('<b>Database tables have been reset in preparation importing members.</b><br>', 'AdminNotice');
-
- // Delete Images
- foreach( new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator( GLM_MEMBERS_PLUGIN_IMAGES_PATH, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS ),
- RecursiveIteratorIterator::CHILD_FIRST ) as $value ) {
- if ($value->isFile()) {
- unlink( $value );
- }
- }
-
- $templateData['import'] = true;
- $templateData['membersImported'] = $Connections->doImport();
-
- } else {
-
- // Check if Connections is not installed or not active. If active, gets count of entries.
- $c = $Connections->checkConnections();
- if ($c === false) {
- glmMembersAdmin::addNotice('<b>Connections Business Directory plugin is not installed or not active!</b><br>'.print_r($c,1), 'AdminError');
- break;
- }
- $templateData['numbEntries'] = $c;
- $importNotice = 'Connections Business Directory plugin is active.<br>Number of businesses listed: '.$c.'<br>';
-
- // Get the basic business data for review.
- $templateData['members'] = $Connections->getList();
- if ($templateData['members'] === false) {
- $importNotice = 'No businesses were retieved.';
- break;
- }
-
- $templateData['haveMembers'] = true;
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice($templateData['members'], 'DataBlock', 'Base Members Data');
- }
-
- }
-
- break;
-
- case 'drop':
- case 'reset':
-
- $del = $this->deleteDataTables($dbVersion);
-
- if ($del) {
- glmMembersAdmin::addNotice('New database tables for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin have been deleted.', 'AdminNotice');
-
- }
-
- if ($option != 'reset') {
- break;
- }
-
- case 'create':
-
- $create = $this->createDataTables($dbVersion);
-
- // If there were no errors
- if ($create) {
-
- // Notify the user that the database has been installed
- glmMembersAdmin::addNotice('New database tables installed for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin.', 'AdminNotice');
-
- // Save the version of the installed database
- update_option('glmMembersDatabaseDbVersion', $dbVersion);
-
- }
-
- 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;
-
- }
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => true,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/configure/development.html',
- 'data' => $templateData
- );
-
- }
-
- /*
- * Delete Members Database Tables
- *
- * @param string $dbVersion Current version of Members Database
- *
- * @return boolean
- * @access public
- */
- public function deleteDataTables($dbVersion)
- {
-
- // 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);
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice('Dropping all database tables', 'Process');
- glmMembersAdmin::addNotice($sql, 'DataBlock', 'Drop Tables SQL');
- }
-
- // Removing the tables using the script
- $this->wpdb->query($sql);
-
- // If there's been an error, display in debug Alert
- $queryError = $this->wpdb->last_error;
- if ($queryError) {
- glmMembersAdmin::addNotice('<b>Error when deleting database: Database tables may not have existed.</b><br>Check following message.<br>'.$queryError, 'AdminError');
- return false;
- }
-
- return true;
-
- }
-
- /*
- * Create Members Database Tables
- *
- * @param string $dbVersion Current version of Members Database
- *
- * @return boolean
- * @access public
- */
- public function createDataTables($dbVersion)
- {
-
- // 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
- $qForDebug = '';
- do {
- $q = current($queries);
- $this->wpdb->query($q);
- $queryError = $this->wpdb->last_error;
-
- if ($queryError) {
- glmMembersAdmin::addNotice('<b>Error when creating database: Database tables may already exist.</b><br>Check following message.<br>'.$queryError, 'AdminError');
- return false;
- }
- $qForDebug .= $queryError.$q;
-
- } while ($queryError == '' && next($queries));
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice('Creating database tables', 'Process');
- glmMembersAdmin::addNotice($qForDebug, 'DataBlock', 'Create Tables SQL');
- }
-
- return true;
-
- }
-
-}
-
-?>
\ No newline at end of file
/**
* Gaslight Media Members Database
- * Admin Configure
+ * Admin Member Type List
*
* PHP version 5.5
*
* @version 0.1
*/
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.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_index
+class GlmMembersAdmin_configure_index extends GlmDataMemberTypes
{
/**
// Save plugin configuration object
$this->config = $config;
+ // Run constructor for members data class
+ parent::__construct(false, false);
+
}
/*
public function modelAction ($actionData = false)
{
- // Determine if current user can add, edit, delete member data
- $canEdit = current_user_can('glm_members_edit');
+ $success = true;
+ $haveMemberTypes = false;
+ $memberTypes = false;
+ $error = false;
+
+ // Check for member type id
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'addNew':
+ $this->insertEntry();
+ break;
+
+ case 'update':
+ if ($id > 0) {
+ $this->updateEntry($id);
+ }
+ break;
+
+ case 'delete':
+ if ($id > 0) {
+ $this->deleteEntry($id, true);
+ }
+ break;
+
+ }
+
+ }
+
+ // Get a current list of member types
+ $memberTypes = $this->getList();
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Type Data');
+ }
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveMemberTypes = false;
+ if ($memberTypes !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($memberTypes) > 0) {
+ $haveMemberTypes = 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($memberTypes, 'DataBlock', 'Member Types Data');
+ }
// Compile template data
$templateData = array(
- 'canEdit' => $canEdit
+ 'haveMemberTypes' => $haveMemberTypes,
+ 'memberTypes' => $memberTypes
);
// Return status, suggested view, and data to controller
return array(
- 'status' => true,
+ 'status' => $success,
'menuItemRedirect' => false,
'modelRedirect' => false,
'view' => 'admin/configure/index.html',
}
+
}
?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Member Type 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 Member Types data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.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_memberTypes extends GlmDataMemberTypes
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
-
- /*
- * Constructor
- *
- * This contructor sets up this model. At this time that only includes
- * storing away the WordPress data object.
- *
- * @return object Class object
- *
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for members data class
- parent::__construct(false, false);
-
- }
-
- /*
- * Perform Model Action
- *
- * This method does the work for this model and returns any resulting data
- *
- * @return array Status and data array
- *
- * 'status'
- *
- * True if successfull and false if there was a fatal failure.
- *
- * 'menuItemRedirect'
- *
- * If not false, provides a menu item the controller should
- * execute after this one. Normally if this is used, there would also be a
- * modelRedirect value supplied as well.
- *
- * 'modelRedirect'
- *
- * If not false, provides an action the controller should execute after
- * this one.
- *
- * 'view'
- *
- * A suggested view name that the contoller should use instead of the
- * default view for this model or false to indicate that the default view
- * should be used.
- *
- * 'data'
- *
- * Data that the model is returning for use in merging with the view to
- * produce output.
- *
- */
- public function modelAction ($actionData = false)
- {
-
- $success = true;
- $haveMemberTypes = false;
- $memberTypes = false;
- $error = false;
-
- // Check for member type id
- $id = 0;
- if (isset($_REQUEST['id'])) {
- $id = $_REQUEST['id']-0;
- }
-
- // If there's an action option
- if (isset($_REQUEST['option'])) {
-
- switch($_REQUEST['option']) {
-
- case 'addNew':
- $this->insertEntry();
- break;
-
- case 'update':
- if ($id > 0) {
- $this->updateEntry($id);
- }
- break;
-
- case 'delete':
- if ($id > 0) {
- $this->deleteEntry($id, true);
- }
- break;
-
- }
-
- }
-
- // Get a current list of member types
- $memberTypes = $this->getList();
-
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
- glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Type Data');
- }
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveMemberTypes = false;
- if ($memberTypes !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($memberTypes) > 0) {
- $haveMemberTypes = 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($memberTypes, 'DataBlock', 'Member Types Data');
- }
-
- // Compile template data
- $templateData = array(
- 'haveMemberTypes' => $haveMemberTypes,
- 'memberTypes' => $memberTypes
- );
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => $success,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/configure/memberTypes.html',
- 'data' => $templateData
- );
-
- }
-
-
-}
-
-?>
\ No newline at end of file
--- /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_settings_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 ($actionData = false)
+ {
+
+ // Get current database version
+ $dbVersion = GLM_MEMBERS_PLUGIN_DB_VERSION;
+ settype($dbVersion, 'string');
+
+ $templateData['resultMessage'] = '';
+ $templateData['success'] = false;
+ $templateData['haveNotices'] = false;
+ $notices = array();
+ $templateData['haveMembers'] = false;
+ $templateData['import'] = false;
+ $templateData['importNotice'] = false;
+ $templateData['haveDatabaseTableList'] = false;
+
+ // 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 'import_connections':
+
+ // Load Member Info Data Class and get info data for later use
+ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmMemberImportFromConnections.php');
+ $Connections = new GlmMemberImportFromConnections($this->wpdb, $this->config);
+
+ if (isset($_REQUEST['import']) && $_REQUEST['import'] == 'now') {
+
+ // Reset the database
+ if (!$this->deleteDataTables($dbVersion)) {
+ glmMembersAdmin::addNotice('<b>Unable to delete the database tables while resetting the database.</b><br>', 'AdminError');
+ break;
+ }
+ if (!$this->createDataTables($dbVersion)) {
+ glmMembersAdmin::addNotice('<b>Unable to create the database tables while resetting the database.</b><br>', 'AdminError');
+ break;
+ }
+ glmMembersAdmin::addNotice('<b>Database tables have been reset in preparation importing members.</b><br>', 'AdminNotice');
+
+ // Delete Images
+ foreach( new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator( GLM_MEMBERS_PLUGIN_IMAGES_PATH, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS ),
+ RecursiveIteratorIterator::CHILD_FIRST ) as $value ) {
+ if ($value->isFile()) {
+ unlink( $value );
+ }
+ }
+
+ $templateData['import'] = true;
+ $templateData['membersImported'] = $Connections->doImport();
+
+ } else {
+
+ // Check if Connections is not installed or not active. If active, gets count of entries.
+ $c = $Connections->checkConnections();
+ if ($c === false) {
+ glmMembersAdmin::addNotice('<b>Connections Business Directory plugin is not installed or not active!</b><br>'.print_r($c,1), 'AdminError');
+ break;
+ }
+ $templateData['numbEntries'] = $c;
+ $importNotice = 'Connections Business Directory plugin is active.<br>Number of businesses listed: '.$c.'<br>';
+
+ // Get the basic business data for review.
+ $templateData['members'] = $Connections->getList();
+ if ($templateData['members'] === false) {
+ $importNotice = 'No businesses were retieved.';
+ break;
+ }
+
+ $templateData['haveMembers'] = true;
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice($templateData['members'], 'DataBlock', 'Base Members Data');
+ }
+
+ }
+
+ break;
+
+ case 'drop':
+ case 'reset':
+
+ $del = $this->deleteDataTables($dbVersion);
+
+ if ($del) {
+ glmMembersAdmin::addNotice('New database tables for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin have been deleted.', 'AdminNotice');
+
+ }
+
+ if ($option != 'reset') {
+ break;
+ }
+
+ case 'create':
+
+ $create = $this->createDataTables($dbVersion);
+
+ // If there were no errors
+ if ($create) {
+
+ // Notify the user that the database has been installed
+ glmMembersAdmin::addNotice('New database tables installed for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin.', 'AdminNotice');
+
+ // Save the version of the installed database
+ update_option('glmMembersDatabaseDbVersion', $dbVersion);
+
+ }
+
+ break;
+
+ case 'list':
+
+ // Check if the database version set for this plugin is invalid.
+ if (!isset($activate->dbVersions[$dbVersion])) {
+ $templateData['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)) {
+
+
+
+
+ $templateData['resultMessage'] .= '<b>Current database tables</b><br><ul>';
+ foreach($existingTables as $t){
+ $templateData['resultMessage'] .= "<li>".$t['table_name'].'</li><br>';
+ }
+ $templateData['resultMessage'] .= '</ul>';
+ } else {
+ $templateData['resultMessage'] .= '<b>No tables currently exist</b><br>';
+ }
+
+ break;
+
+ default:
+
+ break;
+
+ }
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/development.html',
+ 'data' => $templateData
+ );
+
+ }
+
+ /*
+ * Delete Members Database Tables
+ *
+ * @param string $dbVersion Current version of Members Database
+ *
+ * @return boolean
+ * @access public
+ */
+ public function deleteDataTables($dbVersion)
+ {
+
+ // 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);
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice('Dropping all database tables', 'Process');
+ glmMembersAdmin::addNotice($sql, 'DataBlock', 'Drop Tables SQL');
+ }
+
+ // Removing the tables using the script
+ $this->wpdb->query($sql);
+
+ // If there's been an error, display in debug Alert
+ $queryError = $this->wpdb->last_error;
+ if ($queryError) {
+ glmMembersAdmin::addNotice('<b>Error when deleting database: Database tables may not have existed.</b><br>Check following message.<br>'.$queryError, 'AdminError');
+ return false;
+ }
+
+ return true;
+
+ }
+
+ /*
+ * Create Members Database Tables
+ *
+ * @param string $dbVersion Current version of Members Database
+ *
+ * @return boolean
+ * @access public
+ */
+ public function createDataTables($dbVersion)
+ {
+
+ // 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
+ $qForDebug = '';
+ do {
+ $q = current($queries);
+ $this->wpdb->query($q);
+ $queryError = $this->wpdb->last_error;
+
+ if ($queryError) {
+ glmMembersAdmin::addNotice('<b>Error when creating database: Database tables may already exist.</b><br>Check following message.<br>'.$queryError, 'AdminError');
+ return false;
+ }
+ $qForDebug .= $queryError.$q;
+
+ } while ($queryError == '' && next($queries));
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ glmMembersAdmin::addNotice('Creating database tables', 'Process');
+ glmMembersAdmin::addNotice($qForDebug, 'DataBlock', 'Create Tables SQL');
+ }
+
+ return true;
+
+ }
+
+}
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Configure
+ *
+ * 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_settings_index
+{
+
+ /**
+ * 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 ($actionData = false)
+ {
+
+ // Determine if current user can add, edit, delete member data
+ $canEdit = current_user_can('glm_members_edit');
+
+ // Compile template data
+ $templateData = array(
+ 'canEdit' => $canEdit
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/index.html',
+ 'data' => $templateData
+ );
+
+ }
+
+}
+
+?>
\ No newline at end of file
+++ /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>Import</H3>
- <ul>
- <li>
- <p>
- <a href="{$thisURL}?page={$thisPage}&glm_action=development&option=import_connections">Import data from "Connections" business directory</a>
-
- {if $importNotice}
- <div class="glm-indent glm-notice">{$importNotice}</div>
- {/if}
- </p>
-
- {if $import}
-
- <h3 style="margin-left: 2em;">Members imported: {$membersImported}</h3>
-
- {else}
- {if $haveMembers}
- <form action="{$thisURL}?page={$thisPage}&glm_action=development&option=import_connections" method="POST">
- <div class="glm-item-container">
- <b>Default data to use when importing members.</b>
- <table>
- <tr><td>Default member type: </td><td><input type="text" name="memberType" value="Standard"></td></tr>
- <tr><td>Default region name: </td><td><input type="text" name="region" value="Region"></td></tr>
- </table>
- </div>
- <p>
- <input class="glm-right" type="submit" value="Click here to import all members not marked as Skip">
- <span id="skipAll" class="button-primary">Skip All</span>
- <span id="skipNone" class="button-primary">Import All</span>
- </p>
- <div class="glm-nitice glm-indent">
- <ul class="glm-required glm-indent">
- <li>*** THIS ACTION WILL FULLY RESET YOUR MEMBERS DATABASE ***</li>
- <li>This action does not check for duplicate members!</li>
- </ul>
- </div>
- <input type="hidden" name="import" value="now">
- <table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th>Skip</th>
- <th>Name</th>
- <th>Addr Line 1</th>
- <th>Addr Line 2</th>
- <th>Addr Line 3</th>
- <th>City</th>
- <th>State</th>
- <th>ZIP</th>
- <th>Country</th>
- <th>Lat/Lon</th>
- </tr>
- </thead>
- <tbody>
- {foreach $members as $m}
- <tr class="alternate">
- <td><input type="checkbox" name="skip[{$m.id}]" class="skip">{$m.id}</td>
- <td>{$m.organization}</td>
- {assign var="i" value="0"}
- {foreach $m.addresses as $a}
- {if $i++ gt 1}
- <tr>
- <td> </td>
- <td> </td>
- {/if}
- <td>{$a.line_1}</td>
- <td>{$a.line_2}</td>
- <td>{$a.line_3}</td>
- <td>{$a.city}</td>
- <td>{$a.state}</td>
- <td>{$a.zipcode}</td>
- <td>{$a.country}</td>
- <td>{$a.latitude|number_format:3:".":","}/{$a.longitude|number_format:3:".":","}</td>
- </tr>
- {/foreach}
- {/foreach}
- </tbody>
- </table>
- </form>
- {/if}
- {/if}
- </li>
- </ul>
- <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>
-
- <div>
- <h3>Docuemtation and References</h3>
- <p><a href="{$baseURL}/lib/GlmDataAbstract/GlmDataAbstract_Programmers_Manual.pdf">Data Abstract Class Documentation</a></p>
- </div>
-{if $resultMessage}
- <div>
- <h3>Results</h3>
- {$resultMessage}
- </div>
-{/if}
-
-{if $haveMembers}
- <script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $('#skipAll').click(function(event) {
- $('.skip').each(function() { //loop through each checkbox
- this.checked = true; //select all checkboxes with class "checkbox1"
- });
- return false;
- });
-
- $('#skipNone').click(function(event) {
- $('.skip').each(function() { //loop through each checkbox
- this.checked = false; //select all checkboxes with class "checkbox1"
- });
- return false;
- });
-
- });
- </script>
-{/if}
-
-
-{include file='admin/footer.html'}
<h2>{$glmPluginName} Configuration</h2>
<h2 class="nav-tab-wrapper">
- <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">General Options</a>
- <a href="{$thisURL}?page={$thisPage}&glm_action=memberTypes" class="nav-tab{if $thisAction==memberTypes}-active{/if}">Member Types</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">Member Types</a>
<a href="{$thisURL}?page={$thisPage}&glm_action=categories" class="nav-tab{if $thisAction==categories}-active{/if}">Member Categories</a>
- <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>
+ <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>
</h2>
<div id="glm-admin-content-container">
\ No newline at end of file
{include file='admin/configure/header.html'}
+
+ <!-- Add Member Type Button and Dialog Box -->
+ <div id="newMemberTypeButton" class="button-primary glm-right">Add a Member Type</div>
+ <div id="newMemberTypeDialog" class="glm-dialog-box" title="Enter New Member Type">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="index">
+ <input type="hidden" name="option" value="addNew">
+
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Member Type Name:</th>
+ <td>
+ <input type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newMemberTypeCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new member type">
+ </form>
+ </div>
+
+ <!-- Delete Member Dialog Box -->
+ <div id="deleteMemberTypeDialog" class="glm-dialog-box" title="Delete Member Type">
+ <center>
+ <p>Are you sure you want to delete this member type?</p>
+ <p><div id="deleteMemberTypeConfirm" class="button-primary">Yes, delete this member type</div></p>
+ <p><div id="deleteMemberTypeCancel" class="button-primary">Cancel</div></p>
+ </center>
+ </div>
+
+ <!-- Edit Member Type Dialog Box -->
+ <div id="editMemberTypeDialog" class="glm-dialog-box" title="Edit Member Type">
+ <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="index">
+ <input type="hidden" name="option" value="update">
+ <input id="editMemberTypeID" type="hidden" name="id" value="">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Member Type Name:</th>
+ <td>
+ <input id="editMemberTypeName" type="text" name="name" class="glm-form-text-input">
+ </td>
+ </tr>
+ <tr>
+ <th>Description:</th>
+ <td>
+ <textarea id="editMemberTypeDescr" name="descr" class="glm-form-textarea"></textarea>
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="editMemberTypeCancel" class="button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this member type">
+ </form>
+ </div>
- <h2>General Configuration</h2>
-
- <p>General configuration options go here.</p>
-
+ <h2>Member Types</h2>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th>Member Type</th>
+ <th>Description</th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+{if $haveMemberTypes}
+ {assign var="i" value="0"}
+ {foreach $memberTypes as $t}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <a class="editMemberType" data-memberTypeID="{$t.id}">{$t.name}</a>
+ </td>
+ <td id="editMemberTypeDescr_{$t.id}">
+ {$t.descr}
+ </td>
+ <td>
+ <div class="deleteMemberTypeButton button-primary glm-right" data-memberTypeID="{$t.id}">Delete</div>
+ </td>
+ </tr>
+ {/foreach}
+{else}
+ <tr class="alternate"><td colspan="2">(no member types listed)</td></tr>
+{/if}
+ </tbody>
+ </table>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $("#newMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#editMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+ $("#deleteMemberTypeDialog").dialog({
+ autoOpen: false,
+ minWidth: 400,
+ dialogClass: "glm-dialog-no-close"
+ });
+
+ $('#newMemberTypeButton').click( function() {
+ $("#newMemberTypeDialog").dialog("open");
+ });
+ $('.editMemberType').click( function() {
+ var typeID = $(this).attr('data-memberTypeID');
+ var typeName = $(this).text();
+ var typeDescr = $('#editMemberTypeDescr_' + typeID).html();
+ $('#editMemberTypeID').val(typeID);
+ $('#editMemberTypeName').val(typeName.trim());
+ $('#editMemberTypeDescr').val(typeDescr.trim());
+ $("#editMemberTypeDialog").dialog("open");
+ });
+ $('#editMemberTypeCancel').click( function() {
+ $("#editMemberTypeDialog").dialog("close");
+ });
+ $('#newMemberTypeCancel').click( function() {
+ $("#newMemberTypeDialog").dialog("close");
+ });
+
+ var id = false;
+ $('.deleteMemberTypeButton').click( function() {
+ id = $(this).attr('data-memberTypeID');
+ $("#deleteMemberTypeDialog").dialog("open");
+ });
+ $('#deleteMemberTypeConfirm').click( function() {
+ $("#deleteMemberTypeDialog").dialog("close");
+ window.location.href = "{$thisURL}?page={$thisPage}&glm_action=index&option=delete&id=" + id;
+ });
+ $('#deleteMemberTypeCancel').click( function() {
+ $("#deleteMemberTypeDialog").dialog("close");
+ });
+
+ });
+ </script>
+
{include file='admin/footer.html'}
+++ /dev/null
-{include file='admin/configure/header.html'}
-
- <!-- Add Member Type Button and Dialog Box -->
- <div id="newMemberTypeButton" class="button-primary glm-right">Add a Member Type</div>
- <div id="newMemberTypeDialog" class="glm-dialog-box" title="Enter New Member Type">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="memberTypes">
- <input type="hidden" name="option" value="addNew">
-
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Member Type Name:</th>
- <td>
- <input type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newMemberTypeCancel" class="button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new member type">
- </form>
- </div>
-
- <!-- Delete Member Dialog Box -->
- <div id="deleteMemberTypeDialog" class="glm-dialog-box" title="Delete Member Type">
- <center>
- <p>Are you sure you want to delete this member type?</p>
- <p><div id="deleteMemberTypeConfirm" class="button-primary">Yes, delete this member type</div></p>
- <p><div id="deleteMemberTypeCancel" class="button-primary">Cancel</div></p>
- </center>
- </div>
-
- <!-- Edit Member Type Dialog Box -->
- <div id="editMemberTypeDialog" class="glm-dialog-box" title="Edit Member Type">
- <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="memberTypes">
- <input type="hidden" name="option" value="update">
- <input id="editMemberTypeID" type="hidden" name="id" value="">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Member Type Name:</th>
- <td>
- <input id="editMemberTypeName" type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- <tr>
- <th>Description:</th>
- <td>
- <textarea id="editMemberTypeDescr" name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="editMemberTypeCancel" class="button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this member type">
- </form>
- </div>
-
- <h2>Member Types</h2>
-
- <table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th>Member Type</th>
- <th>Description</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
-{if $haveMemberTypes}
- {assign var="i" value="0"}
- {foreach $memberTypes as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>
- <a class="editMemberType" data-memberTypeID="{$t.id}">{$t.name}</a>
- </td>
- <td id="editMemberTypeDescr_{$t.id}">
- {$t.descr}
- </td>
- <td>
- <div class="deleteMemberTypeButton button-primary glm-right" data-memberTypeID="{$t.id}">Delete</div>
- </td>
- </tr>
- {/foreach}
-{else}
- <tr class="alternate"><td colspan="2">(no member types listed)</td></tr>
-{/if}
- </tbody>
- </table>
-
- <script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $("#newMemberTypeDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#editMemberTypeDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#deleteMemberTypeDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
-
- $('#newMemberTypeButton').click( function() {
- $("#newMemberTypeDialog").dialog("open");
- });
- $('.editMemberType').click( function() {
- var typeID = $(this).attr('data-memberTypeID');
- var typeName = $(this).text();
- var typeDescr = $('#editMemberTypeDescr_' + typeID).html();
- $('#editMemberTypeID').val(typeID);
- $('#editMemberTypeName').val(typeName.trim());
- $('#editMemberTypeDescr').val(typeDescr.trim());
- $("#editMemberTypeDialog").dialog("open");
- });
- $('#editMemberTypeCancel').click( function() {
- $("#editMemberTypeDialog").dialog("close");
- });
- $('#newMemberTypeCancel').click( function() {
- $("#newMemberTypeDialog").dialog("close");
- });
-
- var id = false;
- $('.deleteMemberTypeButton').click( function() {
- id = $(this).attr('data-memberTypeID');
- $("#deleteMemberTypeDialog").dialog("open");
- });
- $('#deleteMemberTypeConfirm').click( function() {
- $("#deleteMemberTypeDialog").dialog("close");
- window.location.href = "{$thisURL}?page={$thisPage}&glm_action=memberTypes&option=delete&id=" + id;
- });
- $('#deleteMemberTypeCancel').click( function() {
- $("#deleteMemberTypeDialog").dialog("close");
- });
-
- });
- </script>
-
-{include file='admin/footer.html'}
--- /dev/null
+{include file='admin/settings/header.html'}
+
+ <p>Note: Customers will not have access to this tab.</p>
+
+ <h2>Development Activities</h2>
+
+ <ul>
+ <li>
+ <H3>Import</H3>
+ <ul>
+ <li>
+ <p>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=development&option=import_connections">Import data from "Connections" business directory</a>
+
+ {if $importNotice}
+ <div class="glm-indent glm-notice">{$importNotice}</div>
+ {/if}
+ </p>
+
+ {if $import}
+
+ <h3 style="margin-left: 2em;">Members imported: {$membersImported}</h3>
+
+ {else}
+ {if $haveMembers}
+ <form action="{$thisURL}?page={$thisPage}&glm_action=development&option=import_connections" method="POST">
+ <div class="glm-item-container">
+ <b>Default data to use when importing members.</b>
+ <table>
+ <tr><td>Default member type: </td><td><input type="text" name="memberType" value="Standard"></td></tr>
+ <tr><td>Default region name: </td><td><input type="text" name="region" value="Region"></td></tr>
+ </table>
+ </div>
+ <p>
+ <input class="glm-right" type="submit" value="Click here to import all members not marked as Skip">
+ <span id="skipAll" class="button-primary">Skip All</span>
+ <span id="skipNone" class="button-primary">Import All</span>
+ </p>
+ <div class="glm-nitice glm-indent">
+ <ul class="glm-required glm-indent">
+ <li>*** THIS ACTION WILL FULLY RESET YOUR MEMBERS DATABASE ***</li>
+ <li>This action does not check for duplicate members!</li>
+ </ul>
+ </div>
+ <input type="hidden" name="import" value="now">
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th>Skip</th>
+ <th>Name</th>
+ <th>Addr Line 1</th>
+ <th>Addr Line 2</th>
+ <th>Addr Line 3</th>
+ <th>City</th>
+ <th>State</th>
+ <th>ZIP</th>
+ <th>Country</th>
+ <th>Lat/Lon</th>
+ </tr>
+ </thead>
+ <tbody>
+ {foreach $members as $m}
+ <tr class="alternate">
+ <td><input type="checkbox" name="skip[{$m.id}]" class="skip">{$m.id}</td>
+ <td>{$m.organization}</td>
+ {assign var="i" value="0"}
+ {foreach $m.addresses as $a}
+ {if $i++ gt 1}
+ <tr>
+ <td> </td>
+ <td> </td>
+ {/if}
+ <td>{$a.line_1}</td>
+ <td>{$a.line_2}</td>
+ <td>{$a.line_3}</td>
+ <td>{$a.city}</td>
+ <td>{$a.state}</td>
+ <td>{$a.zipcode}</td>
+ <td>{$a.country}</td>
+ <td>{$a.latitude|number_format:3:".":","}/{$a.longitude|number_format:3:".":","}</td>
+ </tr>
+ {/foreach}
+ {/foreach}
+ </tbody>
+ </table>
+ </form>
+ {/if}
+ {/if}
+ </li>
+ </ul>
+ <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>
+
+ <div>
+ <h3>Docuemtation and References</h3>
+ <p><a href="{$baseURL}/lib/GlmDataAbstract/GlmDataAbstract_Programmers_Manual.pdf">Data Abstract Class Documentation</a></p>
+ </div>
+{if $resultMessage}
+ <div>
+ <hr>
+ {$resultMessage}
+ </div>
+{/if}
+
+{if $haveMembers}
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ $('#skipAll').click(function(event) {
+ $('.skip').each(function() { //loop through each checkbox
+ this.checked = true; //select all checkboxes with class "checkbox1"
+ });
+ return false;
+ });
+
+ $('#skipNone').click(function(event) {
+ $('.skip').each(function() { //loop through each checkbox
+ this.checked = false; //select all checkboxes with class "checkbox1"
+ });
+ return false;
+ });
+
+ });
+ </script>
+{/if}
+
+
+{include file='admin/footer.html'}
--- /dev/null
+<div class="wrap">
+
+ <h2>{$glmPluginName} Configuration</h2>
+
+ <h2 class="nav-tab-wrapper">
+ <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">General Settings</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
--- /dev/null
+{include file='admin/settings/header.html'}
+
+ <h2>General Settings</h2>
+
+ <p>General settings go here.</p>
+
+{include file='admin/footer.html'}
--- /dev/null
+
+<div id="icon-themes" class="icon32"><br></div>
+<h2 class="nav-tab-wrapper">
+ <a class='{if $settingsTab=="tab1"}nav-tab-active{else}nav-tab{/if}' href='{$thisURL}?page=glm-member-db-settings&tab=tab1'>Tab 1</a>
+ <a class='{if $settingsTab=="tab2"}nav-tab-active{else}nav-tab{/if}' href='{$thisURL}?page=glm-member-db-settings&tab=tab2'>Tab 2</a>
+</h2>
+<div class="wrap">
+ <h2>My Plugin Options</h2>
+ <form action="options.php?tab={$settingsTab}" method="POST">
+ {php} settings_fields( 'glm-member-db-settings-group' ); {/php}
+ {php} do_settings_sections( 'glm-member-db-settings' ); {/php}
+ {php} submit_button(); {/php}
+ </form>
+</div>