From: Chuck Scott Date: Thu, 22 Jan 2015 00:50:08 +0000 (-0500) Subject: Have some of the configuration section working and more updated to the database abstract. X-Git-Tag: v1.0.0~73 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=c5cc91e910344edb2d63286a07caf859848fefe0;p=WP-Plugins%2Fglm-member-db.git Have some of the configuration section working and more updated to the database abstract. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..1ef30ec2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Don't save smarty cache directories or files +misc/smarty/* \ No newline at end of file diff --git a/activate.php b/activate.php index 9b25583f..ef29d27d 100644 --- a/activate.php +++ b/activate.php @@ -126,8 +126,12 @@ class glmMembersPluginActivate extends glmPluginSupport WHERE table_name like '".GLM_MEMBERS_PLUGIN_DB_PREFIX."%'; "); - // Check if the number of tables is correct - if ($tables != $existingTables) { + // If there's no tables, just assume we need to install all new ones. + if ($existingTables == 0) { + $dbVersion = false; + + // Otherwise check if the number of tables is correct + } elseif ($tables != $existingTables) { $this->addNotice('We do not have the correct number of tables for the currently set database version (V'.$dbVersion.') for the '.GLM_MEMBERS_PLUGIN_NAME.'.'); $this->addNotice("There should be $tables but there are currently $existingTables. Please call for support."); return false; @@ -172,8 +176,8 @@ class glmMembersPluginActivate extends glmPluginSupport } else { $this->addNotice('Failure installing database tables for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin.'); - $this->addNotice(''.print_r($queryError,1).''); -// $this->addNotice('

'.print_r($q,1).''); + $this->addNotice('Database Installation Error: '.print_r($queryError,1), 'Alert'); + $this->addNotice($q, 'DataBlock', 'Database Installation Query'); } // Otherwise, check if we need to update the database @@ -232,7 +236,7 @@ class glmMembersPluginActivate extends glmPluginSupport $this->addNotice('Failure updating the database tables for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin ' .'from V'.$dbVersion.'_V'.$ver.'.'); $db_setup_status = false; - $this->addNotice('ERROR: '.$queryError); + $this->addNotice('Database Update Error: '.$queryError, 'Alert'); } } diff --git a/classes/data/dataCities.php b/classes/data/dataCities.php new file mode 100644 index 00000000..ca27415a --- /dev/null +++ b/classes/data/dataCities.php @@ -0,0 +1,133 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * EventManagementDataCities class + * + * PHP version 5 + * + * @category Data + * @package EventManagement + * @author Chuck Scott + * @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/ + */ +abstract class GlmDataCities 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 . 'cities'; + + /* + * Table Data Fields + */ + $this->fields = array( + + 'id' => array( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Name + 'name' => array( + 'field' => 'name', + 'type' => 'text', + 'required' => true, + 'unique' => 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 diff --git a/classes/data/dataMemberTypes.php b/classes/data/dataMemberTypes.php new file mode 100644 index 00000000..6d0dde42 --- /dev/null +++ b/classes/data/dataMemberTypes.php @@ -0,0 +1,141 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * EventManagementDataMemberType class + * + * PHP version 5 + * + * @category Data + * @package EventManagement + * @author Chuck Scott + * @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/ + */ +abstract class GlmDataMemberTypes 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_type'; + + /* + * Table Data Fields + */ + $this->fields = array( + + 'id' => array( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Member Type Name + 'name' => array( + 'field' => 'name', + 'type' => 'text', + 'required' => true, + 'unique' => true, + 'use' => 'a' + ), + + // Description + 'descr' => array( + 'field' => '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 diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php index 2ccb33e4..e3484b90 100644 --- a/classes/data/dataMembers.php +++ b/classes/data/dataMembers.php @@ -27,7 +27,21 @@ */ abstract class GlmDataMembers extends GlmDataAbstract { - /** + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** * Field definitions * * @var $ini @@ -69,11 +83,24 @@ abstract class GlmDataMembers extends GlmDataAbstract { * @return void * @access public */ - function __construct($dbh, $config) { - parent::__construct ( $dbh, $config ); + 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 . 'members'; + /* + * Table Data Fields + */ $this->fields = array ( 'id' => array ( @@ -83,14 +110,29 @@ abstract class GlmDataMembers extends GlmDataAbstract { 'use' => 'a' ), - // Active - 'active' => array ( - 'field' => 'active', - 'type' => 'checkbox', + // Status + 'status' => array ( + 'field' => 'status', + 'type' => 'list', + 'list' => $this->config['status'], + 'required' => true, + 'default' => $this->config['status_numb']['Pending'], 'use' => 'a' ), - // Member Name + // Member Type + 'member_type' => array ( + 'field' => 'member_type', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_type', + 'p_field' => 'name', + 'p_orderby' => 'name', + 'p_blank' => true, + 'required' => true, + 'use' => 'a' + ), + + // Member Name 'name' => array ( 'field' => 'name', 'type' => 'text', @@ -137,9 +179,14 @@ abstract class GlmDataMembers extends GlmDataAbstract { ) - ) - // - ; + ); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); + } + + + } } diff --git a/classes/data/dataRegions.php b/classes/data/dataRegions.php new file mode 100644 index 00000000..df9a5022 --- /dev/null +++ b/classes/data/dataRegions.php @@ -0,0 +1,148 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * EventManagementDataRegions class + * + * PHP version 5 + * + * @category Data + * @package EventManagement + * @author Chuck Scott + * @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/ + */ +abstract class GlmDataRegions 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 . 'regions'; + + /* + * Table Data Fields + */ + $this->fields = array( + + 'id' => array( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Name + 'name' => array( + 'field' => 'name', + 'type' => 'text', + 'required' => true, + 'unique' => true, + '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 diff --git a/classes/glmPluginSupport.php b/classes/glmPluginSupport.php index b7f4dd6e..b7f94416 100644 --- a/classes/glmPluginSupport.php +++ b/classes/glmPluginSupport.php @@ -23,23 +23,53 @@ class GlmPluginSupport /* * Add a message to the 'glmMembersAdminNotices' option for output later. * + * Messages that don't have a $type specified are displayed in + * the admin WordPress message area. + * + * Messages that have a $type are for the debug window and are categorized + * as follows and in this order in the debug window + * Alert Placed sequentially in the Alerts list + * Process Placed sequentially in the process list + * DataBlock Placed in a colored data block. Requires a $title + * * @param string $message + * @param string $type + * @param string $title * * @return void * @access public */ - public static function addNotice ($message, $title = false) + public static function addNotice ($message, $type = false, $title = false) { - $notices = get_option('glmMembersAdminNotices'); - // If there's a title, include that - $mes = $message; - if ($title) { - $mes = '

'.$title.'
'.$mes."
"; + switch($type) { + + case 'Alert'; + $alerts = get_option('glmMembersAdminNoticeAlerts'); + $alerts[] = $message; + update_option('glmMembersAdminNoticeAlerts', $alerts); + break; + + case 'Process'; + $process = get_option('glmMembersAdminNoticeProcess'); + $process[] = $message; + update_option('glmMembersAdminNoticeProcess', $process); + break; + + case 'DataBlock'; + $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks'); + $dataBlocks[] = array('data' => $message, 'title' => $title); + update_option('glmMembersAdminNoticeDataBlocks', $dataBlocks); + break; + + default; + $notices = get_option('glmMembersAdminNotices'); + $notices[] = $message; + update_option('glmMembersAdminNotices', $notices); + break; + } - $notices[] = $mes; - update_option('glmMembersAdminNotices', $notices); } /* diff --git a/config/colors.ini b/config/colors.ini new file mode 100644 index 00000000..82087c32 --- /dev/null +++ b/config/colors.ini @@ -0,0 +1,120 @@ +; +; Standard color names and codes +; Gaslight Media Members Database Plugin +; + +[common] + +color[800000] = 'maroon' +color[8B0000] = 'darkred' +color[FF0000] = 'red' +color[FFB6C1] = 'lightpink' +color[DC143C] = 'crimson' +color[DB7093] = 'palevioletred' +color[FF69B4] = 'hotpink' +color[FF1493] = 'deeppink' +color[C71585] = 'mediumvioletred' +color[800080] = 'purple' +color[8B008B] = 'darkmagenta' +color[DA70D6] = 'orchid' +color[D8BFD8] = 'thistle' +color[DDA0DD] = 'plum' +color[EE82EE] = 'violet' +color[FF00FF] = 'fuchsia' +color[FF00FF] = 'magenta' +color[BA55D3] = 'mediumorchid' +color[9400D3] = 'darkviolet' +color[9932CC] = 'darkorchid' +color[8A2BE2] = 'blueviolet' +color[4B0082] = 'indigo' +color[9370DB] = 'mediumpurple' +color[6A5ACD] = 'slateblue' +color[7B68EE] = 'mediumslateblue' +color[00008B] = 'darkblue' +color[05367D] = 'mackinawblue' +color[0000CD] = 'mediumblue' +color[0000FF] = 'blue' +color[000080] = 'navy' +color[191970] = 'midnightblue' +color[483D8B] = 'darkslateblue' +color[4169E1] = 'royalblue' +color[6495ED] = 'cornflowerblue' +color[B0C4DE] = 'lightsteelblue' +color[F0F8FF] = 'aliceblue' +color[F8F8FF] = 'ghostwhite' +color[E6E6FA] = 'lavender' +color[1E90FF] = 'dodgerblue' +color[4682B4] = 'steelblue' +color[00BFFF] = 'deepskyblue' +color[708090] = 'slategray' +color[778899] = 'lightslategray' +color[87CEFA] = 'lightskyblue' +color[87CEEB] = 'skyblue' +color[ADD8E6] = 'lightblue' +color[008080] = 'teal' +color[008B8B] = 'darkcyan' +color[00CED1] = 'darkturquoise' +color[00FFFF] = 'aqua' +color[48D1CC] = 'mediumturquoise' +color[5F9EA0] = 'cadetblue' +color[AFEEEE] = 'paleturquoise' +color[E0FFFF] = 'lightcyan' +color[F0FFFF] = 'azure' +color[20B2AA] = 'lightseagreen' +color[40E0D0] = 'turquoise' +color[B0E0E6] = 'powderblue' +color[2F4F4F] = 'darkslategray' +color[7FFFD4] = 'aquamarine' +color[00FA9A] = 'mediumspringgreen' +color[66CDAA] = 'mediumaquamarine' +color[00FF7F] = 'springgreen' +color[3CB371] = 'mediumseagreen' +color[2E8B57] = 'seagreen' +color[32CD32] = 'limegreen' +color[006400] = 'darkgreen' +color[008000] = 'green' +color[00FF00] = 'lime' +color[228B22] = 'forestgreen' +color[8FBC8F] = 'darkseagreen' +color[90EE90] = 'lightgreen' +color[98FB98] = 'palegreen' +color[F5FFFA] = 'mintcream' +color[F0FFF0] = 'honeydew' +color[7FFF00] = 'chartreuse' +color[7CFC00] = 'lawngreen' +color[6B8E23] = 'olivedrab' +color[556B2F] = 'darkolivegreen' +color[9ACD32] = 'yellowgreen' +color[ADFF2F] = 'greenyellow' +color[F5F5DC] = 'beige' +color[FAF0E6] = 'linen' +color[FAFAD2] = 'lightgoldenrodyellow' +color[808000] = 'olive' +color[FFFF00] = 'yellow' +color[FFFFE0] = 'lightyellow' +color[FFFFF0] = 'ivory' +color[BDB76B] = 'darkkhaki' +color[F0E68C] = 'khaki' +color[EEE8AA] = 'palegoldenrod' +color[F5DEB3] = 'wheat' +color[FFD700] = 'gold' +color[FFFACD] = 'lemonchiffon' +color[FFEFD5] = 'papayawhip' +color[B8860B] = 'darkgoldenrod' +color[DAA520] = 'goldenrod' +color[FAEBD7] = 'antiquewhite' +color[FFF8DC] = 'cornsilk' +color[FDF5E6] = 'oldlace' +color[FFE4B5] = 'moccasin' +color[FFDEAD] = 'navajowhite' +color[FFA500] = 'orange' +color[FFE4C4] = 'bisque' +color[D2B48C] = 'tan' +color[FF8C00] = 'darkorange' +color[DEB887] = 'burlywood' +color[8B4513] = 'saddlebrown' +color[F4A460] = 'sandybrown' +color[FFEBCD] = 'blanchedalmond' +color[FFF0F5] = 'lavenderblush' +color[FFF5EE] = 'seashell' +color[FFFAF0] = 'floralwhite' diff --git a/config/countries.ini b/config/countries.ini new file mode 100644 index 00000000..cea09550 --- /dev/null +++ b/config/countries.ini @@ -0,0 +1,247 @@ +; +; Countries +; Gaslight Media Members Database Plugin +; + +[common] + +countries[US] = "United States" +countries[CA] = "Canada" +countries[AF] = "Afghanistan" +countries[AX] = "Land Islands" +countries[AL] = "Albania" +countries[DZ] = "Algeria" +countries[AS] = "American Samoa" +countries[AD] = "Andorra" +countries[AO] = "Angola" +countries[AI] = "Anguilla" +countries[AQ] = "Antarctica" +countries[AG] = "Antigua and Barbuda" +countries[AR] = "Argentina" +countries[AM] = "Armenia" +countries[AW] = "Aruba" +countries[AU] = "Australia" +countries[AT] = "Austria" +countries[AZ] = "Azerbaijan" +countries[BS] = "Bahamas" +countries[BH] = "Bahrain" +countries[BD] = "Bangladesh" +countries[BB] = "Barbados" +countries[BY] = "Belarus" +countries[BE] = "Belgium" +countries[BZ] = "Belize" +countries[BJ] = "Benin" +countries[BM] = "Bermuda" +countries[BT] = "Bhutan" +countries[BO] = "Bolivia" +countries[BA] = "Bosnia and Herzegovina" +countries[BW] = "Botswana" +countries[BV] = "Bouvet Island" +countries[BR] = "Brazil" +countries[IO] = "British Indian Ocean Territory" +countries[BN] = "Brunei Darussalam" +countries[BG] = "Bulgaria" +countries[BF] = "Burkina Faso" +countries[BI] = "Burundi" +countries[KH] = "Cambodia" +countries[CM] = "Cameroon" +countries[CV] = "Cape Verde" +countries[KY] = "Cayman Islands" +countries[CF] = "Central African Republic" +countries[TD] = "Chad" +countries[CL] = "Chile" +countries[CN] = "China" +countries[CX] = "Christmas Island" +countries[CC] = "Cocos (Keeling) Islands" +countries[CO] = "Colombia" +countries[KM] = "Comoros" +countries[CG] = "Congo" +countries[CD] = "Congo, the Democratic Rep. of" +countries[CK] = "Cook Islands" +countries[CR] = "Costa Rica" +countries[CI] = "Cote D'Ivoire" +countries[HR] = "Croatia" +countries[CU] = "Cuba" +countries[CY] = "Cyprus" +countries[CZ] = "Czech Republic" +countries[DK] = "Denmark" +countries[DJ] = "Djibouti" +countries[DM] = "Dominica" +countries[DO] = "Dominican Republic" +countries[EC] = "Ecuador" +countries[EG] = "Egypt" +countries[SV] = "El Salvador" +countries[GQ] = "Equatorial Guinea" +countries[ER] = "Eritrea" +countries[EE] = "Estonia" +countries[ET] = "Ethiopia" +countries[FK] = "Falkland Islands (Malvinas)" +countries[FO] = "Faroe Islands" +countries[FJ] = "Fiji" +countries[FI] = "Finland" +countries[FR] = "France" +countries[GF] = "French Guiana" +countries[PF] = "French Polynesia" +countries[TF] = "French Southern Territories" +countries[GA] = "Gabon" +countries[GM] = "Gambia" +countries[GE] = "Georgia" +countries[DE] = "Germany" +countries[GH] = "Ghana" +countries[GI] = "Gibraltar" +countries[GR] = "Greece" +countries[GL] = "Greenland" +countries[GD] = "Grenada" +countries[GP] = "Guadeloupe" +countries[GU] = "Guam" +countries[GT] = "Guatemala" +countries[GN] = "Guinea" +countries[GW] = "Guinea-Bissau" +countries[GY] = "Guyana" +countries[HT] = "Haiti" +countries[HM] = "Heard Island, McDonald Islands" +countries[VA] = "Holy see (Vatican City State)" +countries[HN] = "Honduras" +countries[HK] = "Hong Kong" +countries[HU] = "Hungary" +countries[IS] = "Iceland" +countries[IN] = "India" +countries[ID] = "Indonesia" +countries[IR] = "Iran, Islamic Republic of" +countries[IQ] = "Iraq" +countries[IE] = "Ireland" +countries[IL] = "Israel" +countries[IT] = "Italy" +countries[JM] = "Jamaica" +countries[JP] = "Japan" +countries[JO] = "Jordan" +countries[KZ] = "Kazakhstan" +countries[KE] = "Kenya" +countries[KI] = "Kiribati" +countries[KP] = "Korea, Democratic People's Rep. of" +countries[KR] = "Korea, Republic of" +countries[KW] = "Kuwait" +countries[KG] = "Kyrgyzstan" +countries[LA] = "Lao People's Democratic Republic" +countries[LV] = "Latvia" +countries[LB] = "Lebanon" +countries[LS] = "Lesotho" +countries[LR] = "Liberia" +countries[LY] = "Libyan Arab Jamahiriya" +countries[LI] = "Liechtenstein" +countries[LT] = "Lithuania" +countries[LU] = "Luxembourg" +countries[MO] = "Macao" +countries[MK] = "Macedonia, the Former Yugoslav Rep." +countries[MG] = "Madagascar" +countries[MW] = "Malawi" +countries[MY] = "Malaysia" +countries[MV] = "Maldives" +countries[ML] = "Mali" +countries[MT] = "Malta" +countries[MH] = "Marshall Islands" +countries[MQ] = "Martinique" +countries[MR] = "Mauritania" +countries[MU] = "Mauritius" +countries[YT] = "Mayotte" +countries[MX] = "Mexico" +countries[FM] = "Micronesia, Federated States of" +countries[MD] = "Moldova, Republic of" +countries[MC] = "Monaco" +countries[MN] = "Mongolia" +countries[MS] = "Montserrat" +countries[MA] = "Morocco" +countries[MZ] = "Mozambique" +countries[MM] = "Myanmar" +countries[NA] = "Namibia" +countries[NR] = "Nauru" +countries[NP] = "Nepal" +countries[NL] = "Netherlands" +countries[AN] = "Netherlands Antilles" +countries[NC] = "New Caledonia" +countries[NZ] = "New Zealand" +countries[NI] = "Nicaragua" +countries[NE] = "Niger" +countries[NG] = "Nigeria" +countries[NU] = "Niue" +countries[NF] = "Norfolk Island" +countries[MP] = "Northern Mariana Islands" +countries[NO] = "Norway" +countries[OM] = "Oman" +countries[PK] = "Pakistan" +countries[PW] = "Palau" +countries[PS] = "Palestinian Territory, Occupied" +countries[PA] = "Panama" +countries[PG] = "Papua New Guinea" +countries[PY] = "Paraguay" +countries[PE] = "Peru" +countries[PH] = "Philippines" +countries[PN] = "Pitcairn" +countries[PL] = "Poland" +countries[PT] = "Portugal" +countries[PR] = "Puerto Rico" +countries[QA] = "Qatar" +countries[RE] = "Reunion" +countries[RO] = "Romania" +countries[RU] = "Russian Federation" +countries[RW] = "Rwanda" +countries[SH] = "Saint Helena" +countries[KN] = "Saint Kitts and Nevis" +countries[LC] = "Saint Lucia" +countries[PM] = "Saint Pierre and Miquelon" +countries[VC] = "Saint Vincent and the Grenadines" +countries[WS] = "Samoa" +countries[SM] = "San Marino" +countries[ST] = "Sao Tome and Principe" +countries[SA] = "Saudi Arabia" +countries[SN] = "Senegal" +countries[CS] = "Serbia and Montenegro" +countries[SC] = "Seychelles" +countries[SL] = "Sierra Leone" +countries[SG] = "Singapore" +countries[SK] = "Slovakia" +countries[SI] = "Slovenia" +countries[SB] = "Solomon Islands" +countries[SO] = "Somalia" +countries[ZA] = "South Africa" +countries[GS] = "South Georgia, South Sandwich Islands" +countries[ES] = "Spain" +countries[LK] = "Sri Lanka" +countries[SD] = "Sudan" +countries[SR] = "Suriname" +countries[SJ] = "Svalbard and Jan Mayen" +countries[SZ] = "Swaziland" +countries[SE] = "Sweden" +countries[CH] = "Switzerland" +countries[SY] = "Syrian Arab Republic" +countries[TW] = "Taiwan, Province of China" +countries[TJ] = "Tajikistan" +countries[TZ] = "Tanzania, United Republic of" +countries[TH] = "Thailand" +countries[TL] = "Timor-Leste" +countries[TG] = "Togo" +countries[TK] = "Tokelau" +countries[TO] = "Tonga" +countries[TT] = "Trinidad and Tobago" +countries[TN] = "Tunisia" +countries[TR] = "Turkey" +countries[TM] = "Turkmenistan" +countries[TC] = "Turks and Caicos Islands" +countries[TV] = "Tuvalu" +countries[UG] = "Uganda" +countries[UA] = "Ukraine" +countries[AE] = "United Arab Emirates" +countries[GB] = "United Kingdom" +countries[UM] = "United States minor outlying islands" +countries[UY] = "Uruguay" +countries[UZ] = "Uzbekistan" +countries[VU] = "Vanuatu" +countries[VE] = "Venezuela" +countries[VN] = "Viet Nam" +countries[VG] = "Virgin Islands, British" +countries[VI] = "Virgin Islands, U.S." +countries[WF] = "Wallis and Futuna" +countries[EH] = "Western Sahara" +countries[YE] = "Yemen" +countries[ZM] = "Zambia" +countries[ZW] = "Zimbabwe" diff --git a/config/plugin.ini b/config/plugin.ini new file mode 100644 index 00000000..914cc452 --- /dev/null +++ b/config/plugin.ini @@ -0,0 +1,157 @@ +; +; Main Configuration File +; Gaslight Media Members Database Plugin +; +; Custom configurations for development and developer configuration at bottom of file. +; + +[common] + +; +; Entry Status Types +; +status[10] = 'Active' +status[20] = 'Inactive' +status[30] = 'Pending Review' +status[40] = 'Archived' + +status_numb['None'] = 0 +status_numb['Active'] = 10 +status_numb['Inactive'] = 20 +status_numb['Pending'] = 30 +status_numb['Archived'] = 40 + +; +; Entity Reference Type +; +ref_type[0] = 'None' +ref_type[10] = 'Member' +ref_type[20] = 'Location' +ref_type[30] = 'Facility' +ref_type[40] = 'Activity' +ref_type[50] = 'Golf' +ref_type[60] = 'Restaurant' +ref_type[70] = 'Contact' + +ref_type_numb['None'] = 0 +ref_type_numb['Member'] = 10 +ref_type_numb['Location'] = 20 +ref_type_numb['Facility'] = 30 +ref_type_numb['Activity'] = 40 +ref_type_numb['Golf'] = 50 +ref_type_numb['Restaurant'] = 60 +ref_type_numb['Contact'] = 70 + +; +; 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 +facility_type_numb['Golf'] = 40 + +; +; Contact Type +; +contact_type[0] = 'None' +contact_type[10] = 'Personal' +contact_type[20] = 'Role' + +contact_type_numb['None'] = 0 +contact_type_numb['Personal'] = 10 +contact_type_numb['Role'] = 20 + +; +; Invoice Delivery +; +invoice_delivery[0] = 'None' +invoice_delivery[10] = 'E-Mail' +invoice_delivery[20] = 'US Mail' +invoice_delivery[30] = 'FAX' +invoice_delivery[40] = 'Hand' + +invoice_delivery_numb['None'] = 0 +invoice_delivery_numb['Email'] = 10 +invoice_delivery_numb['USPS'] = 20 +invoice_delivery_numb['FAX'] = 30 +invoice_delivery_numb['Hand'] = 40 + +; +; Payment Type +; +payment_type[0] = 'None' +payment_type[10] = 'Upon Arrival' +payment_type[20] = 'Corporate Account' +payment_type[30] = 'Check By Mail' +payment_type[40] = 'Credit Card' +payment_type[50] = 'Debit Card' +payment_type[60] = 'PayPal' + +payment_type_numb['None'] = 0 +payment_type_numb['UponArrival'] = 10 +payment_type_numb['CorpAccount'] = 20 +payment_type_numb['CheckByMail'] = 30 +payment_type_numb['CreditCard'] = 40 +payment_type_numb['DebitCard'] = 50 +payment_type_numb['PayPal'] = 60 + +; 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" + +; +; Common Terms/Phrases +; + +; Admin Menus +term['term_admin_menu_members'] = 'Members' +term['term_admin_menu_member'] = 'Member' +term['term_admin_menu_configure'] = 'Configure' + +; General Terms +term['term_member'] = 'member' +term['term_member_cap'] = 'Member' +term['term_member_plur'] = 'members' +term['term_member_plur_cap'] = 'Members' + +term['term_location'] = 'location' +term['term_location_cap'] = 'Location' +term['term_location_plur'] = 'locations' +term['term_location_plur_cap'] = 'Locations' + +term['term_facility'] = 'facility' +term['term_facility_cap'] = 'Facility' +term['term_facility_plur'] = 'facilities' +term['term_facility_plur_cap'] = 'Facilities' + +term['term_attraction'] = 'attraction' +term['term_attraction_cap'] = 'Attraction' +term['term_attraction_plur'] = 'attractions' +term['term_attraction_plur_cap'] = 'Attractions' + +term['term_contact'] = 'contact' +term['term_contact_cap'] = 'Contact' +term['term_contact_plur'] = 'contacts' +term['term_contact_plur_cap'] = 'Contacts' + +; Phrases +phrase['phrase_test'] = 'test' + + +[development:common] + + +[chuck:common] + diff --git a/config/states.ini b/config/states.ini new file mode 100644 index 00000000..b36d8885 --- /dev/null +++ b/config/states.ini @@ -0,0 +1,77 @@ +; +; States +; Gaslight Media Members Database Plugin +; + +[common] +states['AL'] = 'Alabama' +states['AK'] = 'Alaska' +states['AB'] = 'Alberta' +states['AZ'] = 'Arizona' +states['AR'] = 'Arkansas' +states['BC'] = 'British Columbia' +states['CA'] = 'California' +states['CO'] = 'Colorado' +states['CT'] = 'Connecticut' +states['DE'] = 'Delaware' +states['DC'] = 'District of Columbia' +states['FL'] = 'Florida' +states['GA'] = 'Georgia' +states['GU'] = 'Guam' +states['HI'] = 'Hawaii' +states['ID'] = 'Idaho' +states['IL'] = 'Illinois' +states['IN'] = 'Indiana' +states['IA'] = 'Iowa' +states['KS'] = 'Kansas' +states['KY'] = 'Kentucky' +states['LA'] = 'Louisiana' +states['ME'] = 'Maine' +states['MB'] = 'Manitoba' +states['MD'] = 'Maryland' +states['MA'] = 'Massachusetts' +states['MI'] = 'Michigan' +states['MN'] = 'Minnesota' +states['MS'] = 'Mississppi' +states['MO'] = 'Missouri' +states['MT'] = 'Montana' +states['NE'] = 'Nebraska' +states['NV'] = 'Nevada' +states['NB'] = 'New Brunswick' +states['NF'] = 'Newfoundland' +states['NH'] = 'New Hampshire' +states['NJ'] = 'New Jersey' +states['NM'] = 'New Mexico' +states['NY'] = 'New York' +states['NC'] = 'North Carolina' +states['ND'] = 'North Dakota' +states['NT'] = 'Northwest Territories' +states['NS'] = 'Nova Scotia' +states['OH'] = 'Ohio' +states['OK'] = 'Oklahoma' +states['ON'] = 'Ontario' +states['OR'] = 'Oregon' +states['PA'] = 'Pennsylvania' +states['PE'] = 'Prince Edward Island' +states['PR'] = 'Puerto Rico' +states['QC'] = 'Quebec' +states['RI'] = 'Rhode Island' +states['SK'] = 'Saskatchewan' +states['SC'] = 'South Carolina' +states['SD'] = 'South Dakota' +states['TN'] = 'Tennessee' +states['TX'] = 'Texas' +states['UT'] = 'Utah' +states['VT'] = 'Vermont' +states['VI'] = 'Virgin Islands' +states['VA'] = 'Virginia' +states['WA'] = 'Washington' +states['WV'] = 'West Virginia' +states['WI'] = 'Wisconsin' +states['WY'] = 'Wyoming' +states['YT'] = 'Yukon' + +[development:common] + + +[chuck:common] diff --git a/controllers/admin.php b/controllers/admin.php index 293a282a..67b05eb9 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -43,9 +43,8 @@ $GLOBALS['glmMembersAdminValidActions'] = array( , 'configure' => array( 'index', + 'memberTypes', 'cities', - 'states', - 'countries', 'regions' ), 'error' => array( @@ -215,6 +214,7 @@ class glmMembersAdmin extends GlmPluginSupport wp_enqueue_script('jquery-style'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-dialog'); + wp_enqueue_style("wp-jquery-ui-dialog"); wp_enqueue_media(); wp_register_script('glm-members-admin-js', @@ -230,6 +230,7 @@ class glmMembersAdmin extends GlmPluginSupport GLM_MEMBERS_PLUGIN_URL . 'css/admin.css'); wp_enqueue_style('glmMembersAdminStyle'); + } /** @@ -361,16 +362,24 @@ class glmMembersAdmin extends GlmPluginSupport if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - // Get all defiend constants then if not VERBOSE select out only user contstants + // If debug is VERBOSE $consts = get_defined_constants(true); - if (!GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - $consts = $consts['user']; + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + $this->addNotice("
".print_r($_SERVER,1).'
', 'DataBlock', 'Server Defines'); + $this->addNotice('
'.print_r($consts,1).'
', 'DataBlock', 'Defined Parameters'); + // Not verbose } else { - $this->addNotice("
".print_r($_SERVER,1)."
", "Server Defines"); + $ourConsts = array(); + foreach ($consts['user'] as $k => $v) { + if (strncmp($k, 'GLM_MEMBERS_PLUGIN', 18) == 0) { + $ourConsts[$k] = $v; + } + } + $this->addNotice('
'.print_r($ourConsts,1).'
', 'DataBlock', 'Defined Parameters'); } - $this->addNotice("
".print_r($consts,1)."
", "Defined Parameters"); - $this->addNotice("
".print_r($_REQUEST,1)."
", "Request Data"); + $this->addNotice('
'.print_r($this->config,1).'
', 'DataBlock', 'Configuration Settings'); + $this->addNotice("
".print_r($_REQUEST,1)."
", 'DataBlock', "Request Data"); } /* @@ -395,7 +404,7 @@ class glmMembersAdmin extends GlmPluginSupport do { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - $this->addNotice("Requested Action: Menu item = $menuItem, Action = $action"); + $this->addNotice("Requested Action: Menu item = $menuItem, Action = $action", 'Process'); } $modelRedirect = false; @@ -403,6 +412,10 @@ class glmMembersAdmin extends GlmPluginSupport // Verify that we have the requested menu item in the valid actions if (!isset($GLOBALS['glmMembersAdminValidActions'][$menuItem])) { + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + $this->addNotice('Error in Admin Controller: Menu Item not specified!', 'Alert'); + } + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -414,6 +427,11 @@ class glmMembersAdmin extends GlmPluginSupport if (! isset($GLOBALS['glmMembersAdminValidActions'][$menuItem]) || ! in_array($action, $GLOBALS['glmMembersAdminValidActions'][$menuItem])) { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + $this->addNotice('Error in Admin Controller: Requested Menu Item is invalid!', 'Alert'); + } + $menuItem = 'error'; $action = 'badAction'; } @@ -430,6 +448,10 @@ class glmMembersAdmin extends GlmPluginSupport // If model file doesn't exist - we have an error if (!file_exists($modelName)) { + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + $this->addNotice("Error in Admin Controller: Model file doesn't exist - ".$modelName, 'Alert'); + } + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -444,6 +466,10 @@ class glmMembersAdmin extends GlmPluginSupport // check for an invalid model class name if (!class_exists($className)) { + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + $this->addNotice("Error in Admin Controller: Invalid Model Class Name - ".$className, 'Alert'); + } + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -454,7 +480,6 @@ class glmMembersAdmin extends GlmPluginSupport // Check if this is a re-direct with parameters $args = false; - // Instantiate the model and ask it to perform the work $model = new $className($this->wpdb, $this->config); $results = $model->modelAction($redirectData); @@ -486,6 +511,11 @@ class glmMembersAdmin extends GlmPluginSupport // Check for invalid or missing view file if (!$view || !is_file(GLM_MEMBERS_PLUGIN_DIR . '/views/'.$view)) { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + $this->addNotice("Error in Admin Controller: Requested View file doesn't exist - ".$view, 'Alert'); + } + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -501,7 +531,7 @@ class glmMembersAdmin extends GlmPluginSupport } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG && $modelRedirect) { - $this->addNotice('Redirecting...'); + $this->addNotice('Redirecting...', 'Process'); } // Loop again if there's a model redirect @@ -527,6 +557,15 @@ class glmMembersAdmin extends GlmPluginSupport require (GLM_MEMBERS_PLUGIN_DIR . '/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 ( 'thisPage', $_REQUEST['page']); + $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME ); + $smarty->templateAssign ( 'thisYear', date ( 'Y' ) ); + $smarty->templateAssign ( $this->config['term']); + $smarty->templateAssign ( $this->config['phrase']); + // Add data from model to Smarty template if (is_array($results['data']) && count($results['data']) > 0) { foreach ($results['data'] as $k => $d) { @@ -545,11 +584,16 @@ class glmMembersAdmin extends GlmPluginSupport // If view debug has been requested if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("Template Data
$view"); + glmMembersAdmin::addNotice("Template File: $view", 'Process'); $x = $smarty->template->getTemplateVars(); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice($x, 'DataBlock', 'Template Parameters'); + } + $templateVars = '
' . print_r($x, 1) . '
'; - glmMembersAdmin::addNotice($templateVars, 'Template Parameters'); + glmMembersAdmin::addNotice($templateVars, 'Template Parameters', 'Process'); } // Generate output from model data and view diff --git a/controllers/front.php b/controllers/front.php index 9dc68e7b..ff08b322 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -196,8 +196,8 @@ class glmMembersFront extends GlmPluginSupport $consts = $consts['user']; } - $this->addNotice("
".print_r($consts,1)."
", "Defined Parameters"); - $this->addNotice("
".print_r($_REQUEST,1)."
", "Request Data"); + $this->addNotice("
".print_r($consts,1)."
", 'DataBlock', "Defined Parameters"); + $this->addNotice("
".print_r($_REQUEST,1)."
", 'DataBlock', "Request Data"); } /* @@ -223,7 +223,7 @@ class glmMembersFront extends GlmPluginSupport if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) { $this->addNotice( - "Requested Action: Menu item = $menuItem, Action = $action"); + "Requested Action: Menu item = $menuItem, Action = $action", 'Process'); } $modelRedirect = false; @@ -330,7 +330,7 @@ class glmMembersFront extends GlmPluginSupport } if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG && $modelRedirect) { - $this->addNotice('Redirecting...'); + $this->addNotice('Redirecting...', 'Process'); } // Loop again if there's a model redirect @@ -356,6 +356,17 @@ class glmMembersFront extends GlmPluginSupport require (GLM_MEMBERS_PLUGIN_DIR . '/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 ( 'thisPage', $_REQUEST['page']); + $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME ); + $smarty->templateAssign ( 'thisYear', date ( 'Y' ) ); + + // Add all terms and phrases from the config/plugin.ini file + $smarty->templateAssign ( 'terms', $this->config->term); + $smarty->templateAssign ( 'phrase', $this->config->phrase); + // Add data from model to Smarty template if (is_array($results['data']) && count($results['data']) > 0) { foreach ($results['data'] as $k => $d) { @@ -373,11 +384,11 @@ class glmMembersFront extends GlmPluginSupport // If view debug has been requested if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) { - glmMembersFront::addNotice("Template Data
$view"); + glmMembersFront::addNotice("Template File:
$view", 'Process'); $x = $smarty->template->getTemplateVars(); $templateVars = '
' . print_r($x, 1) . '
'; - glmMembersFront::addNotice($templateVars, 'Template Parameters'); + glmMembersFront::addNotice($templateVars, 'DataBlock', 'Template Parameters'); } // Generate output from model data and view diff --git a/css/admin.css b/css/admin.css index d9a6c77e..dcaf0523 100644 --- a/css/admin.css +++ b/css/admin.css @@ -13,6 +13,9 @@ .glm-notice { color: red; } +.glm-active { + color: blue; +} .glm-right { float: right; } @@ -70,12 +73,11 @@ } /* Overlay dialog box */ -.glm-dialog-box { +.ui-dialog { background: #fff; border: 1px black solid; border-radius: 7px; padding: 5px; - z-axis: 100; } .glm-dialog-no-close .ui-dialog-titlebar-close { display: none; diff --git a/defines.php b/defines.php index a92689b0..e93d3a2c 100644 --- a/defines.php +++ b/defines.php @@ -1,9 +1,8 @@ - - - - -
'.date('m/d/Y G:i:s A').'
-
'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data
+ + + + + + +
'.date('m/d/Y G:i:s A').'
+
'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data
'; - } - // Start with div class to output in standard admin notice block - $output .= '

'; + // Display alerts + $alerts = get_option('glmMembersAdminNoticeAlerts'); + if(is_array($alerts)) { + $output .= '

Alerts

'; + foreach($alerts as $a) { + $output .= $a.'
'; + } + } else { + $output .= '

Alerts

'; + } + $output .= '

'; + delete_option('glmMembersAdminNoticeAlerts'); + + // Display process messages + $process = get_option('glmMembersAdminNoticeProcess'); + $output .= '

Processing

'; + if(is_array($process)) { + foreach($process as $p) { + $output .= $p.'
'; + } + } + $output .= '

'; + delete_option('glmMembersAdminNoticeProcess'); + + // Display data blocks table of contents then the data blocks + $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks'); + $output .= '

Data Blocks

    '; + $n = 0; + if (is_array($dataBlocks)) { + foreach($dataBlocks as $d) { + $output .= '
  • '.$d['title'].'
  • '; + } + } + $output .= '

'; + if (is_array($dataBlocks)) { + reset($dataBlocks); + $n = 0; + foreach($dataBlocks as $d) { + $output .= ' +
+
[Top]
+ +
'.print_r($d['data'],1).'
+
+ '; + } + } + delete_option('glmMembersAdminNoticeDataBlocks'); - // Get the notice texts - $notices = get_option('glmMembersAdminNotices'); + echo $output.' + + + '; - if (is_array($notices) && count($notices) > 0) { + // Otherwise we're outputting data to the message block in the WordPress admin area + } else { - // For each notice retrieved - $br = ''; - foreach($notices as $n) { + // Start with div class to output in standard admin notice block + $output .= '

'; - // Add the notice to the output - $output .= $br.$n; - $br = '
'; - } + // Get the notice texts + $notices = get_option('glmMembersAdminNotices'); - } + if (is_array($notices) && count($notices) > 0) { - // Output the notices - $output .= '

'; + // For each notice retrieved + $br = ''; + foreach($notices as $n) { + // Add the notice to the output + $output .= $br.$n; + $br = '
'; + } - // If windowed, also include HTML header and stylesheet - if ($windowed) { - $output .= ' - - - '; - } + } - echo $output; + echo $output.'

'; - // Delete the option containing the notices to indicate they have been sent - delete_option('glmMembersAdminNotices'); + // Delete the option containing the notices to indicate they have been sent + delete_option('glmMembersAdminNotices'); + + } } // Check if there's admin notices for output diff --git a/lib/GlmDataAbstract/DataAbstract.php b/lib/GlmDataAbstract/DataAbstract.php index 40d64a4e..f16ec2c2 100755 --- a/lib/GlmDataAbstract/DataAbstract.php +++ b/lib/GlmDataAbstract/DataAbstract.php @@ -545,21 +545,28 @@ abstract class GlmDataAbstract */ 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 = $f['p_id']." = T.".$f['field']; - if ($f['p_where']) { + $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 ($f['p_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 ($f['p_sum']) { + if (isset($f['p_sum']) && $f['p_sum']) { $field_val = 'COALESCE(sum('.$field_val.'), 0) '; } @@ -574,9 +581,16 @@ abstract class GlmDataAbstract } function pointerOptions($f) { + + // Get ID field of other table - default to 'id' + $p_id = 'id'; + if(isset($f['p_id'])) { + $p_id = $f['p_id']; + } + $sql = " SELECT " - .$f['p_id'].", ".$f['p_field']." + .$p_id.", ".$f['p_field']." FROM " .$f['p_table']." ORDER BY " @@ -614,8 +628,15 @@ abstract class GlmDataAbstract if ($f['p_where']) { $where = 'WHERE '.$f['p_where']; } + + // Get ID field of other table - default to 'id' + $p_id = 'id'; + if(isset($f['p_id'])) { + $p_id = $f['p_id']; + } + $sql = " - SELECT ".$f['p_id']." AS p_id, + SELECT ".$p_id." AS p_id, ".$f['p_field']." AS p_value FROM ".$f['p_table']." $where @@ -628,10 +649,14 @@ abstract class GlmDataAbstract $selected_name = ''; $pick_list = array(); - if ($f['p_blank']) { + $blankText = ''; + if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') { + $blankText = $f['p_blank_text']; + } + if (isset($f['p_blank']) && $f['p_blank']) { $pick_list[0] = array( 'value' => '', - 'name' => '(none selected)', + 'name' => $blankText, 'default' => ($p['p_id'] == '') ); } @@ -669,7 +694,7 @@ abstract class GlmDataAbstract 'value' => $p_value, 'name' => $selected_name, 'nameEsc' => addslashes($selected_name), - 'pick_list' => $pick_list + 'list' => $pick_list ); return $r; @@ -691,12 +716,19 @@ abstract class GlmDataAbstract // Get picklist options from other table $where = ''; - if ($f['p_where']) { + if (isset($f['p_where']) && $f['p_where'] != '') { $where = 'WHERE '.$f['p_where']; } + + // Get ID field of other table - default to 'id' + $p_id = 'id'; + if(isset($f['p_id'])) { + $p_id = $f['p_id']; + } + $sql = " SELECT " - .$f['p_id']." AS p_id, + .$p_id." AS p_id, " .$f['p_field']." AS p_value FROM " @@ -756,6 +788,21 @@ abstract class GlmDataAbstract if (count($p_list) > 0) { $pick_list = array(); + + // Deal with optional blank entry + $blankText = ''; + if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') { + $blankText = $f['p_blank_text']; + } + if (isset($f['p_blank']) && $f['p_blank']) { + $pick_list[0] = array( + 'value' => '', + 'name' => $blankText, + 'nameEsc' => addslashes($blankText), + 'default' => false + ); + } + reset($p_list); foreach ($p_list as $p) { @@ -821,7 +868,7 @@ abstract class GlmDataAbstract 'value' => $in, 'name' => $selected_name, 'nameEsc' => addslashes($selected_name), - 'pick_list' => $pick_list + 'list' => $pick_list ); return $r; @@ -880,7 +927,7 @@ abstract class GlmDataAbstract ); // if the list is not required, dump it now. (List, Get, Delete, Confirm delete) - if (in_array($op, array(l, g, d, c))) { + if (in_array($op, array('l', 'g', 'd', 'c'))) { $r['list'] = false; } @@ -2543,7 +2590,7 @@ abstract class GlmDataAbstract WHERE $where;"; if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($sql,1)."
", "DataAbstract - getStats() query"); + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getStats() query"); } $stats = $this->wpdb->get_row($sql, ARRAY_A); @@ -2581,7 +2628,7 @@ abstract class GlmDataAbstract } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($sql,1)."
", "DataAbstract - getList() query"); + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query"); } //echo "
$sql
"; @@ -2622,7 +2669,7 @@ abstract class GlmDataAbstract ;"; if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($sql,1)."
", "DataAbstract - getEntry() query"); + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getEntry() query"); } $detail = $this->wpdb->get_row($sql, ARRAY_A); @@ -2713,7 +2760,7 @@ abstract class GlmDataAbstract $r['insertedID'] = $this->wpdb->insert_id; if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($sql,1)."
", "DataAbstract - insertEntry() query"); + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - insertEntry() query"); } // Get the data again for output @@ -2742,7 +2789,7 @@ abstract class GlmDataAbstract ;"; if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($sql,1)."
", "DataAbstract - editEntry() query"); + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - editEntry() query"); } $detail = $this->wpdb->get_row($sql, ARRAY_A); @@ -2821,7 +2868,7 @@ abstract class GlmDataAbstract "; if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($sql,1)."
", "DataAbstract - updateEntry() query"); + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - updateEntry() query"); } // Now store the field data @@ -2878,7 +2925,7 @@ abstract class GlmDataAbstract "; if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($sql,1)."
", "DataAbstract - deleteEntry() query"); + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - deleteEntry() query"); } // Assume things will go fine diff --git a/lib/GlmDataAbstract/documentation.txt b/lib/GlmDataAbstract/documentation.txt index ea0f0e60..88a50c9d 100644 --- a/lib/GlmDataAbstract/documentation.txt +++ b/lib/GlmDataAbstract/documentation.txt @@ -301,6 +301,8 @@ Field Specifications: 'p_blank' If set or true provide a "blank" option for pointer input +'p_blank_text' If set, use this as the text for the 'p_blank' option + 'p_sort' Optional ORDER BY sort clause (i.e. "name, age DESC") - May not be functional yet. 'p_orderby' Optional "ORDER BY" clause for results from table pointed to by pointer diff --git a/lib/smartyTemplateSupport.php b/lib/smartyTemplateSupport.php index c50da953..1a150800 100644 --- a/lib/smartyTemplateSupport.php +++ b/lib/smartyTemplateSupport.php @@ -57,13 +57,6 @@ class smartyTemplateSupport { $this->template = new Smarty (); - // Add standard parameters - $this->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG); - $this->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL ); - $this->templateAssign ( 'thisPage', $_REQUEST['page']); - $this->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME ); - $this->templateAssign ( 'thisYear', date ( 'Y' ) ); - /* * Configure Smarty Templates for this site */ diff --git a/misc/databaseScripts/create_database_V0.1.sql b/misc/databaseScripts/create_database_V0.1.sql index 0d7fdf7e..91a93fe0 100644 --- a/misc/databaseScripts/create_database_V0.1.sql +++ b/misc/databaseScripts/create_database_V0.1.sql @@ -6,27 +6,18 @@ -- To permit each query below to be executed separately, -- all queries must be separated by a line with ---- -CREATE TABLE {prefix}cities ( +CREATE TABLE {prefix}member_type ( id INT NOT NULL AUTO_INCREMENT, name TINYTEXT NULL, + descr TINYTEXT NULL, PRIMARY KEY (id) ); ---- -CREATE TABLE {prefix}states ( - id INT NOT NULL AUTO_INCREMENT, - name TINYTEXT NULL, - code TINYTEXT NULL, - PRIMARY KEY (id) -); - ----- - -CREATE TABLE {prefix}countries ( +CREATE TABLE {prefix}cities ( id INT NOT NULL AUTO_INCREMENT, name TINYTEXT NULL, - code TINYTEXT NULL, PRIMARY KEY (id) ); @@ -76,7 +67,7 @@ CREATE TABLE {prefix}members ( CREATE TABLE {prefix}locations ( id INT NOT NULL AUTO_INCREMENT, status INT NULL, - location_type ENUM('hotel','restaurant') NULL, + location_type INT NULL, member INT NULL, name TINYTEXT NULL, descr TEXT NULL, @@ -105,7 +96,7 @@ CREATE TABLE {prefix}locations ( CREATE TABLE {prefix}facilities ( id INT NOT NULL AUTO_INCREMENT, status INT NULL, - facility_type ENUM('hotel_motel','bandb','restaurant','golf') NULL, + facility_type INT NULL, location INT NULL, name TINYTEXT NULL, descr TEXT NULL, @@ -143,7 +134,7 @@ CREATE TABLE {prefix}activties ( notes TEXT NULL, create_time TIMESTAMP NULL, modify_time TIMESTAMP NULL, - ref_type ENUM('member','location','facility') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); @@ -160,7 +151,7 @@ CREATE TABLE {prefix}accommodations ( reservation_url TINYTEXT NULL, reservation_id TINYTEXT NULL, year_round TINYINT(1) NULL, - ref_type ENUM('member','location','facility') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); @@ -178,9 +169,9 @@ CREATE TABLE {prefix}golf ( yardage TINYTEXT NULL, slope TINYTEXT NULL, walking TINYINT(1) NULL, - holes ENUM('9','18') NULL, + holes INT NULL, reservation_url TINYTEXT NULL, - ref_type ENUM('member','location','facility') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); @@ -202,7 +193,7 @@ CREATE TABLE {prefix}restaurants ( alcohol TINYINT(1) NULL, non_smoking TINYINT(1) NULL, notes TEXT NULL, - ref_type ENUM('member','location','facility') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); @@ -265,11 +256,11 @@ CREATE TABLE {prefix}meals ( CREATE TABLE {prefix}contacts ( id INT NOT NULL AUTO_INCREMENT, status INT NULL, - ref_type ENUM('member','location','facility','activity') NULL, + ref_type INT NULL, ref_dest INT NULL, fname TINYTEXT NULL, lname TINYTEXT NULL, - contact_type ENUM('personal','role') NULL, + contact_type INT NULL, org TINYTEXT NULL, addr1 TINYTEXT NULL, addr2 TINYTEXT NULL, @@ -303,7 +294,7 @@ CREATE TABLE {prefix}amenities ( name TINYTEXT NULL, descr TEXT NULL, short_descr TINYTEXT NULL, - facility_type ENUM('hotel_motel','bandb','restaurant','golf') NULL, + facility_type INT NULL, PRIMARY KEY (id) ); @@ -321,7 +312,7 @@ CREATE TABLE {prefix}social_media ( CREATE TABLE {prefix}social_media_member ( id INT NOT NULL AUTO_INCREMENT, - ref_type ENUM('member','location','facility','contact') NULL, + ref_type INT NULL, ref_dest INT NULL, social_media INT NULL, url TINYTEXT NULL, @@ -333,7 +324,7 @@ CREATE TABLE {prefix}social_media_member ( CREATE TABLE {prefix}amenity_member ( id INT NOT NULL AUTO_INCREMENT, amenity INT NULL, - ref_type ENUM('member','location','facility') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); @@ -343,8 +334,8 @@ CREATE TABLE {prefix}amenity_member ( CREATE TABLE {prefix}accounts ( id INT NOT NULL AUTO_INCREMENT, member INT NULL, - payment_type ENUM('credit_card','check') NULL, - invoice_delivery ENUM('email','usmail','fax') NULL, + payment_type INT NULL, + invoice_delivery INT NULL, PRIMARY KEY (id) ); @@ -365,7 +356,7 @@ CREATE TABLE {prefix}category_member ( id INT NOT NULL AUTO_INCREMENT, cateogory INT NULL, main_category TINYINT(1) NULL, - ref_type ENUM('member','location','facility') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); @@ -381,7 +372,7 @@ CREATE TABLE {prefix}files ( size INT NULL, pending TINYINT(1) NULL, create_date DATE NULL, - ref_type ENUM('member','location','facility') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); @@ -396,7 +387,7 @@ CREATE TABLE {prefix}images ( caption TINYTEXT NULL, pending TINYINT(1) NULL, position INT NULL, - ref_type ENUM('member','location','facility','activity','accommodation','golf','restaurant','contact') NULL, + ref_type INT NULL, ref_dest INT NULL, PRIMARY KEY (id) ); diff --git a/misc/databaseScripts/drop_database_V0.1.sql b/misc/databaseScripts/drop_database_V0.1.sql index 54c65c1d..eee1b69e 100644 --- a/misc/databaseScripts/drop_database_V0.1.sql +++ b/misc/databaseScripts/drop_database_V0.1.sql @@ -5,6 +5,7 @@ DROP TABLE {prefix}members, + {prefix}member_type, {prefix}locations, {prefix}facilities, {prefix}activties, @@ -23,8 +24,6 @@ DROP TABLE {prefix}regions, {prefix}social_media, {prefix}social_media_member, - {prefix}cities, - {prefix}states, - {prefix}countries + {prefix}cities ; diff --git a/models/admin/configure/cities.php b/models/admin/configure/cities.php new file mode 100644 index 00000000..d9e92524 --- /dev/null +++ b/models/admin/configure/cities.php @@ -0,0 +1,187 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Member Types data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataCities.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_cities extends GlmDataCities +{ + + /** + * 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; + $haveCities = false; + $citiew = false; + $error = false; + + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') { + $cities = $this->insertEntry(); + } + + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['cityID'])) { + $id = $_REQUEST['cityID']-0; + if ($id > 0) { + $this->deleteEntry($id, true); + } + } + + // Check if a city ID is supplied + if (isset($_REQUEST['city_id'])) { + // Make sure it's a number + $cityID = $_REQUEST['city_id']-0; + } + + // Check for action option + $option = false; + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { + $option = $_REQUEST['option']; + } + +// Check for options + + // Get a current list of members + $cities = $this->getList(); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($cities, 'DataBlock', 'City Data'); + } + + // If we have list entries - even if it's an empty list + $success = true; + $haveCities = false; + if ($cities !== false) { + + $success = true; + + // If we have any entries + if (count($cities) > 0) { + $haveCities = 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($cities, 'DataBlock', 'Cities Data'); + } + + // Compile template data + $templateData = array( + 'haveCities' => $haveCities, + 'cities' => $cities + ); +echo "!@#!@##"; + // Return status, suggested view, and data to controller + return array( + 'status' => $success, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/configure/cities.html', + 'data' => $templateData + ); + + } + + +} + +?> \ No newline at end of file diff --git a/models/admin/configure/memberTypes.php b/models/admin/configure/memberTypes.php new file mode 100644 index 00000000..6b314b44 --- /dev/null +++ b/models/admin/configure/memberTypes.php @@ -0,0 +1,187 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Member Types data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/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($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; + $haveMemberTypes = false; + $memberTypes = false; + $error = false; + + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') { + $memberData = $this->insertEntry(); + } + + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['memberTypeID'])) { + $id = $_REQUEST['memberTypeID']-0; + if ($id > 0) { + $this->deleteEntry($id, true); + } + } + + // Check if a member ID is supplied + if (isset($_REQUEST['member_id'])) { + // Make sure it's a number + $memberID = $_REQUEST['member_id']-0; + } + + // Check for action option + $option = false; + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { + $option = $_REQUEST['option']; + } + +// Check for options + + // Get a current list of members + $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 diff --git a/models/admin/configure/regions.php b/models/admin/configure/regions.php new file mode 100644 index 00000000..45b7fd63 --- /dev/null +++ b/models/admin/configure/regions.php @@ -0,0 +1,187 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Member Types data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataRegions.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_regions extends GlmDataRegions +{ + + /** + * 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; + $haveRegions = false; + $citiew = false; + $error = false; + + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') { + $regions = $this->insertEntry(); + } + + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['cityID'])) { + $id = $_REQUEST['cityID']-0; + if ($id > 0) { + $this->deleteEntry($id, true); + } + } + + // Check if a city ID is supplied + if (isset($_REQUEST['city_id'])) { + // Make sure it's a number + $cityID = $_REQUEST['city_id']-0; + } + + // Check for action option + $option = false; + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { + $option = $_REQUEST['option']; + } + +// Check for options + + // Get a current list of members + $regions = $this->getList(); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($regions, 'DataBlock', 'City Data'); + } + + // If we have list entries - even if it's an empty list + $success = true; + $haveRegions = false; + if ($regions !== false) { + + $success = true; + + // If we have any entries + if (count($regions) > 0) { + $haveRegions = 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($regions, 'DataBlock', 'Regions Data'); + } + + // Compile template data + $templateData = array( + 'haveRegions' => $haveRegions, + 'regions' => $regions + ); + + // Return status, suggested view, and data to controller + return array( + 'status' => $success, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/configure/regions.html', + 'data' => $templateData + ); + + } + + +} + +?> \ No newline at end of file diff --git a/models/admin/member/index.php b/models/admin/member/index.php index 3cd0887d..3b50ef70 100644 --- a/models/admin/member/index.php +++ b/models/admin/member/index.php @@ -120,7 +120,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers if ($memberID <= 0) { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice('  No member ID supplied.'); + glmMembersAdmin::addNotice('  No member ID supplied.', 'Process'); } return array( @@ -135,7 +135,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("  Member ID specified: $memberID"); + glmMembersAdmin::addNotice("  Member ID specified: $memberID", 'Process'); } // If a delete request has been made, try to delete the member without confirmation @@ -156,7 +156,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($memberData,1)."
", 'Member Data'); + glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data'); } // Compile template data diff --git a/models/admin/member/member.php b/models/admin/member/member.php index 16a88076..eee981f3 100644 --- a/models/admin/member/member.php +++ b/models/admin/member/member.php @@ -126,7 +126,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers $memberData = $this->insertEntry(); if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice('
'.print_r($memberData,1).'
', 'New Member Data'); + glmMembersAdmin::addNotice($memberData, 'DataBlock', 'New Member Data'); } if ($memberData['status']) { @@ -179,7 +179,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers default: if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("  Member ID specified: $memberID"); + glmMembersAdmin::addNotice("  Member ID specified: $memberID", 'Process'); } // If we have a member ID, try to get the member data @@ -195,7 +195,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers } else { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("  Specified Member ID is invalid: $memberID"); + glmMembersAdmin::addNotice("  Specified Member ID is invalid: $memberID", 'Process'); } $error = true; @@ -229,7 +229,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($memberData,1)."
", 'Member Data'); + glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data'); } // Compile template data diff --git a/models/admin/members/index.php b/models/admin/members/index.php index add413d7..11295fa9 100644 --- a/models/admin/members/index.php +++ b/models/admin/members/index.php @@ -105,7 +105,7 @@ class GlmMembersAdmin_members_index extends GlmDataMembers /* if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($list,1)."
", 'Member Data'); + glmMembersAdmin::addNotice($stats, 'DataBlock', 'Member Data'); } // If we have list entries - even if it's an empty list diff --git a/models/admin/members/list.php b/models/admin/members/list.php index c9bbaa56..0ea9c570 100644 --- a/models/admin/members/list.php +++ b/models/admin/members/list.php @@ -103,7 +103,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers $list = $this->getList(); if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice("
".print_r($list,1)."
", 'Member Data'); + glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data'); } // If we have list entries - even if it's an empty list diff --git a/uninstall.php b/uninstall.php index 059590bc..168bbddb 100644 --- a/uninstall.php +++ b/uninstall.php @@ -1,7 +1,7 @@ Add a City
+
+
+ + + + + + + + + + + + + + +
City Name: + +
Description: + +
+

