+++ /dev/null
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Full Contacts List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link http://dev.gaslightmedia.com/
- */
-
-// Load Contacts data abstract
-require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
-
-/*
- * This model is called when the "Shortcodes" menu is selected
- *
- */
-class GlmMembersAdmin_members_contacts extends GlmDataContacts
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * Plugin Configuration Data
- *
- * @var $config
- * @access public
- */
- public $config;
- /**
- * Contacts List
- *
- * @var $contacts
- * @access public
- */
- public $contacts;
-
- /*
- * Constructor
- *
- * This contructor performs the work for this model. This model returns
- * an array containing the following.
- *
- * 'status'
- *
- * True if successfull and false if there was a fatal failure.
- *
- * '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.
- *
- * @wpdb object WordPress database object
- *
- * @return array Array containing status, suggested view, and any data
- */
- public function __construct ($wpdb, $config)
- {
-
- // Save WordPress Database object
- $this->wpdb = $wpdb;
-
- // Save plugin configuration object
- $this->config = $config;
-
- // Run constructor for members data class
- parent::__construct(false, false);
-
- }
-
- public function modelAction($actionData = false) {
-
- $haveContacts = false;
- $filterArchived = false;
- $filterText = false;
- $haveFilter = false;
-
- // Only list member contacts for the selected member
- $where = "true";
-
- // Filter by text string supplied
- if (isset($_REQUEST['filterText'])) {
- $filterText = esc_sql($_REQUEST['filterText']);
- $where .= " AND (
- T.lname LIKE '%$filterText%' OR
- T.fname LIKE '%$filterText%' OR
- T.org LIKE '%$filterText%' OR
- T.descr LIKE '%$filterText%'
- )";
- $haveFilter = true;
- }
-
- // Check if this is a request to show archived contacts
- if (!isset($_REQUEST['filterArchived'])) {
- $where .= " AND T.access != ".$this->config['access_numb']['Archived'];
- $filterArchived = false;
- } else {
- $filterArchived = true;
- $haveFilter = true;
- }
-
- // Get list of contacts
- $this->contacts = $this->getList($where);
-
- if ($this->contacts !== false) {
- if (count($this->contacts) > 0) {
- $haveContacts = true;
- }
- }
-
- // Compile template data
- $templateData = array(
- 'haveContacts' => $haveContacts,
- 'contacts' => $this->contacts,
- 'filterArchived' => $filterArchived,
- 'filterText' => $filterText,
- 'haveFilter' => $haveFilter
- );
-
- // Return status, any suggested view, and any data to controller
- return array(
- 'status' => true,
- 'modelRedirect' => false,
- 'view' => 'admin/members/contacts.html',
- 'data' => $templateData
- );
-
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-{include file='admin/members/header.html'}
-
- <form class="glm-right" onSubmit="return false;">
- <span{if $haveFilter} class="glm-notice"{/if}><b>List Filters:</b> </span>
- <input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if}>Show Archived
-
- <input type="text" id="filterText" class="listFilter" value="{$filterText}"> Search
- </form>
- <h2 class="glm-left">Contacts</h2>
-
- <table class="wp-list-table striped glm-admin-table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Active</th>
- <th>Type</th>
- <th>Access</th>
- <th>User</th>
- <th>Entity</th>
- <th>Organization</th>
- <th>Location</th>
- </tr>
- </thead>
- <tbody>
-{if $haveContacts}
- {foreach $contacts as $c}
- <tr>
- <td class="glm-shrink"><a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=contacts&option=edit&member={$c.ref_dest}&contact={$c.id}">{$c.lname}, {$c.fname}</a></td>
- <td class="glm-shrink">{$c.active.name}</td>
- <td>{$c.contact_type.name}</td>
- <td class="glm-shrink">{$c.access.name}</td>
- <td class="glm-nowrap">{$c.contact_role_short.name}</td>
- <td class="glm-nowrap">
- {$c.ref_type.name}:
- <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=index&member={$c.ref_dest}">{$c.ref_dest_name}</a>
- </td>
- <td class="glm-shrink">{$c.org}</td>
- <td class="glm-shrink">{$c.city.name}, {$c.state.name}</td>
- </tr>
- {/foreach}
-{else}
- <tr class="alternate"><td colspan="2">(no contacts listed)</td></tr>
-{/if}
- </tbody>
- </table>
-
- <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=contacts" + filter;
-
- return false;
- });
- });
- </script>
-
-
-
-{include file='admin/footer.html'}