From: Chuck Scott Date: Sat, 7 Mar 2015 21:46:26 +0000 (-0500) Subject: Pretty much ready to do some initial testing of basic member information X-Git-Tag: v1.0.0~68 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=4e671ab0bf5e0ea066105de6ce041d35f0d3c1a8;p=WP-Plugins%2Fglm-member-db.git Pretty much ready to do some initial testing of basic member information --- diff --git a/classes/data/dataCategories.php b/classes/data/dataCategories.php index 530525f3..d9e6a72c 100644 --- a/classes/data/dataCategories.php +++ b/classes/data/dataCategories.php @@ -156,6 +156,184 @@ class GlmDataCategories extends GlmDataAbstract } } + + /** + * Add a category using supplied parameters + * + * @param string $name Category Name + * @param mixed $parent Existing Parent ID or name of parent to add + * + * @return integer ID of new category or false if failed + * + * @access public + */ + + public function addCategory($name, $parent) { + + $categoryID = false; + $parentID = false; + + // Filter new category name + $name = filter_var($name); + if ($name == false || trim($name) == '') { + return false; + } + + // Determine parent supplied as an ID + + $parentInt = $parent - 0; + if (is_int($parent) && $parentInt > 0) { + + // If it's not positive, then fail + if ($parent <= 0) { + return false; + } + + // Check that parent exists + $sql = " + SELECT COUNT(id) AS count + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories + WHERE id = $parent + ;"; + $test = $this->wpdb->get_row($sql, ARRAY_A); + + // Should be only one entry if the parent category exists + if ($test['count'] != 1) { + return false; + } + + $parentID = $parent; + + // Else check to see if parent was supplied as a name + } elseif ($parent != '') { + + $parent = filter_var($parent); + + // If the name didn't pass the filer then fail + if ($parent == false) { + return false; + } + + // Check if the name already exists + $sql = " + SELECT id + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cateogries + WHERE name = '$parent' + ;"; + $parentCategory = $this->wpdb->get_row($sql, ARRAY_A); + + // If we found the parent ID + if ($parentCategory['id']) { + + // Set that as the parent ID for the new category + $parentID = $parentCategory['id']; + + // Otherwise, try to add the parent category + } else { + + // Add the parent as a new category + $sql = " + INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories + ( name, parent ) + VALUES + ( '".addslashes($parent)."', 0 ) + ;"; + $this->wpdb->query($sql); + $parentID = $this->wpdb->insert_id; + + // Check if it didn't store properly + if (!$parentID) { + return false; + } + + } + + // Otherwise the categroy being added has no parent + } else { + $parentID = 0; + } + + // Check if the new category name/parent already exists + $sql = " + SELECT id + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cateogry + WHERE name = '$name' + AND parent = $parentID + ;"; + $existing = $this->wpdb->get_row($sql, ARRAY_A); + + if ($existing['id']) { + + $categoryID = $existing['id']; + + } else { + + // Try to add the new category + $sql = " + INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories + ( name, parent ) + VALUES + ( '".addslashes($name)."', $parentID ) + ;"; + $this->wpdb->query($sql); + $categoryID = $this->wpdb->insert_id; + + } + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice("Category added: name = $name, parent = $parent, ID = $categoryID", 'DataBlock', "addCategory()"); + } + + return $categoryID; + + } + + /** + * Get categories list sorted by parent/child then alpha + * + * @return array Array of categories + * + * @access public + */ + + public function getListSortedParentChild() { + + $categories = $this->getList(); + + $categories = glmMembersAdmin::sortParentChild($categories); + + return $categories; + + } + + /* + * Check other requirements + * + * When deleteing categories, check for references in sub-categories and set them to no parent. + * + */ + function checkOther($r, $a) + { + // Required + parent::checkOther($r, $a); + + // If there's a valid category ID + if (isset($r['id']) && $r['id'] > 0) { + + // Set any parent references with this ID to 0 + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories + SET parent = 0 + WHERE parent = ".$r['id']." + ;"; + $this->wpdb->query($sql); + + } + + return $r; + } + + } ?> \ No newline at end of file diff --git a/classes/data/dataCategoryMemberInfo.php b/classes/data/dataCategoryMemberInfo.php new file mode 100644 index 00000000..ae3e4bcd --- /dev/null +++ b/classes/data/dataCategoryMemberInfo.php @@ -0,0 +1,294 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * EventManagementDataCategories class + * + * PHP version 5 + * + * @category Data + * @package EventManagement + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + * @link http://www.visitgreatlakesbay.org/ + */ +class GlmDataCategoryMemberInfo extends GlmDataAbstract +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Field definitions + * + * @var $ini + * @access public + */ + public $table; + + /** + * Field definitions + * + * 'type' is type of field as defined by the application + * text Regular text field + * pointer Pointer to an entry in another table + * 'filters' is the filter name for a particular filter ID in PHP filter + * functions + * See PHP filter_id() + * + * 'use' is when to use the field + * l = List + * g = Get + * n = New + * i = Insert + * e = Edit + * u = Update + * d = Delete + * a = All + * + * @var $ini + * @access public + */ + public $fields = false; + + /** + * Constructor + * + * @param object $d + * database connection + * + * @return void + * @access public + */ + function __construct ($wpdb, $config) + { + parent::__construct($wpdb, $config); + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + /* + * Table Name + */ + $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'category_member_info'; + + /* + * Table Data Fields + */ + $this->fields = array( + + 'id' => array( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Category ID + 'category' => array( + 'field' => 'category', + 'type' => 'integer', + 'required' => true, + 'use' => 'a' + ), + + // Member Info ID + 'member_info' => array( + 'field' => 'member_info', + 'type' => 'integer', + 'required' => true, + 'use' => 'a' + ), + + // Category Name + 'category_name' => array( + 'field' => 'category', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'categories', + 'p_field' => 'name', + 'p_orderby' => 'name', + 'use' => 'gl' + ) + + ); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); + } + + } + + /** + * Get list of categories with parent information + * + * @param integer $memberInfoID Optional member_info ID to match + * Used to find all categories for a particular member_info ID + * + * @param integer $category Optional category ID to match + * Used to find all member_info records for a particular category + * + * NOTE: Both parameters above can't be used at the same time + * + * @return array List of selected categories + * + * @access public + */ + + public function getListWithParents($memberInfoID = false, $category = false) { + + $where = ''; + + if ($category) { + $where = "WHERE T.category = $category"; + } elseif ($memberInfoID) { + $where = "WHERE T.member_info = $memberInfoID"; + } + + $sql = " + SELECT T.category, T.member_info, + ( + SELECT name + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories + WHERE id = T.category + ) AS category_name, + ( + SELECT parent + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories + WHERE id = T.category + ) AS category_parent, + COALESCE ( + ( + SELECT name + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories + WHERE id = category_parent + ), + '' + ) AS parent_name + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info T + $where + ;"; + $list = $this->wpdb->get_results($sql, ARRAY_A); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getListWithParents() query"); + glmMembersAdmin::addNotice($list, 'DataBlock', 'getListWithParents() data'); + } + + return $list; + + } + + /** + * Use supplied category ID list to set selected categories for this + * member information record. Any others that were set will be cleared. + * + * @param integer $memberInfoID Member Information Record ID + * @param array $selectedCategories Array of selected category IDs (key is also category ID) + * + * @return array List of selected categories + * + * @access public + */ + + public function setMemberInfoCategories($memberInfoID, $selectedCategories) { + + // Check supplied data + if (!is_int($memberInfoID) || $memberInfoID <=0 || !is_array($selectedCategories) || count($selectedCategories) == 0 ) { + return false; + } + + // Get current list + $current = $this->getList($memberInfoID); + + // If we have any currently selected categories + if (is_array($current) && count($current) > 0) { + + // For each category in the list + foreach ($current as $key => $val) { + + $current[$key]['selected'] = false; + + // Delete existing ones from the supplied selection list and mark selected ones in the current list + if (isset($selectedCategories[$val['id']])) { + + unset($selectedCategories[$val['id']]); + + $current[$key]['selected'] = true; + + } + + } + + } + + // For each remaining selected category, add the category + foreach ($selectedCategories as $s) { + + // Add the category + $sql = " + INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info + ( category, member_info ) + VALUES + ( $s, $memberInfoID ) + ;"; + $this->wpdb->query($sql); + + + } + + // For any existing categories listed that aren't marked as selected, remove them + foreach ($current as $key => $val) { + + if (!$val['selected']) { + + // Delete the entry + // Add the category + $sql = " + DELETE FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info + WHERE id = ".$val['id']." + ;"; + $this->wpdb->query($sql); + + } + } + + // Get new list and return it + $current = $this->getList($memberInfoID); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($current, 'DataBlock', 'Currently Selected Member Categories'); + } + + return $current; + } +} + +?> \ No newline at end of file diff --git a/classes/data/dataCities.php b/classes/data/dataCities.php index 7e4717d8..a4f4f01e 100644 --- a/classes/data/dataCities.php +++ b/classes/data/dataCities.php @@ -128,6 +128,56 @@ class GlmDataCities extends GlmDataAbstract } } + + /** + * Add a city to the city table. + * + * This function is provided so cities may be added by other code instead of as a user submission. + * + * @param string $cityName Name of the city to add + * + * @return integer ID of the city just added, the id of an existing record matching the city name, or false + * + * @access public + */ + + public function addCity($cityName) { + +echo "addCity()
"; + + // Check that we have a good name + $cName = trim($cityName); + if ($cName == '') { + return false; + } + + // Check if the city name already exists + $sql = " + SELECT id + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cities + WHERE name = '$cName' + ;"; + $cFound = $this->wpdb->get_row($sql, ARRAY_A); + + // If it already exists, then just retun the id for the existing entry. + if (count($cFound) > 0) { + return $cFound['id']; + } + + // Try to add the city name + $sql = " + INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cities + ( name ) + VALUES + ( '$cName' ) + ;"; + $this->wpdb->query($sql); + $id = $this->wpdb->insert_id; + + // Return the new city id or false if the query failed + return $id; + + } } ?> \ No newline at end of file diff --git a/classes/data/dataMemberInfo.php b/classes/data/dataMemberInfo.php index 3a63cbef..6259dc14 100644 --- a/classes/data/dataMemberInfo.php +++ b/classes/data/dataMemberInfo.php @@ -122,6 +122,13 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'use' => 'a' ), + // Reference Name - Not displayed to user + 'reference_name' => array ( + 'field' => 'reference_name', + 'type' => 'text', + 'use' => 'a' + ), + // Status 'status' => array ( 'field' => 'status', @@ -129,24 +136,21 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'list' => $this->config['status'], 'required' => true, 'default' => $this->config['status_numb']['Pending'], + 'force_list' => true, 'use' => 'a' ), // Create Time 'create_time' => array ( 'field' => 'create_time', - 'type' => 'date', - 'required' => true, - 'default' => 'now', - 'use' => 'a' + 'type' => 'datetime', + 'use' => 'lgie' ), // Last Modify Time 'modify_time' => array ( 'field' => 'modify_time', - 'type' => 'date', - 'required' => true, - 'default' => 'now', + 'type' => 'datetime', 'use' => 'a' ), @@ -154,7 +158,6 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'descr' => array( 'field' => 'descr', 'type' => 'text', - 'required' => true, 'use' => 'a' ), @@ -162,7 +165,6 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'short_descr' => array ( 'field' => 'short_descr', 'type' => 'text', - 'required' => true, 'use' => 'a' ), @@ -188,7 +190,6 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'p_field' => 'name', 'p_orderby' => 'name', 'p_blank' => true, - 'required' => true, 'force_list' => true, 'use' => 'a' ), @@ -198,8 +199,8 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'field' => 'state', 'type' => 'list', 'list' => $this->config['states'], - 'required' => true, 'default' => 'MI', + 'force_list' => true, 'use' => 'a' ), @@ -215,8 +216,8 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'field' => 'country', 'type' => 'list', 'list' => $this->config['countries'], - 'required' => true, 'default' => 'US', + 'force_list' => true, 'use' => 'a' ), @@ -244,6 +245,7 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'p_field' => 'name', 'p_orderby' => 'name', 'p_blank' => true, + 'force_list' => true, 'use' => 'a' ), @@ -289,22 +291,6 @@ class GlmDataMemberInfo extends GlmDataAbstract { 'field' => 'notes', 'type' => 'text', 'use' => 'a' - ), - - // Create time - 'create_time' => array ( - 'field' => 'create_time', - 'type' => 'time', - 'required' => true, - 'use' => 'a' - ), - - // Modify time - 'modify_time' => array ( - 'field' => 'modify_time', - 'type' => 'time', - 'required' => true, - 'use' => 'a' ) ); diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php index f600858e..e45978e2 100644 --- a/classes/data/dataMembers.php +++ b/classes/data/dataMembers.php @@ -149,6 +149,30 @@ class GlmDataMembers extends GlmDataAbstract { 'type' => 'date', 'required' => true, 'use' => 'a' + ), + + /* + * Has pending information + * + * This is returning the sum of the ID field for all matching entries in the other table + * where the ID of the member entry is equal to the 'member' column in the member_info + * table and only for those entries where the status column is set to Pending. + * + * If this returns a value of 0, there are no pending informaation records for this member. + * If it returns a positive value, there are. The actual positive number returned is + * of course not anything useable, only that it's positive. + * + */ + 'pending' => array ( + 'field' => 'id', + 'as' => 'pending', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_info', + 'p_field' => 'member', + 'p_id' => 'member', + 'p_where' => 'status = '.$this->config['status_numb']['Pending'], + 'p_sum' => true, + 'use' => 'gl' ) ); @@ -157,8 +181,6 @@ class GlmDataMembers extends GlmDataAbstract { glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); } - - } } diff --git a/config/plugin.ini b/config/plugin.ini index b92fd9cb..20eeba55 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -5,31 +5,69 @@ ; Custom configurations for development and developer configuration at bottom of file. ; +; Image sizes array is outsize of the sections below and is added to $config after the section is selected. +; Any sizes added to this section will used by the Data Abstract to generate that size when images are uploaded. +; Crop value: +; 1. If false (default), images will not be cropped. +; 2. If an array in the form of array( x_crop_position, y_crop_position ): +; x_crop_position accepts 'left' 'center', or 'right'. +; y_crop_position accepts 'top', 'center', or 'bottom'. +; Images will be cropped to the specified dimensions within the defined crop area. + +[imageSizes] + +large['width'] = 800 +large['height'] = false +large['crop'] = false + +medium['width'] = 400 +medium['height'] = false +medium['crop'] = false + +small['width'] = 200 +small['height'] = false +small['crop'] = false + +thumb['width'] = 60 +thumb['height'] = false +thumb['crop'] = false + [common] +; +; Google Maps Browser API Key +; Account: cscott.glm@gmail.com +; Need to create a new key for each "Project", referrer +; for the project should be the customer's Web site. +; +googleMapsApiKey = '' ;'AIzaSyDWgyf8MeYdxZRHaN73O37vFbkhvPjjNhU' + +; General Settings +timezone = America/Detroit + ; ; Entry Status Types ; -status[10] = 'Inactive' -status[20] = 'Active' -status[30] = 'Pending Review' -status[40] = 'Archived' +status[10] = 'Active' +status[20] = 'Pending Review' +status[30] = 'Inactive' +status[90] = 'Archived' -status_numb['Inactive'] = 10 -status_numb['Active'] = 20 -status_numb['Pending'] = 30 -status_numb['Archived'] = 40 +status_numb['Active'] = 10 +status_numb['Pending'] = 20 +status_numb['Inactive'] = 30 +status_numb['Archived'] = 90 ; ; Member Access Levels ; -memb_access[10] = 'Inactive' -memb_access[20] = 'Active, No Memb Access' -memb_access[30] = 'Active, Moderated' -memb_access[40] = 'Active, Full Access' -memb_access[90] = 'Archived' +memb_access[10] = 'Not Displayed' +memb_access[20] = 'Display, No Memb Access' +memb_access[30] = 'Display, Moderated' +memb_access[40] = 'Display, Full Access' +memb_access[90] = 'Not Displayed, Archived' -memb_access_numb['Inactive'] = 10 +memb_access_numb['NotDisplayed'] = 10 memb_access_numb['NoAccess'] = 20 memb_access_numb['Moderated'] = 30 memb_access_numb['Full'] = 40 diff --git a/controllers/admin.php b/controllers/admin.php index 329259de..68138baa 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -199,6 +199,7 @@ class glmMembersAdmin extends GlmPluginSupport $this, 'glmMembersAdminScripts' )); + } /** @@ -290,7 +291,7 @@ class glmMembersAdmin extends GlmPluginSupport // Add a submenu for the "Member" section add_submenu_page('glm-members-admin-menu-members', 'Member Information', - 'Member Data', 'glm_members_member', 'glm-members-admin-menu-member', + 'Add Member', 'glm_members_member', 'glm-members-admin-menu-member', array( $this, 'glmMembersAdminMenuMember' @@ -396,6 +397,15 @@ class glmMembersAdmin extends GlmPluginSupport { $errorMsg = ''; + /* + * Because WordPress insists on forcing the timezone to UTC + * we need to save the current timezone setting, set the one + * we want to use, and then restore it after we're all done + * (see bottom of this script). + */ + $defaultTimeZone = date_default_timezone_get(); + date_default_timezone_set($this->config['timezone']); + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { // If debug is VERBOSE @@ -604,9 +614,11 @@ class glmMembersAdmin extends GlmPluginSupport $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL ); $smarty->templateAssign ( 'thisPage', $_REQUEST['page']); $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME ); + $smarty->templateAssign ( 'glmPluginMediaURL', GLM_MEMBERS_PLUGIN_MEDIA_URL ); $smarty->templateAssign ( 'thisYear', date ( 'Y' ) ); $smarty->templateAssign ( $this->config['term']); $smarty->templateAssign ( $this->config['phrase']); + $smarty->templateAssign ( 'googleMapsBrowserApiKey', $this->config['googleMapsApiKey']); // Add data from model to Smarty template if (is_array($results['data']) && count($results['data']) > 0) { @@ -640,7 +652,12 @@ class glmMembersAdmin extends GlmPluginSupport // Generate output from model data and view $smarty->template->display($view); + + // Restore timezone that was set before our code was called + date_default_timezone_set($defaultTimeZone); + } + } diff --git a/controllers/front.php b/controllers/front.php index 86110213..2b2c3271 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -180,11 +180,14 @@ class glmMembersFront extends GlmPluginSupport 'option' => false ), $atts); - - - - - + /* + * Because WordPress insists on forcing the timezone to UTC + * we need to save the current timezone setting, set the one + * we want to use, and then restore it after we're all done + * (see bottom of this script). + */ + $defaultTimeZone = date_default_timezone_get(); + date_default_timezone_set($this->config['timezone']); $errorMsg = ''; @@ -358,10 +361,14 @@ class glmMembersFront extends GlmPluginSupport // Add standard parameters $smarty->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG); + $smarty->templateAssign ( 'baseURL', GLM_MEMBERS_PLUGIN_BASE_URL); $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL ); $smarty->templateAssign ( 'thisPage', $_REQUEST['page']); $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME ); + $smarty->templateAssign ( 'glmPluginMediaURL', GLM_MEMBERS_PLUGIN_MEDIA_URL ); $smarty->templateAssign ( 'thisYear', date ( 'Y' ) ); + $smarty->templateAssign ( $this->config['term']); + $smarty->templateAssign ( $this->config['phrase']); // Add all terms and phrases from the config/plugin.ini file $smarty->templateAssign ( 'terms', $this->config->term); @@ -393,6 +400,10 @@ class glmMembersFront extends GlmPluginSupport // Generate output from model data and view $smarty->template->display($view); + + // Restore timezone that was set before our code was called + date_default_timezone_set($defaultTimeZone); + } } ?> \ No newline at end of file diff --git a/css/admin.css b/css/admin.css index 1eb60434..fda3410f 100644 --- a/css/admin.css +++ b/css/admin.css @@ -25,12 +25,19 @@ .glm-indent { padding-left: 2em; } - +.glm-center { + text-align: center; +} .glm-copyright { text-align: center; margin: 2em; } +.glm-button { + margin-left: 4px !important; + margin-right: 4px !important; +} + /* Admin Area - General */ #glm-admin-content-container { border: 1px #ccc solid; @@ -39,23 +46,29 @@ } .glm-item-container { border: 1px #ccc solid; - padding: .2em; + padding: .4em; background: #f8f8f8; } /* Admin Tabs */ + +.nav-tab-wrapper { + white-space: nowrap; + height: 1.5em; +} .nav-tab { - font-size: 15px !important; + font-size: 1.1vw !important; font-weight: bold; + padding: 0px 8px 4px 8px !important; } .nav-tab-active { - font-size: 15px !important; font-weight: bold; var_dump($memberData); - + font-size: 1.1vw !important; text-decoration: none; border: 2px #ccc solid; border-bottom: 0px; - padding: 6px 10px 8px 10px; + padding: 8px 8px 10px 8px !important; + margin-bottom: 10px; background-color: #f8f8f8; } .disabled { @@ -73,7 +86,10 @@ width: 90%; } .glm-form-text-input-short { - width: 10em; + width: 15em; +} +.glm-form-text-input-medium { + width: 30em; } .glm-form-textarea { width: 90%; @@ -101,6 +117,16 @@ font-size: 15px; font-weight: bold; } +.glm-admin-table-active { + background: lightblue; +} +.glm-admin-image-edit-table { + border: 2px #ddd solid; +} +.glm-admin-image-edit-table td { + padding: 5px; +} + /* Overlay dialog box */ .glm-dialog-box { @@ -148,8 +174,8 @@ /* Map Edit */ .glm-map-edit { - width:320px; - height:200px; + width:90%; + height:400px; border: 2px black solid; } diff --git a/defines.php b/defines.php index e43ccb8f..5476cd65 100644 --- a/defines.php +++ b/defines.php @@ -6,7 +6,7 @@ */ define('GLM_MEMBERS_PLUGIN_NAME', 'Gaslight Media Members Database'); -define('GLM_MEMBERS_PLUGIN_DIR', 'glm-members-db'); +define('GLM_MEMBERS_PLUGIN_DIR', 'glm-member-db'); // Debug Options define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', true); @@ -31,12 +31,16 @@ define('GLM_MEMBERS_PLUGIN_URL', plugin_dir_url(__FILE__)); $pageUri = explode('?', $_SERVER['REQUEST_URI']); // Bust this up to access URL path and script name only define('GLM_MEMBERS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_PLUGIN_DIR); define('GLM_MEMBERS_PLUGIN_CURRENT_URL', $pageProtocol.'://'.$_SERVER['SERVER_NAME'].$pageUri[0]); +define('GLM_MEMBERS_PLUGIN_MEDIA_URL', WP_CONTENT_URL.'/plugins/'.GLM_MEMBERS_PLUGIN_DIR.'/media'); // Directories define('GLM_MEMBERS_PLUGIN_PATH', dirname(__FILE__)); define('GLM_MEMBERS_PLUGIN_DB_SCRIPTS', dirname(__FILE__).'/misc/databaseScripts'); define('GLM_MEMBERS_PLUGIN_CLASS_PATH', GLM_MEMBERS_PLUGIN_PATH.'/classes'); define('GLM_MEMBERS_PLUGIN_LIB_PATH', GLM_MEMBERS_PLUGIN_PATH.'/lib'); +define('GLM_MEMBERS_PLUGIN_IMAGES_PATH', GLM_MEMBERS_PLUGIN_PATH.'/media/images'); +define('GLM_MEMBERS_PLUGIN_CONFIG_PATH', GLM_MEMBERS_PLUGIN_PATH.'/config'); + // Database table prefixes global $wpdb; diff --git a/index.php b/index.php index a4a7e3aa..0a5aec20 100644 --- a/index.php +++ b/index.php @@ -45,6 +45,7 @@ require_once('defines.php'); // Get plugin configuration - Just use common section for now, we'll deal with others later $configData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/plugin.ini', true); $config = $configData['common']; +$config['imageSizes'] = $configData['imageSizes']; // Get additional configuration data $stateData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/states.ini'); @@ -361,9 +362,4 @@ if (is_admin() && $notices && !GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { add_action('admin_notices','glmMembersAdminNotices'); } - - - - - ?> \ No newline at end of file diff --git a/js/geolocation-edit/jquery.geolocation.edit.0.0.11.nomin.js b/js/geolocation-edit/jquery.geolocation.edit.0.0.11.nomin.js new file mode 100644 index 00000000..e2ddf3b9 --- /dev/null +++ b/js/geolocation-edit/jquery.geolocation.edit.0.0.11.nomin.js @@ -0,0 +1,245 @@ +/** + * jQuery geolocation.edit plugin + * Copyright (c) 2012 Milos Popovic + * + * Freely distributable under the MIT license. + * + * @version 0.0.11 (2014-06-01) + * @see http://github.com/miloss/jquery-geolocation-edit + */ + +(function ($) { + var inits + , methods + , loadScript; + + // Queued initializations + inits = []; + // Methods container object + methods = {}; + + + // Plugin methods + // -------------- + + /** + * Main execution method + * @param {Object} options Passed plugin options + */ + methods.main = function (options) { + var selector = this + , opts + , llat, llng, llocation + , i, addrlen; + + // Check for required fields + if (typeof options.lat === "undefined" || + typeof options.lng === "undefined") { + $.error("Please provide 'lat' and 'lng' options for jQuery.geolocate"); + return; + } + + // If GoogleMaps not loaded - push init to queue and go on + if (typeof google === "undefined" || + typeof google.maps === "undefined") { + inits.push(function () { + $(selector).geolocate(options); + }); + loadScript(); + return; + } + + // Extend default options + opts = $.extend(true, { + address: [], + changeOnEdit: false, + mapOptions: { + zoom: 14, + mapTypeId: google.maps.MapTypeId.ROADMAP, + mapTypeControl: false, + streetViewControl: false + }, + markerOptions: { + draggable:true, + animation: google.maps.Animation.DROP + }, + geoCallback: function(){} + }, options); + + $(this).data('opts', opts); + + // Init map and marker - per coordinates + llat = parseFloat( $( opts.lat ).val() ); + llng = parseFloat( $( opts.lng ).val() ); + if (isNaN(llat)) { + llat = 0; + } + if (isNaN(llng)) { + llng = 0; + } + + llocation = new google.maps.LatLng(llat, llng); + $(this).geolocate({}, 'initMap', llocation); + + // Bind actions - coordinates fields (future?) + if ( opts.changeOnEdit ) { + $( opts.lat ).change(function () { /* ... */ }); + $( opts.lng ).change(function () { /* ... */ }); + } + + // Bind actions - address field + addrlen = opts.address.length; + if (addrlen > 0) { + for (i=0; iinputFieldStatus = false; $this->inputErrorReason = 'Input is not numeric.'; return $in; @@ -570,23 +572,35 @@ abstract class GlmDataAbstract } function pointerOutput($f, $d, $forEdit = false, $id = false, $idfield = 'id') { + /* + * This function will only return the value of the pointer field unless one + * of the following situations occurs. + * $forEdit is true to force the pointer options for an edit form + * 'force_list' option is true + * 'p_static' option true to force only the pointer field value to be returned + * + * if 'p_sum' is true, then this function will look up the values from the + * specified field in the other table to get the summ of all values, but + * will not return a list of options. + */ // If 'force_list' or $forEdit also get the options for select, unless 'p_static' $alwaysList = (isset($f['force_list']) && $f['force_list']); $pStatic = (isset($f['p_static']) && $f['p_static']); - if (($alwaysList || $forEdit) && !$pStatic ) { + $pSum = (isset($f['p_sum']) && $f['p_sum']); + if (($alwaysList || $forEdit || $pSum) && !$pStatic ) { $p_value = $d; // Get pointer options from specified table $order_by = $f['p_field']; - if ($f['p_orderby']) { + if (isset($f['p_orderby']) && $f['p_orderby']) { $order_by = $f['p_orderby']; } // Get picklist options from other table $where = ''; - if (isset($f['p_where']) && $f['p_where']) { + if (isset($f['p_where']) && $f['p_where'] != '') { $where = 'WHERE '.$f['p_where']; } @@ -596,69 +610,88 @@ abstract class GlmDataAbstract $p_id = $f['p_id']; } - $sql = " - SELECT ".$p_id." AS p_id, - ".$f['p_field']." AS p_value - FROM ".$f['p_table']." - $where - ORDER BY $order_by - "; - $p_list = $this->wpdb->get_results($sql, ARRAY_A); + // If p_sum is selected, do a special query + if ($pSum) { - // Build pick select table - $pick_select = false; - $selected_name = ''; - $pick_list = array(); + $sql = " + SELECT COALESCE(SUM(".$f['p_field']."), 0) AS p_sum + FROM ".$f['p_table']." + $where + AND $p_id = $p_value + "; + $res = $this->wpdb->get_row($sql, ARRAY_A); - $blankText = ''; - if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') { - $blankText = $f['p_blank_text']; - } - if (isset($f['p_blank']) && $f['p_blank']) { - $pick_list[0] = array( - 'value' => '', - 'name' => $blankText, - 'default' => (!$p_value) - ); - } - - if (count($p_list) > 0) { - - reset($p_list); - foreach ($p_list as $p) { - - if ($this->optionIncludeSelectListData) { - $pick_list[$p['p_id']] = array( - 'value' => $p['p_id'], - 'name' => $p['p_value'], - 'nameEsc' => addslashes($p['p_value']), - 'default' => ($p['p_id'] == $p_value) - ); - } - - // Check for selected option - if ($p['p_id'] == $p_value) { - $selected_name = $p['p_value']; - } + return $res['p_sum']; + } else { + + + $sql = " + SELECT ".$p_id." AS p_id, + ".$f['p_field']." AS p_value + FROM ".$f['p_table']." + $where + ORDER BY $order_by + "; + $p_list = $this->wpdb->get_results($sql, ARRAY_A); + + + // Build pick select table + $pick_select = false; + $selected_name = ''; + $pick_list = array(); + + $blankText = ''; + if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') { + $blankText = $f['p_blank_text']; + } + if (isset($f['p_blank']) && $f['p_blank']) { + $pick_list[0] = array( + 'value' => '', + 'name' => $blankText, + 'default' => (!$p_value) + ); } - } else { + if (count($p_list) > 0) { - // There were no results from the - $this->inputFieldStatus = false; - $this->inputErrorReason = 'No options were available for this pick list.'; + reset($p_list); + foreach ($p_list as $p) { - } + if ($this->optionIncludeSelectListData) { + $pick_list[$p['p_id']] = array( + 'value' => $p['p_id'], + 'name' => $p['p_value'], + 'nameEsc' => addslashes($p['p_value']), + 'default' => ($p['p_id'] == $p_value) + ); + } - $r = array( - 'value' => $p_value, - 'name' => $selected_name, - 'nameEsc' => addslashes($selected_name), - 'list' => $pick_list - ); + // Check for selected option + if ($p['p_id'] == $p_value) { + $selected_name = $p['p_value']; + } - return $r; + } + + } else { + + // There were no results from the + $this->inputFieldStatus = false; + $this->inputErrorReason = 'No options were available for this pick list.'; + + } + + $r = array( + 'value' => $p_value, + 'name' => $selected_name, + 'nameEsc' => addslashes($selected_name), + 'list' => $pick_list + ); + + return $r; + + } // else p_sum } @@ -952,14 +985,14 @@ abstract class GlmDataAbstract $in = ($f['default']); } - // Otherwise check for input data - } else { + // Otherwise check for input data + } else { // Sanitize currently selected value $in = filter_input(INPUT_POST, $as, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES); // Is it one of the available values - if ($f['required'] && trim($in) == '') { + if (isset($f['required']) && $f['required'] && trim($in) == '') { $this->inputFieldStatus = false; $this->inputErrorReason = 'Required input is not provded.'; } @@ -1518,51 +1551,6 @@ abstract class GlmDataAbstract /* * Date Field Processing */ - // Support function to build picklists for Date field - function buildDateFieldLists($min, $max) - { - - if (!$this->optionIncludeSelectListData) { - return false; - } - - // Default date input lists - $month_list = array( - 1 => array('name' => 'Jan', 'value' => 1, 'default' => false), - 2 => array('name' => 'Feb', 'value' => 2, 'default' => false), - 3 => array('name' => 'Mar', 'value' => 3, 'default' => false), - 4 => array('name' => 'Apr', 'value' => 4, 'default' => false), - 5 => array('name' => 'May', 'value' => 5, 'default' => false), - 6 => array('name' => 'Jun', 'value' => 6, 'default' => false), - 7 => array('name' => 'Jul', 'value' => 7, 'default' => false), - 8 => array('name' => 'Aug', 'value' => 8, 'default' => false), - 9 => array('name' => 'Sep', 'value' => 9, 'default' => false), - 10 => array('name' => 'Oct', 'value' => 10, 'default' => false), - 11 => array('name' => 'Nov', 'value' => 11, 'default' => false), - 12 => array('name' => 'Dec', 'value' => 12, 'default' => false), - ); - $day_list = array(); - for ($i = 1; $i <= 31; $i++) { - $day_list[$i] = array('name' => $i, 'value' => $i, 'default' => false); - } - $year_list = array(); - - $min_year = date('Y', $min); - $max_year = date('Y', $max); - for ($i = $min_year; $i <= $max_year; $i++) { - $year_list[$i] = array('name' => $i, 'value' => $i, 'default' => false); - } - - $date_list = array( - 'month' => $month_list, - 'day' => $day_list, - 'year' => $year_list, - 'min' => date('m/d/Y',$min), - 'max' => date('m/d/Y',$max) - ); - - return $date_list; - } function dateField($f) { return 'T.'.$f['field']; @@ -1620,7 +1608,7 @@ abstract class GlmDataAbstract $def_day = date('j', $t); $date_list['day'][$def_day]['default'] = true; $def_year = date('Y', $t); - $date_list['year'][$def_year]['default'] = true; + $date_list['year'][$def_year]['default'] = true; $out['date_list'] = $date_list; } @@ -1964,6 +1952,256 @@ abstract class GlmDataAbstract return "'".$in['time_store']."'"; } + /* + * datetime (date and time) Field Processing + */ + function datetimeField($f) + { + return 'T.'.$f['field']; + } + function datetimeOptions($f) + { + return false; + } + function datetimeOutput($f, $d) + { + + // Check for min/max date values + if (isset($f['minValue']) && ($f['minValue']-0) > 0) { + $min = $f['minValue']-0; + } else { + $min = strtotime('-10 years'); + } + if (isset($f['maxValue']) && ($f['maxValue']-0) > 0) { + $max = $f['maxValue']-0; + } else { + $max = strtotime('+10 years'); + } + + // Check if it's a valid time (MySQL returns 0000-00-00 00:00:00 for a null time, which maps to a timestamp = -62169984000) + $haveDatetime = true; + if (substr($d, 0, 4) == '0000') { + + // No valid time retrieved + $haveDateTime = false; + $text_datetime = ''; + $t = 0; + + } else { + + // Get time stamp for retrieved data + $t = strtotime($d); + + // Set text format for return + $format = 'm/d/Y h:i A'; + if (isset($f['format']) && $f['format'] != false) { + $format = $f['format']; + } + + // If there was a date stored, then display it, otherwise blank + if ($d != '') { + $text_datetime = date($format, $t); + } else { + $text_datetime = ''; + } + + } + + // Build return array + $out = array( + 'datetime' => $text_datetime, + 'timestamp' => $t + ); + + // Build picklists for date input + $date_list = false; + if ($this->optionIncludeSelectListData) { + + $date_list = $this->buildDateFieldLists($min, $max, true); + + if ($haveDatetime) { + + // Get default values for list selection and set in date_list array + $def_month = date('n', $t); + $date_list['month'][$def_month]['default'] = true; + $def_day = date('j', $t); + $date_list['day'][$def_day]['default'] = true; + $def_year = date('Y', $t); + $date_list['year'][$def_year]['default'] = true; + $def_hour = date('h', $t); + $date_list['hour'][($def_hour-0)]['default'] = true; + $def_min = date('i', $t); + $date_list['minute'][$def_min]['default'] = true; + $def_ampm = date('a', $t); + $date_list['ampm'][$def_ampm]['default'] = true; + + } + + $out['date_list'] = $date_list; + } + + return $out; + } + function datetimeInput($as, $f, $id, $idfield, $op) + { + $this->inputFieldStatus = true; + + // Check for min/max date values + if (isset($f['minValue']) && ($f['minValue']-0) > 0) { + $min = $f['minValue']-0; + } else { + $min = strtotime('-10 years'); + } + if (isset($f['maxValue']) && ($f['maxValue']-0) > 0) { + $max = $f['maxValue']-0; + } else { + $max = strtotime('+10 years'); + } + + // Build picklists for date input + $date_list = $this->buildDateFieldLists($min, $max, true); + + // If this is setup for a new entry, then just return default value + if ($op == 'n') { + + $in = time(); // Assume current time + + // Check for a specified default + if (isset($f['default']) && $f['default'] != false) { + $in = ($f['default']); + } + + // Otherwise we should be getting input from the user + } else { + + $this->inputErrorReason = false; + $in_type = false; + $in = false; + + // If we're getting separate month, day, year, hour, min, ampm + if (isset($_REQUEST[$as.'_month'])) { + + // Looks like we have picklist input + $in = strtotime($_REQUEST[$as.'_month'].'/'.$_REQUEST[$as.'_day'].'/'.$_REQUEST[$as.'_year'].' '.$_REQUEST[$as.'_hour'].':'.$_REQUEST[$as.'_min'].' '.$_REQUEST[$as.'_ampm']); + $in_type = 'pick'; + + // Look for plain text input + } elseif (isset($_REQUEST[$as])) { + $in = strtotime($_REQUEST[$as]); + $in_type = 'text'; + } + + // check if the input time was invalid + if (isset($f['required']) && $f['required'] && $in == false) { + $this->inputErrorReason = 'Date supplied is invalid.'; + $this->inputFieldStatus = false; + $in = time(); + } + + } // get input from user + + // Force to be numeric - Must be time stamp at this point + $in = ($in - 0); + + // Use default format unless there's a date format spec? + $format = ('m/d/Y h:i A'); + if (isset($f['format']) && $f['format']) { + $format = $f['format']; + } + + // Check for required input - Can't be 0 (epoch) + if (isset($f['required']) && $f['required']) { + if ($in == 0) { + $this->inputErrorReason = 'Required date not supplied.'; + $this->inputFieldStatus = false; + // Check for valid date range + } elseif (isset($f['minValue']) && $f['minValue'] && $in < $f['minValue']) { + $this->inputErrorReason = 'Date earlier than permitted ('.date($format, $f['minValue']).').'; + $this->inputFieldStatus = false; + } elseif (isset($f['maxValue']) && $f['maxValue'] && $in > $f['maxValue']) { + $this->inputErrorReason = 'Date later than permitted ('.date($format, $f['maxValue']).').'; + $this->inputFieldStatus = false; + } + } + + // Use specified format to clean up date + if ($in > 0) { + $text_date = date($format, $in); + } else { + $text_date = ''; + } + + // Create MYSQL compatible date input + $sqlDate = date('Y-m-d H:i:s', $in); + + // If the field validated and it's supposed to be unique + if ($this->inputFieldStatus && $this->inputFieldStatus && isset($f['unique']) && $f['unique']) { + + // Query table to see if there's a conflict + $sql = " + SELECT COUNT(".$f['field'].") + FROM ".$this->table." + WHERE ".$f['field']." = '$sqlDate'; + "; + + // If there's an ID field, then this must be an update rather than an insert + if ($id != false && $idField != false) { + // Add clause to check if not the current record + $sql .= "AND $idField != $id"; + } + + $d = $this->wpdb->get_results($sql, ARRAY_A); + + if ($d['count'] > 0) { + $this->inputFieldStatus = false; + $this->inputErrorReason = 'This must unique but it conflicts with another entry.'; + return $in; + } + } + + // Get default values for list selection and set in date_list array + if ($text_date != '') { + $def_month = date('n', $in); + $date_list['month'][$def_month]['default'] = true; + $def_day = date('j', $in); + $date_list['day'][$def_day]['default'] = true; + $def_year = date('Y', $in); + $date_list['year'][$def_year]['default'] = true; + $def_hour = date('h', $in); + $date_list['hour'][($def_hour-0)]['default'] = true; + $def_min = date('i', $in); + $date_list['minute'][$def_min]['default'] = true; + $def_ampm = date('a', $in); + $date_list['ampm'][$def_ampm]['default'] = true; + } + + // Build return array + $v = array( + 'datetime' => $text_date, + 'timestamp' => $in, + 'date_list' => $date_list, + ); + + return $v; + + } + function datetimeStore($in, $f) + { + + // Check if there's no date then supply null + if ($in['datetime'] != '') { + + // Create MYSQL compatible date input + $sqlDate = date('Y-m-d H:i:s', strtotime($in['datetime'])); + + return "'$sqlDate'"; + + } else { + return "null"; + } + } + + /* * Phone Field Processing */ @@ -2015,7 +2253,6 @@ abstract class GlmDataAbstract } function imageInput($as, $f, $id, $idfield, $op) { -echo "DDDDD"; $haveNewImage = false; @@ -2024,12 +2261,8 @@ echo "DDDDD"; $in = ''; return $in; } -echo "222"; - $current_img = false; - // Setup Image server access -// require_once IMAGE_SERVER_ABSTRACT; -// $imServer = new ImageServerAbstract(); + $current_img = false; // Check if there's an existing image if ($id != false) { @@ -2043,8 +2276,7 @@ echo "222"; $sql = "SELECT $as FROM $this->table WHERE $idfield = $id;"; - - $d = $this->wpdb->get_results($sql, ARRAY_A); + $d = $this->wpdb->get_row($sql, ARRAY_A); if (trim($d[$as]) != '') { $current_img = $d[$as]; @@ -2053,34 +2285,77 @@ echo "222"; // If there a request to delete an existing image or a new image and there's a current image if (isset($_REQUEST[$as."_delete"]) && ($_REQUEST[$as."_delete"] == 'on' || $new) && $current_img != false) { -// $imServer->imageDelete($current_img); + + // Scan all the image size directories and remove this image + while (list($k, $v) = each($this->config['imageSizes'])) { + unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$current_img); + } + $current_img = ''; + } -echo "3333"; + // Is there a new image being uploaded if (isset($_FILES[$as.'_new']) && is_array($_FILES[$as.'_new']) && $_FILES[$as.'_new']['tmp_name'] != '') { - $tmpImg = $_FILES[$as.'_new']['tmp_name']; - -$imgSize = filesize ( $tmpImg ); -echo "Getting $tmpImg - Size = $imgSize
"; - $newImage = wp_get_image_editor($tmpImg); + // Get new image using temporary file name + $newImage = wp_get_image_editor($_FILES[$as.'_new']['tmp_name']); // If we have a good image if ( ! is_wp_error( $newImage ) ) { - // Get image temp file name + // Check if there's a prefix that should be included in the image file name + $prefix = ''; + if (isset($f['i_prefix']) && trim($f['i_prefix']) != '') { + $prefix = $f['i_prefix']; + } + + // Get the desired file name and add a timestamp to it to ensure that it's unique + $fInfo = pathinfo($_FILES[$as.'_new']['name']); + $newFilename = $prefix.$fInfo['filename'].'_'.time().'.'.$fInfo['extension']; + + // Get image temp file name - Not currently using, but should be using to check for resizing sanity $size = $newImage->get_size(); -echo "Size = $size
"; - $type = $newImage->get_mime_type(); -echo "Type = $type
"; + + // Try to store the image using that file name in the 'original' directory + $storedImage = $newImage->save( GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$newFilename ); + + // Now resize the images using $sizeArray + $sizes = $newImage->multi_resize($this->config['imageSizes']); + + // Finally, move the files to the various size directories and rename them back to the correct name + while (list($k, $v) = each($this->config['imageSizes'])) { + + // Check if size directory needs to be made + if (!file_exists(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k)) { + mkdir(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k); + } + + // If there's an entry in the $sizes array, it means that the image resized to this size + if (isset($sizes[$k])) { + + // Move resized file to desired direectory + rename(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$sizes[$k]['file'], GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newFilename); + + } else { + + // Image didn't resize to this size, probably because it was smaller than the destination size (silly WP Image Editor class) - so just use the original + copy(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$newFilename, GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newFilename); + + } + } + + // Remove original + unlink(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$newFilename); + + $current_img = $newFilename; + } else { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($newImage, 'DataBlock', "DataAbstract - imageInput() wp_get_image_editor($tmpFile) Error"); } -echo "Bad image file or some such thing
"; } } @@ -2392,11 +2667,6 @@ echo "Bad image file or some such thing
"; $asFieldUsed = true; } - // If field type is pointer and we don't have AS then do it with default - if ($v['type'] == 'pointer' && ($asFieldUsed)) { - $this->select .= 'AS '.$v['field']; - } - // Get this field specification $this->fieldData[$as] = array( 'name' => $as, @@ -2422,6 +2692,10 @@ echo "Bad image file or some such thing
"; } + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($this->fieldData, 'DataBlock', "buildFieldsList() data"); + } + return; } @@ -2475,7 +2749,7 @@ echo "Bad image file or some such thing
"; $d = $data[$as]; } - // Call field processing function based on field tye + // Call field processing function based on field type $out = $this->{$type.'Output'}($v, $d, $forEdit, $id, $idfield, $op); $data[$as] = $out; @@ -2598,6 +2872,7 @@ echo "Bad image file or some such thing
"; */ public function getStats($where = 'true') { + $sql = "SELECT count(DISTINCT id) as count FROM $this->table WHERE $where;"; @@ -2639,6 +2914,10 @@ echo "Bad image file or some such thing
"; "; } + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query"); + } + //echo "
$sql
"; $list = $this->wpdb->get_results($sql, ARRAY_A); @@ -2652,7 +2931,6 @@ echo "Bad image file or some such thing
"; } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query"); glmMembersAdmin::addNotice($list, 'DataBlock', "getList() data"); } @@ -2667,6 +2945,7 @@ echo "Bad image file or some such thing
"; */ public function getEntry($id, $idfield = 'id', $where = '', $forEdit = false) { + if ($id-0 == 0) { // echo "DataAbstract.php - getEntry() called with invalid ID"; return false; @@ -2711,6 +2990,9 @@ echo "Bad image file or some such thing
"; $r = $this->processInputData('n'); $r['fieldFail'] = false; + // Check if there's a function to do other checks + $r = $this->checkOther($r, 'n'); + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($r, 'DataBlock', "newEntry() data"); } @@ -2722,12 +3004,15 @@ echo "Bad image file or some such thing
"; * Check Other fields (default function) * This is here so it doesn't have to be defined in data{xxx}.php file. * if it is, be sure to use the following in that function. - * parent::checkOther($r); + * parent::checkOther($r, $a); * - * @return void + * @param array $r A result array from one of the other functions + * @param string $a The action type being performed (single letter, i.e. l, g, ...) + * + * @return array Returns supplied result array as updated * @access public */ - public function checkOther($r) + public function checkOther($r, $a) { return $r; } @@ -2746,7 +3031,7 @@ echo "Bad image file or some such thing
"; $r = $this->processInputData('i'); // Check if there's a function to do other checks - $r = $this->checkOther($r); + $r = $this->checkOther($r, 'i'); // If input is OK, try to store if ($r['status']) { @@ -2806,7 +3091,7 @@ echo "Bad image file or some such thing
"; } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice($r, 'DataBlock', "DataAbstract - insertEntry() failure data"); + glmMembersAdmin::addNotice($r, 'DataBlock', "DataAbstract - insertEntry() data"); } return $r; @@ -2875,7 +3160,7 @@ echo "Bad image file or some such thing
"; } // Check if there's a function to do other checks - $r = $this->checkOther($r); + $r = $this->checkOther($r, 'u'); // If input is OK, and we haven't been told not to, try to store if ($r['status'] && $store) { @@ -2936,6 +3221,11 @@ echo "Bad image file or some such thing
"; // Get the current record data $detail = $this->getEntry($id, $idField); + // Check if there's a function to do other checks + if ($confirm) { + $detail = $this->checkOther($detail, 'd'); + } + // Add delete confirmation request flag $detail['delete'] = true; @@ -2997,7 +3287,6 @@ echo "Bad image file or some such thing
"; * min Minutes * sec Seconds */ - public function f2LatLon($d, $LatLon, $type, $precision) { @@ -3075,5 +3364,81 @@ echo "Bad image file or some such thing
"; return $r; } + + /* + * Support function to build picklists for Date field + * + * @return array + */ + public function buildDateFieldLists($min, $max, $time = false) + { + + if (!$this->optionIncludeSelectListData) { + return false; + } + + // Default date input lists + $month_list = array( + 1 => array('name' => 'Jan', 'value' => 1, 'default' => false), + 2 => array('name' => 'Feb', 'value' => 2, 'default' => false), + 3 => array('name' => 'Mar', 'value' => 3, 'default' => false), + 4 => array('name' => 'Apr', 'value' => 4, 'default' => false), + 5 => array('name' => 'May', 'value' => 5, 'default' => false), + 6 => array('name' => 'Jun', 'value' => 6, 'default' => false), + 7 => array('name' => 'Jul', 'value' => 7, 'default' => false), + 8 => array('name' => 'Aug', 'value' => 8, 'default' => false), + 9 => array('name' => 'Sep', 'value' => 9, 'default' => false), + 10 => array('name' => 'Oct', 'value' => 10, 'default' => false), + 11 => array('name' => 'Nov', 'value' => 11, 'default' => false), + 12 => array('name' => 'Dec', 'value' => 12, 'default' => false), + ); + $day_list = array(); + for ($i = 1; $i <= 31; $i++) { + $day_list[$i] = array('name' => $i, 'value' => $i, 'default' => false); + } + + $year_list = array(); + $min_year = date('Y', $min); + $max_year = date('Y', $max); + for ($i = $min_year; $i <= $max_year; $i++) { + $year_list[$i] = array('name' => $i, 'value' => $i, 'default' => false); + } + + if ($time) { + + $hour_list = array(); + for ($i = 1; $i < 12; $i++) { + $hour_list[$i] = array('name' => sprintf("%02d", $i), 'value' => $i, 'default' => false); + } + + $min_list = array(); + for ($i = 0; $i < 60; $i++) { + $min_list[$i] = array('name' => sprintf("%02d", $i), 'value' => $i, 'default' => false); + } + + $ampm_list = array( + 'am' => array('name' => 'AM', 'value' => 'am', 'default' => false), + 'pm' => array('name' => 'PM', 'value' => 'pm', 'default' => false) + ); + } + + $date_list = array( + 'month' => $month_list, + 'day' => $day_list, + 'year' => $year_list, + 'min' => date('m/d/Y',$min), + 'max' => date('m/d/Y',$max) + ); + + if ($time) { + $date_list['hour'] = $hour_list; + $date_list['minute'] = $min_list; + $date_list['ampm'] = $ampm_list; + } + + return $date_list; + } + + } ?> \ No newline at end of file diff --git a/lib/GlmDataAbstract/documentation.txt b/lib/GlmDataAbstract/documentation.txt index ead05c28..dd0dd7cd 100644 --- a/lib/GlmDataAbstract/documentation.txt +++ b/lib/GlmDataAbstract/documentation.txt @@ -1,6 +1,11 @@ GlmDataAbstract.php Documentation ------------------------------------------- + +**** Need to add 'PreDelete" and "PostDelete" capability for things like images and other related stuff **** + + + This file is an abstract layer for all standard database operations. It provides the following. @@ -31,6 +36,10 @@ getStats() Collects and returns statistics from the database according getList() Builds and returns a list of database entries according to the field definitions array. + Parameters: + $where Optional SQL "WHERE" clause + $order Optional SQL "ORDER BY" clause + getEntry() Builds and returns a single simple database table entry or optionally a single instance of a composite of multiple related table entries. @@ -67,17 +76,18 @@ checkOther() Permits other checks before submission of data with insert can be used to intercept the insert and update process, run checks on data that was submitted, alter data, add fieldFail data, and chage the result status. The function is passed the - entire result array ($r) and should return the same when done + entire result array ($r) and the action character ($a) + and should return the same when done performing checks and updates. This is not required when calling DataAbstract since there is a stub checkOther() method there. An example follows showing how to hook into checkOther() in DataAbstract and make additional checks ... - function checkOther($r) + function checkOther($r, $a) { // Required - parent::checkOther($r); + parent::checkOther($r, $a); // ---- Perform test and changes ---- @@ -139,6 +149,10 @@ percent A float value processed for percentile input and display str any supplied "%" characters and properly formatting for output. pointer An integer field being used as a pointer to other table entries. + NOTE: Pointer processing is performed after the table data is + queried. Because of this, it's not possible to use a 'where' option + to select those results. The 'where' option would only operate + on the value of the pointer, not what it's pointing to. list An integer field being used as a pointer to a list of possible values useable for radio buttons and picklists. @@ -155,6 +169,8 @@ date A timestamp field represented as a date, timestamp, or date time A timestamp field represented as a time value. +datetime A timestamp filed represented as a date AND time value. + phone A text field expecting and returning text formatted as a Phone number. @@ -214,135 +230,137 @@ single field ('field') in the database table. Field Specifications: -(array index) The array index is only used to permit multiple entries for the - same database field. This permits including the field several - times so it can be processed differently based on the operation - being performed or can be displayed multiple time but each in a - different way. - -'field' Name of field in database table - -'as' Name to use for this field for all operations other than for talking - with the database. Doing this keeps any possible multiple instances - of use of a single database field separate. (see array index above) - - If this is not specified, then the actual database field name is - used for these purposes. - - -'type' Type of field - Possible field types are... - - 'integer', - 'float', - 'money', - 'percent', - 'pointer', - 'list', - 'text', - 'password', - 'checkbox', - 'email', - 'date', - 'time', - 'phone', - 'image', - 'latitude', Data is an array of (dir,deg,min,sec); - 'longitude' " " " - "dir" is - for West and South - -'filter' Optional filter - See PHP filter_input() "filter" parameter. - Currently only for type "text" - FILTER_SANITIZE_FULL_SPECIAL_CHARS does not seem to be defined at this time. - FILTER_SANITIZE_MAGIC_QUOTES seems to be good for permitting HTML - -'filter_options' Optional filter options - See PHP filter_input() "options" parameter. - Currently only for type "text". - -'required' If set and true, field data must be supplied - -'unique' If set and true, must be a unique value - -'default' If set and true use this value as the default for input fields. - Dates/times are expected to be timestamps - There is no default image capability - -'use' Character(s) that indicate which operations to use this field with. - - l = Listing records - g = Get - Displaying a record - n = Setup input for a new record - i = Insert new record - e = Edit an existing record - u = Update an edited record - d = Ask for verification of deletion of a record - c = Confirm delete and delete record. - a = All above operations - -'minValue' Minimum acceptable value (numeric) - Dates are specified as timestamp - -'maxValue' Maximum acceptable value (numeric) - Dates are specified as timestamp +(array index) The array index is only used to permit multiple entries for the + same database field. This permits including the field several + times so it can be processed differently based on the operation + being performed or can be displayed multiple time but each in a + different way. + +'field' Name of field in database table + +'as' Name to use for this field for all operations other than for talking + with the database. Doing this keeps any possible multiple instances + of use of a single database field separate. (see array index above) + + If this is not specified, then the actual database field name is + used for these purposes. + + +'type' Type of field - Possible field types are... + + 'integer', + 'float', + 'money', + 'percent', + 'pointer', + 'list', + 'text', + 'password', + 'checkbox', + 'email', + 'date', + 'time', + 'phone', + 'image', + 'latitude', Data is an array of (dir,deg,min,sec); + 'longitude' " " " + "dir" is - for West and South + +'filter' Optional filter - See PHP filter_input() "filter" parameter. + Currently only for type "text" + FILTER_SANITIZE_FULL_SPECIAL_CHARS does not seem to be defined at this time. + FILTER_SANITIZE_MAGIC_QUOTES seems to be good for permitting HTML + +'filter_options' Optional filter options - See PHP filter_input() "options" parameter. + Currently only for type "text". + +'required' If set and true, field data must be supplied + +'unique' If set and true, must be a unique value + +'default' If set and true use this value as the default for input fields. + Dates/times are expected to be timestamps + There is no default image capability + +'use' Character(s) that indicate which operations to use this field with. + + l = Listing records + g = Get - Displaying a record + n = Setup input for a new record + i = Insert new record + e = Edit an existing record + u = Update an edited record + d = Ask for verification of deletion of a record + c = Confirm delete and delete record. + a = All above operations + +'minValue' Minimum acceptable value (numeric) + Dates are specified as timestamp + +'maxValue' Maximum acceptable value (numeric) + Dates are specified as timestamp -'minLength' Minimum length for an input field -'maxLength' Maximum length for an input field +'minLength' Minimum length for an input field +'maxLength' Maximum length for an input field -'force_list' Always provide the picklist tables (p_static overrides) +'force_list' Always provide the picklist tables (p_static overrides) -'p_table' Table to get related data from for pointer types +'p_table' Table to get related data from for pointer types -'p_field' Field to get related data from for field types +'p_field' Field to get related data from for pointer types -'p_id' name of ID field in related data table +'p_id' name of ID field in related data table -'p_where' Additional WHERE clause for getting possible values from related table. - "T." refers to the primary table +'p_where' Additional WHERE clause for getting possible values from related table. + "T." refers to the primary table -'p_from' Additional FROM tables for getting possible values from related table. +'p_from' Additional FROM tables for getting possible values from related table. See example in dataMembers.php -'p_blank' If set or true provide a "blank" option for pointer input +'p_blank' If set or true provide a "blank" option for pointer input -'p_blank_text' If set, use this as the text for the 'p_blank' option +'p_blank_text' If set, use this as the text for the 'p_blank' option -'p_sort' Optional ORDER BY sort clause (i.e. "name, age DESC") - May not be functional yet. +'p_sort' Optional ORDER BY sort clause (i.e. "name, age DESC") - May not be functional yet. -'p_orderby' Optional "ORDER BY" clause for results from table pointed to by pointer +'p_orderby' Optional "ORDER BY" clause for results from table pointed to by pointer -'p_autoadd' Option to permit the addition of a new entry using a text input field +'p_autoadd' Option to permit the addition of a new entry using a text input field -'p_sum' If true causes a numeric sum of all returned values from the target table/column +'p_sum' If true causes a numeric sum of all returned values from the target table/column -'p_static' A static pointer that does not do a lookup for a list of values, only a single value reference +'p_static' A static pointer that does not do a lookup for a list of values, only a single value reference -'output_type' Optional type to use for output. Useful with pointers. +'output_type' Optional type to use for output. Useful with pointers. -'latlon_type' Optional specification for lat/lon output (DMS, DM, or D) +'latlon_type' Optional specification for lat/lon output (DMS, DM, or D) -'view_only' View only field, do not check for input or store, only provide data from record. +'view_only' View only field, do not check for input or store, only provide data from record. -'list' Required with field type 'list' - includes simple array where... - array key is value for option - array value is name for option +'list' Required with field type 'list' - includes simple array where... + array key is value for option + array value is name for option -'l_blank] Provide a blank entry for type 'list'. +'l_blank] Provide a blank entry for type 'list'. 'list_keytype' Type of key field (default is 'text') - 'text' A Text key - expects a text field in the database - 'int' An Integer key - expects a numeric field in the database + 'text' A Text key - expects a text field in the database + 'int' An Integer key - expects a numeric field in the database -'output_format' Optional output format specification as would be used in printf() - Use only the actual format and not the type identifier (i.e. "02.2" rather than "%f02.2") +'output_format' Optional output format specification as would be used in printf() + Use only the actual format and not the type identifier (i.e. "02.2" rather than "%f02.2") -'no_stripslashes' Don't strip slashes when recalling this field from the database. +'no_stripslashes' Don't strip slashes when recalling this field from the database. -'quicktip' Text description of this field and its use. +'quicktip' Text description of this field and its use. -'no_update_when_blank' Do not store a new value if the submitted data is blank +'no_update_when_blank' Do not store a new value if the submitted data is blank Used particularly for password fields where you only want them updated when the user puts something in -'pw_type' Type of password to require for password fields. (default is normal, 'strong' is for strong passwords with a mix of character types) +'pw_type' Type of password to require for password fields. (default is normal, 'strong' is for strong passwords with a mix of character types) +'i_prefix' Optional string prefix to be attached to the beginning of a stored image. May be used to categorize images + or associate an image with a particular entity. Note that no delimiter is added, so if you want want (i.e. '_'), you need to include that. Data specification for various types ------------------------------------ diff --git a/media/images/large/memb_1_AlliedEMS_1425158485.jpg b/media/images/large/memb_1_AlliedEMS_1425158485.jpg new file mode 100644 index 00000000..0473cf41 Binary files /dev/null and b/media/images/large/memb_1_AlliedEMS_1425158485.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209309.jpg b/media/images/large/memb_1_GLM_Logo_1424209309.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209309.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209380.jpg b/media/images/large/memb_1_GLM_Logo_1424209380.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209380.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209395.jpg b/media/images/large/memb_1_GLM_Logo_1424209395.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209395.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209500.jpg b/media/images/large/memb_1_GLM_Logo_1424209500.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209500.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209533.jpg b/media/images/large/memb_1_GLM_Logo_1424209533.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209533.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209590.jpg b/media/images/large/memb_1_GLM_Logo_1424209590.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209590.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209674.jpg b/media/images/large/memb_1_GLM_Logo_1424209674.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209674.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209710.jpg b/media/images/large/memb_1_GLM_Logo_1424209710.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209710.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1424209749.jpg b/media/images/large/memb_1_GLM_Logo_1424209749.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1424209749.jpg differ diff --git a/media/images/large/memb_1_GLM_Logo_1425063087.jpg b/media/images/large/memb_1_GLM_Logo_1425063087.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/large/memb_1_GLM_Logo_1425063087.jpg differ diff --git a/media/images/large/memb_1_ambulance_1424209765.jpg b/media/images/large/memb_1_ambulance_1424209765.jpg new file mode 100644 index 00000000..e48a36b3 Binary files /dev/null and b/media/images/large/memb_1_ambulance_1424209765.jpg differ diff --git a/media/images/large/memb_1_ambulance_1424276026.jpg b/media/images/large/memb_1_ambulance_1424276026.jpg new file mode 100644 index 00000000..e48a36b3 Binary files /dev/null and b/media/images/large/memb_1_ambulance_1424276026.jpg differ diff --git a/media/images/large/memb_1_ambulance_1424276148.jpg b/media/images/large/memb_1_ambulance_1424276148.jpg new file mode 100644 index 00000000..e48a36b3 Binary files /dev/null and b/media/images/large/memb_1_ambulance_1424276148.jpg differ diff --git a/media/images/large/memb_1_bkgrd_v2_1423781858.jpg b/media/images/large/memb_1_bkgrd_v2_1423781858.jpg new file mode 100644 index 00000000..9c658214 Binary files /dev/null and b/media/images/large/memb_1_bkgrd_v2_1423781858.jpg differ diff --git a/media/images/large/memb_1_bkgrd_v2_1424210527.jpg b/media/images/large/memb_1_bkgrd_v2_1424210527.jpg new file mode 100644 index 00000000..9c658214 Binary files /dev/null and b/media/images/large/memb_1_bkgrd_v2_1424210527.jpg differ diff --git a/media/images/large/memb_1_bkgrd_v2_1424271092.jpg b/media/images/large/memb_1_bkgrd_v2_1424271092.jpg new file mode 100644 index 00000000..9c658214 Binary files /dev/null and b/media/images/large/memb_1_bkgrd_v2_1424271092.jpg differ diff --git a/media/images/large/memb_1_frgrd_v2_1424209820.png b/media/images/large/memb_1_frgrd_v2_1424209820.png new file mode 100644 index 00000000..da4f5773 Binary files /dev/null and b/media/images/large/memb_1_frgrd_v2_1424209820.png differ diff --git a/media/images/large/memb_1_frgrd_v2_1424209995.png b/media/images/large/memb_1_frgrd_v2_1424209995.png new file mode 100644 index 00000000..da4f5773 Binary files /dev/null and b/media/images/large/memb_1_frgrd_v2_1424209995.png differ diff --git a/media/images/large/memb_1_logo_1424209796.png b/media/images/large/memb_1_logo_1424209796.png new file mode 100644 index 00000000..83b87682 Binary files /dev/null and b/media/images/large/memb_1_logo_1424209796.png differ diff --git a/media/images/large/memb_1_r158_1424208132.jpg b/media/images/large/memb_1_r158_1424208132.jpg new file mode 100644 index 00000000..30c10e9b Binary files /dev/null and b/media/images/large/memb_1_r158_1424208132.jpg differ diff --git a/media/images/large/memb_1_r158_1424276259.jpg b/media/images/large/memb_1_r158_1424276259.jpg new file mode 100644 index 00000000..30c10e9b Binary files /dev/null and b/media/images/large/memb_1_r158_1424276259.jpg differ diff --git a/media/images/medium/memb_1_AlliedEMS_1425158485.jpg b/media/images/medium/memb_1_AlliedEMS_1425158485.jpg new file mode 100644 index 00000000..0473cf41 Binary files /dev/null and b/media/images/medium/memb_1_AlliedEMS_1425158485.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209309.jpg b/media/images/medium/memb_1_GLM_Logo_1424209309.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209309.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209380.jpg b/media/images/medium/memb_1_GLM_Logo_1424209380.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209380.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209395.jpg b/media/images/medium/memb_1_GLM_Logo_1424209395.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209395.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209500.jpg b/media/images/medium/memb_1_GLM_Logo_1424209500.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209500.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209533.jpg b/media/images/medium/memb_1_GLM_Logo_1424209533.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209533.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209590.jpg b/media/images/medium/memb_1_GLM_Logo_1424209590.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209590.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209674.jpg b/media/images/medium/memb_1_GLM_Logo_1424209674.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209674.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209710.jpg b/media/images/medium/memb_1_GLM_Logo_1424209710.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209710.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1424209749.jpg b/media/images/medium/memb_1_GLM_Logo_1424209749.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1424209749.jpg differ diff --git a/media/images/medium/memb_1_GLM_Logo_1425063087.jpg b/media/images/medium/memb_1_GLM_Logo_1425063087.jpg new file mode 100644 index 00000000..7f56d0a9 Binary files /dev/null and b/media/images/medium/memb_1_GLM_Logo_1425063087.jpg differ diff --git a/media/images/medium/memb_1_ambulance_1424209765.jpg b/media/images/medium/memb_1_ambulance_1424209765.jpg new file mode 100644 index 00000000..e48a36b3 Binary files /dev/null and b/media/images/medium/memb_1_ambulance_1424209765.jpg differ diff --git a/media/images/medium/memb_1_ambulance_1424276026.jpg b/media/images/medium/memb_1_ambulance_1424276026.jpg new file mode 100644 index 00000000..e48a36b3 Binary files /dev/null and b/media/images/medium/memb_1_ambulance_1424276026.jpg differ diff --git a/media/images/medium/memb_1_ambulance_1424276148.jpg b/media/images/medium/memb_1_ambulance_1424276148.jpg new file mode 100644 index 00000000..e48a36b3 Binary files /dev/null and b/media/images/medium/memb_1_ambulance_1424276148.jpg differ diff --git a/media/images/medium/memb_1_bkgrd_v2_1423781858.jpg b/media/images/medium/memb_1_bkgrd_v2_1423781858.jpg new file mode 100644 index 00000000..a82e7ed3 Binary files /dev/null and b/media/images/medium/memb_1_bkgrd_v2_1423781858.jpg differ diff --git a/media/images/medium/memb_1_bkgrd_v2_1424210527.jpg b/media/images/medium/memb_1_bkgrd_v2_1424210527.jpg new file mode 100644 index 00000000..a82e7ed3 Binary files /dev/null and b/media/images/medium/memb_1_bkgrd_v2_1424210527.jpg differ diff --git a/media/images/medium/memb_1_bkgrd_v2_1424271092.jpg b/media/images/medium/memb_1_bkgrd_v2_1424271092.jpg new file mode 100644 index 00000000..a82e7ed3 Binary files /dev/null and b/media/images/medium/memb_1_bkgrd_v2_1424271092.jpg differ diff --git a/media/images/medium/memb_1_frgrd_v2_1424209820.png b/media/images/medium/memb_1_frgrd_v2_1424209820.png new file mode 100644 index 00000000..e9035a3f Binary files /dev/null and b/media/images/medium/memb_1_frgrd_v2_1424209820.png differ diff --git a/media/images/medium/memb_1_frgrd_v2_1424209995.png b/media/images/medium/memb_1_frgrd_v2_1424209995.png new file mode 100644 index 00000000..e9035a3f Binary files /dev/null and b/media/images/medium/memb_1_frgrd_v2_1424209995.png differ diff --git a/media/images/medium/memb_1_logo_1424209796.png b/media/images/medium/memb_1_logo_1424209796.png new file mode 100644 index 00000000..83b87682 Binary files /dev/null and b/media/images/medium/memb_1_logo_1424209796.png differ diff --git a/media/images/medium/memb_1_r158_1424208132.jpg b/media/images/medium/memb_1_r158_1424208132.jpg new file mode 100644 index 00000000..f83cb7a7 Binary files /dev/null and b/media/images/medium/memb_1_r158_1424208132.jpg differ diff --git a/media/images/medium/memb_1_r158_1424276259.jpg b/media/images/medium/memb_1_r158_1424276259.jpg new file mode 100644 index 00000000..f83cb7a7 Binary files /dev/null and b/media/images/medium/memb_1_r158_1424276259.jpg differ diff --git a/media/images/small/memb_1_AlliedEMS_1425158485.jpg b/media/images/small/memb_1_AlliedEMS_1425158485.jpg new file mode 100644 index 00000000..0473cf41 Binary files /dev/null and b/media/images/small/memb_1_AlliedEMS_1425158485.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209309.jpg b/media/images/small/memb_1_GLM_Logo_1424209309.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209309.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209380.jpg b/media/images/small/memb_1_GLM_Logo_1424209380.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209380.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209395.jpg b/media/images/small/memb_1_GLM_Logo_1424209395.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209395.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209500.jpg b/media/images/small/memb_1_GLM_Logo_1424209500.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209500.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209533.jpg b/media/images/small/memb_1_GLM_Logo_1424209533.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209533.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209590.jpg b/media/images/small/memb_1_GLM_Logo_1424209590.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209590.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209674.jpg b/media/images/small/memb_1_GLM_Logo_1424209674.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209674.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209710.jpg b/media/images/small/memb_1_GLM_Logo_1424209710.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209710.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1424209749.jpg b/media/images/small/memb_1_GLM_Logo_1424209749.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1424209749.jpg differ diff --git a/media/images/small/memb_1_GLM_Logo_1425063087.jpg b/media/images/small/memb_1_GLM_Logo_1425063087.jpg new file mode 100644 index 00000000..9a4c62de Binary files /dev/null and b/media/images/small/memb_1_GLM_Logo_1425063087.jpg differ diff --git a/media/images/small/memb_1_ambulance_1424209765.jpg b/media/images/small/memb_1_ambulance_1424209765.jpg new file mode 100644 index 00000000..6eff3550 Binary files /dev/null and b/media/images/small/memb_1_ambulance_1424209765.jpg differ diff --git a/media/images/small/memb_1_ambulance_1424276026.jpg b/media/images/small/memb_1_ambulance_1424276026.jpg new file mode 100644 index 00000000..6eff3550 Binary files /dev/null and b/media/images/small/memb_1_ambulance_1424276026.jpg differ diff --git a/media/images/small/memb_1_ambulance_1424276148.jpg b/media/images/small/memb_1_ambulance_1424276148.jpg new file mode 100644 index 00000000..6eff3550 Binary files /dev/null and b/media/images/small/memb_1_ambulance_1424276148.jpg differ diff --git a/media/images/small/memb_1_bkgrd_v2_1423781858.jpg b/media/images/small/memb_1_bkgrd_v2_1423781858.jpg new file mode 100644 index 00000000..b62ebb1f Binary files /dev/null and b/media/images/small/memb_1_bkgrd_v2_1423781858.jpg differ diff --git a/media/images/small/memb_1_bkgrd_v2_1424210527.jpg b/media/images/small/memb_1_bkgrd_v2_1424210527.jpg new file mode 100644 index 00000000..b62ebb1f Binary files /dev/null and b/media/images/small/memb_1_bkgrd_v2_1424210527.jpg differ diff --git a/media/images/small/memb_1_bkgrd_v2_1424271092.jpg b/media/images/small/memb_1_bkgrd_v2_1424271092.jpg new file mode 100644 index 00000000..b62ebb1f Binary files /dev/null and b/media/images/small/memb_1_bkgrd_v2_1424271092.jpg differ diff --git a/media/images/small/memb_1_frgrd_v2_1424209820.png b/media/images/small/memb_1_frgrd_v2_1424209820.png new file mode 100644 index 00000000..66fd314b Binary files /dev/null and b/media/images/small/memb_1_frgrd_v2_1424209820.png differ diff --git a/media/images/small/memb_1_frgrd_v2_1424209995.png b/media/images/small/memb_1_frgrd_v2_1424209995.png new file mode 100644 index 00000000..66fd314b Binary files /dev/null and b/media/images/small/memb_1_frgrd_v2_1424209995.png differ diff --git a/media/images/small/memb_1_logo_1424209796.png b/media/images/small/memb_1_logo_1424209796.png new file mode 100644 index 00000000..83b87682 Binary files /dev/null and b/media/images/small/memb_1_logo_1424209796.png differ diff --git a/media/images/small/memb_1_r158_1424208132.jpg b/media/images/small/memb_1_r158_1424208132.jpg new file mode 100644 index 00000000..6435384c Binary files /dev/null and b/media/images/small/memb_1_r158_1424208132.jpg differ diff --git a/media/images/small/memb_1_r158_1424276259.jpg b/media/images/small/memb_1_r158_1424276259.jpg new file mode 100644 index 00000000..6435384c Binary files /dev/null and b/media/images/small/memb_1_r158_1424276259.jpg differ diff --git a/media/images/thumb/memb_1_AlliedEMS_1425158485.jpg b/media/images/thumb/memb_1_AlliedEMS_1425158485.jpg new file mode 100644 index 00000000..a453b5c2 Binary files /dev/null and b/media/images/thumb/memb_1_AlliedEMS_1425158485.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209309.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209309.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209309.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209380.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209380.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209380.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209395.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209395.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209395.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209500.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209500.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209500.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209533.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209533.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209533.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209590.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209590.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209590.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209674.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209674.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209674.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209710.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209710.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209710.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1424209749.jpg b/media/images/thumb/memb_1_GLM_Logo_1424209749.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1424209749.jpg differ diff --git a/media/images/thumb/memb_1_GLM_Logo_1425063087.jpg b/media/images/thumb/memb_1_GLM_Logo_1425063087.jpg new file mode 100644 index 00000000..890c2e85 Binary files /dev/null and b/media/images/thumb/memb_1_GLM_Logo_1425063087.jpg differ diff --git a/media/images/thumb/memb_1_ambulance_1424209765.jpg b/media/images/thumb/memb_1_ambulance_1424209765.jpg new file mode 100644 index 00000000..d1c81b8a Binary files /dev/null and b/media/images/thumb/memb_1_ambulance_1424209765.jpg differ diff --git a/media/images/thumb/memb_1_ambulance_1424276026.jpg b/media/images/thumb/memb_1_ambulance_1424276026.jpg new file mode 100644 index 00000000..d1c81b8a Binary files /dev/null and b/media/images/thumb/memb_1_ambulance_1424276026.jpg differ diff --git a/media/images/thumb/memb_1_ambulance_1424276148.jpg b/media/images/thumb/memb_1_ambulance_1424276148.jpg new file mode 100644 index 00000000..d1c81b8a Binary files /dev/null and b/media/images/thumb/memb_1_ambulance_1424276148.jpg differ diff --git a/media/images/thumb/memb_1_bkgrd_v2_1423781858.jpg b/media/images/thumb/memb_1_bkgrd_v2_1423781858.jpg new file mode 100644 index 00000000..ebdfa4cb Binary files /dev/null and b/media/images/thumb/memb_1_bkgrd_v2_1423781858.jpg differ diff --git a/media/images/thumb/memb_1_bkgrd_v2_1424210527.jpg b/media/images/thumb/memb_1_bkgrd_v2_1424210527.jpg new file mode 100644 index 00000000..ebdfa4cb Binary files /dev/null and b/media/images/thumb/memb_1_bkgrd_v2_1424210527.jpg differ diff --git a/media/images/thumb/memb_1_bkgrd_v2_1424271092.jpg b/media/images/thumb/memb_1_bkgrd_v2_1424271092.jpg new file mode 100644 index 00000000..ebdfa4cb Binary files /dev/null and b/media/images/thumb/memb_1_bkgrd_v2_1424271092.jpg differ diff --git a/media/images/thumb/memb_1_frgrd_v2_1424209820.png b/media/images/thumb/memb_1_frgrd_v2_1424209820.png new file mode 100644 index 00000000..baf131eb Binary files /dev/null and b/media/images/thumb/memb_1_frgrd_v2_1424209820.png differ diff --git a/media/images/thumb/memb_1_frgrd_v2_1424209995.png b/media/images/thumb/memb_1_frgrd_v2_1424209995.png new file mode 100644 index 00000000..baf131eb Binary files /dev/null and b/media/images/thumb/memb_1_frgrd_v2_1424209995.png differ diff --git a/media/images/thumb/memb_1_logo_1424209796.png b/media/images/thumb/memb_1_logo_1424209796.png new file mode 100644 index 00000000..4fbc2618 Binary files /dev/null and b/media/images/thumb/memb_1_logo_1424209796.png differ diff --git a/media/images/thumb/memb_1_r158_1424208132.jpg b/media/images/thumb/memb_1_r158_1424208132.jpg new file mode 100644 index 00000000..d12974fa Binary files /dev/null and b/media/images/thumb/memb_1_r158_1424208132.jpg differ diff --git a/media/images/thumb/memb_1_r158_1424276259.jpg b/media/images/thumb/memb_1_r158_1424276259.jpg new file mode 100644 index 00000000..d12974fa Binary files /dev/null and b/media/images/thumb/memb_1_r158_1424276259.jpg differ diff --git a/misc/databaseScripts/create_database_V0.1.sql b/misc/databaseScripts/create_database_V0.1.sql index e9d17f68..f21f35fb 100644 --- a/misc/databaseScripts/create_database_V0.1.sql +++ b/misc/databaseScripts/create_database_V0.1.sql @@ -115,13 +115,17 @@ CREATE TABLE {prefix}categories ( ---- -CREATE TABLE {prefix}category_member ( +CREATE TABLE {prefix}category_member_info ( id INT NOT NULL AUTO_INCREMENT, category INT NULL, - member INT NULL, + member_info INT NULL, PRIMARY KEY (id), + CONSTRAINT categories_fk_1 + FOREIGN KEY (category) + REFERENCES {prefix}categories (id) + ON DELETE CASCADE, INDEX(category), - INDEX(member) + INDEX(member_info) ); ---- @@ -379,13 +383,14 @@ CREATE TABLE {prefix}member_info ( id INT NOT NULL AUTO_INCREMENT, member INT NULL, status INT NULL, + reference_name TINYTEXT NULL, descr TEXT NULL, short_descr TINYTEXT NULL, addr1 TINYTEXT NULL, addr2 TINYTEXT NULL, city INT NULL, - state INT NULL, - country INT NULL, + state TINYTEXT NULL, + country TINYTEXT NULL, zip TINYTEXT NULL, lat FLOAT NULL, lon FLOAT NULL, diff --git a/misc/databaseScripts/drop_database_V0.1.sql b/misc/databaseScripts/drop_database_V0.1.sql index 5fca8a39..518b3c42 100644 --- a/misc/databaseScripts/drop_database_V0.1.sql +++ b/misc/databaseScripts/drop_database_V0.1.sql @@ -11,7 +11,7 @@ DROP TABLE {prefix}amenities, {prefix}amenity_ref, {prefix}categories, - {prefix}category_member, + {prefix}category_member_info, {prefix}cities, {prefix}contacts, {prefix}facilities, diff --git a/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php b/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php index dc3e86bf..714454ee 100644 --- a/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php +++ b/misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '081a36d97cdf30d438a1e104c26a275acc180da0' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/index.html', - 1 => 1423101141, + 1 => 1425062899, 2 => 'file', ), ), @@ -67,7 +67,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( You do not have any members listed. Click here to create your first member. +?page=glm-members-admin-menu-member&glm_action=index&member_id=">Click here to create your first member. diff --git a/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php b/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php index db2f3d79..7b3615aa 100644 --- a/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php +++ b/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '1be35689c5d30d774f40ebc45e387f5f95c45e90' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html', - 1 => 1423239729, + 1 => 1425670675, 2 => 'file', ), ), @@ -27,10 +27,13 @@ $_valid = $_smarty_tpl->decodeProperties(array ( 'thisPage' => 0, 'v' => 0, 'haveInfoRecords' => 0, + 'memberID' => 0, + 'showArchived' => 0, + 'noActive' => 0, 'memberInfoRecords' => 0, 'i' => 0, 'm' => 0, - 'memberID' => 0, + 'statusPending' => 0, ), 'has_nocache_code' => false, ),false); /*/%%SmartyHeaderCode%%*/?> @@ -127,16 +130,32 @@ $_smarty_tpl->tpl_vars['v']->_loop = true; + +

 

tpl_vars['haveMember']->value) {?> tpl_vars['haveInfoRecords']->value) {?> + + Add New Member Information Version +

Member Information Versions

+

tpl_vars['showArchived']->value) {?> checked="checked"> Show archived information  

+ + tpl_vars['noActive']->value) {?> +

There is no active information for this member.

+ + - + + + @@ -149,14 +168,32 @@ $_smarty_tpl->tpl_vars['m']->_loop = true; tpl_vars['i']->value++ / 1)) {?> - + - + - - + @@ -177,6 +214,25 @@ $_smarty_tpl->tpl_vars['m']->_loop = true; ?page=glm-members-admin-menu-configure&glm_action=memberTypes">Click here to add Member Types. + + type="text/javascript"> + jQuery(document).ready(function($) { + + $('#showArchived').click( function() { + checked = 'false'; + if ($(this).attr('checked') == 'checked') { + checked = 'true'; + } + window.location.replace("tpl_vars['thisURL']->value;?> +?page=tpl_vars['thisPage']->value;?> +&glm_action=index&member=tpl_vars['memberID']->value;?> +&showArchived=" + checked); + }); + + }); + +> + getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?> diff --git a/misc/smarty/templates_c/4c287ca0e4946b3d644e61950c851e98e8906d49.file.list.html.php b/misc/smarty/templates_c/4c287ca0e4946b3d644e61950c851e98e8906d49.file.list.html.php index 2091ca95..fbda4d8a 100644 --- a/misc/smarty/templates_c/4c287ca0e4946b3d644e61950c851e98e8906d49.file.list.html.php +++ b/misc/smarty/templates_c/4c287ca0e4946b3d644e61950c851e98e8906d49.file.list.html.php @@ -1,4 +1,4 @@ -decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '4c287ca0e4946b3d644e61950c851e98e8906d49' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/list.html', - 1 => 1422815211, + 1 => 1425667668, 2 => 'file', ), ), @@ -36,9 +36,9 @@ $_valid = $_smarty_tpl->decodeProperties(array ( tpl_vars['haveFilter']->value) {?> class="glm-notice">List Filters:   - tpl_vars['filterStatus']->value) {?> checked>Pending - Search + tpl_vars['filterStatus']->value) {?> checked>Has Pending Information   + Search

List of Members

@@ -50,6 +50,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
+ @@ -84,6 +85,9 @@ $_smarty_tpl->tpl_vars['m']->_loop = true; tpl_vars['m']->value['created']['date'];?> + {/if} - - {/if} - - - - @@ -36,28 +36,73 @@ - + - -
Access:Access Created Last UpdateReference Name
tpl_vars['m']->value['status']['name'];?> + tpl_vars['m']->value['status']['value']==$_smarty_tpl->tpl_vars['statusPending']->value) {?> class="glm-notice">tpl_vars['m']->value['status']['name'];?> +tpl_vars['m']->value['create_time']['datetime'];?> tpl_vars['m']->value['create_time']['time'];?> + tpl_vars['m']->value['modify_time']['datetime'];?> tpl_vars['m']->value['modify_time']['time'];?> + tpl_vars['m']->value['reference_name'];?> + Manage + tpl_vars['m']->value['status']['name']!='Active') {?>Activate  +
Member Name Member Type Date CreatedPending  
+ tpl_vars['m']->value['pending']>0) {?>Pending + decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( 'c74bd17240f8892f8955e8bedbedd434341aeca9' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/header.html', - 1 => 1422815090, + 1 => 1424809451, 2 => 'file', ), ), @@ -23,6 +23,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( 'thisPage' => 0, 'memberID' => 0, 'thisAction' => 0, + 'memberInfoID' => 0, 'haveMember' => 0, 'haveMemberInfo' => 0, ), @@ -40,7 +41,8 @@ $_valid = $_smarty_tpl->decodeProperties(array ( Member Info +&id=tpl_vars['memberInfoID']->value;?> +" class="nav-tabtpl_vars['thisAction']->value=='memberInfo') {?>-active tpl_vars['haveMember']->value||!$_smarty_tpl->tpl_vars['haveMemberInfo']->value) {?>disabled">Member Info wpdb->query($sql); + + } + } + + // Check if there's a request to activate a specific member information record + if (isset($_REQUEST['activateID']) && $_REQUEST['activateID'] != '') { + + $activateID = $_REQUEST['activateID']-0; + + // If the ID is sane, try to activate this recored + if ($activateID > 0) { + + // Make sure we have a good ID + $sql = " + SELECT id + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + WHERE id = $activateID + ;"; + $idTest = $this->wpdb->get_row($sql, ARRAY_A); + + // If we do, then activate it + if($idTest != null) { + + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + SET status = ".$this->config['status_numb']['Inactive']." + WHERE status = ".$this->config['status_numb']['Active']." + ;"; + $this->wpdb->query($sql); + + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + SET status = ".$this->config['status_numb']['Active']." + WHERE id = $activateID + ;"; + $this->wpdb->query($sql); + + } + + + } + } + + // If we have a member then also get a list of member info records $haveInfoRecords = false; $memberInfoRecords = false; + $noActive = false; + $showArchived = false; if ($haveMember) { + + // Hide archived unless instructed otherwise + $hideArchived = ''; + if (!isset($_REQUEST['showArchived']) || $_REQUEST['showArchived'] != 'true') { + $hideArchived = " && T.status != ".$this->config['status_numb']['Archived']; + } else { + $showArchived = true; + } + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'); $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config); - $memberInfoRecords = $MemberInfo->getList($memberID); + $memberInfoRecords = $MemberInfo->getList("T.member = $memberID".$hideArchived, 'T.status'); - // Check if any members returned + // Check if there's any member information records if (is_array($memberInfoRecords) && count($memberInfoRecords) > 0) { $haveInfoRecords = true; } + + // Determine if there are any active info records for this member + $sql = " + SELECT count(id) as numbActive + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + WHERE status = ".$this->config['status_numb']['Active']." + ;"; + $activeTest = $this->wpdb->get_row($sql, ARRAY_A); + + // If count is 0 then there are no active info records + if ($activeTest['numbActive'] == 0) { + $noActive = true; + } + } // Compile template data @@ -212,8 +297,11 @@ class GlmMembersAdmin_member_index extends GlmDataMembers 'member' => $memberData, 'haveInfoRecords' => $haveInfoRecords, 'memberInfoRecords' => $memberInfoRecords, + 'noActive' => $noActive, + 'showArchived' => $showArchived, 'haveMemberInfo' => $haveMemberInfo, - 'updated' => $updated + 'updated' => $updated, + 'statusPending' => $this->config['status_numb']['Pending'] ); // Return status, suggested view, and data to controller diff --git a/models/admin/member/memberInfo.php b/models/admin/member/memberInfo.php index fe06a9a3..3fb971d7 100644 --- a/models/admin/member/memberInfo.php +++ b/models/admin/member/memberInfo.php @@ -131,42 +131,32 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo */ public function modelAction ($redirectData = false) { - + // Set some default values $success = true; $memberID = 0; $haveMember = false; $memberInfoID = 0; $haveMemberInfo = false; + $isActive = false; + $noActive = false; $categories = false; $haveCategories = false; $regions = false; $haveRegions = false; $error = false; - // Get sorted list of categories - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); - $Categories = new GlmDataCategories($this->wpdb, $this->config); - $categories = $Categories->getList(); - if (is_array($categories) && count($categories) > 0) { - - // Sort results by higherarchy (Parent/Child and Alpha) - $categories = glmMembersAdmin::sortParentChild($categories); - $haveCategories = true; - - } - - // Check for action option + // Check for action option - Should be one of the values in the "switch" statement below $option = false; if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { $option = $_REQUEST['option']; } - // Get supplied member ID + // If a member ID is supplied, get that and make sure it's a valid integer if (isset($_REQUEST['member'])) { $memberID = $_REQUEST['member']-0; } - // If member ID not supplied - we shouldn't be here + // If member ID not supplied - we shouldn't be here, so redirect to an error page if ($memberID <= 0) { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { @@ -186,16 +176,31 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php'); $Members = new GlmDataMembers($this->wpdb, $this->config); $memberData = $Members->getEntry($memberID); + $this->fields['logo']['i_prefix'] = 'memb_'.$memberID.'_'; $haveMember = true; } - // Get member info record ID - if (isset($_REQUEST['member_info_id'])) { - $memberInfoID = $_REQUEST['member_info_id']-0; + // If a member info record ID is supplied, get that and make sure it's an integer + if (isset($_REQUEST['id'])) { + $memberInfoID = $_REQUEST['id']-0; $haveMemberInfo = true; + + // Determine if this is the active record + $sql = " + SELECT status + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + WHERE id = $memberInfoID + ;"; + $activeTest = $this->wpdb->get_row($sql, ARRAY_A); + + // If it is, then save that + if ($activeTest['status'] == $this->config['status_numb']['Active']) { + $isActive = true; + } + } - // If no member info record, assume that we need to create the first record + // If no member info record, assume that we need to create a new one if ($memberInfoID <= 0 && $option != 'addNew') { $option = 'create'; } @@ -204,48 +209,58 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo glmMembersAdmin::addNotice("  Option specified: $option", 'Process'); } - // Perform requested option + /* + * Perform requested action + */ switch ($option) { - case 'new': + // Setup to input a nnew member information record + case 'create': $MemberInfo = $this->newEntry(); break; + // Process submission of a member information record update case 'submit': if ($haveMemberInfo) { - // Update the member data - $MemberInfo = $this->updateEntry($memberID); + + // Update the member Info data + $MemberInfo = $this->updateEntry($memberInfoID); + + break; + } else { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { glmMembersAdmin::addNotice("  No member information exists, assuming this is a new submission.", 'Process'); } - break; + // Note that if we don't have an existing member info record, we fall through to "addNew" below. + } + // Add the new member information record case 'addNew': // Insert the new member into the database $MemberInfo = $this->insertEntry(); + if ($MemberInfo['status']) { + $memberInfoID = $MemberInfo['fieldData']['id']; + $haveMemberInfo = true; + } break; - case 'create': - - $MemberInfo = $this->newEntry(); - - break; - + // Default is to display the currently selected member information record in a form for updates default: // Edit the existing member - $MemberInfo = $this->getEntry($memberInfoID); + $MemberInfo = $this->editEntry($memberInfoID); // If we have member data, say so if (is_array($MemberInfo) && $MemberInfo['status']) { + $haveMemberInfo = true; // Otherwise @@ -261,7 +276,33 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo break; + } + + // If we have a member ID and this was a submission with a new city (id < 0) + if ($memberInfoID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') { + // Clean up city name + $cName = trim(filter_var($_REQUEST['newCityName'])); + + // Try to add the city + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'); + $Cities = new GlmDataCities($this->wpdb, $this->config); + $cID = $Cities->addCity($cName); + + // If we got a city id back + if (is_int($cID) && $cID > 0) { + + // Update the city selected for this memberInfo record + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + SET city = $cID + WHERE id = $memberInfoID + ;"; + $this->wpdb->query($sql); + + // Get updated member information for editing. + $MemberInfo = $this->editEntry($memberInfoID); + } } @@ -277,6 +318,143 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo } + /* + * Get a sorted list of categories. + * These will be sorted so sub-categories fall under their + * respective category. + */ + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); + $Categories = new GlmDataCategories($this->wpdb, $this->config); + $categories = $Categories->getListSortedParentChild(); + if (is_array($categories) && count($categories) > 0) { + $haveCategories = true; + } + + // Lastly, if we have member info, and if this record is active, we need to check for other active records and other things + $categoryMemberInfo = false; + if ($haveMemberInfo) { + +// *** Need to Modularize this + + // Determine if this is the active record + $sql = " + SELECT status + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + WHERE id = $memberInfoID + ;"; + $activeTest = $this->wpdb->get_row($sql, ARRAY_A); + + // If the current record is now active and wasn't before + if ($activeTest['status'] == $this->config['status_numb']['Active'] && !$isActive) { + + // Change any others for this member to inactive + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + SET status = ".$this->config['status_numb']['Inactive']." + WHERE status = ".$this->config['status_numb']['Active']." + AND id != $memberInfoID + ;"; + $this->wpdb->query($sql); + + } + + // Instatiate categoryMemberInfo class + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php'); + $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config); + + // Get any selected categories + $selectedCategories = array(); + $newCategory = false; + if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) { + + /* + * For each selected category + * + * Note that categories are submitted with either a positive key, which indicates + * that it represents an existing category, or a negative key, which indicates + * that the user is trying to add it to the list of categories. + * + */ + foreach ($_REQUEST['category'] as $key) { + + // Make sure key is an integer + $key = intval($key -0); + + // If negative, this is a new category that needs to be added to the category table + if ($key < 0) { + + $newCategory = true; + + // Check if a parent is specied + $parent = 0; + if ($_REQUEST['newCatParent'][$key] != '') { + $parent = $_REQUEST['newCatParent'][$key] -0; + } elseif ($_REQUEST['newCatParentName'][$key]) { + $parent = $_REQUEST['newCatParentName'][$key]; + } + + // Clean up the category name + $category = filter_var($_REQUEST['newCategory'][$key]); + + // Add it to the category table and get the new category ID + $categoryID = $Categories->addCategory($category, $parent); + + // If we got a new category ID, ad it to the array of currently selected categoryMemberInfo records + if ($categoryID) { + $selectedCategories[$categoryID] = $categoryID; + } + + // Otherwise if it's positive, the category is an existing one + } else if ($key > 0) { + + $selectedCategories[$key] = $key; + + } + // A zero index should never happen, but we ignore them anyway + + // If there's selected categories + if (count($selectedCategories) > 0) { + + // Update the selected categories for this member information record, returns new list + $categoryMemberInfo = $CategoryMemberInfo->setMemberInfoCategories($memberInfoID, $selectedCategories); + + } + + // If there's been a new category + if ($newCategory) { + + // Get the full category list again + $categories = $Categories->getListSortedParentChild(); + + } + + } // For each category being submitted + + } // If there's any categories selected + + // Now get the (possibly updated) category list for this member info record + $categoryMemberInfo = $CategoryMemberInfo->getListWithParents($memberInfoID); + + } // Have member info + + // If we have a member record + if ($haveMember) { + + // Determine if there are any active info records for this member + $sql = " + SELECT count(id) as numbActive + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + WHERE status = ".$this->config['status_numb']['Active']." + ;"; + $activeTest = $this->wpdb->get_row($sql, ARRAY_A); + + // If count is 0 then there are no active info records + if ($activeTest['numbActive'] == 0) { + $noActive = true; + } + + } + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($MemberInfo, 'DataBlock', 'Member Data'); } @@ -290,7 +468,10 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo 'memberInfoID' => $memberInfoID, 'memberInfo' => $MemberInfo, 'haveCategories' => $haveCategories, - 'categories' => $categories + 'categories' => $categories, + 'categoryMemberInfo' => $categoryMemberInfo, + 'noActive' => $noActive, + 'time' => time() ); // Return status, suggested view, and data to controller @@ -307,4 +488,4 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo } -?> \ No newline at end of file +?> diff --git a/models/admin/members/list.php b/models/admin/members/list.php index 51cb9ea4..05bbd63e 100644 --- a/models/admin/members/list.php +++ b/models/admin/members/list.php @@ -103,12 +103,6 @@ class GlmMembersAdmin_members_list extends GlmDataMembers $filterName = false; $haveFilter = false; - // Check for list filters - if (isset($_REQUEST['filterPending'])) { - $where .= 'T.status = '.$this->config['status_numb']['Pending']; - $filterStatus = true; - $haveFilter = true; - } if (isset($_REQUEST['filterName'])) { $filterName = $_REQUEST['filterName']; $where .= "T.name like '%$filterName%'"; @@ -118,6 +112,26 @@ class GlmMembersAdmin_members_list extends GlmDataMembers // Get a current list of members $list = $this->getList($where); + /* + * Check for list filters + * + * Note that since the pointer processing in the data abstract takes place after the + * query of the table data, and that the pending value is actually a sum() of the + * id field values for member_info table generated using the pointer p_sum options, + * we can't use a common where clause to select it. + */ + if (isset($_REQUEST['filterPending'])) { + + foreach($list as $k => $v) { + if ($v['pending'] == 0) { + unset($list[$k]); + } + } + + $filterStatus = true; + $haveFilter = true; + } + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data'); } diff --git a/views/admin/configure/accommodationTypes.html b/views/admin/configure/accommodationTypes.html index 8be95c2e..8e78a956 100644 --- a/views/admin/configure/accommodationTypes.html +++ b/views/admin/configure/accommodationTypes.html @@ -1,11 +1,11 @@ {include file='admin/configure/header.html'} +
Add a Accommodation Type
+ +

Are you sure you want to delete this accommodation type?

Yes, delete this accommodation type

-

No, I don't want to delete this accommodation

+

Cancel

- + + +
+
+ + + + + + + + + + + + + + + + +
Accommodation Type Name: + +
Description: + +
Short Description: + +
+

* Required

+ Cancel + +
+

Accommodation Types

@@ -64,12 +94,12 @@
- {$t.name} + {$t.name} + {$t.descr} + {$t.short_descr} @@ -91,6 +121,11 @@ minWidth: 400, dialogClass: "glm-dialog-no-close" }); + $("#editAccommodationTypeDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); $("#deleteAccommodationTypeDialog").dialog({ autoOpen: false, minWidth: 400, @@ -100,6 +135,20 @@ $('#newAccommodationTypeButton').click( function() { $("#newAccommodationTypeDialog").dialog("open"); }); + $('.editAccommodationType').click( function() { + var accommodationTypeID = $(this).attr('data-accommodationTypeID'); + var accommodationTypeName = $(this).text(); + var accommodationTypeDescr = $('#editAccommodationTypeDescr_' + accommodationTypeID).html(); + var accommodationTypeShortDescr = $('#editAccommodationTypeShortDescr_' + accommodationTypeID).html(); + $('#editAccommodationTypeID').val(accommodationTypeID); + $('#editAccommodationTypeName').val(accommodationTypeName.trim()); + $('#editAccommodationTypeDescr').val(accommodationTypeDescr.trim()); + $('#editAccommodationTypeShortDescr').val(accommodationTypeShortDescr.trim()); + $("#editAccommodationTypeDialog").dialog("open"); + }); + $('#editAccommodationTypeCancel').click( function() { + $("#editAccommodationTypeDialog").dialog("close"); + }); $('#newAccommodationTypeCancel').click( function() { $("#newAccommodationTypeDialog").dialog("close"); }); @@ -111,7 +160,7 @@ }); $('#deleteAccommodationTypeConfirm').click( function() { $("#deleteAccommodationTypeDialog").dialog("close"); - window.location.href = "{$thisURL}?page={$thisPage}&glm_action=accommodationTypes&option=delete&accommodationTypeID=" + id; + window.location.href = "{$thisURL}?page={$thisPage}&glm_action=accommodationTypes&option=delete&id=" + id; }); $('#deleteAccommodationTypeCancel').click( function() { $("#deleteAccommodationTypeDialog").dialog("close"); diff --git a/views/admin/configure/amenities.html b/views/admin/configure/amenities.html index f6d52645..7d893b5a 100644 --- a/views/admin/configure/amenities.html +++ b/views/admin/configure/amenities.html @@ -1,11 +1,11 @@ {include file='admin/configure/header.html'} +
Add a Amenity
- @@ -40,8 +40,6 @@ - -
Amenity Name:

* Required

Cancel @@ -49,13 +47,63 @@
+ +

Are you sure you want to delete this accommodation type?

Yes, delete this accommodation type

-

No, I don't want to delete this accommodation

+

Cancel

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Amenity Name: + +
Facility Type: + +
Uses a value:
Description: + +
Short Description: + +
+

* Required

+ Cancel + + +
+

Amenities

@@ -81,18 +129,18 @@
- {$t.name} + {$t.name} + {$t.facility_type.name} + {$t.uses_value.name} + {$t.descr} + {$t.short_descr} @@ -114,6 +162,11 @@ minWidth: 400, dialogClass: "glm-dialog-no-close" }); + $("#editAmenityDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); $("#deleteAmenityDialog").dialog({ autoOpen: false, minWidth: 400, @@ -123,6 +176,24 @@ $('#newAmenityButton').click( function() { $("#newAmenityDialog").dialog("open"); }); + $('.editAmenity').click( function() { + var amenityID = $(this).attr('data-amenityID'); + var amenityName = $(this).text(); + var amenityFacilityTypeID = $(this).attr('data-facilityTypeID'); + var amenityUsesValue = parseInt($(this).attr('data-amenityUsesValue')); + var amenityDescr = $('#editAmenityDescr_' + amenityID).html(); + var amenityShortDescr = $('#editAmenityShortDescr_' + amenityID).html(); + $('#editAmenityID').val(amenityID); + $('#editAmenityName').val(amenityName.trim()); + $('#editAmenityFacility').val(amenityFacilityTypeID); + $('#editAmenityUsesValue').prop('checked', amenityUsesValue); + $('#editAmenityDescr').val(amenityDescr.trim()); + $('#editAmenityShortDescr').val(amenityShortDescr.trim()); + $("#editAmenityDialog").dialog("open"); + }); + $('#editAmenityCancel').click( function() { + $("#editAmenityDialog").dialog("close"); + }); $('#newAmenityCancel').click( function() { $("#newAmenityDialog").dialog("close"); }); @@ -134,7 +205,7 @@ }); $('#deleteAmenityConfirm').click( function() { $("#deleteAmenityDialog").dialog("close"); - window.location.href = "{$thisURL}?page={$thisPage}&glm_action=amenities&option=delete&amenityID=" + id; + window.location.href = "{$thisURL}?page={$thisPage}&glm_action=amenities&option=delete&id=" + id; }); $('#deleteAmenityCancel').click( function() { $("#deleteAmenityDialog").dialog("close"); diff --git a/views/admin/configure/categories.html b/views/admin/configure/categories.html index 0b3ced13..83325d08 100644 --- a/views/admin/configure/categories.html +++ b/views/admin/configure/categories.html @@ -1,5 +1,6 @@ {include file='admin/configure/header.html'} +
Add a Category
@@ -26,7 +27,6 @@ {/foreach} {/if} -
Description:Short Description:

* Required

Cancel - + +

Are you sure you want to delete this category?

Yes, delete this category

-

No, I don't want to delete this category

+

Cancel

- + + +
+
+ + + + + + + + + + + + + + + + + + + + +
Category Name: + +
Parent Category: + +
Description: + +
Short Description: + +
+

* Required

+ Cancel + +
+

Categories

@@ -81,13 +126,13 @@ {/if} - {$t.name} + {$t.name} - + {$t.descr} - + {$t.short_descr} @@ -109,6 +154,11 @@ minWidth: 400, dialogClass: "glm-dialog-no-close" }); + $("#editCategoryDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); $("#deleteCategoryDialog").dialog({ autoOpen: false, minWidth: 400, @@ -118,6 +168,22 @@ $('#newCategoryButton').click( function() { $("#newCategoryDialog").dialog("open"); }); + $('.editCategory').click( function() { + var catID = $(this).attr('data-categoryID'); + var catName = $(this).text(); + var catParent = $(this).attr('data-categoryParent'); + var catDescr = $('#editCategoryDescr_' + catID).html(); + var catShortDescr = $('#editCategoryShortDescr_' + catID).html(); + $('#editCategoryID').val(catID); + $('#editCategoryName').val(catName.trim()); + $('#editCategoryParent').val(catParent); + $('#editCategoryDescr').val(catDescr.trim()); + $('#editCategoryShortDescr').val(catShortDescr.trim()); + $("#editCategoryDialog").dialog("open"); + }); + $('#editCategoryCancel').click( function() { + $("#editCategoryDialog").dialog("close"); + }); $('#newCategoryCancel').click( function() { $("#newCategoryDialog").dialog("close"); }); @@ -129,7 +195,7 @@ }); $('#deleteCategoryConfirm').click( function() { $("#deleteCategoryDialog").dialog("close"); - window.location.href = "{$thisURL}?page={$thisPage}&glm_action=categories&option=delete&categoryID=" + id; + window.location.href = "{$thisURL}?page={$thisPage}&glm_action=categories&option=delete&id=" + id; }); $('#deleteCategoryCancel').click( function() { $("#deleteCategoryDialog").dialog("close"); diff --git a/views/admin/configure/cities.html b/views/admin/configure/cities.html index 39a7f428..789f0361 100644 --- a/views/admin/configure/cities.html +++ b/views/admin/configure/cities.html @@ -1,11 +1,11 @@ {include file='admin/configure/header.html'} +
Add a City
- @@ -13,29 +13,41 @@ - - - - - -
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

+

Cancel

- + + +
+
+ + + + + + + + +
City Name: + +
+

* Required

+ Cancel + +
+

Cities

@@ -56,7 +68,7 @@ {/if} - {$t.name} + {$t.name}
Delete
@@ -77,6 +89,11 @@ minWidth: 400, dialogClass: "glm-dialog-no-close" }); + $("#editCityDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); $("#deleteCityDialog").dialog({ autoOpen: false, minWidth: 400, @@ -89,6 +106,16 @@ $('#newCityCancel').click( function() { $("#newCityDialog").dialog("close"); }); + $('.editCity').click( function() { + var cityID = $(this).attr('data-cityID'); + var cityName = $(this).text(); + $('#editCityID').val(cityID); + $('#editCityName').val(cityName.trim()); + $("#editCityDialog").dialog("open"); + }); + $('#editCityCancel').click( function() { + $("#editCityDialog").dialog("close"); + }); var id = false; $('.deleteCityButton').click( function() { @@ -97,7 +124,7 @@ }); $('#deleteCityConfirm').click( function() { $("#deleteCityDialog").dialog("close"); - window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=delete&cityID=" + id; + window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=delete&id=" + id; }); $('#deleteCityCancel').click( function() { $("#deleteCityDialog").dialog("close"); diff --git a/views/admin/configure/memberTypes.html b/views/admin/configure/memberTypes.html index c2c2965b..1756e4d9 100644 --- a/views/admin/configure/memberTypes.html +++ b/views/admin/configure/memberTypes.html @@ -1,6 +1,7 @@ {include file='admin/configure/header.html'} -
Add a Member Type
+ +
Add a Member Type
@@ -19,23 +20,47 @@ - -

* 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

+

Cancel

+ +
+
+ + + + + + + + + + + + +
Member Type Name: + +
Description: + +
+

* Required

+ Cancel + +
+

Member Types

@@ -57,9 +82,9 @@ {/if} - {$t.name} + {$t.name} - + {$t.descr} @@ -81,6 +106,11 @@ minWidth: 400, dialogClass: "glm-dialog-no-close" }); + $("#editMemberTypeDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); $("#deleteMemberTypeDialog").dialog({ autoOpen: false, minWidth: 400, @@ -90,6 +120,18 @@ $('#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"); }); @@ -101,7 +143,7 @@ }); $('#deleteMemberTypeConfirm').click( function() { $("#deleteMemberTypeDialog").dialog("close"); - window.location.href = "{$thisURL}?page={$thisPage}&glm_action=memberTypes&option=delete&memberTypeID=" + id; + window.location.href = "{$thisURL}?page={$thisPage}&glm_action=memberTypes&option=delete&id=" + id; }); $('#deleteMemberTypeCancel').click( function() { $("#deleteMemberTypeDialog").dialog("close"); diff --git a/views/admin/configure/regions.html b/views/admin/configure/regions.html index 0309213a..c4cb6e85 100644 --- a/views/admin/configure/regions.html +++ b/views/admin/configure/regions.html @@ -1,11 +1,11 @@ {include file='admin/configure/header.html'} +
Add a Region
- @@ -20,28 +20,58 @@ - + - -
Region Name:
Description:Short 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

+

Cancel

- + + +
+
+ + + + + + + + + + + + + + + + +
Region Name: + +
Description: + +
Short Description: + +
+

* Required

+ Cancel + +
+

Regions

@@ -64,12 +94,12 @@ {/if} - {$t.name} + {$t.name} - + {$t.descr} - + {$t.short_descr} @@ -91,6 +121,11 @@ minWidth: 400, dialogClass: "glm-dialog-no-close" }); + $("#editRegionDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); $("#deleteRegionDialog").dialog({ autoOpen: false, minWidth: 400, @@ -100,6 +135,20 @@ $('#newRegionButton').click( function() { $("#newRegionDialog").dialog("open"); }); + $('.editRegion').click( function() { + var regionID = $(this).attr('data-regionID'); + var regionName = $(this).text(); + var regionDescr = $('#editRegionDescr_' + regionID).html(); + var regionShortDescr = $('#editRegionShortDescr_' + regionID).html(); + $('#editRegionID').val(regionID); + $('#editRegionName').val(regionName.trim()); + $('#editRegionDescr').val(regionDescr.trim()); + $('#editRegionShortDescr').val(regionShortDescr.trim()); + $("#editRegionDialog").dialog("open"); + }); + $('#editRegionCancel').click( function() { + $("#editRegionDialog").dialog("close"); + }); $('#newRegionCancel').click( function() { $("#newRegionDialog").dialog("close"); }); @@ -111,7 +160,7 @@ }); $('#deleteRegionConfirm').click( function() { $("#deleteRegionDialog").dialog("close"); - window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=delete®ionID=" + id; + window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=delete&id=" + id; }); $('#deleteRegionCancel').click( function() { $("#deleteRegionDialog").dialog("close"); diff --git a/views/admin/member/header.html b/views/admin/member/header.html index f82c128b..c8f8a89e 100644 --- a/views/admin/member/header.html +++ b/views/admin/member/header.html @@ -4,7 +4,7 @@

Member Information Versions

+

Show archived information  

+ + {if $noActive} +

There is no active information for this member.

+ {/if} + - + + + @@ -86,11 +99,16 @@ {if $i++ is odd by 1} {else} - + {/if} - - - + + + + + {/foreach} @@ -107,5 +125,19 @@ {/if} + + {include file='admin/footer.html'} diff --git a/views/admin/member/memberInfo.html b/views/admin/member/memberInfo.html index cab2bbda..a80329d6 100644 --- a/views/admin/member/memberInfo.html +++ b/views/admin/member/memberInfo.html @@ -1,6 +1,22 @@ {include file='admin/member/header.html'} + + {if $haveMemberInfo} + +
Archive this Member Information
+
+
+

Cancel

+

+
+

+ NOTE: Archived member information records are not listed in the the member Dashboard by default but + may be shown using the "Show archived information" checkbox on that page. +

+ +
+

Edit Member Information

{else}

Add New Member Information

@@ -11,10 +27,13 @@ {if $haveMemberInfo} + + {else} + {/if} - +
Access:Access Created Last UpdateReference Name
{$m.status.name}{$m.create_time.time}{$m.modify_time.time}{$m.status.name}{$m.create_time.datetime}{$m.modify_time.datetime}{$m.reference_name} + Manage + {if $m.status.name != 'Active'}Activate{/if}  +
Click here to add Member Types.
@@ -24,13 +43,28 @@ + {if $haveMemberInfo} - + + {/if} + {if $noActive} + + {/if} - + {if $haveMemberInfo} + + + + + + + + + {/if} + - - + - - - + - + + + + @@ -149,9 +142,10 @@ - + - - - - {if $memberInfo.fieldRequired.lat} + + + + + + + + + + + + @@ -243,7 +306,24 @@ @@ -261,13 +341,10 @@ - - -
Member Name:Member Type: {$member.member_type.name}
Access: {$member.access.name}

You do not have any active information for this member.

 
Member Info Status:
Created:{$memberInfo.fieldData.create_time.datetime}
Last Updated:{$memberInfo.fieldData.modify_time.datetime}
Member Info Status:
Categories - -
Add a new Category
-
- - - - - - - - - -
Category Name: - -
-
Parent Category: - - -
-

* Required

- Cancel - -
- -    Select a category to add to box below.
-
-
+
  +

Descriptions

Region: - - {if $memberInfo.fieldFail.region}

{$memberInfo.fieldFail.region}

{/if} +
Reference Name: + + {if $memberInfo.fieldFail.reference_name}

{$memberInfo.fieldFail.reference_name}

{/if}
Description: - + {if $memberInfo.fieldFail.descr}

{$memberInfo.fieldFail.descr}

{/if}
Short Description: - + {if $memberInfo.fieldFail.short_descr}

{$memberInfo.fieldFail.short_descr}

{/if}
  +

Member Address

+

The map below will display the likely location as you enter or edit the address.

+
Address Line 1: - + {if $memberInfo.fieldFail.addr1}

{$memberInfo.fieldFail.addr1}

{/if}
Address Line 2: - + {if $memberInfo.fieldFail.addr2}

{$memberInfo.fieldFail.addr2}

{/if}
State: - {foreach from=$memberInfo.fieldData.state.list item=v}
ZIP / Postal Code: - + {if $memberInfo.fieldFail.zip}

{$memberInfo.fieldFail.zip}

{/if}
Country: - {foreach from=$memberInfo.fieldData.country.list item=v} {/foreach} @@ -198,44 +188,117 @@
{else}{/if}Location: - Latitude:
- Longitude:
- (Temporary till we get the auto locate map working) - +
(map loads here)
+ position: Lat {$memberInfo.fieldData.lat}, Lon {$memberInfo.fieldData.lon} +
  +

Other Information

+
Categories + +
Add a new Category
+
+ + + + + + + + + +
Category Name: + +
+
Parent Category: + +
OR
+ +
+

* Required

+ Cancel + +
+ +    Select a category to add to box below.
+
+ {if $categoryMemberInfo} + {foreach from=$categoryMemberInfo item=c} +
+ {if $c.category_parent}{$c.parent_name}: {/if}{$c.category_name} + X + +
+ {/foreach} + {/if} +
+
Region: + + {if $memberInfo.fieldFail.region}

{$memberInfo.fieldFail.region}

{/if}
Phone #: - + {if $memberInfo.fieldFail.phone}

{$memberInfo.fieldFail.phone}

{/if}
Toll Free #: - + {if $memberInfo.fieldFail.toll_free}

{$memberInfo.fieldFail.toll_free}

{/if}
Web Address (URL): - (ex: http://www.gaslightmedia.com) + {if $memberInfo.fieldData.url} + Test Link + {/if} + {if $memberInfo.fieldFail.url}

{$memberInfo.fieldFail.url}

{/if}
Logo: {if $memberInfo.fieldData.logo} - Delete Image
+ + +
+ + Close
+
+ + + + + + + +
+ Delete Image
+ {$memberInfo.fieldData.logo}
+

Show Large Logo Image

+
{/if} {if $memberInfo.fieldFail.logo}

{$memberInfo.fieldFail.logo}

{/if} @@ -253,7 +333,7 @@
Credit Cards Accepted: {foreach from=$memberInfo.fieldData.cc_type.bitmap item=v} - {$v.name}
+ {$v.name}
{/foreach} {if $memberInfo.fieldFail.cc_type}

{$memberInfo.fieldFail.cc_type}

{/if}
Notes: - + {if $memberInfo.fieldFail.notes}

{$memberInfo.fieldFail.notes}

{/if}

* Required

@@ -283,9 +360,10 @@ // Action to select a category $('#categorySelect').change( function() { - // Get the ID and name of the category + // Get the ID, name, and parent of the category var catValue = $('#categorySelect').val(); var catName = $('#categorySelect').find(':selected').text(); + var catParent = $('#categorySelect').find(':selected').attr('data-parent'); // Check if the category has already been added var found = false; @@ -296,11 +374,17 @@ } }); + // Check if there's a parent + parentName = ''; + if (catParent != '') { + parentName = catParent + ': '; + } + // If not found, Add the category if (!found) { $('#activeCategories').append('
' - + catName.trim() + ' X' + + parentName + catName.trim() + ' X' + '
'); } @@ -335,6 +419,7 @@ // Submit new category $('#newCategorySubmit').click( function() { + // Assign new cat number newCat--; @@ -342,27 +427,38 @@ // Get new category information var newCatName = $('#newCatName').val(); var newCatParent = $('#newCatParent').val(); + var catParent = $('#newCatParent').find(':selected').attr('data-parent'); + var newCatParentName = $('#newCatParentName').val(); // If there's no name, tell the user we need one. if (newCatName == '') { - $('#newCatNameTD').addClass('glm-form-bad-input'); $('#newCatNameRequired').text('A catogory name is required!'); return false; } - + + // Check if there's a parent, get the name - new parent name overrides selected parent + parentName = ''; + if (newCatParentName && newCatParentName != '') { + parentName = newCatParentName + ': '; + } else if (catParent && catParent != '') { + parentName = catParent + ': '; + } + // Add the new category to the active categories list $('#activeCategories').append('
' - + newCatName.trim() + ' X' + + parentName + newCatName.trim() + ' X' + '' + '' - + '' + + '' + + '' + '
'); // Clear the dialog input fields $('#newCatName').val(''); - $('#newCatParent').val(''); + $('#newCatParent').val(''); + $('#newCatParentName').val(''); $("#newCategoryDialog").dialog("close"); @@ -411,6 +507,9 @@ return false; } + // Add new city name to the hidden field that will pass the new name to PHP. + $('#cityName').val(newCityName); + // Add new city name to picklist and for storing - Only one permitted per submission if (newCityAdded) { @@ -425,44 +524,144 @@ $('#city').val(-1); $('#newCityNameTD').append(''); newCityAdded = true; - + } // Clear new city name from form $('#newCityName').val(''); $("#newCityDialog").dialog("close"); + + glmGeocode(); + }); - /* - * Map operations + * Large Logo Dialog */ - // Code to kick off the geolocation-edit feature - // requires js/geolocation-edit/jquery.geolocation.edit.min.0.0.11.js -/* - $("#locationMap").geolocate({ - - lat: "#lat", - lng: "#lon", - address: [ - "#addr1", - "#city", - "#zip" - ], - mapOptions: { - disableDefaultUI: false, - mapTypeControl: true, - mapTypeId: "roadmap", - zoom: 16 - }, - markerOptions: { - title: "This is your selected location" - } + // Setup dialog box for showing enlarged logo image + x = $("#largeLogoDialog").dialog({ + autoOpen: false, + resizable: false, + dialogClass: "glm-dialog-no-close" + }); + $('#largeLogoCancel').click( function() { + $("#largeLogoDialog").dialog("close"); + }); + + // Show large logo image - pop-up dialog - resize at time of pop-up + $('#largeLogoButton').click( function() { + $("#largeLogoDialog").dialog("open"); + $( "#largeLogoDialog" ).dialog( "option", "position", { my: "center", at: "center", of: window } ); + var newWidth = $(window).width() * .8; + $( "#largeLogoDialog" ).dialog( "option", "width", newWidth ); + }); + + // Resize whenever window size changes + $(window).resize(function(){ + $( "#largeLogoDialog" ).dialog( "option", "position", { my: "center", at: "center", of: window } ); + var newWidth = $(window).width() * .8; + $( "#largeLogoDialog" ).dialog( "option", "width", newWidth ); + }); + + {if $haveMemberInfo} + // Delete Member Info dialog + $("#deleteMemberInfoDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); + $('#deleteMemberInfoButton').click( function() { + $('#deleteMemberInfoDialog').dialog('open'); + }); + $('#deleteMemberInfoCancel').click( function() { + $("#deleteMemberInfoDialog").dialog("close"); + }); + $('#deleteMemberInfoSubmit').click( function() { + window.location.replace("{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&deleteID={$memberInfo.fieldData.id}"); + }); + {/if} + /* + * Map operations + */ + //show error if location can't be found + function showError() { + alert("Location can't be found"); + } + + /* + * Google Maps + * API reference: https://developers.google.com/maps/documentation/javascript/reference + */ + + // Set default - Need to make this configurable + var location = new google.maps.LatLng(45, -85) + var map = new google.maps.Map(document.getElementById('locationMap'), { + zoom: 14, + disableDefaultUI: false, + mapTypeId: google.maps.MapTypeId.MAP, + }); + var geocoder = new google.maps.Geocoder(); + var marker = new google.maps.Marker({ + map: map, + position: location, + draggable: true, + animation: google.maps.Animation.DROP, + title: "This is your location" + }); + map.setCenter(location); + + // Listen for an end of drag event for the map marker + google.maps.event.addListener(marker,'dragend',function(event) { + + // Get the end postion + glmLat = this.position.lat(); + glmLng = this.position.lng(); + + // Assign it to the hidden fields for submission + $('#glmLat').val(glmLat); + $('#glmLng').val(glmLng); + + // Also display it to the user + $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4)); + }); + + // Resubmit geocoding when address changes + function glmGeocode() { + + // Get all address parts + var geoAddr1 = $('#addr1').val().trim(); + var geoAddr2 = $('#addr2').val().trim(); + var geoCity = $('#city').find('option:selected').text().trim(); + var geoState = $('#state').find('option:selected').text().trim(); + var geoZIP = $('#zip').val().trim(); + var geoCountry = $('#country').find('option:selected').text().trim(); + + // Assemble address string for + var geoAddress = '{$member.name}' + ', ' + geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry; + + // Send to Google Geocoder + geocoder.geocode( { 'address': geoAddress }, function(results, status) { + + // If we have a geocode solution + if (status == google.maps.GeocoderStatus.OK) { + map.setCenter(results[0].geometry.location); + marker.setPosition( results[0].geometry.location ); + + // Otherwise tell the user. + } else { +alert(status + ' - ' + geoAddress); + $('#mapPosition').html('Not able to estimate position from the above address.'); + } + }); + } + + $('.glm-geocodeAction').change( function() { + glmGeocode(); }); - */ + }); diff --git a/views/admin/members/index.html b/views/admin/members/index.html index 63a290dd..20bed3c4 100644 --- a/views/admin/members/index.html +++ b/views/admin/members/index.html @@ -30,7 +30,7 @@ {if $numbMembers == 0} You do not have any members listed. - Click here to create your first member. + Click here to create your first member. {/if} diff --git a/views/admin/members/list.html b/views/admin/members/list.html index 8f962997..87f02446 100644 --- a/views/admin/members/list.html +++ b/views/admin/members/list.html @@ -2,8 +2,8 @@
List Filters:   - Pending - Search + Has Pending Information   + Search

List of Members

@@ -15,6 +15,7 @@ Member Name Member Type Date Created + Pending   @@ -39,6 +40,9 @@ {$m.created.date} + + {if $m.pending > 0}Pending{/if} + Manage