'use' => 'a'
),
+ // County
+ 'county' => array (
+ 'field' => 'county',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
// State
'state' => array (
'field' => 'state',
'ref_dest' => $savedFields['ref_dest'],
'ref_dest_name' => $savedFields['ref_dest_name'],
'city' => $savedFields['city'],
- 'state' => $savedFields['state']
+ 'state' => $savedFields['state'],
+ 'county' => $savedFields['county']
);
$contacts = $this->getList($where, $order, $fieldVals, $idField, $start, $limit);
--- /dev/null
+#glmContactsSearchContainer,
+#glmContactsCountySearchContainer {
+ max-width: 300px;
+ padding: 10px;
+}
+@media (max-width: 1023px) {
+ #glmContactsSearchSubmit,
+ #glmContactsSearchContainer,
+ #glmContactsCountySearchContainer {
+ clear: both;
+ margin: 0 auto;
+ text-align: center;
+ }
+}
+@media (min-width: 1024px) {
+ #glmContactsSearchSubmit,
+ #glmContactsSearchContainer,
+ #glmContactsCountySearchContainer {
+ float: left;
+ }
+ #glmContactsSearchSubmit {
+ margin-top: 30px;
+ }
+}
\ No newline at end of file
if (trim($host) == '') {
$host = 'PRODUCTION';
}
-define('GLM_MEMBER_CONTACTS_PLUGIN_HOST', $host);
+define('GLM_MEMBERS_CONTACTS_PLUGIN_HOST', $host);
// Determine current http/https protocol
$pageProtocol = 'http';
* Plugin Name: GLM Members Database Contacts
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 1.0.15
+ * Version: 1.0.16
* Author: Gaslight Media
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
* @package glmMembersDatabaseContacts
* @author Gaslight Media <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.15
+ * @version 1.0.16
*/
/*
* version when there's a change in the database!! Use the
* version nunmber of that release for the DB version.
*/
-define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.15');
-define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.2');
+define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.16');
+define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.3');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58');
echo '
<div class="error">
<p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
- .GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.' but the current verssion is '.$curVer.'!</p>
+ .GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.' but the current version is '.$curVer.'!</p>
<p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' plugin has been de-activated.</p>
</div>
';
* Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded.
*/
require_once GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/validActions.php';
+require_once GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/shortcodes.php';
require_once GLM_MEMBERS_CONTACTS_PLUGIN_DB_SCRIPTS.'/dbVersions.php';
function glmMembersRegisterContacts($addOns) {
'dbActiveVersionOption' => GLM_MEMBERS_CONTACTS_PLUGIN_ACTIVE_DB_OPTION,
'dbScriptPath' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_SCRIPTS,
'dbVersions' => $GLOBALS['glmMembersContactsDbVersions']
- )
+ ),
+ 'shortcodes' => $GLOBALS['glmMembersContactsShortcodes'],
+ 'shortcodesDescription' => $GLOBALS['glmMembersContactsShortcodesDescription']
);
// Return the array with our data added
}
// If we're coming from the Member Contacts Menu/Tab
- if (defined('GLM_CONTACTS_MEMBER_MENU')) {
+ if (defined('GLM_MEMBERS_CONTACTS_MEMBER_MENU')) {
$fromMemberMenu = true;
// If we don't have a member, the get a list of member IDs for selection
if (!$haveMember) {
- $membersList = $this->Members->geSimpleMemberstList('TRUE', 'name');
+ $membersList = $this->Members->getSimpleMembersList('TRUE', 'name');
}
$view = 'edit.html';
$wpUser = new WP_User($contactCheck['wpUserEmail']->ID);
$wpUserID = $wpUser->ID;
- $contactMembersListd = '';
+ $contactMembersList = '';
// If we have a valid WordPress user ID
if ($wpUserID) {
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Contacts Database
+ * Admin List Contacts
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmContactsDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Contacts data abstract
+require_once GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php';
+
+/*
+ * This class performs the work for the default action of the "Contacts" menu
+ * option, which is to display the contacts dashboard.
+ *
+ */
+class GlmContactsAdmin_contacts_list extends GlmDataContacts
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ /*
+ * Run constructor for contacts data class to setup table and fields array
+ *
+ * Since this class is extending GlmDataContacts, it does not need to pass
+ * $wpdb and $config to it in the constructor.
+ */
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $where = ' true ';
+ $filterPending = false;
+ $filterArchived = false;
+ $filterFeatured = false;
+ $haveFilter = false;
+ $numbDisplayed = false;
+ $lastDisplayed = false;
+ $paging = true;
+ $prevStart = false;
+ $nextStart = false;
+ $start = 1;
+ $limit = 20; // Set to the number of listings per page
+ $namesList = false;
+ $enable_contacts = $this->config['settings']['enable_contacts'];
+
+ // Check if this is a request to show archived contacts
+ if (isset($_REQUEST['filterArchived'])) {
+ $where .= " AND access = ".$this->config['access_numb']['Archived'];
+ $filterArchived = true;
+ $haveFilter = true;
+
+ // If not, don't show them
+ } else {
+ $where .= " AND access != ".$this->config['access_numb']['Archived'];
+ }
+
+ // Check for a text search
+ if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search']) != '') {
+
+ $textSearch = addslashes(filter_input(INPUT_POST, 'text_search', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
+ $where .= " AND T.id in (
+ SELECT DISTINCT(contact)
+ FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX."contact_info
+ WHERE contact_name like '%$textSearch%'
+ )";
+ }
+
+
+ // Get count of contacts listed
+ $contactCount = $this->getStats($where);
+
+ // If the number of contacts is less than a page, don't do paging
+ if ($contactCount <= $limit) {
+ $paging = false;
+ }
+
+ // Get full list of names matching this where clause for search box
+ $namesList = $this->getIdName($where);
+
+ // Check if we're doing paging
+ if (isset($_REQUEST['pageSelect'])) {
+
+ // If request is for Next
+ if ($_REQUEST['pageSelect'][0] == 'N') {
+ $newStart = $_REQUEST['nextStart'] - 0;
+
+ // Otherwise it must be Previous
+ } else {
+ $newStart = $_REQUEST['prevStart'] - 0;
+ }
+
+ if ($newStart > 0) {
+ $start = $newStart;
+ }
+ }
+
+ // Get a current list of contacts
+ $listResult = $this->getSimpleMembersList($where, 'name', true, 'id', $start, $limit);
+
+ // Get paging results
+ $numbDisplayed = $listResult['returned'];
+ $lastDisplayed = $listResult['last'];
+ if ($start == 1) {
+ $prevStart = false;
+ } else {
+ $prevStart = $start - $limit;
+ if ($start < 1) {
+ $start = 1;
+ }
+ }
+ if ($listResult['returned'] == $limit) {
+ $nextStart = $start + $limit;
+ }
+
+ if (GLM_MEMBERS_CONTACTS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmContactsAdmin::addNotice($list, 'DataBlock', 'Contact Data');
+ }
+
+ // since we're doing paging, we have to break out just the contact data
+ $list = $listResult['list'];
+ unset($listResult);
+
+ // If we have list entries - even if it's an empty list
+ $success = true;
+ $haveContacts = false;
+ if ($list !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($list) > 0) {
+ $haveContacts = true;
+ }
+ }
+
+ // Determine if current user can add, edit, delete contact data
+// $canEdit = current_user_can('glm_contacts_edit');
+
+ // Add a url for each contact
+ foreach ($list as $contact) {
+ $list[$contact['id']]['contact_slug'] = sanitize_title($contact['name']);
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'enable_contacts' => $enable_contacts,
+ 'haveContacts' => $haveContacts,
+ 'contacts' => $list,
+ 'contactCount' => $contactCount,
+ 'haveFilter' => $haveFilter,
+ 'filterArchived' => $filterArchived,
+ 'filterFeatured' => $filterFeatured,
+ 'filterPending' => $filterPending,
+ 'numbDisplayed' => $numbDisplayed,
+ 'lastDisplayed' => $lastDisplayed,
+ 'paging' => $paging,
+ 'prevStart' => $prevStart,
+ 'nextStart' => $nextStart,
+ 'start' => $start,
+ 'limit' => $limit,
+ 'namesList' => $namesList
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/contacts/list.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
+
+?>
*/
// Inform the contacts code that we're working from the member area
-define('GLM_CONTACTS_MEMBER_MENU', true);
+define('GLM_MEMBERS_CONTACTS_MEMBER_MENU', true);
// Load the events index
require GLM_MEMBERS_CONTACTS_PLUGIN_PATH."/models/admin/contacts/index.php";
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Contacts Database
+ * Front List Contacts
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmContactsDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Translation table for [glm-contacts-list] "show" options to configuration parameters
+$GLOBALS['showOpts'] = array(
+
+);
+
+// Load Contacts data abstract
+require_once GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php';
+
+/*
+ * This class performs the work for the default action of the "Contacts" menu
+ * option, which is to display the contacts dashboard.
+ *
+ */
+class GlmMembersFront_contacts_list extends GlmDataContacts
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for contacts data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This method does the work for this model and returns any resulting data
+ *
+ * @return array Status and data array
+ *
+ * 'status'
+ *
+ * True if successful and false if there was a fatal failure.
+ *
+ * 'menuItemRedirect'
+ *
+ * If not false, provides a menu item the controller should
+ * execute after this one. Normally if this is used, there would also be a
+ * modelRedirect value supplied as well.
+ *
+ * 'modelRedirect'
+ *
+ * If not false, provides an action the controller should execute after
+ * this one.
+ *
+ * 'view'
+ *
+ * A suggested view name that the controller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $view = 'index.html';
+ $option = 'list';
+ $fromMemberMenu = false;
+ $loggedInMember = false;
+ $refType = false;
+ $refTypeName = false;
+ $haveMember = false;
+ $this->memberID = false;
+ $memberData = false;
+ $memberName = false;
+ $membersList = false;
+ $contactsList = false;
+ $haveContacts = false;
+ $contactID = false;
+ $contactInfo = false;
+ $newContactEmailExists = false;
+ $newContactUsernameExists = false;
+ $misMatchedWpUsers = false;
+ $newContactCreated = false;
+ $usingExistingWPContact = false;
+ $usernameChangedToWP = false;
+ $contactUpdated = false;
+ $filterArchived = false;
+ $filterText = false;
+ $countySearch = false;
+ $countyList = array();
+ $haveFilter = false;
+ $userDeleted = false;
+ $wpUserDeleted = false;
+ $contactMembers = array();
+
+ $numbContacts = false;
+ $numbDisplayed = false;
+ $lastDisplayed = false;
+ $paging = true;
+ $prevStart = false;
+ $nextStart = false;
+ $start = 1;
+ $limit = 20; // Set to the number of listings per page
+ $namesList = false;
+
+ $where = '';
+
+ $validOptions = array(
+ 'create',
+ 'addNew',
+ 'edit',
+ 'submit',
+ 'delete',
+ 'list'
+ );
+
+ // If this is a logged in member user, then show their contacts only
+ if (isset($this->config['loggedInUser']['contactUser'])) {
+
+ // if there's logged in contact user
+ $contactUser = $this->config['loggedInUser']['contactUser'];
+ if ($contactUser['ref_type'] = $this->config['ref_type_numb']['Member']
+ && $contactUser['ref_dest'] ) {
+
+ $loggedInMember = true;
+
+ // Filter all contact searches to their member contacts
+ $where .= " AND ref_type = ".$this->config['ref_type_numb']['Member']."
+ AND ref_dest = ".$contactUser['ref_dest'];
+
+ // Also set their member as the current one
+ $this->memberID = $contactUser['ref_dest'];
+ }
+
+ }
+
+ // If we're coming from the Member Contacts Menu/Tab
+ if (defined('GLM_MEMBERS_CONTACTS_MEMBER_MENU')) {
+
+ $fromMemberMenu = true;
+
+ // Check if we've received member ID
+ if (isset($_REQUEST['member'])) {
+
+ // Clean up the member ID and store it in wordpress option
+ $this->memberID = $_REQUEST['member']-0;
+ update_option('glmMembersDatabaseMemberID', $this->memberID);
+
+ // Otherwise check if a member is stored in wordpress option
+ } else {
+ $this->memberID = get_option('glmMembersDatabaseMemberID', false);
+ }
+
+ }
+
+ // Load members data class
+ require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php';
+ $this->Members = new GlmDataMembers($this->wpdb, $this->config);
+
+ // If we have a member ID - Get Member information
+ if ($this->memberID) {
+ $memberData = $this->Members->getEntry($this->memberID);
+ }
+
+ // Check that we have good member data
+ if (is_array($memberData) && isset($memberData['id']) && $memberData['id'] > 0) {
+ $haveMember = true;
+ $memberName = $memberData['name'];
+ }
+
+ // Make sure option is set to list
+ $option = 'list';
+
+ $where = ' TRUE ';
+
+ // Only list member contacts for the selected member
+ if ($haveMember) {
+ $where .= " AND ref_type = ".$this->config['ref_type_numb']['Member'].' AND ref_dest = '.$this->memberID;
+ }
+
+ // Filter by selected county
+ if (isset($_REQUEST['countySearch'])) {
+ $countySearch = esc_sql($_REQUEST['countySearch']);
+ $where .= " AND (
+ county LIKE '%$countySearch%'
+ )";
+ $haveFilter = true;
+ }
+
+ // Filter by text string supplied
+ if (isset($_REQUEST['filterText'])) {
+ $filterText = esc_sql($_REQUEST['filterText']);
+ $where .= " AND (
+ lname LIKE '%$filterText%' OR
+ fname LIKE '%$filterText%' OR
+ org LIKE '%$filterText%' OR
+ descr LIKE '%$filterText%' OR
+ county LIKE '%$filterText%' OR
+ ref_dest IN (SELECT id FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members WHERE name LIKE '%$filterText%')
+ )";
+ $haveFilter = true;
+ }
+
+ // Get the total number of contacts listed
+ $numbContacts = $this->getStats($where);
+
+ // If the number of events is less than a page, don't do paging
+ if ($numbContacts <= $limit) {
+ $paging = false;
+ }
+
+ // Get full list of names matching this where clause for search box
+ $namesList = $this->getIdName($where);
+
+ // Check if we're doing paging
+ if (isset($_REQUEST['pageSelect'])) {
+
+ // If request is for Next
+ if ($_REQUEST['pageSelect'][0] == 'N') {
+ $newStart = $_REQUEST['nextStart'] - 0;
+
+ // Otherwise it must be Previous
+ } else {
+ $newStart = $_REQUEST['prevStart'] - 0;
+ }
+
+ if ($newStart > 0) {
+ $start = $newStart;
+ }
+ }
+
+ // Get list of contacts
+ $contactsList = $this->getList($where);
+
+ if ($contactsList != false) {
+ if ($paging) {
+ //Get paging results
+ $numbDisplayed = $contactsList['returned'];
+ $lastDisplayed = $contactsList['last'];
+ if ($start == 1) {
+ $prevStart = false;
+ } else {
+ $prevStart = $start - $limit;
+ if ($start < 1) {
+ $start = 1;
+ }
+ }
+ if ($contactsList['returned'] == $limit) {
+ $nextStart = $start + $limit;
+ }
+
+ }
+ if (count($contactsList) > 0) {
+ $haveContacts = true;
+ }
+ }
+
+ // Get a list of counties
+ $countyList = $this->wpdb->get_col("SELECT DISTINCT county FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts WHERE active = true;");
+//
+//
+//
+// $r = array(
+// 'contactRole' => $contactRole,
+// 'wpRole' => $this->config['contact_role_wordpress'][$contactRole]
+// );
+//
+// return $r;
+
+
+ // If the option is "edit" don't let lower-level users assign privileges above the user's pay grade
+ if (($option == 'edit' || $option == 'create') && $this->config['loggedInUser']['contactUser']) {
+
+ // If this is an Entity Manager or lower user, then remove the "MembersManger" role selection
+ if ($this->config['loggedInUser']['contactUser']['role'] >= $this->config['contact_role_numb']['EntityManager']) {
+ unset($contactInfo['fieldData']['contact_role']['list'][$this->config['contact_role_numb']['MembersManager']]);
+ }
+
+ }
+
+
+ //echo "<pre>" . print_r($countyList, true) . "</pre>";
+
+ // Compile template data
+ $templateData = array(
+ 'option' => $option,
+ 'loggedInMember' => $loggedInMember,
+ 'fromMemberMenu' => $fromMemberMenu,
+ 'haveMember' => $haveMember,
+ 'memberID' => $this->memberID,
+ 'memberData' => $memberData,
+ 'memberName' => $memberName,
+ 'membersList' => $membersList,
+ 'refType' => $refType,
+ 'refTypeName' => $refTypeName,
+ 'haveContacts' => $haveContacts,
+ 'contactsList' => $contactsList,
+ 'numbContacts' => $numbContacts,
+ 'contactID' => $contactID,
+ 'contactInfo' => $contactInfo,
+ 'newContactEmailExists' => $newContactEmailExists,
+ 'newContactUsernameExists' => $newContactUsernameExists,
+ 'misMatchedWpUsers' => $misMatchedWpUsers,
+ 'usernameChangedToWP' => $usernameChangedToWP,
+ 'newContactCreated' => $newContactCreated,
+ 'usingExistingWPContact' => $usingExistingWPContact,
+ 'contactUpdated' => $contactUpdated,
+ 'filterArchived' => $filterArchived,
+ 'filterText' => $filterText,
+ 'countyList' => $countyList,
+ 'countySearch' => $countySearch,
+ 'haveFilter' => $haveFilter,
+ 'userDeleted' => $userDeleted,
+ 'wpUserDeleted' => $wpUserDeleted,
+ 'contactMembers' => $contactMembers,
+
+ 'numbDisplayed' => $numbDisplayed,
+ 'lastDisplayed' => $lastDisplayed,
+ 'paging' => $paging,
+ 'prevStart' => $prevStart,
+ 'nextStart' => $nextStart,
+ 'start' => $start = 1,
+ 'limit' => $limit,
+ 'namesList' => $namesList,
+ 'EntityManagerRole' => $this->config['contact_role_numb']['EntityManager']
+
+ );
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'front/contacts/list.html',
+ 'data' => $templateData
+ );
+
+ }
+
+ /*
+ * Check for new Cities being submitted
+ *
+ * @return void
+ */
+ public function checkNewCities($contactID)
+ {
+
+ // If we have a contact ID and this was a submission with a new city (id < 0)
+ if ($contactID && 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 contact record
+ $sql = "
+ UPDATE ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX."contacts
+ SET city = $cID
+ WHERE id = ".$contactID."
+ ;";
+ $this->wpdb->query($sql);
+
+ // Update submitted city value to use the new ID
+ $_REQUEST['city'] = $cID;
+
+ }
+ }
+ }
+
+ /*
+ * Check for additional Members this contact can access
+ *
+ * @param $contactInfo array Contact information array
+ * @param $memberID integer ID of contact's member
+ *
+ * @return array Array of Member IDs with names
+ */
+ public function checkContactMembers($contactInfo, $update = false)
+ {
+
+ // Attempt to get WordPress user data
+ $contactCheck = $this->checkContact($contactInfo['fieldData']['email']);
+ $wpUser = new WP_User($contactCheck['wpUserEmail']->ID);
+ $wpUserID = $wpUser->ID;
+
+ $contactMembersListd = '';
+
+ // If we have a valid WordPress user ID
+ if ($wpUserID) {
+
+ // If there's an update request and the current user can manage members
+ if (apply_filters('glm_members_menu_members', $update)) {
+
+ // And if there's contact member data
+ if ($_REQUEST['contactMembers'] && count($_REQUEST['contactMembers'])) {
+
+ // Update the contact members selection
+ $contactMembersList = implode(',', $_REQUEST['contactMembers']);
+ }
+
+ } else {
+
+ // Get contact's list of members they can manage
+ $contactMembersList = get_user_meta($wpUserID, 'glmMembersContactMembers', true);
+
+ }
+
+ }
+
+ // Always add the user's primary member to the list
+ if ($contactMembersList != '') {
+ $contactMembersList .= ',';
+ }
+ $contactMembersList .= $this->memberID; // Always include contact's main member
+
+ // Store the list of ID's for members this user can access in user meta data
+ update_user_meta($wpUserID, 'glmMembersContactMembers', $contactMembersList);
+
+ // Get a list of contact members with names and other basic info from the list of ids
+ $contactMembers = $this->Members->getIdName("ID in (".$contactMembersList.")");
+
+ // Get currently selected member, if not set yet set it to their primary member
+ $currentContactMember = get_user_meta($wpUserID, 'glmMembersContactMemberSelected', true);
+ if (empty($currentContactMember)) {
+ update_user_meta($wpUserID, 'glmMembersContactMemberSelected', $this->memberID);
+ }
+
+ // Set currently selected member as active
+ if (isset($contactMembers[$currentContactMember])) {
+ $contactMembers[$currentContactMember]['selected'] = true;
+ }
+
+ return $contactMembers;
+
+ }
+}
+
+?>
--- /dev/null
+The front controller executes models under this directory.
+
+Typically you should add a directory here that matches the category of actions that will take place.
+
+Under that directory place the model for the various actions.
+
+Actions under this directory would normally be called due to processing of a shortcode.
\ No newline at end of file
+++ /dev/null
--- Gaslight Media Members Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.0.2
--- Database Creation Script - Contacts Add-On
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
---
-
--- Contacts - used by various entities
-CREATE TABLE {prefix}contacts (
- id INT NOT NULL AUTO_INCREMENT,
- active BOOLEAN NULL, -- Contact is active flag
- access INT NULL, -- Access type - See access table in plugin.ini
- primary_contact BOOLEAN NULL, -- Contact is the "Primary Contact" for mailings to entity (ref_type/ref_dest)
- fname TINYTEXT NULL, -- First name of contact
- lname TINYTEXT NULL, -- Last name of contact
- contact_type INT NULL, -- Contact type - see contact_type table (individual, role, ...)
- contact_role INT NULL, -- Contact WordPress user Role
- org TINYTEXT NULL, -- Organization name
- title TINYTEXT NULL, -- Title/Position
- descr TEXT NULL, -- Description of position/responsibilities - Displayed
- image TINYTEXT NULL, -- Image
- addr1 TINYTEXT NULL, -- Address line 1 - Address is for contact, not necessarily for organization
- addr2 TINYTEXT NULL, -- Address line 2
- city INT NULL, -- Pointer to city in cities table
- state TINYTEXT NULL, -- Two character state code - matches states.ini entries
- country TINYTEXT NULL, -- Two character country code - matches countries.ini entries
- zip TINYTEXT NULL, -- ZIP/Postal Code
- lat FLOAT NULL, -- Latitude of contact location
- lon FLOAT NULL, -- Longitude of contact location
- url TINYTEXT NULL, -- URL to information regarding this contact
- office_phone TINYTEXT NULL, -- Office phone number
- home_phone TINYTEXT NULL, -- Home phone number - or after-hours phone number
- mobile_phone TINYTEXT NULL, -- Mobile phone number
- alt_phone TINYTEXT NULL, -- An alternate phone number
- fax TINYTEXT NULL, -- FAX number (do people still use these?)
- email TINYTEXT NULL, -- E-Mail address
- alt_email TINYTEXT NULL, -- Alternate E-Mail address - Also used to log-in
- username TINYTEXT NULL, -- Optional username to use for login
- password TINYTEXT NULL, -- Encrypted password
- notes TEXT NULL, -- Notes - Not displayed on front-end
- create_time TIMESTAMP NULL, -- Create date/time
- modify_time TIMESTAMP NULL, -- Last modified date/time
- ref_type INT NULL, -- Type of entity this contact is associated with
- ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with
- PRIMARY KEY (id),
- INDEX(fname(20)),
- INDEX(lname(20)),
- INDEX(city),
- INDEX(zip(10)),
- INDEX(lat),
- INDEX(lon),
- INDEX(email(20))
-);
--- /dev/null
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.3
+-- Database Creation Script - Contacts Add-On
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+--
+
+-- Contacts - used by various entities
+CREATE TABLE {prefix}contacts (
+ id INT NOT NULL AUTO_INCREMENT,
+ active BOOLEAN NULL, -- Contact is active flag
+ access INT NULL, -- Access type - See access table in plugin.ini
+ primary_contact BOOLEAN NULL, -- Contact is the "Primary Contact" for mailings to entity (ref_type/ref_dest)
+ fname TINYTEXT NULL, -- First name of contact
+ lname TINYTEXT NULL, -- Last name of contact
+ contact_type INT NULL, -- Contact type - see contact_type table (individual, role, ...)
+ contact_role INT NULL, -- Contact WordPress user Role
+ org TINYTEXT NULL, -- Organization name
+ title TINYTEXT NULL, -- Title/Position
+ descr TEXT NULL, -- Description of position/responsibilities - Displayed
+ image TINYTEXT NULL, -- Image
+ addr1 TINYTEXT NULL, -- Address line 1 - Address is for contact, not necessarily for organization
+ addr2 TINYTEXT NULL, -- Address line 2
+ county TINYTEXT NULL, -- County
+ city INT NULL, -- Pointer to city in cities table
+ state TINYTEXT NULL, -- Two character state code - matches states.ini entries
+ country TINYTEXT NULL, -- Two character country code - matches countries.ini entries
+ zip TINYTEXT NULL, -- ZIP/Postal Code
+ lat FLOAT NULL, -- Latitude of contact location
+ lon FLOAT NULL, -- Longitude of contact location
+ url TINYTEXT NULL, -- URL to information regarding this contact
+ office_phone TINYTEXT NULL, -- Office phone number
+ home_phone TINYTEXT NULL, -- Home phone number - or after-hours phone number
+ mobile_phone TINYTEXT NULL, -- Mobile phone number
+ alt_phone TINYTEXT NULL, -- An alternate phone number
+ fax TINYTEXT NULL, -- FAX number (do people still use these?)
+ email TINYTEXT NULL, -- E-Mail address
+ alt_email TINYTEXT NULL, -- Alternate E-Mail address - Also used to log-in
+ username TINYTEXT NULL, -- Optional username to use for login
+ password TINYTEXT NULL, -- Encrypted password
+ notes TEXT NULL, -- Notes - Not displayed on front-end
+ create_time TIMESTAMP NULL, -- Create date/time
+ modify_time TIMESTAMP NULL, -- Last modified date/time
+ ref_type INT NULL, -- Type of entity this contact is associated with
+ ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with
+ PRIMARY KEY (id),
+ INDEX(fname(20)),
+ INDEX(lname(20)),
+ INDEX(city),
+ INDEX(zip(10)),
+ INDEX(lat),
+ INDEX(lon),
+ INDEX(email(20))
+);
*/
$glmMembersContactsDbVersions = array(
'0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '4/15/2016'),
- '0.0.2' => array('version' => '0.0.2', 'tables' => 1, 'date' => '7/25/2016')
+ '0.0.2' => array('version' => '0.0.2', 'tables' => 1, 'date' => '7/25/2016'),
+ '0.0.3' => array('version' => '0.0.3', 'tables' => 1, 'date' => '1/11/2017')
);
+++ /dev/null
--- Gaslight Media Contacts Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.0.2
--- Database Deletion Script
--- Note: Tables with DELETE CASCADE must appear before referenced table
-
-DROP TABLE IF EXISTS
- {prefix}contacts
-;
-
--- /dev/null
+-- Gaslight Media Contacts Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.2
+-- Database Deletion Script
+-- Note: Tables with DELETE CASCADE must appear before referenced table
+
+DROP TABLE IF EXISTS
+ {prefix}contacts
+;
+
-- Gaslight Media Members Database - Contacts Add-On
-- File Created: 12/09/14 15:27:15
--- Database Version: 0.0.2
+-- Database Version: 0.0.3
-- Database Update From Previous Version Script
--
-- To permit each query below to be executed separately,
-- all queries must be separated by a line with four dashses
-- Add primary_contact field
-ALTER TABLE {prefix}contacts ADD COLUMN primary_contact BOOLEAN;
-
-----
-
--- Update primary_contacts to default all current entries to false
-UPDATE {prefix}contacts SET primary_contact = false;
-
-
-
-
-
+ALTER TABLE {prefix}contacts ADD COLUMN county TINYTEXT;
--- /dev/null
+-- Gaslight Media Members Database - Contacts Add-On
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.3
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+-- Add primary_contact field
+ALTER TABLE {prefix}contacts ADD COLUMN primary_contact BOOLEAN;
+
+----
+
+-- Update primary_contacts to default all current entries to false
+UPDATE {prefix}contacts SET primary_contact = false;
+
+
+
+
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Contacts Add-On Misc Hooks and Filters
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release frontHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Misc Hooks and Filters here. If this file exists, it will be included
+ * by the add-on main plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ * add_filter( 'filter_title', function( $parameter ) {
+ * // Function code
+ * });
+ *
+ * *** Also note that parameters will be in the context of the main front controller constructor. ***
+ */
+
+// Add contactslug query var
+add_filter('query_vars', function($vars) {
+ array_push($vars, 'contactslug');
+ return $vars;
+});
+
+if (isset($this->config['addOns']['glm-member-db'])) {
+
+// // Add content to member listing page - Get it from the existing package listing shortcode
+// add_filter('glm-member-db-front-members-list-memberDataBelow', function($content, $id) {
+// $contactData = do_shortcode('[glm-members-contact-list member='.$id.' template="member-list" order="title"]');
+// $content .= $contactData;
+// return $content;
+// },
+// 10,
+// 2
+// );
+
+ // Add internal page content links to member detail page
+// add_filter('glm-member-db-front-members-detail-linksBottom', function($content, $id) {
+// $contactData = do_shortcode('[glm-members-contact-list member='.$id.', template="contacts-link" order="title"]');
+// $content .= $contactData;
+// return $content;
+// },
+// 10,
+// 2
+// );
+
+ // Add content to member detail page - Get it from the existing package listing shortcode
+// add_filter('glm-member-db-front-members-detail-descriptionAfter', function($content, $id) {
+// $contactData = do_shortcode('[glm-members-contact-list member='.$id.', template="member-detail" order="title"]');
+// $content .= $contactData;
+// return $content;
+// },
+// 10,
+// 2
+// );
+//
+// add_filter('glm-member-db-front-members-detail-sidemenuBottom', function($content, $id) {
+// $contactData = do_shortcode('[glm-members-contact-list member='.$id.', template="detail-sidemenu" order="title"]');
+// $content .= $contactData;
+// return $content;
+// },
+// 10,
+// 2
+// );
+
+}
+
+add_filter( 'glm-member-db-contacts-get-contact-data', function( $contact_id ){
+ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataContacts.php';
+ $contactData = new GlmDataContacts( $this->wpdb, $this->config );
+ $contacts = $contactData->getEntry( $contact_id );
+ return $contacts;
+} );
+
<td>glm_members_permit_admin_member_contacts_tab</td>
<td>Filter</td>
<td></td>
- <td>
- Hook to test if the logged in user is permitted to see the member Contacts tab.
- </td>
+ <td>Hook to test if the logged in user is permitted to see the member Contacts tab.</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_contacts_add_contact</td>
<td>Filter</td>
<td></td>
- <td>
- Hook to test if the logged in user is permitted to add a new contact.
- </td>
+ <td>Hook to test if the logged in user is permitted to add a new contact.</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_contacts_view_contact</td>
<td>Filter</td>
<td></td>
- <td>
- Hook to test if the logged in user is permitted to view a contact.
- </td>
+ <td>Hook to test if the logged in user is permitted to view a contact.</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_contacts_edit_contact</td>
<td>Filter</td>
<td></td>
- <td>
- Hook to test if the logged in user is permitted to edit a contact.
- </td>
+ <td>Hook to test if the logged in user is permitted to edit a contact.</td>
</tr>
<tr>
<td>glm_members_current_logged_in_user</td>
<td>Filter</td>
<td></td>
- <td>
- Filter that returns the current WordPress user data along with any
+ <td>Filter that returns the current WordPress user data along with any
current Member Contact user information. The information returned
is listed below
<pre>Array
<td>glm_members_locked_to_member_id</td>
<td>Filter</td>
<td></td>
- <td>
- Filter that provides the member ID of any member the current user is locked into.
- </td>
+ <td>Filter that provides the member ID of any member the current user is locked into.</td>
</tr>
<tr>
<td>glm_members_menu_members</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Can current user access any member?"
- </td>
+ <td>Returns boolean answer to "Can current user access any member?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_members_index_member_config_warning</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should we display configuration warnings to current user?"
- </td>
+ <td>Returns boolean answer to "Should we display configuration warnings to current user?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_members_index_add_member</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Can current user edit any member?"
- </td>
+ <td>Returns boolean answer to "Can current user edit any member?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_index_add_member_info_version</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see the member information display and add-new links/buttons?"
- </td>
+ <td>Returns boolean answer to "Should current user see the member information display and add-new links/buttons?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_index_edit_member</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see the member edit page?" (if not, then just show the info)
- </td>
+ <td>Returns boolean answer to "Should current user see the member edit page?" (if not, then just show the info)</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_index_view_member_info_version</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see link to view/edit member information?"
- </td>
+ <td>Returns boolean answer to "Should current user see link to view/edit member information?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_index_clone_activate_info_version</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see Clone and Activate buttons for member information?"
- </td>
+ <td>Returns boolean answer to "Should current user see Clone and Activate buttons for member information?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_contacts_tab</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see the Contacts tab?"
- </td>
+ <td>Returns boolean answer to "Should current user see the Contacts tab?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_contacts_add_contact</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user be able to add contacts?"
- </td>
+ <td>Returns boolean answer to "Should current user be able to add contacts?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_contacts_view_contact</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user be able to view contact data?"
- </td>
+ <td>Returns boolean answer to "Should current user be able to view contact data?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_contacts_edit_contact</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user be able to edit contact data?"
- </td>
+ <td>Returns boolean answer to "Should current user be able to edit contact data?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_widget_members</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see the member search and member list in dashboard widget?"
- </td>
+ <td>Returns boolean answer to "Should current user see the member search and member list in dashboard widget?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_widget_warnings</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see warnings in dashboard widget?"
- </td>
+ <td>Returns boolean answer to "Should current user see warnings in dashboard widget?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_widget_pending_info</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see pending member information list in dashboard widget?"
- </td>
+ <td>Returns boolean answer to "Should current user see pending member information list in dashboard widget?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_index_list_inactive_info</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user see inactive member information records in member info list?"
- </td>
+ <td>Returns boolean answer to "Should current user see inactive member information records in member info list?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_member_info_edit</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user be able to edit member information records?"
- </td>
+ <td>Returns boolean answer to "Should current user be able to edit member information records?"</td>
</tr>
<tr>
<td>glm_members_permit_admin_profile_index_edit_profile</td>
<td>Filter</td>
<td></td>
- <td>
- Returns boolean answer to "Should current user be able to edit own contact profile?"
- </td>
+ <td>Returns boolean answer to "Should current user be able to edit own contact profile?"</td>
</tr>
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Contacts Add-On Short Codes
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release shortcodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/**
+ * Array of short-code
+ *
+ * This array lists all of the short-codes available from the main
+ * member plugin and all add-ons that provide short-code features.
+ *
+ * This array is merged with the data from any registered add-ons
+ * providing short-code features. The plugin providing the short-code
+ * is designated in the 'plugin' elemeent.
+ *
+ * A shortcode is unique to a particular plugin. To provide additional
+ * data and features to a short-code, an add-on should use filters
+ * provided by the short-code to insert data into the template array,
+ * to insert additional format into the template, or to insert
+ * text directly into the completed template output.
+ *
+ * The "attributes" array is a list of available attributes for this
+ * shortcode and their default values. If a database table is provided,
+ * then the value for each attribute is a table column where we get
+ * the default value. If no table is provided, then the value for
+ * each attribute is the actual default value for that attribute.
+ * In the case that the data is taken from the database table, the
+ * "id" for the table entry where the data is stored is assumed to
+ * be 1.
+ *
+ * Note that if the value for a particular attribute is false, then
+ * it is not read from the database even if the table is specified
+ * but might be supplied at run-time as an attribute in the short-code.
+ * All attributes that might be specified in the shortcode must be
+ * listed in the 'attributes' array below. If an attribute is not
+ * specified here, it can't be read from the short-code.
+ *
+ * The following is an explanation of this array.
+ *
+ * array(
+ * '{shortcode-slug} => array(
+ * 'plugin' => '{plugin (add-on) slug}', // Identifies which plugin is providing the short-code
+ * 'menu' => '{menu name}', // Menu name in this context is simply where to find the action
+ * 'action' => '{shortcode action name}, // Action used to execute this shortcode
+ * 'table' => '{table prefix}{table name}', // Database table where default attribute values are stored
+ * 'attributes' => array( // An array of all shortcode attributes (options)
+ * '{attr name}' => '{field name}', // Available attribute names and the database field names with the default value
+ * ....
+ * ),
+ * ... additional short-codes
+ * )
+ *
+ * Shortcode descriptions events
+ *
+ * <tr>
+ * <th>[glm-members-contacts-shortcode]</th>
+ * <td> </td>
+ * <td width="50%">
+ * <p>
+ * Displays something related to this add-on.
+ * </p>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td> </td>
+ * <th>type="{types}"</th>
+ * <td>
+ * <p>
+ * The "type" attribute is used to select the type of data to be displayed.
+ * Below is a list of available list types.
+ * </p>
+ * <p>
+ * <table width="100%">
+ * <tr><th colspan=3">List Types</th></tr>
+ * <tr><td>one</td><td>Type One</td></tr>
+ * <tr><td>two</td><td>Type Two</td></tr>
+ * </table>
+ * </p>
+ *
+ * </td>
+ * </tr>
+ *
+ */
+
+$glmMembersContactsShortcodes = array(
+ 'glm-members-contacts-list' => array(
+ 'plugin' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
+ 'menu' => 'contacts',
+ 'action' => 'list',
+ 'table' => false,
+ 'attributes' => array(
+ 'type' => 'all',
+ 'order' => 'title',
+ 'member' => false,
+ 'template' => false,
+ 'limit' => null,
+ )
+ ),
+);
+
+$glmMembersContactsShortcodesDescription = '
+ <tr><th>Shortcode</th><th>Attribute</th><th>Description</th></tr>
+ <tr>
+ <th>[glm-members-contacts-list]</th>
+ <td> </td>
+ <td width="50%">
+ Displays a list of contacts.
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <th>
+ order="{ fieldName }"
+ </th>
+ <td>
+ The "order" attribute is used to set the field to use for ordering results. Defaults to \'title\'.
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <th>
+ template="{ template }"
+ </th>
+ <td>
+ The "template" attribute is used to set the template that will be
+ used for smarty. Defaults to false.
+ </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <th>
+ limit="{ (number) }"
+ </th>
+ <td>
+ The "limit" attribute limits the results to (number). Defaults to null.
+ </td>
+ </tr>
+';
+
)
),
'frontActions' => array(
+ 'contacts' => array(
+ 'list' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
+ )
)
);
</select>
</td>
</tr>
+ <tr>
+ <th {if $contactInfo.fieldRequired.county}class="glm-required"{/if}>County:</th>
+ <td {if $contactInfo.fieldFail.county}class="glm-form-bad-input"{/if}>
+ <input id="county" type="text" name="county" value="{$contactInfo.fieldData.county}" class="glm-form-text-input-short">
+ {if $contactInfo.fieldFail.county}<p>{$contactInfo.fieldFail.county}</p>{/if}
+ </td>
+ </tr>
<tr>
<th {if $contactInfo.fieldRequired.state}class="glm-required"{/if}>State:</th>
<td {if $contactInfo.fieldFail.state}class="glm-form-bad-input"{/if}>
<tr><th>Address Line 1:</th><td>{$contactInfo.fieldData.addr1}</td></tr>
<tr><th>Address Line 2:</th><td>{$contactInfo.fieldData.addr2}</td></tr>
<tr><th>City</th><td>{$contactInfo.fieldData.city.name}</td></tr>
+ <tr><th>County</th><td>{$contactInfo.fieldData.county}</td></tr>
<tr><th>State:</th><td>{$contactInfo.fieldData.state.name}</td></tr>
<tr><th>ZIP / Postal Code:</th><td>{$contactInfo.fieldData.zip}</td></tr>
<tr><th>Country:</th><td>{$contactInfo.fieldData.country.name}</td></tr>
--- /dev/null
+<div class="wrap">
+ <h2>All Contacts</h2>
+ <h2 class="nav-tab-wrapper">
+ <a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Contacts List</a>
+ </h2>
+ <div id="glm-admin-content-container">
+
+
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+To change this license header, choose License Headers in Project Properties.
+To change this template file, choose Tools | Templates
+and open the template in the editor.
+-->
+<html>
+ <head>
+ <title>Contacts List</title>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ </head>
+ <body class="glm-contact-front">
+{include file='front/contacts/header.html'}
+
+ <form action="{$thisUrl}" method="post" id="searchForm">
+ <input type="hidden" name="prevStart" value="{$prevStart}">
+ <input type="hidden" name="nextStart" value="{$nextStart}">
+ <input type="hidden" name="limit" value="{$limit}">
+
+ <div>
+ <div class="row glmContactsSearchWrapper">
+ <div id="glmContactsSearchContainer" class="small-12 large-5">
+ <b>Text Search: </b><input id="glmContactsSearch" name="filterText" type="text" id="autoTest" value="{$filterText}">
+ </div>
+ <div id="glmContactsCountySearchContainer" class="small-12 large-5">
+ <b>County Search: </b>
+ <select id="glmContactsCountySearch" name="countySearch" type="text" value="{$countySearch}">
+ {foreach $countyList as $county}
+ <option value="{$county}">{$county} County</option>
+ {/foreach}
+ </select>
+ </div>
+ <div class="small-12 large-2" id="glmContactsSearchSubmit">
+ <input type="submit" value="Submit" class="glm-button button">
+ </div>
+ </div>
+ </div>
+
+
+ <br clear="all">
+
+ <p><b>Total found:</b> {$numbContacts} </p>
+
+ {if $paging}
+ <input type="Submit" name="pageSelect" value="Previous {$limit} Contacts" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
+ <input type="Submit" name="pageSelect" value="Next {$limit} Contacts" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
+ {/if}
+
+
+ {if $haveContacts}
+ {foreach $contactsList as $contact}
+ <div class="glm-member-list-container glm-member-container small-12 columns">
+ <div class="glm-member-list-data small-12 columns">
+ <div class="glm-member-list-active-info small-12 columns">
+ <h4 class="glm-member-title">
+ {if $fromMemberMenu}
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=contacts&option=edit&member={$contact.ref_dest}&contact={$contact.id}">{$contact.lname}, {$contact.fname}</a>
+ {else}
+ <a href="{$thisUrl}?page=glm-members-admin-menu-contacts&glm_action=index&option=edit&member={$contact.ref_dest}&contact={$contact.id}">{$contact.lname}, {$contact.fname}</a>
+ {/if}
+ </h4>
+
+ <div class="row">
+
+ <div class="small-6 columns">
+ {if $contact.title}<div class="glm-contact-title">{$contact.title}</div>{/if}
+ {if $contact.ref_type.name}
+ <div class="glm-contact-member">
+ {if $contact.ref_dest_name}
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=index&member={$c.ref_dest}">{$contact.ref_dest_name}</a>
+ {/if}
+ </div>
+ {/if}
+ {if $contact.addr1}<div class="glm-contact-address1">{$contact.addr1}</div>{/if}
+ {if $contact.addr2}<div class="glm-contact-address2">{$contact.addr2}</div>{/if}
+ {if $contact.zip or $contact.city.name or $contact.state.name}
+ <div>
+ {if $contact.city.name}<span class="glm-contact-city">{$contact.city.name},</span>{/if}
+ {if $contact.state.name}<span class="glm-contact-state">{$contact.state.name}</span>{/if}
+ {if $contact.zip}<span class="glm-contact-zip">{$contact.zip}</span>{/if}
+ </div>{/if}
+ {if $contact.county}<div class="glm-contact-county">{$contact.county}</div>{/if}
+ </div>
+ <div class="small-6 columns">
+ {if $contact.office_phone}<div>{$contact.office_phone}</div>{/if}
+ {if $contact.fax}<div>{$contact.fax}</div>{/if}
+ {if $contact.email}<div>Email: {$contact.email}</div>{/if}
+ </div>
+
+<!--// title phone
+// MEMBER fax
+// Address: Rd Email: email(linked)
+// Address: City, St ZIP
+// county County-->
+
+
+ </div>
+<!-- <div class="glm-shrink">Active: {$contact.active.name}</div>-->
+<!-- <div class="glm-shrink">Primary: {if $contact.primary_contact.value}Yes{/if}</div>
+ {if $contact.contact_type.name}<div>Type: {$contact.contact_type.name}</div>{/if}
+ {if $contact.access.name}<div class="glm-shrink">Access: {$contact.access.name}</div>{/if}
+ {if $contact.username}<div class="glm-nowrap">User: {$contact.username}</div>{/if}-->
+
+
+ <div class="glm-member-list-address-wrapper">
+ <!--
+ addr1
+ addr2
+ city
+ state.value
+ zip
+ country.name
+ phone
+ toll_free
+ region
+ member_pointer
+ term_webcam_cap
+
+ -->
+ </div>
+ </div>
+ </div>
+ </div>
+ {/foreach}
+ {else}
+ <tr class="alternate"><td colspan="7">(no contacts listed)</td></tr>
+ {/if}
+ {if $paging}
+ <input type="Submit" name="pageSelect" value="Previous {$limit} Contacts" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
+ <input type="Submit" name="pageSelect" value="Next {$limit} Contacts" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
+ {/if}
+ </form>
+<!-- Start Member List Copy -->
+
+
+<!-- End Member List Copy -->
+
+
+
+
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+/*
+ // Filter triggers
+ $(".listFilter" ).change( function() {
+
+ var filter = '';
+
+ // Check for archived filter
+ if ($("#filterArchived").attr('checked')) {
+ filter += '&filterArchived=true';
+ }
+
+ // Check for text filter
+ var filterText = $("#filterText").val();
+ if (filterText != '') {
+ filter += '&filterText=' + encodeURIComponent(filterText).replace(/%20/g,'+');
+ }
+
+ window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=index" + filter;
+
+ return false;
+ });
+*/
+
+ /*
+ * Do autocomplete search for member
+ * label: What will be searched
+ * value: What will be displayed when selected
+ * id: Member id added so we can go to the member while showing what was selected
+ * Also note that autocomplete does not properly render HTML codes, so we
+ * "unescape" them for HTML in Smarty.
+ */
+
+ var availableTags = [
+ {foreach $namesList as $e}
+ { label: "{$e.fname|replace:'"':"'"} {$e.lname|replace:'"':"'"} {$e.ref_dest_name|replace:'"':"'"} ( username: {$e.username})", value: "{$e.fname|replace:'"':"'"} {$e.lname|replace:'"':"'"}, {$e.ref_dest_name|replace:'"':"'"}, {$e.username}", id: '{$e.id}', member: '{$e.ref_dest}' },
+ {/foreach}
+ ];
+
+ $( "#glmContactsSearch" ).autocomplete({
+ source: availableTags,
+ html: true,
+ position: { my : "right top", at: "right bottom" },
+ select: function( event, ui ) {
+ var contactID = ui.item.id;
+ var memberID = ui.item.member;
+ window.location.replace("{$adminUrl}?page=glm-members-admin-menu-member&glm_action=contacts&option=edit&member=" + memberID + "&contact=" + contactID );
+ },
+ response: function(event, ui) {
+ if (!ui.content.length) {
+ var noResult = { value:"",label:"No results found" };
+ ui.content.push(noResult);
+ }
+ }
+ });
+
+ });
+ </script>
+
+
+
+{include file='front/footer.html'}
+
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+{include file='front/error/header.html'}
+<div id="awShucks" title="">
+ <center>
+ <h1 class="glm-error">Aw shucks!</h1>
+ <h3>We couldn't get you the page you wanted. </h3>
+ <div style="width: 600px; text-align: left;">
+ <p>
+ Yes, something went wrong, but we really want to make it right. In fact, we've already
+ notified our hard-working Web crew that you had this problem and will do what we can
+ to make sure it doesn't happen again.
+ </p>
+ <p>
+ As far as we can tell now, <b>an invalid action has been requested</b>. This really shouldn't
+ happen, so we're going to research this to see if we can avoid this in the future.
+ </p>
+ {if isset($errorMsg) && $errorMsg}
+ <p>Oh, we have a little more information for you.</p>
+ <p>{$errorMsg}</p>
+ {/if}
+
+ <p>
+ Please head back to the link below and try again. If you continue to get this error,
+ please call for assistance.
+ </p>
+ <p style="text-align: center;"><a href="{$siteBaseUrl}">Return to Home Page</a></p>
+ </div>
+ </center>
+</center>
+
+<script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ // Create graph dialog boxes
+ $("#awShucks").dialog({
+ autoOpen: true,
+ resizable: false,
+ modal: true,
+ width:'900'
+ });
+
+ });
+</script>
+
+{include file='front/footer.html'}
+
--- /dev/null
+<div class="wrap">
--- /dev/null
+{include file='front/error/header.html'}
+<div id="awShucks" title="">
+ <center>
+ <h1 class="glm-error">Aw shucks!</h1>
+ <p><b>We couldn't get you the page you wanted.</b></p>
+ <div style="width: 600px; text-align: left;">
+ <p style="margin-top: .5em;">
+ Yes, something went wrong, but we really want to make it right. In fact, we've already
+ notified our hard-working Web crew that you had this problem and will do what we can
+ to make sure it doesn't happen again.
+ </p>
+ {if isset($errorMsg) && $errorMsg}
+ <p style="margin-top: .5em;">Oh, we have a little more information for you.</p>
+ <p style="margin-top: .5em;"><b>{$errorMsg}</b></p>
+ {/if}
+
+ <p style="margin-top: .5em;">
+ Please head back to the link below and try again. If you continue to get this error,
+ please call for assistance.
+ </p>
+ <p style="margin-top: .5em; text-align: center;"><a href="{$siteBaseUrl}">Return to Home Page</a></p>
+ </div>
+ </center>
+</center>
+
+<script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ // Create graph dialog boxes
+ $("#awShucks").dialog({
+ autoOpen: true,
+ resizable: false,
+ modal: true,
+ width:'900'
+ });
+
+ });
+</script>
+
+{include file='front/footer.html'}
+
--- /dev/null
+
+ </div> <!-- / content area -->
+
+</div> <!-- / wrap -->
\ No newline at end of file