* Required

+ Cancel + + +
+
+
+
+

Are you sure you want to delete this city?

+

Yes, delete this city

+

No, I don't want to delete this city

+
+
+ + +

Cities

+ + + + + + + + + + + + + + + +{if $haveCities} + {assign var="i" value="0"} + {foreach $cities as $t} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + {/foreach} +{else} + +{/if} + +
City 
City 
+ {$t.name} + +
Delete
+
(no cities listed)
+ + + +{include file='admin/footer.html'} diff --git a/views/admin/configure/header.html b/views/admin/configure/header.html index 6d9eff32..a44cbb43 100644 --- a/views/admin/configure/header.html +++ b/views/admin/configure/header.html @@ -4,10 +4,9 @@
\ No newline at end of file diff --git a/views/admin/configure/memberTypes.html b/views/admin/configure/memberTypes.html new file mode 100644 index 00000000..a702086d --- /dev/null +++ b/views/admin/configure/memberTypes.html @@ -0,0 +1,124 @@ +{include file='admin/configure/header.html'} + +
Add a Member Type
+
+
+ + + + + + + + + + + + + + +
Member Type Name: + +
Description: + +
+

* Required

+ Cancel + + +
+
+
+
+

Are you sure you want to delete this member type?

+

Yes, delete this member type

+

No, I don't want to delete this member type

+
+
+ + +

Member Types

+ + + + + + + + + + + + + + + + + +{if $haveMemberTypes} + {assign var="i" value="0"} + {foreach $memberTypes as $t} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + {/foreach} +{else} + +{/if} + +
Member TypeDescription 
Member TypeDescription 
+ {$t.name} + + {$t.descr} + +
Delete
+
(no member types listed)
+ + + +{include file='admin/footer.html'} diff --git a/views/admin/configure/regions.html b/views/admin/configure/regions.html new file mode 100644 index 00000000..aa82f21f --- /dev/null +++ b/views/admin/configure/regions.html @@ -0,0 +1,129 @@ +{include file='admin/configure/header.html'} + +
Add a Region
+
+
+ + + + + + + + + + + + + + +
Region Name: + +
Description: + +
+

* Required

+ Cancel + + +
+
+
+
+

Are you sure you want to delete this region?

+

Yes, delete this region

+

No, I don't want to delete this region

+
+
+ + +

Cities

+ + + + + + + + + + + + + + + + + + + +{if $haveCities} + {assign var="i" value="0"} + {foreach $regions as $t} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + + {/foreach} +{else} + +{/if} + +
RegionDescriptionShort Description 
RegionDescriptionShort Description 
+ {$t.name} + + {$t.descr} + + {$t.short_descr} + +
Delete
+
(no regions listed)
+ + + +{include file='admin/footer.html'} diff --git a/views/admin/member/index.html b/views/admin/member/index.html index 6c97c423..a2dc6e5e 100644 --- a/views/admin/member/index.html +++ b/views/admin/member/index.html @@ -2,7 +2,7 @@ {if !$deleted}
Delete this Member
-
+

Are you sure you want to delete this member?

Yes, delete this member

@@ -13,17 +13,15 @@

{$member.name}

- {if $deleted} -

Member Has Been Deleted!

- {else} - {if $member.active.value} -

This member is active.

- {else} -

Member Not Active

- {/if} - {/if} +

+ + + + {$member.status.name} + + @@ -33,6 +31,7 @@ jQuery(document).ready(function($) { $("#deleteMemberDialog").dialog({ autoOpen: false, + minWidth: 400, dialogClass: "glm-dialog-no-close" }); $('#deleteMemberButton').click( function() { diff --git a/views/admin/member/member.html b/views/admin/member/member.html index 337a09a5..06704f89 100644 --- a/views/admin/member/member.html +++ b/views/admin/member/member.html @@ -26,14 +26,23 @@
Status
Member Name:{$member.name}
Description:{$member.descr}
Short Description:{$member.short_descr}
Active: - - {if $member.fieldFail.name}

{$member.fieldFail.name}

{/if} + + {if $member.fieldFail.status}

{$member.fieldFail.status}

{/if}
Member Type: - Need to add "enum" type to data abstract. + + {if $member.fieldFail.member_type}

{$member.fieldFail.member_type}

{/if}