+ The Security # is the three or four digit number on the signature side of your credit card.
+ American Express cards may have this number on the front of the card.
+
+
+
+
+
+
+
+
+
+
+
Contact Information
+
+
+
+
First Name
+
Last Name
+
Address
+
+
City
+
+
State
+
+
+
+
+
+
Country
+
+
+
+
+
ZIP/Postal code
+
Phone
+
E-Mail
+
Verify E-Mail
+
+
OK to Sent E-Mail?
+
Please send information on activities and offers.
+
+
+
+
+
+
+
+
+
Venue #2 Name
+
+
+
+
(venue description text goes here)
+
+
+
+
+
+
+
+
+
+
Event #1 Name
+
+
(venue description text goes here)
+
+
+
+
+
+
Quant
+
Section
+
Ticket
+
Price Each
+
Total
+
+
+
5
+
Section 1
+
Type 1
+
$25.00/each
+
$125.00
+
+
+
2
+
Section 2
+
Type 2
+
$25.00
+
$50.00
+
+
+
7
+
$175.00
+
+
+
+
+
+
+
+
+
Event #2 Name
+
+
(venue description text goes here)
+
+
+
+
+
+
Quant
+
Section
+
Ticket
+
Price Each
+
Total
+
+
+
5
+
Section 1
+
Type 1
+
$25.00/each
+
$125.00
+
+
+
2
+
Section 2
+
Type 2
+
$25.00
+
$50.00
+
+
+
7
+
$175.00
+
+
+
+
+
+
+
+
+
+
+
Tickets
+
Venue Total
+
+
+
19
+
$250.00
+
+
+
+
+
+
+
+
+
+
+
Payment for Venue #2 Name
+
+
+
+
+
Card Type
+
+
+
+
+
Name on Card
+
Card #
+
+
Expiration
+
+ Month
+ Year
+
+
+
+
Security #
+
+
+ The Security # is the three or four digit number on the signature side of your credit card.
+ American Express cards may have this number on the front of the card.
+
Selects display of Housing summary information only in the report.
+ When this option is selected, only the summary is displayed without all of the property and inventory detail.
Selects display of Reservations summary information only in the report.
+ When this option is selected, only the summary is displayed without all of the reservation detail.
Display on Screen - Display the report in your browser below the report request form.
+
Printable Report - Display the report in a separate browser window for output to a printer.
+
Export as Spreadsheet - Sends the report to your computer as a ".CSV" type file for import into a spreadsheet program.
+
+
If the Printable Report does not show, check to make sure you have permitted browser pop-ups for this Web site.
+ '
+ )
+ )
+
+
+
+ );
+ }
+
+ /**
+ * Create Report Controls Data
+ *
+ * @return array
+ */
+ function newControls()
+ {
+
+ $r = $this->newEntry();
+
+ // Get event, state, team matrix and merge that with result
+ $eventStateTeamData = $this->getEventStateTeamMatrix();
+ $r['eventStateTeam'] = $eventStateTeamData;
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $event = isset($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $r['eventStateTeam'][$event]['default'] = true;
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * getStateTeamMatrix
+ *
+ */
+ function getEventStateTeamMatrix()
+ {
+
+ // Get property/accommodation matrix
+ $sql = "
+ SELECT C.id AS event_id,
+ C.name AS event_name,
+ C.event_code AS event_code,
+ S.id AS state_id,
+ S.code AS state_code,
+ S.event AS event,
+ T.id AS team_id,
+ T.team_code AS team_code,
+ T.name AS team_name
+ FROM eventmgt.event C
+ LEFT OUTER JOIN state_rep S ON (S.event = C.id)
+ LEFT OUTER JOIN team T ON (T.state = S.id)
+ ORDER BY C.name, S.code, T.team_code
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventStateTeamData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($eventStateTeamData) == 0) {
+ $reason[] = "No State Reps listed in the system.";
+ }
+ // *** LOOK FOR DEFAULTS ***
+ // Build array of Members with their accommodations
+ $eventStateTeam = array();
+ foreach ($eventStateTeamData as $d) {
+
+ // If event hasn't been added yet, do that.
+ if (!isset($eventStateTeam[$d['event_id']])) {
+ $eventStateTeam[$d['event_id']] = array(
+ 'eventID' => $d['event_id'],
+ 'eventName' => $d['event_name'],
+ 'eventCode' => $d['event_code'],
+ 'default' => false,
+ 'state' => array()
+ );
+ }
+
+ // If state hasn't been added yet, do that.
+ if ($d['state_id']) {
+ if (!isset($eventStateTeam[$d['event_id']]['state'][$d['state_id']])) {
+ $eventStateTeam[$d['event_id']]['state'][$d['state_id']] = array(
+ 'stateID' => $d['state_id'],
+ 'stateCode' => $d['state_code'],
+ 'team' => array()
+ );
+ }
+ }
+
+ // Add team
+ if ($d['team_id']) {
+ $eventStateTeam[$d['event_id']]['state'][$d['state_id']]['team'][$d['team_id']] = array(
+ 'teamID' => $d['team_id'],
+ 'teamName' => $d['team_name']
+ );
+ }
+ }
+
+ return $eventStateTeam;
+ }
+
+
+ /**
+ * Try to process controls input
+ *
+ * @return array
+ */
+ function processControls()
+ {
+
+ $r = $this->processInputData();
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $event = isset($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $r['fieldData']['event_name']['pick_list'][$event]['default'] = true;
+ }
+
+ return $r;
+
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAccoms.php b/classes/data/dataAccoms.php
new file mode 100644
index 0000000..9fa360f
--- /dev/null
+++ b/classes/data/dataAccoms.php
@@ -0,0 +1,468 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAccoms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAccoms class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAccoms,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataAccoms extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.accommodation';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Member name
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => 'property',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ 'p_where' => 'member_id in
+ (
+ SELECT DISTINCT member_id
+ FROM members.member_category
+ WHERE category_id IN
+ (SELECT category_id FROM members.category WHERE accommodations)
+ )',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'ni'
+ ),
+
+ // Member name
+ 'member_2' => array(
+ 'field' => 'member',
+ 'as' => 'property',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'view_only' => true,
+ 'use' => 'gleudc'
+ ),
+
+ // Accommodation Name (internal use)
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Accommodation Title (for display to users)
+ 'title' => array(
+ 'field' => 'title',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Category - Needs to be moved to a separate admin table
+ 'category' => array(
+ 'field' => 'category',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->room_category->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gnieud'
+ ),
+
+ // Quantity - Number of these accommodations at property
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgnieud'
+ ),
+
+ // Standard # of occupants
+ 'occupants' => array(
+ 'field' => 'occupants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gnieud'
+ ),
+
+ // Max # of occupants
+ 'maxoccupants' => array(
+ 'field' => 'maxoccupants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gnieud'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Get Accommadations list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAccomsList($member = false)
+ {
+
+ // Get any specified member listing option - default to event
+ $option = 'event';
+ if (($membersListOption = filter_input(INPUT_GET, 'AccomsListOption', FILTER_SANITIZE_STRING))) {
+ $option = $membersListOption;
+ }
+
+ // Get event Member from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ if ($member) {
+ $memberID = $member;
+ $option = 'member';
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'member':
+ if ($memberID) {
+ $where = "T.member = $memberID";
+ } else {
+ $where .= "false";
+ }
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get list of all available Events
+ $accomsList = $this->getList($where, 'sort, name');
+
+
+ if (count($accomsList) == 0) {
+ return false;
+ }
+
+
+ return $accomsList;
+ }
+
+
+ /**
+ * Get Accommodation Detail
+ *
+ * @return array
+ */
+ function getAccomDetail()
+ {
+
+ // Is there a new accom ID selected?
+ if (($accomID = filter_input(INPUT_GET, 'AccomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $accomID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+
+ // Otherwise, get the event ID from the session
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ } else {
+
+ // Otherwise, we don't have an event id
+ return false;
+
+ }
+
+ $accomDetail = $this->getEntry($accomID);
+
+ return $accomDetail;
+
+ }
+
+
+ /**
+ * Edit Accommodation
+ *
+ * @return array
+ */
+ function editAccom()
+ {
+
+ // Is there a new accommodaton code selected?
+ if (($accomID = filter_input(INPUT_GET, 'AccomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $accomID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+
+ // Otherwise, get the accommodation ID from the session
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ } else {
+
+ // Otherwise, we don't have a accommodation id
+ return false;
+
+ }
+
+ $accomDetail = $this->editEntry($accomID);
+
+ // echo "
".print_r($accomDetail,1)."
";
+ return $accomDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Accommodation
+ *
+ * @return array
+ */
+ function updateAccom()
+ {
+
+ // Is there a new event code selected?
+ if (($accomID = filter_input(INPUT_GET, 'AccomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $accomID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+
+ // Otherwise, get the accommodation ID from the session
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ } else {
+
+ // Otherwise, we don't have a accommodation id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($accomID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add Accommodation
+ *
+ * @return array
+ */
+ function newAccom()
+ {
+
+ $r = $this->newEntry();
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Member']) && $_SESSION[GLM_EVENT_SESSION]['Member'] != false) {
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ $r['fieldData']['property']['pick_list'][$accomID]['default'] = true;
+ $r['fieldData']['property']['name'] = $r['fieldData']['property']['pick_list'][$accomID]['name'];
+ $r['fieldData']['property']['value'] = $accomID;
+ }
+
+ // If succesful then set current accommodation to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $r['insertedID'];
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Accommodation
+ *
+ * @return array
+ */
+ function insertAccom()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current accommodation to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $r['insertedID'];
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAddonSold.php b/classes/data/dataAddonSold.php
new file mode 100644
index 0000000..5af00aa
--- /dev/null
+++ b/classes/data/dataAddonSold.php
@@ -0,0 +1,290 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddonSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAddonSold class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddonSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+class EventManagementDataAddonSold extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.add_on_sold';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Ticket Order
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Ticket Sold
+ 'ticket_sold' => array(
+ 'field' => 'ticket_sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Add-on Name
+ 'add_on_name' => array(
+ 'field' => 'add_on_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on type
+ 'add_on_type' => array(
+ 'field' => 'add_on_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_add_on_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on type name
+ 'add_on_type_name' => array(
+ 'field' => 'add_on_type_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Unit name
+ 'unit_name' => array(
+ 'field' => 'unit_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Unit cost number
+ 'unit_price_numb' => array(
+ 'field' => 'unit_price',
+ 'as' => 'unit_price_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Unit price (money)
+ 'unit_price' => array(
+ 'field' => 'unit_price',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ ),
+
+ // Quantity selected
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Total Price Paid - Number
+ 'price_paid_numb' => array(
+ 'field' => 'price_paid',
+ 'as' => 'price_paid_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Price paid (money)
+ 'price_paid' => array(
+ 'field' => 'price_paid',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ )
+
+ );
+
+ }
+
+ /**
+ * Get Ticket Sold Add-Ons list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAddonsSoldList($ticketSoldID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied, use the $TicketSoldID - Otherwise $where
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a ticket sold ID, then filter by that
+ $ticketSoldID = ($ticketSoldID - 0); // Make sure it's number
+ if ($ticketSoldID > 0) {
+ $where .= " AND T.ticket_sold = $ticketSoldID";
+ }
+
+ }
+
+ $addonsSoldList = $this->getList($where, 'id');
+
+ return $addonsSoldList;
+ }
+
+ /**
+ * Get Add-On Sold Detail
+ *
+ * @return array
+ */
+ function getAddonSoldDetail($addonSoldID = false)
+ {
+
+ if ($addonSoldID == false) {
+
+ // Otherwise, we don't have an add-on id
+ return false;
+
+ }
+
+ // If the add-on sold ID is valid, get the detail
+ $addonSoldID = filter_input(INPUT_GET, 'AddonSoldID', FILTER_SANITIZE_NUMBER_INT);
+ if ($addonSoldID) {
+ $addonSoldDetail = $this->getEntry($addonSoldID);
+
+ // Otherwise fail
+ } else {
+ return false;
+ }
+
+ return $addonSoldDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAddons.php b/classes/data/dataAddons.php
new file mode 100644
index 0000000..bdf6e26
--- /dev/null
+++ b/classes/data/dataAddons.php
@@ -0,0 +1,416 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAddons class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+class EventManagementDataAddons extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_add_on';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Ticket
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Ticket'],
+ 'use' => 'niegdl'
+ ),
+
+ // Add-on Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on type
+ 'add_on_type' => array(
+ 'field' => 'add_on_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_add_on_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Maximum quant (0 is unlimited)
+ 'max_quant' => array(
+ 'field' => 'max_quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Unit name
+ 'unit_name' => array(
+ 'field' => 'unit_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Unit cost
+ 'unit_cost_numb' => array(
+ 'field' => 'unit_cost',
+ 'as' => 'unit_cost_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Unit cost (money)
+ 'unit_cost' => array(
+ 'field' => 'unit_cost',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ )
+
+ );
+
+ }
+
+ /**
+ * Get Add-Ons list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAddonsList($ticketID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a ticket ID and filter by that ticket if there is
+ $ticketID = ($ticketID - 0); // Make sure it's number
+ if ($ticketID > 0) {
+ $where .= " AND T.ticket = $ticketID";
+ } elseif ($_SESSION[GLM_EVENT_MGT_ADMIN]['Ticket'] > 0) {
+ $where .= " AND T.ticket = ".$_SESSION[GLM_EVENT_MGT_ADMIN]['Ticket'];
+ }
+
+ }
+
+ // Get list of Add-Ons
+ $addonsList = $this->getList($where, 'name');
+
+ return $addonsList;
+ }
+
+ /**
+ * Get Add-On Detail
+ *
+ * @return array
+ */
+ function getAddonDetail($addonID = false)
+ {
+
+ // If a Add-On ID has been supplied
+ if ($addonID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise if there a new add-on ID supplied via the request
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have an add-on id
+ return false;
+
+ }
+
+ $addonDetail = $this->getEntry($addonID);
+
+ return $addonDetail;
+
+ }
+
+
+ /**
+ * Edit Add-On
+ *
+ * @return array
+ */
+ function editAddon()
+ {
+
+ if (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have a add-on id
+ return false;
+
+ }
+
+ $addonDetail = $this->editEntry($addonID);
+
+ return $addonDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Add-On
+ *
+ * @return array
+ */
+ function updateAddon()
+ {
+
+ if (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($addonID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Add-On
+ *
+ * @return array
+ */
+ function newAddon()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert add-on
+ *
+ * @return array
+ */
+ function insertAddon()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current add-on to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete add-on
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function addonDelete($confirm = false)
+ {
+
+ // Is there a new add-on code selected?
+ if (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have an add-on id
+ return false;
+
+ }
+
+ $addonDetail = $this->deleteEntry($addonID, $confirm);
+
+ return $addonDetail;
+
+ }
+
+ /**
+ * Get Add-Ons Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAddonsStats($where = 'true')
+ {
+
+ $addonsStats = $this->getStats($where);
+
+ return $addonsStats;
+ }
+
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAmenities.php b/classes/data/dataAmenities.php
new file mode 100644
index 0000000..3f50b0f
--- /dev/null
+++ b/classes/data/dataAmenities.php
@@ -0,0 +1,486 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAmenities.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAmenities class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAmenities.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataAmenities extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.amenities';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Affiliation (insert) - what type of entities is this Amenity for
+ 'affiliation_type' => array(
+ 'field' => 'affiliation_type',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Affiliation (view)
+ 'affiliation_type_2' => array(
+ 'field' => 'affiliation_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->reference_type_numb->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gled'
+ ),
+
+ // Amenity affiliation (non-standard pointer)
+ // Points to various tables depending on the "Affiliation type" value
+ 'owner' => array(
+ 'field' => 'owner',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Amenity affiliation (non-standard pointer)
+ // Points to various tables depending on the "Affiliation To" value
+ 'owner_2' => array(
+ 'field' => 'owner',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gled'
+ ),
+
+ // Amenity Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Quantity / Size
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Amenity Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get an array of Amenities for a particular affiliated entity
+ *
+ * $listOption Optional Type of affiliation - see config.ini 'reference_type'
+ * If not supplied will check for AmenitiesListOption GET value
+ * $whereRequest If supplied, use as WHERE clause instead
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAmenities($listOption = false, $whereRequest = false)
+ {
+
+ $where = '';
+
+ // If there's a specific whereRequest, use that only
+ if ($whereRequest) {
+ $where = $whereRequest;
+ } else {
+
+ // Get Event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get Member ID from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ // Get any specified listing option
+ if ($listOption != '') {
+ $option = $listOption;
+
+ // Otheriwse check for list options provided in request
+ } elseif (($AmenitiesListOption = filter_input(INPUT_GET, 'AmenitiesListOption', FILTER_SANITIZE_STRING))) {
+ $option = $AmenitiesListOption;
+ }
+
+ // Include selection of proper affiliation type
+ switch ($option) {
+ case 'member':
+ if ($memberID) {
+ $where .= "T.affiliation_type = ".$this->config->reference_type->property
+ ."AND owner = $memberID\n";
+ } else {
+ $where .= "false";
+ }
+ break;
+ }
+ }
+
+ // Get the Amenities - return false if none found
+ $amenitiesList = $this->getList($where, 'name');
+ if (!is_array($amenitiesList) || count($amenitiesList) == 0) {
+ return false;
+ }
+
+ // Get affiliation type for each Amenity
+ reset($amenitiesList);
+ while( list($key, $val) = each( $amenitiesList ) ) {
+
+ $aData = $this->getAffiliate(
+ $val['affiliation_type']['value'],
+ $val['owner']
+ );
+
+ if ($aData) {
+ $amenitiesList[$key]['affiliation_type_name'] = $aData['applied_to_name'];
+ $amenitiesList[$key]['owner_name'] = $aData['owner_name'];
+ }
+
+ } // Get Amenities affiliation
+
+ return $amenitiesList;
+ }
+
+ /**
+ * Get Amenity Detail
+ *
+ * @return array
+ */
+ function getAmenityDetail()
+ {
+
+ // Is there a new Amenity ID supplied?
+ if (!($amenityID = filter_input(INPUT_GET, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ // We don't have an amenity id
+ return false;
+
+ }
+
+ $amenityDetail = $this->getEntry($amenityID);
+
+ // Get owner data
+ $aData = $this->getAffiliate(
+ $amenityDetail['affiliation_type']['value'],
+ $amenityDetail['owner']
+ );
+
+
+ if ($aData) {
+ $amenityDetail = array_merge($amenityDetail, $aData);
+ }
+
+ return $amenityDetail;
+
+ }
+
+ /**
+ * Edit Amenity
+ *
+ * @return array
+ */
+ function editAmenity()
+ {
+
+ // Is there a new amenity ID supplied?
+ if (!($amenityID = filter_input(INPUT_GET, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ // We don't have an amenity id
+ return false;
+
+ }
+
+ $amenityDetail = $this->editEntry($amenityID);
+
+ // Get owner data
+ $aData = $this->getAffiliate(
+ $amenityDetail['affiliation_type']['value'],
+ $amenityDetail['owner']
+ );
+
+ if ($aData) {
+ $amenityDetail = array_merge($amenityDetail, $aData);
+ }
+
+ return $amenityDetail;
+
+ }
+
+ /**
+ * Update Amenity
+ *
+ * @return array
+ */
+ function updateAmenity()
+ {
+
+ // Is there a new amenity ID supplied?
+ if (!($amenityID = filter_input(INPUT_GET, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ if (!($amenityID = filter_input(INPUT_POST, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ echo "::::::";
+ // We don't have an Amenity id
+ return false;
+ }
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($amenityID);
+
+ // Get owner data
+ $aData = $this->getAffiliate(
+ $amenityDetail['affiliation_type']['value'],
+ $amenityDetail['owner']
+ );
+
+ if ($aData) {
+ $amenityDetail = array_merge($amenityDetail, $aData);
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * New Amenity Affiliation
+ *
+ * @return array
+ */
+ function newAmenityAffiliation($r)
+ {
+
+ // Check for specified Amenity type
+ // We need to check for name rather than number because that's what the js is sending us
+ if (!isset($_REQUEST['amenity_type_code']) || $_REQUEST['amenity_type_code'] == '') {
+ return false;
+ }
+
+ // Get type and affiliation
+ $amenityType = trim($_REQUEST['amenity_type_code']);
+ $affiliateID = false;
+
+ switch ($amenityType) {
+ case 'property':
+ $amenityTypeNumber = $this->config->reference_type->property;
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $affiliateID = ($_SESSION[GLM_EVENT_SESSION]['Member'] - 0);
+ $amenityTypeName = 'Property';
+ $aTable = 'eventmgt.member';
+ $aField = 'name';
+ $aFieldShort = $aField;
+ }
+ break;
+ }
+
+ // If no match on Amenity type, then fail
+ if ($affiliateID == false) {
+ return false;
+ }
+
+ // Get affiliate data
+ $sql = "SELECT $aField AS name,
+ $aFieldShort AS short_name
+ FROM $aTable
+ WHERE id = $affiliateID
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $aData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // if no valid affiliate data - fail
+ if (!$aData) {
+ return false;
+ }
+
+ $r['fieldData']['amenity_type_name'] = $amenityTypeName;
+ $r['fieldData']['amenity_type_code'] = $amenityType;
+ $r['fieldData']['amenity_type'] = $amenityTypeNumber;
+ $r['fieldData']['affiliation_name'] = $aData['name'];
+ $r['fieldData']['affiliation'] = $affiliateID;
+ $r['fieldData']['affiliation_short'] = $aData['short_name'];
+
+ return $r;
+
+ }
+
+ function newAmenity()
+ {
+
+ $r = $this->newEntry();
+
+ $r = $this->newAmenityAffiliation($r);
+
+ // echo "
";
+ return $r;
+
+ }
+
+ /**
+ * Get Affiliate table and name
+ *
+ */
+ function getAffiliate($type, $affiliation)
+ {
+
+ // Deterimine Affliate table
+ $aTable = '';
+ $aField = '';
+ switch ($type) {
+ case $this->config->reference_type->event:
+ $aType = 'Event';
+ $aTable = 'event';
+ $aField = 'name';
+ $aFieldShort = 'event_code';
+ break;
+ case $this->config->reference_type->property:
+ $aType = 'Property';
+ $aTable = 'eventmgt.member';
+ $aField = 'name';
+ $aFieldShort = $aField;
+ break;
+ }
+
+ $r = false;
+
+ // If we have a good affiliate relationship
+ if ($aField != '') {
+
+ $sql = "SELECT $aField AS name,
+ $aFieldShort AS short_name
+ FROM $aTable
+ WHERE id = $affiliation
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $aData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if ($aData) {
+ $r = array(
+ 'fee_type_name' => $aType,
+ 'affiliation_name' => $aData['name'],
+ 'affiliation_short' => $aData['short_name']
+ );
+ }
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Fee
+ *
+ * @return array
+ */
+ function feeDelete($confirm = false)
+ {
+ // Is there a new fee code selected?
+ if (($feeID = filter_input(INPUT_GET, 'FeeID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Fee'] = $feeID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Fee'])) {
+
+ // Otherwise, get the fee ID from the session
+ $feeID = $_SESSION[GLM_EVENT_SESSION]['Fee'];
+
+ } else {
+
+ // Otherwise, we don't have a fee id
+ return false;
+
+ }
+
+ $feeDetail = $this->deleteEntry($feeID, $confirm);
+ return $feeDetail;
+
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/classes/data/dataInventory.php b/classes/data/dataInventory.php
new file mode 100644
index 0000000..0d5015d
--- /dev/null
+++ b/classes/data/dataInventory.php
@@ -0,0 +1,1141 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataInventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementAdminInventory class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataInventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataInventory extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.inventory';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event selection
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lgud'
+ ),
+
+ // Event ID
+ 'event_id' => array(
+ 'field' => 'event',
+ 'as' => 'event_id',
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgud'
+ ),
+
+ // Property selection
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lgud'
+ ),
+
+ // Member Street Address - From main member db
+ 'member_street' => array(
+ 'field' => 'member', // ID in member table is same as in eventmgt.member
+ 'as' => 'street',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'street',
+ 'p_id' => 'member_id',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member City - From main member db
+ 'member_city' => array(
+ 'field' => 'member', // ID in member table is same as in eventmgt.member
+ 'as' => 'city',
+ 'type' => 'pointer',
+ 'p_table' => 'members.city',
+ 'p_field' => 'city_name',
+ 'p_id' => 'city_id',
+ 'p_where' => 'M.member_id = T.member AND city.city_id = M.city_id',
+ 'p_from' => 'members.member M',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // member ID
+ 'memb_id' => array(
+ 'field' => 'member',
+ 'as' => 'member_id',
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgdu'
+ ),
+
+ // Accommodation ID
+ 'accommodation_id' => array(
+ 'field' => 'accommodation',
+ 'as' => 'accommodation_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'au'
+ ),
+
+ // Accommodation
+ 'accommodation' => array(
+ 'field' => 'accommodation',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.accommodation',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'ni'
+ ),
+
+ // Accommodation name
+ 'accommodation_name' => array(
+ 'field' => 'accommodation',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.accommodation',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lged'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'ni'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niu'
+ ),
+
+ // Date
+ 'date' => array(
+ 'field' => 'date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => date('m/d/Y'),
+ 'use' => 'lgeud'
+ ),
+
+ // Assigned to Event
+ 'assigned' => array(
+ 'field' => 'assigned',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'minValue' => 1,
+ 'use' => 'a'
+ ),
+
+ // Available to reserve
+ 'available' => array(
+ 'field' => 'available',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'lgeud'
+ ),
+
+ // On Hold
+ 'on_hold' => array(
+ 'field' => 'id',
+ 'as' => 'on_hold',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.inven_hold',
+ 'p_field' => 'quant',
+ 'p_id' => 'inventory',
+ 'p_where' => "expire_time > '".date('r')."' AND inventory = T.id",
+ 'p_sum' => true,
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lg'
+ ),
+
+/* not using now
+ // Minimum Nights Requred
+ 'min_nights' => array(
+ 'field' => 'min_nights',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 1,
+ 'minValue' => 1,
+ 'use' => 'a'
+ ),
+*/
+ // Event Room Rate - For standard number of occupants
+ 'rate' => array(
+ 'field' => 'rate',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0.0,
+ 'minValue' => 1,
+ 'use' => 'a'
+ )
+/* not using now
+ // Additional Person Rate
+ 'add_person' => array(
+ 'field' => 'add_person',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.0,
+ 'minValue' => 0,
+ 'use' => 'a'
+ )
+*/
+
+/* not using policies at this level for now
+ // Request Policy
+ 'res_policy' => array(
+ 'field' => 'res_policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Cancel Policy
+ 'can_policy' => array(
+ 'field' => 'can_policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+*/
+ );
+ }
+
+ /**
+ * Get Inventory list
+ *
+ * @param string type of events list
+ *
+ * @return object containing array
+ * timestamp of first date of inventory
+ * array of inventory items
+ */
+ function getInvenList($setType = false, $setId = false)
+ {
+
+ // Get any specified member listing option - default to event
+ if ($setType) {
+
+ $option = $setType;
+
+ } else {
+
+ $option = 'accom';
+ if (($invenListOption = filter_input(INPUT_GET, 'InvenListOption', FILTER_SANITIZE_STRING))) {
+ $option = $invenListOption;
+ }
+
+ }
+
+ // Check for setId passed in URL
+ $setIdRequest = ($_REQUEST['setId'] - 0);
+ if ($setIdRequest > 0) {
+ $setId = $setIdRequest;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ $type = 'Summary';
+ break;
+ case 'event':
+ // Get event ID from session - if available
+ $eventID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Event'] );
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.event = $eventID";
+ $type = 'Summary';
+ break;
+ case 'member':
+ $memberID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Member'] );
+ if (!$memberID) {
+ return false;
+ }
+ $where = "T.member = $memberID";
+ $type = 'Calendar';
+ break;
+ case 'accom':
+ // Get event ID from session - if available
+ $accomID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Accom'] );
+ if (!$accomID) {
+ return false;
+ }
+ $where = "T.accommodation = $accomID";
+ $type = 'Calendar';
+ break;
+ case 'team':
+ $teamID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Team'] );
+ if (!$teamID) {
+ return false;
+ }
+ $where = "
+ T.member in (
+ SELECT property
+ FROM eventmgt.team_property
+ WHERE team = $teamID
+ )";
+ $type = 'Calendar';
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Only look for inventory from now forward.
+ $where .= " AND T.date > 'now'";
+
+ // Get list of all available Events
+ $inventoryList = $this->getList($where);
+
+ // Clean up and fix specific fields and find first date of inventory
+ if ($inventoryList != false) {
+
+ $firstDate = strtotime('+5 years'); // Start with something far out in time
+ reset($inventoryList);
+ while( list($key, $val) = each( $inventoryList ) ) {
+
+ $thisDate = strtotime($val['date']['date']);
+
+ // Is this date earlier than any others?
+ if ($thisDate < $firstDate) {
+ $firstDate = $thisDate;
+ }
+
+ // Convert dates to format required for fullcalendar
+ $inventoryList[$key]['cal_date'] = date('Y-m-d', $thisDate);
+
+ // Make member_name copy safe for inclusion in JAVAscript code
+ $inventoryList[$key]['member_name_h'] = addslashes($val['property']);
+
+ }
+ }
+
+ // Create a summary for certain list options
+ $sum = array();
+ $dates = array();
+ $have_summary = false;
+ $total_properties = 0;
+ $total_assigned = array();
+ $total_available = array();
+ $total_sold = array();
+ if ($type == 'Summary' && is_array($inventoryList) && count($inventoryList) > 0) {
+
+ // Start by building list of all inventory dates
+ // *** should be able to do this from the event dates data ***
+ foreach ($inventoryList as $inv) {
+ // Add to dates list
+ $t = strtotime($inv['date']['date']);
+ $dates[$t] = date('m/d/Y', $t);
+ $total_assigned[$t] = 0;
+ $total_available[$t] = 0;
+ $total_sold[$t] = 0;
+ }
+ ksort($dates);
+
+ // Now go through it again and build all the data
+ foreach ($inventoryList as $inv) {
+ // If event has not been set yet
+ $event_id = $inv['event_id'];
+ if (!isset($sum[$event_id])) {
+ $sum[$event_id] = array(
+ 'id' => $event_id,
+ 'name' => $inv['event'],
+ 'memb' => array()
+ );
+ }
+
+ // If member has not been set yet
+ $memb_id = $inv['member_id'];
+ if (!isset($sum[$event_id]['memb'][$memb_id])) {
+
+ // Get Member credit card types
+ $sql = "
+ SELECT CT.ccard_type_name AS ccardName
+ FROM members.ccard_type CT, members.member_ccard_type MCT
+ WHERE MCT.member_id = $memb_id
+ AND CT.ccard_type_id = MCT.ccard_type_id
+ ORDER BY CT.ccard_type_name
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $cc_types = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($cc_types) == 0) {
+ $cc_types = false;
+ }
+
+ $sum[$event_id]['memb'][$memb_id] = array(
+ 'id' => $memb_id,
+ 'name' => $inv['member'],
+ 'street' => $inv['street'],
+ 'city' => $inv['city'],
+ 'accom' => array(),
+ 'cc_types' => $cc_types
+ );
+
+ $total_properties++;
+ }
+
+ // If accommodation has not been set yet
+ $accom_id = $inv['accommodation_id'];
+ if (!isset($sum[$event_id]['memb'][$memb_id]['accom'][$accom_id])) {
+ $sum[$event_id]['memb'][$memb_id]['accom'][$accom_id] = array(
+ 'id' => $memb_id,
+ 'name' => $inv['accommodation'],
+ 'date' => array()
+ );
+
+ // Also build all the dates as empty entries
+ reset($dates);
+ while( list($k, $v) = each($dates) ) {
+ $sum[$event_id]['memb'][$memb_id]['accom'][$accom_id]['date'][$k] = false;
+ }
+
+ }
+
+ // Add this inventory item
+ $inven_id = $inv['id'];
+ $t = strtotime($inv['date']['date']);
+ $sum[$event_id]['memb'][$memb_id]['accom'][$accom_id]['date'][$t] = array(
+ 'id' => $inven_id,
+ 'date' => $inv['date']['date'],
+ 'assigned' => $inv['assigned'],
+ 'avail' => $inv['available'],
+ 'sold' => $inv['assigned'] - $inv['available'],
+ 'rate' => $inv['rate']
+ );
+ ksort($sum[$event_id]['memb'][$memb_id]['accom'][$accom_id]['date']);
+
+ $total_assigned[$t] += $inv['assigned'];
+ $total_available[$t] += $inv['available'];
+ $total_sold[$t] += ($inv['assigned'] - $inv['available']);
+
+ }
+
+ $sum[$event_id]['total_properties'] = $total_properties;
+ $sum[$event_id]['total_assigned'] = $total_assigned;
+ $sum[$event_id]['total_available'] = $total_available;
+ $sum[$event_id]['total_sold'] = $total_sold;
+
+ // Calculate overall uptake rate per day
+ $ta = 0;
+ $ts = 0;
+ $daily_uptake = array();
+ while (list($k, $v) = each($total_assigned)) {
+ $ta += $v;
+ $ts += $total_sold[$k];
+
+ // Calculate uptake rate for this day
+ $sum[$event_id]['daily_uptake'][$k] = sprintf('%.2f', (($total_sold[$k] / $v) * 100) )."%";
+ }
+ $sum[$event_id]['overall_uptake'] = sprintf('%.2f', (($ts / $ta) * 100) )."%";
+
+ $have_summary = true;
+
+ }
+
+ $r = array(
+ 'inventory' => $inventoryList,
+ 'firstDate' => $firstDate,
+ 'type' => $type,
+ 'dates' => $dates,
+ 'sum' => $sum,
+ 'have_sum' => $have_summary
+ );
+
+ return $r;
+
+ }
+
+
+ /**
+ * Get Inventory Detail
+ *
+ * @return array
+ */
+ function getInvenDetail($invID = false)
+ {
+
+ // If an inventory ID is supplied
+ if ($invID) {
+ $inventoryID = $invID;
+
+ // Otherwise is there a new inventory item selected selected?
+ } elseif (($inventoryID = filter_input(INPUT_GET, 'InvenID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Inven'] = $inventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Inven'])) {
+
+ // Otherwise, get the inventory ID from the session
+ $inventoryID = $_SESSION[GLM_EVENT_SESSION]['Inven'];
+
+ } else {
+
+ // Otherwise, we don't have an inventory id
+ return false;
+
+ }
+
+ $inventoryDetail = $this->getEntry($inventoryID);
+
+ return $inventoryDetail;
+
+ }
+
+
+ /**
+ * Edit Inventory
+ *
+ * @return array
+ */
+ function editInven()
+ {
+
+ if (($invenID = filter_input(INPUT_GET, 'InvenID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Inven'] = $invenID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Inven'])) {
+
+ // Otherwise, get the inventory ID from the session
+ $invenID = $_SESSION[GLM_EVENT_SESSION]['Inven'];
+
+ } else {
+
+ // Otherwise, we don't have an inventory id
+ return false;
+
+ }
+
+ $invenDetail = $this->editEntry($invenID);
+
+ return $invenDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Inventory
+ *
+ * @return array
+ */
+ function updateInven()
+ {
+
+ if (($invenID = filter_input(INPUT_GET, 'InvenID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Inven'] = $invenID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Inven'])) {
+
+ // Otherwise, get the inventory ID from the session
+ $invenID = $_SESSION[GLM_EVENT_SESSION]['Inven'];
+
+ } else {
+
+ // Otherwise, we don't have a inventory id
+ return false;
+
+ }
+
+ // Assume no delete and no delete failure
+ $delete = false;
+ $deleteFail = false;
+ $reason = array();
+
+ // Check if we have valid data
+ $r = $this->updateEntry($invenID, 'id', false);
+ if ($r['status']) {
+
+ // check if this is a Delete request
+ if (isset($_REQUEST['submitType']) && $_REQUEST['submitType'] == 'Delete Selected Inventory') {
+
+ // Check if there are room block associated with this inventory
+ $sql = "
+ SELECT COUNT(id)
+ FROM eventmgt.room_block_seg
+ WHERE event = ".$r['fieldData']['event_id']."
+ AND accommodation = ".$r['fieldData']['accommodation_id'].";
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $blockData = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($blockData['count'] > 0) {
+ // Can't delete because room blocks associated with this inventory exist
+ $r['status'] = false;
+ $reason[] = 'The selected inventory is in use in a room block.';
+ $reason[] = 'Delete the room block first if you want to delete this inventory.';
+ $delete = false;
+ $deleteFail = true;
+ } else {
+ // No room blocks so inventory may be deleted.
+ $delete = true;
+ }
+ }
+
+ // Check if this is only the original date
+ if ($r['fieldStore']['date'] == $r['fieldStore']['end_date'] &&
+ $r['fieldData']['date']['date'] == $_REQUEST['original_date']) {
+
+ $fields = $this->fields;
+ unset($fields['end_date']);
+ $this->fields = $fields;
+
+ // It's only the original date, so do again but store it this time or delete it
+ if ($delete) {
+
+ // Delete requested
+ $sql = "DELETE FROM eventmgt.inventory
+ WHERE id = ".$r['fieldData']['id'].";";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ $r['fieldData']['date']['date'] .= " *** DELETED *** ";
+
+ } else {
+
+ $r = $this->updateEntry($invenID);
+
+ }
+
+ } else { // This is either not the original date or it's a date range
+
+ // Check for sane dates
+ if ($r['fieldData']['date']['timestamp'] > $r['fieldData']['end_date']['timestamp']) {
+
+ $r['status'] = false;
+ $r['fieldFail']['end_date'] = "Must be equal to or later than From Date.";
+
+ } else {
+
+ $accom_id = ($_REQUEST['accom_id'] - 0);
+ $event_id = ($_REQUEST['event_id'] - 0);
+ $memb_id = ($_REQUEST['member_id'] - 0);
+
+ // Delete any inventory for this accommodation and event
+ $sql = "DELETE FROM eventmgt.inventory
+ WHERE event = ".$event_id."
+ AND accommodation = ".$accom_id."
+ AND date >= '".$r['fieldData']['date']['date']."'
+ AND date <= '".$r['fieldData']['end_date']['date']."';";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ // Check if this is a request to delete the inventory
+ if (isset($_REQUEST['submitType']) && $_REQUEST['submitType'] == 'Delete Selected Inventory') {
+ $r['fieldData']['date']['date'] .= " through ".$r['fieldData']['end_date']['date'].' *** DELETED ***';
+ } else {
+
+ // Insert updated inventory for date range (note incriment is a bit more to accommodate leap seconds)
+ $sql = "INSERT INTO eventmgt.inventory
+ (date, member, accommodation, event, assigned, available, rate)
+ VALUES
+ ('{date}', $memb_id, $accom_id, $event_id, ".$r['fieldStore']['assigned'].",
+ ".$r['fieldStore']['available'].", ".$r['fieldStore']['rate']."
+ );
+ ";
+
+ // For each date, create new inventory.
+ for ($d = $r['fieldData']['date']['timestamp'] ;
+ $d <= $r['fieldData']['end_date']['timestamp'] ;
+ $d = strtotime(date('m/d/Y', $d+86500))) {
+
+ $date = date('m/d/Y', $d);
+ $s = str_replace('{date}', $date, $sql);
+ $stmt = $this->dbh->prepare($s);
+ $stmt->execute();
+
+ }
+
+ // Change date on detail display to show range
+ $r['fieldData']['date']['date'] .= " through ".$r['fieldData']['end_date']['date'];
+ }
+ }
+ }
+
+ }
+
+ // Check if there was a delete failure
+ if ($deleteFail) {
+ $r['status'] = false;
+ if (is_array($r['reason'])) {
+ $reason = array_merge($r['reason'], $reason);
+ }
+ $r['reason'] = $reason;
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add Inventory
+ *
+ * @return array
+ */
+ function addInven()
+ {
+ $reason = array();
+
+ // Make sure an Event has been selected.
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ $reason[] = "No event has been selected. Please select an Event and Property before adding inventory.";
+ }
+
+ // Get selected event and property data
+ $eventData = $this->getEventMemberData($eventID);
+
+ // Set dates to default to event dates
+ $this->fields['start_date']['default'] = strtotime($eventData['event_start_date']);
+ $this->fields['end_date']['default'] = strtotime($eventData['event_end_date']);
+ $this->fields['min_nights']['default'] = $eventData['event_days'];
+
+ // Get new entry fields
+ $r = $this->newEntry();
+
+ // Check for available properties/accommodations
+ if (count($r['fieldData']['accommodation']['pick_list']) == 0) {
+ $r['status'] = false;
+ $r['reason'][] = 'No property accommodations in system to select from. Please add accommodations to a property.';
+ }
+
+ // Add in static Event and Property data
+ $r['fieldData'] = array_merge($r['fieldData'], $eventData);
+
+ // Add in member/accommodation data
+ $membAccom = $this->getMembAccomMatrix();
+ $r['membAccom'] = $membAccom;
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Inventory
+ *
+ * @return array
+ */
+ function insertInven()
+ {
+
+ // Get selected event and property data using ID's passed from form
+ $eventID = ($_REQUEST['event'] - 0);
+ $memberID = ($_REQUEST['member'] - 0);
+ $eventData = $this->getEventMemberData($eventID);
+
+ // Process input, but don't store any result
+ $r = $this->insertEntry(false);
+
+ // Add in static Event and Property data
+ $r['fieldData'] = array_merge($r['fieldData'], $eventData);
+
+ // Check for sane dates
+ if ($r['fieldData']['start_date']['timestamp'] > $r['fieldData']['end_date']['timestamp']) {
+ $r['status'] = false;
+ $r['fieldFail']['start_date'] = 'First date may not be later than last date when creating inventory.';
+ }
+
+ if ($memberID > 0 && $r['status'] ) {
+
+ // Check for existing inventory conflicting with this new inventory
+ $sql = "SELECT count(id)
+ FROM eventmgt.inventory
+ WHERE event = $eventID
+ AND member = $memberID
+ AND accommodation = ".$r['fieldStore']['accommodation']."
+ AND date BETWEEN ".$r['fieldStore']['start_date']." AND ".$r['fieldStore']['end_date']."
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if ($eventData['count'] > 0) {
+ $r['status'] = false;
+ $r['fieldFail']['start_date'] = 'Inventory already exists for at least one of the dates requested.';
+ }
+ }
+
+ if ($memberID == 0) {
+ $r['fieldFail']['member'] = 'Member is required.';
+ }
+
+ // If it's OK to create the inventory
+ if ($r['status']) {
+
+ // Add each night as separate inventory item
+ $s = $r['fieldData']['start_date']['timestamp'];
+ $e = $r['fieldData']['end_date']['timestamp'];
+ $sql = array();
+ for ($date=$s ; $date<=$e ; $date=strtotime(date('m/d/Y',$date)." +1 day")) {
+ $sql[] = "INSERT INTO eventmgt.inventory
+ (event, member, accommodation, date, assigned, available, rate)
+ VALUES
+ (
+ $eventID, $memberID, ".$r['fieldStore']['accommodation'].",
+ '".date('m/d/Y',$date)."', ".$r['fieldStore']['assigned'].",
+ ".$r['fieldStore']['assigned'].", ".$r['fieldStore']['rate']."
+ );
+ \n";
+ }
+/* Not using event_prop table anymore
+ // Check for existing event/property table entry
+ $sql2 = "SELECT count(id)
+ FROM eventmgt.event_prop
+ WHERE event = $eventID
+ AND property = $memberID
+ ;";
+ $stmt = $this->dbh->prepare($sql2);
+ $stmt->execute();
+ $eventpropData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // If there's not an entry, add one
+ if ($eventpropData['count'] == 0) {
+ $sql[] = "INSERT INTO eventmgt.event_prop
+ (event, property)
+ VALUES
+ ($eventID, $memberID)
+ ;";
+
+ }
+*/
+ // Try to add this inventory
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ $r['status'] = false;
+ $r['reason'][] = 'Unable to store new inventory for unknown reason. ';
+ // var_dump($e);
+ }
+
+ // Add to event-property table
+ }
+
+ // Add in member/accommodation data
+ $membAccom = $this->getMembAccomMatrix();
+ if ($memberID > 0) {
+ $r['membSelected'] = $membAccom[$memberID];
+ $membAccom[$memberID]['selected'] = true;
+ }
+ $r['membAccom'] = $membAccom;
+
+ // Check for selected accommodation
+ $a = ($r['fieldData']['accommodation']['in'] - 0);
+ if ($a > 0) {
+ $r['membSelected']['accoms'][$a]['selected'] = true;
+ }
+
+
+ // If succesful then set current inventory to the one just inserted.
+ if ($r['status']) {
+
+ $sql = "select currval('inventory_id_seq');";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $last = $stmt->fetch(PDO::FETCH_ASSOC);
+ $r['insertedID'] = $last['currval'] ;
+
+ }
+
+ return $r;
+
+ }
+
+
+
+ /**
+ * getMembAccomMatrix
+ *
+ * @param integer $memberID
+ */
+ function getMembAccomMatrix()
+ {
+
+ // Get property/accommodation matrix
+ if (count($reason) == 0) {
+ $sql = "SELECT M.id AS memb_id,
+ M.name AS memb_name,
+ A.id AS accom_id,
+ A.name AS accom_name
+ FROM eventmgt.member M, eventmgt.accommodation A
+ WHERE A.member = M.id
+ ORDER BY M.name, A.sort
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $membAccomData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($membAccomData) == 0) {
+ $reason[] = "No properties with accommodations are currently listed in the system.";
+ }
+ }
+
+ // Build array of Members with their accommodations
+ $membAccom = array();
+ foreach ($membAccomData as $d) {
+
+ // If member hasn't been added to array yet
+ if (!isset($membAccom[$d['memb_id']])) {
+ $membAccom[$d['memb_id']] = array(
+ 'membID' => $d['memb_id'],
+ 'membName' => $d['memb_name'],
+ 'accoms' => array()
+ );
+ }
+
+ // Add this accommodation
+ $membAccom[$d['memb_id']]['accoms'][$d['accom_id']] = array(
+ 'accomID' => $d['accom_id'],
+ 'accomName' => $d['accom_name']
+ );
+ }
+
+ return $membAccom;
+ }
+
+ /**
+ * Get Event and Member information for specified event and member ID
+ *
+ * @param integer $eventID
+ * @param integer $memberID
+ */
+ function getEventMemberData($eventID)
+ {
+ // Get event Data
+ $sql = "SELECT name, event_code, start_date, end_date, days
+ FROM eventmgt.event
+ WHERE id = $eventID;
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Add event information to returned array
+ $r['event'] = $eventData['name'];
+ $r['event_code'] = $eventData['event_code'];
+ $r['event_id'] = $eventID;
+ $r['event_days'] = $eventData['days'];
+ $r['event_start_date'] = $eventData['start_date'];
+ $r['event_end_date'] = $eventData['end_date'];
+
+/*
+ // Get property Data
+ $sql = "SELECT name
+ FROM eventmgt.member
+ WHERE id = $memberID;
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $memberData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Add event information to returned array
+ $r['member'] = $memberData['name'];
+ $r['member_id'] = $memberID;
+*/
+ return $r;
+
+ }
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataMemberScansFor.php b/classes/data/dataMemberScansFor.php
new file mode 100644
index 0000000..79d6da1
--- /dev/null
+++ b/classes/data/dataMemberScansFor.php
@@ -0,0 +1,234 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMemberScansFor.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataMemberScansFor class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMemberScansFor,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataMemberScansFor extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.member_scans_for';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Pointer to a member who does the scanning
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Name of member who does the scanning
+ 'member_name' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Pointer to a member who the scanning is for
+ 'scans_for' => array(
+ 'field' => 'scans_for',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Name of member who does the scanning
+ 'scans_for_name' => array(
+ 'field' => 'scans_for',
+ 'as' => 'scans_for_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ )
+
+ );
+ }
+
+ /**
+ * Get List
+ *
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getMemberScansForList($memberID = false)
+ {
+
+ // if member ID is not supplied, try to find it
+ if ($memberID == false) {
+
+ // Check submit input
+ $memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT);
+
+ // If we still don't have it
+ if ($memberID == false || $memberID < 1) {
+
+ // Try the session
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ }
+
+ }
+
+ }
+
+ // If we still don't have a valid member ID
+ if ($memberID == false || ($memberID - 0) <= 0) {
+ return false;
+ }
+
+ $where = "T.member = $memberID";
+
+ // Get the list of members a member scans for
+ $memberScansFor = $this->getList($where);
+ if (count($memberScansFor) == 0) {
+ return false;
+ }
+
+ return $memberScansFor;
+
+ }
+
+ /**
+ * Update member scans for list
+ *
+ * Expects request input "selectedMember[id]" array.
+ */
+
+ public function updateMemberScansForList($memberID = false)
+ {
+
+ if ($memberID == false) {
+ return false;
+ }
+
+ // Query to delete current Member Scans For list
+ $sql = "
+ BEGIN;
+ DELETE FROM eventmgt.member_scans_for
+ WHERE member = $memberID;
+ ";
+
+ // Now add in any members who this member will be scanning for
+ $newMembers = $_REQUEST['selectedMember'];
+ if ($newMembers) {
+ foreach ($newMembers as $m) {
+ $sql .= "
+ INSERT INTO eventmgt.member_scans_for
+ ( member, scans_for )
+ VALUES ( $memberID, $m )
+ ;";
+ }
+ }
+ $sql .= "COMMIT;";
+ $this->dbh->exec($sql);
+
+ return $this->getMemberScansForList($memberID);
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php
new file mode 100644
index 0000000..9871c92
--- /dev/null
+++ b/classes/data/dataMembers.php
@@ -0,0 +1,1219 @@
+
+ * @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.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataMembers 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.gaslightmedia.com/
+ */
+class EventManagementDataMembers extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.member';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Member Type
+ 'member_type' => array(
+ 'field' => 'member_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->member_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // E-Mail
+ 'email' => array(
+ 'field' => 'email',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Processing E-Mail
+ 'proc_email' => array(
+ 'field' => 'proc_email',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Processing E-Mail #2
+ 'proc_email2' => array(
+ 'field' => 'proc_email2',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notify member of each checkout
+ 'checkout_notify' => array(
+ 'field' => 'checkout_notify',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => true,
+ 'use' => 'a'
+ ),
+
+ // Check In Time
+ 'check_in' => array(
+ 'field' => 'check_in',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Check Out Time
+ 'check_out' => array(
+ 'field' => 'check_out',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Defalut Ticket Policy
+ 'def_ticket_pol' => array(
+ 'field' => 'def_ticket_pol',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+
+ /*
+ * Fields used whether or not we're using an integrated member database
+ */
+
+/* not using policies at this level for now
+ // Defalut Reservation Policy
+ 'def_res_pol' => array(
+ 'field' => 'def_res_pol',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+
+ // Defalut Cancel Policy
+ 'def_can_pol' => array(
+ 'field' => 'def_can_pol',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+*/
+ // Member amenity #1
+ 'amen_1' => array(
+ 'field' => 'amen_1',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #2
+ 'amen_2' => array(
+ 'field' => 'amen_2',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #3
+ 'amen_3' => array(
+ 'field' => 'amen_3',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #4
+ 'amen_4' => array(
+ 'field' => 'amen_4',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #5
+ 'amen_5' => array(
+ 'field' => 'amen_5',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #6
+ 'amen_6' => array(
+ 'field' => 'amen_6',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #7
+ 'amen_7' => array(
+ 'field' => 'amen_7',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #8
+ 'amen_8' => array(
+ 'field' => 'amen_8',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #9
+ 'amen_9' => array(
+ 'field' => 'amen_9',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #10
+ 'amen_10' => array(
+ 'field' => 'amen_10',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Intro Text for front-end
+ 'intro_text' => array(
+ 'field' => 'intro_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Checkout E-Mail
+ 'checkout_email' => array(
+ 'field' => 'checkout_email',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+
+ /*
+ * Fields used if we're using an integrated member database
+ */
+ if ($this->config->option->member_db_integrated) {
+
+ $integratedDb = array(
+
+ // Member name - From main member db - Used only if db is Integrated
+ 'member_name' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ // Only permit members set at providing accommodations
+ 'p_where' => 'member_id in
+ (
+ SELECT DISTINCT member_id
+ FROM members.member_category
+ WHERE category_id IN
+ (SELECT category_id FROM members.category WHERE accommodations)
+ )',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Member name - From main member db - Used only if db is Integrated
+ 'member_name_view' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member login - From main member db - Used only if db is Integrated
+ 'member_login_view' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_login',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_login',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member password - From main member db - Used only if db is Integrated
+ 'member_passwd_view' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_passwd',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_passwd',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Street Address - From main member db
+ 'member_street' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'street',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'street',
+ 'p_id' => 'member_id',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member City - From main member db
+ 'member_city' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'city',
+ 'type' => 'pointer',
+ 'p_table' => 'members.city',
+ 'p_field' => 'city_name',
+ 'p_id' => 'city_id',
+ 'p_where' => 'M.member_id = T.id AND city.city_id = M.city_id',
+ 'p_from' => 'members.member M',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member phone - From main member db
+ 'member_phone' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'phone',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'phone',
+ 'p_id' => 'member_id',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Lat - From main member db
+ 'member_lat' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'lat',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'lat',
+ 'p_id' => 'member_id',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Lon - From main member db
+ 'member_lon' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'lon',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'lon',
+ 'p_id' => 'member_id',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member number of rooms at property
+ 'prop_rooms' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'prop_rooms',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member_accommodations',
+ 'p_field' => 'num_rooms',
+ 'p_id' => 'member_id',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ )
+
+ );
+
+ $this->fields = array_merge($this->fields, $integratedDb);
+
+ }
+
+
+ /*
+ * Fields used if we're not using an integrated database
+ */
+ if (!$this->config->option->member_db_integrated) {
+
+ $nonIntegratedDb = array(
+
+ // Member Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 1
+ 'addr1' => array(
+ 'field' => 'addr1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 2
+ 'addr2' => array(
+ 'field' => 'addr2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // City
+ 'city' => array(
+ 'field' => 'city',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->states->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 'MI',
+ 'use' => 'a'
+ ),
+
+ // Country
+ 'country' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->countries->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // ZIP
+ 'zip' => array(
+ 'field' => 'zip',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Latitude
+ 'lat' => array(
+ 'field' => 'lat',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 45,
+ 'use' => 'a'
+ ),
+
+ // Longitude
+ 'lon' => array(
+ 'field' => 'lon',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => -84,
+ 'use' => 'a'
+ ),
+
+ // Member phone - From main member db
+ 'phone' => array(
+ 'field' => 'phone', // ID in member table is same as in eventmgt.member
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Cards Accepted - multi-pick
+ 'cards_accepted' => array(
+ 'field' => 'cards_accepted',
+ 'as' => false,
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config->ccard->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0, // Note that this is a bitmap of card indexes
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway
+ 'payment_gateway' => array(
+ 'field' => 'payment_gateway',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ccard_processor->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => '99',
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 1 (Authorize.net: login, Merchant Solutions: acctid)
+ 'gateway_par1' => array(
+ 'field' => 'gateway_par1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 2 (Authorize.net: key, Merchant Solutions: merchantpin)
+ 'gateway_par2' => array(
+ 'field' => 'gateway_par2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 3 (Authorize.net: test, Merchant Solutions: n/a)
+ // test: LOCAL_TEST, LOCAL_FAIL, TRUE, FALSE (Must be FALSE for production)
+ 'gateway_par3' => array(
+ 'field' => 'gateway_par3',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->cc_mode->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 4 (Authorize.net: Send Conf Flag, Merchant Solutions: n/a)
+ 'gateway_par4' => array(
+ 'field' => 'gateway_par4',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 5 (Authorize.net: Merchant Email, Merchant Solutions: n/a)
+ 'gateway_par5' => array(
+ 'field' => 'gateway_par5',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal enabled flag
+ 'paypal' => array(
+ 'field' => 'paypal',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal Client ID
+ 'paypal_client_id' => array(
+ 'field' => 'paypal_client_id',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal Secret
+ 'paypal_secret' => array(
+ 'field' => 'paypal_secret',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal payment mode
+ // test:
+ 'paypal_mode' => array(
+ 'field' => 'paypal_mode',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->paypal_mode->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Parking Map
+ 'parking_map' => array(
+ 'field' => 'parking_map',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Sector Map
+ 'ticket_sec_map' => array(
+ 'field' => 'ticket_sec_map',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Policy
+ 'ticket_policy' => array(
+ 'field' => 'ticket_policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Special Request Accepted
+ 'ticket_spec_req' => array(
+ 'field' => 'ticket_spec_req',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Sort order
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ ),
+
+ // Member account active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+ );
+
+ $this->fields = array_merge($this->fields, $nonIntegratedDb);
+
+ }
+
+ }
+
+ /**
+ * Get Members list
+ *
+ * @param string type of events list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMembersList($option = 'event', $where = 'TRUE', $sort = 'name')
+ {
+
+ // Check if a member ID was submitted
+ $locationID = filter_input(INPUT_GET, 'locationID', FILTER_SANITIZE_NUMBER_INT);
+ if ($locationID) {
+ $option = 'member';
+ }
+
+ if ($option == 'all') {
+ $_SESSION[GLM_EVENT_SESSION]['Event'] = false;
+ }
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get any specified member listing option - default to event
+ if (($membersListOption = filter_input(INPUT_GET, 'MembersListOption', FILTER_SANITIZE_STRING))) {
+ $option = $membersListOption;
+ }
+
+ // Select type of list
+ $sortByDist = false;
+ switch ($option) {
+
+ case 'all':
+ break;
+
+ case 'active':
+ $where .= ' AND active';
+ break;
+
+ case 'accom':
+ $where .= " AND id in
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.accommodation
+ )
+ ";
+ break;
+
+ case 'member':
+ $where .= " AND active AND id = ".($locationID - 0);
+ break;
+
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where .= "AND id IN
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.inventory
+ WHERE conv = $eventID
+ )
+ ";
+ /* Not using event_prop anymore
+ SELECT DISTINCT property
+ FROM eventmgt.event_prop
+ WHERE event = $eventID
+ */
+ $sortByDist = true;
+ break;
+
+ case 'type1':
+ $where .= " AND member_type = 1 AND active";
+ break;
+
+ case 'type2':
+ $where .= " AND member_type = 2 AND active";
+ break;
+
+ case 'type3':
+ $where .= " AND member_type = 3 AND active";
+ break;
+
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get Members List
+ $membersList = $this->getList($where, $sort);
+
+ // Add distances to the member data and sort by distance
+ if ($sortByDist) {
+ if (!class_exists('EventManagementGeoCalculations')) {
+ require COMMON_APP_BASE.APP_VERSION.'/classes/GeoCalculations.php';
+ }
+ $Geo = new EventManagementGeoCalculations($this->dbh);
+ $membersList = $Geo->getMemberEventDistance( $eventID, $membersList, 'lat', 'lon', 'distance', 'duration', 'id', true);
+ }
+
+ // echo "
".print_r($membersList,1)."
";
+ return $membersList;
+ }
+
+
+ /**
+ * Get Member Detail
+ *
+ * @return array
+ */
+ function getMemberDetail($memberID = false)
+ {
+ $this->optionIncludeSelectListData = false;
+
+ // If a member ID has been supplied
+ if ($memberID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise if there a new member ID supplied via the request
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the event ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have an event id
+ return false;
+
+ }
+
+ $memberDetail = $this->getEntry($memberID);
+
+ // echo "
".print_r($memberDetail,1)."
";
+ return $memberDetail;
+
+ }
+
+
+ /**
+ * Edit Member
+ *
+ * @return array
+ */
+ function editMember()
+ {
+ // Is there a new member code selected?
+ if (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the member ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have a member id
+ return false;
+
+ }
+
+ $memberDetail = $this->editEntry($memberID);
+
+ return $memberDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Member
+ *
+ * @return array
+ */
+ function updateMember()
+ {
+
+ // Is there a new event code selected?
+ if (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the member ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have a member id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($memberID);
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Member
+ *
+ * @return array
+ */
+ function insertMember()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current member to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete Member
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function memberDelete($confirm = false)
+ {
+
+ // Is there a new member code selected?
+ if (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the member ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have a member id
+ return false;
+
+ }
+
+ /*
+ * Delete all supporting information
+ *
+ * Contacts
+ * Performance
+ * Sections
+ * Events
+ * Tickets
+ * Ticket inventory
+ * Orders
+ * Sold
+ *
+ *
+ * inven_hold gets cleaned out and does not need to be deleted
+ */
+/*
+ DELETE FROM eventmgt.ticket_order
+ WHERE member = $memberID;
+ DELETE FROM eventmgt.ticket_sold
+ WHERE member = $memberID;
+*/
+ $sql = "
+ DELETE FROM eventmgt.res_contact
+ WHERE contact_type = ".$this->config->reference_type->member."
+ AND affiliation = $memberID;
+ DELETE FROM eventmgt.section
+ WHERE member = $memberID;
+ DELETE FROM eventmgt.ticket_inventory
+ WHERE ticket in (
+ SELECT id
+ FROM eventmgt.ticket
+ WHERE member = $memberID
+ );
+ DELETE FROM eventmgt.ticket
+ WHERE member = $memberID;
+ DELETE FROM eventmgt.performance
+ WHERE member = $memberID;
+ ";
+ $this->dbh->exec($sql);
+
+ // Delete member and return their old data
+ $memberDetail = $this->deleteEntry($memberID, $confirm);
+
+ return $memberDetail;
+
+ }
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataMisc.php b/classes/data/dataMisc.php
new file mode 100644
index 0000000..ca124a7
--- /dev/null
+++ b/classes/data/dataMisc.php
@@ -0,0 +1,283 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMisc.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataMisc class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMisc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataMisc extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.misc';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // ID - in this table there's only one entry and the ID is always 1
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for intro page
+ 'intro_text' => array(
+ 'field' => 'intro_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for section selection page
+ 'section_text' => array(
+ 'field' => 'section_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for ticket selection page
+ 'ticket_text' => array(
+ 'field' => 'ticket_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for ticket date, time, section, quantity, selection page
+ 'ticket_opt_text' => array(
+ 'field' => 'ticket_opt_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for cart page
+ 'cart_text' => array(
+ 'field' => 'cart_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for checkout page
+ 'checkout_text' => array(
+ 'field' => 'checkout_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for checkout success page
+ 'success_text' => array(
+ 'field' => 'success_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Google tracking script for checkout page
+ 'tracking' => array(
+ 'field' => 'tracking',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // No payment reasons for admin checkout
+ 'no_payment_reasons' => array(
+ 'field' => 'no_payment_reasons',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #1
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #2
+ 'opt_field_2_name' => array(
+ 'field' => 'opt_field_2_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #3
+ 'opt_field_3_name' => array(
+ 'field' => 'opt_field_3_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // SSL Certificate Seal Head Script
+ 'ssl_seal_head_script' => array(
+ 'field' => 'ssl_seal_head_script',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // SSL Certificate Seal Body Script
+ 'ssl_seal_body_script' => array(
+ 'field' => 'ssl_seal_body_script',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Central Payment Location
+ 'central_payment' => array(
+ 'field' => 'central_payment',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Central Payment Location ID
+ 'central_payment_id' => array(
+ 'field' => 'central_payment',
+ 'as' => 'central_payment_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'g'
+ )
+
+ );
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/classes/data/dataOrders.php b/classes/data/dataOrders.php
new file mode 100644
index 0000000..2850a64
--- /dev/null
+++ b/classes/data/dataOrders.php
@@ -0,0 +1,714 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataOrders.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataOrders,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataOrders extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_order';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // user_trace_info
+ 'user_trace_info' => array(
+ 'field' => 'user_trace_info',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // First Name
+ 'fname' => array(
+ 'field' => 'fname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Last Name
+ 'lname' => array(
+ 'field' => 'lname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 1
+ 'addr1' => array(
+ 'field' => 'addr1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 2
+ 'addr2' => array(
+ 'field' => 'addr2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // First Name
+ 'city' => array(
+ 'field' => 'city',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Contact State
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->states->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 'MI',
+ 'use' => 'a'
+ ),
+
+ // Contact Country
+ 'country' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->countries->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Contact ZIP
+ 'zip' => array(
+ 'field' => 'zip',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Phone
+ 'phone' => array(
+ 'field' => 'phone',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // E-Mail
+ 'email' => array(
+ 'field' => 'email',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // E-Mail OK
+ 'email_ok' => array(
+ 'field' => 'email_ok',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Purchase Date
+ 'purchase_date' => array(
+ 'field' => 'purchase_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => time(),
+ 'use' => 'lged'
+ ),
+
+ // Member ID
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // CC Type
+ 'cctype' => array(
+ 'field' => 'cctype',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // CC Number
+ 'ccnumber' => array(
+ 'field' => 'ccnumber',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // CC Expiration$_SESSION[GLM_EVENT_SESSION]['Ticket']
+ 'expire' => array(
+ 'field' => 'expire',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // Name on Card
+ 'ccname' => array(
+ 'field' => 'ccname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // CC Confirmation #
+ 'ccconf' => array(
+ 'field' => 'ccconf',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // Charge Number
+ 'charge_numb' => array(
+ 'field' => 'charge_total',
+ 'as' => 'charge_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Charge Total Money
+ 'charge_total' => array(
+ 'field' => 'charge_total',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // Special Needs
+ 'special_needs' => array(
+ 'field' => 'special_needs',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #1
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field #1
+ 'opt_field_1' => array(
+ 'field' => 'opt_field_1',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field Name #2
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field #2
+ 'opt_field_2' => array(
+ 'field' => 'opt_field_2',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field Name #3
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field #3
+ 'opt_field_3' => array(
+ 'field' => 'opt_field_3',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+
+ /**
+ * Get Orders list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getOrdersList($memberID = false, $performanceID = false, $sectionID = false, $listType = false)
+ {
+
+ // Get member ID
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+
+ // Get performance ID
+ if ($performanceID == false) {
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+ }
+
+ // Get section ID
+ if ($sectionID == false) {
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+ }
+
+ // Get URI search type
+ if (!$listType && isset($_REQUEST['listType'])) {
+ $listType = $_REQUEST['listType'];
+ }
+
+ // Build query Where clause
+ $where = 'true';
+
+ switch ($listType) {
+
+ case 'norm':
+ default:
+ if ($memberID) {
+ $where .= " AND T.member = $memberID";
+ }
+ if ($performanceID) {
+ $where .= " AND T.performance = $performanceID";
+ }
+ if ($sectionID) {
+ $where .= " AND T.section = $sectionID";
+ }
+ break;
+
+ case 'all':
+ break;
+
+ }
+
+ // Get list of Orders
+ $ordersList = $this->getList($where, 'purchase_date');
+
+ return $ordersList;
+ }
+
+ /**
+ * Get Order Detail
+ *
+ * @return array
+ */
+ function getOrderDetail($orderID = false, $memberID = false)
+ {
+
+ // If a order has been specified
+ if ($orderID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ // Otherwise if there's a order ID in the request
+ } elseif (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ $where = '';
+ if ($memberID) {
+ $where = "AND T.member = $memberID";
+ }
+
+ $orderDetail = $this->getEntry($orderID, 'id', $where);
+
+ // If we have a member ID then make sure the sold ticket is for that member
+ if ($memberID && $orderDetail['member'] != $memberID) {
+ return false;
+ }
+
+ return $orderDetail;
+
+ }
+
+
+ /**
+ * Edit Order
+ *
+ * @return array
+ */
+ function editOrder()
+ {
+
+ if (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ // Otherwise, get the order ID from the session
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ $orderDetail = $this->editEntry($orderID);
+
+ return $orderDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Order
+ *
+ * @return array
+ */
+ function updateOrder()
+ {
+
+ if (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ // Otherwise, get the order ID from the session
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($orderID);
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Order
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ * @param $orderID int If supplied, use for order ID, otherwise check for orderID REQUEST param.
+ *
+ * @return int Deleted order ID or false if fail
+ */
+ function orderDelete($confirm = false, $orderID = false)
+ {
+
+ $orderID = $orderID - 0;
+
+ // If an order wasn't supplied in the function call or it's not a positive integer
+ if ($orderID <= 0) {
+
+ $orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT);
+ $orderID = $orderID - 0;
+
+ // Is there isn't a new order ID provided on the URL
+ if ($orderID <= 0) {
+ echo "
No valid order ID supplied.
";
+ return false;
+ }
+
+ }
+
+ // Get order to validate order ID
+ $orderDetail = $this->getEntry($orderID);
+ if (!$orderDetail) {
+ echo "
Order ID $orderID not found.
";
+ return false;
+ }
+
+ $sql = "BEGIN;\n";
+
+ // Build query to delete add_on_sold data
+ $sql .= "DELETE FROM eventmgt.add_on_sold WHERE ticket_order = $orderID;\n";
+
+ // Build query to delete promo_sold data
+ $sql .= "DELETE FROM eventmgt.promo_sold WHERE ticket_order = $orderID;\n";
+
+ // Get list of tickets sold in this order
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSold.php';
+ $Sold = new EventManagementDataSold($this->dbh, $this->config);
+ $sold = $Sold->getSoldList($orderID);
+ if (!$sold) {
+ echo "
No tickets found for order ID $orderID.
";
+ return false;
+ }
+
+ // Build query to update inventory for each ticket sold and to delete the ticket sold
+ foreach ($sold as $s) {
+
+ // If this is not a package sold item, adjust inventory - Only the tickets in a package get processed
+ if (!$s['ticket_package']) {
+
+ // Note that we don't check to see if the ticket is marked as having unlimited quantity. If it's unlimited, decrementing the inventory has no effect.
+
+ // If this is a date specific ticket, specify the inventory for that date
+ $dateWhere = '';
+ if ($s['date_specific']['value']) {
+ $dateWhere = " AND ticket_date = '".$s['ticket_date']['date']."'";
+ }
+
+ // If this is a time specific ticket, specify the inventory for that time
+ $timeWhere = '';
+ if ($s['time_specific']['value']) {
+ $timeWhere = " AND ticket_time = '".$s['ticket_time']['time']."'";
+ }
+
+ // Build the query for this ticket sold to adjust the inventory levels
+ $sql .= "UPDATE eventmgt.ticket_inventory SET available = available + 1, sold = sold - 1 WHERE ticket = ".$s['ticket']."$dateWhere$timeWhere;\n";
+
+ }
+
+ }
+
+ // Build the query to delete the ticket_sold records
+ $sql .= "DELETE FROM eventmgt.ticket_sold WHERE ticket_order = $orderID;\n";
+
+ // Build the query to delete the ticket_claim_tracking records
+ $sql .= "DELETE FROM eventmgt.ticket_claim_tracking WHERE ticket_order = $orderID;\n";
+
+ // Lastly, build the query to delete the ticket_order record
+ $sql .= "DELETE FROM eventmgt.ticket_order WHERE id = $orderID;\n";
+
+ $sql .= "COMMIT\n";
+
+// echo "
$sql
";
+
+ $res = $this->dbh->exec($sql);
+
+ return $res;
+ }
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataPerformances.php b/classes/data/dataPerformances.php
new file mode 100644
index 0000000..66989e0
--- /dev/null
+++ b/classes/data/dataPerformances.php
@@ -0,0 +1,956 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPerformances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPerformances class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPerformances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataPerformances extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.performance';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Member ID for adding performances
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'nid'
+ ),
+
+ // Member ID for adding performances
+ 'member_id' => array(
+ 'field' => 'member',
+ 'as' => member_id,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Performance Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Admin Only Flag
+ 'admin_only' => array(
+ 'field' => 'admin_only',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Short Description
+ 'short_descr' => array(
+ 'field' => 'short_descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Purchase lead-time in hours
+ 'purch_leadtime' => array(
+ 'field' => 'purch_leadtime',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 24,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Policy
+ 'policy' => array(
+ 'field' => 'policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher Text
+ 'voucher_text' => array(
+ 'field' => 'voucher_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Confirmation E-Mail Text
+ 'conf_text' => array(
+ 'field' => 'conf_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promote in Cart
+ 'promote_in_cart' => array(
+ 'field' => 'promote_in_cart',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Sort order
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ /* Also get some member information in case we need it */
+
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Address line 1
+ 'member_addr1' => array(
+ 'field' => 'member',
+ 'as' => 'member_addr1',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'addr1',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Address line 2
+ 'member_addr2' => array(
+ 'field' => 'member',
+ 'as' => 'member_addr2',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'addr2',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member City
+ 'member_city' => array(
+ 'field' => 'member',
+ 'as' => 'member_city',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'city',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member State
+ 'member_state' => array(
+ 'field' => 'member',
+ 'as' => 'member_state',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'state',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member ZIP
+ 'member_zip' => array(
+ 'field' => 'member',
+ 'as' => 'member_zip',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'zip',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Country
+ 'member_country' => array(
+ 'field' => 'member',
+ 'as' => 'member_country',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'country',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member LAT
+ 'member_lat' => array(
+ 'field' => 'member',
+ 'as' => 'member_lat',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'lat',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member LON
+ 'member_lon' => array(
+ 'field' => 'member',
+ 'as' => 'member_lon',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'lon',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member phone
+ 'member_phone' => array(
+ 'field' => 'member',
+ 'as' => 'member_phone',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'phone',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member payment gateways
+ 'member_payment_gateway' => array(
+ 'field' => 'member',
+ 'as' => 'member_payment_gateway',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'payment_gateway',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member credit cards accepted
+ 'member_cards_accepted' => array(
+ 'field' => 'member',
+ 'as' => 'member_cards_accepted',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'cards_accepted',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member credit cards accepted
+ 'member_cards_accepted' => array(
+ 'field' => 'member',
+ 'as' => 'member_cards_accepted',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'cards_accepted',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member payment gateway parameter 1
+ 'member_gateway_par1' => array(
+ 'field' => 'member',
+ 'as' => 'member_gateway_par1',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'gateway_par1',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member payment gateway parameter 2
+ 'member_gateway_par2' => array(
+ 'field' => 'member',
+ 'as' => 'member_gateway_par2',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'gateway_par2',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+
+
+ );
+ }
+
+ /**
+ * Get Performances list
+ *
+ * @param $listType String A particular list type ('all', 'member', 'cart_promotions', ...)
+ * @return object containing array as sub-objects
+ */
+ function getPerformancesList($listType = false, $memberID = false, $includeAdminOnly = false)
+ {
+
+ $where = '';
+ $and = '';
+
+ // Determine if there's a list type request (otherwise default to call parameter $listType)
+ if (!$listType && isset($_REQUEST['listType'])) {
+ $listType = $_REQUEST['listType'];
+ $and = ' AND ';
+ }
+
+ // Check if adminUser
+ if (!$includeAdminOnly) {
+ $where .= $and.' NOT T.admin_only';
+ $and = ' AND ';
+ }
+
+ switch ($listType) {
+
+ case 'member':
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+ $where .= $and."member = $memberID";
+ break;
+
+ case 'member_and_active':
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+ $where .= $and."member = $memberID AND T.active";
+ break;
+
+ case 'cart_promotions':
+ $where .= $and."T.promote_in_cart AND T.active AND (SELECT active FROM eventmgt.member WHERE active = true AND member.id = T.member)";
+ break;
+
+ case 'all':
+ default:
+ break;
+
+ }
+
+ $performancesList = $this->getList($where, 'sort, name');
+
+ return $performancesList;
+ }
+
+ /**
+ * Get Performance Detail
+ *
+ * @return array
+ */
+ function getPerformanceDetail($performanceID = false)
+ {
+
+ $where = '';
+
+ // If a performance has been specified
+ if ($performanceID != false) {
+
+ // Don't do anything here
+
+ // Is there a new Performance code selected?
+ } elseif (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the performance ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a performance specified
+ return false;
+
+ }
+
+
+ $performanceDetail = $this->getEntry($performanceID, 'id', $where);
+
+ return $performanceDetail;
+
+ }
+
+
+ /**
+ * Edit Performance
+ *
+ * @return array
+ */
+ function editPerformance()
+ {
+
+ if (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $performanceDetail = $this->editEntry($performanceID);
+
+ return $performanceDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Performance
+ *
+ * @return array
+ */
+ function updatePerformance()
+ {
+
+ if (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($performanceID);
+
+ // If the update was successful and we ahve start and end dates, Set inventory outside of the dates set for this performance to inactive
+ $start = $r['fieldData']['start_date']['date'];
+ $end = $r['fieldData']['end_date']['date'];
+ if ($r['status'] && $r['fieldData']['start_date']['date'] != '' && $r['fieldData']['end_date']['date'] != '') {
+ $sql = "
+ UPDATE eventmgt.ticket_inventory
+ SET active = false
+ WHERE id in (
+ SELECT I.id
+ FROM eventmgt.ticket T, eventmgt.ticket_inventory I
+ WHERE T.performance = $performanceID
+ AND T.id = I.ticket
+ AND ( I.ticket_date < '$start' OR I.ticket_date > '$end')
+ )
+ ;";
+ $this->dbh->exec($sql);
+
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Performance
+ *
+ * @return array
+ */
+ function newPerformance()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Performance
+ *
+ * @return array
+ */
+ function insertPerformance()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current performance to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete Performance
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function performanceDelete($confirm = false)
+ {
+
+ // Is there a new performance code selected?
+ if (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the performance ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have an performance id
+ return false;
+
+ }
+
+ $performanceDetail = $this->deleteEntry($performanceID, $confirm);
+
+ return $performanceDetail;
+
+ }
+
+ /**
+ * Get Performance Inventory Summary
+ *
+ * @return array
+ */
+ function getPerformanceInventorySummary($performanceID = false, $year = false)
+ {
+
+ // If a performance has been specified
+ if ($performanceID != false) {
+
+ // Don't do anything here
+
+ // Is there a new Performance code selected?
+ } elseif (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Don't do anything here
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the performance ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $yearWhere = '';
+ if ($year) {
+ $yearWhere = "AND I.ticket_date BETWEEN '01/01/$year' AND '12/31/$year'";
+ }
+ // Get detail on the performance
+ $performanceDetail = $this->getPerformanceDetail($performanceID);
+
+ // Get inventory summary data for the performance
+ $sql = "
+ SELECT I.active, I.ticket_date AS date, I.ticket_time AS time, I.id AS invenID, I.quant, I.available, I.sold,
+ S.id AS sectionID, S.name AS sectionName, COALESCE(sum(H.quant),0) AS quantHeld,
+ T.name AS ticketname, T.price, t.unlimited_quant
+ FROM eventmgt.ticket T, eventmgt.ticket_inventory I LEFT OUTER JOIN eventmgt.inven_hold H ON (H.inventory = I.id),
+ eventmgt.section S
+ WHERE T.performance = $performanceID
+ AND I.ticket = T.id
+ AND S.id = T.section
+ $yearWhere
+ GROUP BY I.active, I.ticket_date, I.ticket_time, I.id, I.quant, I.available, I.sold, S.id, S.name, T.name, T.price, T.unlimited_quant
+ ORDER BY date, time, sectionID, ticketname
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $invData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Build inventory summary array organized by date, time, section, ticket
+ $sum = array();
+ $date = false;
+ $time = false;
+ $section = false;
+ foreach ($invData as $i) {
+
+ $dow = date('D', strtotime($i['date']));
+
+ $t = explode(':', $i['time']);
+ $ampm = 'AM';
+ $hour = ($t[0] - 0);
+ if ($hour > 11) {
+ $ampm = 'PM';
+ } else {
+ }
+ if ($hour > 12) {
+ $hour -= 12;
+ }
+ $timeString = sprintf('%2d:%02d %s', $hour, $min, $ampm);
+
+ // Insert ticket with inventory
+ $s = array(
+ 'id' => $i['invenid'],
+ 'active' => $i['active'],
+ 'date' => $dow." ".$i['date'],
+ 'time' => $timeString,
+ 'section' => $i['sectionname'],
+ 'name' => $i['ticketname'],
+ 'unlimited_quant' => $i['unlimited_quant'],
+ 'quant' => $i['quant'],
+ 'avail' => $i['available'],
+ 'sold' => $i['sold'],
+ 'held' => $i['quantheld'],
+ 'netAvail' => $i['available'] - $i['held'],
+ 'price' => $this->money($i['price'])
+ );
+
+ // Clear redundant values
+ if ($i['date'] == $date) {
+ $s['date'] = '';
+ } else {
+ $date = $i['date'];
+ $time = false;
+ $section = false;
+ }
+
+ if ($i['time'] == $time) {
+ $s['time'] = '';
+ } else {
+ $time = $i['time'];
+ $section = false;
+ }
+
+ if ($i['sectionname'] == $section) {
+ $s['section'] = '';
+ } else {
+ $section = $i['sectionname'];
+ }
+
+
+ $sum[] = $s;
+ }
+
+ return $sum;
+
+ }
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ private function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataPromoSold.php b/classes/data/dataPromoSold.php
new file mode 100644
index 0000000..9ad7ab4
--- /dev/null
+++ b/classes/data/dataPromoSold.php
@@ -0,0 +1,268 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPromoSold class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+class EventManagementDataPromoSold extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.promo_sold';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Ticket Order
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Ticket Sold
+ 'ticket_sold' => array(
+ 'field' => 'ticket_sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Promo
+ 'promo' => array(
+ 'field' => 'promo',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Promo Name
+ 'promo_name' => array(
+ 'field' => 'promo_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promo type
+ 'promo_type' => array(
+ 'field' => 'promo_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->promo_ticket_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promo type name
+ 'promo_type_name' => array(
+ 'field' => 'promo_type_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Amount
+ 'amount' => array(
+ 'field' => 'amount',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Amount (money)
+ 'amount_money' => array(
+ 'field' => 'amount',
+ 'as' => 'amount_money',
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ ),
+
+ // Session ID
+ 'session_id' => array(
+ 'field' => 'session_id',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+ }
+
+ /**
+ * Get Ticket Sold promos list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromosSoldList($ticketSoldID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied, use the $TicketSoldID - Otherwise $where
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a ticket sold ID, then filter by that
+ $ticketSoldID = ($ticketSoldID - 0); // Make sure it's number
+ if ($ticketSoldID > 0) {
+ $where .= " AND T.ticket_sold = $ticketSoldID";
+ }
+
+ }
+
+ $promosSoldList = $this->getList($where, 'id');
+
+ return $promosSoldList;
+ }
+
+ /**
+ * Get Promo Sold Detail
+ *
+ * @return array
+ */
+ function getPromoSoldDetail($promoSoldID = false)
+ {
+
+ if ($promoSoldID == false) {
+
+ // Otherwise, we don't have an promo sold id
+ return false;
+
+ }
+
+ // If the promo sold ID is valid, get the detail
+ $promoSoldID = filter_input(INPUT_GET, 'PromoSoldID', FILTER_SANITIZE_NUMBER_INT);
+ if ($promoSoldID) {
+ $promoSoldDetail = $this->getEntry($promoSoldID);
+
+ // Otherwise fail
+ } else {
+ return false;
+ }
+
+ return $promoSoldDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataPromoTickets.php b/classes/data/dataPromoTickets.php
new file mode 100644
index 0000000..183b38d
--- /dev/null
+++ b/classes/data/dataPromoTickets.php
@@ -0,0 +1,505 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoTickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPromoTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataPromoTickets extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.promo_ticket';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Promo Code
+ 'promo' => array(
+ 'field' => 'promo',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion Name
+ 'promo_name' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion Description
+ 'promo_descr' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_descr',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'descr',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion Start Date
+ 'promo_start_date' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_start_date',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'start_date',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion end Date
+ 'promo_end_date' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_end_date',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'end_date',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket ID
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Name
+ 'ticket_name' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'title',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promo type
+ 'promo_type' => array(
+ 'field' => 'promo_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->promo_ticket_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Amount
+ 'amount' => array(
+ 'field' => 'amount',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ return $r;
+ }
+
+ /**
+ * Get Promo Ticket list
+ *
+ * If $promoID is supplied also returns sales counts for this promo for each ticket.
+ * Front-end shop selection of
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromoTicketsList($promoID = false, $promoCode = false, $where = 'true')
+ {
+
+ // If promoID is supplied, get only tickets listed for that promo
+ if ($promoID) {
+ $where .= " AND T.promo = $promoID";
+ }
+
+ // If promoCode is supplied, get only tickets listed for that promo
+ if ($promoCode) {
+ $where .= " AND T.promo = (SELECT id FROM eventmgt.promo_code WHERE name = '$promoCode')";
+ }
+
+ // Get list of Promo Tickets
+ $promoTicketsList = $this->getList($where);
+
+ // If a Promo ID was supplied, also get the promo code use counts per ticket
+ If ($promoID && is_array($promoTicketsList)) {
+
+ // If promoID is supplied, get only tickets listed for that promo
+ if ($promoID) {
+ $where = " AND P.promo = $promoID";
+ }
+
+ // Also get total Promo counts for each ticket
+ reset($promoTicketsList);
+ while (list($key, $val) = each($promoTicketsList)) {
+
+ // Get number sold and value sold for this ticket type and promo code
+ $sql = "
+ SELECT count(P.id) as numb_sold, sum(P.amount) as value_sold
+ FROM eventmgt.promo_sold P, eventmgt.ticket_sold T
+ WHERE T.id = P.ticket_sold
+ AND T.ticket = ".$val['ticket']."
+ $where;
+ ";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $sales = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Add it to the results
+ $promoTicketsList[$key]['numberSold'] = $sales['numb_sold'];
+ $promoTicketsList[$key]['valueSold'] = $sales['value_sold'];
+ $promoTicketsList[$key]['dollarsSold'] = $this->money($sales['value_sold']);
+
+ }
+
+ }
+
+ return $promoTicketsList;
+ }
+
+ /**
+ * Get Promo Ticket Detail
+ *
+ * @return array
+ */
+ function getPromoTicketDetail($promoTicketID = false)
+ {
+
+ // If a promo ticket has been specified
+ if ($promoTicketID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ // Otherwise if there's a promo ticket ID in the request
+ } elseif (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a Promo Ticket submitted, so save that
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoTicketID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have a promo ticket id
+ return false;
+
+ }
+
+ $promoTicketDetail = $this->getEntry($promoTicketID);
+
+ return $promoTicketDetail;
+
+ }
+
+ /**
+ * Edit Promo Ticket
+ *
+ * @return array
+ */
+ function editPromoTicket()
+ {
+
+ if (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo ticket ID from the session
+ $promoTicketID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have a promo ticket id
+ return false;
+
+ }
+
+ $promoTicketDetail = $this->editEntry($promoTicketID);
+
+ return $promoTicketDetail;
+
+ }
+
+ /**
+ * Update Promo Ticket
+ *
+ * @return array
+ */
+ function updatePromoTicket()
+ {
+
+ if (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo ticket ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have a promo ticket id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($promoTicketID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Promo Ticket
+ *
+ * @return array
+ */
+ function newPromoTicket()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Promo Ticket
+ *
+ * @return array
+ */
+ function insertPromoTicket()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current promo ticket to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Promo Ticket
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function promoTicketDelete($confirm = false)
+ {
+
+ // Is there a new promo ticket code selected?
+ if (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoTicketID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have an promo ticket id
+ return false;
+
+ }
+
+ $promoTicketDetail = $this->deleteEntry($promoTicketID, $confirm);
+
+ return $promoTicketDetail;
+
+ }
+
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ private function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataPromos.php b/classes/data/dataPromos.php
new file mode 100644
index 0000000..6773d78
--- /dev/null
+++ b/classes/data/dataPromos.php
@@ -0,0 +1,376 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromos.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPromos class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromos,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataPromos extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.promo_code';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Promo Code Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promo Code Long Name
+ 'long_name' => array(
+ 'field' => 'long_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ // Check that Sticky is not used with date-specific inventory
+ if ($r['fieldData']['date_specific']['value'] && $r['fieldData']['cart_sticky']['value']) {
+ $r['status'] = false;
+ $r['fieldFail']['cart_sticky'] = 'Sticky may not be used when "Specified Dates" is checked.';
+ $r['fieldFail']['date_specific'] = 'Specified dates may not be used when "Sticky" is checked.';
+ }
+
+ return $r;
+ }
+
+ /**
+ * Get Promo Code list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromosList()
+ {
+
+ // Build query Where clause
+ $where = 'true';
+
+ // Get list of Promo Codes
+ $promosList = $this->getList($where, 'start_date, name');
+
+ return $promosList;
+ }
+
+ /**
+ * Get Promo Code Detail
+ *
+ * @return array
+ */
+ function getPromoDetail($promoID = false)
+ {
+
+ // If a promo code has been specified
+ if ($promoID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ // Otherwise if there's a promo code ID in the request
+ } elseif (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a Promo Code submitted, so save that
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have a promo code id
+ return false;
+
+ }
+
+ $promoDetail = $this->getEntry($promoID);
+
+ return $promoDetail;
+
+ }
+
+ /**
+ * Edit Promo Code
+ *
+ * @return array
+ */
+ function editPromo()
+ {
+
+ if (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $promoDetail = $this->editEntry($promoID);
+
+ return $promoDetail;
+
+ }
+
+ /**
+ * Update Promo Code
+ *
+ * @return array
+ */
+ function updatePromo()
+ {
+
+ if (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have a promo code id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($promoID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Promo Code
+ *
+ * @return array
+ */
+ function newPromo()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Promo Code
+ *
+ * @return array
+ */
+ function insertPromo()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current promo code to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Promo Code
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function promoDelete($confirm = false)
+ {
+
+echo "dataPromos.php - promoDelete() - need to also delete from promo_ticket table";
+
+ // Is there a new promo code code selected?
+ if (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have an promo code id
+ return false;
+
+ }
+
+ $promoDetail = $this->deleteEntry($promoID, $confirm);
+
+ return $promoDetail;
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataReservations.php b/classes/data/dataReservations.php
new file mode 100644
index 0000000..482382b
--- /dev/null
+++ b/classes/data/dataReservations.php
@@ -0,0 +1,830 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataReservations.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataReservations class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataReservations.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataReservations extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.reservation';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // User Trace Info
+ 'user_trace_info' => array(
+ 'field' => 'user_trace_info',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // First Name
+ 'fname' => array(
+ 'field' => 'fname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Last Name
+ 'lname' => array(
+ 'field' => 'lname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Team name (stored as "org") - need to clean up field name
+ 'org' => array(
+ 'field' => 'org',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Event
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Event name
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'event_code',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Team
+ 'team' => array(
+ 'field' => 'team',
+ 'as' => 'team_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.team',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State Rep
+ 'state_rep' => array(
+ 'field' => 'state_rep',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State Rep Code
+ 'state_rep_code' => array(
+ 'field' => 'state_rep',
+ 'as' => 'state_rep_code',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.state_rep',
+ 'p_field' => 'code',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member (property)
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member (property) ID
+ 'member_id' => array(
+ 'field' => 'member',
+ 'as' => 'member_id',
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Address Line 1
+ 'addr1' => array(
+ 'field' => 'addr1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 2
+ 'addr2' => array(
+ 'field' => 'addr2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // City
+ 'city' => array(
+ 'field' => 'city',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Country
+ 'country' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lnieudc'
+ ),
+
+ // Country Full - Get Detail only
+ 'countryFull' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->countries->toArray(),
+ 'list_keytype' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'g'
+ ),
+
+ // ZIP
+ 'zip' => array(
+ 'field' => 'zip',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Phone
+ 'phone' => array(
+ 'field' => 'phone',
+ 'as' => false,
+ 'type' => 'phone',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+
+ // Contact E-Mail
+ 'email' => array(
+ 'field' => 'email',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // OK to sent email
+ 'email_ok' => array(
+ 'field' => 'email_ok',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Date reservation was entered.
+ 'date_entered' => array(
+ 'field' => 'date_entered',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Arrive Date
+ 'arrive_date' => array(
+ 'field' => 'arrive_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Nights
+ 'nights' => array(
+ 'field' => 'nights',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Number of Rooms
+ 'rooms' => array(
+ 'field' => 'rooms',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Occupants (adults)
+ 'adults' => array(
+ 'field' => 'adults',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment method
+ 'payby' => array(
+ 'field' => 'payby',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->pay_types->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card Type
+ 'cctype' => array(
+ 'field' => 'cctype',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card Number
+ 'ccnumber' => array(
+ 'field' => 'ccnumber',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card Expiration
+ 'expire' => array(
+ 'field' => 'expire',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Name on Credit Card
+ 'ccname' => array(
+ 'field' => 'ccname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card CCV
+ 'cccode' => array(
+ 'field' => 'cccode',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Total Room Rate for stay (formatted)
+ 'hotel_price' => array(
+ 'field' => 'hotel_price',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Total Room Rate for stay (number)
+ 'hotel_price_numb' => array(
+ 'field' => 'hotel_price',
+ 'as' => 'hotel_price_numb',
+ 'type' => 'float',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'l'
+ ),
+
+ // Total Taxes (formatted)
+ 'taxes' => array(
+ 'field' => 'taxes',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Total Taxes (number)
+ 'taxes_numb' => array(
+ 'field' => 'taxes',
+ 'as' => 'taxes_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'l'
+ ),
+
+ // Grand Total (formatted)
+ 'grand_total' => array(
+ 'field' => 'grand_total',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Grand Total (number)
+ 'grand_total_numb' => array(
+ 'field' => 'grand_total',
+ 'as' => 'grand_total_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'l'
+ ),
+
+ // Confirmed
+ 'confirmed' => array(
+ 'field' => 'confirmed',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Declined
+ 'declined' => array(
+ 'field' => 'declined',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // date_confirmed
+ 'date_confirmed' => array(
+ 'field' => 'date_confirmed',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Confirmed By
+ 'conf_by' => array(
+ 'field' => 'conf_by',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Confirmation Message
+ 'conf_message' => array(
+ 'field' => 'conf_message',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Reservation Detail (serialized array)
+ 'res_detail' => array(
+ 'field' => 'res_detail',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'no_stripslashes' => true,
+ 'use' => 'a'
+ ),
+
+ // HTML Summary of Reservation
+ 'summary' => array(
+ 'field' => 'summary',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get Reservations list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getReservationsList()
+ {
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get member ID from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ // Get accommodation ID from session - if available
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ // Get team ID from session - if available
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ // Get any specified reservation listing option - default to event
+ $option = 'event';
+ if (($resListOption = filter_input(INPUT_GET, 'ReservationsListOption', FILTER_SANITIZE_STRING))) {
+ $option = $resListOption;
+ }
+ $status = 'all';
+ if (($resListStatus = filter_input(INPUT_GET, 'ReservationsListStatus', FILTER_SANITIZE_STRING))) {
+ $status = $resListStatus;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.event = $eventID";
+ break;
+ case 'member':
+ if (!$memberID) {
+ return false;
+ }
+ $where = "T.member = $memberID";
+ break;
+ case 'accom':
+ if (!$accomID) {
+ return false;
+ }
+ $where = "T.accommodation = $accomID";
+ break;
+ case 'team':
+ if (!$teamID) {
+ return false;
+ }
+ $where = "T.team_id = $memberID";
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Select by status
+ switch ($status) {
+ case 'pending':
+ $where .= ($where!=''?' AND ':'')." NOT T.confirmed AND NOT T.declined";
+ break;
+ case 'confirmed':
+ $where .= ($where!=''?' AND ':'')." T.confirmed AND NOT T.declined";
+ break;
+ case 'declined':
+ $where .= ($where!=''?' AND ':'')." T.declined";
+ break;
+ case 'all':
+ default:
+ break;
+ }
+
+ // Get list of Reservations
+ $resList = $this->getList($where);
+ return $resList;
+ }
+
+ /**
+ * Get Reservation Detail
+ *
+ * @return array
+ */
+ function getReservationDetail()
+ {
+
+ // Is there a new reservation code selected?
+ if (($resID = filter_input(INPUT_GET, 'ReservationID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = $resID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Reservation'])) {
+
+ // Otherwise, get the team ID from the session
+ $resID = $_SESSION[GLM_EVENT_SESSION]['Reservation'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $resDetail = $this->getEntry($resID);
+
+ // NEED TO PUT THIS CAPABILITY INTO ABSTRACT AS AN OPTION
+ $resDetail['summary'] = html_entity_decode($resDetail['summary']);
+
+ // echo "
".print_r($resDetail,1)."
";
+ return $resDetail;
+
+ }
+
+
+ /**
+ * Edit Reservation
+ *
+ * @return array
+ */
+ function editReservation()
+ {
+
+ if (($resID = filter_input(INPUT_GET, 'ReservationID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = $resID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Reservation'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Reservation'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $resDetail = $this->editEntry($resID);
+
+ return $resDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ // Nothing here for now
+
+ return $r;
+ }
+
+ /**
+ * Update Reservation
+ *
+ * @return array
+ */
+ function updateReservation()
+ {
+
+ if (($resID = filter_input(INPUT_GET, 'ReservationID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = $resID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Reservation'])) {
+
+ // Otherwise, get the reservation ID from the session
+ $resID = $_SESSION[GLM_EVENT_SESSION]['Reservation'];
+
+ } else {
+
+ // Otherwise, we don't have a reservation id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($resID);
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Reservation
+ *
+ * @return array
+ */
+ function insertReservation()
+ {
+
+ echo "INSERT NOT SUPPORTED FOR RESERVATIONS IN EVENT MANAGEMENT ADMIN AREA!";
+ exit;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataRooms.php b/classes/data/dataRooms.php
new file mode 100644
index 0000000..650e8ac
--- /dev/null
+++ b/classes/data/dataRooms.php
@@ -0,0 +1,457 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataRooms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataRooms class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataRooms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataRooms extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.room_detail';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Member
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Accommodation
+ 'accommodation' => array(
+ 'field' => 'accommodation',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Occupants
+ 'occupants' => array(
+ 'field' => 'occupants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Room Type - Needs to be moved to a separate admin table
+ 'room_type' => array(
+ 'field' => 'room_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->room_types->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Bath Type - Needs to be moved to a separate admin table
+ 'bath_type' => array(
+ 'field' => 'bath_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->bath_types->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Pull-out Beds
+ 'pullout_beds' => array(
+ 'field' => 'pullout_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Single Beds
+ 'single_beds' => array(
+ 'field' => 'single_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Double Beds
+ 'double_beds' => array(
+ 'field' => 'double_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Queen Beds
+ 'queen_beds' => array(
+ 'field' => 'queen_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // King Beds
+ 'king_beds' => array(
+ 'field' => 'king_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // TV
+ 'tv' => array(
+ 'field' => 'tv',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Fridge
+ 'fridge' => array(
+ 'field' => 'fridge',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Safe
+ 'safe' => array(
+ 'field' => 'safe',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get Rooms list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getRoomsList()
+ {
+
+ // Get accommodation ID from session - if available
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ if (!$accomID) {
+ return false;
+ }
+
+ // Select type of list
+ $where = "T.accommodation = $accomID";
+
+ // Get list of States
+ $roomsList = $this->getList($where, 'sort');
+
+ // Build Beds summary
+ if ($roomsList && count($roomsList) > 0) {
+ reset($roomsList);
+ while( list($key, $val) = each( $roomsList ) ) {
+ $beds_summary = '';
+ $sep = '';
+ if ($val['pullout_beds'] > 0) {
+ $beds_summary .= $val['pullout_beds']." Pullout";
+ $sep = ', ';
+ }
+ if ($val['single_beds'] > 0) {
+ $beds_summary .= $sep.$val['single_beds']." Single";
+ $sep = ', ';
+ }
+ if ($val['double_beds'] > 0) {
+ $beds_summary .= $sep.$val['double_beds']." Double";
+ $sep = ', ';
+ }
+ if ($val['queen_beds'] > 0) {
+ $beds_summary .= $val['queen_beds']." Queen";
+ $sep = ', ';
+ }
+ if ($val['king_beds'] > 0) {
+ $beds_summary .= $val['king_beds']." King";
+ $sep = ', ';
+ }
+ $roomsList[$key]['beds_summary'] = $beds_summary;
+ }
+ }
+
+ return $roomsList;
+ }
+
+ /**
+ * Get Room Detail
+ *
+ * @return array
+ */
+ function getRoomDetail()
+ {
+
+ // Is there a new State Rep code selected?
+ if (!($roomID = filter_input(INPUT_GET, 'RoomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ return false;
+
+ }
+
+ $roomDetail = $this->getEntry($roomID);
+
+ return $roomDetail;
+
+ }
+
+
+ /**
+ * Edit Room
+ *
+ * @return array
+ */
+ function editRoom()
+ {
+ if (!($roomID = filter_input(INPUT_GET, 'RoomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $roomDetail = $this->editEntry($roomID);
+
+ $roomDetail['RoomID'] = $roomID;
+
+ // echo "
".print_r($roomDetail,1)."
";
+ return $roomDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Room
+ *
+ * @return array
+ */
+ function updateRoom()
+ {
+
+ if (!($roomID = filter_input(INPUT_POST, 'RoomID', FILTER_SANITIZE_NUMBER_INT))) {
+ return false;
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($roomID);
+
+ $r['fieldData']['RoomID'] = $roomID;
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Room
+ *
+ * @return array
+ */
+ function newRoom()
+ {
+ // Get member and accommodation ID from session - if available
+ $membID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ if (!$accomID) {
+ return false;
+ }
+
+ $r = $this->newEntry();
+
+ $r['fieldData']['member'] = $membID;
+ $r['fieldData']['accommodation'] = $accomID;
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Room
+ *
+ * @return array
+ */
+ function insertRoom()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current state rep to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataSections.php b/classes/data/dataSections.php
new file mode 100644
index 0000000..ae768c4
--- /dev/null
+++ b/classes/data/dataSections.php
@@ -0,0 +1,450 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSections.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataSections class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSections.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataSections extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.section';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Member ID for adding sections
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'nid'
+ ),
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Section Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Entrance
+ 'entrance' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.entrance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_where' => 'member = '.$_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nideu'
+ ),
+
+ // Entrance_view
+ 'entrance_view' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.entrance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Entrance_id
+ 'entrance_id' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Sort order
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Get Sections list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSectionsList($memberID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a member ID and filter by that member if there is
+ $memberID = ($memberID - 0); // Make sure it's number
+ if ($memberID > 0) {
+ $where .= " AND T.member = $memberID";
+ } elseif ($_SESSION[GLM_EVENT_MGT_ADMIN]['Member'] > 0) {
+ $where .= " AND T.member = ".$_SESSION[GLM_EVENT_MGT_ADMIN]['Member'];
+ }
+
+ }
+
+ // Get list of Sections
+ $sectionsList = $this->getList($where, 'sort, name');
+
+ return $sectionsList;
+ }
+
+ /**
+ * Get Section Detail
+ *
+ * @return array
+ */
+ function getSectionDetail($sectionID = false)
+ {
+
+ // If a section ID has been supplied
+ if ($sectionID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise if there a new section ID supplied via the request
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the event ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have an event id
+ return false;
+
+ }
+
+ $sectionDetail = $this->getEntry($sectionID);
+
+ return $sectionDetail;
+
+ }
+
+
+ /**
+ * Edit Section
+ *
+ * @return array
+ */
+ function editSection()
+ {
+
+ if (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the section ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have a section id
+ return false;
+
+ }
+
+ $sectionDetail = $this->editEntry($sectionID);
+
+ return $sectionDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Section
+ *
+ * @return array
+ */
+ function updateSection()
+ {
+
+ if (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the section ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have a section id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($sectionID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Section
+ *
+ * @return array
+ */
+ function newSection()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Section
+ *
+ * @return array
+ */
+ function insertSection()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current section to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete Section
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function sectionDelete($confirm = false)
+ {
+
+ // Is there a new section code selected?
+ if (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the section ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have an section id
+ return false;
+
+ }
+
+ $sectionDetail = $this->deleteEntry($sectionID, $confirm);
+
+ return $sectionDetail;
+
+ }
+
+ /**
+ * Get Sections Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSectionsStats($where = 'true')
+ {
+
+ $sectionsStats = $this->getStats($where);
+
+ return $sectionsStats;
+ }
+
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataSold.php b/classes/data/dataSold.php
new file mode 100644
index 0000000..ebad123
--- /dev/null
+++ b/classes/data/dataSold.php
@@ -0,0 +1,804 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataSold class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSold,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataSold extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_sold';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Ticket Sold (Voucher) ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Order ID
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Member ID
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Member Name
+ 'member_name' => array(
+ 'field' => 'member_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Left End Text
+ 'real_member_name' => array(
+ 'field' => 'member',
+ 'as' => 'real_member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Assigned (consignment to another venue)
+ 'assigned' => array(
+ 'field' => 'assigned',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Assigned From ID
+ 'assigned_from' => array(
+ 'field' => 'assigned_from',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Assigned from name
+ 'assigned_from_name' => array(
+ 'field' => 'assigned_from_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Performance ID
+ 'performance' => array(
+ 'field' => 'performance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Performance Name
+ 'performance_name' => array(
+ 'field' => 'performance_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Entrance ID
+ 'entrance' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Entrance Name
+ 'entrance_name' => array(
+ 'field' => 'entrance_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Entrance Color
+ 'entrance_color' => array(
+ 'field' => 'entrance_color',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Section ID
+ 'section' => array(
+ 'field' => 'section',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Section Name
+ 'section_name' => array(
+ 'field' => 'section_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket ID
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Name
+ 'ticket_name' => array(
+ 'field' => 'ticket_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Is Package
+ 'is_package' => array(
+ 'field' => 'is_package',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Ticket Package - points to ticket that is a package that includes this ticket - 0 if not part of a package
+ 'ticket_package' => array(
+ 'field' => 'ticket_package',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Package Sold ID
+ 'package_sold_id' => array(
+ 'field' => 'package_sold_id',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Package Name
+ 'package_name' => array(
+ 'field' => 'package_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Text
+ 'ticket_voucher_text' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_voucher_text',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'voucher_text',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Type
+ 'ticket_voucher_type' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_voucher_type',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'voucher_type',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Left End Text
+ 'ticket_voucher_leftend_text' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_voucher_leftend_text',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'voucher_leftend_text',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Date Specific flag
+ 'date_specific' => array(
+ 'field' => 'date_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Ticket Date
+ 'ticket_date' => array(
+ 'field' => 'ticket_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Time Specific flag
+ 'time_specific' => array(
+ 'field' => 'time_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Ticket Time
+ 'ticket_time' => array(
+ 'field' => 'ticket_time',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Start Date for non-date-specific tickets
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // End Date for non-date-specific tickets
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Date customer will likely use this ticket
+ 'likely_date' => array(
+ 'field' => 'likely_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Price Paid
+ 'price_paid' => array(
+ 'field' => 'price_paid',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Policies at time of order
+ 'policies' => array(
+ 'field' => 'policies',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Unlimited Use flag
+ 'unlimited_use' => array(
+ 'field' => 'unlimited_use',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Number of uses
+ 'numb_uses' => array(
+ 'field' => 'numb_uses',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Number of times claimed
+ 'numb_claimed' => array(
+ 'field' => 'numb_claimed',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Time Claimed
+ 'time_claimed' => array(
+ 'field' => 'time_claimed',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y h:i:s A',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ )
+
+ );
+ }
+
+
+ /**
+ * Get Orders list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSoldList($orderID = false, $memberID = false)
+ {
+
+ // If a order has been specified
+ if ($orderID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ // Otherwise if there's a order ID in the request
+ } elseif (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ $where = '';
+ if ($memberID) {
+ $where = "AND T.member = $memberID";
+ }
+
+ // Get list of Tickets Sold
+ $soldList = $this->getList("T.ticket_order = $orderID $where", 'T.ticket_order, T.package_sold_id, T.id');
+
+ // Load addonsSold class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addonsSold.php';
+ $addonsSold = new EventManagementAdminAddonsSold($this->dbh, $this->config);
+
+ // For each ticket, check for any add-ons that have been sold with it
+ if ($soldList != false) {
+ reset($soldList);
+ while (list($key, $val) = each($soldList)) {
+ // Get any add-ons included with this ticket
+ $addonsSoldList = $addonsSold->getAddonsSoldList($val['id']);
+ if ($addonsSoldList) {
+ $soldList[$key]['addons_sold'] = $addonsSoldList;
+ }
+ }
+ }
+
+ return $soldList;
+ }
+
+ /**
+ * Get Ticket Sold Detail
+ *
+ * @return array
+ */
+ function getSoldDetail($soldID = false, $memberID = false)
+ {
+ // Test Check character
+ $testCheck = false;
+
+ // If a order has been specified
+ if ($soldID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Sold'] = $soldID;
+
+ // Otherwise if there's a sold ID in the request
+ } elseif (($soldID = filter_input(INPUT_GET, 'SoldID', FILTER_SANITIZE_STRING))) {
+
+ // Do a check character test if input from form.
+ $testCheck = true;
+
+ $_SESSION[GLM_EVENT_SESSION]['Sold'] = $soldID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Sold'])) {
+
+ $soldID = $_SESSION[GLM_EVENT_SESSION]['Sold'];
+
+ } else {
+
+ // Otherwise, we don't have an ticket sold id
+ return false;
+
+ }
+
+ $checkBypass = filter_input(INPUT_GET, 'checkBypass', FILTER_SANITIZE_STRING);
+ if ( $checkBypass == 'true') {
+ $testCheck = false;
+ }
+
+
+ $where = '';
+ if ($memberID) {
+ $where = "AND T.member = $memberID";
+ }
+
+ // If input came from form, then test the check char
+ $voucherNumb = $soldID;
+ if ($testCheck) {
+ // Separate check character from voucher number
+ $voucherNumb = substr($soldID, 0, -2);
+ $checkChar = substr($soldID, -2);
+
+ // Check if check character
+ $c = $this->getCheckCode($voucherNumb);
+ if ($c != strtoupper($checkChar)) {
+
+ return false;
+ }
+ }
+
+ // If number has
+ $soldDetail = $this->getEntry($voucherNumb, 'id', $where);
+
+ // If we have a member ID then make sure the sold ticket is for that member
+ if ($memberID && $soldDetail['member'] != $memberID) {
+ return false;
+ }
+
+ return $soldDetail;
+
+ }
+
+
+ /**
+ * Edit Sold
+ *
+ * @return array
+ */
+ function editSold()
+ {
+echo "editSold() not competed";
+/*
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->editEntry($ticketID);
+
+ return $ticketDetail;
+*/
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Ticket Sold
+ *
+ * @return array
+ */
+ function updateSold()
+ {
+
+echo "updateSold() not competed";
+/*
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($ticketID);
+
+ return $r;
+*/
+ }
+
+ /**
+ * Delete Ticket Sold
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function soldDelete($confirm = false)
+ {
+echo "soldDelete() not competed";
+/*
+
+ // Is there a new ticket code selected?
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have an ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->deleteEntry($ticketID, $confirm);
+
+ return $ticketDetail;
+*/
+ }
+
+
+ /*
+ * Function to add check character to end of voucher number
+ *
+ * Uses config->voucher_check_secret and voucher # to create MD5 string
+ * then takes last hex character off of that string and shifts it up to
+ * always be a character (adds 16 to numbers and 10 to the upper-case
+ * version of the character).
+ * i.e. 0 = A, 9 = J, A = K, F =
+ *
+ */
+ public function getCheckCode($voucherNumb)
+ {
+
+ // Create MD5 string using voucher number and secret
+ $md5 = md5($voucherNumb.$this->config->voucher_check_secret);
+
+ // Get last character code of the last character in the MD5
+ $cc = strtoupper(substr($md5, -2));
+ $cc[0] = $this->shiftCheckCodeCharacter($cc[0]);
+ $cc[1] = $this->shiftCheckCodeCharacter($cc[1]);
+
+ // Return check code
+ return $cc;
+
+ }
+
+ private function shiftCheckCodeCharacter($c) {
+
+ $x = ord($c);
+
+ // If it's a digit, add 16
+ if ($x < 65) {
+ $x += 17;
+ // otherwise, add 10
+ } else {
+ $x += 10;
+ }
+
+ // Also skip the letter O
+ if (x >= ord('O')) {
+ $x += 1;
+ }
+
+ return chr($x);
+ }
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataStates.php b/classes/data/dataStates.php
new file mode 100644
index 0000000..7fe8857
--- /dev/null
+++ b/classes/data/dataStates.php
@@ -0,0 +1,363 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataStates.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataStates class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataStates.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataStates extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.state_rep';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Event selection
+ 'conv' => array(
+ 'field' => 'conv',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Event Name display
+ 'conv_view' => array(
+ 'field' => 'conv',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // State Rep Code
+ 'code' => array(
+ 'field' => 'code',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Password
+ 'password' => array(
+ 'field' => 'password',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get States list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getStatesList()
+ {
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get any specified state rep listing option - default to event
+ $option = 'event';
+ if (($statesListOption = filter_input(INPUT_GET, 'StatesListOption', FILTER_SANITIZE_STRING))) {
+ $option = $statesListOption;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.conv = $eventID";
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get list of States
+ $statesList = $this->getList($where, 'code');
+
+ return $statesList;
+ }
+
+ /**
+ * Get State Rep Detail
+ *
+ * @return array
+ */
+ function getStateDetail()
+ {
+
+ // Is there a new State Rep code selected?
+ if (($stateID = filter_input(INPUT_GET, 'StateID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $stateID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['State'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $stateDetail = $this->getEntry($stateID);
+
+ return $stateDetail;
+
+ }
+
+
+ /**
+ * Edit State Rep
+ *
+ * @return array
+ */
+ function editState()
+ {
+
+ if (($stateID = filter_input(INPUT_GET, 'StateID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $stateID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['State'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $stateDetail = $this->editEntry($stateID);
+
+ return $stateDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update State Rep
+ *
+ * @return array
+ */
+ function updateState()
+ {
+
+ if (($stateID = filter_input(INPUT_GET, 'StateID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $stateID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['State'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($stateID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New State Rep
+ *
+ * @return array
+ */
+ function newState()
+ {
+
+ $r = $this->newEntry();
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $event = isset($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $r['fieldData']['event_name']['pick_list'][$event]['default'] = true;
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Insert State Rep
+ *
+ * @return array
+ */
+ function insertState()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current state rep to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataTeams.php b/classes/data/dataTeams.php
new file mode 100644
index 0000000..73e8e51
--- /dev/null
+++ b/classes/data/dataTeams.php
@@ -0,0 +1,735 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTeams.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTeams class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTeams.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataTeams extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.team';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Event selection
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Event Name display
+ 'event_view' => array(
+ 'field' => 'event',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'event_code',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // State (rep) selection
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.state_rep',
+ 'p_field' => 'code',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'ni'
+ ),
+
+ // State (rep) Name display
+ 'state_view' => array(
+ 'field' => 'state',
+ 'as' => 'state_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.state_rep',
+ 'p_field' => 'code',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Division selection
+ 'division' => array(
+ 'field' => 'division',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.division',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Division Name display
+ 'division_view' => array(
+ 'field' => 'division',
+ 'as' => 'division_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.division',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Team name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Team Code
+ 'team_code' => array(
+ 'field' => 'team_code',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Participants
+ 'participants' => array(
+ 'field' => 'participants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get Teams list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTeamsList()
+ {
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get member ID from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ // Clear Session Team Selection
+// $_SESSION[GLM_EVENT_SESSION]['Team'] = false;
+
+ // Get any specified team listing option - default to event
+ $option = 'event';
+ if (($teamsListOption = filter_input(INPUT_GET, 'TeamsListOption', FILTER_SANITIZE_STRING))) {
+ $option = $teamsListOption;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'member':
+ if (!$memberID) {
+ return false;
+ }
+ $where = "
+ T.id in (
+ SELECT team
+ FROM team_property
+ WHERE property = $memberID
+ )
+ ";
+ break;
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.event = $eventID";
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get list of Teams
+ $teamsList = $this->getList($where, 'event_name,state_name,division_name,name');
+
+ return $teamsList;
+ }
+
+ /**
+ * Get Team Detail
+ *
+ * @return array
+ */
+ function getTeamDetail()
+ {
+
+ // Is there a new team code selected?
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $teamDetail = $this->getEntry($teamID);
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ $r = array(
+ 'teamDetail' => $teamDetail,
+ 'teamRoster' => $teamRoster
+ );
+
+ return $r;
+
+ }
+
+ /**
+ * Get Team Roster
+ *
+ * @return array
+ */
+ function getTeamRoster($teamID, $participants)
+ {
+ // Try to get team roster
+ $sql = "SELECT *
+ FROM team_roster
+ WHERE team = $teamID
+ ORDER BY
+ CASE lname WHEN '' THEN 'ZZZZZZZ' ELSE lname END,
+ CASE fname WHEN '' THEN 'ZZZZZZZ' ELSE fname END;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamRoster = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Did we get less entries than team members listed?
+ if (count($teamRoster) < $participants) {
+ // Add number of additional participant slots to roster
+ $sql2 = array();
+ for ($i=count($teamRoster) ; $i<$participants ; $i++ ) {
+ $sql2[] = "INSERT INTO eventmgt.team_roster (team) values ($teamID);";
+ }
+
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql2 as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ }
+
+ // Get the team roster again
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamRoster = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ }
+
+ // Convert to array that has the roster ids as the index
+ $tr = array();
+ foreach($teamRoster as $r) {
+ $tr[$r['id']] = $r;
+ }
+
+ return $tr;
+ }
+
+
+ /**
+ * Edit Team
+ *
+ * @return array
+ */
+ function editTeam()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $teamDetail = $this->editEntry($teamID);
+
+ // echo "
".print_r($teamDetail,1)."
";
+ return $teamDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Team
+ *
+ * @return array
+ */
+ function updateTeam()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($teamID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Team
+ *
+ * @return array
+ */
+ function newTeam()
+ {
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Don't have a selected Event, so can't add a team.
+ return false;
+ }
+
+ // Set the p_where values for State Rep and Division picklists to only display ones associated
+ // with the selected event.
+ $this->fields['state']['p_where'] = "event = $eventID";
+ $this->fields['division']['p_where'] = "event = $eventID";
+
+ $r = $this->newEntry();
+
+ // Add selected event id and name for display in new team form
+ $r['fieldData']['event']['value'] = $eventID;
+ $r['fieldData']['event']['name'] = $r['fieldData']['event']['pick_list'][$eventID]['name'];
+
+ // Set selected event - Note that the template should actally not be using the event pick_list
+ // for new team entry unless we get the page to reload with the correct State Rep and Division lists.
+ $r['fieldData']['event']['pick_list'][$eventID]['default'] = true;
+
+ // If there's a currently selected State, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['State']) && $_SESSION[GLM_EVENT_SESSION]['State'] != false) {
+ $stateID = isset($_SESSION[GLM_EVENT_SESSION]['State']);
+ $r['fieldData']['state']['pick_list'][$stateID]['default'] = true;
+ }
+
+ // If there's a currently selected Division, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Division']) && $_SESSION[GLM_EVENT_SESSION]['Division'] != false) {
+ $divisionID = isset($_SESSION[GLM_EVENT_SESSION]['Division']);
+ $r['fieldData']['division']['pick_list'][$divisionID]['default'] = true;
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Team
+ *
+ * @return array
+ */
+ function insertTeam()
+ {
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Don't have a selected Event, so can't add a team.
+ return false;
+ }
+
+ // Set the p_where values for State Rep and Division picklists to only display ones associated
+ // with the selected event.
+ $this->fields['state']['p_where'] = "event = $eventID";
+ $this->fields['division']['p_where'] = "event = $eventID";
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current team to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $r['insertedID'];
+ }
+
+ // Add selected event name and value for display in new team form
+ $r['fieldData']['event']['name'] = $r['fieldData']['event']['pick_list'][$eventID]['name'];
+ $r['fieldData']['event']['value'] = $eventID;
+
+ // Set selected event - Note that the template should actally not be using the event pick_list
+ // for new team entry unless we get the page to reload with the correct State Rep and Division lists.
+ $r['fieldData']['event']['pick_list'][$eventID]['default'] = true;
+
+ // If there's a currently selected State, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['State']) && $_SESSION[GLM_EVENT_SESSION]['State'] != false) {
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+ $r['fieldData']['state']['pick_list'][$stateID]['default'] = true;
+ }
+
+ // If there's a currently selected Division, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Division']) && $_SESSION[GLM_EVENT_SESSION]['Division'] != false) {
+ $divisionID = $_SESSION[GLM_EVENT_SESSION]['Division'];
+ $r['fieldData']['division']['pick_list'][$divisionID]['default'] = true;
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Edit Team Roster
+ *
+ * @return array
+ */
+ function editTeamRoster()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ // Get team detail for reference
+ $teamDetail = $this->getEntry($teamID);
+
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ $r = array(
+ 'teamDetail' => $teamDetail,
+ 'teamRoster' => $teamRoster
+ );
+
+ return $r;
+
+ }
+
+ /**
+ * Update Team Roster
+ *
+ * @return array
+ */
+ function updateTeamRoster()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ // Get team detail for reference
+ $teamDetail = $this->getEntry($teamID);
+
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ $fieldFail = array();
+ $status = true;
+
+ // Filter and sanitize all input arrays
+ $lname_in = filter_input(INPUT_POST, "lname", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+ $fname_in = filter_input(INPUT_POST, "fname", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+ $pos_in = filter_input(INPUT_POST, "pos", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+ $notes_in = filter_input(INPUT_POST, "notes", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+
+ // For each participant
+ while (list($key, $val) = each($lname_in)) {
+
+ // Last Name
+ if ($lname_in[$key] || $lname_in[$key] == '') {
+ $teamRoster[$key]['lname'] = $lname_in[$key];
+ $fieldFail[$key]['lname'] = false;
+ } else {
+ $fieldFail[$key]['lname'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+
+ // First Name
+ if ($fname_in[$key] || $fname_in[$key] == '') {
+ $teamRoster[$key]['fname'] = $fname_in[$key];
+ $fieldFail[$key]['fname'] = false;
+ } else {
+ $fieldFail[$key]['fname'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+
+ // Position
+ if ($pos_in[$key] || $pos_in[$key] == '') {
+ $teamRoster[$key]['pos'] = $pos_in[$key];
+ $fieldFail[$key]['pos'] = false;
+ } else {
+ $fieldFail[$key]['pos'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+
+ // Notes
+ if ($notes_in[$key] || $notes_in[$key] == '') {
+ $teamRoster[$key]['notes'] = $notes_in[$key];
+ $fieldFail[$key]['notes'] = false;
+ } else {
+ $fieldFail[$key]['notes'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+ }
+
+ // If submission is safe, then update the roster table
+ if ($status) {
+ $sql = array();
+ foreach ($teamRoster as $r) {
+ $sql[] = "UPDATE team_roster
+ SET lname = '".addslashes($r['lname'])."',
+ fname = '".addslashes($r['fname'])."',
+ pos = '".addslashes($r['pos'])."',
+ notes = '".addslashes($r['notes'])."'
+ WHERE id = ".$r['id'].";";
+ }
+
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ }
+
+ // Get team roster again so it's propety ordered
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ }
+
+ $r = array(
+ 'status' => $status,
+ 'teamDetail' => $teamDetail,
+ 'teamRoster' => $teamRoster,
+ 'fieldFail' => $fieldFail
+ );
+
+ return $r;
+
+ }
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataTicketClaimTracking.php b/classes/data/dataTicketClaimTracking.php
new file mode 100644
index 0000000..bbc8ed0
--- /dev/null
+++ b/classes/data/dataTicketClaimTracking.php
@@ -0,0 +1,216 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketClaimTtracking.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTicketClaimTracking class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketClaimTracking,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementDataTicketClaimTracking extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_claim_tracking';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Order
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Sold
+ 'ticket_sold' => array(
+ 'field' => 'ticket_sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Time of scan (timestamp)
+ 'time_of_action' => array(
+ 'field' => 'time_of_action',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Action Type
+ 'action_type' => array(
+ 'field' => 'action_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->member_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Quantity
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Scan User
+ 'scan_user' => array(
+ 'field' => 'scan_user',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Scan Name
+ 'scan_name' => array(
+ 'field' => 'scan_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Attendance Entry
+ 'attendance' => array(
+ 'field' => 'attendance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Attendee Name
+ 'attendee_name' => array(
+ 'field' => 'attendee_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Attendee Notes
+ 'attendee_notes' => array(
+ 'field' => 'attendee_notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ return $r;
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataTicketInventory.php b/classes/data/dataTicketInventory.php
new file mode 100644
index 0000000..65e0a02
--- /dev/null
+++ b/classes/data/dataTicketInventory.php
@@ -0,0 +1,683 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketInventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataTicketInventory extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_inventory';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket ID
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Ticket'],
+ 'use' => 'nid'
+ ),
+
+ // Member ID
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'lged'
+ ),
+
+ // Member Name
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Name Display
+ 'ticket_view' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket ID
+ 'ticket_id' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Date
+ 'ticket_date' => array(
+ 'field' => 'ticket_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => time(),
+ 'use' => 'lgnid'
+ ),
+
+ // Ticket time
+ 'ticket_time' => array(
+ 'field' => 'ticket_time',
+ 'as' => false,
+ 'type' => 'time',
+// 'format' => 'm/d/Y',
+// 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+// 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgnid'
+ ),
+
+ // Ticket Unlimited Quantity
+ 'unlimited_quant' => array(
+ 'field' => 'ticket',
+ 'as' => 'unlimited_quant',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'unlimited_quant',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket is Cart Sticky
+ 'cart_sticky' => array(
+ 'field' => 'ticket',
+ 'as' => 'cart_sticky',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'cart_sticky',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Quantity Allotted
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Available
+ 'available' => array(
+ 'field' => 'available',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Available
+ 'sold' => array(
+ 'field' => 'sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // On Hold
+ 'on_hold' => array(
+ 'field' => 'id',
+ 'as' => 'on_hold',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.inven_hold',
+ 'p_field' => 'quant',
+ 'p_id' => 'inventory',
+ 'p_where' => "
+ hold_type = ".$this->config->hold_types->ticket." AND
+ expire_time > '".date('r')."' AND
+ inventory = T.id",
+ 'p_sum' => true,
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lg'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket sort order
+ 'ticket_sort' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_sort',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'sort',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Section ID - retrieval only
+ 'section' => array(
+ 'field' => 'ticket',
+ 'as' => 'section',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'section',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'g'
+ )
+
+
+ );
+ }
+
+
+ /**
+ * Get Ticket Inventory
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketInventoryList($ticketID = false, $where = false, $dateKey = false)
+ {
+
+ // If ticket ID is -1, then don't use ticket ID in search.
+ if ($ticketID == -1) {
+
+ $ticketID = false;
+
+ // If a ticket ID is specified
+ } elseif ($ticketID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If there's a new ticket code submitted then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id - This should not be a problem
+
+ }
+
+ // If we have a ticket id, use that for inventory selection
+ $ticketWhere = 'true ';
+ if ($ticketID) {
+ $ticketWhere = "T.ticket = $ticketID ";
+ }
+
+ // Check for Where clause supplied
+ if ($where) {
+ $where = "AND $where ";
+ }
+
+ // Get list of Inventory
+ $invData = $this->getList($ticketWhere.$where, 'ticket_date');
+
+ // Convert to array with timestamp or ID as index
+ $inventoryData = array();
+ if ($invData != false) {
+ foreach ($invData as $i) {
+
+ // If the inventory item has a date and we're getting inventory for a specific ticketID
+ if (trim($i['ticket_date']['date']) != '' && $ticketID) {
+
+ // Use ticket timestamp for index
+ $inventoryData[$i['ticket_date']['timestamp']] = $i;
+
+ // Otherwise just use inventory ID (it's a non-date specific ticket)
+ } else {
+ $inventoryData[$i['id']] = $i;
+ }
+ }
+ }
+
+ return $inventoryData;
+ }
+
+ /**
+ * Get Ticket Inventory Calendar Data
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketInventoryCalendarData()
+ {
+
+ // Is there a new Ticket code selected?
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Get peformance ID from ticket
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+ $Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+ $ticketDetail = $Tickets->getTicketDetail();
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $ticketDetail['performance_id'];
+
+ // Get performance data to get start and end date for the performance
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+ $Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+ $performanceDetail = $Performances->getPerformanceDetail();
+
+ $invData = $this->getTicketInventoryList(false, "ticket_date is not null");
+
+ // If this ticket is date specific by inventory
+ // If not, there's only one inventory item, so we don't build a calendar
+ if ($ticketDetail['date_specific']['value']) {
+
+ $start = $ticketDetail['start_date']['timestamp'];
+ $end = $ticketDetail['end_date']['timestamp'];
+
+ /*
+ * Build output organized as calendar months
+ */
+
+ // Create calendars for the months covered by the performance
+ $calData = array();
+ $startMonth = strtotime(date('m/1/Y', $start));
+ $endMonth = strtotime(date('m/1/Y', $end));
+
+ // For each month of the performance
+ $newInventoryAdded = false;
+ for ($month = $startMonth; $month <= $endMonth; $month = strtotime(date('m/d/Y',$month).' +1 Month')) {
+
+ $offset = date('w', $month); // Number of days start of month is offset from Sunday
+ $monthDays = date('t', $month); // Number of days in the month
+
+ $calData[$month] = array(
+ 'month' => date('F', $month),
+ 'year' => date('Y', $month)
+ );
+
+ // For each week of the month
+ for ($week = 1; $week <= 6; $week++) {
+
+ $weekUsed = false;
+
+ // For each day of the week
+ for ($day = 1; $day <= 7; $day++) {
+
+ $cellNumb = ($week-1) * 7 + $day; // Calendar cell number - 6 week rows = 42 cells
+
+ // If this is a real date cell, then add the date info and any inventory data
+ $dateData = array('isDate' => false);
+ if ($cellNumb > $offset && ($cellNumb-$offset) <= $monthDays) {
+
+ $date = $cellNumb - $offset; // Day of the month
+ $dateTime = strtotime(date('m/d/Y', $month)." + ".($date-1)." Days"); // Timestamp for this date
+
+ $dow = date('w', $dateTime);
+
+ // Create base cell data
+ $dateData = array(
+ 'isDate' => true,
+ 'time' => $dateTime,
+ 'dom' => date('j', $dateTime),
+ 'date' => date('m/d/Y',$dateTime),
+ 'selectable' => ($dateTime >= $start && $dateTime <= $end && $ticketDetail['days_of_week']['bitmap'][$dow]['default']),
+ 'selected' => false
+ );
+
+
+ if ($ticketDetail['days_of_week']['bitmap'][$dow]['default']) {
+
+
+ $weekUsed = true;
+
+ // Check if there's no inventory for this date and there should be
+ if (($dateTime >= $start && $dateTime <= $end) && !isset($invData[$dateTime])) {
+
+ // Create a new inventory item
+ $quant = $ticketDetail['quant'];
+ $time = trim($ticketDetail['ticket_time']['time']);
+ $dateText = date('m/d/Y', $dateTime);
+
+ $sql = "
+ INSERT INTO eventmgt.ticket_inventory
+ (ticket, quant, available, ticket_date, ticket_time, sold, active)
+ VALUES
+ ($ticketID, $quant, $quant, '$dateText', '$time', 0, true)
+ ;";
+ $this->dbh->exec($sql);
+ $newInventoryAdded = true;
+
+ }
+
+ }
+
+ // If there's data for this date, add that to the cell data
+ if (isset($invData[$dateTime])) {
+
+ $dateData = array_merge($dateData, $invData[$dateTime]);
+ unset($dateData['ticket_date']); // Don't need this here
+ unset($dateData['ticket_name']); // Don't need this here
+
+ }
+
+ }
+ $calData[$month]['weeks'][$week]['weekUsed'] = $weekUsed;
+ $calData[$month]['weeks'][$week]['days'][$cellNumb] = $dateData;
+
+ }
+ }
+ }
+
+ // If new inventory was added, go back and reload all the data again
+ if ($newInventoryAdded) {
+ $calData = $this->getTicketInventoryCalendarData();
+ }
+
+ } else {
+
+ // If not date specific, we'll just pass on the current inventory data item
+ $calData = $invData;
+ }
+
+ return $calData;
+ }
+
+
+ /**
+ * Get Ticket Inventory Detail
+ *
+ * @return array
+ */
+ function getTicketInventoryDetail($ticketInventoryID = false, $extended = false)
+ {
+
+ // If an ID was supplied
+ if ($ticketInventoryID > 0) {
+
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ // Otherwise is there a new Ticket code submitted?
+ } elseif (($ticketInventoryID = filter_input(INPUT_GET, 'TicketInventoryID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['TicketInventory'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketInventoryID = $_SESSION[GLM_EVENT_SESSION]['TicketInventory'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $detail = $this->getEntry($ticketInventoryID);
+
+ // If $extended, then get detail on Section and Entrance
+ if ($extended) {
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+ $Sections = new EventManagementDataSections($this->dbh, $this->config);
+ $Sections->optionIncludeSelectListData = false;
+ $sectionDetail = $Sections->getSectionDetail($detail['section']);
+
+ }
+
+ return $detail;
+
+ }
+
+
+ /**
+ * Edit Ticket Inventory
+ *
+ * @return array
+ */
+ function editTicketInventory()
+ {
+
+ if (($ticketInventoryID = filter_input(INPUT_GET, 'TicketInventoryID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['TicketInventory'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketInventoryID = $_SESSION[GLM_EVENT_SESSION]['TicketInventory'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->editEntry($ticketInventoryID);
+
+ return $ticketInventoryDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Ticket
+ *
+ * @return array
+ */
+ function updateTicketInventory()
+ {
+
+ // Removing "active" field to keep inventory update from messing with active flag
+ $saveActive = $this->fields['active'];
+ unset($this->fields['active']);
+
+ if (($ticketInventoryID = filter_input(INPUT_GET, 'TicketInventoryID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['TicketInventory'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketInventoryID = $_SESSION[GLM_EVENT_SESSION]['TicketInventory'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Check if there's existing inventory data
+
+
+ // Try to update this data
+ $r = $this->updateEntry($ticketInventoryID);
+
+ // Restore "active" field
+ $this->fields['active'] = $saveActive;
+
+ return $r;
+
+ }
+
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataTicketPackages.php b/classes/data/dataTicketPackages.php
new file mode 100644
index 0000000..dfb3f44
--- /dev/null
+++ b/classes/data/dataTicketPackages.php
@@ -0,0 +1,347 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketPackage.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTicketPackage class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataTicketPackages extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_package';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Pointer to ticket that is acting as a package container
+ 'ticket_package' => array(
+ 'field' => 'package',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Pointer to ticket that is contained in the package
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Quantity
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Separate Voucher Flag
+ 'separate_voucher' => array(
+ 'field' => 'separate_voucher',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Package Name
+ 'package_name' => array(
+ 'field' => 'package',
+ 'as' => 'package_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'title',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Name
+ 'member_name' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Performance Name
+ 'performance_name' => array(
+ 'field' => 'performance',
+ 'as' => 'performance_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.performance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Title
+ 'ticket_title' => array(
+ 'field' => 'ticket',
+ 'as' => 'title',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'title',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Active
+ 'active' => array(
+ 'field' => 'ticket',
+ 'as' => 'active',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'active',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Get Package Tickets list
+ *
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getPackageList($where)
+ {
+
+ // Get the package contents
+ $packageData = $this->getList($where);
+ if (count($packageData) == 0) {
+ return false;
+ }
+
+ // Build output array with package ticket as key
+ $outData = array();
+ if ($packageData && count($packageData) > 0) {
+ foreach ($packageData as $p) {
+ $outData[$p['ticket']] = $p;
+ }
+ }
+ return $outData;
+
+ }
+
+ /**
+ * Update package tickets list
+ *
+ * Expects request input "selected_ticket_quant[id]" array.
+ */
+ public function updatePackageTicketsList($packageID = false)
+ {
+ // Check for good package ID
+ $pID = $packageID - 0;
+ if ($pID <= 0) {
+ return false;
+ }
+
+ // Try to retrieve package to make sure it exists and is a package
+ $sql = "
+ SELECT id
+ FROM eventmgt.ticket
+ WHERE id = $pID
+ AND ticket_type = 20
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $packageData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($packageData) != 1) {
+ return false;
+ }
+
+ // Query to delete all for selected package
+ $sql = "
+ BEGIN;
+ DELETE FROM eventmgt.ticket_package
+ WHERE package = $packageID;
+ ";
+
+ // Now add in any tickets in request
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+ $Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+ $newTickets = $_REQUEST['selected_ticket_quant'];
+
+ if ($newTickets) {
+
+ foreach ($newTickets as $k=>$v) {
+
+ // Get ticket data
+ $ticketData = $Tickets->getEntry($k);
+ if (is_array($ticketData)) {
+
+ // Check for separate vouchers
+ $separateVoucher = 'false';
+ if (isset($_REQUEST['selected_ticket_separatevoucher'][$k])) {
+ $separateVoucher = 'true';
+ }
+
+ $sql .= "
+ INSERT INTO eventmgt.ticket_package
+ (package, ticket, member, performance, quant, sort, separate_voucher)
+ VALUES ($packageID, $k, ".$ticketData['member'].", ".$ticketData['performance_id'].", $v, 99, $separateVoucher)
+ ;";
+ }
+
+ }
+ }
+ $sql .= "COMMIT;";
+ $this->dbh->exec($sql);
+
+ return $this->getPackageList("package = $packageID");
+
+ }
+
+ /**
+ * Clear package tickets list
+ */
+ public function clearPackageTicketsList($packageID = false)
+ {
+
+ // Check for good package ID
+ $pID = $packageID - 0;
+ if ($pID <= 0) {
+ return false;
+ }
+
+ $sql = "
+ DELETE FROM eventmgt.ticket_package
+ WHERE package = $packageID;
+ ";
+ $this->dbh->exec($sql);
+
+ return;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataTickets.php b/classes/data/dataTickets.php
new file mode 100644
index 0000000..1a5a3b8
--- /dev/null
+++ b/classes/data/dataTickets.php
@@ -0,0 +1,923 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataTickets extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Admin Only Flag
+ 'admin_only' => array(
+ 'field' => 'admin_only',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Type
+ 'ticket_type' => array(
+ 'field' => 'ticket_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 10,
+ 'use' => 'a'
+ ),
+
+ // Member ID for adding tickets
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'a'
+ ),
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Name (internal use)
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Title (for display to users)
+ 'title' => array(
+ 'field' => 'title',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Performance
+ 'performance' => array(
+ 'field' => 'performance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.performance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_where' => 'member = '.$_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Performance'],
+ 'use' => 'nideu'
+ ),
+
+ // Performance_view
+ 'performance_view' => array(
+ 'field' => 'performance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.performance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Performance ID
+ 'performance_id' => array(
+ 'field' => 'performance',
+ 'as' => 'performance_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Section
+ 'section' => array(
+ 'field' => 'section',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.section',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_where' => 'member = '.$_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nideu'
+ ),
+
+ // Section View
+ 'section_view' => array(
+ 'field' => 'section',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.section',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Section ID
+ 'section_id' => array(
+ 'field' => 'section',
+ 'as' => 'section_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Available for Sale Start Date
+ 'for_sale_start_date' => array(
+ 'field' => 'for_sale_start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y').' -1 year'), // Earliest is now less 1 year
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Available for Sale End Date
+ 'for_sale_end_date' => array(
+ 'field' => 'for_sale_end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y').' -1 year'), // Earliest is now less 1 year
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Date Specific - use single or multiple inventory
+ 'date_specific' => array(
+ 'field' => 'date_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Days of the week to create default inventory - multi-pick
+ 'days_of_week' => array(
+ 'field' => 'days_of_week',
+ 'as' => false,
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config->days->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0, // Note that this is a bitmap of card indexes
+ 'use' => 'a'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Time Specific
+ 'time_specific' => array(
+ 'field' => 'time_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Time
+ 'ticket_time' => array(
+ 'field' => 'ticket_time',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => '12:00 PM',
+ 'use' => 'a'
+ ),
+
+ // Ticket Timestamp
+ 'ticket_timestamp' => array(
+ 'field' => 'ticket_time',
+ 'as' => 'ticket_timestamp',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Unlimited Use
+ 'unlimited_use' => array(
+ 'field' => 'unlimited_use',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Number of uses
+ 'uses' => array(
+ 'field' => 'uses',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Unlimited Quantity
+ 'unlimited_quant' => array(
+ 'field' => 'unlimited_quant',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => true,
+ 'use' => 'a'
+ ),
+
+ // Quantity - Number of these tickets in the section
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'lgnieud'
+ ),
+
+ // Price
+ 'price' => array(
+ 'field' => 'price',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Consignment Type
+ 'consignment_type' => array(
+ 'field' => 'consignment_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_consignment_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Cart Sticky (Always displayed on cart - even with no quant)
+ 'cart_sticky' => array(
+ 'field' => 'cart_sticky',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a',
+ 'callback' => function ($r) {
+ $r['status'] = false;
+ return $r;
+ }
+ ),
+
+ // Show ticket on Start Page
+ 'show_on_start' => array(
+ 'field' => 'show_on_start',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on Selection Required
+ 'addon_required' => array(
+ 'field' => 'addon_required',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Price
+ 'price_numb' => array(
+ 'field' => 'price',
+ 'as' => 'price_numb',
+ 'type' => 'float',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher Text
+ 'voucher_text' => array(
+ 'field' => 'voucher_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher LeftEnd Text - overrides other text for that area if set
+ 'voucher_leftend_text' => array(
+ 'field' => 'voucher_leftend_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher Type
+ 'voucher_type' => array(
+ 'field' => 'voucher_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_voucher_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ // Check that Sticky is not used with date-specific inventory
+ if ($r['fieldData']['date_specific']['value'] && $r['fieldData']['cart_sticky']['value']) {
+ $r['status'] = false;
+ $r['fieldFail']['cart_sticky'] = 'Sticky may not be used when "Specified Dates" is checked.';
+ $r['fieldFail']['date_specific'] = 'Specified dates may not be used when "Sticky" is checked.';
+ }
+
+ return $r;
+ }
+
+ /**
+ * Get Tickets list
+ *
+ * @param integer $memberID Specifies tickets for a Member ID
+ * @param integer $performanceID Specifies tickets for a Performance ID
+ * @param integer $sectionID Specifies tickets for a Section ID
+ * @param string $listType Type of list to generate
+ * "norm" Standard list output with detail
+ * 'all' List all and ignore member, performance, section ID
+ * 'packageSelect' List package selection with only ID, Name, Member, Performance, Section, active
+ * Optional specify $notTicketID to not include the current ticket by ID
+ * Sorts by Member, Performance, Section, then Ticket
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketsList($memberID = false, $performanceID = false, $sectionID = false, $listType = false, $activeOnly = false, $where = false, $includeAdminOnly = false, $notTicketID = false, $packages = true)
+ {
+ // Get member ID - But don't use it if performance or section IDs are supplied.
+ if ($memberID == false && !$performanceID && !$sectionID) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+
+ // Get performance ID
+ if ($performanceID == false) {
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+ }
+
+ // Get section ID
+ if ($sectionID == false) {
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+ }
+
+ // Get URI search type
+ if (!$listType && isset($_REQUEST['listType'])) {
+ $listType = $_REQUEST['listType'];
+ }
+
+ // Build query Where clause
+ if ($where == false) {
+ $where = 'true';
+ }
+
+ // Check for active only request
+ if ($activeOnly) {
+ $where .= ' AND T.active';
+ }
+
+ // Check if adminUser
+ if (!$includeAdminOnly) {
+ $where .= ' AND NOT T.admin_only';
+ }
+
+ // Check if packages aren't enabled
+ if (!$packages) {
+ $where .= ' AND T.ticket_type != 20';
+ }
+
+ $fieldsSave = false;
+
+ switch ($listType) {
+
+ case 'packageSelect':
+
+ // Save current field list
+ $fieldsSave = $this->fields;
+ $this->fields = array(
+ 'id' => $this->fields['id'],
+ 'name' => $this->fields['name'],
+ 'title' => $this->fields['title'],
+ 'member_name' => $this->fields['member_view'],
+ 'performance_view' => $this->fields['performance_view'],
+ 'section_view' => $this->fields['section_view'],
+ 'active' => $this->fields['active']
+ );
+
+ $where = '
+ T.ticket_type != 20
+ AND T.addon_required = false
+ '.($notTicketID ? ' AND T.id != '.$notTicketID : '').'
+ ';
+ if ($memberID) {
+ $where .= " AND ( T.member = $memberID OR T.consignment_type > 1)";
+ } else {
+ $where .= 'AND T.consignment_type > 1';
+ }
+
+ $sort = '';
+
+ break;
+
+ case 'norm':
+ default:
+ if ($memberID) {
+ $where .= " AND T.member = $memberID";
+ }
+ if ($performanceID) {
+ $where .= " AND T.performance = $performanceID";
+ }
+ if ($sectionID) {
+ $where .= " AND T.section = $sectionID";
+ }
+ $sort = 'sort, name';
+ break;
+
+ case 'all':
+ $sort = 'sort, name';
+ break;
+
+ }
+
+ // Get list of Tickets
+ $ticketsList = $this->getList($where, 'sort, name');
+
+ if ($fieldsSave != false) {
+ $this->fields = $fieldsSave;
+ }
+
+ // If type packageSelect
+ if ($listType == 'packageSelect') {
+
+ // Sort by member, performance, section, ticket names.
+ function packageSelectSort($a, $b) {
+ if ($a['member_name'] == $b['member_name'] && $a['performance'] == $b['performance'] && $a['section'] == $b['section'] && $a['title'] == $b['title'] ) {
+ return 0;
+ }
+ if ($a['member_name'] < $b['member_name']) { return -1; }
+ if ($a['member_name'] > $b['member_name']) { return 1; }
+ if ($a['performance'] < $b['performance']) { return -1; }
+ if ($a['performance'] > $b['performance']) { return 1; }
+ if ($a['section'] < $b['section']) {return -1;}
+ if ($a['section'] > $b['section']) {return 1;}
+ if ($a['title'] < $b['title']) {return -1;}
+ return 1;
+ }
+ uasort($ticketsList, 'packageSelectSort');
+
+ // Save names, Remove subsequent member, performance, section until change
+ $memberName = '';
+ $performanceName = '';
+ $sectionName = '';
+ while (list($k, $v) = each($ticketsList)) {
+
+ // Also provide active as Yes/No
+ $ticketsList[$k]['active_name'] = ($v['active'] ? 'Yes' : 'No');
+
+ // Save names for adding to selected list
+ $ticketsList[$k]['member_save'] = $v['member_name'];
+ $ticketsList[$k]['performance_save'] = $v['performance'];
+ $ticketsList[$k]['section_save'] = $v['section'];
+
+ // Remove duplicate names for ordered picklist
+ if ($v['member_name'] != $memberName) {
+ $memberName = $v['member_name'];
+ $performanceName = '';
+ $sectionName = '';
+ } else {
+ $ticketsList[$k]['member_name'] = '';
+ }
+ if ($v['performance'] != $performanceName) {
+ $performanceName = $v['performance'];
+ $sectionName = '';
+ } else {
+ $ticketsList[$k]['performance'] = '';
+ }
+ if ($v['section'] != $sectionName) {
+ $sectionName = $v['section'];
+ } else {
+ $ticketsList[$k]['performance'] = '';
+ }
+
+ }
+
+ }
+
+ return $ticketsList;
+ }
+
+ /**
+ * Get Ticket Detail
+ *
+ * @return array
+ */
+ function getTicketDetail($ticketID = false)
+ {
+
+ // If a ticket has been specified
+ if ($ticketID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ // Otherwise if there's a ticket ID in the request
+ } elseif (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->getEntry($ticketID);
+
+ return $ticketDetail;
+
+ }
+
+ /**
+ * Edit Ticket
+ *
+ * @return array
+ */
+ function editTicket()
+ {
+
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->editEntry($ticketID);
+
+ return $ticketDetail;
+
+ }
+
+ /**
+ * Update Ticket
+ *
+ * @return array
+ */
+ function updateTicket()
+ {
+
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($ticketID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Ticket
+ *
+ * @return array
+ */
+ function newTicket()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Ticket
+ *
+ * @return array
+ */
+ function insertTicket()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current ticket to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Ticket
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function ticketDelete($confirm = false)
+ {
+
+ // Is there a new ticket code selected?
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have an ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->deleteEntry($ticketID, $confirm);
+
+ return $ticketDetail;
+
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataVoucherCoupons.php b/classes/data/dataVoucherCoupons.php
new file mode 100644
index 0000000..a4f0850
--- /dev/null
+++ b/classes/data/dataVoucherCoupons.php
@@ -0,0 +1,472 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataVoucherCoupons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataVoucherCoupons class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataVoucherCoupons,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementDataVoucherCoupons extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.voucher_coupons';
+
+ /**
+ * 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($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Voucher Coupon Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => true,
+ 'use' => 'a'
+ ),
+
+ // Coupon Type
+ 'coupon_type' => array(
+ 'field' => 'coupon_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->coupon_type->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Coupon Position
+ 'coupon_position' => array(
+ 'field' => 'coupon_position',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->coupon_position->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Display From Date
+ 'display_from' => array(
+ 'field' => 'display_from',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => time(),
+ 'use' => 'a'
+ ),
+
+ // Display To Date
+ 'display_to' => array(
+ 'field' => 'display_to',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => strtotime('12/31/'.date('Y').' +4 years'),
+ 'use' => 'a'
+ ),
+
+ // Stretch to Fit
+ 'stretch_to_fit' => array(
+ 'field' => 'stretch_to_fit',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image Padding
+ 'padding' => array(
+ 'field' => 'padding',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Show Border
+ 'show_border' => array(
+ 'field' => 'show_border',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Coupon Image
+ 'coupon_image' => array(
+ 'field' => 'coupon_image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Maximum Display Count (-1 = unlimited)
+ 'max_display_count' => array(
+ 'field' => 'max_display_count',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => -1,
+ 'use' => 'a'
+ ),
+
+ // Display Count
+ 'display_count' => array(
+ 'field' => 'display_count',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ return $r;
+ }
+
+
+ /**
+ * Get Voucher Coupon list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getVoucherCouponList($where = '')
+ {
+
+ // Build query Where clause
+ if ($where == '') {
+ $where = 'true';
+ }
+
+ // Get list of Voucher Coupons
+ $voucherCouponsList = $this->getList($where, 'name');
+
+ return $voucherCouponsList;
+ }
+
+ /**
+ * Get Voucher Coupon Detail
+ *
+ * @return array
+ */
+ function getVoucherCouponDetail($voucherCouponID = false)
+ {
+
+ // If a voucher coupon has been specified
+ if ($voucherCouponID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ // Otherwise if there's a voucher coupon ID in the request
+ } elseif (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a Voucher Coupon submitted, so save that
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have a voucher coupon id
+ return false;
+
+ }
+
+ $voucherCouponDetail = $this->getEntry($voucherCouponID);
+
+ return $voucherCouponDetail;
+
+ }
+
+ /**
+ * Edit Voucher Coupon
+ *
+ * @return array
+ */
+ function editVoucherCoupon()
+ {
+
+ if (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have a voucher coupon id
+ return false;
+
+ }
+
+ $voucherCouponDetail = $this->editEntry($voucherCouponID);
+
+ return $voucherCouponDetail;
+
+ }
+
+ /**
+ * Update Voucher Coupon
+ *
+ * @return array
+ */
+ function updateVoucherCoupon()
+ {
+
+ if (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have a voucher coupon id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($voucherCouponID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Voucher Coupon
+ *
+ * @return array
+ */
+ function newVoucherCoupon()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Voucher Coupon
+ *
+ * @return array
+ */
+ function insertVoucherCoupon()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current voucher coupone to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Voucher Coupon
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function voucherCouponDelete($confirm = false)
+ {
+
+ // Is there a new voucher coupon code selected?
+ if (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have an voucher coupon id
+ return false;
+
+ }
+
+ $voucherCouponDetail = $this->deleteEntry($voucherCouponID, $confirm);
+
+ return $voucherCouponDetail;
+
+ }
+
+ /**
+ * Get Voucher Coupon List for Display
+ *
+ * @param $date string Date to use for selection (usually today unless testing)
+ *
+ * @return array
+ */
+ function getCouponsForDisplay($date = false)
+ {
+
+ $where = '';
+
+ // If no date (time) has been supplied
+ if (!$date) {
+ $date = date('m/d/Y', time());
+ }
+ $where = "T.active AND '$date' >= T.display_from AND '$date' <= T.display_to";
+
+ $coupons = $this->getVoucherCouponList($where);
+
+ if (!is_array($coupons) || count($coupons) == 0) {
+ return false;
+ }
+
+ // Convert to array organized by location
+ $cr = array();
+ foreach ($coupons as $c) {
+ $cr[$c['coupon_position']['value']][] = $c;
+ }
+
+ // Shuffle order of coupons in each location (randomize)
+ foreach ($cr as $k => $v) {
+ shuffle($cr[$k]);
+ }
+
+ return $cr;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/configs/common.ini b/configs/common.ini
new file mode 100644
index 0000000..deb1b9b
--- /dev/null
+++ b/configs/common.ini
@@ -0,0 +1,807 @@
+; Configuration File for Event Management System - V3
+;
+; This file contains common configuration for all sites using this Event Management
+; System on this server. Each site also has local configuration for this application
+; in a config/applications/EventManagement.ini file in the site.
+;
+; Custom configurations for development and developer configuration at bottom of file.
+
+[common]
+
+applicationName = "Event Management"
+applicationVersion = "EventManagement/V3"
+dataAbstractLocation = "Database/V0"
+pdfAbstractLocation = "PDF/V0"
+paymentProcessorsLocation = "PaymentProcessors/V0"
+imageServerAbstractLocation = "ImageServer/V0"
+internalReportingAddress = "cscott@gaslightmedia.com"
+
+orderVerificationSecret = "GLMOrder2secreT"
+
+;
+; ********** NEED TO VERIFY EVERYTHING BELOW **************
+;
+
+; Base URL/paths for front-end of this application
+url.members = CURRENT_BASE_URL "members-only-area/?page_id=122"
+path.front_end = BASE_PATH ""
+path.admin = BASE_PATH "admin/Event_Housing/"
+path.common = "/var/www/server/CommonApps/"
+
+; Admin Interface Selection
+default_admin_interface = "tickets"
+admin_interface.selectable = false;
+admin_interface.tickets = "tickets"
+admin_interface_type.tickets = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+
+; Front End Interface Selection
+; default_front_interface (set in customer configuration)
+front_interface.selectable = false;
+
+; Front End Interfaces
+; "tickets"
+front_interface.tickets = "tickets"
+front_interface_type.tickets = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "TicketsFoundation"
+front_interface.TicketsFoundation = "TicketsFoundation"
+front_interface_type.TicketsFoundation = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "FoundationStandAlone" - Used for foundation with tickets when Foundation is not loaded for the site
+front_interface.FoundationStandAlone = "TicketsFoundation"
+front_interface_type.FoundationStandAlone = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "SaultSteMarie"
+front_interface.SaultSteMarie = "SaultSteMarie"
+front_interface_type.SaultSteMarie = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "Gaslight"
+front_interface.Gaslight = "Gaslight"
+front_interface_type.Gaslight = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "MMM"
+front_interface.MMM = "MMM"
+front_interface_type.MMM = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "PointerBoat"
+front_interface.PointerBoat = "PointerBoat"
+front_interface_type.PointerBoat = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+
+; Set Database Date Style - uncomment desired style
+;misc.datestyle = "SET DATESTYLE TO 'ISO';" ;ISO example: 1997-12-17 07:37:16-08';\n"
+misc.datestyle = "SET DATESTYLE TO 'SQL';" ;SQL example: 12/17/1997 07:37:16.00 PST';\n"
+;misc.datestyle = "SET DATESTYLE TO 'Postgres';" ;Postgres example: Wed Dec 17 07:37:16 1997 PST';\n"
+;misc.datestyle = "SET DATESTYLE TO 'European';" ;European example: 17/12/1997 15:37:16.00 MET';\n"
+;misc.datestyle = "SET DATESTYLE TO 'US';" ;US example: 12/17/1997 07:37:16.00 PST';\n"
+;misc.datestyle = "SET DATESTYLE TO 'German';" ;German example: 17.12.1997 07:37:16.00 PST';\n"
+
+; Standard arrays
+
+; Member Types
+member_type.1 = "Standard"
+member_type.2 = "Standard + Sells other's items"
+member_type.3 = "Vendor of items only sold through others"
+member_type.10 = "Other - neither vendor nor sales"
+
+; Ticket consignment types
+ticket_consignment_type.1 = "Not sold by other locations"
+ticket_consignment_type.2 = "Available for sale by other locations"
+ticket_consignment_type.3 = "Sold only by other locations"
+
+; Ticket voucher types - Note types < 80 are tickets, > 80 are things sold
+ticket_voucher_type.1 = "Standard Voucher/Ticket with Barcode"
+ticket_voucher_type.11 = "Voucher/Ticket for Pickup - no Barcode"
+ticket_voucher_type.12 = "Voucher/Ticket to be mailed Mailed - no Barcode"
+ticket_voucher_type.81 = "Object Sold (i.e. books) to be claimed - with Barcode"
+ticket_voucher_type.82 = "Object Sold (i.e. books) to be mailed - no Barcode"
+
+; Ticket Types
+ticket_type.10 = 'Standard'
+ticket_type.20 = 'Package'
+
+; Ticket Add-On Types
+ticket_add_on_type.1 = 'Checkbox'
+ticket_add_on_type.2 = 'Quantity'
+
+; Promo Ticket Types
+promo_ticket_type.1 = '$ Amount'
+promo_ticket_type.2 = 'Percentage'
+
+; Permissions
+permissions.10 = "Full Venue Access"
+permissions.20 = "Ticket Orders and Claims"
+permissions.30 = "Ticket Claims Only"
+permissions.99 = "No Access"
+
+; Permissions References
+permissions_numb.full = 10
+permissions_numb.orders_and_claims = 20
+permissions_numb.claims = 30
+permissions_numb.none = 99
+
+; Pending cart hold types
+hold_types.reservation = 1
+hold_types.ticket = 2
+
+; Claim Tracking Types by Name
+claim_tracking_types_numb.claim = 1
+claim_tracking_types_numb.clear = 2
+
+; Claim Tracking Types
+claim_tracking_types.1 = "Claimed"
+claim_tracking_types.2 = "Claim Cleared"
+
+; Processing Methods
+proc_method.1 = merchant ;Merchant processes cards
+proc_method.2 = processed ;Processed by a card processor
+
+; Card Processors by number
+ccard_processor.0 = "(none - select processor)"
+ccard_processor.3 = "No Payment Processing at Checkout"
+ccard_processor.99 = "Card Processing Test"
+ccard_processor.1 = "Authorize.net"
+ccard_processor.2 = "Merchant Solutions"
+
+; Card Processors by name
+ccard_processor_numb.none = 0
+ccard_processor_numb.authorize_net = 1
+ccard_processor_numb.merchant_solutions = 2
+ccard_processor_numb.no_payment = 3
+ccard_processor_numb.test = 99
+
+; Card processing mode options
+cc_mode.1 = "Local Transaction Approval Test"
+cc_mode.2 = "Local Transaction Decline Test"
+cc_mode.3 = "On-Line Transaction Test"
+cc_mode.0 = "Production Mode"
+
+; PayPal processing mode options
+paypal_mode.3 = "On-Line Transaction Test"
+paypal_mode.0 = "Production Mode"
+
+; Processing Status
+proc_status.new = 0
+proc_status.descr.0 = "New Registration Record"
+proc_status.unpaid = 1
+proc_status.descr.1 = "Not Paid"
+proc_status.cc_pend = 2
+proc_status.descr.2 = "Credit Card Pending"
+proc_status.cc_paid = 3
+proc_status.descr.3 = "Paid by Credit Card"
+proc_status.cc_decl = 4
+proc_status.descr.4 = "Credit Card Declined"
+proc_status.check_pend = 5
+proc_status.descr.5 = "Check Pending"
+proc_status.check_paid = 6
+proc_status.descr.6 = "Paid by Check"
+proc_status.comp = 7
+proc_status.descr.7 = "Complimentary"
+proc_status.failed = 98
+proc_status.descr.98 = "Submission Failed"
+proc_status.canceled = 99
+proc_status.descr.99 = "Canceled"
+
+; Payment Types
+pay_types.1 = "Credit Card"
+pay_types.2 = "Check"
+pay_types.3 = "Direct"
+pay_types.4 = "PayPal"
+
+; Credit Cards - numbers are an exponent of 2 that represent the bit position
+ccard.0 = "Visa"
+ccard.1 = "MasterCard"
+ccard.2 = "American Express"
+ccard.3 = "Discover"
+ccard.4 = "Diners Club"
+
+; Credit Card validation strings (regular expression)
+ccverify.0 = "^4.{15}$|^4.{12}$"
+ccverify.1 = "^5[1-5].{14}$"
+ccverify.2 = "^3[47].{13}$"
+ccverify.3 = "^6011.{12}$"
+ccverify.4 = "^30[0-5].{11}$|^3[68].{12}$"
+
+; Confirmation Methods
+conf_methods.1 = "US Mail"
+conf_methods.2 = "E-Mail"
+
+; Reference Types
+reference_type.misc = 0
+reference_type.event = 1
+reference_type.member = 2
+reference_type.state = 3
+reference_type.team = 4
+
+; Voucher Check Character Secret
+voucher_check_secret = "emVoucherCheck1"
+
+; Reference Type Numbers
+reference_type_numb.0 = "Misc"
+reference_type_numb.1 = "Event"
+reference_type_numb.2 = "Member/Venue"
+reference_type_numb.3 = "State Rep"
+reference_type_numb.4 = "Team"
+
+; Fee Method
+fee_method.fixed_stay = 1
+fee_method.fixed_accom = 2
+fee_method.fixed_accomnight = 3
+fee_method.percent_stay = 10
+
+; Fee Method Numbers
+fee_method_numb.1 = "Per Reservation"
+fee_method_numb.2 = "Per Room"
+fee_method_numb.3 = "Per Night"
+fee_method_numb.10 = "Percent of Room Rate"
+
+; Member/Venue Amenities
+; Static amenitities set system-wide
+; Only 10 fields in member records for these at this time
+; Needs to be replaced with managed amenities list
+memb_amen.1 = "Air-Conditioning"
+memb_amen.2 = "Barrier Free"
+memb_amen.3 = "Coffee Pot"
+memb_amen.4 = "Hair Dryer"
+memb_amen.5 = "Interior Corridor"
+memb_amen.6 = "Microwave"
+memb_amen.7 = "Refrigerator"
+;memb_amen.8 = "Shopping nearby"
+;memb_amen.9 = "Indoor pool"
+;memb_amen.10 = "Outdoor pool"
+;memb_amen.? = "Sauna"
+;memb_amen.? = "Whirlpool"
+;memb_amen.? = "Valet/Charge Parking"
+;memb_amen.? = "Self-operated coin laundry"
+;memb_amen.? = "Free parking"
+;memb_amen.? = "Fitness area"
+;memb_amen.? = "Room service"
+;memb_amen.? = "Conference/Meeting facilities"
+;memb_amen.? = "Restaurant nearby"
+;memb_amen.? = "Restaurant on site"
+;memb_amen.? = "Barrier free guest rooms available"
+;memb_amen.? = "Pets"
+;memb_amen.? = "Golf nearby"
+
+; Accommodatation Amenitities
+; NOT USED AT THIS TIME
+;accom_amen.1 = "Cable TV"
+;accom_amen.2 = "Movies in Room"
+;accom_amen.3 = "Barrier Free Access"
+;accom_amen.4 = "Smoke Free Room"
+;accom_amen.5 = "Jacuzzi in Room"
+;accom_amen.6 = "Iron and Ironing Board"
+;accom_amen.7 = "Coffee Pot in Room"
+;accom_amen.8 = "Refrigerator in Room"
+;accom_amen.9 = "Microwave in Room"
+;accom_amen.10 = "Safe"
+;accom_amen.11 = "Hair Dryer"
+
+; Accommodation Room Categories
+room_category.0 = "n/a"
+room_category.1 = "Bed"
+room_category.2 = "Room"
+room_category.3 = "Suite"
+
+; Accommodation Room Types
+room_types.0 = "n/a"
+room_types.1 = "Main"
+room_types.2 = "Bedroom"
+room_types.3 = "Kitchen"
+room_types.4 = "Living Room"
+
+; Accommodation Bath Types
+bath_types.0 = "None"
+bath_types.1 = "Full"
+bath_types.2 = "Half"
+bath_types.3 = "Sink"
+
+; Voucher Coupon Types
+coupon_type.0 = "Image"
+; coupon_type.1 = "PDF"
+; coupon_type.2 = "Text"
+
+; Days of the week - numbers are an exponent of 2 that represent the bit position
+days.0 = "Sunday"
+days.1 = "Monday"
+days.2 = "Tuesday"
+days.3 = "Wednesday"
+days.4 = "Thursday"
+days.5 = "Friday"
+days.6 = "Saturday"
+
+; States
+states.AL = "Alabama"
+states.AK = "Alaska"
+states.AB = "Alberta"
+states.AZ = "Arizona"
+states.AR = "Arkansas"
+states.BC = "British Columbia"
+states.CA = "California"
+states.CO = "Colorado"
+states.CT = "Connecticut"
+states.DE = "Delaware"
+states.DC = "District of Columbia"
+states.FL = "Florida"
+states.GA = "Georgia"
+states.GU = "Guam"
+states.HI = "Hawaii"
+states.ID = "Idaho"
+states.IL = "Illinois"
+states.IN = "Indiana"
+states.IA = "Iowa"
+states.KS = "Kansas"
+states.KY = "Kentucky"
+states.LA = "Louisiana"
+states.ME = "Maine"
+states.MB = "Manitoba"
+states.MD = "Maryland"
+states.MA = "Massachusetts"
+states.MI = "Michigan"
+states.MN = "Minnesota"
+states.MS = "Mississppi"
+states.MO = "Missouri"
+states.MT = "Montana"
+states.NE = "Nebraska"
+states.NV = "Nevada"
+states.NB = "New Brunswick"
+states.NF = "Newfoundland"
+states.NH = "New Hampshire"
+states.NJ = "New Jersey"
+states.NM = "New Mexico"
+states.NY = "New York"
+states.NC = "North Carolina"
+states.ND = "North Dakota"
+states.NT = "Northwest Territories"
+states.NS = "Nova Scotia"
+states.OH = "Ohio"
+states.OK = "Oklahoma"
+states.ON = "Ontario"
+states.OR = "Oregon"
+states.PA = "Pennsylvania"
+states.PE = "Prince Edward Island"
+states.PR = "Puerto Rico"
+states.QC = "Quebec"
+states.RI = "Rhode Island"
+states.SK = "Saskatchewan"
+states.SC = "South Carolina"
+states.SD = "South Dakota"
+states.TN = "Tennessee"
+states.TX = "Texas"
+states.UT = "Utah"
+states.VT = "Vermont"
+states.VI = "Virgin Islands"
+states.VA = "Virginia"
+states.WA = "Washington"
+states.WV = "West Virginia"
+states.WI = "Wisconsin"
+states.WY = "Wyoming"
+states.YT = "Yukon"
+
+; Countries
+countries.US = "United States"
+countries.CA = "Canada"
+countries.AF = "Afghanistan"
+countries.AX = "Land Islands"
+countries.AL = "Albania"
+countries.DZ = "Algeria"
+countries.AS = "American Samoa"
+countries.AD = "Andorra"
+countries.AO = "Angola"
+countries.AI = "Anguilla"
+countries.AQ = "Antarctica"
+countries.AG = "Antigua and Barbuda"
+countries.AR = "Argentina"
+countries.AM = "Armenia"
+countries.AW = "Aruba"
+countries.AU = "Australia"
+countries.AT = "Austria"
+countries.AZ = "Azerbaijan"
+countries.BS = "Bahamas"
+countries.BH = "Bahrain"
+countries.BD = "Bangladesh"
+countries.BB = "Barbados"
+countries.BY = "Belarus"
+countries.BE = "Belgium"
+countries.BZ = "Belize"
+countries.BJ = "Benin"
+countries.BM = "Bermuda"
+countries.BT = "Bhutan"
+countries.BO = "Bolivia"
+countries.BA = "Bosnia and Herzegovina"
+countries.BW = "Botswana"
+countries.BV = "Bouvet Island"
+countries.BR = "Brazil"
+countries.IO = "British Indian Ocean Territory"
+countries.BN = "Brunei Darussalam"
+countries.BG = "Bulgaria"
+countries.BF = "Burkina Faso"
+countries.BI = "Burundi"
+countries.KH = "Cambodia"
+countries.CM = "Cameroon"
+countries.CV = "Cape Verde"
+countries.KY = "Cayman Islands"
+countries.CF = "Central African Republic"
+countries.TD = "Chad"
+countries.CL = "Chile"
+countries.CN = "China"
+countries.CX = "Christmas Island"
+countries.CC = "Cocos (Keeling) Islands"
+countries.CO = "Colombia"
+countries.KM = "Comoros"
+countries.CG = "Congo"
+countries.CD = "Congo, the Democratic Rep. of"
+countries.CK = "Cook Islands"
+countries.CR = "Costa Rica"
+countries.CI = "Cote D'Ivoire"
+countries.HR = "Croatia"
+countries.CU = "Cuba"
+countries.CY = "Cyprus"
+countries.CZ = "Czech Republic"
+countries.DK = "Denmark"
+countries.DJ = "Djibouti"
+countries.DM = "Dominica"
+countries.DO = "Dominican Republic"
+countries.EC = "Ecuador"
+countries.EG = "Egypt"
+countries.SV = "El Salvador"
+countries.GQ = "Equatorial Guinea"
+countries.ER = "Eritrea"
+countries.EE = "Estonia"
+countries.ET = "Ethiopia"
+countries.FK = "Falkland Islands (Malvinas)"
+countries.FO = "Faroe Islands"
+countries.FJ = "Fiji"
+countries.FI = "Finland"
+countries.FR = "France"
+countries.GF = "French Guiana"
+countries.PF = "French Polynesia"
+countries.TF = "French Southern Territories"
+countries.GA = "Gabon"
+countries.GM = "Gambia"
+countries.GE = "Georgia"
+countries.DE = "Germany"
+countries.GH = "Ghana"
+countries.GI = "Gibraltar"
+countries.GR = "Greece"
+countries.GL = "Greenland"
+countries.GD = "Grenada"
+countries.GP = "Guadeloupe"
+countries.GU = "Guam"
+countries.GT = "Guatemala"
+countries.GN = "Guinea"
+countries.GW = "Guinea-Bissau"
+countries.GY = "Guyana"
+countries.HT = "Haiti"
+countries.HM = "Heard Island, McDonald Islands"
+countries.VA = "Holy see (Vatican City State)"
+countries.HN = "Honduras"
+countries.HK = "Hong Kong"
+countries.HU = "Hungary"
+countries.IS = "Iceland"
+countries.IN = "India"
+countries.ID = "Indonesia"
+countries.IR = "Iran, Islamic Republic of"
+countries.IQ = "Iraq"
+countries.IE = "Ireland"
+countries.IL = "Israel"
+countries.IT = "Italy"
+countries.JM = "Jamaica"
+countries.JP = "Japan"
+countries.JO = "Jordan"
+countries.KZ = "Kazakhstan"
+countries.KE = "Kenya"
+countries.KI = "Kiribati"
+countries.KP = "Korea, Democratic People's Rep. of"
+countries.KR = "Korea, Republic of"
+countries.KW = "Kuwait"
+countries.KG = "Kyrgyzstan"
+countries.LA = "Lao People's Democratic Republic"
+countries.LV = "Latvia"
+countries.LB = "Lebanon"
+countries.LS = "Lesotho"
+countries.LR = "Liberia"
+countries.LY = "Libyan Arab Jamahiriya"
+countries.LI = "Liechtenstein"
+countries.LT = "Lithuania"
+countries.LU = "Luxembourg"
+countries.MO = "Macao"
+countries.MK = "Macedonia, the Former Yugoslav Rep."
+countries.MG = "Madagascar"
+countries.MW = "Malawi"
+countries.MY = "Malaysia"
+countries.MV = "Maldives"
+countries.ML = "Mali"
+countries.MT = "Malta"
+countries.MH = "Marshall Islands"
+countries.MQ = "Martinique"
+countries.MR = "Mauritania"
+countries.MU = "Mauritius"
+countries.YT = "Mayotte"
+countries.MX = "Mexico"
+countries.FM = "Micronesia, Federated States of"
+countries.MD = "Moldova, Republic of"
+countries.MC = "Monaco"
+countries.MN = "Mongolia"
+countries.MS = "Montserrat"
+countries.MA = "Morocco"
+countries.MZ = "Mozambique"
+countries.MM = "Myanmar"
+countries.NA = "Namibia"
+countries.NR = "Nauru"
+countries.NP = "Nepal"
+countries.NL = "Netherlands"
+countries.AN = "Netherlands Antilles"
+countries.NC = "New Caledonia"
+countries.NZ = "New Zealand"
+countries.NI = "Nicaragua"
+countries.NE = "Niger"
+countries.NG = "Nigeria"
+countries.NU = "Niue"
+countries.NF = "Norfolk Island"
+countries.MP = "Northern Mariana Islands"
+countries.NO = "Norway"
+countries.OM = "Oman"
+countries.PK = "Pakistan"
+countries.PW = "Palau"
+countries.PS = "Palestinian Territory, Occupied"
+countries.PA = "Panama"
+countries.PG = "Papua New Guinea"
+countries.PY = "Paraguay"
+countries.PE = "Peru"
+countries.PH = "Philippines"
+countries.PN = "Pitcairn"
+countries.PL = "Poland"
+countries.PT = "Portugal"
+countries.PR = "Puerto Rico"
+countries.QA = "Qatar"
+countries.RE = "Reunion"
+countries.RO = "Romania"
+countries.RU = "Russian Federation"
+countries.RW = "Rwanda"
+countries.SH = "Saint Helena"
+countries.KN = "Saint Kitts and Nevis"
+countries.LC = "Saint Lucia"
+countries.PM = "Saint Pierre and Miquelon"
+countries.VC = "Saint Vincent and the Grenadines"
+countries.WS = "Samoa"
+countries.SM = "San Marino"
+countries.ST = "Sao Tome and Principe"
+countries.SA = "Saudi Arabia"
+countries.SN = "Senegal"
+countries.CS = "Serbia and Montenegro"
+countries.SC = "Seychelles"
+countries.SL = "Sierra Leone"
+countries.SG = "Singapore"
+countries.SK = "Slovakia"
+countries.SI = "Slovenia"
+countries.SB = "Solomon Islands"
+countries.SO = "Somalia"
+countries.ZA = "South Africa"
+countries.GS = "South Georgia, South Sandwich Islands"
+countries.ES = "Spain"
+countries.LK = "Sri Lanka"
+countries.SD = "Sudan"
+countries.SR = "Suriname"
+countries.SJ = "Svalbard and Jan Mayen"
+countries.SZ = "Swaziland"
+countries.SE = "Sweden"
+countries.CH = "Switzerland"
+countries.SY = "Syrian Arab Republic"
+countries.TW = "Taiwan, Province of China"
+countries.TJ = "Tajikistan"
+countries.TZ = "Tanzania, United Republic of"
+countries.TH = "Thailand"
+countries.TL = "Timor-Leste"
+countries.TG = "Togo"
+countries.TK = "Tokelau"
+countries.TO = "Tonga"
+countries.TT = "Trinidad and Tobago"
+countries.TN = "Tunisia"
+countries.TR = "Turkey"
+countries.TM = "Turkmenistan"
+countries.TC = "Turks and Caicos Islands"
+countries.TV = "Tuvalu"
+countries.UG = "Uganda"
+countries.UA = "Ukraine"
+countries.AE = "United Arab Emirates"
+countries.GB = "United Kingdom"
+countries.UM = "United States minor outlying islands"
+countries.UY = "Uruguay"
+countries.UZ = "Uzbekistan"
+countries.VU = "Vanuatu"
+countries.VE = "Venezuela"
+countries.VN = "Viet Nam"
+countries.VG = "Virgin Islands, British"
+countries.VI = "Virgin Islands, U.S."
+countries.WF = "Wallis and Futuna"
+countries.EH = "Western Sahara"
+countries.YE = "Yemen"
+countries.ZM = "Zambia"
+countries.ZW = "Zimbabwe"
+
+; Standard color names and codes
+color.800000 = 'maroon'
+color.8B0000 = 'darkred'
+color.FF0000 = 'red'
+color.FFB6C1 = 'lightpink'
+color.DC143C = 'crimson'
+color.DB7093 = 'palevioletred'
+color.FF69B4 = 'hotpink'
+color.FF1493 = 'deeppink'
+color.C71585 = 'mediumvioletred'
+color.800080 = 'purple'
+color.8B008B = 'darkmagenta'
+color.DA70D6 = 'orchid'
+color.D8BFD8 = 'thistle'
+color.DDA0DD = 'plum'
+color.EE82EE = 'violet'
+color.FF00FF = 'fuchsia'
+color.FF00FF = 'magenta'
+color.BA55D3 = 'mediumorchid'
+color.9400D3 = 'darkviolet'
+color.9932CC = 'darkorchid'
+color.8A2BE2 = 'blueviolet'
+color.4B0082 = 'indigo'
+color.9370DB = 'mediumpurple'
+color.6A5ACD = 'slateblue'
+color.7B68EE = 'mediumslateblue'
+color.00008B = 'darkblue'
+color.05367D = 'mackinawblue'
+color.0000CD = 'mediumblue'
+color.0000FF = 'blue'
+color.000080 = 'navy'
+color.191970 = 'midnightblue'
+color.483D8B = 'darkslateblue'
+color.4169E1 = 'royalblue'
+color.6495ED = 'cornflowerblue'
+color.B0C4DE = 'lightsteelblue'
+color.F0F8FF = 'aliceblue'
+color.F8F8FF = 'ghostwhite'
+color.E6E6FA = 'lavender'
+color.1E90FF = 'dodgerblue'
+color.4682B4 = 'steelblue'
+color.00BFFF = 'deepskyblue'
+color.708090 = 'slategray'
+color.778899 = 'lightslategray'
+color.87CEFA = 'lightskyblue'
+color.87CEEB = 'skyblue'
+color.ADD8E6 = 'lightblue'
+color.008080 = 'teal'
+color.008B8B = 'darkcyan'
+color.00CED1 = 'darkturquoise'
+color.00FFFF = 'aqua'
+color.48D1CC = 'mediumturquoise'
+color.5F9EA0 = 'cadetblue'
+color.AFEEEE = 'paleturquoise'
+color.E0FFFF = 'lightcyan'
+color.F0FFFF = 'azure'
+color.20B2AA = 'lightseagreen'
+color.40E0D0 = 'turquoise'
+color.B0E0E6 = 'powderblue'
+color.2F4F4F = 'darkslategray'
+color.7FFFD4 = 'aquamarine'
+color.00FA9A = 'mediumspringgreen'
+color.66CDAA = 'mediumaquamarine'
+color.00FF7F = 'springgreen'
+color.3CB371 = 'mediumseagreen'
+color.2E8B57 = 'seagreen'
+color.32CD32 = 'limegreen'
+color.006400 = 'darkgreen'
+color.008000 = 'green'
+color.00FF00 = 'lime'
+color.228B22 = 'forestgreen'
+color.8FBC8F = 'darkseagreen'
+color.90EE90 = 'lightgreen'
+color.98FB98 = 'palegreen'
+color.F5FFFA = 'mintcream'
+color.F0FFF0 = 'honeydew'
+color.7FFF00 = 'chartreuse'
+color.7CFC00 = 'lawngreen'
+color.6B8E23 = 'olivedrab'
+color.556B2F = 'darkolivegreen'
+color.9ACD32 = 'yellowgreen'
+color.ADFF2F = 'greenyellow'
+color.F5F5DC = 'beige'
+color.FAF0E6 = 'linen'
+color.FAFAD2 = 'lightgoldenrodyellow'
+color.808000 = 'olive'
+color.FFFF00 = 'yellow'
+color.FFFFE0 = 'lightyellow'
+color.FFFFF0 = 'ivory'
+color.BDB76B = 'darkkhaki'
+color.F0E68C = 'khaki'
+color.EEE8AA = 'palegoldenrod'
+color.F5DEB3 = 'wheat'
+color.FFD700 = 'gold'
+color.FFFACD = 'lemonchiffon'
+color.FFEFD5 = 'papayawhip'
+color.B8860B = 'darkgoldenrod'
+color.DAA520 = 'goldenrod'
+color.FAEBD7 = 'antiquewhite'
+color.FFF8DC = 'cornsilk'
+color.FDF5E6 = 'oldlace'
+color.FFE4B5 = 'moccasin'
+color.FFDEAD = 'navajowhite'
+color.FFA500 = 'orange'
+color.FFE4C4 = 'bisque'
+color.D2B48C = 'tan'
+color.FF8C00 = 'darkorange'
+color.DEB887 = 'burlywood'
+color.8B4513 = 'saddlebrown'
+color.F4A460 = 'sandybrown'
+color.FFEBCD = 'blanchedalmond'
+color.FFF0F5 = 'lavenderblush'
+color.FFF5EE = 'seashell'
+color.FFFAF0 = 'floralwhite'
+color.FFFAFA = 'snow'
+color.CD853F = 'peru'
+color.FFDAB9 = 'peachpuff'
+color.D2691E = 'chocolate'
+color.A0522D = 'sienna'
+color.FFA07A = 'lightsalmon'
+color.FF7F50 = 'coral'
+color.E9967A = 'darksalmon'
+color.FFE4E1 = 'mistyrose'
+color.FF4500 = 'orangered'
+color.FA8072 = 'salmon'
+color.FF6347 = 'tomato'
+color.BC8F8F = 'rosybrown'
+color.FFC0CB = 'pink'
+color.CD5C5C = 'indianred'
+color.F08080 = 'lightcoral'
+color.A52A2A = 'brown'
+color.B22222 = 'firebrick'
+color.000000 = 'black'
+color.696969 = 'dimgray'
+color.808080 = 'gray'
+color.A9A9A9 = 'darkgray'
+color.C0C0C0 = 'silver'
+color.D3D3D3 = 'lightgrey'
+color.DCDCDC = 'gainsboro'
+color.F5F5F5 = 'whitesmoke'
+color.FFFFFF = 'white'
+
+[production : common]
+; Debugging and Testing parameters
+option.development = false ;Tells templates that this is a production server
+option.admin_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.admin_debug_size = 800 ;Width in pixels of front debug window
+option.front_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.front_debug_size = 800 ;Width in pixels of front debug window
+option.preview = true ;Use "preview=1" in links to support preview feature
+option.checkout_pre_fill = false ;Use for testing, prefills checkout data for convenience
+debug.level = 0 ;Debug level - 0=off
+debug.view_parameters = false ;Display all View tags and information
+debug.housing_query = false ;Display main housing query
+debug.pricing = false ;Detailed information on pricing and cost calculations
+debug.checkout = false ;Display checkout processing steps and data
+debug.mail = false ;Display mail rather than send it
+debug.glmpdf = false ;Display calibration grids in PDFs
+
+[development : common]
+; Debugging and Testing parameters
+option.development = true ;Tells templates that this is a development server
+option.admin_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.admin_debug_size = 800 ;Width in pixels of front debug window
+option.front_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.front_debug_size = 800 ;Width in pixels of front debug window
+option.preview = true ;Use "preview=1" in links to support preview feature
+option.checkout_pre_fill = false ;Use for testing, prefills checkout data for convenience
+debug.level = 0 ;Debug level - 0=off
+debug.view_parameters = false ;Display all View tags and information
+debug.housing_query = false ;Display main housing query
+debug.pricing = false ;Detailed information on pricing and cost calculations
+debug.checkout = false ;Display checkout processing steps and data
+debug.mail = false ;Display mail rather than send it
+debug.glmpdf = false ;Display calibration grids in PDFs
+
+[chuck : common]
+; Debugging and Testing parameters
+option.development = true ;Tells templates that this is a development server
+option.admin_debug = true ;If true causes system to dump diagnostic data to a separate window
+option.admin_debug_size = 800 ;Width in pixels of front debug window
+option.front_debug = true ;If true causes system to dump diagnostic data to a separate window
+option.front_debug_size = 800 ;Width in pixels of front debug window
+option.preview = false ;Use "preview=1" in links to support preview feature
+option.checkout_pre_fill = true ;Use for testing, prefills checkout data for convenience
+debug.level = 1 ;Debug level - 0=off, 1=Show Function Calls
+debug.view_parameters = true ;Display all View tags and information
+debug.housing_query = true ;Display main housing query
+debug.pricing = true ;Detailed information on pricing and cost calculations
+debug.checkout = true ;Display checkout processing steps and data
+debug.mail = true ;Display mail rather than send it
+debug.glmpdf = true ;Display calibration grids in PDFs
diff --git a/controllers/AdminController.php b/controllers/AdminController.php
new file mode 100644
index 0000000..69d2c94
--- /dev/null
+++ b/controllers/AdminController.php
@@ -0,0 +1,1051 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: EventManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/*
+ * Need to explain all this
+ */
+class EventManagementPage
+{
+
+ public $level;
+
+ function setUserLevel($level)
+ {
+ $this->level = $level;
+ }
+
+ function checkPermission($userPermissionLevel)
+ {
+ if ($userPermissionLevel >= $this->level) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
+
+/**
+ * EventManagementAdminIndexController class
+ *
+ * Event Management System - Admin main index
+ *
+ * PHP version 5
+ *
+ * @category Reservations_Front_End
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: EventManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementAdminIndexController
+{
+
+ /**
+ * Debug Information
+ * @var $adminDebug
+ * @access public
+ */
+ private $adminDebug = '';
+ private $adminDebugMenu = '';
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ private $applicationConfig;
+ private $serverConfig;
+ private $siteConfig;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $isa;
+ public $imageServer;
+ /**
+ * Reason for any problems that come up
+ * @var unknown
+ * @access public
+ */
+ public $reason = array();
+ /**
+ * Current Action
+ * Default is set to SelectConv
+ * @var $Action
+ * @access public
+ */
+ public $Action = 'SelectConv';
+ /**
+ * Template to use for output
+ * @var unknown
+ * @access public
+ */
+ public $flexyOptions;
+ public $template;
+ public $page;
+ /**
+ * User Level
+ * @var unknown
+ * @access public
+ */
+ public $userLevel = false;
+ /**
+ * User Interface
+ * @var unknown
+ * @access public
+ */
+ public $interface = false;
+ public $userInterface = false;
+ public $userInterfaces = false;
+ public $userInterfacesSelectable = false;
+
+ public $customFeatures = false;
+ public $userMemberID = false;
+ public $memberName = false;
+ public $userMemberVenueName = false;
+ public $MemberUser = false;
+ public $MemberUserValid = false;
+ public $AdminUser = false;
+ public $tabList = false;
+ public $blockTab = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($applicationConfig, $serverConfig, $siteConfig)
+ {
+
+ // Save config data and build a common config object
+ $this->applicationConfig = $applicationConfig;
+ $this->serverConfig = $serverConfig;
+ $this->siteConfig = $siteConfig;
+ $this->buildIntegratedConfig();
+
+ // Setup some required defines for this application
+ $this->setupDefines();
+
+ // Create database connection
+ $this->dbh = Toolkit_Database::getInstance();
+
+ // Set debug file name that includes remote address to keep users separate
+ if ($this->config->option->admin_debug) {
+ define('DEBUG_DATA_FILENAME', '/tmp/EventManagement.'.$_SERVER['REMOTE_ADDR'].'.debug.html');
+ }
+
+ // If there's no custom front-end, then disable custom features (i.e. Misc menu in admin)
+ $this->customFeatures = false;
+ if ($this->config->custom_prefix != '') {
+ $this->customFeatures = true;
+ }
+
+ // Start Session
+ $this->startSession();
+
+ // Get requested action
+ $this->getRequestedAction();
+
+ // Check for a member user
+ $this->checkMemberUser();
+
+ // Check if there's a request to reset all selected items
+ $this->checkResetSelected();
+
+ // User interface selection
+ $this->userInterfaceSelection();
+
+ // Track selected tabs so they aren't repeated in the user interface
+ $this->trackTabs();
+
+ // Setup page and template configurations and add some standard page data
+ $this->setupTemplate();
+
+ // Setup URLs and Locations for templates
+ $this->setupURLs();
+
+ // Add start of request debug data
+ $this->startOfRequestDebug();
+
+ // Perform requested action and add this to debug
+ $this->performAction();
+
+ // Display Output
+ $this->displayOutput();
+
+ // Output debug information if that's enabled
+ $this->displayDebug();
+
+ }
+
+ /**
+ * Assemble all required config data into $this->config
+ *
+ * @return void
+ */
+ private function buildIntegratedConfig()
+ {
+
+ // Set common apps base location
+ define('COMMON_APP_BASE', '/var/www/server/CommonApps/');
+
+ // Get customer's config for this application and Merge in customer's main application.ini
+ $this->config = new Zend_Config_Ini(
+ BASE_PATH.'config/applications/EventManagement.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($this->applicationConfig->event_management);
+ $this->config->owner = $this->siteConfig->owner;
+ $this->config->file_server = $this->serverConfig->file_server;
+
+ // Set location for this application
+ define('EVENT_MANAGEMENT_APP_BASE', COMMON_APP_BASE.$this->config->version.'/');
+
+ // Get common config data for this application and merge in site specific config
+ $EMConfig = new Zend_Config_Ini(
+ EVENT_MANAGEMENT_APP_BASE.'configs/common.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($EMConfig);
+
+ }
+
+ /**
+ * Set system defines
+ *
+ * @return void
+ */
+ private function setupDefines()
+ {
+
+ // Set datestyle string for DB results
+ define('DATE_STYLE_STRING', $this->config->misc->datestyle );
+
+ // Set common apps base location
+ define('DATA_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->dataAbstractLocation.'/DataAbstract.php');
+ define('PDF_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->pdfAbstractLocation.'/GlmPdf.php');
+ define('IMAGE_SERVER_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->imageServerAbstractLocation.'/Server.php');
+
+ // Also set a defined parameter for access to the File/Image Server
+ define('IMAGE_SERVER_PREFIX', $this->config->file_server->secure.$this->config->file_server->owner_id.'/');
+
+ }
+
+ /**
+ * Start Session
+ *
+ * @return object containing array as sub-objects
+ */
+ function startSession($force = false)
+ {
+ // If we haven't started sessions yet
+ if (!isset($_SESSION)) {
+ session_start();
+ }
+
+ // Use "session_reset=true" in link to force a reset
+ if ($_REQUEST['session_reset'] == 'true') {
+ $force = true;
+ }
+
+ // Set a different session name if the user is coming from the front end as an ADMIN_LOGIN_USER
+ if (defined('MEMBER_USER') && MEMBER_USER) {
+ define('GLM_EVENT_SESSION', 'GLM_EVENT_MGT_LOGIN_USER');
+ } else {
+ define('GLM_EVENT_SESSION', 'GLM_EVENT_MGT_ADMIN');
+
+ // Define MEMBER_USER as false so we don't have to keep checking if it's defined
+ define('MEMBER_USER', false);
+ }
+
+ // If the session timeout has past then reset session
+ if ($_SESSION[GLM_EVENT_SESSION]['timeOut'] < time()) {
+ $force = true;
+
+ // Only notify the user if the session has timed out in the last hour
+ if (time() - $_SESSION[GLM_EVENT_SESSION]['timeOut'] < 60*60 ) {
+ $this->reason[] = 'Your user session has timed out due to inactivity.';
+ }
+ }
+
+ // If requested or not yet set, create a clean session array
+ if ($force || !isset($_SESSION[GLM_EVENT_SESSION])) {
+
+ // But save certain things
+ $this->interface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+ if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $userMember = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ $userID = $_SESSION[GLM_EVENT_SESSION]['MemberUser'];
+ $userLevel = $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'];
+ } else {
+ $userID = false;
+ $userLevel = $this->config->permissions_numb->none;
+ }
+
+ // If full reset then set user interface back to default
+ if ($force) {
+ $this->interface = $this->config->default_admin_interface;
+ }
+
+ // create GLM_HOUSING session with all parameters false
+ $_SESSION[GLM_EVENT_SESSION] = array(
+ 'timeOut' => false,
+ 'Event' => false,
+ 'Member' => $userMember,
+ 'Accom' => false,
+ 'Inven' => false,
+ 'Team' => false,
+ 'Booking' => false,
+ 'Reservation' => false,
+ 'State' => false,
+ 'Division' => false,
+ 'Contact' => false,
+ 'Entrance' => false,
+ 'Section' => false,
+ 'Performance' => false,
+ 'Promo' => false,
+ 'Ticket' => false,
+ 'TicketInventory' => false,
+ 'Interface' => $this->interface,
+ 'TabsSelected' => false,
+ 'Order' => false,
+ 'MemberUser' => $userID,
+ 'MemberUserLevel' => $userLevel,
+ 'VoucherCoupon' => false
+ );
+
+ }
+
+ // Reset session timeout to current time plus timeout length in minutes
+ $_SESSION[GLM_EVENT_SESSION]['timeOut'] = strtotime('now +'.$this->config->admin_session_timeout.' minutes');
+
+ $this->addDebug('startSession()', 'Session timeout at: '.date('r', $_SESSION[GLM_EVENT_SESSION]['timeOut']).' ('.$_SESSION[GLM_EVENT_SESSION]['timeOut'].')');
+
+ }
+
+ /**
+ * Get requested action
+ *
+ * @return void
+ */
+ private function getRequestedAction()
+ {
+
+ // Try both GET and POST
+ if (!($this->Action = filter_input(INPUT_GET, 'Action', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) &&
+ !($this->Action = filter_input(INPUT_POST, 'Action', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH))
+ ) {
+ // No Action provided, so doing default
+ $this->Action = 'Index_index';
+ }
+
+ }
+
+ /**
+ * Check for member user
+ *
+ * @return void
+ */
+ private function checkMemberUser()
+ {
+
+ // Start with assumption that we don't have a valid member user
+ $this->MemberUserValid = false;
+
+ // Override for debug window
+ if ($this->Action == "Debug_start" || $this->Action == "Debug_update") {
+ $this->MemberUser = false;
+ $this->AdminUser = true;
+ }
+
+ // Check if this is a member logout. If so, send user back to front-end.
+ if ($_REQUEST['EMlogout'] == 'true') {
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] = 0;
+
+ echo '
+ ';
+ }
+
+ // If this is a member user, and we're not processing a debug request
+ if (MEMBER_USER && $this->Action != "Debug_start" && $this->Action != "Debug_update") {
+
+ // Check if we aren't getting a login request and we already have a member user login
+ if ($this->Action != "User_login" && $_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+
+ // Check the current user level
+ $sql = "
+ SELECT C.id, C.user_rights, C.active, C.affiliation, C.fname, C.lname, M.name
+ FROM eventmgt.res_contact C, eventmgt.member M
+ WHERE C.id = ".$_SESSION[GLM_EVENT_SESSION]['MemberUser']."
+ AND M.id = C.affiliation
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $contact = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // If the contact has been deleted, is marked inactive, or had their rights changed
+ if ($contact == false || !$contact['active'] || $contact['user_rights'] != $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel']) {
+
+ // Send the user back to login
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = false;
+ $reason =
+ "Your session is being reset. This can happen for one of the following reasons. "
+ ."Your permissions have changed, "
+ ."your user account has been marked inactive, "
+ ."your user account has been deleted, "
+ ."or there has been an unexpected system error.";
+ echo '
+
+ ';
+ exit;
+
+ }
+
+ // Otherwise we must not have a current login
+ } else {
+
+ // Assume we're not going to get logged in and we're going to send them back
+ $this->Action = 'User_login';
+
+ $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
+ $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
+
+ // Check if we have email and password supplied
+ if ($email != '' && $password != '') {
+
+ $loginFail = false;
+
+ // Crypt password
+ $pwCrypt = crypt($password);
+
+ // Check contact table for user with the supplied E-Mail address
+ $sql = "
+ SELECT C.id, C.password, C.user_rights, C.active, C.contact_type, C.affiliation, C.fname, C.lname, M.name
+ FROM eventmgt.res_contact C, eventmgt.member M
+ WHERE (C.email = '$email' OR C.login_id = '$email')
+ AND M.id = C.affiliation
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $contact = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // If we found a contact with this E-Mail address that's active
+ if ($contact != false && $contact['active'] && $contact['contact_type'] == 2) {
+
+ // Does the crypt match?
+ if (crypt($password, $contact['password']) == $contact['password']) {
+
+ // Yep, so send user to the admin home
+ $this->Action = 'Index_index';
+
+ // And save the user login info
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $contact['affiliation'];
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = $contact['id'];
+ $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] = $contact['user_rights'];
+
+ } else {
+ $loginFail = true;
+ }
+
+ } else {
+ $loginFail = true;
+ }
+
+ if ($loginFail) {
+ $this->reason[] = 'You did not supply a valid E-Mail address or Log in ID and password.';
+ }
+
+ }
+
+ } // Don't have member user login
+
+ } else {
+ if ($this->Action != "Debug_start" && $this->Action != "Debug_update") {
+ // The user is not a MemberUser, so must be an admin user - Give full permissions
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] = 0;
+ }
+ }
+
+ // This stuffs the current user level into the EventManagementPage class parameter
+ if ($_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] > 0) {
+ $this->userMemberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ $this->memberName = $contact['fname']." ".$contact['lname'];
+ $this->userMemberVenueName = $contact['name'];
+ } else {
+ $this->userMemberID = false;
+ $this->memberName = '';
+ $this->userMemberVenueName = '';
+ }
+
+ }
+
+
+ /**
+ * Check if selected items reset has been requested
+ *
+ * @return void
+ */
+ private function checkResetSelected()
+ {
+
+ // If requested, reset all selected items in the session - This is done with all main tabs
+ if ($_REQUEST['resetSelected'] == 'true') {
+
+ $_SESSION[GLM_EVENT_SESSION]['Event'] = false;
+ if (!$_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = false;
+ }
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Booking'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['State'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Division'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Contact'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = false;
+
+ }
+
+ }
+
+ /**
+ * User Interface selection (template dir)
+ *
+ * @return void
+ */
+ private function userInterfaceSelection()
+ {
+
+ // Is there a request for a specific interface
+ if (isset($_REQUEST['interface']) &&
+ in_array($_REQUEST['interface'], $this->config->admin_interface->toArray())
+ ) {
+ $this->interface = $_REQUEST['interface'];
+ // Oherwise, do we have an interface selection in the user session?
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Interface']) && $_SESSION[GLM_EVENT_SESSION]['Interface'] != '') {
+ $this->interface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+ // If neither, then use default user interface.
+ } else {
+ $this->interface = $this->config->default_admin_interface;
+ }
+
+ // Update session and page to show selected user interface
+ $_SESSION[GLM_EVENT_SESSION]['Interface'] = $this->interface;
+ $this->userInterface = $this->interface;
+
+ // Provide list of user interfaces to page
+ $interfaces = $this->config->admin_interface->toArray();
+ $userInterfaces = array();
+ foreach ($interfaces as $i) {
+ $userInterfaces[] = array(
+ 'directory' => $i,
+ 'name' => $i,
+ 'selected' => ($i == $this->interface)
+ );
+ }
+
+ // If there's more than 1 user interface then tell the template to display user interface selection
+ $this->userInterfacesSelectable = ($this->config->admin_interface->selectable && count($interfaces) > 1);
+ $this->userInterfaces = $this->bindArrayToObject($userInterfaces);
+
+ }
+
+ /**
+ * Track tabs that are selected
+ *
+ * This is to keep from displaying another tab in a
+ * lower layer that's already been displayed.
+ *
+ * @return void
+ */
+ private function trackTabs()
+ {
+
+ // If tab list is provided
+ if (isset($_REQUEST['tabList'])) {
+ $this->tabList = $_REQUEST['tabList'];
+ } else {
+ $this->tabList = '';
+ }
+ if ($this->tabList != '') {
+ $this->tabList .= ',';
+ }
+ $this->tabList .= $this->Action;
+
+ $blockTab = array();
+ $nt = explode(',', $this->tabList);
+ foreach ($nt as $t) {
+ $blockTab[$t] = true;
+ }
+ $this->blockTab = $this->bindArrayToObject($blockTab);
+
+ }
+
+ /**
+ * Set template configuration
+ *
+ * @return void
+ */
+ private function setupTemplate()
+ {
+ // Test if there is a local templates directory for the Web site
+ if (is_dir(BASE_PATH.'admin/EventManagement/templates')) {
+ $templatesDir = BASE_PATH.'admin/EventManagement/templates/admin/';
+ } else {
+ // Otherwise use the templates in this app
+ $templatesDir = EVENT_MANAGEMENT_APP_BASE.'views/admin/';
+ }
+
+ // Setup Template and Page
+ $this->flexyOptions = array(
+ 'templateDir' => $templatesDir,
+ 'compileDir' => BASE_PATH.'/templates/compiled',
+ 'forceCompile' => false,
+ 'flexyIgnore' => true,
+ 'allowPHP' => true,
+ 'debug' => false
+ );
+ $this->template = new HTML_Template_Flexy($this->flexyOptions);
+ $this->page = new EventManagementPage();
+
+ // Add some standard page data
+ $this->page->startScript = '
+ ';
+ }
+
+ }
+
+ }
+
+ /**
+ * Get all general search lists - Events, Members, etc
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSearchLists()
+ {
+ // Get full list of events
+ $sql = "SELECT id, name, event_code, active, end_date < 'now' AS expired, team_event
+ FROM eventmgt.event
+ ORDER BY name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventsList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Get full list of members
+ $sql = "SELECT id, name FROM eventmgt.member ORDER BY name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $membersList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ while( list($key, $val) = each( $membersList ) ) {
+ $membersList[$key]['name'] = addslashes($val['name']);
+ }
+
+ // Get full list of Teams
+ $sql = "SELECT id, name FROM eventmgt.team ORDER BY name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamsList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ while( list($key, $val) = each( $teamsList ) ) {
+ $teamsList[$key]['name'] = addslashes($val['name']);
+ }
+
+ $searchLists = array(
+ 'events' => $eventsList,
+ 'teamList' => $teamsList,
+ 'members' => $membersList
+ );
+
+ if ($this->config->option->admin_debug) {
+ $this->adminDebug .= "
EventManagement.php: getSearchLists()
".print_r($searchLists,1)."
";
+ }
+
+ return $searchLists;
+ }
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ private function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+}
+
+// Start Event Management Admin - Pass the site's global application config data
+$eh = new EventManagementAdminIndexController($GLOBALS['applicationConfig'], $GLOBALS['serverConfig'], $GLOBALS['siteConfig']);
+
+// If this is an admin user initial entry or if this is an admin user login
+if (!(defined('SHOW_IN_SITE') && SHOW_IN_SITE)) {
+ exit;
+}
+
+
+
+?>
diff --git a/controllers/FrontController.php b/controllers/FrontController.php
new file mode 100644
index 0000000..66f9e6d
--- /dev/null
+++ b/controllers/FrontController.php
@@ -0,0 +1,909 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: FrontController.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/*
+
+Custom Index file
+ {GLM} is replaced with a template include file that calls the selected template.
+
+If custom index
+
+ base_url is /index.phtml - directly calls front-end controller
+
+ Controller determines action and calls proper include file for that action
+ returns selected template file and data
+
+ Controller
+ sets page->template parameter
+ calls custom index template
+ Template uses page-template parameter to include the target template.
+
+else
+ base_url is specified static page
+end
+
+*/
+
+/**
+ * EventManagementFrontIndexController class
+ *
+ * Event Management System - Front end main index
+ *
+ * PHP version 5
+ *
+ * @category Reservations_Front_End
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: FrontController.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementIndexController
+{
+
+ /**
+ * Front End Support
+ * @var $frontDebug
+ * @access public
+ */
+ public $support = false;
+ /**
+ * Debug Information
+ * @var $frontDebug
+ * @access public
+ */
+ public $frontDebug = '';
+ private $frontDebugMenu = '';
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $isa;
+ public $imageServer;
+ /**
+ * Reason for any problems that come up
+ * @var unknown
+ * @access public
+ */
+ public $reason = array();
+ /**
+ * Have Cart
+ * @var $haveCart
+ * @access public
+ */
+ public $haveCart = false;
+ /**
+ * Current Action
+ * Default is set to SelectConv
+ * @var $Action
+ * @access public
+ */
+ public $Action = '';
+ /**
+ * Template to use for output
+ * @var unknown
+ * @access public
+ */
+ public $flexyOptions;
+ public $template;
+ private $page;
+ private $smarty;
+ /**
+ * User Interface
+ * @var unknown
+ * @access public
+ */
+ private $userInterface = false;
+ private $interfaceType = false;
+ private $userInterfaces = false;
+ private $userInterfacesSelectable = false;
+ public $memberUser = false;
+
+ private $resetSession = false;
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($applicationConfig, $serverConfig, $siteConfig)
+ {
+
+ // Save config data and build a common config object
+ $this->applicationConfig = $applicationConfig;
+ $this->serverConfig = $serverConfig;
+ $this->siteConfig = $siteConfig;
+ $this->buildIntegratedConfig();
+
+ // Setup some required defines for this application
+ $this->setupDefines();
+
+ // Create database connection
+ $this->dbh = Toolkit_Database::getInstance();
+
+ // Set debug file name
+ if ($this->config->option->front_debug) {
+ define('DEBUG_DATA_FILENAME', '/tmp/EventManagement.'.$_SERVER['REMOTE_ADDR'].'.debug.html');
+ }
+
+ // Provide front-end support class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+ $this->support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+ // start this user session
+ $this->startSession();
+
+ // User interface selection
+ $this->userInterfaceSelection();
+
+ // Setup page and template configurations and add some standard page data
+ $this->setupTemplate();
+
+ // Perform requested action and add this to debug
+ $this->performAction();
+
+ // Display Output
+ $this->displayOutput();
+
+ // Check if we need to clear the session
+ if ($this->resetSession) {
+ $this->startSession(true);
+ }
+
+ // Output debug information if that's enabled
+ $this->displayDebug();
+
+ // If this is a debug output page then stop here.
+ if (substr($this->Action,0,6) == 'Debug_') {
+ exit;
+ }
+
+ } // _constructor
+
+ /**
+ * Assemble all required config data into $this->config
+ *
+ * @return void
+ */
+ private function buildIntegratedConfig()
+ {
+
+ // Set common apps base location
+ define('COMMON_APP_BASE', '/var/www/server/CommonApps/');
+
+ // Get customer's config for this application and Merge in customer's main application.ini
+ $this->config = new Zend_Config_Ini(
+ BASE_PATH.'config/applications/EventManagement.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($this->applicationConfig->event_management);
+ $this->config->owner = $this->siteConfig->owner;
+ $this->config->file_server = $this->serverConfig->file_server;
+
+ // Set location for this application
+ define('EVENT_MANAGEMENT_APP_BASE', COMMON_APP_BASE.$this->config->version.'/');
+
+ // Get common configuration for this application
+ $EMconfig = new Zend_Config_Ini(
+ EVENT_MANAGEMENT_APP_BASE.'configs/common.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($EMconfig);
+
+ }
+
+ /**
+ * Set system defines
+ *
+ * @return void
+ */
+ private function setupDefines()
+ {
+ // Set datestyle string for DB results
+ define('DATE_STYLE_STRING', $this->config->misc->datestyle );
+
+ // Set common apps base location
+ define('DATA_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->dataAbstractLocation.'/DataAbstract.php');
+ define('PDF_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->pdfAbstractLocation.'/GlmPdf.php');
+ define('IMAGE_SERVER_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->imageServerAbstractLocation.'/Server.php');
+
+ define('GLM_EVENT_SESSION', 'GLM_EVENT_MGT_FRONT');
+
+ // Also set a defined parameter for access to the File/Image Server
+ define('IMAGE_SERVER_PREFIX', $this->config->file_server->secure.$this->config->file_server->owner_id.'/');
+
+ // Set base script - If there's an application URL defined, use that, otherwise use page ID
+ $baseApplicationScript = ($this->config->application_url != '' ?
+ CURRENT_BASE_URL.$this->config->application_url.'/?x=1' :
+ CURRENT_BASE_URL.'index.php?catid='.$this->config->application_page
+ );
+ define('BASE_APPLICATION_SCRIPT', $baseApplicationScript);
+
+ // Set base URL
+ $baseApplicationUrl = ($this->config->application_page == 0 ?
+ $baseScript :
+ CURRENT_BASE_URL.'common/EventManagement/'
+ );
+ define('BASE_APPLICATION_URL', $baseApplicationUrl);
+
+ }
+
+ /**
+ * Destroy Event Management Front-end Session
+ *
+ * @return object containing array as sub-objects
+ */
+ function destroySession()
+ {
+ unset($_SESSION[GLM_EVENT_SESSION]);
+ return;
+ }
+
+ /**
+ * Start Session
+ *
+ * @return object containing array as sub-objects
+ */
+ function startSession($force = false)
+ {
+
+ // If we haven't started sessions yet
+ if (!isset($_SESSION)) {
+ session_start();
+ }
+
+ // Use "session_reset=true" in link to force a reset
+ if ($_REQUEST['session_reset'] == 'true') {
+ $force = true;
+ }
+
+ // If the session timeout has past then reset session
+ if ($_SESSION[GLM_EVENT_SESSION]['timeOut'] < time()) {
+
+ $force = true;
+
+ // Only notify the user if the session has timed out in the last hour
+ if (time() - $_SESSION[GLM_EVENT_SESSION]['timeOut'] < 60*60 ) {
+ $this->reason[] = 'Your user session has timed out due to inactivity and your cart has been cleared.';
+ }
+
+ // If not adding items to cart or starting with sectionSelect, reset Action
+ if ($_REQUEST['Action'] != 'Shop_sectionSelect' && $_REQUEST['cart'] != 'add') {
+ $this->Action = 'Shop_start';
+ }
+
+ }
+
+ // If requested or not yet set, create a clean GLM_HOUSING session array
+ if ($force || !isset($_SESSION[GLM_EVENT_SESSION])) {
+
+ // But save interface
+ $this->userInterface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+
+ // If full reset then clear this also
+ if ($force) {
+ $this->userInterface = false;
+ }
+
+ // create GLM_HOUSING session with all parameters false
+ $_SESSION[GLM_EVENT_SESSION] = array(
+ 'SessionID' => md5(($_SERVER["REMOTE_ADDR"].'-'.time())),
+ 'PseudoRand' => false,
+ 'permitInactive' => $this->permitInactive,
+ 'timeOut' => false,
+ 'Event' => false,
+ 'Member' => false,
+ 'Accom' => false,
+ 'Inven' => false,
+ 'Team' => false,
+ 'Booking' => false,
+ 'Reservation' => false,
+ 'State' => false,
+ 'Division' => false,
+ 'Contact' => false,
+ 'Entrance' => false,
+ 'Section' => false,
+ 'Performance' => false,
+ 'Ticket' => false,
+ 'TicketInventory' => false,
+ 'Interface' => $this->userInterface,
+ 'Search' => false,
+ 'Cart' => false,
+ 'CartIndex' => 0,
+ 'OptServCart' => false,
+ 'TicketCart' => false,
+ 'ContactInput' => false,
+ 'TicketPayments' => false,
+ 'AdminUser' => false
+ );
+
+ // Initialze Cart
+ $this->clearCart();
+
+ $this->addDebug("startSession()", 'Session Reset', false);
+
+ }
+
+ // Reset session timeout to current time plus timeout length in minutes
+ $_SESSION[GLM_EVENT_SESSION]['timeOut'] = strtotime('now +'.$this->config->session_timeout.' minutes');
+
+ // Now let's check for an admin login user who might have more privileges than a normal front-end user
+ if (isset($_REQUEST['adminUserCheck']) && $_REQUEST['adminUserCheck'] != '') {
+
+/* Temporarily bypassed due to issues with office computer Check Failures.
+ // Check admin user ID and check string
+ $check = md5($this->config->orderVerificationSecret.$_SERVER['REMOTE_ADDR'].date('m/d/Y'));
+ if ($_REQUEST['adminUserCheck'] != $check) {
+ echo "Check failure:";
+ exit;
+ }
+*/
+
+ $_SESSION[GLM_EVENT_SESSION]['AdminUser'] = true;
+ }
+
+ $this->addDebug('startSession()', 'Session timeout at: '.date('r', $_SESSION[GLM_EVENT_SESSION]['timeOut']).' ('.$_SESSION[GLM_EVENT_SESSION]['timeOut'].')');
+
+
+ }
+
+ /**
+ * User Interface selection (template dir)
+ *
+ * @return void
+ */
+ private function userInterfaceSelection()
+ {
+
+ // Is there a request for a specific interface
+ if (isset($_REQUEST['interface']) &&
+ in_array($_REQUEST['interface'], $this->config->front_interface->toArray())
+ ) {
+ $this->userInterface = $_REQUEST['interface'];
+ // Oherwise, do we have an interface selection in the user session?
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Interface']) && $_SESSION[GLM_EVENT_SESSION]['Interface'] != '') {
+ $this->userInterface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+ // If neither, then use default user interface.
+ } else {
+ $this->userInterface = $this->config->default_front_interface;
+ }
+
+ // Update session with current user interface
+ $_SESSION[GLM_EVENT_SESSION]['Interface'] = $this->userInterface;
+
+ // Get interface type (flexy or smarty)
+ $this->interfaceType = $this->config->front_interface_type->{$this->userInterface};
+
+ // Provide list of user interfaces to page
+ $interfaces = $this->config->front_interface->toArray();
+ $userInterfaces = array();
+ foreach ($interfaces as $i) {
+ $userInterfaces[] = array(
+ 'directory' => $i,
+ 'name' => $i,
+ 'selected' => ($i == $interface)
+ );
+ }
+
+ // If there's more than 1 user interface then tell the template to display user interface selection
+ $this->userInterfacesSelectable = ($this->config->front_interface->selectable && count($interfaces) > 1);
+ $this->userInterfaces = $this->bindArrayToObject($userInterfaces);
+
+ $this->addDebug("userInterfaceSelection()", $this->userInterface.' (template engine: '.$this->interfaceType.')', false);
+
+ }
+
+ /**
+ * Set template configuration
+ *
+ * @return void
+ */
+ private function setupTemplate()
+ {
+
+ // Test if there is a local templates directory for the Web site
+ if (is_dir(BASE_PATH.'admin/EventManagement/templates')) {
+ $templatesDir = BASE_PATH.'admin/EventManagement/templates/front/';
+ } else {
+ // Otherwise use the templates in this app
+ $templatesDir = EVENT_MANAGEMENT_APP_BASE.'views/front/';
+ }
+
+ switch ($this->interfaceType) {
+
+ case 'smarty':
+
+ // Load Smarty class and create instance
+ require(COMMON_APP_BASE.'Smarty/3.1/Smarty.class.php');
+ $this->smarty = new Smarty();
+
+ // Setup required Smarty paths
+ $this->smarty->setTemplateDir($templatesDir);
+ $this->smarty->setCompileDir(BASE_PATH.'/smarty/templates_c');
+ $this->smarty->setCacheDir(BASE_PATH.'/smarty/cache');
+ $this->smarty->setConfigDir(BASE_PATH.'/smarty/configs');
+
+ break;
+
+ case 'flexy':
+ // Setup Template and Page
+ $this->flexyOptions = array(
+ 'templateDir' => $templatesDir,
+ 'compileDir' => BASE_PATH.'/templates/compiled',
+ 'forceCompile' => false,
+ 'flexyIgnore' => true,
+ 'allowPHP' => true,
+ 'debug' => false
+ );
+ $this->template = new HTML_Template_Flexy($this->flexyOptions);
+ $this->page = new stdClass();
+
+ break;
+ }
+
+ // Get misc system configuration data for use below
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+ $Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+ $miscConfigDetail = $Misc->getEntry(1);
+
+ // Get some standard page data
+ $this->templateAssign(
+ array(
+
+ 'owner' => $this->bindArrayToObject($this->config->owner->toArray()),
+
+ 'startScript' => '
+ ';
+
+ }
+
+ }
+
+ /*
+ * Assign parameters to the template
+ *
+ * @param array Array of arrays with parameter name, value pairs
+ * or
+ * @param text parameter name
+ * @param {whatever} parameter value
+ *
+ * @return void
+ */
+ private function templateAssign($params, $value = false)
+ {
+
+ // If this is a single assignment
+ if ($value != false) {
+
+ switch ($this->interfaceType) {
+ case 'smarty':
+ $this->smarty->assign($param, $value);
+ break;
+ case 'flexy':
+ $this->page->{$params} = $value;
+ break;
+ }
+
+ // Otherwise it's an array of parameter/value pairs
+ } else {
+
+ while (list($key, $value) = each($params)) {
+
+ switch ($this->interfaceType) {
+ case 'smarty':
+ $this->smarty->assign($key, $value);
+ break;
+ case 'flexy':
+ $this->page->{$key} = $value;
+ break;
+ }
+
+ }
+
+ }
+
+ }
+
+ /**
+ * If debug for mail turned on, display E-Mail messages rather than send them
+ *
+ * @access public
+ */
+ public function debug_mail( $to, $subject, $message, $headers = '', $parameters = '' )
+ {
+ if( $this->config->debug->mail )
+ {
+ $mailDebug = '
+
+
MAIL DEBUG
+
Recipient(s): '.$to.'
+
Subject: '.$subject.'
+
Headers:
'.$headers.'
+
Parameters:
'.$parameters.'
+
Message Content: '.$message.'
+
+
+ ';
+
+ // If front-debug is enabled, display in debug window
+ if ($this->config->option->front_debug) {
+ $this->addDebug('Email Message', $subject, $mailDebug, true);
+ } else {
+ // Otherwise display in-line.
+ echo $mailDebug;
+ }
+
+ return( true );
+ } else {
+ return( mail( $to, $subject, $message, $headers, $parameters ) );
+ }
+ }
+
+
+
+
+} // EventManagementIndexController
+
+// Start Event Management Front-End - Pass the site's global application config data
+//$eh = new EventManagementIndexController($applicationConfig, $serverConfig);
+//exit;
+
+?>
diff --git a/data/DatabaseModificationsForTicketing.sql b/data/DatabaseModificationsForTicketing.sql
new file mode 100644
index 0000000..93f3931
--- /dev/null
+++ b/data/DatabaseModificationsForTicketing.sql
@@ -0,0 +1,2 @@
+
+Updates to database required for current updates
diff --git a/data/EventManagement.sql b/data/EventManagement.sql
new file mode 100644
index 0000000..c57b235
--- /dev/null
+++ b/data/EventManagement.sql
@@ -0,0 +1,1183 @@
+CREATE SCHEMA eventmgt;
+
+ALTER SCHEMA eventmgt OWNER TO postgres;
+GRANT ALL ON SCHEMA eventmgt TO nobody;
+
+CREATE TABLE eventmgt.misc
+(
+ id integer,
+ intro_text text,
+ section_text text,
+ ticket_text text,
+ ticket_opt_text text,
+ cart_text text,
+ checkout_text text,
+ success_text text,
+ tracking text,
+ no_payment_reasons text,
+ opt_field_1_name text,
+ opt_field_2_name text,
+ opt_field_3_name text,
+ central_payment smallint
+);
+
+ALTER TABLE eventmgt.misc OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.misc FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.misc FROM postgres;
+GRANT ALL ON TABLE eventmgt.misc TO postgres;
+GRANT ALL ON TABLE eventmgt.misc TO nobody;
+
+INSERT INTO eventmgt.misc
+ (id, intro_text, section_text, ticket_text, ticket_opt_text, cart_text, checkout_text, success_text, central_payment)
+ VALUES
+ (1, 'Intro text', 'Section selection text', 'Ticket selection text', 'Ticket option selection text', 'Cart text', 'Checkout text', 'Checkout success text', 0);
+
+
+CREATE TABLE eventmgt.fees
+(
+id SERIAL,
+affiliation_type smallint,
+owner smallint,
+fee_method smallint,
+room_specific bool,
+name text,
+fee_amount float,
+taxable bool,
+itemize bool,
+event_specific bool,
+event smallint,
+optional_service bool,
+service_quant bool,
+service_max_quant smallint,
+descr text
+);
+
+ALTER TABLE eventmgt.fees OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.fees FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.fees FROM postgres;
+GRANT ALL ON TABLE eventmgt.fees TO postgres;
+GRANT ALL ON TABLE eventmgt.fees TO nobody;
+GRANT ALL ON TABLE eventmgt.fees_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.fees_id_seq TO nobody;
+
+CREATE INDEX fees_id_index ON eventmgt.fees ( id );
+CREATE INDEX fees_owner_index ON eventmgt.fees ( owner );
+
+CREATE TABLE eventmgt.division
+ (
+ id SERIAL,
+ event integer,
+ name text,
+ descr text,
+ notes text
+ );
+
+ALTER TABLE eventmgt.division OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.division FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.division FROM postgres;
+GRANT ALL ON TABLE eventmgt.division TO postgres;
+GRANT ALL ON TABLE eventmgt.division TO nobody;
+GRANT ALL ON TABLE eventmgt.division_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.division_id_seq TO nobody;
+
+CREATE INDEX division_id_index ON eventmgt.division ( id );
+CREATE INDEX division_event_index ON eventmgt.division ( event );
+
+CREATE TABLE eventmgt.state_rep
+ (
+ id SERIAL,
+ event integer,
+ code text,
+ password text,
+ descr text,
+ notes text
+ );
+
+ALTER TABLE eventmgt.state_rep OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.state_rep FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.state_rep FROM postgres;
+GRANT ALL ON TABLE eventmgt.state_rep TO postgres;
+GRANT ALL ON TABLE eventmgt.state_rep TO nobody;
+GRANT ALL ON TABLE eventmgt.state_rep_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.state_rep_id_seq TO nobody;
+
+CREATE INDEX state_rep_id_index ON eventmgt.state_rep ( id );
+CREATE INDEX state_rep_event_index ON eventmgt.state_rep ( event );
+
+
+CREATE TABLE eventmgt.room_block
+ (
+ id SERIAL,
+ event integer,
+ state_rep integer,
+ team integer,
+ member integer,
+ block_name integer
+ );
+
+ALTER TABLE eventmgt.room_block OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.room_block FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.room_block FROM postgres;
+GRANT ALL ON TABLE eventmgt.room_block TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block TO nobody;
+GRANT ALL ON TABLE eventmgt.room_block_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block_id_seq TO nobody;
+
+CREATE INDEX room_block_id_index ON eventmgt.room_block ( id );
+CREATE INDEX room_block_event_index ON eventmgt.room_block ( event );
+CREATE INDEX room_block_state_rep_index ON eventmgt.room_block ( state_rep );
+CREATE INDEX room_block_team_index ON eventmgt.room_block ( team );
+CREATE INDEX room_block_member_index ON eventmgt.room_block ( member );
+
+
+CREATE TABLE eventmgt.room_block_seg
+ (
+ id SERIAL,
+ block integer,
+ event integer,
+ accommodation integer,
+ allocated smallint,
+ available smallint
+ );
+
+ALTER TABLE eventmgt.room_block_seg OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.room_block_seg FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.room_block_seg FROM postgres;
+GRANT ALL ON TABLE eventmgt.room_block_seg TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block_seg TO nobody;
+GRANT ALL ON TABLE eventmgt.room_block_seg_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block_seg_id_seq TO nobody;
+
+CREATE INDEX room_block_seg_id_index ON eventmgt.room_block_seg ( id );
+CREATE INDEX room_block_seg_block_index ON eventmgt.room_block_seg ( block );
+CREATE INDEX room_block_seg_event_index ON eventmgt.room_block_seg ( event );
+CREATE INDEX room_block_seg_accommodation_index ON eventmgt.room_block_seg ( accommodation );
+
+
+CREATE TABLE eventmgt.team
+ (
+ id SERIAL,
+ event integer,
+ division integer,
+ state integer,
+ name text,
+ team_code text,
+ participants smallint,
+ room_block integer,
+ notes text
+ );
+
+ALTER TABLE eventmgt.team OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.team FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.team FROM postgres;
+GRANT ALL ON TABLE eventmgt.team TO postgres;
+GRANT ALL ON TABLE eventmgt.team TO nobody;
+GRANT ALL ON TABLE eventmgt.team_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.team_id_seq TO nobody;
+
+CREATE INDEX team_id_index ON eventmgt.team ( id );
+CREATE INDEX team_code_index ON eventmgt.team ( team_code );
+CREATE INDEX team_event_index ON eventmgt.team ( event );
+
+
+CREATE TABLE eventmgt.team_roster
+ (
+ id SERIAL,
+ team integer,
+ lname text,
+ fname text,
+ pos text,
+ notes text
+ );
+
+ALTER TABLE eventmgt.team_roster OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.team_roster FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.team_roster FROM postgres;
+GRANT ALL ON TABLE eventmgt.team_roster TO postgres;
+GRANT ALL ON TABLE eventmgt.team_roster TO nobody;
+GRANT ALL ON TABLE eventmgt.team_roster_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.team_roster_id_seq TO nobody;
+
+CREATE INDEX team_roster_id_index ON eventmgt.team_roster ( id );
+CREATE INDEX team_roster_team_index ON eventmgt.team_roster ( team );
+
+
+
+CREATE TABLE eventmgt.team_property
+ (
+ id SERIAL,
+ team integer,
+ property integer,
+ event integer,
+ start date,
+ stop date
+ );
+
+ALTER TABLE eventmgt.team_property OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.team_property FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.team_property FROM postgres;
+GRANT ALL ON TABLE eventmgt.team_property TO postgres;
+GRANT ALL ON TABLE eventmgt.team_property TO nobody;
+GRANT ALL ON TABLE eventmgt.team_property_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.team_property_id_seq TO nobody;
+
+CREATE INDEX team_property_id_index ON eventmgt.team_property ( id );
+CREATE INDEX team_property_team_id_index ON eventmgt.team_property ( team );
+CREATE INDEX team_property_property_id_index ON eventmgt.team_property ( property );
+CREATE INDEX team_property_event_id_index ON eventmgt.team_property ( event );
+
+
+CREATE TABLE eventmgt.accommodation
+ (
+ id SERIAL,
+ member integer,
+ name text,
+ title text,
+ category smallint,
+ descr text,
+ image text,
+ quant integer,
+ occupants smallint,
+ maxoccupants smallint,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.accommodation OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.accommodation FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.accommodation FROM postgres;
+GRANT ALL ON TABLE eventmgt.accommodation TO postgres;
+GRANT ALL ON TABLE eventmgt.accommodation TO nobody;
+GRANT ALL ON TABLE eventmgt.accommodation_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.accommodation_id_seq TO nobody;
+
+CREATE INDEX accommodation_id_index ON eventmgt.accommodation (id);
+CREATE INDEX accommodation_member_index ON eventmgt.accommodation (member);
+
+CREATE TABLE eventmgt.entrance
+ (
+ id SERIAL,
+ member integer,
+ name text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ country text,
+ zip text,
+ phone text,
+ lat float,
+ lon float,
+ descr text,
+ image text,
+ color text,
+ notes text,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.entrance OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.entrance FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.entrance FROM postgres;
+GRANT ALL ON TABLE eventmgt.entrance TO postgres;
+GRANT ALL ON TABLE eventmgt.entrance TO nobody;
+GRANT ALL ON TABLE eventmgt.entrance_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.entrance_id_seq TO nobody;
+
+CREATE INDEX entrance_id_index ON eventmgt.entrance (id);
+CREATE INDEX entrance_member_index ON eventmgt.entrance (member);
+CREATE INDEX entrance_sort_index ON eventmgt.entrance (sort);
+
+CREATE TABLE eventmgt.section
+ (
+ id SERIAL,
+ member integer,
+ name text,
+ descr text,
+ image text,
+ entrance integer,
+ notes text,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.section OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.section FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.section FROM postgres;
+GRANT ALL ON TABLE eventmgt.section TO postgres;
+GRANT ALL ON TABLE eventmgt.section TO nobody;
+GRANT ALL ON TABLE eventmgt.section_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.section_id_seq TO nobody;
+
+CREATE INDEX section_id_index ON eventmgt.section (id);
+CREATE INDEX section_member_index ON eventmgt.section (member);
+CREATE INDEX section_sort_index ON eventmgt.section (sort);
+
+CREATE TABLE eventmgt.performance
+ (
+ id SERIAL,
+ member smallint,
+ name text,
+ active boolean,
+ admin_only boolean,
+ descr text,
+ short_descr text,
+ start_date date,
+ end_date date,
+ purch_leadtime smallint,
+ image text,
+ policy text,
+ voucher_text text,
+ conf_text text,
+ notes text,
+ promote_in_cart boolean,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.performance OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.performance FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.performance FROM postgres;
+GRANT ALL ON TABLE eventmgt.performance TO postgres;
+GRANT ALL ON TABLE eventmgt.performance TO nobody;
+GRANT ALL ON TABLE eventmgt.performance_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.performance_id_seq TO nobody;
+
+CREATE INDEX performance_id_index ON eventmgt.performance (id);
+CREATE INDEX performance_member_index ON eventmgt.performance (member);
+CREATE INDEX performance_sort_index ON eventmgt.performance (sort);
+
+CREATE TABLE eventmgt.ticket
+ (
+ id SERIAL,
+ active boolean,
+ admin_only boolean,
+ ticket_type integer,
+ member integer,
+ name text,
+ title text,
+ section smallint,
+ date_specific boolean,
+ days_of_week integer,
+ start_date date,
+ end_date date,
+ time_specific boolean,
+ ticket_time time,
+ unlimited_use boolean,
+ uses smallint,
+ performance smallint,
+ unlimited_quant boolean,
+ quant integer,
+ consignment_type smallint,
+ cart_sticky boolean,
+ show_on_start boolean,
+ price float,
+ descr text,
+ image text,
+ voucher_text text,
+ voucher_type integer,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.ticket OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_id_seq TO nobody;
+
+CREATE INDEX ticket_id_index ON eventmgt.ticket (id);
+CREATE INDEX ticket_member_index ON eventmgt.ticket (member);
+CREATE INDEX ticket_section_index ON eventmgt.ticket (section);
+
+CREATE TABLE eventmgt.ticket_package
+ (
+ id SERIAL,
+ package integer,
+ ticket integer,
+ member integer,
+ performance integer,
+ quant integer,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.ticket_package OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_package FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_package FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_package TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_package TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_package_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_package_id_seq TO nobody;
+
+CREATE INDEX ticket_package_id_index ON eventmgt.ticket_package (id);
+CREATE INDEX ticket_package_package_index ON eventmgt.ticket_package (package);
+CREATE INDEX ticket_package_ticket_index ON eventmgt.ticket_package (ticket);
+
+CREATE TABLE eventmgt.member_scans_for
+ (
+ id SERIAL,
+ member integer,
+ scans_for integer
+ );
+
+ALTER TABLE eventmgt.member_scans_for OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.member_scans_for FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.member_scans_for FROM postgres;
+GRANT ALL ON TABLE eventmgt.member_scans_for TO postgres;
+GRANT ALL ON TABLE eventmgt.member_scans_for TO nobody;
+GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO nobody;
+
+CREATE INDEX member_scans_for_id_index ON eventmgt.member_scans_for (id);
+CREATE INDEX member_scans_for_member_index ON eventmgt.member_scans_for (member);
+CREATE INDEX member_scans_for_scans_for_index ON eventmgt.member_scans_for (scans_for);
+
+
+CREATE TABLE eventmgt.ticket_inventory
+ (
+ id SERIAL,
+ ticket integer,
+ member integer,
+ quant integer,
+ available integer,
+ sold integer,
+ ticket_date date,
+ ticket_time time,
+ active boolean
+ );
+
+ALTER TABLE eventmgt.ticket_inventory OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_inventory FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_inventory FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_inventory TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_inventory TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_inventory_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_inventory_id_seq TO nobody;
+
+CREATE INDEX ticket_inventory_id_index ON eventmgt.ticket_inventory (id);
+CREATE INDEX ticket_inventory_ticket_index ON eventmgt.ticket_inventory (ticket);
+CREATE INDEX ticket_inventory_member_index ON eventmgt.ticket_inventory (member);
+CREATE INDEX ticket_inventory_date_index ON eventmgt.ticket_inventory (ticket_date);
+
+CREATE TABLE eventmgt.ticket_add_on
+ (
+ id SERIAL,
+ ticket integer,
+ name text,
+ descr text,
+ add_on_type integer,
+ max_quant integer,
+ unit_name text,
+ unit_cost float
+ );
+
+ALTER TABLE eventmgt.ticket_add_on OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_add_on FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_add_on FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_add_on TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_add_on TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_add_on_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_add_on_id_seq TO nobody;
+
+CREATE INDEX ticket_add_on_id_index ON eventmgt.ticket_add_on (id);
+CREATE INDEX ticket_add_on_ticket_index ON eventmgt.ticket_add_on (ticket);
+
+CREATE TABLE eventmgt.promo_code
+ (
+ id SERIAL,
+ name text,
+ long_name text,
+ descr text,
+ start_date date,
+ end_date date,
+ notes text
+ );
+
+ALTER TABLE eventmgt.promo_code OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.promo_code FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.promo_code FROM postgres;
+GRANT ALL ON TABLE eventmgt.promo_code TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_code TO nobody;
+GRANT ALL ON TABLE eventmgt.promo_code_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_code_id_seq TO nobody;
+
+CREATE INDEX promo_code_id_index ON eventmgt.promo_code (id);
+CREATE INDEX promo_code_start_date_index ON eventmgt.promo_code (start_date);
+CREATE INDEX promo_code_end_date_index ON eventmgt.promo_code (end_date);
+
+CREATE TABLE eventmgt.promo_ticket
+ (
+ id SERIAL,
+ promo integer,
+ ticket integer,
+ promo_type integer,
+ amount float,
+ notes text
+ );
+
+ALTER TABLE eventmgt.promo_ticket OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.promo_ticket FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.promo_ticket FROM postgres;
+GRANT ALL ON TABLE eventmgt.promo_ticket TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_ticket TO nobody;
+GRANT ALL ON TABLE eventmgt.promo_ticket_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_ticket_id_seq TO nobody;
+
+CREATE INDEX promo_ticket_id_index ON eventmgt.promo_ticket (id);
+CREATE INDEX promo_ticket_ticket_index ON eventmgt.promo_ticket (ticket);
+
+CREATE TABLE eventmgt.room_detail
+ (
+ id SERIAL,
+ member integer,
+ accommodation integer,
+ occupants smallint,
+ room_type smallint,
+ bath_type smallint,
+ pullout_beds smallint,
+ single_beds smallint,
+ double_beds smallint,
+ queen_beds smallint,
+ king_beds smallint,
+ tv bool,
+ fridge bool,
+ safe bool,
+ descr text,
+ image text,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.room_detail OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.room_detail FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.room_detail FROM postgres;
+GRANT ALL ON TABLE eventmgt.room_detail TO postgres;
+GRANT ALL ON TABLE eventmgt.room_detail TO nobody;
+GRANT ALL ON TABLE eventmgt.room_detail_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.room_detail_id_seq TO nobody;
+
+CREATE INDEX room_detail_id_index ON eventmgt.room_detail (id);
+CREATE INDEX room_detail_member_index ON eventmgt.room_detail (member);
+CREATE INDEX room_detail_accom_index ON eventmgt.room_detail (accommodation);
+
+
+CREATE TABLE eventmgt.res_contact
+ (
+ id SERIAL,
+ contact_type int,
+ affiliation int,
+ fname text,
+ lname text,
+ org text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ country text,
+ zip text,
+ org_url text,
+ office_phone text,
+ mobile_phone text,
+ alt_phone text,
+ fax text,
+ email text,
+ login_id text,
+ alt_email text,
+ image text,
+ notes text,
+ create_date date,
+ active bool,
+ password text,
+ user_rights int
+ );
+
+ALTER TABLE eventmgt.res_contact OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.res_contact FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.res_contact FROM postgres;
+GRANT ALL ON TABLE eventmgt.res_contact TO postgres;
+GRANT ALL ON TABLE eventmgt.res_contact TO nobody;
+GRANT ALL ON TABLE eventmgt.res_contact_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.res_contact_id_seq TO nobody;
+
+CREATE INDEX res_contact_id_index ON eventmgt.res_contact (id);
+CREATE INDEX res_contact_affiliation_index ON eventmgt.res_contact (affiliation);
+CREATE INDEX res_contact_city_index ON eventmgt.res_contact (city);
+CREATE INDEX res_contact_email_index ON eventmgt.res_contact (email);
+CREATE INDEX res_contact_fname_index ON eventmgt.res_contact (fname);
+CREATE INDEX res_contact_lname_index ON eventmgt.res_contact (lname);
+CREATE INDEX res_contact_zip_index ON eventmgt.res_contact (zip);
+CREATE INDEX res_contact_login_id_index ON eventmgt.res_contact (login_id);
+
+
+CREATE TABLE eventmgt.event
+ (
+ id SERIAL,
+ name text,
+ event_code text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ descr text,
+ event_dates text,
+ active bool,
+ image text,
+ team_event bool,
+ days smallint,
+ start_date date,
+ end_date date,
+ cutoff_date date,
+ req_stay bool,
+ req_stay_arrive date,
+ req_stay_depart date,
+ req_stay_notice text,
+ open_res_date date,
+ conf_hours integer,
+ inven_hold_time integer,
+ sort smallint,
+ lat float,
+ lon float,
+ multiple_rooms bool,
+ max_rooms smallint,
+ cart_text text,
+ res_policy text,
+ can_policy text,
+ pmt_policy text,
+ res_msg text,
+ conf_msg text,
+ reserve_by_code bool,
+ central_payment bool,
+ central_payment_email text,
+ host_property smallint,
+ parking_image text,
+ parking_descr text
+ );
+
+ALTER TABLE eventmgt.event OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.event FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.event FROM postgres;
+GRANT ALL ON TABLE eventmgt.event TO postgres;
+GRANT ALL ON TABLE eventmgt.event TO nobody;
+GRANT ALL ON TABLE eventmgt.event_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.event_id_seq TO nobody;
+
+CREATE INDEX event_id_index ON eventmgt.event ( id );
+CREATE INDEX event_sort_index ON eventmgt.event ( sort );
+
+
+CREATE TABLE eventmgt.event_prop_dist
+ (
+ id SERIAL,
+ event integer,
+ event_lat float,
+ event_lon float,
+ member integer,
+ memb_lat float,
+ memb_lon float,
+ summary text,
+ start_addr text,
+ end_addr text,
+ distance text,
+ duration text
+ );
+
+ALTER TABLE eventmgt.event_prop_dist OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.event_prop_dist FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.event_prop_dist FROM postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_dist TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_dist TO nobody;
+GRANT ALL ON TABLE eventmgt.event_prop_dist_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_dist_id_seq TO nobody;
+
+CREATE INDEX event_prop_event_index ON eventmgt.event_prop_dist (event);
+CREATE INDEX event_prop_member_index ON eventmgt.event_prop_dist (member);
+
+
+CREATE TABLE eventmgt.inventory
+ (
+ id SERIAL,
+ date date,
+ member integer,
+ accommodation integer,
+ event integer,
+ assigned smallint,
+ available smallint,
+ rate float,
+ add_person float,
+ room_block text,
+ res_policy text,
+ can_policy text,
+ min_nights integer,
+ descr text
+ );
+
+ALTER TABLE eventmgt.inventory OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.inventory FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.inventory FROM postgres;
+GRANT ALL ON TABLE eventmgt.inventory TO postgres;
+GRANT ALL ON TABLE eventmgt.inventory TO nobody;
+GRANT ALL ON TABLE eventmgt.inventory_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.inventory_id_seq TO nobody;
+
+CREATE INDEX inventory_id_index ON eventmgt.inventory ( id );
+CREATE INDEX inventory_date_index ON eventmgt.inventory ( date );
+CREATE INDEX inventory_member_index ON eventmgt.inventory ( member );
+CREATE INDEX inventory_accom_index ON eventmgt.inventory ( accommodation );
+
+
+CREATE TABLE eventmgt.inven_hold
+ (
+ id SERIAL,
+ hold_type integer,
+ inventory integer,
+ quant integer,
+ expire_time timestamp,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.inven_hold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.inven_hold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.inven_hold FROM postgres;
+GRANT ALL ON TABLE eventmgt.inven_hold TO postgres;
+GRANT ALL ON TABLE eventmgt.inven_hold TO nobody;
+GRANT ALL ON TABLE eventmgt.inven_hold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.inven_hold_id_seq TO nobody;
+
+CREATE INDEX inven_hold_inventory_index ON eventmgt.inven_hold (inventory);
+CREATE INDEX inven_hold_session_id_index ON eventmgt.inven_hold (session_id);
+
+
+CREATE TABLE eventmgt.member
+ (
+ id SERIAL,
+ member_type smallint,
+ name text,
+ descr text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ lat float,
+ lon float,
+ active boolean,
+ cards_accepted smallint,
+ payment_gateway smallint,
+ gateway_par1 text,
+ gateway_par2 text,
+ gateway_par3 text,
+ gateway_par4 boolean,
+ gateway_par5 text,
+ paypal boolean,
+ paypal_client_id text,
+ paypal_secret text,
+ paypal_mode smallint,
+ image text,
+ parking_map text,
+ ticket_sec_map text,
+ ticket_spec_req boolean,
+ ticket_policy text,
+ intro_text text,
+ checkout_email text,
+ phone text,
+ email text,
+ proc_email text,
+ proc_email2 text,
+ checkout_notify boolean,
+ check_in time,
+ check_out time,
+ def_res_pol text,
+ def_can_pol text,
+ notes text,
+ amen_1 boolean,
+ amen_2 boolean,
+ amen_3 boolean,
+ amen_4 boolean,
+ amen_5 boolean,
+ amen_6 boolean,
+ amen_7 boolean,
+ amen_8 boolean,
+ amen_9 boolean,
+ amen_10 boolean,
+ def_ticket_pol text,
+ sort integer,
+ checkout_opt_1 text,
+ checkout_opt_2 text,
+ checkout_opt_3 text
+ );
+
+ALTER TABLE eventmgt.member OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.member FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.member FROM postgres;
+GRANT ALL ON TABLE eventmgt.member TO postgres;
+GRANT ALL ON TABLE eventmgt.member TO nobody;
+GRANT ALL ON TABLE eventmgt.member_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.member_id_seq TO nobody;
+
+CREATE INDEX member_id_index ON eventmgt.member ( id );
+
+CREATE TABLE eventmgt.amenities
+ (
+ id SERIAL,
+ affiliation_type smallint,
+ owner smallint,
+ name text,
+ quant int,
+ descr text
+ );
+
+ALTER TABLE eventmgt.amenities OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.amenities FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.amenities FROM postgres;
+GRANT ALL ON TABLE eventmgt.amenities TO postgres;
+GRANT ALL ON TABLE eventmgt.amenities TO nobody;
+GRANT ALL ON TABLE eventmgt.amenities_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.amenities_id_seq TO nobody;
+
+CREATE INDEX amenities_id_index ON eventmgt.amenities ( id );
+CREATE INDEX amenities_owner_index ON eventmgt.amenities ( owner );
+
+
+CREATE TABLE eventmgt.event_prop
+ (
+ id SERIAL,
+ event integer,
+ property integer
+ );
+
+ALTER TABLE eventmgt.event_prop OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.event_prop FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.event_prop FROM postgres;
+GRANT ALL ON TABLE eventmgt.event_prop TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop TO nobody;
+GRANT ALL ON TABLE eventmgt.event_prop_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_id_seq TO nobody;
+
+CREATE INDEX event_prop_event_id_index ON eventmgt.event_prop ( event );
+CREATE INDEX event_prop_property_id_index ON eventmgt.event_prop ( property );
+
+CREATE TABLE eventmgt.reservation
+ (
+ id SERIAL,
+ user_trace_info text,
+ fname text,
+ lname text,
+ org text,
+ team_id smallint,
+ state_rep smallint,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ phone text,
+ email text,
+ email_ok bool,
+ date_entered date,
+ arrive_date date,
+ nights smallint,
+ rooms smallint,
+ adults smallint,
+ team smallint,
+ member integer,
+ accommodation int,
+ room_block integer,
+ arrival text,
+ event smallint,
+ event_name text,
+ event_start date,
+ event_end date,
+ payby smallint,
+ cctype text,
+ ccnumber text,
+ expire text,
+ ccname text,
+ cccode text,
+ hotel_price float,
+ taxes float,
+ grand_total float,
+ confirmation smallint,
+ confirmed bool,
+ declined bool,
+ conf_numb text,
+ date_confirmed date,
+ conf_by text,
+ conf_message text,
+ special_needs text,
+ notes text,
+ res_detail text,
+ summary text
+ );
+
+ALTER TABLE eventmgt.reservation OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.reservation FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.reservation FROM postgres;
+GRANT ALL ON TABLE eventmgt.reservation TO postgres;
+GRANT ALL ON TABLE eventmgt.reservation TO nobody;
+GRANT ALL ON TABLE eventmgt.reservation_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.reservation_id_seq TO nobody;
+
+CREATE INDEX reservation_id_index ON eventmgt.reservation ( id );
+CREATE INDEX reservation_lname_index ON eventmgt.reservation ( lname );
+CREATE INDEX reservation_fname_index ON eventmgt.reservation ( fname );
+CREATE INDEX reservation_email_index ON eventmgt.reservation ( email );
+CREATE INDEX reservation_arrive_index ON eventmgt.reservation ( arrive_date );
+
+
+CREATE TABLE eventmgt.ticket_order
+ (
+ id SERIAL,
+ user_trace_info text,
+ active boolean,
+ fname text,
+ lname text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ phone text,
+ email text,
+ email_ok bool,
+ opt_field_1_name text,
+ opt_field_1 text,
+ opt_field_2_name text,
+ opt_field_2 text,
+ opt_field_3_name text,
+ opt_field_3 text,
+ purchase_date date,
+ member integer,
+ cctype text,
+ ccnumber text,
+ expire text,
+ ccname text,
+ ccconf text,
+ charge_total float,
+ special_needs text,
+ notes text,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.ticket_order OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_order FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_order FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_order TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_order TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_order_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_order_id_seq TO nobody;
+
+CREATE INDEX ticket_order_id_index ON eventmgt.ticket_order ( id );
+CREATE INDEX ticket_order_lname_index ON eventmgt.ticket_order ( lname );
+CREATE INDEX ticket_order_fname_index ON eventmgt.ticket_order ( fname );
+CREATE INDEX ticket_order_email_index ON eventmgt.ticket_order ( email );
+CREATE INDEX ticket_order_purchase_date_index ON eventmgt.ticket_order ( purchase_date );
+CREATE INDEX ticket_order_member_index ON eventmgt.ticket_order ( member );
+CREATE INDEX ticket_order_session_id_index ON eventmgt.ticket_order ( session_id );
+
+
+CREATE TABLE eventmgt.ticket_sold
+ (
+ id SERIAL,
+ ticket_order integer,
+ member integer,
+ member_name text,
+ assigned boolean,
+ assigned_from integer,
+ assigned_from_name text,
+ performance smallint,
+ performance_name text,
+ entrance smallint,
+ entrance_name text,
+ entrance_color text,
+ section smallint,
+ section_name text,
+ ticket integer,
+ ticket_name text,
+ is_package boolean,
+ package_sold_id text,
+ ticket_package integer,
+ package_name text,
+ date_specific boolean,
+ ticket_date date,
+ time_specific boolean,
+ ticket_time time,
+ start_date date,
+ end_date date,
+ likely_date date,
+ price_paid float,
+ policies text,
+ unlimited_use boolean,
+ numb_uses smallint,
+ numb_claimed smallint,
+ time_claimed timestamp,
+ voucher_type smallint,
+ voucher_text text,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.ticket_sold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_sold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_sold FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_sold TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_sold TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_sold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_sold_id_seq TO nobody;
+
+CREATE INDEX ticket_sold_id_index ON eventmgt.ticket_sold ( id );
+CREATE INDEX ticket_sold_ticket_order_index ON eventmgt.ticket_sold ( ticket_order );
+CREATE INDEX ticket_sold_member_index ON eventmgt.ticket_sold ( member );
+CREATE INDEX ticket_sold_assigned_from_index ON eventmgt.ticket_sold ( assigned_from );
+CREATE INDEX ticket_sold_performance_index ON eventmgt.ticket_sold ( performance );
+CREATE INDEX ticket_sold_ticket_index ON eventmgt.ticket_sold ( ticket );
+CREATE INDEX ticket_sold_ticket_date_index ON eventmgt.ticket_sold ( ticket_date );
+CREATE INDEX ticket_sold_likely_date_index ON eventmgt.ticket_sold ( likely_date );
+CREATE INDEX ticket_sold_time_claimed_index ON eventmgt.ticket_sold ( time_claimed );
+CREATE INDEX ticket_sold_session_id_index ON eventmgt.ticket_sold ( session_id );
+CREATE INDEX ticket_sold_package_sold_id_index ON eventmgt.ticket_sold ( package_sold_id );
+CREATE INDEX ticket_sold_ticket_package_index ON eventmgt.ticket_sold ( ticket_package );
+
+CREATE TABLE eventmgt.add_on_sold
+ (
+ id SERIAL,
+ ticket_order integer,
+ ticket_sold integer,
+ add_on_name text,
+ add_on_type integer,
+ add_on_type_name text,
+ unit_name text,
+ unit_price float,
+ quant integer,
+ price_paid float,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.add_on_sold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.add_on_sold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.add_on_sold FROM postgres;
+GRANT ALL ON TABLE eventmgt.add_on_sold TO postgres;
+GRANT ALL ON TABLE eventmgt.add_on_sold TO nobody;
+GRANT ALL ON TABLE eventmgt.add_on_sold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.add_on_sold_id_seq TO nobody;
+
+CREATE INDEX add_on_sold_id_index ON eventmgt.add_on_sold ( id );
+CREATE INDEX add_on_sold_ticket_order_index ON eventmgt.add_on_sold ( ticket_order );
+CREATE INDEX add_on_sold_ticket_sold_index ON eventmgt.add_on_sold ( ticket_sold );
+CREATE INDEX add_on_sold_session_id_index ON eventmgt.add_on_sold ( session_id );
+
+CREATE TABLE eventmgt.promo_sold
+ (
+ id SERIAL,
+ ticket_order integer,
+ ticket_sold integer,
+ promo integer,
+ promo_name text,
+ promo_type integer,
+ promo_type_name text,
+ amount float,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.promo_sold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.promo_sold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.promo_sold FROM postgres;
+GRANT ALL ON TABLE eventmgt.promo_sold TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_sold TO nobody;
+GRANT ALL ON TABLE eventmgt.promo_sold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_sold_id_seq TO nobody;
+
+CREATE INDEX promo_sold_id_index ON eventmgt.promo_sold ( id );
+CREATE INDEX promo_sold_ticket_order_index ON eventmgt.promo_sold ( ticket_order );
+CREATE INDEX promo_sold_ticket_sold_index ON eventmgt.promo_sold ( ticket_sold );
+CREATE INDEX promo_sold_promo_index ON eventmgt.promo_sold ( promo );
+CREATE INDEX promo_sold_session_id_index ON eventmgt.promo_sold ( session_id );
+
+
+CREATE TABLE eventmgt.ticket_claim_tracking
+ (
+ id SERIAL,
+ ticket_order integer,
+ ticket_sold integer,
+ time_of_action timestamp,
+ action_type smallint,
+ quant smallint,
+ scan_user integer,
+ scan_name text,
+ attendance smallint,
+ attendee_name text,
+ attendee_notes text
+ );
+
+ALTER TABLE eventmgt.ticket_claim_tracking OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_claim_tracking FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_claim_tracking FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking_id_seq TO nobody;
+
+CREATE INDEX ticket_claim_tracking_id_index ON eventmgt.ticket_claim_tracking ( id );
+CREATE INDEX ticket_claim_tracking_order_index ON eventmgt.ticket_claim_tracking ( ticket_order );
+CREATE INDEX ticket_claim_tracking_sold_index ON eventmgt.ticket_claim_tracking ( ticket_sold );
+CREATE INDEX ticket_claim_tracking_scan_user_index ON eventmgt.ticket_claim_tracking ( scan_user );
+
+
+CREATE TABLE eventmgt.attendance
+ (
+ id SERIAL,
+ member smallint,
+ name text,
+ notes text,
+ attendance_date timestamp,
+ entrance_start_time timestamp,
+ entrance_end_time timestamp,
+ perf_start_time timestamp,
+ perf_end_time timestamp
+ );
+
+ALTER TABLE eventmgt.attendance OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.attendance FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.attendance FROM postgres;
+GRANT ALL ON TABLE eventmgt.attendance TO postgres;
+GRANT ALL ON TABLE eventmgt.attendance TO nobody;
+GRANT ALL ON TABLE eventmgt.attendance_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.attendance_id_seq TO nobody;
+
+CREATE INDEX attendance_id_index ON eventmgt.attendance ( id );
+CREATE INDEX attendance_lmember_index ON eventmgt.attendance ( member );
+CREATE INDEX attendance_performance_index ON eventmgt.attendance ( performance );
+CREATE INDEX attendance_attendance_date_index ON eventmgt.attendance ( attendance_date );
+CREATE INDEX attendance_entrance_start_time_index ON eventmgt.attendance ( entrance_start_time );
+CREATE INDEX attendance_perf_start_time_index ON eventmgt.attendance ( perf_start_time );
+
+
+CREATE TABLE eventmgt.voucher_coupons
+ (
+ id SERIAL,
+ name text,
+ active boolean,
+ display_from timestamp,
+ display_to timestamp,
+ coupon_type smallint,
+ coupon_image text,
+ coupon_position smallint,
+ stretch_to_fit boolean,
+ padding integer,
+ show_border boolean,
+ max_display_count smallint,
+ display_count integer,
+ notes text
+ );
+
+ALTER TABLE eventmgt.voucher_coupons OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM postgres;
+GRANT ALL ON TABLE eventmgt.voucher_coupons TO postgres;
+GRANT ALL ON TABLE eventmgt.voucher_coupons TO nobody;
+GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO nobody;
+
+CREATE INDEX voucher_coupons_id_index ON eventmgt.voucher_coupons ( id );
+CREATE INDEX voucher_coupons_from_index ON eventmgt.voucher_coupons ( display_from );
+CREATE INDEX voucher_coupons_to_index ON eventmgt.voucher_coupons ( display_to );
+
diff --git a/docs/Current_Deployment_Notes.txt b/docs/Current_Deployment_Notes.txt
new file mode 100644
index 0000000..4be5dc8
--- /dev/null
+++ b/docs/Current_Deployment_Notes.txt
@@ -0,0 +1,638 @@
+Current Deployment Notes
+========================
+
+
+NEW CHANGES
+
+ DATABASE CHANGES
+ ----------------
+
+ CREATE TABLE eventmgt.voucher_coupons
+ (
+ id SERIAL,
+ name text,
+ active boolean,
+ display_from timestamp,
+ display_to timestamp,
+ coupon_type smallint,
+ coupon_image text,
+ coupon_position smallint,
+ stretch_to_fit boolean,
+ padding integer,
+ show_border boolean,
+ max_display_count smallint,
+ display_count integer,
+ notes text
+ );
+
+ ALTER TABLE eventmgt.voucher_coupons OWNER TO postgres;
+ REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM PUBLIC;
+ REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM postgres;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons TO postgres;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons TO nobody;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO postgres;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO nobody;
+
+ CREATE INDEX voucher_coupons_id_index ON eventmgt.voucher_coupons ( id );
+ CREATE INDEX voucher_coupons_from_index ON eventmgt.voucher_coupons ( display_from );
+ CREATE INDEX voucher_coupons_to_index ON eventmgt.voucher_coupons ( display_to );
+
+
+
+ ALTER TABLE eventmgt.ticket_sold ADD COLUMN package_name text;
+ update eventmgt.ticket_sold set package_name = '';
+ ALTER TABLE eventmgt.ticket_sold ADD COLUMN is_package boolean;
+ update eventmgt.ticket_sold SET is_package = false;
+
+ ALTER TABLE eventmgt.ticket_sold ADD COLUMN package_sold_id text;
+
+ CREATE INDEX ticket_sold_package_sold_id_index ON eventmgt.ticket_sold ( package_sold_id );
+ CREATE INDEX ticket_sold_ticket_package_index ON eventmgt.ticket_sold ( ticket_package );
+
+ CREATE TABLE eventmgt.attendance
+ (
+ id SERIAL,
+ member smallint,
+ name text,
+ notes text,
+ attendance_date timestamp,
+ entrance_start_time timestamp,
+ entrance_end_time timestamp,
+ perf_start_time timestamp,
+ perf_end_time timestamp
+ );
+
+ ALTER TABLE eventmgt.attendance OWNER TO postgres;
+ REVOKE ALL ON TABLE eventmgt.attendance FROM PUBLIC;
+ REVOKE ALL ON TABLE eventmgt.attendance FROM postgres;
+ GRANT ALL ON TABLE eventmgt.attendance TO postgres;
+ GRANT ALL ON TABLE eventmgt.attendance TO nobody;
+ GRANT ALL ON TABLE eventmgt.attendance_id_seq TO postgres;
+ GRANT ALL ON TABLE eventmgt.attendance_id_seq TO nobody;
+
+ CREATE INDEX attendance_id_index ON eventmgt.attendance ( id );
+ CREATE INDEX attendance_lmember_index ON eventmgt.attendance ( member );
+ CREATE INDEX attendance_attendance_date_index ON eventmgt.attendance ( attendance_date );
+ CREATE INDEX attendance_entrance_start_time_index ON eventmgt.attendance ( entrance_start_time );
+ CREATE INDEX attendance_perf_start_time_index ON eventmgt.attendance ( perf_start_time );
+
+ ALTER TABLE eventmgt.ticket_claim_tracking ADD COLUMN attendance smallint;
+ ALTER TABLE eventmgt.ticket_claim_tracking ADD COLUMN attendee_name text;
+ ALTER TABLE eventmgt.ticket_claim_tracking ADD COLUMN attendee_notes text;
+ CREATE INDEX ticket_claim_tracking_attendance_index ON eventmgt.ticket_claim_tracking ( attendance );
+ UPDATE eventmgt.ticket_claim_tracking SET attendance = 0, attendee_name = '', attendee_notes = '';
+
+ CREATE TABLE eventmgt.member_scans_for
+ (
+ id SERIAL,
+ member integer,
+ scans_for integer
+ );
+
+ ALTER TABLE eventmgt.member_scans_for OWNER TO postgres;
+ REVOKE ALL ON TABLE eventmgt.member_scans_for FROM PUBLIC;
+ REVOKE ALL ON TABLE eventmgt.member_scans_for FROM postgres;
+ GRANT ALL ON TABLE eventmgt.member_scans_for TO postgres;
+ GRANT ALL ON TABLE eventmgt.member_scans_for TO nobody;
+ GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO postgres;
+ GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO nobody;
+
+ CREATE INDEX member_scans_for_id_index ON eventmgt.member_scans_for (id);
+ CREATE INDEX member_scans_for_member_index ON eventmgt.member_scans_for (member);
+ CREATE INDEX member_scans_for_scans_for_index ON eventmgt.member_scans_for (scans_for);
+
+
+
+
+ CONFIG CHANGES
+ --------------
+
+ ; Terms used to refer to an attendance
+ term.attendance.norm = "attendance"
+ term.attendance.cap = "Attendance"
+ term.attendance.plur = "attendance"
+ term.attendance.plur_cap = "Attendance"
+
+ ; Terms used to refer to an attendee
+ term.attendee.norm = "attendee"
+ term.attendee.cap = "Attendee"
+ term.attendee.plur = "attendees"
+ term.attendee.plur_cap = "Attendees"
+
+ ; Terms used to refer to an attendance log
+ term.attendance_log.norm = "attendance log"
+ term.attendance_log.cap = "Attendance Log"
+ term.attendance_log.plur = "attendance logs"
+ term.attendance_log.plur_cap = "Attendance Logs"
+
+ ; Terms used to refer to entering (attendance)
+ term.attendance_entering.norm = "entering"
+ term.attendance_entering.cap = "Entering"
+ term.attendance_entering.plur = "entering"
+ term.attendance_entering.plur_cap = "Entering"
+
+ ; Terms used to refer to Coupons (advertisements) for vouchers
+ term.coupon.norm = "voucher coupon"
+ term.coupon.cap = "Voucher Coupon"
+ term.coupon.plur = "voucher coupons"
+ term.coupon.plur_cap = "Voucher Coupons"
+
+
+
+------------END OF NEW CHANGES NOTES------------------------------------
+
+Mackinaw Lakeshore Development (Mackinaw City)
+Username: hydrojet955
+Password: Mc33BoAt
+Current API Login ID: 6AkBG3xJ7HB
+Current Transaction Key: 6tJ5BxaB4X4f37JE
+
+Star Line Mackinac Island Passenger Service Inc. (St Ignace)
+Username: hydrojet956
+Password: Mc34BoAt
+Current API Login ID: 3Wazxf7G5u97
+Current Transaction Key: 3TW7f7Z28p5m4x9Y
+
+
+Database Update Notes
+---------------------
+
+
+
+Temporary Notes from Notepad
+----------------------------
+
+Jodie Things and other thing I've noticed
+
+* Include contact permission options to enable access to all locations data
+
+* Fix problems with Likely date not being validated
+ DONE
+
+* Check on correct "From:" E-Mail address for confirmation messages.
+
+* Agree to policies on checkout page not staying as what was selected when checkout fails.
+
+* Session ID or something not going to Authorize.net for use as an order ID.
+
+* Inventory may not be being created when a ticket is created.
+
+Longer term Jodie Things
+
+* One credit card checkout form
+
+* Need to consider limits on report results.
+
+To do
+
+* Can't use Add-ons for children in sunset cruises
+
+* Promo Codes not working on checkout - Check again
+ DONE
+
+* Make sure promo codes respect time ranges
+ DONE
+
+* Add "Code Recognized" indication to cart
+
+* Check if we should be storing ID of Add-on in add_on_sold table.
+
+* Make Checkout Results look like current checkout page for tables.
+ DONE
+
+* make likely date = ticket date if fixed date
+
+* may be issue with selection on "Ticket Select" page (cruises) when there's unlimited quantity and the underlying quant field is 0 or null.
+
+* Flag to permit voucher scanning by contact from any location
+
+* Ticket claim tracking
+
+* Check if login user can check/claim tickets at all locations - May need to make this a configuration option per customer.
+ Use option to suppress location name at top of page.
+
+
+
+Done
+
+* checkout now storing add-ons correctly
+
+* Vouchers now showing add-ons correctly
+
+* Sticky items showing up when category is active = false
+
+
+
+
+
+Current modifications to complete for Star Line
+-----------------------------------------------
+
+QUESTIONS
+
+ Are the dates on promo codes the date of purchase or the date of use?
+ ANSWER: Date of sale.
+
+Vouchers:
+
+ * Specified color per dock for voucher and for display when scanning vouchers.
+ Not always displaying correctly - Check
+ DONE - If not an assignment, the Section must specify an entrance and entrance must have color.
+
+ * 90 deg Rotated text not displaying in the correct position and moves as text changes.
+ DONE - Needed to use "left" for $align in glmpdfPlaceText() then "position=center" in the optlist.
+
+ * Summary of items purchased and totals on voucher cover page
+ DONE
+
+ * Policies per location for display on cover sheet of voucher.
+ DONE
+
+ * Simple (limited) text per category (performance) for display on bottom of voucher.
+ DONE
+
+ * Provide for blocking of printing Voucher Barcode if card will be printed and mailed. Note on voucher.
+ DONE - NEED TO TEST WITH PURCHASE
+
+ * Properly show add-ons
+ DONE
+
+Voucher related functionality:
+
+ * Ability to show just barcode for a specific voucher for possible scanning from a phone.
+ NOT DOING AT THIS TIME
+
+ * Ability of customers to enter a voucher number (and check code) to view order and re-print vouchers and display barcode for phone scanning.
+ NOT DOING AT THIS TIME
+
+ * Check on auto-scaling image on Voucher
+
+ * Check fonts on Dev53 used by Vouchers
+
+Front-End General:
+
+ * Removed number of "uses" from display on Front-end. Relying on descriptions to say how the tickets will be used.
+ DONE
+
+ * Fixed improper reference to ticket.ticket_name when should have been ticket.ticket_title for use on front-end.
+ DONE
+
+ * Test in Chrome and other browsers
+
+ * Test in mobile widths
+
+ * Check sort order of all output
+ DONE - for everything we're showing for Star Line
+
+ * Make sure that all available data can be displayed. (descriptions, images, etc). Set configurable options (in config/applications/EventManagement.ini) to turn those on/off.
+ DONE
+
+ * Sale of "group" tickets, like 2 Adults and 2 Children, should be on one voucher (which they are now). Need to confirm with Star Line.
+ DONE - Must be this way as they are group tickets.
+
+ * Look for "Check if we're receiving an array of new additions" in front/classes/support.php and check on this.
+
+ * Make sure add-ons work on ticketSelect page.
+
+ * Check that all new information is passed all the way through to orders
+
+Cart Page:
+
+ * Check on ordering of categories. They don't seem to follow the sort order field in the database.
+ DONE
+
+ * Have "nights" selection for valet parking display right away when user selects quantity for valet parking.
+ DONE - Decided to show it all the time for now.
+
+ * Have resubmit updates try to return to the same page scroll position.
+ DONE
+
+ * Check on not showing Dock selection or likely departure date unless they're needed. This is interfering with ordering things that don't need them.
+ DONE
+
+ * Consider adding a notice overlay when the first thing is selected that needs dock and date selection to instruct user that they need to enter that information.
+
+ * Remove the "reprint a previous order" thing from the top of the page.
+ DONE
+
+ * Added short descriptions to Categories. In cart use short description instead of normal when less than 600 wide.
+ DONE
+
+Checkout page:
+
+ * Make checkout page items lists look like Cart page
+ DONE - But might need to check what's store
+
+ * Make checkout prompt fields configurable in customer config file.
+ DONE
+
+ * Add a few optional/configurable text fields for checkout
+ DONE
+
+ * Fixed Special Requests field showing when not requested
+ DONE
+
+ * Fixed improper reference to ticket.ticket_name when should have been ticket.ticket_title for use on front-end.
+ DONE
+
+ * Fixed missing info for ticket orders.
+ DONE
+
+ * Check storage of promotions with purchase
+
+ * Check storage of Add-Ons with purchase
+ DONE
+
+Admin:
+
+ * Admin Login and improved colored claim scan results indications
+ DONE
+
+ * Test in Chrome and other browsers
+
+ * See if can do better with consignment type text - less confusing
+ DONE - Might want to move text for these things to customer config
+
+ * Add time override to inventory - Default to that set in the ticket
+ Added to inventory edit
+ Need to use that time throughout the rest of admin and front-end
+ SUSPENDED FOR NOW
+
+ * Fix issues with small and large list switching and alignment of columns when selecting large/small or resizing window.
+ DONE
+
+ * Redisplay lists when something is added deleted or edited.
+ Need to add feature to know where the list is so it can be updated.
+ Working on this....
+
+ * Low-level front-end admin access.
+ DONE
+
+ * Background color on scan of voucher to show Pass/No Pass status.
+ DONE
+
+ * Inventory calendars not showing all dates at times
+
+ * Add link from a performance to permit purchasing from admin even if performance or ticket is not active.
+ Added flag to ticket to permit active boolean, but need to Respect in front-end.
+
+ * Add any needed reporting for promotions
+
+ * Add any needed reporting for Add-Ons
+
+ * Consider copying default ticket time into inventory so that a specific inventory item can have the time of the event adjusted.
+ Only do this if there's time available for the change.
+
+ * Consider adding a "Category" parameter to performances to permit categorizing performances. (This would mean changing how we use these terms for Star Line.)
+
+Not-categorized:
+
+* May need to consider non-date-related items such as purchased physical items (books, etc) - Don't show likely departure date in cart for these.
+
+* Consider adding year/season to all ticket data and establishing a "seasonal" option that lets admin select a year/season to work with.
+
+* Check Member Ticket Policy - Does not seem to be in detail or edit.
+
+* Agree to policies on checkout needs to be in red - required.
+
+* Need to complete tracking of multiple claims for tickets that can be claimed more than once.
+ Database seems to be setup, but need to add tracking and display in ticket sold display
+
+* Need to add code to handle editing of tickets sold.
+
+* Check on adding entrance to ticket. May not always be able to use "Entrance" from section
+ i.e. Sunset Cruises.
+ DONE - may need some work later to make this more universal
+
+* Check on doing a pop-up message when checkout completed instructing users to print tickets or retain order and voucher numbers.
+
+* Voucher cover page
+ Web address
+ Phone Numbers
+ Maps??? Or do the appropriate map with each voucher.
+
+* Set a date range for creating inventory in ticket edit
+ This should be used as the date range when building inventory
+ It should be the dates checked when checking if inventory needs to be added or turned off
+ It should default to the date range specified in the event
+ DONE - But not defaulting to performance dates
+
+* Need to handle Valet Parking
+ Valet parking is charged per night.
+ Consider this a ticket "Add-On" item
+ Select 1 or multiple for an add-on item (yes/no or quantity)
+ Optional Price per add-on
+ Include field to say what this is (i.e "Per Night", or "Each")
+ Should show on line below primary line for ticket.
+
+ Ticket Add-On
+
+ * create table ticket_add_on
+ name
+ description
+ type (single (option), selected quantity,
+ other - perhaps packaging of other tickets)
+ see "ticket_add_on_type" in config
+ max quantity if quantity related
+ unit name
+ unit amount
+
+ * Add admin management of add-ons for a specific ticket
+
+ * Add handling of add-ons when selecting tickets and in cart and checkout
+
+ * Add handling of add-ons in reporting.
+
+ Added to admin but not done on front-end
+
+* Promo Code
+ Entry of Promo Code text
+ Each promo code has list of tickets it applies to
+ Each promo code provides either percentage or $ amount
+
+ promo_code
+ id SERIAL,
+ name text,
+ descr text,
+ start_date date,
+ end_date date,
+ notes text
+
+ promo_ticket
+
+ id SERIAL,
+ ticket text,
+ promo_type integer,
+ amount float,
+ notes text
+
+
+* Check on entrance display in Section selection page.
+
+Completed
+
+* Toggle list size button for lists in admin.
+ DONE
+
+* Need to add time specific, # of uses, and number of claims to ticket sold data
+ DONE
+
+* For vouchers "Round Trip Ticket", "Retain this ticket for your return trip.
+ Now configurable text per ticket or event
+ DONE
+
+* Forget session button when running on Development server
+ Added to bottom of all pages if running on a development server
+ DONE
+
+* Add better "Please Wait" thingy.
+ Added pop-up/overlay for pages needing this.
+ DONE
+
+* Departure date for non-date-specific tickets
+ Added likely departure date to cart and likely date to checkout
+ Need to add to ticket order information also
+ DONE
+
+* Remove "Each" from cart and checkout tables
+ DONE
+
+* Add second doc (location) handling for St. Ignace
+ Added "Entrance" feature to ticketing system and termed this as "Docks" for Star Line
+ Still need to get this printing on summaries and vouchers
+ DONE
+
+* Checkout contact information "Please send information ..." should default to checked.
+ DONE
+
+* "Print Vouchers" to "Print Boarding Passes" ???
+ Changed terms used for "Voucher" to "Boarding Pass"
+ DONE
+
+* Enable browser menus on the voucher window so people can print.
+ Enabled menus and added window.print() to script
+ DONE
+
+-------
+
+
+
+* Create new optional Purchase process for Star Line
+ See "Streamlined Ticketing for Star Line.odg"
+
+ Venues need "type"
+ type 1 Standard Location/venue
+ Can sell items
+ type 2 Standard Location/venue + Sell through other venues
+ Can sell items
+ Can offer items for sale by other locations
+ Must flag items to be sold this way
+ Other vendors must be approved by this vendor to sell their stuff
+ Items must be flagged as sellable by others
+ (may want to have specific ticket negotiations)
+ type 3 Non-sales vendor, tickets only sold by type 1 or 2 locations/venues on this system
+ Does not sell items
+ Items of Type 3 are available for sale by type 2
+
+ Ticket need flag that permits them to be sold by other vendors
+
+ Need flag for ticket that causes it to always be shown on cart - even with 0 quantity.
+
+ Ticket sold needs pointer to vendor who sold the ticket/item (in addition to the point to the member who's tickets they are)
+
+* Try to sort cart by ticket sort order
+
+* Set global terms
+ location: Departing From
+ (Consider adding categories of events)
+ Event: Category ???
+ Section: Section
+ Ticket: Item
+ Inventory: Inventory
+
+* Get info on Motorola hand scanners for Jerry - May need 8 to 10 - Most WiFi but some Cell.
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning#
+
+ Possible options - Prices approx
+
+ Simple for use with computer
+ $108 (Amazon) http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning/General+Purpose+Scanners/LI2208
+ $380 (Amazon) http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning/General+Purpose+Scanners/LI4278
+
+ Wireless
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MT2000+Series+Handheld+Mobile+Terminals_US-EN
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MC55A0
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning/Rugged+Scanners/MT2000+Series+Handheld+Mobile+Terminals_US-EN
+
+ Ruggedized Mobile Computer
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MC3100_US-EN
+
+ Cell Capable
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/TC55#specs_tab
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MC67
+
+
+* Create Venue - Event - Section - Ticket - Inventory summary with flags for issues in Admin area
+ Expandable sections might be good
+
+* Update reports to work correctly with all new changes
+
+* Add Month and Day of Week enable/dissable for inventory edit page
+ * Consider being able to highlight date cells and do bulk edit with them.
+
+* Update Help file and enable context sensitive admin help
+
+
+
+Issues to check on
+------------------
+
+* Make sure default inventory is created when tickets are created.
+
+* Make sure that tickets are not presented on the front-end unless there's inventory
+
+* Make sure that non-date-specific inventory is handled correctly
+ * Inventory edit updates quantities properly
+ * Front-end and reports use correct numbers
+
+* Make sure we're using the right name/title for tickets and other things (internal vs user terms)
+
+* Check on content of stored purchase summary
+
+* Check that credit card type and name on cart are stored in order detail
+
+* Make sure that multiple claims per ticket is working correctly and showing on back-end correctly
+
+
+
+
+
+
+OLD INFO - MAY NOT BE RELEVANT ANYMORE
+
+* Change any fees of type 11 or 12 that are in use to type 10
+* Check to make sure Toolkit/EventManagement/config.ini has updated fee definitions
+
+; Fee Method
+fee_method.fixed_stay = 1
+fee_method.fixed_accom = 2
+fee_method.fixed_accomnight = 3
+fee_method.percent_stay = 10
+
+; Fee Method Numbers - admin
+fee_method_numb.1 = "Per Reservation - Fixed Fee"
+fee_method_numb.2 = "Per Room - Fixed Fee"
+fee_method_numb.3 = "Per Night - Fixed Fee"
+fee_method_numb.10 = "% of Room Rate"
+
+; Fee Method Numbers - Front End
+fee_method_numb_fe.1 = "Per Reservation"
+fee_method_numb_fe.2 = "Per Room"
+fee_method_numb_fe.3 = "Per Night"
+fee_method_numb_fe.10 = "Per Room"
+
+
+alter table convention add column central_payment boolean;
+alter table convention add column central_payment_email text;
+alter table convention add column host_property smallint;
+update convention set central_payment = 'f', central_payment_email = '', host_property = 0;
diff --git a/docs/Delete_Event.sql b/docs/Delete_Event.sql
new file mode 100644
index 0000000..1ec7fea
--- /dev/null
+++ b/docs/Delete_Event.sql
@@ -0,0 +1,21 @@
+
+-- Find event ID
+SELECT id, name, conv_code, start_date, end_date FROM convention;
+
+
+-- Replace {CONV ID} with desired event id
+DELETE FROM team_roster WHERE team IN (SELECT id FROM team WHERE conv = {CONV ID});
+DELETE FROM team_property WHERE conv = {CONV ID};
+DELETE FROM team_property WHERE conv = {CONV ID};
+DELETE FROM state_rep WHERE conv = {CONV ID};
+DELETE FROM division WHERE conv = {CONV ID};
+DELETE FROM room_block WHERE conv = {CONV ID};
+DELETE FROM room_block_seg WHERE conv = {CONV ID};
+DELETE FROM inven_hold WHERE inventory IN (SELECT id FROM inventory WHERE conv = {CONV ID});
+DELETE FROM inventory WHERE conv = {CONV ID};
+DELETE FROM reservation WHERE conv = {CONV ID};
+DELETE FROM fees WHERE affiliation_type = 1 AND owner = {CONV ID};
+DELETE FROM conv_prop_dist WHERE convention = {CONV ID};
+DELETE FROM event_prop WHERE event = {CONV ID};
+DELETE FROM convention WHERE id = {CONV ID};
+
diff --git a/docs/Development_Notes.txt b/docs/Development_Notes.txt
new file mode 100644
index 0000000..47d4be3
--- /dev/null
+++ b/docs/Development_Notes.txt
@@ -0,0 +1,513 @@
+Current Work
+------------
+
+Notes regarding modifications to Ticketing to support ferry services
+
+Things to update
+----------
+SQL and database changes required for current updates
+
+alter table eventmgt.ticket add column unlimited_quant boolean;
+update eventmgt.ticket set unlimited_quant = false;
+alter table eventmgt.misc drop column return_url;
+alter table eventmgt.misc add column intro_text text;
+alter table eventmgt.misc add column ticket_text text;
+alter table eventmgt.misc add column ticket_opt_text text;
+alter table eventmgt.misc add column cart_text text;
+alter table eventmgt.misc add column checkout_text text;
+alter table eventmgt.misc add column success_text text;
+update eventmgt.misc set
+ intro_text = 'Intro text',
+ ticket_text = 'Ticket selection text',
+ ticket_opt_text = 'Ticket option selection text',
+ cart_text = 'Cart text',
+ checkout_text = 'Checkout text',
+ success_text = 'Checkout success text';
+
+Above needed for current devdb copy
+
+alter table eventmgt.ticket add column section_specific boolean;
+alter table eventmgt.ticket add column time_specific boolean;
+alter table eventmgt.ticket add column date_specific boolean;
+alter table eventmgt.ticket add column unlimited_use boolean;
+alter table eventmgt.ticket add column start_date date;
+alter table eventmgt.ticket add column end_date date;
+alter table eventmgt.ticket add column uses smallint;
+update eventmgt.ticket set
+ section_specific = true,
+ time_specific = true,
+ date_specific = true,
+ unlimited_use = false,
+ start_date = null,
+ end_date = null,
+ uses = 1;
+
+
+
+How to add a new main tab item to admin
+---------------------------------------
+
+* Edit view index.html and add a new tab where desired.
+* Set "emTabId" for that tab to the desired model and action (i.e. Attendees_list}
+* Create a matching directory under both...
+ models/admin/actions/{model}
+ views/admin/tickets/{model}
+* Add action include files in models/admin/actions/{model}. Typically these are...
+ add.inc, confirmDelete.inc, delete,inc, detail.inc, edit.inc, insert.inc, list.inc, selected.inc, update.inc
+* Add view files in views/admin/tickets/{model}. Typically these are...
+ added.html, deleted,html, detail.html, edit.html, list.html
+
+
+
+
+Update CommonAbstracts-PDF-V0
+-------------
+
+High priority for Starline
+
+* Check on creating tickets for an event needing to select the venu
+* Check on permitting selection of both date specific and non date specific tickets for the same event
+* Options to set defaults for checkboxes when creating tickets
+
+* Options for tickets
+ * No Section
+ * No time
+ * Non-date specific
+ * Active for specified range of dates for non-date specific tickets
+ * Multiple scans/uses for a single ticket - Specified number
+ * Unlimited scans/uses for ticket
+ * Unlimited inventory
+* Track Scan time, location, user when claiming tickets
+
+* Convert to Smarty Templates
+* Create admin/log-in user ticket sales interface
+* If a single venue, default to that venue when creating tickets and other things
+* Recommend other tickets/sales on ticket selection
+* Packaging
+ * Purchase multiple tickets as one item
+* Pre-sales to other sales agents
+ * Create agents to sell (use contacts with specified permissions)
+ * Track sales agent / means of sale for each ticket sold
+ Add "sold_by" field to ticket_sold table
+* Add filters to lists
+ * Active/inactive
+ * Venue
+ * Section
+ * Date range for ticket orders
+
+
+* Check on support for portable bar-code readers with audible/light/display confirmation.
+ BarcodesInc, Chicago 1-800-351-9962
+ * Hand held, weather proof, bar-code, WiFi, optional link to cell phone/service, display/audio for confirmation/info
+
+
+
+
+
+Things to check on
+
+* Checkout permitted with no cart contents if re-displaying checkout
+* on checkout fail (field not filled in) says "This venue does not have a payment method configured. Please call this venue to purchase tickets."
+* Need ability to display prototype of all E-Mail messages sent. Optionally all forms.
+
+
+
+
+* Need to split and verify application.ini file into common app and user configuration files.
+
+* Moving schema from reservations to eventmgt
+* Moving table convention to table event
+* Moving fields that point to event (convention) to event
+* Move ..._APP_BASE to THIS_APP_BASE as appropriate
+
+
+
+
+
+FROM V2 - Much still needs to be implemented
+
+Notes from 2/1/2013
+
+Do something to deal with someone double selecting the same available inventory into their cart.
+Cart should check for actual maximums available or we can implement the selected inventory hold.
+
+Check all property fees to see if any type 1 or type 10 are set as "Fee is selectable per room":
+
+For event fees, per room % of room rate seems to be superfluous.
+
+May need to check for per Reservation optional fee that's not per room on accommodations selection page.
+
+----
+
+
+
+DB updates
+ alter table convention add column central_payment boolean;
+ alter table convention add column central_payment_email text;
+ alter table convention add column host_property smallint;
+ update convention set central_payment = 'f', central_payment_email = '', host_property = 0;
+
+
+In procees
+ Central Payment
+ Admin work
+ * central_payment Flag
+ * central_payment_email Who gets bills
+ Request credit card Flag
+ Show prices to guests Flag
+ ??? Billing/payment reconciliation to members ???
+ Front-end
+ Request credit card if set
+ Send reservation to Prop
+ Send billing to central billing
+ Members Area
+ Look through to find things that might need to be fixed up
+ ??? payment reconciliation to members ???
+ Host Property
+ Admin
+ * Work completed
+ Front End
+ Need to display host propert at top of lists
+ Highlight background?
+
+
+
+
+
+General Development Notes
+
+alter table
+
+Fees Matrix
+
+ Available with
+ Applied at level Event Property
+ Per Reservation - Fixed Fee
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No No
+
+ Per Room - Fixed Fee
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No Yes
+
+ Per Night - Fixed Fee
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No Yes
+
+ % of Room Rate
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No Yes
+
+
+Misc Notes
+----------
+
+Pending database updates for live servers
+-----------------------------------------
+
+For geo mapping address
+/*
+include this link
+http://maps.googleapis.com/maps/api/js?sensor=true
+
+// For the Event Map
+// Create a jquery dialog with #map-dialog
+$('#map-dialog').dialog({
+height: 480,
+width: 520,
+modal: true,
+autoOpen: false
+});
+$("#map-it").click(function(e){
+e.preventDefault();
+$("#map-dialog").dialog('open');
+GLM_GeoMap.initialize();
+});
+
+
+
+
+*/
+
+Site Status
+-----------
+
+ Server Site Version Notes
+ dev52 Development V1, V2
+ dev53 Development (pending)
+ ws0 app.gaslightmedia.com V1, V2
+ ws3 app.gaslightmedia.com V1, V2
+ www.discoverkalamazoo.com V2
+
+
+Task List
+---------
+
+GENERAL
+
+** Check for International Address Support
+ DONE
+
+** Add fields for E-Mail addresses to event (general contact, internal contact, from address)
+ Can we use Discover Kalamazoo in the from line and GeneralInfo@DiscoverKalamazoo.com as the email address? - Jodie
+
+** Ability to select an event that is charged to a central entity rather than to each attendee
+
+** Check owner name salutation line in confirmation e-mails.
+
+** Event ID as access to event registrations
+ DONE
+
+** Host property selection in event
+
+** Display of date/rates when rates are inconsistent for a stay
+
+* Purge any previous customer info or links from system (greatlakesbay)
+
+* Need to change calendar.phtml pop-up to all JAVAscript using a layer at some point.
+
+* Add "conv" field to inven_hold table to make it easier to identify by event.
+
+ADMIN AREA
+
+** Add Team filter and output sorting options to Reservations report
+
+* Add check for inventory that doesn't match the evnet dates when the dates for an event are changed.
+ Add check for this whenever the event is selected and prominantly warn the user.
+ Make sure that inventory associated with an event is displayed even if it's outside the date range for the event.
+ Add warning to inventory that is outside the date range for an event when listing/viewing that inventory.
+
+* Need to have system check to make sure inventory is in a rational date frame for the event. If the event date
+ changes, it needs to still be able to display what inventory is in there (which it seems to have a problem with)
+ and needs to warn the admin user that the inventory needs to be change. Consider adding code such that if the
+ event start date changes that all inventory slides the same number of days.
+
+* Add Division to reservation reports
+
+* Add Division to Events->Reservations list and detail
+
+* Check fees/taxes detail output to make sure $ & % are displayed correctly for selected type.
+
+* Add date for earliest possible reservation used to block reservations prior to a certain date.
+
+* Reservations report
+ Add table ordered by State Rep, Team
+ ***DONE*** Add filter for State Rep
+
+* Add map drag-drop capability for Lat/Lon input and refining positions.
+ Ask Steve for his code.
+
+* Check on styles properly loading for printed reports
+
+* Set table headers to not scroll in admin areas
+
+* Add property search field for Inventory list summary screen
+
+* Add delete functions to dataAbstract.php and appropriate admin areas
+ ***DONE*** Contacts
+ Events
+ Event Fees & Taxes
+ State Reps
+ Divisions
+ Teams
+ ***DONE*** Inventory ( this is done in inventory edit - now checking for room blocks first )
+ Properties
+ Property Fees & Taxes
+ Property Accommodations
+
+* Reports - Complete basic reports
+ ***DONE*** Room block Reports
+ Room Requests
+ Reservations
+ Finance
+
+* Help - complete help texts and Quickhelp popups
+
+* When inventory is added, see if it's easy to have the inventory summary at the top scroll to the selected property
+
+* Build default teams using "Division" names when a division or State rep is added
+
+* Add ability to include sort links at top of tables
+
+* Add demographics info to reports
+
+* Auto-generate default "access codes" (currently "Team code") to produce rational password style string
+ {word}{nnn}{word} kind of password
+
+* Auto-generate team records when state-division is added
+
+* Check for and fix "&" in Room Block Report
+
+RESERVATIONS FRONT-END
+
+* System does not handle the situation where all of the inventory for an event is well outside the date range of the event.
+ (See similar issue for admin area above). If this happens it should not break but rather show no properties available.
+
+* Accommodations image problem
+
+* Add support for Fee/Tax guest optional items and optional quantities.
+
+* Check for earliest possible reservation date and display that instead of link to event on event selection page if it's not time to reserve yet.
+
+* Room Blocks Front-end lists, include fees/taxes in property detail pages just below room-blocks list.
+
+* Move fees/taxes on property detail page, to just below accommodation selection
+ Move "Add Selected Accommodation" button to bottom of list.
+
+* Mage sure "Must arrive by" and "Must not depart before" dates are displayed correctly and that default arrive/depart search dates are correct.
+
+* Add "Must arrive by" and "Must not depart before" dates to Event Selection screen
+
+* Keep pending reservations selections (on hold) from being reserved by others
+
+* Need to deal with checkout problem where there might be more than one room block that matches the same accommodation and team.
+ Currently not able to distribute consumption of rooms between multiple room blocks where the conv, state, team, and accomodation all match.
+
+* Make sure reservations respect
+ req_stay_arrive
+ req_stay_depart dates
+ ***DONE*** open_res_date
+ cutoff_date
+
+* Setup default and custom E-Mail message templates (by event) for sending to visitor on making the reservation. (file in this directory)
+
+* Check "OK to send" setting. Make sure it's respected on checkout
+
+* Check cart to make sure that there is availability for all cart entries
+ Currently only checking each separately
+ Consider combining same accommodation to make one entry
+
+* Add check-in and check-out times to conf E-Mail to visitors
+
+* On property profile (unit selection) page add the following:
+ Room Amenitites
+ Distance from Event
+ Consider moving number of rooms, credit card data to right had side as in main site
+ Make sure all appropriate data displayed in main site member profile pages is displayed
+ Consider moving description to below room list to minimize scrolling
+ Consider making profile page and property selection page similar
+
+* Check to make sure any session timeout is handled properly.
+
+* Reservations submitted E-Mail messages need to be customizable by event.
+
+* E-Mail sent when submitting reservation should include driving directions
+
+* Fix arrive_date stored with reservation request
+
+* Add storage of fees summary into reservations request then fix reservations reports to use that data
+
+MEMBERS FRONT-END
+
+* Fix problem with editing reservation dates and such.
+ Note that line with "calc_unit_totals()" call has been commented out.
+
+* Complete processing of accommodation quantity and date changes when updating a reservation.
+ Check again for availability
+ Rebuild summary
+ Note changes in Notes field.
+
+* Fix "fudged" min and max reservations available dates for modifying reservations
+ Should be based on actual availability for each accommodation
+
+* Create "print" option for printing out reservation detail for a selected reservation.
+
+* Change to appearance similar to back-end tables
+
+* Add copy of policies to reservation confirmation E-Mail
+
+* When declining reservations do not send E-Mail to visitor, only send E-Mail to event contacts (King Comm.)
+
+* Check reservations daily(hourly?) and send warning notices of unconfirmed reservations (see conf_hours) to members and summary to event contacts.
+
+* Confirmation E-Mail messages need to be customizable by event.
+ Need to be able to say whether credit card will be charged upon reservation or at checkin.
+
+* Change conf message to HTML and use view file
+
+* Driving directions link on Confirmation E-Mail
+
+* Ability to edit reservations dates
+ When storing, update all inventory and room block availability numbers
+ Recalculate all charges, fess, and totals
+ Update reservation record with new data
+ Add to notes for this reservations record how it was modified
+
+STATE-REP ROOM BLOCK SUMMARY
+
+
+
+OTHER NOTES ON USE
+
+Info on sending test message to properties for a specific event
+---------------------------------------------------------------
+* Enter front-end reservations as a team or regular visitor.
+* Select accommodations for a single property
+* Proceed to checkout
+* Under "Billing Information" in the "First Name" field enter "Event Test Property Message"
+* Fill out rest of information and submit
+ You may use the 0011001100110011 pseudo creadit card number
+* System will produce a single test message to the "cscott@gaslightmedia.com" address for testing this mode
+* To have the test message sent to all properties associated with the selected event enter "Production Mode" in the "Last Name" field.
+* Messages will contain
+ - "John Doe" information for the billed party
+ - Will be addressed to each property
+ - Will NOT contain any of the credit card information submitted
+ - Will contain the exact selected reservations summary and totals selected in the cart
+ - Will NOT clear the cart or create an actual reservation
+
+
+PHASE 2 WORK
+
+* Property defines cut-off date for reservations if not defined in Event
+
+
+
+
+How to delete an entire event
+-----------------------------
+
+Delete data in this order
+
+Table Link to Link field
+----------------------- --------------- -------------------------------------------
+ SELECT id, name, conv_code, start_date, end_date FROM convention;
+team_roster team team = {team for specified event}
+ DELETE FROM team_roster WHERE team IN (SELECT id FROM team WHERE conv = {CONV ID});
+team_property convention conv = {convention}
+ DELETE FROM team_property WHERE conv = {CONV ID};
+team convention conv = {convention}
+ DELETE FROM team_property WHERE conv = {CONV ID};
+state_rep convention conv = {convention}
+ DELETE FROM state_rep WHERE conv = {CONV ID};
+division convention conv = {convention}
+ DELETE FROM division WHERE conv = {CONV ID};
+room_block convention conv = {convention}
+ DELETE FROM room_block WHERE conv = {CONV ID};
+room_block_seg convention conv = {convention}
+ DELETE FROM room_block_seg WHERE conv = {CONV ID};
+inven_hold inventory inventory = {inv for specified event}
+ DELETE FROM inven_hold WHERE inventory IN (SELECT id FROM inventory WHERE conv = {CONV ID});
+inventory convention conv = {convention}
+ DELETE FROM inventory WHERE conv = {CONV ID};
+res_contact ???
+reservation convention conv = {convention}
+ DELETE FROM reservation WHERE conv = {CONV ID};
+fees convention affiliation_type = 1, owner = {convention}
+ DELETE FROM fees WHERE affiliation_type = 1 AND owner = {CONV ID};
+conv_prop_dist convention convention = {convention}
+ DELETE FROM conv_prop_dist WHERE convention = {CONV ID};
+event_prop convention event = {convention}
+ DELETE FROM event_prop WHERE event = {CONV ID};
+convention
+ DELETE FROM convention WHERE id = {CONV ID};
+
+
diff --git a/docs/Field Specifications b/docs/Field Specifications
new file mode 100644
index 0000000..05784ab
--- /dev/null
+++ b/docs/Field Specifications
@@ -0,0 +1,271 @@
+Field Definitions Specification
+
+Fields are specified using an array of field specification arrays.
+
+Sample:
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'filter' => 'int',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Name of event
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => 'string',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+
+The index for fields must be unique, but three may be multiple entries for a
+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',
+ 'bitmap', like list but permits multi-pick
+ 'text',
+ '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_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
+
+'p_table' Table to get related data from for pointer types
+
+'p_field' Field to get related data from for field types
+
+'p_id' name of ID field in related data table
+
+'p_where' Additional WHERE clause 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_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_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_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.
+
+'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.
+
+'list' Required with field type 'list' - includes simple array where...
+ array key is value for option
+ array value is name for option
+
+'bitmap' Required with field type 'bitmap' - includes array of (position, name) for each option
+ array key is a value indicating the bit position (i.e. 1, 2, 3, 4) starting with 1 rather than 0 (it will be converted)
+ array value is the name for the option
+
+'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
+
+'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.
+
+'quicktip' Text description of this field and its use.
+
+
+Data specification for various types
+------------------------------------
+
+Type 'list'
+
+ Return data
+
+ array(
+ 'list' => array(
+ array('name' => {name}, 'value' => {value}, 'default' => {true if default or selected},
+ ....
+ ),
+ 'value' => {value of selected option},
+ 'name' => {name of selected option}
+ )
+
+Type 'bitmap'
+
+ Return data
+
+ array(
+ 'bitmap' => array(
+ array('name' => {name}, 'value' => {value}, 'default' => {true if default or selected},
+ ....
+ ),
+ 'value' => {value of selected option},
+ 'names' => array( {simple list of names of selected options} )
+ )
+
+Type 'date'
+
+ Input data fields
+
+ When using single input text field, input field is name of field
+
+ When using separate M, D, Y picklist or input fields
+
+ '{field}_month'
+ '{field}_day'
+ '{field}_year'
+
+ Return data
+
+ array(
+ 'date' => {text date},
+ 'timestamp' => {timestamp},
+ 'date_list' => array(
+ 'month' => {picklist array},
+ 'day' => {picklist array},
+ 'year' => {picklist array}
+ ),
+ )
+
+Type 'time'
+
+ Input data fields
+
+ When using single input text field, input field is name of field
+
+ When using separate H, M picklist or input fields
+
+ '{field}_hour'
+ '{field}_min'
+ '{field}_ampm'
+
+
+ Return data
+
+ array(
+ 'time' => {text time},
+ 'time_list' => array(
+ 'hour' => {picklist array},
+ 'min' => {picklist array},
+ 'ampm' => {picklist array}
+ ),
+ )
+
+
+Types 'latitude' & 'longitude'
+
+ Return data
+
+ array(
+ 'dir' => {direction: -1 = S or W, +1 = N or E},
+ 'dir_list' => array(
+ array('name' => 'N', 'value' => 1, 'default' => {true if default or selected}),
+ array('name' => 'S', 'value' => -1, 'default' => {true if default or selected})
+ ),
+ 'deg' => {degrees},
+ 'min' => {minutes},
+ 'sec' => {seconds}
+ )
+
+
+Type 'image'
+
+ Input fields
+
+ '{field}_delete' Name of checkbox field to delete image
+ '{field}_new' Name of file input field to save new image
+
+
+Type 'picklist'
+
+ Parameters for {picklist array}
+
+ 'name' Name to use for this option
+ 'value' Value to return when this option is selected
+ 'default' True if this option is currently selected
+
+
+
diff --git a/docs/Install.txt b/docs/Install.txt
new file mode 100644
index 0000000..254f460
--- /dev/null
+++ b/docs/Install.txt
@@ -0,0 +1,226 @@
+Install Instructions
+
+* This version of Event Management is a New Common App so it's in /var/www/server/CommonApps/EventManagement_V?
+
+* Add the following files/directories if they don't already exist
+
+ /common Directory containing symbolic links to a "web" directory in a common application
+ If creating directory, set svn:ignore for all files below that directory.
+
+ /admin/EventManagement Directory containing a file to kick off EventManagement admin functions
+ /config/applications Directory containing ini files for specific applications
+
+* Add the following symbolic links in the Web site /common directory
+
+ ln -s /var/www/server/CommonApps/EventManagement_V{version}/web EventManagement
+ ln -s /var/www/server/CommonApps/Public Public
+ touch Only_symbolic_links_in_this_directory-do_not_add_to_repository
+
+* Copy the contents of the docs/admin/EventManagement directory to /admin/EventManagement
+
+* Copy the contents of docs/config/applications directory to /config/applications
+
+* Check if the contents of docs/Barcode already exist in "/usr/share/fonts/truetype/barcode".
+ If not, copy docs/Barcode to /usr/share/fonts/truetype/barcode
+
+* Edit site's /config/application.ini.
+
+ Make sure the following is near the top of the file
+
+ ; CommonApps configuration
+ commonApps.base_path = "/var/www/server/CommonApps/"
+
+ Remove any any old configuration for EventManagement and add the following
+
+ ; Turn the events management application On or Off
+ event_management.application = On
+ event_management.version = "EventManagement_V3"
+
+* Make sure site loads jquery
+
+* Create a Toolbox page for the EventManagement front-end and note catid
+
+* Create a Toolbox page for the EventManagement Member's login and note catid
+
+* Add eventmgt schema to database - data/EventManagement.sql
+
+* Edit /admin/nav.phtml and add the following
+
+ if (defined('EVENT_MANAGEMENT') && EVENT_MANAGEMENT) {
+ $nav['Event Management'] = BASE_URL.'admin/EventManagement/EventManagement.php';
+ }
+
+* Edit /config/applications/EventManagement.ini and set at least
+
+ "home_page", "members_only_page" with ID's for pages created above
+
+* Make sure there's not reference to a "reservations" schema in /Toolkit/Database.php
+
+* Create file in /static directory for the front-end catid with the following...
+
+ commonApps->base_path.$GLOBALS['applicationConfig']->event_management->version.'/controllers/FrontController.php';
+ $html = new EventManagementIndexController($GLOBALS['applicationConfig'], $GLOBALS['serverConfig'], $GLOBALS['siteConfig']);
+ ?>
+
+* Create file in /static directory for the admin login catid with the following...
+
+ event_management->version.'/controllers/AdminController.php';
+ ?>
+
+* Check to make sure site has owner information in the config/site.ini file.
+
+ ; Web Site Owner Information - for use by certain applications
+ owner.name = "Gaslight Media"
+ owner.short_name = "GLM"
+ owner.address1 = "120 E. Lake St."
+ owner.address2 = False
+ owner.city = "Petoskey"
+ owner.state = "MI"
+ owner.zip = "49770"
+ owner.country = "US"
+ owner.phone = "231-487-0692"
+ owner.toll_free = False
+
+
+HEREHERHRHERHERHE
+
+
+
+// **************** below is OLD ***********************
+
+* Add the contents of the documentation/config/application.ini file to /config/application.ini
+
+* Add a page for the Event Reservations front-end and note the catid
+
+* Add a page for the members only area Event Housing and note the catid
+
+* Update the following files to include the necessary references to Event Management
+ For old sites without ini files and schemas use replacements in Old sites below.
+
+ /setup.phtml
+
+ /**
+ * Site has Event Management
+ */
+ define('EVENT_MANAGEMENT', $applicationConfig->event_management->application);
+ define('EVENT_MANAGEMENT_HOME_PAGE', $applicationConfig->event_management->home_page);
+ define('EVENT_MANAGEMENT_MEMBERS_PAGE', $applicationConfig->event_management->members_only_page);
+
+
+; Turn the events management application On or Off
+event_management.application = On
+event_management.common_apps = "/var/www/server/CommonApps/"
+event_management.base_path = "/var/www/server/CommonApps/EventManagement_V3/"
+; The page id in the toolbox that is the entry page for Event management - Generally set for each server
+event_management.home_page = 130
+event_management.members_only_page = 131
+
+
+ ; Turn the events management application On or Off
+ event_management.application = On
+ ; The page id in the toolbox that is the entry page for Event management - Generally set for each server
+ event_management.home_page = 239
+ event_management.members_only_page = 240
+
+ ************ NOT NEEDED ANY MORE ************
+ /Toolkit/Database.php in _setSearchPath() function - *** Only if site already has schemas!!! ***
+
+ if (defined('EVENT_MANAGEMENT') && EVENT_MANAGEMENT) {
+ // define event management search path
+ $stmt->bindValue(':schema', 'reservations', PDO::PARAM_STR);
+ $stmt->execute();
+ }
+ *********************************************
+
+ /admin/nav.phtml
+
+ if (defined('EVENT_MANAGEMENT') && EVENT_MANAGEMENT) {
+ $nav['Event Management'] = 'admin/EventManagement/EventManagement.php';
+ }
+
+ /static/{front-end-page}
+
+
+
+ /static/{member-admin-page}
+
+
+
+* Fix member login problem with some sites.
+
+ /memberdb/index.php -- Move logout before auth start
+
+ $memberAuth =& new Toolkit_Members_Auth($root, 'DB', array(), '', false);
+ $memberAuth->setIdle();
+ if (isset($_GET['logout']) || isset($_POST['doLogin'])) {
+ $memberAuth->logout();
+ }
+ $memberAuth->start();
+
+ /memberdb/classes/class_user.inc -- Add user name to logout button.
+
+ $out .= '
';
+
+
+* Old sites that don't have ini files and schemas
+
+ /setup.phtml
+
+ /**
+ * Site has Event Management
+ */
+ define('EVENT_MANAGEMENT', true);
+ define('EVENT_MANAGEMENT_HOME_PAGE', 0);
+ define('EVENT_MANAGEMENT_MEMBERS_PAGE', 0);
+ define('EVENT_MANAGEMENT_LEGACY_SITE', true);
+
+
+ /static/{front-end-page}
+
+ prepare($sql);
+ $stmt->execute();
+
+ $html = new Toolkit_EventManagement_EventManagement($dbh);
+
+ ?>
+
+* Edit /Toolkit/EventManagement/config.ini to set the customer's information
+
+* Add page catid for all pages that should be secure to "$securePagesArray = array(12,33);" in setup.phtml
+
+* Optionally to have a seprate style for this site copy Legacy/styles.css to virtual server directory /Toolkit/EventManagement/styles.css
+
+
+
+
\ No newline at end of file
diff --git a/docs/ProgramFlow.txt b/docs/ProgramFlow.txt
new file mode 100644
index 0000000..51a96b1
--- /dev/null
+++ b/docs/ProgramFlow.txt
@@ -0,0 +1,83 @@
+Event Management
+
+NEED TO UPDATE FOR VERSION 3
+
+
+Notes:
+
+* If there is an /admin/EventManagement/templates directory, the application will look for
+ templates there. Otherwise it will use the standard set in {app}/Common/EventManagement_V2/admin/templates
+
+
+General Program Flow and Class Organization
+-------------------------------------------
+
+Directories & Components
+
+Toolkit/EventManangement
+
+ Contains all setup, configuration, and libraries for application
+
+Toolkit/EventManagement/data
+
+ Contains all Libraries for access to data
+
+ dataAbstract.php
+
+ Abstract class for all access to data
+
+ Methods for processing input and output for all standard field types
+ Method to build queries from field specification tables
+ Methods for all standard data operations
+
+ getStats() Get record counts of various types
+ getList() Get list of records for a particular table
+ getEntry() Get record detail for an entry in a table
+ newEntry() Prepare data to ask for detail for a new table entry
+ insertEntry() Add new detail entry to table
+ editEntry() Prepare data for edit of entry
+ updateEntry() Update data for an entry
+ deleteEntry() Prepare data for confirmation to delete and entry
+ deleteConfirmEntry() Delete an entry if confirmed
+
+ data{app}.php - i.e. dataEvents.php, dataMembers.php, ...
+
+ Data support class for a specific application - such as handing event data or member data
+
+ Field definitions and specifications for a particular table or related group of tables
+ Methods for handling data from these tables for various types of operations.
+ i.e. Stats, List, ...
+ Whenever possible, these methods should try to use methods in the abstract class
+ to support these operations.
+ Methods for handling operations unique to this specific application.
+
+
+admin/EventManagement
+
+ Contains code specific to the admin section for this applicaiton.
+ Whenever possible this code should use the classes in the "Toolkit/EventManagement/Data"
+ directory to support the admin actions.
+
+admin/EventManagement/EventManagement.php
+
+ Main code section for the admin section
+
+admin/Eventmanagement/classes
+
+ Contains all class libraries for performing data retrieval and storage.
+ Whenever possible should use the "data" classes in "Toolkit/EventManagement/data" for
+ data storage and retrieval by calling the "data{app}.php" base classes.
+
+
+
+
+Admin
+
+ /admin/nav.phtml
+ /admin/EventManagement/EventManagement.php
+ /setup.phtml
+ /Toolkit/EventManagement/config.ini
+ /admin/EventManagement/classes/{} - where {} = events.php, ...
+ /Toolkit/EventManagement/data/data{} - where {} is same as above
+ /Toolkit/EventManagment/data/dataAbstract.php
+
diff --git a/docs/Sites_Using.txt b/docs/Sites_Using.txt
new file mode 100644
index 0000000..e7b1db5
--- /dev/null
+++ b/docs/Sites_Using.txt
@@ -0,0 +1,6 @@
+Sites_Using.txt
+---------------
+
+File depreciated
+
+See: CommonApps/EventManagement/V3/Notes/Sites_Using.txt
\ No newline at end of file
diff --git a/docs/Streamlined Ticketing for Star Line.odg b/docs/Streamlined Ticketing for Star Line.odg
new file mode 100644
index 0000000..085cd94
Binary files /dev/null and b/docs/Streamlined Ticketing for Star Line.odg differ
diff --git a/docs/Testing Notes.txt b/docs/Testing Notes.txt
new file mode 100644
index 0000000..321b96f
--- /dev/null
+++ b/docs/Testing Notes.txt
@@ -0,0 +1,12 @@
+Testing Notes
+
+Checkout Test options
+
+This parameter is required for any test option below
+ Last name: GLM TEST ONLY
+
+Do not store the reservation result
+ First name: GLM DO NOT STORE
+
+Do not clear the cart cookie
+ Address (line 1): GLM DO NOT CLEAR
diff --git a/docs/Toolkit/EventManagement/EventManagement.php b/docs/Toolkit/EventManagement/EventManagement.php
new file mode 100644
index 0000000..b23162e
--- /dev/null
+++ b/docs/Toolkit/EventManagement/EventManagement.php
@@ -0,0 +1,19 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: EventManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://housing.gaslightmedia.com/admin/
+ */
+
+echo "NEED TO FIGURE THIS OUT ..."; exit;
+require_once GLM_APP_BASE.'Common/EventManagement_V2/Legacy/EventManagement.php';
+
+?>
\ No newline at end of file
diff --git a/docs/Toolkit/EventManagement/MembersEventManagement.php b/docs/Toolkit/EventManagement/MembersEventManagement.php
new file mode 100644
index 0000000..f833df0
--- /dev/null
+++ b/docs/Toolkit/EventManagement/MembersEventManagement.php
@@ -0,0 +1,57 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: EventManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://housing.gaslightmedia.com/admin/
+ */
+
+
+// Check for an old site that doesn't have a proper autoloader or $dbh defined.
+if (defined('EVENT_MANAGEMENT_LEGACY_SITE')) {
+
+ /* DEPRECIATED ALERT */
+ echo '
+
+ General description of common proceedures goes here.
+
+
+
+
System Setup
+
+ Discussion about setting up system information.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..2f069ce
--- /dev/null
+++ b/index.html
@@ -0,0 +1,17 @@
+
+
+
This is the report area....
+
+ some stuff goes here
+
+
+
+
+{startScript:h}
+
+ // jQuery Section
+ $(document).ready(function(){
+
+ });
+
+
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/add.inc b/models/admin/actions/Accommodation/add.inc
new file mode 100644
index 0000000..746f00c
--- /dev/null
+++ b/models/admin/actions/Accommodation/add.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+$r = $Accoms->newAccom();
+
+$this->page->accomDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewAccom = true;
+
+$this->templateFile = 'Accommodation/EditAccommodation.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/addRoom.inc b/models/admin/actions/Accommodation/addRoom.inc
new file mode 100644
index 0000000..c5c9d1a
--- /dev/null
+++ b/models/admin/actions/Accommodation/addRoom.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+$r = $Rooms->newRoom();
+
+$this->page->roomDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewRoom = true;
+
+$this->templateFile = 'Accommodation/EditRoom.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/detail.inc b/models/admin/actions/Accommodation/detail.inc
new file mode 100644
index 0000000..b8f20cf
--- /dev/null
+++ b/models/admin/actions/Accommodation/detail.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+// Get Accommodation detail
+$accomDetail = $Accoms->getAccomDetail();
+$this->page->accomDetail = $this->bindArrayToObject($accomDetail);
+
+// Get Rooms list
+$roomsList = $Rooms->getRoomsList();
+$this->page->roomsList = $this->bindArrayToObject($roomsList);
+
+$this->templateFile = 'Accommodation/AccommodationDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/edit.inc b/models/admin/actions/Accommodation/edit.inc
new file mode 100644
index 0000000..91b903d
--- /dev/null
+++ b/models/admin/actions/Accommodation/edit.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+$accomDetail = $Accoms->editAccom();
+$this->page->accomDetail = $this->bindArrayToObject($accomDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($accomDetail);
+
+$this->page->editingAccom = true;
+
+$this->templateFile = 'Accommodation/EditAccommodation.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/editRoom.inc b/models/admin/actions/Accommodation/editRoom.inc
new file mode 100644
index 0000000..f891690
--- /dev/null
+++ b/models/admin/actions/Accommodation/editRoom.inc
@@ -0,0 +1,29 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+$roomDetail = $Rooms->editRoom();
+$this->page->roomDetail = $this->bindArrayToObject($roomDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($roomDetail);
+
+$this->templateFile = 'Accommodation/EditRoom.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/insert.inc b/models/admin/actions/Accommodation/insert.inc
new file mode 100644
index 0000000..00b86b3
--- /dev/null
+++ b/models/admin/actions/Accommodation/insert.inc
@@ -0,0 +1,40 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Accoms->insertAccom();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->accomDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewAccom = true;
+ $this->templateFile = 'Accommodation/EditAccommodation.html';
+} else {
+ $this->templateFile = 'Accommodation/AccommodationDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/insertRoom.inc b/models/admin/actions/Accommodation/insertRoom.inc
new file mode 100644
index 0000000..43095d0
--- /dev/null
+++ b/models/admin/actions/Accommodation/insertRoom.inc
@@ -0,0 +1,50 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Rooms->insertRoom();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->roomDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewRoom = true;
+ $this->templateFile = 'Accommodation/EditRoom.html';
+} else {
+
+ // Get Accommodation detail
+ $accomDetail = $Accoms->getAccomDetail();
+ $this->page->accomDetail = $this->bindArrayToObject($accomDetail);
+
+ // Get Rooms list
+ $roomsList = $Rooms->getRoomsList();
+ $this->page->roomsList = $this->bindArrayToObject($roomsList);
+
+ $this->templateFile = 'Accommodation/AccommodationDetail.html';
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/list.inc b/models/admin/actions/Accommodation/list.inc
new file mode 100644
index 0000000..1581bdf
--- /dev/null
+++ b/models/admin/actions/Accommodation/list.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+// Get members stats
+$accomsStats = $Accoms->getAccomsStats();
+$this->page->accomsStats = $this->bindArrayToObject($accomsStats);
+
+// Get accommodations list
+$accoms = $Accoms->getAccomsList();
+$this->page->accomsList = $this->bindArrayToObject($accoms);
+
+$this->templateFile = 'Accommodation/AccommodationsList.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/update.inc b/models/admin/actions/Accommodation/update.inc
new file mode 100644
index 0000000..4f8c52f
--- /dev/null
+++ b/models/admin/actions/Accommodation/update.inc
@@ -0,0 +1,44 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Accoms->updateAccom();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->accomDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$accomDetail = $Accoms->getAccomDetail();
+$this->page->storedDetail = $this->bindArrayToObject($accomDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingAccom = true;
+ $this->templateFile = 'Accommodation/EditAccommodation.html';
+} else {
+ $this->templateFile = 'Accommodation/AccommodationDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Accommodation/updateRoom.inc b/models/admin/actions/Accommodation/updateRoom.inc
new file mode 100644
index 0000000..03fa6ee
--- /dev/null
+++ b/models/admin/actions/Accommodation/updateRoom.inc
@@ -0,0 +1,52 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/rooms.php';
+$Rooms = new EventManagementAdminRooms($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Rooms->updateRoom();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->roomDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$accomDetail = $Rooms->getRoomDetail();
+$this->page->storedDetail = $this->bindArrayToObject($roomDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->templateFile = 'Accommodation/EditRoom.html';
+} else {
+
+ // Get Accommodation detail
+ $accomDetail = $Accoms->getAccomDetail();
+ $this->page->accomDetail = $this->bindArrayToObject($accomDetail);
+
+ // Get Rooms list
+ $roomsList = $Rooms->getRoomsList();
+ $this->page->roomsList = $this->bindArrayToObject($roomsList);
+
+ $this->templateFile = 'Accommodation/AccommodationDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Addon/add.inc b/models/admin/actions/Addon/add.inc
new file mode 100644
index 0000000..3ee71ed
--- /dev/null
+++ b/models/admin/actions/Addon/add.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: add.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+$r = $Addons->newAddon();
+
+$this->page->addonDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+$this->page->addingNewAddon = true;
+
+$this->templateFile = 'Addon/edit.html';
+
+$this->addDebug("Addon/add.inc", 'Array: $r', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Addon/confirmDelete.inc b/models/admin/actions/Addon/confirmDelete.inc
new file mode 100644
index 0000000..6287d71
--- /dev/null
+++ b/models/admin/actions/Addon/confirmDelete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: confirmDelete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+$addonDetail = $Addons->addonDelete(true);
+$this->page->addonDetail = $this->bindArrayToObject($addonDetail);
+
+$this->templateFile = 'Addon/detail.html';
+
+$this->addDebug("Addon/confirmDelete.inc", 'Section Confirm Delete', print_r($addonDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Addon/delete.inc b/models/admin/actions/Addon/delete.inc
new file mode 100644
index 0000000..591e1c2
--- /dev/null
+++ b/models/admin/actions/Addon/delete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: delete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+$addonDetail = $Addons->addonDelete(false);
+$this->page->addonDetail = $this->bindArrayToObject($addonDetail);
+
+$this->templateFile = 'Addon/delete.html';
+
+$this->addDebug("Addon/delete.inc", 'Array: $addonDetail', print_r($addonDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Addon/detail.inc b/models/admin/actions/Addon/detail.inc
new file mode 100644
index 0000000..c7f2dab
--- /dev/null
+++ b/models/admin/actions/Addon/detail.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+// Get Add-on detail
+$addonDetail = $Addons->getAddonDetail();
+$this->page->addonDetail = $this->bindArrayToObject($addonDetail);
+
+$this->templateFile = 'Addon/detail.html';
+
+$this->addDebug("Addon/detail.inc", 'Array: $addonDetail', print_r($addonDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Addon/edit.inc b/models/admin/actions/Addon/edit.inc
new file mode 100644
index 0000000..1a7a220
--- /dev/null
+++ b/models/admin/actions/Addon/edit.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: edit.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+$addonDetail = $Addons->editAddon();
+$this->page->addonDetail = $this->bindArrayToObject($addonDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($addonDetail);
+
+$this->page->editingAddon = true;
+
+$this->templateFile = 'Addon/edit.html';
+
+$this->addDebug("Addon/edit.inc", 'Array: $addonDetail', print_r($addonDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Addon/insert.inc b/models/admin/actions/Addon/insert.inc
new file mode 100644
index 0000000..05197cf
--- /dev/null
+++ b/models/admin/actions/Addon/insert.inc
@@ -0,0 +1,43 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: insert.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+// Process new record
+$r = $Addons->insertAddon();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->addonDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewAddon = true;
+ $this->templateFile = 'Addon/edit.html';
+} else {
+
+ $addonID = $r['fieldData']['id'];
+
+ $this->templateFile = 'Addon/selected.html';
+}
+
+$this->addDebug("Addon/insert.inc", 'Array: $r', print_r($r,1));
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Addon/list.inc b/models/admin/actions/Addon/list.inc
new file mode 100644
index 0000000..00344fa
--- /dev/null
+++ b/models/admin/actions/Addon/list.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: list.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+// Get Add-On stats
+$addonStats = $Addons->getAddonsStats();
+$this->page->addonsStats = $this->bindArrayToObject($addonsStats);
+
+// Get Add-Ons list
+$addons = $Addons->getAddonsList($id, false, false, $type);
+$this->page->addons = $this->bindArrayToObject($addons);
+
+$this->templateFile = 'Addon/list.html';
+
+$this->addDebug("Addon/list.inc", 'Array: $addons', print_r($addons,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Addon/selected.inc b/models/admin/actions/Addon/selected.inc
new file mode 100644
index 0000000..9ed2194
--- /dev/null
+++ b/models/admin/actions/Addon/selected.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: selected.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+$addonDetail = $Addons->getAddonDetail();
+$this->page->addonDetail = $this->bindArrayToObject($addonDetail);
+
+$this->templateFile = 'Addon/selected.html';
+
+$this->addDebug("Addon/selected.inc", 'Addon Detail', print_r($addonDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Addon/update.inc b/models/admin/actions/Addon/update.inc
new file mode 100644
index 0000000..c71cb20
--- /dev/null
+++ b/models/admin/actions/Addon/update.inc
@@ -0,0 +1,43 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: update.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addons.php';
+$Addons = new EventManagementAdminAddons($this->dbh, $this->config);
+
+// Process new record
+$r = $Addons->updateAddon();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->addonDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$addonDetail = $Addons->getAddonDetail();
+$this->page->storedDetail = $this->bindArrayToObject($addonDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingAddon = true;
+ $this->templateFile = 'Addon/edit.html';
+} else {
+ $this->templateFile = 'Addon/detail.html';
+}
+
+$this->addDebug("Addon/update.inc", 'Array: $r', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Attendance/add.inc b/models/admin/actions/Attendance/add.inc
new file mode 100755
index 0000000..931e2b1
--- /dev/null
+++ b/models/admin/actions/Attendance/add.inc
@@ -0,0 +1,36 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: attendance.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get a list of members to select from
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+$members = $Members->getMembersList('all');
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+$r = $Attendance->newEntry();
+
+$this->page->memberDetail = $this->bindArrayToObject($member);
+$this->page->attendanceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+$this->page->addingNewAttendance = true;
+
+$this->templateFile = 'Attendance/edit.html';
+
+$this->addDebug("Attendance/add.inc", 'Array: $r', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Attendance/confirmDelete.inc b/models/admin/actions/Attendance/confirmDelete.inc
new file mode 100755
index 0000000..5ff1e57
--- /dev/null
+++ b/models/admin/actions/Attendance/confirmDelete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: confirmDelete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+$attendanceDetail = $Attendance->attendanceDelete(true);
+$this->page->attendanceDetail = $this->bindArrayToObject($attendanceDetail);
+
+$this->templateFile = 'Attendance/detail.html';
+
+$this->addDebug("Attendance/confirmDelete.inc", 'Section Confirm Delete', print_r($attendanceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Attendance/delete.inc b/models/admin/actions/Attendance/delete.inc
new file mode 100755
index 0000000..a23f36c
--- /dev/null
+++ b/models/admin/actions/Attendance/delete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: delete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+$attendanceDetail = $Attendances->attendanceDelete(false);
+$this->page->attendanceDetail = $this->bindArrayToObject($attendanceDetail);
+
+$this->templateFile = 'Attendance/delete.html';
+
+$this->addDebug("Attendance/delete.inc", 'Array: $attendanceDetail', print_r($attendanceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Attendance/detail.inc b/models/admin/actions/Attendance/detail.inc
new file mode 100644
index 0000000..29676d8
--- /dev/null
+++ b/models/admin/actions/Attendance/detail.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendances.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+// Get Attendance detail
+$attendanceDetail = $Attendance->getAttendanceDetail();
+$this->page->attendanceDetail = $this->bindArrayToObject($attendanceDetail);
+
+$this->templateFile = 'Attendance/detail.html';
+
+$this->addDebug("Attendance/detail.inc", 'Array: $attendanceDetail', print_r($attendanceDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Attendance/edit.inc b/models/admin/actions/Attendance/edit.inc
new file mode 100755
index 0000000..a3c9656
--- /dev/null
+++ b/models/admin/actions/Attendance/edit.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: edit.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+$attendanceDetail = $Attendance->editAttendance();
+$this->page->attendanceDetail = $this->bindArrayToObject($attendanceDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->attendanceDetail = $this->bindArrayToObject($attendanceDetail);
+
+$this->page->editingAttendance = true;
+
+$this->templateFile = 'Attendance/edit.html';
+
+$this->addDebug("Attendance/edit.inc", 'Array: $attendanceDetail', print_r($attendanceDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Attendance/insert.inc b/models/admin/actions/Attendance/insert.inc
new file mode 100755
index 0000000..82270a1
--- /dev/null
+++ b/models/admin/actions/Attendance/insert.inc
@@ -0,0 +1,45 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: insert.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+var_dump($_REQUEST);
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+// Process new record
+$r = $Attendance->insertEntry();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->attendanceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewAttendance = true;
+ $this->templateFile = 'Attendance/edit.html';
+} else {
+
+ $attendanceID = $r['fieldData']['id'];
+
+ $this->templateFile = 'Attendance/selected.html';
+}
+
+$this->addDebug("Attendance/insert.inc", 'Array: $r', print_r($r,1));
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Attendance/list.inc b/models/admin/actions/Attendance/list.inc
new file mode 100755
index 0000000..21069f8
--- /dev/null
+++ b/models/admin/actions/Attendance/list.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: list.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+// Get Attendance stats
+$attendanceStats = $Attendance->getAttendanceStats();
+$this->page->attendanceStats = $this->bindArrayToObject($attendanceStats);
+
+// Get Attendance list
+$attendanceList = $Attendance->getList();
+$this->page->attendance = $this->bindArrayToObject($attendanceList);
+
+$this->templateFile = 'Attendance/list.html';
+
+$this->addDebug("Attendance/list.inc", 'Array: $attendanceList', print_r($attendanceList, 1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Attendance/selected.inc b/models/admin/actions/Attendance/selected.inc
new file mode 100755
index 0000000..8b87cb9
--- /dev/null
+++ b/models/admin/actions/Attendance/selected.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: selected.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+$attendanceDetail = $Attendance->getAttendanceDetail();
+$this->page->attendanceDetail = $this->bindArrayToObject($attendanceDetail);
+
+$this->templateFile = 'Attendance/selected.html';
+
+$this->addDebug("Attendance/selected.inc", 'Attendance Detail', print_r($attendanceDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Attendance/update.inc b/models/admin/actions/Attendance/update.inc
new file mode 100755
index 0000000..41d41a9
--- /dev/null
+++ b/models/admin/actions/Attendance/update.inc
@@ -0,0 +1,43 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: update.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/attendance.php';
+$Attendance = new EventManagementAdminAttendance($this->dbh, $this->config);
+
+// Process new record
+$r = $Attendance->updateAttendance();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->attendanceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$attendanceDetail = $Attendance->getAttendanceDetail();
+$this->page->storedDetail = $this->bindArrayToObject($AttendanceDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingAttendance = true;
+ $this->templateFile = 'Attendance/edit.html';
+ $this->addDebug("Attendance/update.inc", 'Array: $r', print_r($r,1));
+} else {
+ // $this->templateFile = 'Attendance/detail.html';
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/actions/Attendance/detail.inc';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Block/detail.inc b/models/admin/actions/Block/detail.inc
new file mode 100644
index 0000000..60bf2d5
--- /dev/null
+++ b/models/admin/actions/Block/detail.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/blocks.php';
+$Blocks = new EventManagementAdminBlocks($this->dbh, $this->config);
+
+
+// Get Room Blocks Detail for a selected Event and member (must have an event selected)
+$detail = $Blocks->getBlocksDetail();
+$this->page->blocksDetail = $this->bindArrayToObject($detail);
+$this->page->AND = '&&'; // a hack to get this into some javascript
+
+$this->templateFile = 'Block/BlocksDetail.html';
+
+?>
+
diff --git a/models/admin/actions/Block/show.inc b/models/admin/actions/Block/show.inc
new file mode 100644
index 0000000..66275ad
--- /dev/null
+++ b/models/admin/actions/Block/show.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/blocks.php';
+$Blocks = new EventManagementAdminBlocks($this->dbh, $this->config);
+
+
+$roomBlocks = $Blocks->getRoomBlocks();
+
+if ($roomBlocks['blocks'] != false) {
+ $this->page->blocksList = $this->bindArrayToObject($roomBlocks['blocks']);
+}
+$this->page->statesList = $this->bindArrayToObject($roomBlocks['states']);
+
+// echo "
".print_r($roomBlocks,1)."
";
+$this->templateFile = 'Block/BlocksList.html';
+
+?>
+
diff --git a/models/admin/actions/Block/summary.inc b/models/admin/actions/Block/summary.inc
new file mode 100644
index 0000000..1c961ed
--- /dev/null
+++ b/models/admin/actions/Block/summary.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/blocks.php';
+$Blocks = new EventManagementAdminBlocks($this->dbh, $this->config);
+
+
+// Get Room Blocks Summary for a selected Event (must have an event selected)
+$summary = $Blocks->getBlocksSummary();
+$this->page->blocksSummary = $this->bindArrayToObject($summary);
+
+$this->templateFile = 'Block/BlocksSummary.html';
+
+?>
+
diff --git a/models/admin/actions/Block/updateBlocks.inc b/models/admin/actions/Block/updateBlocks.inc
new file mode 100644
index 0000000..13485c5
--- /dev/null
+++ b/models/admin/actions/Block/updateBlocks.inc
@@ -0,0 +1,24 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/blocks.php';
+$Blocks = new EventManagementAdminBlocks($this->dbh, $this->config);
+
+
+$roomBlocks = $Blocks->saveRoomBlocks();
+
+$this->templateFile = 'Block/UpdateBlocksAssignment.html';
+
+?>
+
diff --git a/models/admin/actions/Block/updateDetail.inc b/models/admin/actions/Block/updateDetail.inc
new file mode 100644
index 0000000..c0dafcd
--- /dev/null
+++ b/models/admin/actions/Block/updateDetail.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/blocks.php';
+$Blocks = new EventManagementAdminBlocks($this->dbh, $this->config);
+
+
+$r = $Blocks->updateBlocksDetail();
+$this->page->blocksStatus = $r;
+
+$this->templateFile = 'Block/UpdateBlocksDetail.html';
+
+?>
+
diff --git a/models/admin/actions/Booking/add.inc b/models/admin/actions/Booking/add.inc
new file mode 100644
index 0000000..f9c6982
--- /dev/null
+++ b/models/admin/actions/Booking/add.inc
@@ -0,0 +1,92 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/bookings.php';
+$Bookings = new EventManagementAdminBookings($this->dbh, $this->config);
+
+
+if ($_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ require '../classes/events.php';
+ $Events = new EventManagementAdminEvents($this->dbh, $this->config);
+ $eventDetail = $Events->getEntry($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $this->page->eventName = $eventDetail['name'];
+ $this->page->eventID = $eventDetail['id'];
+ $this->page->haveEvent = true;
+} else {
+ $this->page->haveEvent = false;
+}
+
+if ($_SESSION[GLM_EVENT_SESSION]['Team'] != false) {
+ require '../classes/teams.php';
+ $Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+ $teamDetail = $Teams->getEntry($_SESSION[GLM_EVENT_SESSION]['Team']);
+ $this->page->teamName = $teamDetail['name'];
+ $this->page->teamID = $teamDetail['id'];
+ $this->page->haveTeam = true;
+} else {
+ $this->page->haveTeam = false;
+}
+
+// If we have what we need - Get the list of members with inventory for the event
+if ($this->page->haveEvent && $this->page->haveTeam) {
+
+ // Get properties that have inventory for this event
+ $sql = "
+ SELECT id, name
+ FROM eventmgt.member
+ WHERE id IN
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.inventory
+ WHERE event_code = '".$eventDetail['event_code']."'
+ )
+ ORDER BY name;
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $memberList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ $this->page->memberList = $this->bindArrayToObject($memberList);
+
+}
+
+// Get list of bookings for an event
+
+// Check for Booking Delete
+if (isset($_REQUEST['del'])) {
+ $del = ($_REQUEST['del'] - 0);
+ if ($del > 0) {
+ $sql = "DELETE
+ FROM eventmgt.team_property
+ WHERE id = $del
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ }
+}
+
+// Get bookings stats
+$bookingsStats = $Bookings->getBookingsStats();
+$this->page->bookingsStats = $this->bindArrayToObject($bookingsStats);
+
+// Get bookings list
+$bookings = $Bookings->getBookingsList();
+$this->page->bookingsList = $this->bindArrayToObject($bookings);
+
+$this->templateFile = 'Booking/BookingsList.html';
+
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Booking/detail.inc b/models/admin/actions/Booking/detail.inc
new file mode 100644
index 0000000..91c5b5d
--- /dev/null
+++ b/models/admin/actions/Booking/detail.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/bookings.php';
+$Bookings = new EventManagementAdminBookings($this->dbh, $this->config);
+
+
+$bookingDetail = $Bookings->getBookingDetail();
+$this->page->bookingDetail = $this->bindArrayToObject($bookingDetail);
+
+$this->templateFile = 'Booking/BookingDetail.html';
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Booking/insert.inc b/models/admin/actions/Booking/insert.inc
new file mode 100644
index 0000000..8ad281e
--- /dev/null
+++ b/models/admin/actions/Booking/insert.inc
@@ -0,0 +1,146 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/bookings.php';
+$Bookings = new EventManagementAdminBookings($this->dbh, $this->config);
+
+
+if ($_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ require '../classes/events.php';
+ $Events = new EventManagementAdminEvents($this->dbh, $this->config);
+ $eventDetail = $Events->getEntry($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $this->page->eventName = $eventDetail['name'];
+ $this->page->eventID = $eventDetail['id'];
+ $this->page->haveEvent = true;
+} else {
+ $this->page->haveEvent = false;
+}
+
+if ($_SESSION[GLM_EVENT_SESSION]['Team'] != false) {
+ require '../classes/teams.php';
+ $Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+ $teamDetail = $Teams->getEntry($_SESSION[GLM_EVENT_SESSION]['Team']);
+ $this->page->teamName = $teamDetail['name'];
+ $this->page->teamID = $teamDetail['id'];
+ $this->page->haveTeam = true;
+} else {
+ $this->page->haveTeam = false;
+}
+
+// If we have what we need - Get the list of members with inventory for the event
+if ($this->page->haveEvent && $this->page->haveTeam) {
+
+ // Get properties that have inventory for this event
+ $sql = "
+ SELECT id, name
+ FROM eventmgt.member
+ WHERE id IN
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.inventory
+ WHERE event_code = '".$eventDetail['event_code']."'
+ )
+ ORDER BY name;
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $memberList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ $this->page->memberList = $this->bindArrayToObject($memberList);
+
+}
+
+// Insert a booking
+
+$insertSuccess = true;
+
+// Check for good Event, Team, and property data, must be id numbers
+$eventID = ($_REQUEST['eventID'] - 0);
+$teamID = ($_REQUEST['teamID'] - 0);
+$propID = ($_REQUEST['propID'] - 0);
+
+if ($eventID == 0 || $teamID == 0 || $propID == 0) {
+ $insertSuccess = false;
+}
+// Check for good dates - Must between now and start of event
+$startDate = strtotime($_REQUEST['startDate']);
+$endDate = strtotime($_REQUEST['endDate']);
+
+if ($startDate < strtotime(date('m/d/Y'))) {
+ $this->page->startFail = true;
+ $insertSuccess = false;
+}
+
+if ($endDate > strtotime($eventDetail['start_date'])) {
+ $this->page->endFail = true;
+ $insertSuccess = false;
+}
+
+if ($startDate > $endDate) {
+ $this->page->datesFail = true;
+ $insertSuccess = false;
+}
+
+// If we're Ok to this point, then try to add this booking to the database
+if ($insertSuccess) {
+ $startDate = date('m/d/Y', $startDate);
+ $endDate = date('m/d/Y', $endDate);
+
+ $sql = "
+ INSERT INTO eventmgt.team_property
+ (team, property, event, start, stop)
+ VALUES
+ (
+ $teamID, $propID, $eventID, '$startDate', '$endDate'
+ );
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ // NEED TO TEST FOR SUCCESS HERE
+}
+
+
+// If it failed, then try again
+if ($insertSuccess == false) {
+ $this->page->addingNewBooking = true;
+ $this->templateFile = 'Booking/EditBooking.html';
+} else {
+
+ // Check for Booking Delete
+ if (isset($_REQUEST['del'])) {
+ $del = ($_REQUEST['del'] - 0);
+ if ($del > 0) {
+ $sql = "DELETE
+ FROM eventmgt.team_property
+ WHERE id = $del
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ }
+ }
+
+ // Get bookings stats
+ $bookingsStats = $Bookings->getBookingsStats();
+ $this->page->bookingsStats = $this->bindArrayToObject($bookingsStats);
+
+ // Get bookings list
+ $bookings = $Bookings->getBookingsList();
+ $this->page->bookingsList = $this->bindArrayToObject($bookings);
+
+ $this->templateFile = 'Booking/BookingsList.html';
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Booking/list.inc b/models/admin/actions/Booking/list.inc
new file mode 100644
index 0000000..8042df2
--- /dev/null
+++ b/models/admin/actions/Booking/list.inc
@@ -0,0 +1,43 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/bookings.php';
+$Bookings = new EventManagementAdminBookings($this->dbh, $this->config);
+
+
+// Check for Booking Delete
+if (isset($_REQUEST['del'])) {
+ $del = ($_REQUEST['del'] - 0);
+ if ($del > 0) {
+ $sql = "DELETE
+ FROM eventmgt.team_property
+ WHERE id = $del
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ }
+}
+
+// Get bookings stats
+$bookingsStats = $Bookings->getBookingsStats();
+$this->page->bookingsStats = $this->bindArrayToObject($bookingsStats);
+
+// Get bookings list
+$bookings = $Bookings->getBookingsList();
+$this->page->bookingsList = $this->bindArrayToObject($bookings);
+
+$this->templateFile = 'Booking/BookingsList.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Contact/add.inc b/models/admin/actions/Contact/add.inc
new file mode 100644
index 0000000..e11091a
--- /dev/null
+++ b/models/admin/actions/Contact/add.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+// Get base data and fields
+$r = $Contacts->newContact();
+
+$this->page->contactDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewContact = true;
+
+$this->templateFile = 'Contact/edit.html';
+
+$this->addDebug("Contact/add.inc", 'Contact Add', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Contact/confirmDelete.inc b/models/admin/actions/Contact/confirmDelete.inc
new file mode 100644
index 0000000..46eb6e4
--- /dev/null
+++ b/models/admin/actions/Contact/confirmDelete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+$contactDetail = $Contacts->contactDelete(true);
+$this->page->contactDetail = $this->bindArrayToObject($contactDetail);
+
+$this->templateFile = 'Contact/detail.html';
+
+$this->addDebug("Contact/confirmDelete.inc", 'Contact Confirm Delete', print_r($contactDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Contact/delete.inc b/models/admin/actions/Contact/delete.inc
new file mode 100644
index 0000000..442a862
--- /dev/null
+++ b/models/admin/actions/Contact/delete.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+$contactDetail = $Contacts->contactDelete(false);
+$this->page->contactDetail = $this->bindArrayToObject($contactDetail);
+
+$this->templateFile = 'Contact/delete.html';
+
+$this->addDebug("Contact/delete.inc", 'Contact Delete', print_r($contactDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Contact/detail.inc b/models/admin/actions/Contact/detail.inc
new file mode 100644
index 0000000..b736e4d
--- /dev/null
+++ b/models/admin/actions/Contact/detail.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+$contactDetail = $Contacts->getContactDetail();
+$this->page->contactDetail = $this->bindArrayToObject($contactDetail);
+
+$this->templateFile = 'Contact/detail.html';
+
+$this->addDebug("Contact/detail.inc", 'Contact Detail', print_r($contactDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Contact/edit.inc b/models/admin/actions/Contact/edit.inc
new file mode 100644
index 0000000..03d7252
--- /dev/null
+++ b/models/admin/actions/Contact/edit.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+$contactDetail = $Contacts->editContact();
+$this->page->contactDetail = $this->bindArrayToObject($contactDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($contactDetail);
+
+$this->page->editingContact = true;
+$this->templateFile = 'Contact/edit.html';
+
+$this->addDebug("Contact/edit.inc", 'Contact Edit', print_r($contactDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Contact/insert.inc b/models/admin/actions/Contact/insert.inc
new file mode 100644
index 0000000..799d8c2
--- /dev/null
+++ b/models/admin/actions/Contact/insert.inc
@@ -0,0 +1,40 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+// Process new record
+$r = $Contacts->insertContact();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->contactDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewContact = true;
+ $this->templateFile = 'Contact/edit.html';
+} else {
+ $this->templateFile = 'Contact/detail.html';
+}
+
+$this->addDebug("Contact/insert.inc", 'Contact Insert', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Contact/list.inc b/models/admin/actions/Contact/list.inc
new file mode 100644
index 0000000..2f97688
--- /dev/null
+++ b/models/admin/actions/Contact/list.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+// Get contacts stats
+$contactsStats = $Contacts->getContactsStats();
+$this->page->contactsStats = $this->bindArrayToObject($contactsStats);
+
+$contactList = $Contacts->getContacts();
+$this->page->contactList = $this->bindArrayToObject($contactList);
+
+$this->templateFile = 'Contact/list.html';
+
+$this->addDebug("Contact/list.inc", 'Contact List', print_r($contactList,1));
+
+?>
+
diff --git a/models/admin/actions/Contact/update.inc b/models/admin/actions/Contact/update.inc
new file mode 100644
index 0000000..ea7ec3f
--- /dev/null
+++ b/models/admin/actions/Contact/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Contacts->updateContact();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->contactDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingContact = true;
+ $this->templateFile = 'Contact/edit.html';
+} else {
+ // If valid
+ $this->templateFile = 'Contact/detail.html';
+}
+
+$this->addDebug("Contact/add.inc", 'Contact Add', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Debug/start.inc b/models/admin/actions/Debug/start.inc
new file mode 100644
index 0000000..d07c4fc
--- /dev/null
+++ b/models/admin/actions/Debug/start.inc
@@ -0,0 +1,19 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->page->debugStartupTime = date('m/d/Y H:i:s');
+$this->templateFile = 'Debug/index.html';
+
+?>
+
diff --git a/models/admin/actions/Debug/update.inc b/models/admin/actions/Debug/update.inc
new file mode 100644
index 0000000..6a7e9e6
--- /dev/null
+++ b/models/admin/actions/Debug/update.inc
@@ -0,0 +1,29 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->page->debugUpdateTime = date('m/d/Y H:i:s');
+
+// If there's nothing to send, then don't
+if (!file_exists(DEBUG_DATA_FILENAME)) {
+ exit;
+}
+
+// Otherwise, send the current debug data
+$this->page->debugData = file_get_contents(DEBUG_DATA_FILENAME);
+unlink(DEBUG_DATA_FILENAME);
+
+$this->templateFile = 'Debug/index.html';
+
+?>
+
diff --git a/models/admin/actions/Division/add.inc b/models/admin/actions/Division/add.inc
new file mode 100644
index 0000000..47f2f2d
--- /dev/null
+++ b/models/admin/actions/Division/add.inc
@@ -0,0 +1,28 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/divisions.php';
+$Divisions = new EventManagementAdminDivisions($this->dbh, $this->config);
+
+
+$r = $Divisions->newDivision();
+
+$this->page->divisionDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewDivision = true;
+
+$this->templateFile = 'Division/EditDivision.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Division/detail.inc b/models/admin/actions/Division/detail.inc
new file mode 100644
index 0000000..adfff7f
--- /dev/null
+++ b/models/admin/actions/Division/detail.inc
@@ -0,0 +1,24 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/divisions.php';
+$Divisions = new EventManagementAdminDivisions($this->dbh, $this->config);
+
+
+$divisionDetail = $Divisions->getDivisionDetail();
+$this->page->divisionDetail = $this->bindArrayToObject($divisionDetail);
+
+$this->templateFile = 'Division/DivisionDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Division/edit.inc b/models/admin/actions/Division/edit.inc
new file mode 100644
index 0000000..e0d9ee0
--- /dev/null
+++ b/models/admin/actions/Division/edit.inc
@@ -0,0 +1,29 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/divisions.php';
+$Divisions = new EventManagementAdminDivisions($this->dbh, $this->config);
+
+
+$divisionDetail = $Divisions->editDivision();
+$this->page->divisionDetail = $this->bindArrayToObject($divisionDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($divisionDetail);
+
+$this->page->editingDivision = true;
+
+$this->templateFile = 'Division/EditDivision.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Division/insert.inc b/models/admin/actions/Division/insert.inc
new file mode 100644
index 0000000..0e095a1
--- /dev/null
+++ b/models/admin/actions/Division/insert.inc
@@ -0,0 +1,38 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/divisions.php';
+$Divisions = new EventManagementAdminDivisions($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Divisions->insertDivision();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->divisionDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewDivision = true;
+ $this->templateFile = 'Division/EditDivision.html';
+} else {
+ $this->templateFile = 'Division/DivisionDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Division/list.inc b/models/admin/actions/Division/list.inc
new file mode 100644
index 0000000..69d4558
--- /dev/null
+++ b/models/admin/actions/Division/list.inc
@@ -0,0 +1,29 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/divisions.php';
+$Divisions = new EventManagementAdminDivisions($this->dbh, $this->config);
+
+
+// Get divisions stats
+$divisionsStats = $Divisions->getDivisionsStats();
+$this->page->divisionsStats = $this->bindArrayToObject($divisionsStats);
+
+// Get divisions list
+$divisions = $Divisions->getDivisionsList();
+$this->page->divisionsList = $this->bindArrayToObject($divisions);
+
+$this->templateFile = 'Division/DivisionsList.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Division/update.inc b/models/admin/actions/Division/update.inc
new file mode 100644
index 0000000..2b60b25
--- /dev/null
+++ b/models/admin/actions/Division/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/divisions.php';
+$Divisions = new EventManagementAdminDivisions($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Divisions->updateDivision();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->divisionDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$divisionDetail = $Divisions->getDivisionDetail();
+$this->page->storedDetail = $this->bindArrayToObject($divisionDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingDivision = true;
+ $this->templateFile = 'Division/EditDivision.html';
+} else {
+ $this->templateFile = 'Division/DivisionDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Entrance/add.inc b/models/admin/actions/Entrance/add.inc
new file mode 100644
index 0000000..2e9f2aa
--- /dev/null
+++ b/models/admin/actions/Entrance/add.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: add.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+// Get base data and fields
+$r = $Entrances->newEntrance();
+
+$this->page->entranceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewEntrance = true;
+
+$this->templateFile = 'Entrance/edit.html';
+
+$this->addDebug("Entrance/add.inc", 'Entrance Add', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Entrance/confirmDelete.inc b/models/admin/actions/Entrance/confirmDelete.inc
new file mode 100644
index 0000000..0d03d4a
--- /dev/null
+++ b/models/admin/actions/Entrance/confirmDelete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+$entranceDetail = $Entrances->entranceDelete(true);
+$this->page->entranceDetail = $this->bindArrayToObject($entranceDetail);
+
+$this->templateFile = 'Entrance/detail.html';
+
+$this->addDebug("Entrance/confirmDelete.inc", 'Entrance Confirm Delete', print_r($entranceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Entrance/delete.inc b/models/admin/actions/Entrance/delete.inc
new file mode 100644
index 0000000..6855bcc
--- /dev/null
+++ b/models/admin/actions/Entrance/delete.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: entrance.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+
+$entranceDetail = $Entrances->entranceDelete(false);
+$this->page->entranceDetail = $this->bindArrayToObject($entranceDetail);
+
+$this->templateFile = 'Entrance/delete.html';
+
+$this->addDebug("Entrance/delete.inc", 'Entrance Delete', print_r($entranceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Entrance/detail.inc b/models/admin/actions/Entrance/detail.inc
new file mode 100644
index 0000000..bbba59b
--- /dev/null
+++ b/models/admin/actions/Entrance/detail.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+$entranceDetail = $Entrances->getEntranceDetail();
+$this->page->entranceDetail = $this->bindArrayToObject($entranceDetail);
+
+$this->templateFile = 'Entrance/detail.html';
+
+$this->addDebug("Entrance/detail.inc", 'Entrance Detail', print_r($entranceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Entrance/edit.inc b/models/admin/actions/Entrance/edit.inc
new file mode 100644
index 0000000..c469fc9
--- /dev/null
+++ b/models/admin/actions/Entrance/edit.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+$entranceDetail = $Entrances->editEntrance();
+$this->page->entranceDetail = $this->bindArrayToObject($entranceDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($entranceDetail);
+
+$this->page->editingEntrance = true;
+$this->templateFile = 'Entrance/edit.html';
+
+$this->addDebug("Entrance/edit.inc", 'Entrance Edit', print_r($entranceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Entrance/insert.inc b/models/admin/actions/Entrance/insert.inc
new file mode 100644
index 0000000..e924552
--- /dev/null
+++ b/models/admin/actions/Entrance/insert.inc
@@ -0,0 +1,40 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+// Process new record
+$r = $Entrances->insertEntrance();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->entranceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewEntrance = true;
+ $this->templateFile = 'Entrance/edit.html';
+} else {
+ $this->templateFile = 'Entrance/detail.html';
+}
+
+$this->addDebug("Entrance/insert.inc", 'Entrance Insert', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Entrance/list.inc b/models/admin/actions/Entrance/list.inc
new file mode 100644
index 0000000..80d9e0f
--- /dev/null
+++ b/models/admin/actions/Entrance/list.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+$entranceList = $Entrances->getEntrancesList();
+
+$this->page->entranceList = $this->bindArrayToObject($entranceList);
+
+$this->templateFile = 'Entrance/list.html';
+
+$this->addDebug("Entrance/list.inc", 'Entrance List', 'Array: $entranceList
'.print_r($entranceList,1));
+
+?>
+
diff --git a/models/admin/actions/Entrance/update.inc b/models/admin/actions/Entrance/update.inc
new file mode 100644
index 0000000..a02a0ed
--- /dev/null
+++ b/models/admin/actions/Entrance/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+$Entrances = new EventManagementAdminEntrances($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Entrances->updateEntrance();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->entranceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingEntrance = true;
+ $this->templateFile = 'Entrance/edit.html';
+} else {
+ // If valid
+ $this->templateFile = 'Entrance/detail.html';
+}
+
+$this->addDebug("Entrance/add.inc", 'Entrance Add', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Event/add.inc b/models/admin/actions/Event/add.inc
new file mode 100644
index 0000000..01cba62
--- /dev/null
+++ b/models/admin/actions/Event/add.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/events.php';
+$Events = new EventManagementAdminEvents($this->dbh, $this->config);
+
+
+// Check Event Code
+$r = $Events->newEntry();
+
+$this->page->eventDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewEvent = true;
+
+$this->templateFile = 'Event/EditEvent.html';
+
+?>
+
diff --git a/models/admin/actions/Event/detail.inc b/models/admin/actions/Event/detail.inc
new file mode 100644
index 0000000..f07d78e
--- /dev/null
+++ b/models/admin/actions/Event/detail.inc
@@ -0,0 +1,32 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/events.php';
+$Events = new EventManagementAdminEvents($this->dbh, $this->config);
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Get detail for an event
+$eventDetail = $Events->getEventDetail();
+$this->page->eventDetail = $this->bindArrayToObject($eventDetail);
+
+// Get contacts for this event
+$eventContacts = $Contacts->getContacts('event');
+$this->page->contactsList = $this->bindArrayToObject($eventContacts['contact_list']);
+
+$this->templateFile = 'Event/EventDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Event/edit.inc b/models/admin/actions/Event/edit.inc
new file mode 100644
index 0000000..825bce9
--- /dev/null
+++ b/models/admin/actions/Event/edit.inc
@@ -0,0 +1,32 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/events.php';
+$Events = new EventManagementAdminEvents($this->dbh, $this->config);
+
+
+// Check Event Code
+$eventDetail = $Events->editEvent();
+$this->page->eventDetail = $this->bindArrayToObject($eventDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($eventDetail);
+
+$this->page->editingEvent = true;
+
+$this->templateFile = 'Event/EditEvent.html';
+
+
+?>
+
diff --git a/models/admin/actions/Event/insert.inc b/models/admin/actions/Event/insert.inc
new file mode 100644
index 0000000..a2b04b4
--- /dev/null
+++ b/models/admin/actions/Event/insert.inc
@@ -0,0 +1,39 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/events.php';
+$Events = new EventManagementAdminEvents($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Events->insertEvent();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->eventDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewEvent = true;
+ $this->templateFile = 'Event/EditEvent.html';
+} else {
+ $this->templateFile = 'Event/EventDetail.html';
+}
+
+?>
+
diff --git a/models/admin/actions/Event/list.inc b/models/admin/actions/Event/list.inc
new file mode 100644
index 0000000..c392da9
--- /dev/null
+++ b/models/admin/actions/Event/list.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/events.php';
+$Events = new EventManagementAdminEvents($this->dbh, $this->config);
+
+
+// Get events stats
+$eventsStats = $Events->getEventsStats();
+$this->page->eventsStats = $this->bindArrayToObject($eventsStats);
+
+// Get list of events
+$eventsList = $Events->getEventsList();
+$this->page->eventsList = $this->bindArrayToObject($eventsList);
+
+$this->templateFile = 'Event/EventsList.html';
+
+?>
+
diff --git a/models/admin/actions/Event/stats.inc b/models/admin/actions/Event/stats.inc
new file mode 100644
index 0000000..a58cf42
--- /dev/null
+++ b/models/admin/actions/Event/stats.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/events.php';
+$Events = new EventManagementAdminEvents($this->dbh, $this->config);
+
+
+// Get events stats
+$eventsStats = $Events->getEventsStats();
+$this->page->eventsStats = $this->bindArrayToObject($eventsStats);
+
+$this->templateFile = 'Event/stats.html';
+
+?>
+
diff --git a/models/admin/actions/Event/update.inc b/models/admin/actions/Event/update.inc
new file mode 100644
index 0000000..8cf0cc5
--- /dev/null
+++ b/models/admin/actions/Event/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/events.php';
+$Events = new EventManagementAdminEvents($this->dbh, $this->config);
+
+// Process new record
+$r = $Events->updateEvent();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->eventDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$eventDetail = $Events->getEventDetail();
+$this->page->storedDetail = $this->bindArrayToObject($eventDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingEvent = true;
+ $this->templateFile = 'Event/EditEvent.html';
+} else {
+ $this->templateFile = 'Event/EventDetail.html';
+}
+
+?>
+
diff --git a/models/admin/actions/EventFee/add.inc b/models/admin/actions/EventFee/add.inc
new file mode 100644
index 0000000..9d1a4ed
--- /dev/null
+++ b/models/admin/actions/EventFee/add.inc
@@ -0,0 +1,28 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+$r = $EventFees->newFee();
+
+$this->page->feeDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewFee = true;
+
+$this->templateFile = 'EventFee/EditEventFee.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/EventFee/confirmDelete.inc b/models/admin/actions/EventFee/confirmDelete.inc
new file mode 100644
index 0000000..5920e41
--- /dev/null
+++ b/models/admin/actions/EventFee/confirmDelete.inc
@@ -0,0 +1,24 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+$feeDetail = $EventFees->feeDelete(true);
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+$this->templateFile = 'EventFee/EventFeeDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/EventFee/delete.inc b/models/admin/actions/EventFee/delete.inc
new file mode 100644
index 0000000..64198a0
--- /dev/null
+++ b/models/admin/actions/EventFee/delete.inc
@@ -0,0 +1,24 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+$feeDetail = $EventFees->feeDelete(false);
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+$this->templateFile = 'EventFee/EventFeeDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/EventFee/detail.inc b/models/admin/actions/EventFee/detail.inc
new file mode 100644
index 0000000..49482e8
--- /dev/null
+++ b/models/admin/actions/EventFee/detail.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+$feeDetail = $EventFees->getFeeDetail();
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+$this->templateFile = 'EventFee/EventFeeDetail.html';
+
+$this->addDebug("EventFee/detail.inc", 'Fee Detail', print_r($feeDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/EventFee/edit.inc b/models/admin/actions/EventFee/edit.inc
new file mode 100644
index 0000000..67d64dc
--- /dev/null
+++ b/models/admin/actions/EventFee/edit.inc
@@ -0,0 +1,32 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+// Check Event Fee Code
+$feeDetail = $EventFees->editFee();
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($feeDetail);
+
+$this->page->editingFee = true;
+
+$this->templateFile = 'EventFee/EditEventFee.html';
+
+$this->addDebug("EventFee/edit.inc", 'Fee Detail', print_r($feeDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/EventFee/insert.inc b/models/admin/actions/EventFee/insert.inc
new file mode 100644
index 0000000..a139b0e
--- /dev/null
+++ b/models/admin/actions/EventFee/insert.inc
@@ -0,0 +1,38 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+// Process new record
+$r = $EventFees->insertFee();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->feeDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewFee = true;
+ $this->templateFile = 'EventFee/EditEventFee.html';
+} else {
+ $this->templateFile = 'EventFee/EventFeeDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/EventFee/list.inc b/models/admin/actions/EventFee/list.inc
new file mode 100644
index 0000000..486e2ef
--- /dev/null
+++ b/models/admin/actions/EventFee/list.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+// Get event fees stats
+$feesStats = $EventFees->getEventFeesStats();
+$this->page->feesStats = $this->bindArrayToObject($feesStats);
+
+// Get Event Fees list
+$feesList = $EventFees->getFees('event');
+$this->page->feesList = $this->bindArrayToObject($feesList);
+
+$this->templateFile = 'EventFee/EventFeesList.html';
+
+$this->addDebug("EventFee/list.inc", 'Event Fees List', print_r($feesStats,1).'
'.print_r(feesList,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/EventFee/update.inc b/models/admin/actions/EventFee/update.inc
new file mode 100644
index 0000000..1a23a37
--- /dev/null
+++ b/models/admin/actions/EventFee/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: eventFee.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/eventFees.php';
+$EventFees = new EventManagementAdminEventFees($this->dbh, $this->config);
+
+
+// Process new record
+$r = $EventFees->updateFee();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->feeDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$feeDetail = $EventFees->getFeeDetail();
+$this->page->storedDetail = $this->bindArrayToObject($feeDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingFee = true;
+ $this->templateFile = 'EventFee/EditEventFee.html';
+} else {
+ $this->templateFile = 'EventFee/EventFeeDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Help/index.inc b/models/admin/actions/Help/index.inc
new file mode 100644
index 0000000..43f2fd1
--- /dev/null
+++ b/models/admin/actions/Help/index.inc
@@ -0,0 +1,18 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: index.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->templateFile = "Help/index.html";
+
+?>
+
diff --git a/models/admin/actions/Index/index.inc b/models/admin/actions/Index/index.inc
new file mode 100644
index 0000000..09d2f62
--- /dev/null
+++ b/models/admin/actions/Index/index.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Reset Session
+$this->startSession(true);
+
+// If user level is 20 or above, then start with ticket claims loaded.
+$this->page->startWithClaims = 0;
+if ($this->page->level >= 20) {
+ $this->page->startWithClaims = 1;
+}
+
+$this->templateFile = "index.html";
+
+?>
+
diff --git a/models/admin/actions/Index/welcome.inc b/models/admin/actions/Index/welcome.inc
new file mode 100644
index 0000000..b99344b
--- /dev/null
+++ b/models/admin/actions/Index/welcome.inc
@@ -0,0 +1,18 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->templateFile = "Welcome/index.html";
+
+?>
+
diff --git a/models/admin/actions/Member/add.inc b/models/admin/actions/Member/add.inc
new file mode 100644
index 0000000..fc3e1bc
--- /dev/null
+++ b/models/admin/actions/Member/add.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+// Check Member Code
+$r = $Members->newEntry();
+
+$this->page->memberDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewMember = true;
+
+$this->templateFile = 'Member/edit.html';
+
+$this->addDebug("Member/add.inc", 'Member Add', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/confirmDelete.inc b/models/admin/actions/Member/confirmDelete.inc
new file mode 100644
index 0000000..5ac4dbf
--- /dev/null
+++ b/models/admin/actions/Member/confirmDelete.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+$memberDetail = $Members->memberDelete(true);
+$this->page->memberDetail = $this->bindArrayToObject($memberDetail);
+
+$this->page->memberDeleted = true;
+
+$this->templateFile = 'Member/detail.html';
+
+$this->addDebug("Member/delete.inc", 'Member Delete', print_r($memberDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/delete.inc b/models/admin/actions/Member/delete.inc
new file mode 100644
index 0000000..a68027b
--- /dev/null
+++ b/models/admin/actions/Member/delete.inc
@@ -0,0 +1,32 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+// Check Member Code
+$memberDetail = $Members->getMemberDetail();
+
+$this->page->memberDetail = $this->bindArrayToObject($memberDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($memberDetail);
+
+$this->page->editingMember = true;
+
+$this->templateFile = 'Member/delete.html';
+
+$this->addDebug("Member/delete.inc", 'Member Delete', print_r($memberDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/detail.inc b/models/admin/actions/Member/detail.inc
new file mode 100644
index 0000000..ab9dcd6
--- /dev/null
+++ b/models/admin/actions/Member/detail.inc
@@ -0,0 +1,48 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+$memberDetail = $Members->getMemberDetail();
+$memberID = $memberDetail['id'];
+
+// Also get list of members this member scans for
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMemberScansFor.php';
+$MemberScansFor = new EventManagementDataMemberScansFor($this->dbh, $this->config);
+$memberScansFor = $MemberScansFor->getMemberScansForList($memberID);
+if (is_array($memberScansFor) && count($memberScansFor) > 0) {
+ $this->page->haveMemberScansFor = true;
+ $this->page->memberScansFor = $this->bindArrayToObject($memberScansFor);
+} else {
+ $this->page->haveMemberScansFor = false;
+}
+
+if ($memberDetail != false) {
+ // Also need to add static amenity names
+ $amen_array = $this->config->memb_amen->toArray();
+ while( list($key, $val) = each( $amen_array ) ) {
+ $memberDetail['amen_'.$key]['displayName'] = $val;
+ }
+
+ $this->page->memberDetail = $this->bindArrayToObject($memberDetail);
+} else {
+ $this->page->memberNotFound = true;
+}
+
+$this->templateFile = 'Member/detail.html';
+
+$this->addDebug("Member/detail.inc", 'Members Detail', print_r($memberDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/edit.inc b/models/admin/actions/Member/edit.inc
new file mode 100644
index 0000000..0b6cbc8
--- /dev/null
+++ b/models/admin/actions/Member/edit.inc
@@ -0,0 +1,59 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+/*
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+$Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$memberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+*/
+
+// Check Member Code
+$memberDetail = $Members->editMember();
+$memberID = $memberDetail['id'];
+
+// Also need to add static amenity names
+$amen_array = $this->config->memb_amen->toArray();
+while( list($key, $val) = each( $amen_array ) ) {
+ $memberDetail['amen_'.$key]['displayName'] = $val;
+}
+$this->page->memberDetail = $this->bindArrayToObject($memberDetail);
+
+// Also get list of members this member scans for
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMemberScansFor.php';
+$MemberScansFor = new EventManagementDataMemberScansFor($this->dbh, $this->config);
+$memberScansFor = $MemberScansFor->getMemberScansForList($memberID);
+$this->page->memberScansFor = $this->bindArrayToObject($memberScansFor);
+
+// And get full list of members (except this member) to use for Member Scans For select list
+$sql = "SELECT id, name FROM eventmgt.member WHERE active AND id != $memberID;";
+$stmt = $this->dbh->prepare($sql);
+$stmt->execute();
+$memberList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+$this->page->memberList = $this->bindArrayToObject($memberList);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+//$this->page->storedDetail = $this->bindArrayToObject($memberDetail);
+
+$this->page->editingMember = true;
+
+$this->templateFile = 'Member/edit.html';
+
+$this->addDebug("Member/edit.inc", 'Array: $memberDetail', print_r($memberDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/index.inc b/models/admin/actions/Member/index.inc
new file mode 100644
index 0000000..08cc7b4
--- /dev/null
+++ b/models/admin/actions/Member/index.inc
@@ -0,0 +1,17 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->templateFile = 'Member/index.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/insert.inc b/models/admin/actions/Member/insert.inc
new file mode 100644
index 0000000..db28550
--- /dev/null
+++ b/models/admin/actions/Member/insert.inc
@@ -0,0 +1,41 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+// Process new record
+$r = $Members->insertMember();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->memberDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+$_SESSION[GLM_EVENT_SESSION]['Member'] = $r['fieldData']['id'];
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewMember = true;
+ $this->templateFile = 'Member/edit.html';
+} else {
+ $this->templateFile = 'Member/selected.html';
+}
+
+$this->addDebug("Member/insert.inc", 'Members Insert', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/list.inc b/models/admin/actions/Member/list.inc
new file mode 100644
index 0000000..9f5370a
--- /dev/null
+++ b/models/admin/actions/Member/list.inc
@@ -0,0 +1,35 @@
+
+
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+// Get members list
+$members = $Members->getMembersList('all');
+
+$this->page->membersList = $this->bindArrayToObject($members);
+
+// Check if we also need to display a member detail (list redisplay on member update).
+$this->page->displayMember = false;
+if (isset($_REQUEST['memberID']) && ($_REQUEST['memberID']-0) > 0) {
+ $this->page->displayMember = ($_REQUEST['memberID']-0);
+}
+
+$this->templateFile = 'Member/list.html';
+
+$this->addDebug("Member/list.inc", 'Member List', print_r($members,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/selected.inc b/models/admin/actions/Member/selected.inc
new file mode 100644
index 0000000..0fc654a
--- /dev/null
+++ b/models/admin/actions/Member/selected.inc
@@ -0,0 +1,100 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+$memberDetail = $Members->getMemberDetail();
+
+// Also need to add static amenity names
+$amen_array = $this->config->memb_amen->toArray();
+while( list($key, $val) = each( $amen_array ) ) {
+ $memberDetail['amen_'.$key]['displayName'] = $val;
+}
+$this->page->memberDetail = $this->bindArrayToObject($memberDetail);
+
+$_SESSION[GLM_EVENT_SESSION]['Member'] = $memberDetail['id'];
+
+// Get other stats and clear all flags
+$memberStats = array(
+ 'contact' => $Contacts->getMemberContactsStats(),
+ 'flags' => false,
+ 'flag' => false
+);
+
+// Check contact status
+if ($memberStats['contact'] == 0) {
+ $memberStats['flags']['noContacts'] = true;
+ $memberStats['flag'] = true;
+}
+
+// Check accommodation status
+if ($this->config->option->accommodations) {
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/accommodations.php';
+ $Accoms = new EventManagementAdminAccoms($this->dbh, $this->config);
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/inventory.php';
+ $Inventory = new EventManagementAdminInventory($this->dbh, $this->config);
+
+ $memberStats['accom'] = $Accoms->getMemberAccomsStats();
+ $memberStats['inven'] = $Inventory->getMemberInvenStats();
+ if ($memberStats['accom'] == 0) {
+ $memberStats['flags']['noAccoms'] = true;
+ $memberStats['flag'] = true;
+ }
+ if ($memberStats['inven'] == 0) {
+ $memberStats['flags']['noInven'] = true;
+ $memberStats['flag'] = true;
+ }
+};
+
+// Check ticket status
+if ($this->config->option->tickets) {
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sections.php';
+ $Sections = new EventManagementAdminSections($this->dbh, $this->config);
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+ $Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+ $Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+ $memberStats['section'] = $Sections->getMemberSectionsStats();
+ $memberStats['performance'] = $Performances->getMemberPerformancesStats();
+ $memberStats['ticket'] = $Tickets->getMemberTicketsStats();
+
+ if ($memberStats['section'] == 0) {
+ $memberStats['flags']['noSections'] = true;
+ $memberStats['flag'] = true;
+ }
+ if ($memberStats['performance'] == 0) {
+ $memberStats['flags']['noPerformances'] = true;
+ $memberStats['flag'] = true;
+ }
+ if ($memberStats['ticket'] == 0) {
+ $memberStats['flags']['noTickets'] = true;
+ $memberStats['flag'] = true;
+ }
+
+}
+
+$this->page->memberStats = $this->bindArrayToObject($memberStats);
+
+$this->templateFile = 'Member/selected.html';
+
+$this->addDebug("Member/selected.inc", 'Member Detail', print_r($memberDetail,1));
+$this->addDebug("Member/selected.inc", 'Member Stats', print_r($memberStats,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/stats.inc b/models/admin/actions/Member/stats.inc
new file mode 100644
index 0000000..62f0d13
--- /dev/null
+++ b/models/admin/actions/Member/stats.inc
@@ -0,0 +1,32 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+// Check for new mebers whenever we get here - only called if integrated database
+if ($this->config->option->member_db_integrated) {
+ $Members->checkNewMembers();
+}
+
+// Get members stats
+$membersStats = $Members->getMembersStats();
+
+$this->page->membersStats = $this->bindArrayToObject($membersStats);
+
+$this->templateFile = 'Member/stats.html';
+
+$this->addDebug("Member/stats.inc", 'Array: $memberStats', print_r($membersStats,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Member/update.inc b/models/admin/actions/Member/update.inc
new file mode 100644
index 0000000..67b77f8
--- /dev/null
+++ b/models/admin/actions/Member/update.inc
@@ -0,0 +1,56 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+
+// Process new record
+$r = $Members->updateMember();
+
+// Also need to add static amenity names
+$amen_array = $this->config->memb_amen->toArray();
+while( list($key, $val) = each( $amen_array ) ) {
+ $r['fieldData']['amen_'.$key]['displayName'] = $val;
+}
+
+// Also update list of members this member scans for
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMemberScansFor.php';
+$MemberScansFor = new EventManagementDataMemberScansFor($this->dbh, $this->config);
+$memberScansFor = $MemberScansFor->updateMemberScansForList($r['fieldData']['id']);
+$this->page->memberScansFor = $this->bindArrayToObject($memberScansFor);
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->memberDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$memberDetail = $Members->getMemberDetail();
+$this->page->storedDetail = $this->bindArrayToObject($memberDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingMember = true;
+ $this->templateFile = 'Member/edit.html';
+} else {
+ // $this->templateFile = 'Member/detail.html';
+ $this->templateFile = 'Member/redisplayList.html';
+}
+
+$this->addDebug("Member/update.inc", 'Member Update', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberAmenities/add.inc b/models/admin/actions/MemberAmenities/add.inc
new file mode 100644
index 0000000..01fcd3d
--- /dev/null
+++ b/models/admin/actions/MemberAmenities/add.inc
@@ -0,0 +1,28 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberAmenities.php';
+$MemberAmenities = new EventManagementAdminMemberAmenities($this->dbh, $this->config);
+
+
+$r = $MemberAmenities->newAmenity();
+
+$this->page->amenityDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewAmenity = true;
+
+$this->templateFile = 'Amenity/EditMemberAmenity.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberAmenities/detail.inc b/models/admin/actions/MemberAmenities/detail.inc
new file mode 100644
index 0000000..0b23262
--- /dev/null
+++ b/models/admin/actions/MemberAmenities/detail.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberAmenities.php';
+$MemberAmenities = new EventManagementAdminMemberAmenities($this->dbh, $this->config);
+
+
+$amenityDetail = $MemberAmenities->getAmenityDetail();
+
+$this->page->amenityDetail = $this->bindArrayToObject($amenityDetail);
+
+$this->templateFile = 'Amenity/MemberAmenityDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberAmenities/edit.inc b/models/admin/actions/MemberAmenities/edit.inc
new file mode 100644
index 0000000..1234c8b
--- /dev/null
+++ b/models/admin/actions/MemberAmenities/edit.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberAmenities.php';
+$MemberAmenities = new EventManagementAdminMemberAmenities($this->dbh, $this->config);
+
+
+// Check Member Amenity Code
+$amenityDetail = $MemberAmenities->editAmenity();
+$this->page->amenityDetail = $this->bindArrayToObject($amenityDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($memberAmenityDetail);
+
+$this->page->editingAmenity = true;
+
+$this->templateFile = 'Amenity/EditMemberAmenity.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberAmenities/insert.inc b/models/admin/actions/MemberAmenities/insert.inc
new file mode 100644
index 0000000..23d21fa
--- /dev/null
+++ b/models/admin/actions/MemberAmenities/insert.inc
@@ -0,0 +1,38 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberAmenities.php';
+$MemberAmenities = new EventManagementAdminMemberAmenities($this->dbh, $this->config);
+
+
+// Process new record
+$r = $MemberAmenities->insertAmenity();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->amenityDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewAmenity = true;
+ $this->templateFile = 'Amenity/EditMemberAmenity.html';
+} else {
+ $this->templateFile = 'Amenity/MemberAmenityDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberAmenities/list.inc b/models/admin/actions/MemberAmenities/list.inc
new file mode 100644
index 0000000..9c80b1c
--- /dev/null
+++ b/models/admin/actions/MemberAmenities/list.inc
@@ -0,0 +1,29 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberAmenities.php';
+$MemberAmenities = new EventManagementAdminMemberAmenities($this->dbh, $this->config);
+
+
+// Get member amenities stats
+$amenitiesStats = $MemberAmenities->getMemberAmenitiesStats();
+$this->page->amenitiesStats = $this->bindArrayToObject($amenitiesStats);
+
+// Get Member Amenities list
+$amenitiesList = $MemberAmenities->getAmenities('member');
+$this->page->amenitiesList = $this->bindArrayToObject($amenitiesList);
+
+$this->templateFile = 'Amenity/MemberAmenitiesList.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberAmenities/update.inc b/models/admin/actions/MemberAmenities/update.inc
new file mode 100644
index 0000000..20d7e04
--- /dev/null
+++ b/models/admin/actions/MemberAmenities/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberAmenities.php';
+$MemberAmenities = new EventManagementAdminMemberAmenities($this->dbh, $this->config);
+
+
+// Process new record
+$r = $MemberAmenities->updateAmenity();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->amenityDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$amenityDetail = $MemberAmenities->getAmenityDetail();
+$this->page->storedDetail = $this->bindArrayToObject($amenityDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingAmenity = true;
+ $this->templateFile = 'Amenity/EditMemberAmenity.html';
+} else {
+ $this->templateFile = 'Amenity/MemberAmenityDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/add.inc b/models/admin/actions/MemberFee/add.inc
new file mode 100644
index 0000000..16a9387
--- /dev/null
+++ b/models/admin/actions/MemberFee/add.inc
@@ -0,0 +1,34 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+$r = $MemberFees->newFee();
+
+// check for selected event to use for default for specific event
+$e = $_SESSION[GLM_EVENT_SESSION]['Event'];
+if ($e && isset($r['fieldData']['event']['pick_list'][$e])) {
+ $r['fieldData']['event']['pick_list'][$e]['default'] = true;
+}
+
+$this->page->feeDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewFee = true;
+
+$this->templateFile = 'MemberFee/EditMemberFee.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/confirmDelete.inc b/models/admin/actions/MemberFee/confirmDelete.inc
new file mode 100644
index 0000000..18122a4
--- /dev/null
+++ b/models/admin/actions/MemberFee/confirmDelete.inc
@@ -0,0 +1,24 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+$feeDetail = $MemberFees->feeDelete(true);
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+$this->templateFile = 'MemberFee/MemberFeeDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/delete.inc b/models/admin/actions/MemberFee/delete.inc
new file mode 100644
index 0000000..bf2f2b4
--- /dev/null
+++ b/models/admin/actions/MemberFee/delete.inc
@@ -0,0 +1,24 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+$feeDetail = $MemberFees->feeDelete(false);
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+$this->templateFile = 'MemberFee/MemberFeeDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/detail.inc b/models/admin/actions/MemberFee/detail.inc
new file mode 100644
index 0000000..5c3b4b6
--- /dev/null
+++ b/models/admin/actions/MemberFee/detail.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+$feeDetail = $MemberFees->getFeeDetail();
+
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+$this->templateFile = 'MemberFee/MemberFeeDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/edit.inc b/models/admin/actions/MemberFee/edit.inc
new file mode 100644
index 0000000..ebe2a40
--- /dev/null
+++ b/models/admin/actions/MemberFee/edit.inc
@@ -0,0 +1,37 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+// Check Member Fee Code
+$feeDetail = $MemberFees->editFee();
+
+// check for selected event to use for default for specific event
+$e = $_SESSION[GLM_EVENT_SESSION]['Event'];
+if ($e && isset($feeDetail['fieldData']['event']['pick_list'][$e])) {
+ $feeDetail['fieldData']['event']['pick_list'][$e]['default'] = true;
+}
+
+$this->page->feeDetail = $this->bindArrayToObject($feeDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($memberFeeDetail);
+
+$this->page->editingFee = true;
+
+$this->templateFile = 'MemberFee/EditMemberFee.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/insert.inc b/models/admin/actions/MemberFee/insert.inc
new file mode 100644
index 0000000..486164d
--- /dev/null
+++ b/models/admin/actions/MemberFee/insert.inc
@@ -0,0 +1,38 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+// Process new record
+$r = $MemberFees->insertFee();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->feeDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewFee = true;
+ $this->templateFile = 'MemberFee/EditMemberFee.html';
+} else {
+ $this->templateFile = 'MemberFee/MemberFeeDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/list.inc b/models/admin/actions/MemberFee/list.inc
new file mode 100644
index 0000000..e8d70a4
--- /dev/null
+++ b/models/admin/actions/MemberFee/list.inc
@@ -0,0 +1,29 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+// Get member fees stats
+$feesStats = $MemberFees->getMemberFeesStats();
+$this->page->feesStats = $this->bindArrayToObject($feesStats);
+
+// Get Member Fees list
+$feesList = $MemberFees->getFees('member');
+$this->page->feesList = $this->bindArrayToObject($feesList);
+
+$this->templateFile = 'MemberFee/MemberFeesList.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/MemberFee/update.inc b/models/admin/actions/MemberFee/update.inc
new file mode 100644
index 0000000..426266b
--- /dev/null
+++ b/models/admin/actions/MemberFee/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/memberFees.php';
+$MemberFees = new EventManagementAdminMemberFees($this->dbh, $this->config);
+
+
+// Process new record
+$r = $MemberFees->updateFee();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->feeDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$feeDetail = $MemberFees->getFeeDetail();
+$this->page->storedDetail = $this->bindArrayToObject($feeDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingFee = true;
+ $this->templateFile = 'MemberFee/EditMemberFee.html';
+} else {
+ $this->templateFile = 'MemberFee/MemberFeeDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Misc/blank.inc b/models/admin/actions/Misc/blank.inc
new file mode 100644
index 0000000..7c58511
--- /dev/null
+++ b/models/admin/actions/Misc/blank.inc
@@ -0,0 +1,18 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: index.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->templateFile = 'Misc/blank.html';
+
+
+?>
diff --git a/models/admin/actions/Misc/configDetail.inc b/models/admin/actions/Misc/configDetail.inc
new file mode 100644
index 0000000..e1df266
--- /dev/null
+++ b/models/admin/actions/Misc/configDetail.inc
@@ -0,0 +1,28 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+$Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+
+$miscConfigDetail = $Misc->getEntry(1);
+
+$miscConfigDetail['no_payment_reasons'] = nl2br($miscConfigDetail['no_payment_reasons']);
+
+$this->page->miscConfigDetail = $this->bindArrayToObject($miscConfigDetail);
+
+$this->templateFile = 'Misc/configDetail.html';
+
+$this->addDebug("Misc/configDetail.inc", 'Misc Config Detail', print_r($miscConfigDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Misc/configEdit.inc b/models/admin/actions/Misc/configEdit.inc
new file mode 100644
index 0000000..e296159
--- /dev/null
+++ b/models/admin/actions/Misc/configEdit.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: configEdit.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+$Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+
+$miscConfigDetail = $Misc->editEntry(1);
+
+$this->page->miscConfigDetail = $this->bindArrayToObject($miscConfigDetail);
+$this->templateFile = 'Misc/configEdit.html';
+
+$this->addDebug("Misc/configEdit.inc", 'Array: $miscConfigDetail', print_r($miscConfigDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Misc/configUpdate.inc b/models/admin/actions/Misc/configUpdate.inc
new file mode 100644
index 0000000..aaf7480
--- /dev/null
+++ b/models/admin/actions/Misc/configUpdate.inc
@@ -0,0 +1,40 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: configUpdate.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+$Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+
+// Process new record
+$r = $Misc->updateEntry(1);
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+// If invalid submission
+if (!$status) {
+ $this->templateFile = 'Misc/configEdit.html';
+} else {
+
+ $r['fieldData']['no_payment_reasons'] = nl2br($r['fieldData']['no_payment_reasons']);
+ $this->templateFile = 'Misc/configDetail.html';
+}
+
+$this->page->miscConfigDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+$this->addDebug("Misc/configUpdate.inc", 'Misc Config Detail', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Misc/index.inc b/models/admin/actions/Misc/index.inc
new file mode 100644
index 0000000..9f62687
--- /dev/null
+++ b/models/admin/actions/Misc/index.inc
@@ -0,0 +1,18 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: index.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->templateFile = 'Misc/index.html';
+
+
+?>
diff --git a/models/admin/actions/Misc/upload.inc b/models/admin/actions/Misc/upload.inc
new file mode 100644
index 0000000..0dbee19
--- /dev/null
+++ b/models/admin/actions/Misc/upload.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: upload.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$filepath = EVENT_MANAGEMENT_APP_BASE.'web/custom/'.$this->config->custom_prefix.'/';
+
+// Get last file upload times
+$indexTime = filemtime($filepath.'index.html');
+$stylesTime = filemtime($filepath.'styles.css');
+$this->page->indexTime = date('m/d/Y h:i:s A', $indexTime);
+$this->page->stylesTime = date('m/d/Y h:i:s A', $stylesTime);
+
+$this->templateFile = 'Misc/upload.html';
+
+
+?>
diff --git a/models/admin/actions/Misc/uploadIndex.inc b/models/admin/actions/Misc/uploadIndex.inc
new file mode 100644
index 0000000..6fee2e0
--- /dev/null
+++ b/models/admin/actions/Misc/uploadIndex.inc
@@ -0,0 +1,80 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: uploadIndex.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->page->doingIndex = true;
+$filepath = EVENT_MANAGEMENT_APP_BASE.'web/custom/'.$this->config->custom_prefix.'/';
+
+if (isset($_REQUEST['RevertIndex'])) {
+
+ // Try to copy the previous file back in as the active file.
+ if (!copy($filepath.'SavedOriginals/index.html', $filepath.'index.html')) {
+ $this->reason[] = 'Sorry, we were unable restore the previous file.';
+
+ // Otherwise it's a successful upload
+ } else {
+
+ $this->page->indexFileRestored = true;
+
+ }
+
+
+} else {
+
+ // Check that it's a text/html file
+ if (!isset($_FILES['index'])) {
+ $this->reason[] = 'You did not supply a file.';
+
+ // Check if it's the right type
+ } elseif ($_FILES['index']['type'] != 'text/html') {
+ $this->reason[] = 'The file you supplied is not of type "text/html".';
+
+ // Read the file into a parameter
+ } elseif (!($f = file_get_contents($_FILES['index']['tmp_name']))) {
+ $this->reason[] = 'Unable to read the file provided.';
+
+ // Make sure there's no flexy or PHP elements in the file
+ } elseif (preg_match('~reason[] = 'The file you provided has PHP or Flexy Template components that are not permitted.';
+
+ // Replace the {GLM} tag with a flexy include that will insert content
+ } elseif (($f = str_replace('{GLM}', '', $f)) == '') {
+ $this->reason[] = 'Unable to parse the supplied file to prepare it for use.';
+
+ // Save the file to the destination folder
+ } elseif (!file_put_contents($filepath.'index.html.NEW', $f)) {
+ $this->reason[] = 'Unable to store prepared file.';
+
+ // Try to save off a copy of the current file
+ } elseif (!copy($filepath.'index.html', $filepath.'SavedOriginals/index.html')) {
+ $this->reason[] = 'Sorry, we were unable to save the current file as a backup so are not going to put the new one in.';
+
+ // Try to unlink old file then rename NEW file to index.html
+ } elseif (
+ !unlink($filepath.'index.html') ||
+ !rename($filepath.'index.html.NEW', $filepath.'index.html')
+ ) {
+ $this->reason[] = 'There was a problem moving the supplied file into live use. Please check the site and call immediately if there is a problem.';
+
+ // Otherwise it's a successful upload
+ } else {
+
+ $this->page->indexFileUploaded = true;
+
+ }
+
+}
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/actions/Misc/upload.inc';
+
+?>
diff --git a/models/admin/actions/Misc/uploadStylesheet.inc b/models/admin/actions/Misc/uploadStylesheet.inc
new file mode 100644
index 0000000..e284661
--- /dev/null
+++ b/models/admin/actions/Misc/uploadStylesheet.inc
@@ -0,0 +1,69 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: uploadStylesheet.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->page->doingStylesheet = true;
+$filepath = EVENT_MANAGEMENT_APP_BASE.'web/custom/'.$this->config->custom_prefix.'/';
+
+if (isset($_REQUEST['RevertStylesheet'])) {
+
+ // Try to copy the previous file back in as the active file.
+ if (!copy($filepath.'SavedOriginals/styles.css', $filepath.'styles.css')) {
+ $this->reason[] = 'Sorry, we were unable restore the previous file.';
+
+ // Otherwise it's a successful upload
+ } else {
+
+ $this->page->stylesheetFileRestored = true;
+
+ }
+
+
+} else {
+
+ // Check that it's a text/html file
+ if (!isset($_FILES['stylesheet'])) {
+ $this->reason[] = 'You did not supply a file.';
+
+ // Check if it's the right type
+ } elseif ($_FILES['stylesheet']['type'] != 'text/css') {
+ $this->reason[] = 'The file you supplied is not of type "text/html".';
+
+ // check that the size is reasonable
+ } elseif ($_FILES['stylesheet']['size'] < 10) {
+ $this->reason[] = 'There doesn\'t seem to be much in this file.';
+
+ // Make sure the file gets copied to the destination folder
+ } elseif (!copy($_FILES['stylesheet']['tmp_name'], $filepath.'styles.css.NEW')) {
+ $this->reason[] = 'Sorry, we were unable to copy the file you supplied to the destination folder.';
+
+ // Try to save off a copy of the current file
+ } elseif (!copy($filepath.'styles.css', $filepath.'SavedOriginals/styles.css')) {
+ $this->reason[] = 'Sorry, we were unable to save the current file as a backup so are not going to put the new one in.';
+
+ // Try to unlink old file then rename NEW file to styles.css
+ } elseif (!unlink($filepath.'styles.css') || !rename($filepath.'styles.css.NEW', $filepath.'styles.css')) {
+ $this->reason[] = 'There was a problem moving the supplied file into live use. Please check the site and call immediately if there is a problem.';
+
+ // Otherwise it's a successful upload
+ } else {
+
+ $this->page->stylesheetFileUploaded = true;
+
+ }
+
+}
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/actions/Misc/upload.inc';
+
+?>
diff --git a/models/admin/actions/Order/delete.inc b/models/admin/actions/Order/delete.inc
new file mode 100644
index 0000000..ce24c7a
--- /dev/null
+++ b/models/admin/actions/Order/delete.inc
@@ -0,0 +1,49 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Call the delete order method in the AdminOrders class to delete the order
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+$deleted = $Orders->orderDelete(true, 'abc');
+
+// echo "Result =
".print_r($deleted,1)."
";
+
+if ($deleted === false) {
+ echo "
Order NOT Deleted.
";
+ exit;
+}
+
+echo "
Order DELETED.
";
+
+exit;
+
+
+
+// If this is a member user then make sure they only list their own member performances
+$type = false;
+$id = false;
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser'] && !$this->config->option->users_access_all_members) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+}
+
+// Get Order detail
+$orderDetail = $Orders->getOrderDetail(false, $id);
+$this->page->orderDetail = $this->bindArrayToObject($orderDetail);
+
+$this->templateFile = 'Order/detail.html';
+
+$this->addDebug("Order/detail.inc", 'Array: $orderDetail', print_r($orderDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Order/detail.inc b/models/admin/actions/Order/detail.inc
new file mode 100644
index 0000000..1f289ad
--- /dev/null
+++ b/models/admin/actions/Order/detail.inc
@@ -0,0 +1,43 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+
+// If this is a member user then make sure they only list their own member performances
+$type = false;
+$id = false;
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser'] && !$this->config->option->users_access_all_members) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+}
+
+// Get Order detail
+$orderDetail = $Orders->getOrderDetail(false, $id);
+
+// Check for delete request
+if ($_REQUEST['Option'] == 'delete') {
+ $orderDetail['delete'] = true;
+}
+
+$orderDetail['notes'] = nl2br($orderDetail['notes']);
+
+$this->page->orderDetail = $this->bindArrayToObject($orderDetail);
+
+$this->templateFile = 'Order/detail.html';
+
+$this->addDebug("Order/detail.inc", 'Array: $orderDetail', print_r($orderDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Order/edit.inc b/models/admin/actions/Order/edit.inc
new file mode 100644
index 0000000..01e78a6
--- /dev/null
+++ b/models/admin/actions/Order/edit.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: edit.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+
+$orderDetail = $Orders->editOrder();
+$this->page->orderDetail = $this->bindArrayToObject($orderDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($orderDetail);
+
+$this->page->editingOrder = true;
+
+$this->templateFile = 'Order/edit.html';
+
+$this->addDebug("Order/edit.inc", 'Array: $orderDetail', print_r($orderDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Order/list.inc b/models/admin/actions/Order/list.inc
new file mode 100644
index 0000000..66e2379
--- /dev/null
+++ b/models/admin/actions/Order/list.inc
@@ -0,0 +1,35 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: list.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+
+// If this is a member user then make sure they only list their own member performances
+$type = false;
+$id = false;
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+}
+
+$orderList = $Orders->getOrdersList($id, false, false, $type);
+
+$this->page->orderList = $this->bindArrayToObject($orderList);
+
+$this->templateFile = 'Order/list.html';
+
+$this->addDebug("Order/list.inc", 'Order List', 'Array: $orderList
'.print_r($orderList,1));
+
+?>
+
diff --git a/models/admin/actions/Order/printVoucher.inc b/models/admin/actions/Order/printVoucher.inc
new file mode 100644
index 0000000..e7d6a09
--- /dev/null
+++ b/models/admin/actions/Order/printVoucher.inc
@@ -0,0 +1,50 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: printVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get Order Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+$orderDetail = $Orders->getOrderDetail();
+
+// Get Ticket Sold (voucher) detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sold.php';
+$Sold = new EventManagementAdminSold($this->dbh, $this->config);
+$type = false;
+$id = false;
+/*
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+}
+*/
+$soldList = $Sold->getSoldList($orderDetail['id'], false);
+
+// Get Venue Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+$memberDetail = $Members->getMemberDetail($orderDetail['member']);
+
+// Load voucher design code as per the "voucher_design" config parameter in the site's config/applications/EventManagement.ini file
+if (is_file(EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucher.php')) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucher.php';
+ $pdf = new PdfVoucher($orderDetail, $soldList, $memberDetail, $this->dbh, $this->config);
+} else {
+ echo "SYSTEM ERROR: Site is not configured with a valid voucher design file.";
+ exit;
+}
+
+// There's nothing to do from here. Output should go direct to browser.
+exit;
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Order/printVoucherMobile.inc b/models/admin/actions/Order/printVoucherMobile.inc
new file mode 100755
index 0000000..00543ed
--- /dev/null
+++ b/models/admin/actions/Order/printVoucherMobile.inc
@@ -0,0 +1,48 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: printVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get Order Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+$orderDetail = $Orders->getOrderDetail();
+
+// Get Ticket Sold (voucher) detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sold.php';
+$Sold = new EventManagementAdminSold($this->dbh, $this->config);
+$type = false;
+$id = false;
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+}
+$soldList = $Sold->getSoldList(false, $id);
+
+// Get Venue Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+$memberDetail = $Members->getMemberDetail($orderDetail['member']);
+
+// Load voucher design code as per the "voucher_design" config parameter in the site's config/applications/EventManagement.ini file
+if (is_file(EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucherMobile.php')) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucherMobile.php';
+ $pdf = new PdfVoucher($orderDetail, $soldList, $memberDetail, $this->dbh, $this->config);
+} else {
+ echo "SYSTEM ERROR: Site is not configured with a valid voucher design file.";
+ exit;
+}
+
+// There's nothing to do from here. Output should go direct to browser.
+exit;
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Order/selected.inc b/models/admin/actions/Order/selected.inc
new file mode 100644
index 0000000..c79dd2d
--- /dev/null
+++ b/models/admin/actions/Order/selected.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: selected.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+
+$orderDetail = $Orders->getOrderDetail();
+$this->page->orderDetail = $this->bindArrayToObject($orderDetail);
+
+$this->templateFile = 'Order/selected.html';
+
+$this->addDebug("Order/selected.inc", 'Order Detail', print_r($orderDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Order/update.inc b/models/admin/actions/Order/update.inc
new file mode 100644
index 0000000..d2dba66
--- /dev/null
+++ b/models/admin/actions/Order/update.inc
@@ -0,0 +1,46 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: update.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+
+// Process new record
+$r = $Orders->updateOrder();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingOrder = true;
+ $this->templateFile = 'Order/edit.html';
+} else {
+ $this->templateFile = 'Order/detail.html';
+ $r['fieldData']['notes'] = nl2br($r['fieldData']['notes']);
+}
+
+
+$this->page->orderDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$orderDetail = $Orders->getOrderDetail();
+$this->page->storedDetail = $this->bindArrayToObject($orderDetail);
+
+$this->addDebug("Order/update.inc", 'Array: $r', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Performance/add.inc b/models/admin/actions/Performance/add.inc
new file mode 100644
index 0000000..eab9ba2
--- /dev/null
+++ b/models/admin/actions/Performance/add.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: add.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+$Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+
+// Get base data and fields
+$r = $Performances->newPerformance();
+
+$this->page->performanceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewPerformance = true;
+
+$this->templateFile = 'Performance/edit.html';
+
+$this->addDebug("Performance/add.inc", 'Performance Add', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Performance/confirmDelete.inc b/models/admin/actions/Performance/confirmDelete.inc
new file mode 100644
index 0000000..db150b1
--- /dev/null
+++ b/models/admin/actions/Performance/confirmDelete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: confirmDelete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+$Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+
+$performanceDetail = $Performances->performanceDelete(true);
+$this->page->performanceDetail = $this->bindArrayToObject($performanceDetail);
+
+$this->templateFile = 'Performance/detail.html';
+
+$this->addDebug("Performance/confirmDelete.inc", 'Performance Confirm Delete', print_r($performanceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Performance/delete.inc b/models/admin/actions/Performance/delete.inc
new file mode 100644
index 0000000..18ad6e9
--- /dev/null
+++ b/models/admin/actions/Performance/delete.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: performance.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+$Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+
+
+$performanceDetail = $Performances->performanceDelete(false);
+$this->page->performanceDetail = $this->bindArrayToObject($performanceDetail);
+
+$this->templateFile = 'Performance/delete.html';
+
+$this->addDebug("Performance/delete.inc", 'Performance Delete', print_r($performanceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Performance/detail.inc b/models/admin/actions/Performance/detail.inc
new file mode 100644
index 0000000..4267af9
--- /dev/null
+++ b/models/admin/actions/Performance/detail.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+$Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+
+$performanceDetail = $Performances->getPerformanceDetail();
+$this->page->performanceDetail = $this->bindArrayToObject($performanceDetail);
+
+$this->templateFile = 'Performance/detail.html';
+
+$this->addDebug("Performance/detail.inc", 'Performance Detail', print_r($performanceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Performance/edit.inc b/models/admin/actions/Performance/edit.inc
new file mode 100644
index 0000000..f410e10
--- /dev/null
+++ b/models/admin/actions/Performance/edit.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+$Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+
+$performanceDetail = $Performances->editPerformance();
+$this->page->performanceDetail = $this->bindArrayToObject($performanceDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($performanceDetail);
+
+$this->page->editingPerformance = true;
+$this->templateFile = 'Performance/edit.html';
+
+$this->addDebug("Performance/edit.inc", 'Performance Edit', print_r($performanceDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Performance/insert.inc b/models/admin/actions/Performance/insert.inc
new file mode 100644
index 0000000..59b3642
--- /dev/null
+++ b/models/admin/actions/Performance/insert.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+$Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+
+// Process new record
+$r = $Performances->insertPerformance();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->performanceDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+$_SESSION[GLM_EVENT_SESSION]['Performance'] = $r['fieldData']['id'];
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewPerformance = true;
+ $this->templateFile = 'Performance/edit.html';
+} else {
+ $this->templateFile = 'Performance/selected.html';
+}
+
+$this->addDebug("Performance/insert.inc", 'Performance Insert', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Performance/list.inc b/models/admin/actions/Performance/list.inc
new file mode 100644
index 0000000..dddb4f8
--- /dev/null
+++ b/models/admin/actions/Performance/list.inc
@@ -0,0 +1,45 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+$Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+
+// If this is a member user then make sure they only list their own member performances
+$type = false;
+$id = false;
+
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+} elseif ($_SESSION[GLM_EVENT_SESSION]['Member'] != false) {
+ $type = 'member';
+ $id = $_SESSION[GLM_EVENT_SESSION]['Member'];
+}
+
+$performanceList = $Performances->getPerformancesList($type, $id, true);
+
+$this->page->performanceList = $this->bindArrayToObject($performanceList);
+
+// Check if we also need to display a performance detail (list redisplay on performance update).
+$this->page->displayPerformance = false;
+if (isset($_REQUEST['performanceID']) && ($_REQUEST['performanceID']-0) > 0) {
+ $this->page->displayPerformance = ($_REQUEST['performanceID']-0);
+}
+
+$this->templateFile = 'Performance/list.html';
+
+$this->addDebug("Performance/list.inc", 'Performance List', 'Array: $performanceList
'.print_r($sectionList,1));
+
+?>
+
diff --git a/models/admin/actions/Section/update.inc b/models/admin/actions/Section/update.inc
new file mode 100644
index 0000000..426636a
--- /dev/null
+++ b/models/admin/actions/Section/update.inc
@@ -0,0 +1,42 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sections.php';
+$Sections = new EventManagementAdminSections($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Sections->updateSection();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->sectionDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingSection = true;
+ $this->templateFile = 'Section/edit.html';
+} else {
+ // If valid
+ $this->templateFile = 'Section/detail.html';
+}
+
+$this->addDebug("Section/add.inc", 'Section Add', print_r($r,1));
+
+?>
+
diff --git a/models/admin/actions/Sold/claim.inc b/models/admin/actions/Sold/claim.inc
new file mode 100644
index 0000000..f7451b4
--- /dev/null
+++ b/models/admin/actions/Sold/claim.inc
@@ -0,0 +1,24 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Check if we got an orderID here
+$this->page->orderID = 0;
+if (isset($_REQUEST['orderID'])) {
+ $orderID = ($_REQUEST['orderID'] -0);
+ $this->page->orderID = $orderID;
+}
+
+$this->templateFile = 'Sold/claim.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Sold/claimVoucher.inc b/models/admin/actions/Sold/claimVoucher.inc
new file mode 100644
index 0000000..26d5faa
--- /dev/null
+++ b/models/admin/actions/Sold/claimVoucher.inc
@@ -0,0 +1,44 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: claimVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get ticket inventory ID and desired status
+$voucherID = ($_REQUEST['VoucherID'] - 0);
+
+// Do sanity check on ID
+if ($voucherID > 0) {
+
+ // Get current claims information, if there is one
+ $sql = "SELECT time_claimed FROM eventmgt.ticket_sold WHERE id = $voucherID;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $voucher = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$voucher) {
+
+ // Voucher Not Found
+
+ } else {
+
+ // Has not been claimed, so mark it and return time only
+ $sql = "UPDATE eventmgt.ticket_sold SET numb_claimed = numb_uses WHERE id = $voucherID OR package_sold_id = (SELECT package_sold_id FROM eventmgt.ticket_sold where id = $voucherID);";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ }
+
+}
+
+include EVENT_MANAGEMENT_APP_BASE.'models/admin/actions/Sold/detail.inc';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Sold/detail.inc b/models/admin/actions/Sold/detail.inc
new file mode 100644
index 0000000..086d513
--- /dev/null
+++ b/models/admin/actions/Sold/detail.inc
@@ -0,0 +1,315 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->page->markedAsClaimed = false;
+$this->page->alreadyClaimedAlert = false;
+$packageClaimOK = true;
+$problem = array();
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sold.php';
+$Sold = new EventManagementAdminSold($this->dbh, $this->config);
+
+// If this is a member user then make sure they only list their own member performances
+$userType = false;
+$userID = false;
+$scanName = 'Admin';
+$userMemberID = false;
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $userType = 'member';
+ $userID = $_SESSION[GLM_EVENT_SESSION]['MemberUser'];
+ $userMemberID = $_SESSION[GLM_EVENT_SESSION]['Member']; // This is the ID of the member!!!
+}
+
+// If we have a logged in user, then check if the user's member also scans for other members
+$scansFor = false;
+if ($userMemberID != false) {
+
+ // Get the user information
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataContacts.php';
+ $Contact = new EventManagementDataContacts($this->dbh, $this->config);
+ $userInfo = $Contact->getContactDetail($userID);
+
+ $scanName = '';
+ if ($userInfo['org'] != '') {
+ $scanName = $userInfo['org'].': ';
+ }
+ $scanName .= $userInfo['lname'].', '.$userInfo['fname'];
+
+ // Also get list of members this member scans for
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMemberScansFor.php';
+ $MemberScansFor = new EventManagementDataMemberScansFor($this->dbh, $this->config);
+ $msf = $MemberScansFor->getMemberScansForList($userMemberID);
+
+ // If member scans for others, build a simple array of those member IDs
+ if (is_array($msf) && count($msf) > 0) {
+ $scansFor = array();
+ foreach ($msf as $m) {
+ $scansFor[] = $m['scans_for'];
+ }
+ }
+}
+
+// Get sold ticket detail
+$soldDetail = $Sold->getSoldDetail();
+
+// If we don't have ticket detail
+if (!$soldDetail) {
+
+ $packageTickets = false;
+ $soldDetail = false;
+ $problem[] = 'Not found!';
+
+// We have ticket detail
+} else {
+
+ // Check if a package voucher has been scanned
+ $this->page->isPackage = false;
+ if ($soldDetail['is_package']['value']) {
+
+ $this->page->isPackage = true;
+
+ // Check if this is an admin (not logged in) user - Not permitted to scan packages
+ if (!$userID && $_REQUEST['doClaim'] == 'true') {
+
+ $packageTickets = false;
+ $soldDetail = false;
+ $problem[] = 'Admin users may not scan a package ticket voucher.
+ Package ticket vouchers may only be scanned by a valid logged-in user (contact).
+ Use "Order #:" entry to retrieve voucher status.';
+
+ // The user is a valid logged in user
+ } else {
+
+ if ($userID) {
+ // Build member WHERE clause
+ $memberWhere = " AND member = $userMemberID";
+ if ($scansFor != false) {
+
+ // User member scans for other members (locations), so add them into the WHERE clause.
+ $memberWhere = "AND (member = $userMemberID";
+
+ foreach($scansFor as $sf) {
+ $memberWhere .= " OR member = $sf";
+ }
+
+ $memberWhere .= ')';
+ }
+ }
+
+ // Get list of tickets in the package for this location - Hopefully only 1
+ $sql = "
+ SELECT *
+ FROM eventmgt.ticket_sold
+ WHERE package_sold_id = '".$soldDetail['package_sold_id']."'
+ AND id != ".$soldDetail['id']."
+ $memberWhere
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $packageTickets = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // If we have package tickets for this location
+ if (is_array($packageTickets) && count($packageTickets) > 0) {
+
+ // If we're trying to claim this ticket use
+ if ($_REQUEST['doClaim'] == 'true') {
+
+ // Check if there's more than one ticket - should not be the case
+ if (count($packageTickets) > 1) {
+
+ $problem[] = 'More than one package item for this location was found for the scanned voucher.
+ There may only be one item per location contained in a package. Please check the
+ package configuration.';
+
+ // Only one ticket for this location in the package - OK to claim
+ } else {
+
+ // For each ticket in the package at this location
+ foreach ($packageTickets as $pt) {
+
+ // Check if it's not unlimited and already been claimed the max times
+ if (!$pt['unlimited_use'] && ($pt['numb_uses'] - $pt['numb_claimed']) <= 0 ) {
+ $packageClaimOK = false;
+ $this->page->alreadyClaimedAlert = true;
+ }
+
+ }
+
+ // If we can claim these tickets
+ if ($packageClaimOK) {
+
+ reset($packageTickets);
+ while (list($key, $val) = each($packageTickets)) {
+
+ // Update ticket_sold to indicate one claim of voucher
+ $sql = "
+ UPDATE eventmgt.ticket_sold
+ SET numb_claimed = ( numb_claimed + 1 )
+ WHERE id = ".$val['id'].";
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ // Also update our local copy
+ $packageTickets[$key]['numb_claimed'] += 1;
+
+ // Store claim tracking
+ $sql = "
+ INSERT INTO eventmgt.ticket_claim_tracking
+ ( ticket_order, ticket_sold, time_of_action, action_type, quant, scan_user, scan_name )
+ VALUES
+ (
+ ".$val['ticket_order'].",
+ ".$val['id'].",
+ 'now',
+ ".$this->config->claim_tracking_types_numb->claim.",
+ 1,
+ $userID,
+ '".addslashes($scanName)."'
+ );
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ }
+
+ $this->page->markedAsClaimed = true;
+
+ } // OK to claim ticket
+
+ } // Only one ticket for this location in the package - OK to claim
+
+ } // Claiming package ticket at this time
+
+ } // Have package tickets for this location
+
+ } // Have a valid logged in user
+
+ // Otherwise not scanning a package
+ } else {
+
+ /*
+ * Check if user can scan this ticket, must be one of ...
+ * 1) No user logged in - admins can scan for any non-package
+ * 2) User logged in belongs to the ticket member
+ * 3) User logged in belongs to the member that scans for the ticket member
+ */
+ if ( $userMemberID == false ||
+ $soldDetail['member'] == $userMemberID ||
+ (is_array($scansFor) && (in_array($soldDetail['member'], $scansFor) || in_array($soldDetail['assigned_from'], $scansFor))) ) {
+
+ // If we're not trying to claim this ticket use
+ if ($_REQUEST['doClaim'] != 'true') {
+
+ // Do nothing here. We're just going to display the voucher data
+
+ // Check if the ticket is not unlimited and has already been claimed the max times
+ } elseif (!$soldDetail['unlimited_use']['value'] && ($soldDetail['numb_uses'] - $soldDetail['numb_claimed']) <= 0 ) {
+
+ // Ticket has already been claimed.
+ $this->page->alreadyClaimedAlert = true;
+
+ // Otherwise add a claim for this voucher
+ } else {
+
+ // Update ticket_sold to indicate one claim of voucher
+ $sql = "
+
+ UPDATE eventmgt.ticket_sold
+ SET numb_claimed = ( numb_claimed + 1 )
+ WHERE id = ".$soldDetail['id'].";
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ // Store claim tracking
+ $sql = "
+ INSERT INTO eventmgt.ticket_claim_tracking
+ ( ticket_order, ticket_sold, time_of_action, action_type, quant, scan_user, scan_name )
+ VALUES
+ (
+ ".$soldDetail['ticket_order'].",
+ ".$soldDetail['id'].",
+ 'now',
+ ".$this->config->claim_tracking_types_numb->claim.",
+ 1,
+ ".($userID?$userID:'null').",
+ '".addslashes($scanName)."'
+ );
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ // Reload voucher data
+ $soldDetail = $Sold->getSoldDetail(false, $id);
+
+ $this->page->markedAsClaimed = true;
+
+ }
+
+
+ // User is not permitted to scan the ticket
+ } else {
+ $packageTickets = false;
+ $soldDetail = false;
+ $problem[] = 'The scanned ticket may not be used at the current location.';
+ }
+
+
+ }
+
+} // have ticket detail
+
+// And one last thing. To add some data to package tickets
+if (is_array($packageTickets) && count($packageTickets) > 0) {
+
+ reset($packageTickets);
+
+ // For each ticket in the package at this location
+ while (list($key, $val) = each($packageTickets)) {
+
+ $packageTickets[$key]['fullyClaimedAlert'] = false;
+ $remaining = ($val['numb_uses'] - $val['numb_claimed']);
+ $packageTickets[$key]['remaining'] = $remaining;
+
+ if (!$val['unlimited_use'] && $remaining <= 0 ) {
+ $packageTickets[$key]['fullyClaimedAlert'] = true;
+ }
+
+ }
+
+ $this->page->packageDetail = $this->bindArrayToObject($packageTickets);
+
+}
+
+// Check for main sold detail number of claimes expired
+$remaining = ($soldDetail['numb_uses'] - $soldDetail['numb_claimed']);
+if (is_array($soldDetail) && $soldDetail['unlimited_use']['value'] == '' && $remaining <= 0 ) {
+ $soldDetail['fullyClaimedAlert'] = true;
+}
+
+$this->page->soldDetail = $this->bindArrayToObject($soldDetail);
+$this->templateFile = 'Sold/detail.html';
+
+if (count($problem) > 0) {
+ $this->page->problem = $this->bindArrayToObject($problem);
+ $this->page->haveProblem = true;
+} else {
+ $this->page->problem = false;
+ $this->page->haveProblem = false;
+}
+
+$this->addDebug("Sold/detail.inc", 'Array: $soldDetail', print_r($soldDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Sold/fixPackages.inc b/models/admin/actions/Sold/fixPackages.inc
new file mode 100755
index 0000000..24ed05e
--- /dev/null
+++ b/models/admin/actions/Sold/fixPackages.inc
@@ -0,0 +1,170 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: fixPackages.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+
+/*
+ * This method is build to add the missing package detail for
+ * package tickets sold that did not have the ticket_sold records
+ * added for each of the package destinations. This is not
+ * for normal use.
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+$TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+
+// Get all sold packages that do not have ticket_sold entries for the individual destinations
+$sql = "
+ SELECT ticket_sold.*
+ FROM eventmgt.ticket_sold, eventmgt.ticket
+ WHERE ticket.id = ticket_sold.ticket
+ AND ticket.ticket_type = 20
+ AND package_sold_id IS null
+ ORDER BY ticket_sold.id
+ LIMIT 100
+;";
+$stmt = $this->dbh->prepare($sql);
+$stmt->execute();
+$soldList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+echo "
Loaded ".count($soldList)." package sales that need to be fixed.
";
+
+// For each package ticket sold that needs to be fixed
+foreach ($soldList as $s) {
+
+ $pSale = $s['id'];
+ $p = $s['ticket'];
+
+ // get the package contents
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+ $TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+ $packageData = $TicketPackages->getPackageList("package = ".$s['ticket']);
+
+ echo "Processing package sale # $pSale - Session ID = ".$s['session_id']." ";
+
+ // for each item in the package
+ reset ($packageData);
+ foreach ($packageData as $t) {
+
+ // Get information on this package ticket
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+ $Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+ $pt = $Tickets->getTicketDetail($t['ticket']);
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+ $Sections = new EventManagementDataSections($this->dbh, $this->config);
+ $ps = $Sections->getSectionDetail($pt['section_id']);
+
+ // Get Entrance information for this ticket's section
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataEntrances.php';
+ $Entrances = new EventManagementDataEntrances($this->dbh, $this->config);
+ $pe = $Entrances->getEntranceDetail($ps['entrance']);
+
+ $sql = "
+ INSERT INTO eventmgt.ticket_sold
+ (
+ ticket_order,
+ member,
+ member_name,
+ assigned,
+ assigned_from,
+ assigned_from_name,
+ performance,
+ performance_name,
+ entrance,
+ entrance_name,
+ entrance_color,
+ section,
+ section_name,
+ ticket,
+ ticket_name,
+ is_package,
+ package_sold_id,
+ ticket_package,
+ package_name,
+ date_specific,
+ ticket_date,
+ time_specific,
+ ticket_time,
+ start_date,
+ end_date,
+ likely_date,
+ price_paid,
+ voucher_type,
+ voucher_text,
+ policies,
+ unlimited_use,
+ numb_uses,
+ numb_claimed,
+ time_claimed,
+ session_id
+ )
+ VALUES
+ (
+ ".$s['ticket_order'].",
+ ".$pt['member'].",
+ '".$pt['member_name']."',
+ false,
+ NULL,
+ '',
+ ".$pt['performance_id'].",
+ '".$pt['performance']."',
+ ".(!empty($pt['section_id']) ? $pt['section_id'] : 'NULL').",
+ '".$pe['name']."',
+ '".$pe['color']['name']."',
+ ".$ps['id'].",
+ '".$ps['name']."',
+ ".$pt['id'].",
+ '".$pt['title']."',
+ false,
+ '".$s['session_id']."-$pSale',
+ ".$s['ticket'].",
+ '".$packageData['title']."',
+ false,
+ NULL,
+ false,
+ '".$pt['ticket_timestamp']."',
+ ".(!empty($pt['start_date']['date']) ? "'".$pt['start_date']['date']."'" : 'NULL').",
+ ".(!empty($pt['end_date']['date']) ? "'".$pt['end_date']['date']."'" : 'NULL').",
+ NULL,
+ 0,
+ ".$pt['voucher_type']['value'].",
+ '".$pt['voucher_text']."',
+ '',
+ ".($pt['unlimited_use']['value'] ? 'true' : 'false').",
+ ".$pt['uses'].",
+ 0,
+ null,
+ '".$s['session_id']."'
+ );
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ }
+
+ // Now update the package ticket entry
+ $sql = "
+ UPDATE eventmgt.ticket_sold
+ SET package_sold_id = '".$s['session_id']."-$pSale',
+ is_package = true
+ WHERE id = $pSale
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+}
+exit;
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Sold/list.inc b/models/admin/actions/Sold/list.inc
new file mode 100644
index 0000000..f2d8cc6
--- /dev/null
+++ b/models/admin/actions/Sold/list.inc
@@ -0,0 +1,35 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: list.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sold.php';
+$Sold = new EventManagementAdminSold($this->dbh, $this->config);
+
+// If this is a member user then make sure they only list their own member performances
+$type = false;
+$id = false;
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser'] && !$this->config->option->users_access_all_members) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+}
+
+$soldList = $Sold->getSoldList(false, $id);
+
+$this->page->soldList = $this->bindArrayToObject($soldList);
+
+$this->templateFile = 'Sold/list.html';
+
+$this->addDebug("Sold/list.inc", 'Sold List', 'Array: $soldList
'.print_r($soldList,1));
+
+?>
+
diff --git a/models/admin/actions/Sold/resetVoucher.inc b/models/admin/actions/Sold/resetVoucher.inc
new file mode 100644
index 0000000..af7512c
--- /dev/null
+++ b/models/admin/actions/Sold/resetVoucher.inc
@@ -0,0 +1,45 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: resetVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get ticket inventory ID and desired status
+$voucherID = ($_REQUEST['VoucherID'] - 0);
+
+// Do sanity check on ID
+if ($voucherID > 0) {
+
+ // Get current claim time, if there is one
+ $sql = "SELECT time_claimed FROM eventmgt.ticket_sold WHERE id = $voucherID;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $voucher = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$voucher) {
+
+ // Voucher Not Found
+
+ } else {
+
+ // Has not been claimed, so clear it
+ $sql = "UPDATE eventmgt.ticket_sold SET numb_claimed = 0 WHERE id = $voucherID OR package_sold_id = (SELECT package_sold_id FROM eventmgt.ticket_sold where id = $voucherID);";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ }
+
+}
+
+include EVENT_MANAGEMENT_APP_BASE.'models/admin/actions/Sold/detail.inc';
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Sold/selected.inc b/models/admin/actions/Sold/selected.inc
new file mode 100644
index 0000000..b44de8c
--- /dev/null
+++ b/models/admin/actions/Sold/selected.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: selected.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sold.php';
+$Sold = new EventManagementAdminSold($this->dbh, $this->config);
+
+$soldDetail = $Sold->getSoldDetail();
+$this->page->soldDetail = $this->bindArrayToObject($soldDetail);
+
+$this->templateFile = 'Sold/selected.html';
+
+$this->addDebug("Sold/selected.inc", 'Sold Ticket Detail', print_r($soldDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/State/add.inc b/models/admin/actions/State/add.inc
new file mode 100644
index 0000000..27e826a
--- /dev/null
+++ b/models/admin/actions/State/add.inc
@@ -0,0 +1,36 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/states.php';
+$States = new EventManagementAdminStates($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Generate a random access code for the new team
+require '../classes/EasyPassword.php';
+$ep = new EasyPassword();
+$passwd = $ep->generateEasyPassword();
+
+$r = $States->newState();
+$r['fieldData']['password'] = $code;
+
+$this->page->stateDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewState = true;
+
+$this->templateFile = 'State/EditState.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/State/detail.inc b/models/admin/actions/State/detail.inc
new file mode 100644
index 0000000..df70e19
--- /dev/null
+++ b/models/admin/actions/State/detail.inc
@@ -0,0 +1,36 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/states.php';
+$States = new EventManagementAdminStates($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+$stateDetail = $States->getStateDetail();
+$this->page->stateDetail = $this->bindArrayToObject($stateDetail);
+
+// Get contacts for this event
+$eventContacts = $Contacts->getContacts('state');
+$this->page->contactsList = $this->bindArrayToObject($eventContacts['contact_list']);
+
+// Get room blocks and teams for this state rep
+require '../classes/blocks.php';
+$Blocks = new EventManagementAdminBlocks($this->dbh, $this->config);
+$roomBlocks = $Blocks->getRoomBlocks(false, true, true, $stateDetail['id']);
+$this->page->roomBlocks = $this->bindArrayToObject($roomBlocks);
+
+$this->templateFile = 'State/StateDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/State/edit.inc b/models/admin/actions/State/edit.inc
new file mode 100644
index 0000000..7c714a8
--- /dev/null
+++ b/models/admin/actions/State/edit.inc
@@ -0,0 +1,44 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/states.php';
+$States = new EventManagementAdminStates($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Check State Code
+$stateDetail = $States->editState();
+
+// If no password has been set, then suggest one
+if (trim($stateDetail['password']) == '') {
+
+ // Generate a random access code for the new team
+ require '../classes/EasyPassword.php';
+ $ep = new EasyPassword();
+ $passwd = $ep->generateEasyPassword();
+ $stateDetail['password'] = $passwd;
+
+}
+
+$this->page->stateDetail = $this->bindArrayToObject($stateDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($stateDetail);
+
+$this->page->editingState = true;
+
+$this->templateFile = 'State/EditState.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/State/insert.inc b/models/admin/actions/State/insert.inc
new file mode 100644
index 0000000..a3ac97c
--- /dev/null
+++ b/models/admin/actions/State/insert.inc
@@ -0,0 +1,40 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/states.php';
+$States = new EventManagementAdminStates($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Process new record
+$r = $States->insertState();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->stateDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewState = true;
+ $this->templateFile = 'State/EditState.html';
+} else {
+ $this->templateFile = 'State/StateDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/State/list.inc b/models/admin/actions/State/list.inc
new file mode 100644
index 0000000..d9704bd
--- /dev/null
+++ b/models/admin/actions/State/list.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/states.php';
+$States = new EventManagementAdminStates($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Get state reps stats
+$statesStats = $States->getStatesStats();
+$this->page->statesStats = $this->bindArrayToObject($statesStats);
+
+// Get state reps list
+$states = $States->getStatesList();
+$this->page->statesList = $this->bindArrayToObject($states);
+
+$this->templateFile = 'State/StatesList.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/State/update.inc b/models/admin/actions/State/update.inc
new file mode 100644
index 0000000..435a243
--- /dev/null
+++ b/models/admin/actions/State/update.inc
@@ -0,0 +1,44 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/states.php';
+$States = new EventManagementAdminStates($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Process new record
+$r = $States->updateState();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->stateDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$stateDetail = $States->getStateDetail();
+$this->page->storedDetail = $this->bindArrayToObject($stateDetail);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingState = true;
+ $this->templateFile = 'State/EditState.html';
+} else {
+ $this->templateFile = 'State/StateDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/add.inc b/models/admin/actions/Team/add.inc
new file mode 100644
index 0000000..914be17
--- /dev/null
+++ b/models/admin/actions/Team/add.inc
@@ -0,0 +1,35 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+// Generate a random access code for the new team
+require GLM_APP_BASE.'Common/'.$this->config->applicationVersion.'/classes/EasyPassword.php';
+$ep = new EasyPassword();
+$code = $ep->generateEasyPassword();
+
+$r = $Teams->newTeam();
+$r['fieldData']['team_code'] = $code;
+
+$this->page->teamDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->addingNewTeam = true;
+
+$this->templateFile = 'Team/EditTeam.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/detail.inc b/models/admin/actions/Team/detail.inc
new file mode 100644
index 0000000..f32ae07
--- /dev/null
+++ b/models/admin/actions/Team/detail.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+$r = $Teams->getTeamDetail();
+$this->page->teamDetail = $this->bindArrayToObject($r['teamDetail']);
+$this->page->teamRoster = $this->bindArrayToObject($r['teamRoster']);
+
+// Get contacts for this event
+$eventContacts = $Contacts->getContacts('team');
+$this->page->contactsList = $this->bindArrayToObject($eventContacts['contact_list']);
+
+$this->templateFile = 'Team/TeamDetail.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/edit.inc b/models/admin/actions/Team/edit.inc
new file mode 100644
index 0000000..6a35d48
--- /dev/null
+++ b/models/admin/actions/Team/edit.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+$teamDetail = $Teams->editTeam();
+$this->page->teamDetail = $this->bindArrayToObject($teamDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($teamDetail);
+
+$this->page->editingTeam = true;
+
+$this->templateFile = 'Team/EditTeam.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/editRoster.inc b/models/admin/actions/Team/editRoster.inc
new file mode 100644
index 0000000..7a436ca
--- /dev/null
+++ b/models/admin/actions/Team/editRoster.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+
+
+$r = $Teams->editTeamRoster();
+
+$this->page->teamDetail = $this->bindArrayToObject($r['teamDetail']);
+$this->page->teamRoster = $this->bindArrayToObject($r['teamRoster']);
+
+$this->templateFile = 'Team/EditTeamRoster.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/insert.inc b/models/admin/actions/Team/insert.inc
new file mode 100644
index 0000000..431c94b
--- /dev/null
+++ b/models/admin/actions/Team/insert.inc
@@ -0,0 +1,40 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Teams->insertTeam();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->teamDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewTeam = true;
+ $this->templateFile = 'Team/EditTeam.html';
+} else {
+ $this->templateFile = 'Team/TeamDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/list.inc b/models/admin/actions/Team/list.inc
new file mode 100644
index 0000000..fdd88b4
--- /dev/null
+++ b/models/admin/actions/Team/list.inc
@@ -0,0 +1,54 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Check for teams that don't have access codes and assign one to them
+require GLM_APP_BASE.'CommonApps/'.$this->config->applicationVersion.'/classes/EasyPassword.php';
+$ep = new EasyPassword();
+
+$sql = "
+ SELECT id
+ FROM eventmgt.team
+ WHERE team_code IS NULL
+ OR team_code = '';
+ ";
+$stmt = $this->dbh->prepare($sql);
+$stmt->execute();
+$teams = $stmt->fetchAll(PDO::FETCH_ASSOC);
+$sql = '';
+if (count($teams) > 0) {
+ foreach ($teams as $t) {
+ $code = $ep->generateEasyPassword();
+ $sql = "UPDATE team SET team_code = '$code' WHERE id = ".$t['id'].";\n";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ }
+}
+
+// Get teams stats
+$teamsStats = $Teams->getTeamsStats();
+$this->page->teamsStats = $this->bindArrayToObject($teamsStats);
+
+// Get teams list
+$teams = $Teams->getTeamsList();
+$this->page->teamsList = $this->bindArrayToObject($teams);
+
+$this->templateFile = 'Team/TeamsList.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/update.inc b/models/admin/actions/Team/update.inc
new file mode 100644
index 0000000..f6b2df1
--- /dev/null
+++ b/models/admin/actions/Team/update.inc
@@ -0,0 +1,45 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/contacts.php';
+$Contacts = new EventManagementAdminContacts($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Teams->updateTeam();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->teamDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$r = $Teams->getTeamDetail();
+$this->page->storedDetail = $this->bindArrayToObject($r['teamDetail']);
+$this->page->teamRoster = $this->bindArrayToObject($r['teamRoster']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingTeam = true;
+ $this->templateFile = 'Team/EditTeam.html';
+} else {
+ $this->templateFile = 'Team/TeamDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Team/updateRoster.inc b/models/admin/actions/Team/updateRoster.inc
new file mode 100644
index 0000000..47b1f45
--- /dev/null
+++ b/models/admin/actions/Team/updateRoster.inc
@@ -0,0 +1,32 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/teams.php';
+$Teams = new EventManagementAdminTeams($this->dbh, $this->config);
+
+
+$r = $Teams->updateTeamRoster();
+
+$this->page->teamDetail = $this->bindArrayToObject($r['teamDetail']);
+$this->page->teamRoster = $this->bindArrayToObject($r['teamRoster']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$r['status']) {
+ $this->templateFile = 'Team/EditTeamRoster.html';
+} else {
+ $this->templateFile = 'Team/TeamDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/add.inc b/models/admin/actions/Ticket/add.inc
new file mode 100644
index 0000000..a20665b
--- /dev/null
+++ b/models/admin/actions/Ticket/add.inc
@@ -0,0 +1,58 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: add.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Check if we need to ask for a member/venue first
+//if (!$_SESSION[GLM_EVENT_SESSION]['Member']) {
+$memberID = ($_REQUEST['memberID'] - 0);
+if ($memberID == 0) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+ $Members = new EventManagementAdminMembers($this->dbh, $this->config);
+ $members = $Members->getMembersList('all');
+
+ // Check if there's only one member and if so don't bother asking
+ if (count($members) == 1) {
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $members[0]['id'];
+ } else {
+
+ $this->page->membersList = $this->bindArrayToObject($members);
+ $this->templateFile = 'Ticket/addGetMember.html';
+ return;
+ }
+
+} else {
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+ $Members = new EventManagementAdminMembers($this->dbh, $this->config);
+ $member = $Members->getEntry($memberID);
+
+}
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+$r = $Tickets->newTicket();
+
+$this->page->memberDetail = $this->bindArrayToObject($member);
+$this->page->ticketDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+$this->page->addingNewTicket = true;
+
+$this->templateFile = 'Ticket/edit.html';
+
+$this->addDebug("Ticket/add.inc", 'Array: $r', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/confirmDelete.inc b/models/admin/actions/Ticket/confirmDelete.inc
new file mode 100644
index 0000000..b8e5c10
--- /dev/null
+++ b/models/admin/actions/Ticket/confirmDelete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: confirmDelete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+$ticketDetail = $Tickets->ticketDelete(true);
+$this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+$this->templateFile = 'Ticket/detail.html';
+
+$this->addDebug("Ticket/confirmDelete.inc", 'Section Confirm Delete', print_r($ticketDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Ticket/delete.inc b/models/admin/actions/Ticket/delete.inc
new file mode 100644
index 0000000..4258d52
--- /dev/null
+++ b/models/admin/actions/Ticket/delete.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: delete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+
+$ticketDetail = $Tickets->ticketDelete(false);
+$this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+$this->templateFile = 'Ticket/delete.html';
+
+$this->addDebug("Ticket/delete.inc", 'Array: $ticketDetail', print_r($ticketDetail,1));
+
+?>
+
diff --git a/models/admin/actions/Ticket/detail.inc b/models/admin/actions/Ticket/detail.inc
new file mode 100644
index 0000000..38244c7
--- /dev/null
+++ b/models/admin/actions/Ticket/detail.inc
@@ -0,0 +1,47 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+// Get Ticket detail
+$ticketDetail = $Tickets->getTicketDetail();
+$this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+// If it's a package, get the package contents
+$this->page->isPackage = false;
+if ($this->config->option->packages && $ticketDetail['ticket_type']['value'] == 20) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+ $TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+ $packageData = $TicketPackages->getPackageList("package = ".$ticketDetail['id']);
+ $this->page->isPackage = true;
+}
+$this->page->ticketPackage = $this->bindArrayToObject($packageData);
+
+$_SESSION[GLM_EVENT_SESSION]['Member'] = $ticketDetail['member'];
+
+// Also get Ticket inventory Stats - and check if none exist for this ticket
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/ticketInventory.php';
+$ticketInventory = new EventManagementAdminTicketInventory($this->dbh, $this->config);
+$ticketInventoryStats = $ticketInventory->getTicketTicketInventoryStats();
+$this->page->noTicketInventory = true;
+if ($ticketInventoryStats > 0) {
+ $this->page->noTicketInventory = false;
+}
+
+$this->templateFile = 'Ticket/detail.html';
+
+$this->addDebug("Ticket/detail.inc", 'Array: $ticketDetail', print_r($ticketDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/edit.inc b/models/admin/actions/Ticket/edit.inc
new file mode 100644
index 0000000..9e168f8
--- /dev/null
+++ b/models/admin/actions/Ticket/edit.inc
@@ -0,0 +1,46 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: edit.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+$ticketDetail = $Tickets->editTicket();
+$this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($ticketDetail);
+
+// We need a full list of other tickets to use for selecting tickets in a package
+$ticketsList = $Tickets->getTicketsList($ticketDetail['member'], false, false, 'packageSelect', false, false, false, $ticketDetail['id']);
+$this->page->ticketsList = $this->bindArrayToObject($ticketsList);
+
+// var_dump($ticketsList);
+
+// Also get a list of any tickets that are included in the package
+$this->page->isPackage = false;
+if ($ticketDetail['ticket_type']['value'] == 20) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+ $TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+ $packageData = $TicketPackages->getPackageList("T.package = ".$ticketDetail['id']);
+ $this->page->ticketPackage = $this->bindArrayToObject($packageData);
+ $this->page->isPackage = true;
+}
+
+$this->page->editingTicket = true;
+
+$this->templateFile = 'Ticket/edit.html';
+
+$this->addDebug("Ticket/edit.inc", 'Array: $ticketDetail', print_r($ticketDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/insert.inc b/models/admin/actions/Ticket/insert.inc
new file mode 100644
index 0000000..c90ab95
--- /dev/null
+++ b/models/admin/actions/Ticket/insert.inc
@@ -0,0 +1,63 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: insert.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+// Process new record
+$r = $Tickets->insertTicket();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->ticketDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewTicket = true;
+ $this->templateFile = 'Ticket/edit.html';
+} else {
+
+ $ticketID = $r['fieldData']['id'];
+ // Also get Ticket inventory Stats - and check if none exist for this ticket
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/ticketInventory.php';
+ $TicketInventory = new EventManagementAdminTicketInventory($this->dbh, $this->config);
+ $ticketInventoryStats = $TicketInventory->getTicketTicketInventoryStats($ticketID);
+
+ $this->page->noTicketInventory = true;
+ if ($ticketInventoryStats > 0) {
+ $this->page->noTicketInventory = false;
+ } else {
+
+ // Try to create default ticket inventory
+ $TicketInventory->generateDefaultTicketInventory();
+
+ // Get inventory stats again
+ $ticketInventoryStats = $TicketInventory->getTicketTicketInventoryStats($ticketDetail['id']);
+
+ if ($ticketInventoryStats > 0) {
+ $this->page->noTicketInventory = false;
+ }
+ }
+
+ $this->templateFile = 'Ticket/selected.html';
+}
+
+$this->addDebug("Ticket/insert.inc", 'Array: $r', print_r($r,1));
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/inventory.inc b/models/admin/actions/Ticket/inventory.inc
new file mode 100644
index 0000000..c4d4657
--- /dev/null
+++ b/models/admin/actions/Ticket/inventory.inc
@@ -0,0 +1,59 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: inventory.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/ticketInventory.php';
+$TicketInventory = new EventManagementAdminTicketInventory($this->dbh, $this->config);
+
+// Check if a CreateInventory request has been received
+if (!$_REQUEST['CreateInventory'] == 'true') {
+
+ $res = $TicketInventory->generateDefaultTicketInventory();
+
+ // If there's a failure, then report that
+ if (!$res) {
+ $this->page->ticketCreateInventoryFail = true;
+ }
+
+}
+
+// Get Ticket detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+$ticketDetail = $Tickets->getTicketDetail();
+$this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+$this->addDebug("Ticket/inventory.inc", 'Array: $ticketDetail', print_r($ticketDetail,1));
+
+// If ticket is date specific
+if ($ticketDetail['date_specific']['value']) {
+
+ // Get Ticket Inventory as calendar data
+ $ticketCalendar = $TicketInventory->getTicketInventoryCalendarData();
+ $this->page->ticketCalendar = $this->bindArrayToObject($ticketCalendar);
+ $this->addDebug("Ticket/inventory.inc", 'Array: $ticketCalendar', print_r($ticketCalendar,1));
+
+ $this->templateFile = 'Ticket/inventory.html';
+
+} else {
+
+ // Ticket is not date specific, so not using a calendar
+ $inventoryData = $TicketInventory->getTicketInventoryList(false, "ticket_date is null");
+ $this->page->inventoryData = $this->bindArrayToObject($inventoryData);
+ $this->addDebug("Ticket/inventory.inc", 'Array: $inventoryData', print_r($inventoryData,1));
+ $this->templateFile = 'Ticket/inventoryNoCalendar.html';
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/inventoryUpdate.inc b/models/admin/actions/Ticket/inventoryUpdate.inc
new file mode 100644
index 0000000..b04fb1b
--- /dev/null
+++ b/models/admin/actions/Ticket/inventoryUpdate.inc
@@ -0,0 +1,36 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: inventoryUpdate.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/ticketInventory.php';
+$TicketInventory = new EventManagementAdminTicketInventory($this->dbh, $this->config);
+
+// Process new record
+$r = $TicketInventory->updateTicketInventory();
+
+// If inventory is not date specific, simply redisplay form
+if (isset($_REQUEST['dateSpecific'])) {
+
+ // Redisplay form
+ $this->page->inventoryUpdated = true;
+ include(EVENT_MANAGEMENT_APP_BASE.'models/admin/actions/Ticket/inventory.inc');
+
+} else {
+
+ $this->templateFile = false; // No response expected
+
+ $this->addDebug("Ticket/inventoryUpdate.inc", 'Array: $r', print_r($r,1));
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/list.inc b/models/admin/actions/Ticket/list.inc
new file mode 100644
index 0000000..425dbf7
--- /dev/null
+++ b/models/admin/actions/Ticket/list.inc
@@ -0,0 +1,46 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: list.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+// Get Tickets stats
+$ticketsStats = $Tickets->getTicketsStats();
+$this->page->ticketsStats = $this->bindArrayToObject($ticketsStats);
+
+// If this is a member user then make sure they only list their own member tickets
+$type = false;
+$id = false;
+if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $type = 'member';
+ $id = $this->page->userMemberID;
+ // Also specify current memberID for other uses
+ $this->page->memberID = $id;
+
+// Otherwise if we already have a member selected they pass that for other uses
+} elseif ($_SESSION[GLM_EVENT_SESSION]['Member'] != false) {
+ $this->page->memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+} else {
+ $this->page->memberID = false;
+}
+
+// Get tickets list
+$tickets = $Tickets->getTicketsList($id, false, false, $type, false, false, true);
+$this->page->tickets = $this->bindArrayToObject($tickets);
+
+$this->templateFile = 'Ticket/list.html';
+
+$this->addDebug("Ticket/list.inc", 'Array: $tickets', print_r($tickets,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/printSampleVoucher.inc b/models/admin/actions/Ticket/printSampleVoucher.inc
new file mode 100644
index 0000000..dbf0b11
--- /dev/null
+++ b/models/admin/actions/Ticket/printSampleVoucher.inc
@@ -0,0 +1,145 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: printSampleVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get supplied ticket ID to use for test
+$testTicket = $_REQUEST['testTicket'] - 0;
+
+// Check for Coupon Test only
+$couponTest = false;
+if (isset($_REQUEST['testCoupons']) && $_REQUEST['testCoupons'] == 'true') {
+ $couponTest = true;
+}
+
+// Get Ticket Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+$Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+$Tickets->optionIncludeSelectListData = false;
+$ticketDetail = $Tickets->getTicketDetail($testTicket);
+
+// Get Section Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+$Sections = new EventManagementDataSections($this->dbh, $this->config);
+$Sections->optionIncludeSelectListData = false;
+$sectionDetail = $Sections->getSectionDetail($ticketDetail['section_id']);
+
+// Get Member Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMembers.php';
+$Members = new EventManagementDataMembers($this->dbh, $this->config);
+$Members->optionIncludeSelectListData = false;
+$memberDetail = $Members->getMemberDetail($ticketDetail['member']);
+
+// Get Performance Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPerformances.php';
+$Performances = new EventManagementDataPerformances($this->dbh, $this->config);
+$Performances->optionIncludeSelectListData = false;
+$performanceDetail = $Performances->getPerformanceDetail($ticketDetail['performance_id']);
+
+// Sample Order Detail
+$orderDetail = array(
+ 'id' => 12345678,
+ 'user_trace_info' => $_SERVER["REMOTE_ADDR"]." - ".date("m/d/Y H:i:s"),
+ 'fname' => 'John',
+ 'lname' => 'Smith',
+ 'addr1' => '120 E. Lake St.',
+ 'addr2' => 'Apt 123',
+ 'city' => 'Petoskey',
+ 'state' => 'MI',
+ 'country' => 'US',
+ 'zip' => '49770',
+ 'phone' => '231-487-0692',
+ 'email' => 'info@gaslightmedia.com',
+ 'email_ok' => true,
+ 'purchase_date' => date('m/d/Y'),
+ 'member' => $memberDetail['id'],
+ 'member_name' => $memberDetail['name'],
+ 'cctype' => 'VISA',
+ 'ccnumber' => '0011001100110011',
+ 'expire' => '01/19',
+ 'ccname' => 'JOHN SMITH',
+ 'ccconf' => '12312',
+ 'charge_numb' => 123.45,
+ 'charge_total' => '$123.45',
+ 'special_needs' => 'No special needs',
+ 'notes' => ''
+);
+
+// Sample Tickets Sold List
+$soldList = array(
+ 0 => array(
+ 'id' => 12345678,
+ 'ticket_order' => 11223344,
+ 'member' => $memberDetail['id'],
+ 'member_name' => $memberDetail['name'],
+ 'performance' => $performanceDetail['id'],
+ 'performance_name' => $performanceDetail['name'],
+ 'entrance' => 123,
+ 'entrance_name' => 'Test Entrance',
+ 'entrance_color' => '#FFB6C1',
+ 'section' => $sectionDetail['name'],
+ 'ticket' => $testTicket,
+ 'ticket_name' => $ticketDetail['title'],
+ 'date_specific' => $ticketDetail['date_specific'],
+ 'ticket_date' => array(
+ 'date' => ($ticketDetail['date_specific'] ? date('m/d/Y') : 'Use any date')
+ ),
+ 'ticket_time' => array(
+ 'time' => ($ticketDetail['time_specific'] ? '12:00 PM' : 'Use any time')
+ ),
+ 'start_date' => array('date' => $ticketDetail['start_date']),
+ 'end_date' => array('date' => $ticketDetail['end_date']['date']),
+ 'likely_date' => array('date' => '06/13/14'),
+ 'price_paid' => $this->money($ticketDetail['price']),
+ 'time_claimed' => false
+ ),
+ 1 => array(
+ 'id' => 12345679,
+ 'ticket_order' => 11223345,
+ 'member' => $memberDetail['id'],
+ 'member_name' => $memberDetail['name'],
+ 'performance' => $performanceDetail['id'],
+ 'performance_name' => $performanceDetail['name'],
+ 'entrance' => 123,
+ 'entrance_name' => 'Test Entrance',
+ 'entrance_color' => '#FFB6C1',
+ 'section' => $sectionDetail['name'],
+ 'ticket' => $testTicket,
+ 'ticket_name' => $ticketDetail['title'],
+ 'date_specific' => $ticketDetail['date_specific'],
+ 'ticket_date' => array(
+ 'date' => ($ticketDetail['date_specific'] ? date('m/d/Y') : 'Use any date')
+ ),
+ 'ticket_time' => array(
+ 'time' => ($ticketDetail['time_specific'] ? '12:00 PM' : 'Use any time')
+ ),
+ 'start_date' => array('date' => $ticketDetail['start_date']),
+ 'end_date' => array('date' => $ticketDetail['end_date']['date']),
+ 'likely_date' => array('date' => '06/13/14'),
+ 'price_paid' => $this->money($ticketDetail['price']),
+ 'time_claimed' => date('m/d/Y h:i:s A')
+ ),
+);
+
+// Load voucher design code as per the "voucher_design" config parameter in the site's config/applications/EventManagement.ini file
+if (is_file(EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucher.php')) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucher.php';
+ $pdf = new PdfVoucher($orderDetail, $soldList, $memberDetail, $this->dbh, $this->config, $couponTest);
+} else {
+ echo "SYSTEM ERROR: Site is not configured with a valid voucher design file.";
+ exit;
+}
+
+// There's nothing to do from here. Output should go direct to browser.
+exit;
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/selected.inc b/models/admin/actions/Ticket/selected.inc
new file mode 100644
index 0000000..28f4ad6
--- /dev/null
+++ b/models/admin/actions/Ticket/selected.inc
@@ -0,0 +1,50 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: selected.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+$ticketDetail = $Tickets->getTicketDetail();
+$this->page->ticketPackage = ($ticketDetail['ticket_type']['value']==20);
+$this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+$_SESSION[GLM_EVENT_SESSION]['Performance'] = $ticketDetail['performance_id'];
+
+// Also get Ticket inventory Stats - and check if none exist for this ticket
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/ticketInventory.php';
+$TicketInventory = new EventManagementAdminTicketInventory($this->dbh, $this->config);
+$ticketInventoryStats = $TicketInventory->getTicketTicketInventoryStats($ticketDetail['id']);
+
+// Check if we have inventory or need to create it
+$this->page->noTicketInventory = true;
+if ($ticketInventoryStats > 0) {
+ $this->page->noTicketInventory = false;
+} else {
+
+ // Try to create default ticket inventory
+ $TicketInventory->generateDefaultTicketInventory();
+
+ // Get inventory stats again
+ $ticketInventoryStats = $TicketInventory->getTicketTicketInventoryStats($ticketDetail['id']);
+
+ if ($ticketInventoryStats > 0) {
+ $this->page->noTicketInventory = false;
+ }
+}
+
+$this->templateFile = 'Ticket/selected.html';
+
+$this->addDebug("Ticket/selected.inc", 'Ticket Detail', print_r($ticketDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/setActive.inc b/models/admin/actions/Ticket/setActive.inc
new file mode 100644
index 0000000..956f028
--- /dev/null
+++ b/models/admin/actions/Ticket/setActive.inc
@@ -0,0 +1,28 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: setActive.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get ticket inventory ID and desired status
+$ticketInventoryID = ($_REQUEST['TicketInventoryID'] - 0);
+$ticketInventoryStatus = ($_REQUEST['TicketInventoryStatus'] - 0); // 0 if false, 1 if true
+if ($ticketInventoryID > 0 && $ticketInventoryStatus > -1 && $ticketInventoryStatus < 2) {
+ $active = ($ticketInventoryStatus == 1 ? 'true' : 'false');
+ $sql = "UPDATE eventmgt.ticket_inventory SET active = $active WHERE id = $ticketInventoryID;";
+ $this->dbh->exec($sql);
+}
+
+$this->templateFile = false; // No response expected
+
+$this->addDebug("Ticket/setActive.inc", "ID: $ticketInventoryID, Set active to: $active ");
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/Ticket/update.inc b/models/admin/actions/Ticket/update.inc
new file mode 100644
index 0000000..12c7f5e
--- /dev/null
+++ b/models/admin/actions/Ticket/update.inc
@@ -0,0 +1,56 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: update.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+// Process new record
+$r = $Tickets->updateTicket();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->ticketDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// Get currently stored data for fields that are display only
+$ticketDetail = $Tickets->getTicketDetail();
+$this->page->storedDetail = $this->bindArrayToObject($ticketDetail);
+
+// Check for changes in selected package tickets
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+$TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+$this->page->isPackage = false;
+if ($ticketDetail['ticket_type']['value'] == 20) {
+ $packageData = $TicketPackages->updatePackageTicketsList($ticketDetail['id']);
+ $this->page->isPackage = true;
+ $this->page->ticketPackage = $this->bindArrayToObject($packageData);
+// Otherwise make sure there's no package tickets
+} else {
+ $TicketPackages->clearPackageTicketsList($ticketDetail['id']);
+}
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingTicket = true;
+ $this->templateFile = 'Ticket/edit.html';
+} else {
+ $this->templateFile = 'Ticket/detail.html';
+}
+
+$this->addDebug("Ticket/update.inc", 'Array: $r', print_r($r,1));
+
+?>
diff --git a/models/admin/actions/User/login.inc b/models/admin/actions/User/login.inc
new file mode 100644
index 0000000..362fc44
--- /dev/null
+++ b/models/admin/actions/User/login.inc
@@ -0,0 +1,17 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: login.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->templateFile = 'User/loginForm.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/add.inc b/models/admin/actions/VoucherCoupon/add.inc
new file mode 100755
index 0000000..11e6573
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/add.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: add.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+$r = $VoucherCoupons->newVoucherCoupon();
+
+$this->page->voucherCouponDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+$this->page->addingNewVoucherCoupon = true;
+
+$this->templateFile = 'VoucherCoupon/edit.html';
+
+$this->addDebug("VoucherCoupon/add.inc", 'Array: $r', print_r($r,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/confirmDelete.inc b/models/admin/actions/VoucherCoupon/confirmDelete.inc
new file mode 100755
index 0000000..b8b7deb
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/confirmDelete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: confirmDelete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+$voucherCouponDetail = $VoucherCoupons->voucherCouponDelete(true);
+$this->page->voucherCouponDetail = $this->bindArrayToObject($voucherCouponDetail);
+
+$this->templateFile = 'VoucherCoupon/detail.html';
+
+$this->addDebug("VoucherCoupon/confirmDelete.inc", 'Section Confirm Delete', print_r($voucherCouponDetail,1));
+
+?>
+
diff --git a/models/admin/actions/VoucherCoupon/delete.inc b/models/admin/actions/VoucherCoupon/delete.inc
new file mode 100755
index 0000000..44811c3
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/delete.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: delete.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+$voucherCouponDetail = $VoucherCoupons->voucherCouponDelete(false);
+$this->page->voucherCouponDetail = $this->bindArrayToObject($voucherCouponDetail);
+
+$this->templateFile = 'VoucherCoupon/delete.html';
+
+$this->addDebug("VoucherCoupon/delete.inc", 'Array: $$voucherCouponDetail', print_r($voucherCouponDetail,1));
+
+?>
+
diff --git a/models/admin/actions/VoucherCoupon/detail.inc b/models/admin/actions/VoucherCoupon/detail.inc
new file mode 100644
index 0000000..9724e8e
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/detail.inc
@@ -0,0 +1,26 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: detail.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+// Get Voucher Coupon detail
+$voucherCouponDetail = $VoucherCoupons->getVoucherCouponDetail();
+$this->page->voucherCouponDetail = $this->bindArrayToObject($voucherCouponDetail);
+
+$this->templateFile = 'VoucherCoupon/detail.html';
+
+$this->addDebug("VoucherCoupon/detail.inc", 'Array: $voucherCouponDetail', print_r($voucherCouponDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/edit.inc b/models/admin/actions/VoucherCoupon/edit.inc
new file mode 100755
index 0000000..f036c3a
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/edit.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: edit.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+$voucherCouponDetail = $VoucherCoupons->editVoucherCoupon();
+$this->page->voucherCouponDetail = $this->bindArrayToObject($voucherCouponDetail);
+
+$this->page->editingVoucherCoupon = true;
+
+$this->templateFile = 'VoucherCoupon/edit.html';
+
+$this->addDebug("VoucherDetail/edit.inc", 'Array: $voucherCouponDetail', print_r($voucherCouponDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/insert.inc b/models/admin/actions/VoucherCoupon/insert.inc
new file mode 100755
index 0000000..6509fe9
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/insert.inc
@@ -0,0 +1,43 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: insert.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+// Process new record
+$r = $VoucherCoupons->insertVoucherCoupon();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->voucherCouponDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewVoucherCoupon = true;
+ $this->templateFile = 'VoucherCoupon/edit.html';
+} else {
+
+ $voucherCouponID = $r['fieldData']['id'];
+
+ $this->templateFile = 'VoucherCoupon/selected.html';
+}
+
+$this->addDebug("VoucherCoupon/insert.inc", 'Array: $r', print_r($r,1));
+
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/list.inc b/models/admin/actions/VoucherCoupon/list.inc
new file mode 100755
index 0000000..f2e2414
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/list.inc
@@ -0,0 +1,30 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: list.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+// Get Voucher Coupon stats
+$voucherCouponStats = $VoucherCoupons->getVoucherCouponsStats();
+$this->page->voucherCouponStats = $this->bindArrayToObject($voucherCouponStats);
+
+// Get Voucher Coupons list
+$voucherCouponsList = $VoucherCoupons->getVoucherCouponList();
+$this->page->voucherCoupons = $this->bindArrayToObject($voucherCouponsList);
+
+$this->templateFile = 'VoucherCoupon/list.html';
+
+$this->addDebug("VoucherCoupon/list.inc", 'Array: $voucherCouponsList', print_r($voucherCouponsList, 1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/selected.inc b/models/admin/actions/VoucherCoupon/selected.inc
new file mode 100755
index 0000000..a303ff0
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/selected.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: selected.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+$voucherCouponDetail = $VoucherCoupons->getVoucherCouponDetail();
+$this->page->voucherCouponDetail = $this->bindArrayToObject($voucherCouponDetail);
+
+$this->templateFile = 'VoucherCoupon/selected.html';
+
+$this->addDebug("VoucherCoupon/selected.inc", 'Voucher Coupon Detail', print_r($voucherCouponDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/test.inc b/models/admin/actions/VoucherCoupon/test.inc
new file mode 100755
index 0000000..e1a5dc8
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/test.inc
@@ -0,0 +1,25 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: test.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+$voucherCouponDetail = $VoucherCoupons->newVoucherCoupon();
+$this->page->voucherCouponDetail = $this->bindArrayToObject($voucherCouponDetail);
+
+$this->templateFile = 'VoucherCoupon/test.html';
+
+$this->addDebug("VoucherDetail/test.inc", 'Array: $voucherCouponDetail', print_r($voucherCouponDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/VoucherCoupon/update.inc b/models/admin/actions/VoucherCoupon/update.inc
new file mode 100755
index 0000000..defc044
--- /dev/null
+++ b/models/admin/actions/VoucherCoupon/update.inc
@@ -0,0 +1,38 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: update.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/voucherCoupons.php';
+$VoucherCoupons = new EventManagementAdminVoucherCoupons($this->dbh, $this->config);
+
+// Process new record
+$r = $VoucherCoupons->updateVoucherCoupon();
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->voucherCouponDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+// If invalid submission
+if (!$status) {
+ $this->page->editingVoucherCoupon = true;
+ $this->templateFile = 'VoucherCoupon/edit.html';
+ $this->addDebug("VoucherCoupon/update.inc", 'Array: $r', print_r($r,1));
+} else {
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/actions/VoucherCoupon/detail.inc';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/inventory/add.inc b/models/admin/actions/inventory/add.inc
new file mode 100644
index 0000000..1907907
--- /dev/null
+++ b/models/admin/actions/inventory/add.inc
@@ -0,0 +1,40 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/inventory.php';
+$Inventory = new EventManagementAdminInventory($this->dbh, $this->config);
+
+
+// Check for member ID supplied and force to a number
+$this->page->defMember = false;
+if (isset($_REQUEST['member'])) {
+ $this->page->defMember = ($_REQUEST['member'] - 0);
+}
+
+$r = $Inventory->addInven();
+
+if (isset($r['reason'])) {
+ $this->reason = array_merge($this->reason, $r['reason']);
+}
+
+$this->page->invenDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->membAccom = $this->bindArrayToObject($r['membAccom']);
+
+$this->page->addingNewInven = true;
+
+$this->templateFile = 'Inventory/EditInventory.html';
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/inventory/detail.inc b/models/admin/actions/inventory/detail.inc
new file mode 100644
index 0000000..af25856
--- /dev/null
+++ b/models/admin/actions/inventory/detail.inc
@@ -0,0 +1,27 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/inventory.php';
+$Inventory = new EventManagementAdminInventory($this->dbh, $this->config);
+
+
+// Get inventory itme detail
+$invenDetail = $Inventory->getInvenDetail();
+$this->page->invenDetail = $this->bindArrayToObject($invenDetail);
+
+$this->templateFile = 'Inventory/InventoryDetail.html';
+
+$this->addDebug("Inventory/detail.inc", 'Inventory Detail', print_r($invenDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/inventory/edit.inc b/models/admin/actions/inventory/edit.inc
new file mode 100644
index 0000000..055f28c
--- /dev/null
+++ b/models/admin/actions/inventory/edit.inc
@@ -0,0 +1,31 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/inventory.php';
+$Inventory = new EventManagementAdminInventory($this->dbh, $this->config);
+
+
+$invenDetail = $Inventory->editInven();
+$this->page->invenDetail = $this->bindArrayToObject($invenDetail);
+
+// We need this to mimic stored detail for edit templates that show this on entry to edit
+$this->page->storedDetail = $this->bindArrayToObject($invenDetail);
+
+$this->page->editingInven = true;
+
+$this->templateFile = 'Inventory/EditInventory.html';
+
+$this->addDebug("Inventory/edit.inc", 'Edit Inventory', print_r($invenDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/inventory/insert.inc b/models/admin/actions/inventory/insert.inc
new file mode 100644
index 0000000..4452cee
--- /dev/null
+++ b/models/admin/actions/inventory/insert.inc
@@ -0,0 +1,48 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/inventory.php';
+$Inventory = new EventManagementAdminInventory($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Inventory->insertInven();
+
+if (isset($r['reason'])) {
+ $this->reason = array_merge($this->reason, $r['reason']);
+}
+
+// Get success status, false = fail
+$status = $r['status'];
+$this->page->formFail = !$status;
+
+$this->page->invenDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+$this->page->membSelected = $this->bindArrayToObject($r['membSelected']);
+$this->page->membAccom = $this->bindArrayToObject($r['membAccom']);
+// $this->page->lt = '<'; // needed to avoid breaking javascript
+
+// If invalid submission
+if (!$status) {
+ $this->page->addingNewInven = true;
+ $this->templateFile = 'Inventory/EditInventory.html';
+} else {
+ // Inventory added, so display data on the last inventory item stored.
+ $invenDetail = $Inventory->getInvenDetail($r['insertedID']);
+ $this->page->invenDetail = $this->bindArrayToObject($invenDetail);
+ $this->templateFile = 'Inventory/InventoryDetail.html';
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/inventory/list.inc b/models/admin/actions/inventory/list.inc
new file mode 100644
index 0000000..05e6bc1
--- /dev/null
+++ b/models/admin/actions/inventory/list.inc
@@ -0,0 +1,68 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/inventory.php';
+$Inventory = new EventManagementAdminInventory($this->dbh, $this->config);
+
+
+// Get inventory stats
+$invenStats = $Inventory->getInvenStats();
+$this->page->invenStats = $this->bindArrayToObject($invenStats);
+
+// Get inventory list
+$i = $Inventory->getInvenList();
+$inventory = $i['inventory'];
+
+// If there's member results, then sort them
+if (is_array($i['sum'])) {
+ // Sort members under each event listed
+ function sortByMember($a, $b)
+ {
+ if ($a['name'] > $b['name']) {
+ return 1;
+ } elseif ($b['name'] > $a['name']) {
+ return -1;
+ }
+ return 0;
+ }
+ while (list($k, $v) = each($i['sum'])) {
+ uasort($v['memb'], 'sortByMember');
+ $i['sum'][$k] = $v;
+ }
+}
+
+$this->page->inventoryList = $this->bindArrayToObject($inventory);
+$this->page->dates = $this->bindArrayToObject($i['dates']);
+if ($i['have_sum']) {
+ $this->page->summary = $this->bindArrayToObject($i['sum']);
+}
+
+$this->page->have_summary = $i['have_sum'];
+
+$d = getdate($i['firstDate']);
+
+$this->page->firstInventoryDay = $d['mday'];
+$this->page->firstInventoryMonth = $d['mon'] - 1;
+$this->page->firstInventoryYear = $d['year'];
+
+if ($i['type'] == 'Summary') {
+ $this->templateFile = 'Inventory/InventoryListSummary.html';
+} else {
+ $this->page->memberName = $i['inventory'][0]['member'];
+ $this->templateFile = 'Inventory/InventoryListCalendar.html';
+}
+
+$this->addDebug("Inventory/list.inc", 'Inventory List', print_r($i,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/inventory/selected.inc b/models/admin/actions/inventory/selected.inc
new file mode 100644
index 0000000..e2fbd3e
--- /dev/null
+++ b/models/admin/actions/inventory/selected.inc
@@ -0,0 +1,49 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: selected.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+$Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+
+$ticketDetail = $Tickets->getTicketDetail();
+$this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+$_SESSION[GLM_EVENT_SESSION]['Performance'] = $ticketDetail['performance_id'];
+
+// Also get Ticket inventory Stats - and check if none exist for this ticket
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/ticketInventory.php';
+$TicketInventory = new EventManagementAdminTicketInventory($this->dbh, $this->config);
+$ticketInventoryStats = $TicketInventory->getTicketTicketInventoryStats($ticketDetail['id']);
+
+// Check if we have inventory or need to create it
+$this->page->noTicketInventory = true;
+if ($ticketInventoryStats > 0) {
+ $this->page->noTicketInventory = false;
+} else {
+
+ // Try to create default ticket inventory
+ $TicketInventory->generateDefaultTicketInventory();
+
+ // Get inventory stats again
+ $ticketInventoryStats = $TicketInventory->getTicketTicketInventoryStats($ticketDetail['id']);
+
+ if ($ticketInventoryStats > 0) {
+ $this->page->noTicketInventory = false;
+ }
+}
+
+$this->templateFile = 'Ticket/selected.html';
+
+$this->addDebug("Ticket/selected.inc", 'Ticket Detail', print_r($ticketDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/actions/inventory/update.inc b/models/admin/actions/inventory/update.inc
new file mode 100644
index 0000000..f7e6cd0
--- /dev/null
+++ b/models/admin/actions/inventory/update.inc
@@ -0,0 +1,50 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/inventory.php';
+$Inventory = new EventManagementAdminInventory($this->dbh, $this->config);
+
+
+// Process new record
+$r = $Inventory->updateInven();
+
+// Get success status and reasons and save to add after getInvenDetail() below
+$status = $r['status'];
+$reason = $r['reason'];
+$this->page->formFail = !$status;
+
+$this->page->invenDetail = $this->bindArrayToObject($r['fieldData']);
+$this->page->fieldRequired = $this->bindArrayToObject($r['fieldRequired']);
+$this->page->fieldFail = $this->bindArrayToObject($r['fieldFail']);
+
+
+// If invalid submission
+if (!$status) {
+ $this->reason = $r['reason'];
+ $this->page->storedDetail = $this->bindArrayToObject($r);
+ $this->page->editingInven = true;
+ $this->templateFile = 'Inventory/EditInventory.html';
+
+} else {
+
+ // Get currently stored data for fields that are display only
+ $invenDetail = $Inventory->getInvenDetail();
+ $this->page->storedDetail = $this->bindArrayToObject($invenDetail);
+ $this->templateFile = 'Inventory/InventoryDetail.html';
+
+}
+
+$this->addDebug("Inventory/update.inc", 'Update Inventory', print_r($feeDetail,1));
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/accommodations.php b/models/admin/classes/accommodations.php
new file mode 100644
index 0000000..8aea93c
--- /dev/null
+++ b/models/admin/classes/accommodations.php
@@ -0,0 +1,80 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/accommodations.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataAccoms.php';
+
+/**
+ * EventManagementAdminAccoms class
+ *
+ * Event Management and Reservations System - Admin Code - Accommodations section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Accommodations
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/accommodations.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/admin/EventManagement
+ */
+class EventManagementAdminAccoms extends EventManagementDataAccoms
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ /**
+ * Get Accommodations Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberAccomsStats()
+ {
+ // Get member ID from session - if available get stats for member
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ return $this->getStats("member = $memberID");
+ }
+ return 0;
+ }
+ function getAccomsStats()
+ {
+ $accomsStats = array(
+ 'all' => $this->getStats(),
+ 'member' => $this->getMemberAccomsStats()
+ );
+
+ return $accomsStats;
+ }
+
+
+}
+
+?>
+
diff --git a/models/admin/classes/addons.php b/models/admin/classes/addons.php
new file mode 100644
index 0000000..d37d165
--- /dev/null
+++ b/models/admin/classes/addons.php
@@ -0,0 +1,81 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/addons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataAddons.php';
+
+/**
+ * EventManagementAdminAddons class
+ *
+ * Event Management and Reservations System - Admin Code - Add-Ons section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Add-Ons
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/addons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminAddons extends EventManagementDataAddons
+{
+ /**
+ * Configuration information object
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $data
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Add-Ons Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketAddonsStats($ticketID = false)
+ {
+ // Get ticket ID from session - if available get stats for ticket Add-ons
+ if ($ticketID || ($ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+ return $this->getStats("ticket = $ticketID");
+ }
+ return 0;
+ }
+ function getAddonStats()
+ {
+ $addonStats = array(
+ 'all' => $this->getStats(),
+ 'ticket' => $this->getTicketAddonStats()
+ );
+
+ return $addonStats;
+ }
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/addonsSold.php b/models/admin/classes/addonsSold.php
new file mode 100644
index 0000000..1dd1073
--- /dev/null
+++ b/models/admin/classes/addonsSold.php
@@ -0,0 +1,57 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/addonsSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataAddonSold.php';
+
+/**
+ * EventManagementAdminAddonsSold class
+ *
+ * Event Management and Reservations System - Admin Code - Sold Ticket add-ons
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/addonsSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementAdminAddonsSold extends EventManagementDataAddonSold
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/attendance.php b/models/admin/classes/attendance.php
new file mode 100755
index 0000000..1d92d3d
--- /dev/null
+++ b/models/admin/classes/attendance.php
@@ -0,0 +1,70 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/addons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataAttendance.php';
+
+/**
+ * EventManagementAdminAttendance class
+ *
+ * Event Management and Reservations System - Admin Code - Attendance section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Attendance
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/attendance.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminAttendance extends EventManagementDataAttendance
+{
+ /**
+ * Configuration information object
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $data
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Attendance Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAttendanceStats($performanceID = false)
+ {
+ // Get performance ID from session
+ if ($performanceID || ($performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+ return $this->getStats("performance = $performanceID");
+ }
+ return 0;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/blocks.php b/models/admin/classes/blocks.php
new file mode 100644
index 0000000..f5f36d0
--- /dev/null
+++ b/models/admin/classes/blocks.php
@@ -0,0 +1,1025 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/blocks.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+/**
+ * EventManagementAdminBookings class
+ *
+ * Event Management and Reservations System - Admin Code - Bookings section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/bookings.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ *
+ * NOTE: This class does not currently have a DataBlocks class to extend
+ * because we don't seem to want the lower-level data definitions for this class.
+ */
+class EventManagementAdminBlocks
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ $this->dbh = $dbh;
+ $this->config = $config;
+
+ }
+
+ /**
+ * Get Blocks Summary
+ *
+ * @return object containing array as sub-objects
+ */
+ function getBlocksSummary($event = false, $sort = true)
+ {
+
+ // Check for valid Event
+ if ($event) {
+ $eventID = $event;
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ // Get the event ID from the session
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Otherwise, we don't have a member id
+ return false;
+ }
+
+ // Need to make sure this is a team event - Don't do blocks for a non-team event!
+ $sql = "SELECT team_event FROM eventmgt.event WHERE id = $eventID";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $event = $stmt->fetch(PDO::FETCH_ASSOC);
+ if (!$event['team_event']) {
+ return false;
+ }
+
+ // Get list of Members (properties) along with blocks and inventory stats
+ $sql = "
+ SELECT R.id AS memb_id,
+ R.name AS memb_name,
+ M.street AS addr,
+ M.lat,
+ M.lon,
+ C.city_name AS city,
+ A.id AS accom_id,
+ A.name AS accom_name,
+ I.assigned AS rooms,
+ ( SELECT COUNT(B.id) FROM eventmgt.room_block B WHERE B.member = R.id AND B.conv = $eventID ) AS room_blocks,
+ COALESCE (S.block, 0) AS block_numb,
+ COALESCE (S.allocated, 0) AS allocated,
+ ( SELECT COUNT(B.block_name) FROM eventmgt.room_block B WHERE B.member = R.id AND b.conv = $eventID ) AS block_count
+ FROM eventmgt.member R,
+ member.member M,
+ inventory I,
+ city C,
+ accommodation A
+ LEFT OUTER JOIN room_block_seg S ON (S.accommodation = A.id AND S.conv = $eventID)
+ WHERE I.member = R.id
+ AND A.member = R.id
+ AND I.accommodation = A.id
+ AND I.conv = $eventID
+ AND M.member_id = R.id
+ AND C.city_id = M.city_id
+ GROUP BY R.id, A.id, I.assigned, R.name, M.street, M.lat, M.lon, C.city_name, A.name, S.block, S.allocated
+ ORDER BY R.name, A.id
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $memb_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // If there's no results then fail
+ if (!$memb_data) {
+ return false;
+ }
+
+ // Add distances to the member data and sort by distance
+ if(class_exists('EventManagementGeoCalculations') != true) {
+ require '../../classes/GeoCalculations.php';
+ }
+ $Geo = new EventManagementGeoCalculations($this->dbh);
+ $memb_data = $Geo->getMemberEventDistance( $eventID, $memb_data, 'lat', 'lon', 'distance', 'duration', 'memb_id', $sort);
+
+ // Compile summary from list
+ $r = array();
+ foreach ($memb_data as $m) {
+
+ // If member entry has not been created
+ if (!isset($r[$m['memb_id']])) {
+
+ $r[$m['memb_id']] = array(
+ 'id' => $m['memb_id'],
+ 'name' => addslashes($m['memb_name']),
+ 'distance' => $m['distance'],
+ 'street' => $m['addr'],
+ 'city' => $m['city'],
+ 'blocks' => $m['room_blocks'],
+ 'rooms' => 0,
+ 'allocated' => 0,
+ 'unallocated' => 0,
+ 'all_allocated' => false,
+ 'alert' => false,
+ 'accom' => array()
+ );
+ }
+
+ // If accommodation entry has not been created
+ if (!isset($r[$m['memb_id']]['accom'][$m['accom_id']])) {
+
+ // Add this accomodation
+ $r[$m['memb_id']]['accom'][$m['accom_id']] = array(
+ 'id' => $m['accom_id'],
+ 'name' => $m['accom_name'],
+ 'rooms' => $m['rooms'],
+ 'allocated' => 0,
+ 'all_allocated' => false,
+ 'alert' => false
+ );
+
+ $r[$m['memb_id']]['rooms'] += $m['rooms'];
+ $r[$m['memb_id']]['unallocated'] += $m['rooms'];
+
+ }
+ // tally assingments and allocation for this member
+ $r[$m['memb_id']]['allocated'] += $m['allocated'];
+ $r[$m['memb_id']]['unallocated'] -= $m['allocated'];
+ if ($r[$m['memb_id']]['unallocated'] <= 0) {
+ $r[$m['memb_id']]['all_allocated'] = true;
+ }
+
+ // Check for mixed inventory levels across dates for this accommodation
+ if ($r[$m['memb_id']]['accom'][$m['accom_id']]['rooms'] != $m['rooms']) {
+ // Oops! We have multiple results for the same accommodation with different assigned inventory levels.
+ // This means we don't have the same amount of inventory assigned for all of the dates
+ // User must check inventory for this accommodation for this event
+ $r[$m['memb_id']]['accom'][$m['accom_id']]['alert'] = true;
+ $r[$m['memb_id']]['alert'] = true;
+ }
+
+ // Insert allocated data for this block
+ $r[$m['memb_id']]['accom'][$m['accom_id']]['allocated'] += $m['allocated'];
+ if ($r[$m['memb_id']]['accom'][$m['accom_id']]['rooms'] - $r[$m['memb_id']]['accom'][$m['accom_id']]['allocated'] <= 0) {
+ $r[$m['memb_id']]['accom'][$m['accom_id']]['all_allocated'] = true;
+ }
+
+ }
+
+ // echo "getBlocksSummary()
".print_r($r,1)."
";
+ return $r;
+
+
+ }
+
+ /**
+ * Get Blocks Detail and Management Screen
+ *
+ * @return object containing array as sub-objects
+ */
+ function getBlocksDetail()
+ {
+ // Check for valid Event
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ // Get the event ID from the session
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Otherwise, we don't have a member id
+ return false;
+ }
+
+ // Need to make sure this is a team event - Don't do blocks for a non-team event!
+ $sql = "SELECT team_event FROM eventmgt.event WHERE id = $eventID";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $event = $stmt->fetch(PDO::FETCH_ASSOC);
+ if (!$event['team_event']) {
+ return false;
+ }
+
+ // Get the specified Member
+ if (!($membID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+ return false;
+ }
+ $sql = "SELECT name FROM eventmgt.member WHERE id = $membID";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $memberData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Get inventory data for this member for this event
+ $sql = "
+ SELECT DISTINCT(I.assigned) AS rooms,
+ A.id AS accom_id,
+ A.name AS accom_name,
+ a.sort
+ FROM eventmgt.inventory I, eventmgt.accommodation A
+ WHERE I.member = $membID
+ AND I.conv = $eventID
+ AND A.id = I.accommodation
+ ORDER BY A.sort
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $accom_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Build accommodation type array and short version array to use for building block data
+ $accoms = array();
+ $a_array = array();
+ $a_count = 1;
+ foreach ($accom_data as $a) {
+
+ // Check for duplicate accommodation type - indicates inconsistent quantities
+ if (isset($a_array[$a['accom_id']])) {
+ $accoms[$a['accom_id']]['alert'] = true;
+ }
+
+ $accoms[$a['accom_id']] = array(
+ 'accom_numb' => $a_count,
+ 'id' => $a['accom_id'],
+ 'name' => $a['accom_name'],
+ 'rooms' => $a['rooms'],
+ 'alert' => false
+ );
+
+ $a_array[$a['accom_id']] = array(
+ 'accom_numb' => $a_count,
+ 'id' => false,
+ 'allocated' => 0,
+ 'accom_id' => $a['accom_id'],
+ );
+
+ $a_count++;
+
+ }
+
+ // Get all related block data
+ $sql = "
+ SELECT R.id AS block_id,
+ R.block_name AS block_name,
+ R.state_rep AS state_rep,
+ coalesce((SELECT code FROM eventmgt.state_rep P WHERE P.id = R.state_rep), '') AS state_code,
+ R.team AS team,
+ S.id AS seg_id,
+ S.accommodation AS accom_id,
+ S.allocated AS allocated
+ FROM eventmgt.room_block R, eventmgt.room_block_seg S
+ WHERE R.member = $membID
+ AND R.conv = $eventID
+ AND S.block = R.id
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $block_segs = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Build list of blocks with assignments
+ $blocks = array();
+ $blockCounter = 1;
+ foreach ($block_segs as $s) {
+
+ // If the block hasn't been created yet
+ if (!isset($blocks[$s['block_id']])) {
+ $blocks[$s['block_id']] = array(
+ 'block_numb' => $blockCounter++,
+ 'id' => $s['block_id'],
+ 'name' => $s['block_name'],
+ 'segments' => $a_array,
+ 'assigned' => $s['state_code']
+ );
+ }
+
+ // Add this segment to the block
+ $blocks[$s['block_id']]['segments'][$s['accom_id']] = array(
+ 'accom_numb' => $accoms[$s['accom_id']]['accom_numb'],
+ 'id' => $s['seg_id'],
+ 'allocated' => $s['allocated'],
+ 'accom_id' => $s['accom_id']
+ );
+
+ }
+
+ $r = array(
+ 'memberID' => $membID,
+ 'memberName' => $memberData['name'],
+ 'accomData' => $accoms,
+ 'blockData' => $blocks,
+ 'lineLength' => (count($accoms)+1),
+ 'numbAccoms' => count($accoms),
+ 'nextBlock' => $blockCounter,
+ 'nextBlock2' => ($blockCounter +1)
+ );
+
+ $this->addDebug("classes/blocks.inc", 'getBlocksDetail()', print_r($r,1));
+
+ return $r;
+
+ }
+
+ /**
+ * Update Blocks Detail and Management Screen
+ *
+ * @return object containing array as sub-objects
+ */
+ function updateBlocksDetail()
+ {
+ // Assume everything works fine
+ $status = true;
+
+ // Check for valid Event
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ // Get the event ID from the session
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Otherwise, we don't have a member id
+ return false;
+ }
+
+ // Need to make sure this is a team event - Don't do blocks for a non-team event!
+ $sql = "SELECT team_event FROM eventmgt.event WHERE id = $eventID";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $event = $stmt->fetch(PDO::FETCH_ASSOC);
+ if (!$event['team_event']) {
+ return false;
+ }
+
+ // Get the specified Member
+ if (!($membID = filter_input(INPUT_POST, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+ return false;
+ }
+
+ // Get accomodation/inventory data for this member for this event
+ $sql = "
+ SELECT DISTINCT(I.assigned) AS rooms,
+ A.id AS accom_id,
+ A.name AS accom_name,
+ a.sort
+ FROM eventmgt.inventory I, eventmgt.accommodation A
+ WHERE I.member = $membID
+ AND I.conv = $eventID
+ AND A.id = I.accommodation
+ ORDER BY A.sort
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $accom_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Build accommodation type array
+ $accoms = array();
+ $a_array = array();
+ $a_count = 1;
+ foreach ($accom_data as $a) {
+
+ // Check for duplicate accommodation type - indicates inconsistent quantities
+ if (isset($a_array[$a['accom_id']])) {
+ $accoms[$a['accom_id']]['alert'] = true;
+ }
+
+ $accoms[$a_count] = array(
+ 'accom_numb' => $a_count,
+ 'id' => $a['accom_id'],
+ 'name' => $a['accom_name'],
+ 'rooms' => $a['rooms'],
+ 'alert' => false
+ );
+
+ $a_count++;
+
+ }
+
+ // Get existing room block data for this event/member
+ $sql = "
+ SELECT *
+ FROM eventmgt.room_block
+ WHERE conv = $eventID
+ AND member = $membID
+ ORDER BY id
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $block_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // For each block submitted
+ $blocks = array();
+ $block = 1;
+ while (isset($_REQUEST['seg_'.$block.'_1'])) {
+
+ // Create an entry for this block
+ $blocks[$block] = array(
+ 'numb' => $block,
+ 'block_id' => false,
+ 'sql' => false,
+ 'segs' => array()
+ );
+
+ // For each accommodation
+ for ($accom=1 ; $accom<$a_count ; $accom++) {
+
+ // Create an entry for this accom
+ $blocks[$block]['segs'][$accom] = array(
+ 'numb' => $accom,
+ 'seg_id' => false,
+ 'sql' => false,
+ 'new_block' => false,
+ 'quant' => 0
+ );
+
+ // Check if there was an existing entry
+ if ( isset($_REQUEST['current_'.$block.'_'.$accom]) &&
+ ($current = filter_input(INPUT_POST, 'current_'.$block.'_'.$accom, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES))) {
+ $x = explode(',', $current);
+ $blocks[$block]['block_id'] = $x[0];
+ $blocks[$block]['segs'][$accom]['seg_id'] = $x[1];
+ }
+
+ // Get inventory quantity for this segment
+ if (($quant = filter_input(INPUT_POST, 'seg_'.$block.'_'.$accom, FILTER_SANITIZE_NUMBER_INT))) {
+ $blocks[$block]['segs'][$accom]['quant'] = $quant;
+ }
+
+ }
+
+ $block++;
+ }
+
+ // Get some data on the existing blocks
+ $sql = "SELECT MAX(state_rep) AS max_rep,
+ MAX(team) AS max_team,
+ MAX(block_name) AS max_name
+ FROM eventmgt.room_block
+ WHERE conv = $eventID
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $block_stats = $stmt->fetch(PDO::FETCH_ASSOC);
+ $next_block_name = $block_stats['max_name'] + 1;
+
+ // We should now have all the block and segment data so start building queries to update - for each block
+ $sql = array();
+ foreach ($blocks as $b) {
+
+ $block_total = 0; // Total number of rooms for this block
+
+ // For each block segment
+ foreach ($b['segs'] as $s) {
+
+ // Add the number of rooms in this segment to the block total
+ $block_total += $s['quant'];
+
+ // If the segment is already in the database - update it
+ if ($s['seg_id']) {
+
+ // If the segment now 0 then delete it
+ if ($s['quant'] == false || $s['quant'] == 0) {
+ $blocks[$b['numb']]['segs'][$s['numb']]['sql'] = "DELETE FROM eventmgt.room_block_seg WHERE id = ".$s['seg_id'].";";
+
+ // Otherwise we're going to update it
+ } else {
+ $blocks[$b['numb']]['segs'][$s['numb']]['sql'] = "UPDATE room_block_seg SET allocated = ".$s['quant'].", available = ".$s['quant']." WHERE id = ".$s['seg_id'].";";
+ }
+
+ // Othewise it's a new segment and it's not 0 add it
+ } elseif ($s['quant'] != false && $s['quant'] > 0) {
+
+ // If we already have a block ID, use the block number
+ if ($blocks[$b['numb']]['block_id'] != false) {
+ $bval = $blocks[$b['numb']]['block_id'];
+
+ // Otherwise we'll be adding the block so use the last sequence value for the block ID
+ } else {
+ $bval = "currval('room_block_id_seq')";
+ }
+
+ // Create the block segement insert query
+ $blocks[$b['numb']]['segs'][$s['numb']]['sql'] = "
+ INSERT INTO eventmgt.room_block_seg
+ (block, conv, accommodation, allocated, available)
+ VALUES
+ ($bval, $eventID, ".$accoms[$s['numb']]['id'].", ".$s['quant'].", ".$s['quant'].")
+ ;";
+ }
+
+ }
+
+ // If block is empty
+ if ($block_total == 0) {
+
+ // If the block existed, then delete it
+ if ($b['block_id'] != false) {
+ $blocks[$b['numb']]['sql'] = "DELETE FROM eventmgt.room_block WHERE id = ".$b['block_id'].";";
+ }
+
+ // Otherwise if this is a new block
+ } elseif ($b['block_id'] == false) {
+ $blocks[$b['numb']]['sql'] = "
+ INSERT INTO eventmgt.room_block
+ (conv, member, state_rep, team, block_name)
+ VALUES
+ ($eventID, $membID, 0, 0, ".$next_block_name++.")
+ ;";
+ $blocks[$b['numb']]['new_block'] = true;
+
+ } // Note that we don't have to update the block record if it's going to stay
+
+ }
+
+ // Now try to run the queries
+ reset($blocks);
+ try {
+ $this->dbh->beginTransaction();
+
+ // For each block
+ foreach ($blocks as $b) {
+
+ // if there's a query
+ if ($b['sql'] != false) {
+ $this->dbh->exec($b['sql']);
+ }
+
+ // for each segment
+ foreach ($b['segs'] as $s) {
+
+ // if there's a query
+ if ($s['sql'] != false) {
+ $this->dbh->exec($s['sql']);
+ }
+ }
+ }
+
+ $this->dbh->commit();
+
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ $status = false;
+ }
+
+ // If there are no blocks assigned to state reps or teams yet it's OK to renumber
+ // Otherwise we're just going to add numbers
+ $renumber = false;
+ if ($block_stats['max_rep'] + $block_stats['max_team'] == 0) {
+ $renumber = true;
+ }
+
+ // Get all blocks in the proper member order then in the order of their creation
+ $sql = "SELECT B.id, B.block_name,
+ M.member_id AS memb_id, M.member_name, M.lat, M.lon
+ FROM eventmgt.room_block B, members.member M
+ WHERE B.conv = $eventID
+ AND M.member_id = B.member
+ ORDER BY M.member_id, B.id
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $blocks = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // If we have some room blocks
+ if (count($blocks) > 0) {
+
+ // Add distances to the member data and sort by distance
+ require '../../classes/GeoCalculations.php';
+ $Geo = new EventManagementGeoCalculations($this->dbh);
+ $blocks = $Geo->getMemberEventDistance( $eventID, $blocks, 'lat', 'lon', 'distance', 'duration', 'memb_id', true);
+
+ // Renumber all blocks according to the current order - if we're allowed to renumber at this time
+ $block = 1;
+ if ($renumber) {
+
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($blocks as $b) {
+ $this->dbh->exec("UPDATE room_block SET block_name = ".$block++." WHERE id = ".$b['id'].";");
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ }
+
+ }
+
+ }
+
+ // echo "updateBlocksDetail()
".print_r($blocks,1)."
";
+ return $status;
+
+ }
+
+ /**
+ * Get Room Blocks
+ *
+ * If summary is true, then also put all the data under the properties
+ * so all blocks show under the property as well.
+ *
+ * @return object containing array as sub-objects
+ */
+ function getRoomBlocks($event = false, $sort = true, $summary = false, $state = false, $team = false, $property = false)
+ {
+
+ // Make sure we have an event selected (shouldn't happen that we don't)
+ if ($event) {
+ $eventID = $event;
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ // Get the event ID from the session
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Otherwise, we don't have a member id
+ return false;
+ }
+
+ // Get all State Reps for this event
+ $where = '';
+ if ($state) {
+ $where = "AND id = $state";
+ };
+ if ($property) {
+ $where .= " AND id IN (
+ SELECT DISTINCT state_rep FROM eventmgt.room_block
+ WHERE member = $property
+ )";
+ }
+
+ $sql = "SELECT id, code
+ FROM eventmgt.state_rep
+ WHERE conv = $eventID
+ $where
+ ORDER BY code;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $states_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ $statesList = array();
+ foreach ($states_data as $s) {
+ $statesList[$s['id']] = array(
+ 'id' => $s['id'],
+ 'code' => $s['code']
+ );
+ }
+
+ // Get all Teams for this event and add under state reps array
+ $where = '';
+ if ($state) {
+ $where .= " AND T.state = $state";
+ };
+ if ($team) {
+ $where .= " AND T.id = $team";
+ };
+ if ($property) {
+ $where .= " AND T.room_block IN (
+ SELECT DISTINCT id FROM eventmgt.room_block
+ WHERE member = $property
+ )";
+ }
+
+ $sql = "SELECT T.id, T.name, T.team_code, T.state, D.name AS division
+ FROM eventmgt.team T, eventmgt.division D
+ WHERE T.conv = $eventID
+ AND D.id = T.division
+ $where
+ ORDER BY T.name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teams_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($teams_data as $t) {
+ $statesList[$t['state']]['teams'][$t['id']] = array(
+ 'id' => $t['id'],
+ 'name' => $t['name'],
+ 'team_code' => $t['team_code']
+ );
+ }
+
+ // Get all existing Room Blocks for this event
+ $where = '';
+ if ($state) {
+ $where .= " AND B.state_rep = $state";
+ };
+ if ($team) {
+ $where .= " AND B.team = $team";
+ };
+ if ($property) {
+ $where .= " AND R.id = $property";
+ }
+
+
+ $sql = "SELECT B.id as block_id,
+ B.block_name,
+ B.state_rep,
+ B.team,
+ B.member AS memb_id,
+ R.name AS memb_name,
+ M.street AS street,
+ M.lat,
+ M.lon,
+ C.city_name AS city,
+ A.name AS accom_name,
+ S.allocated AS quant,
+ S.available AS available
+ FROM eventmgt.room_block B, eventmgt.member R, members.member M, members.city C, eventmgt.room_block_seg S, eventmgt.accommodation A
+ WHERE B.conv = $eventID
+ AND R.id = B.member
+ AND S.block = B.id
+ AND A.id = S.accommodation
+ AND C.city_id = M.city_id
+ AND M.member_id = R.id
+ $where
+ ORDER BY M.member_id, B.block_name, A.name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $blocks_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Add distances to the member data and sort by distance
+ if(class_exists('EventManagementGeoCalculations') != true) {
+ require '../../classes/GeoCalculations.php';
+ }
+ $Geo = new EventManagementGeoCalculations($this->dbh);
+ $blocks_data = $Geo->getMemberEventDistance( $eventID, $blocks_data, 'lat', 'lon', 'distance', 'duration', 'memb_id', $sort);
+
+ if (!is_array($blocks_data) || count($blocks_data) == 0) {
+ return false;
+ }
+ reset($blocks_data);
+
+ // Build room blocks list
+ $blocksList = array();
+ foreach ($blocks_data as $b) {
+
+ // If the Property (member) hasn't been added to the array yet
+ if (!isset($blocksList[$b['memb_id']])) {
+ $blocksList[$b['memb_id']] = array(
+ 'memb_id' => $b['memb_id'],
+ 'memb_name' => $b['memb_name'],
+ 'distance' => $b['distance'],
+ 'street' => $b['street'],
+ 'city' => $b['city']
+ );
+ }
+
+ // Get assignement summary if assigned
+ $assigned = false;
+ $assigned_to_state = '';
+ $assigned_to_team = '';
+ if ($b['state_rep'] > 0) {
+ $assigned_to_state = $statesList[$b['state_rep']]['code'];
+ }
+ if ($b['team'] > 0 ) {
+ $assigned_to_team = $statesList[$b['state_rep']]['teams'][$b['team']]['name'];
+ $team_code = $statesList[$b['state_rep']]['teams'][$b['team']]['team_code'];
+ }
+
+ // Build block info array
+ $block = array (
+ 'block_id' => $b['block_id'],
+ 'block_name' => $b['block_name'],
+ 'memb_name' => $b['memb_name'],
+ 'memb_id' => $b['memb_id'],
+ 'accom_info' =>
+ ''.$b['memb_name']." "
+ .$b['quant'].": ".$b['accom_name']." ",
+ 'accoms' => array($b['accom_name'] => array(
+ 'accom_name' => $b['accom_name'], 'quant' => $b['quant'], 'available' => $b['available']
+ )),
+ 'accom_quant' => $b['quant'],
+ 'assigned' => $assigned,
+ 'assigned_to_state' => $assigned_to_state,
+ 'assigned_to_team' => $assigned_to_team,
+ 'team_code' => $team_code
+ );
+
+ // If block as been assigned to a team
+ if ($b['team'] > 0) {
+
+ if (!isset($statesList[$b['state_rep']]['teams'][$b['team']]['blocks'][$b['block_id']])) {
+ $statesList[$b['state_rep']]['teams'][$b['team']]['blocks'][$b['block_id']] = $block;
+ } else {
+ $statesList[$b['state_rep']]['teams'][$b['team']]['blocks'][$b['block_id']]['accom_info'] .= $b['quant'].": ".$b['accom_name']." ";
+ $statesList[$b['state_rep']]['teams'][$b['team']]['blocks'][$b['block_id']]['accoms'][$b['accom_name']] = array(
+ 'accom_name' => $b['accom_name'], 'quant' => $b['quant'], 'available' => $b['available']
+ );
+ // Update sort of accoms array to keep it alphabetical
+ ksort($statesList[$b['state_rep']]['teams'][$b['team']]['blocks'][$b['block_id']]['accoms']);
+ }
+
+ // Otherwise it must just be assigned to a state rep so far
+ } elseif ($b['state_rep'] > 0) {
+
+ if (!isset($statesList[$b['state_rep']]['blocks'][$b['block_id']])) {
+ $statesList[$b['state_rep']]['blocks'][$b['block_id']] = $block;
+ } else {
+ $statesList[$b['state_rep']]['blocks'][$b['block_id']]['accom_info'] .= $b['quant'].": ".$b['accom_name']." ";
+ $statesList[$b['state_rep']]['blocks'][$b['block_id']]['accoms'][$b['accom_name']] = array(
+ 'accom_name' => $b['accom_name'], 'quant' => $b['quant'], 'available' => $b['available']
+ );
+
+ ksort($statesList[$b['state_rep']]['blocks'][$b['block_id']]['accoms']);
+ }
+
+ }
+
+ // If the block is not assigned to either a state or team, or if we're running in summary mode, include under property.
+ if (($b['team'] == 0 && $b['state_rep'] == 0) || $summary) {
+
+ if (!isset($blocksList[$b[memb_id]]['blocks'][$b['block_id']])) {
+ $blocksList[$b[memb_id]]['blocks'][$b['block_id']] = $block;
+ } else {
+ $blocksList[$b[memb_id]]['blocks'][$b['block_id']]['accom_info'] .= $b['quant'].": ".$b['accom_name']." ";
+ $blocksList[$b[memb_id]]['blocks'][$b['block_id']]['accoms'][$b['accom_name']] = array(
+ 'accom_name' => $b['accom_name'], 'quant' => $b['quant'], 'available' => $b['available']
+ );
+ // Update sort of accoms array to keep it alphabetical
+ ksort($blocksList[$b[memb_id]]['blocks'][$b['block_id']]['accoms']);
+ }
+
+ }
+
+ }
+
+ // Check if there's no blocksList yet
+ if (count($blocksList) == 0) {
+ $blocksList = false;
+ }
+
+ // Function to Sort all blocks by block_name (number)
+ function blockCmp($a, $b) {
+
+ $aval = $a['block_name'];
+ $bval = $b['block_name'];
+
+ if ($val == $bval) {
+ return 0;
+ }
+ return ($aval < $bval) ? -1 : 1;
+ }
+
+ // Sort unasigned blocks
+ reset ($blocksList);
+ while (list($k, $v) = each($blocksList)) {
+ if (is_array($v['blocks'])) {
+ uasort($blocksList[$k]['blocks'], 'blockCmp');
+ }
+ }
+
+ // Sort blocks assigned to states or teams
+ reset ($statesList);
+ while (list($k, $v) = each($statesList)) {
+
+ // Check for and sort any blocks not assigned to teams
+ if (is_array($v['blocks'])) {
+ uasort($statesList[$k]['blocks'], 'blockCmp');
+ }
+
+ // Check for any teams
+ if (is_array($v['teams'])) {
+ while (list($tk, $tv) = each($v['teams'])) {
+ if (is_array($tv['blocks'])) {
+ uasort($statesList[$k]['teams'][$tk]['blocks'], 'blockCmp');
+ }
+ }
+ }
+ }
+
+ // Sort accommodation types
+
+ $r = array(
+ 'blocks' => $blocksList,
+ 'states' => $statesList
+ );
+
+ // echo "
".htmlentities(print_r($r,1))."
";
+ return $r;
+ }
+
+ /**
+ * Save Room Blocks
+ *
+ * @return object containing array as sub-objects
+ */
+ function saveRoomBlocks()
+ {
+
+ // Make sure we have an event selected (shouldn't happen that we don't)
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ // Get the event ID from the session
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Otherwise, we don't have a member id
+ return false;
+ }
+
+ // Get room block drop list
+ $dropList = $_REQUEST['blocks'];
+
+ // Separate into separate move requests
+ $drops = explode(',', $dropList);
+
+ $sql = array();
+
+ // For each block moved
+ foreach ($drops as $d) {
+
+ // separate the block id from the destination
+ $x = explode('|', $d);
+ $block = $x[0];
+
+ // separate the destination id from the type
+ $y = explode('_', $x[1]);
+
+ // Set any state and team assignments for this block
+ $state = 'null';
+ $team = 'null';
+ switch ($y[0]) {
+
+ case 'state':
+
+ $state = ($y[1] - 0);
+
+ if ($y[2] == 'team') {
+ $team = ($y[3] - 0);
+ }
+
+ break;
+
+ case 'member':
+ // If moved back to member, then there's no assignment
+ break;
+
+ }
+
+ if ($state == 0) {
+ $state = 'null';
+ }
+ if ($team == 0) {
+ $team = 'null';
+
+ }
+
+ $sql[] = "
+ UPDATE room_block
+ SET state_rep = $state,
+ team = $team
+ WHERE conv = $eventID
+ AND block_name = $block;
+ ";
+ }
+
+ if (count($sql) > 0) {
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ }
+
+ }
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/bookings.php b/models/admin/classes/bookings.php
new file mode 100644
index 0000000..c85c779
--- /dev/null
+++ b/models/admin/classes/bookings.php
@@ -0,0 +1,102 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/bookings.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataBookings.php';
+
+/**
+ * EventManagementAdminBookings class
+ *
+ * Event Management and Reservations System - Admin Code - Bookings section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/bookings.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminBookings extends EventManagementDataBookings
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Members Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getBookingsStats()
+ {
+ $bookingsStats = array(
+ 'all' => $this->getStats(),
+ 'event' => 0,
+ 'member' => 0,
+ 'team' => 0
+ );
+
+ // Get event ID from session - if available get stats for bookings listed with this event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ $bookingsStats['event'] = $this->getStats("
+ conv = $eventID
+ ");
+ }
+
+ // Get member ID from session - if available get stats for bookings for this member
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $bookingsStats['member'] = $this->getStats("
+ property = $memberID
+ ");
+ }
+
+ // Get team ID from session - if available get stats for bookings listed with this team
+ if (($teamID = $_SESSION[GLM_EVENT_SESSION]['Team'])) {
+ $bookingsStats['team'] = $this->getStats("
+ team = $teamID
+ ");
+ }
+
+ return $bookingsStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/contacts.php b/models/admin/classes/contacts.php
new file mode 100644
index 0000000..422cd1f
--- /dev/null
+++ b/models/admin/classes/contacts.php
@@ -0,0 +1,122 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/contacts.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataContacts.php';
+
+/**
+ * EventManagementAdminContacts class
+ *
+ * Event Management and Reservations System - Admin Code - Contacts section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Contacts
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/contacts.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminContacts extends EventManagementDataContacts
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+ /**
+ * Get Contacts Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getEventContactsStats()
+ {
+ // Check for selected Event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ return $this->getStats("
+ contact_type = ".$this->config->reference_type->event."
+ AND affiliation = $eventID
+ ");
+ }
+ return 0;
+ }
+ function getMemberContactsStats()
+ {
+ // Check for selected Member
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ return $this->getStats("
+ contact_type = ".$this->config->reference_type->member."
+ AND affiliation = $memberID
+ ");
+ }
+ return 0;
+ }
+ function getStateContactsStats()
+ {
+ // Check for selected State Rep
+ if (($stateID = $_SESSION[GLM_EVENT_SESSION]['State'])) {
+ return $this->getStats("
+ contact_type = ".$this->config->reference_type->state."
+ AND affiliation = $stateID
+ ");
+ }
+ return 0;
+ }
+ function getTeamContactsStats()
+ {
+
+ // Check for selected Team
+ if (($teamID = $_SESSION[GLM_EVENT_SESSION]['Team'])) {
+ return $this->getStats("
+ contact_type = ".$this->config->reference_type->team."
+ AND affiliation = $teamID
+ ");
+ }
+ return 0;
+ }
+ function getContactsStats()
+ {
+
+ $contactsStats = array(
+ 'all' => $this->getStats(),
+ 'event' => $this->getEventContactsStats(),
+ 'member' => $this->getMemberContactsStats(),
+ 'state' => $this->getStateContactsStats(),
+ 'team' => $this->getTeamContactsStats()
+ );
+
+ return $contactsStats;
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/dataList.php b/models/admin/classes/dataList.php
new file mode 100644
index 0000000..1719cbd
--- /dev/null
+++ b/models/admin/classes/dataList.php
@@ -0,0 +1,188 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+/**
+ * EventManagementAdminEvents class
+ *
+ * Event Management and Reservations System - Admin Code - Events section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Events
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminEvents
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($dbh, $config)
+ {
+ $this->dbh = $dbh;
+ $this->config = $config;
+ }
+
+
+ /**
+ * Get Events Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getEventsStats()
+ {
+
+ // Get list of all available Events
+ $sql = "SELECT ( SELECT count(id) FROM eventmgt.event WHERE active ) AS active,
+ ( SELECT count(id) FROM eventmgt.event WHERE NOT active ) AS inactive
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventsStats = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ return $eventsStats;
+ }
+
+ /**
+ * Get Events list
+ *
+ * @param string type of events list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getEventsList()
+ {
+
+ // Get any specified event listing option - default to active
+ $option = 'active';
+ if (($eventsListOption = filter_input(INPUT_GET, 'EventsListOption', FILTER_SANITIZE_STRING))) {
+ $option = $eventsListOption;
+ }
+
+ // Clear Session Event Selection
+ $_SESSION[GLM_EVENT_SESSION]['Event'] = false;
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'true';
+ break;
+ case 'active':
+ $where = "active AND end_date > 'now'";
+ break;
+ case 'inactive':
+ $where = "NOT active AND end_date > 'now'";
+ break;
+ case 'expired':
+ $where = "active AND end_date < 'now'";
+ break;
+ case 'archived':
+ $where = "NOT active AND end_date < 'now'";
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get list of all available Events
+ $sql = "SELECT id, name, event_code, start_date, end_date, cutoff_date
+ FROM eventmgt.event
+ WHERE $where
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventsList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ if (count($eventsList) == 0)
+ return false;
+ return $eventsList;
+ }
+
+ /**
+ * Get Event Detail
+ *
+ * Returns an array of event detail data for an event.
+ *
+ * @param array $array of values to convert
+ *
+ * @return object containing array as sub-objects
+ */
+ function getEventDetail()
+ {
+ // Is there a new event code selected?
+ if (($eventID = filter_input(INPUT_GET, 'EventID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Event'] = $eventID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Event'])) {
+
+ // Otherwise, get the event ID from the session
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ } else {
+
+ // Otherwise, we don't have an event id
+ return false;
+
+ }
+
+ $sql = "SELECT *
+ FROM eventmgt.event
+ WHERE id = '$eventID';";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventDetail = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ return $eventDetail;
+ }
+
+
+
+}
+
+?>
+
diff --git a/models/admin/classes/divisions.php b/models/admin/classes/divisions.php
new file mode 100644
index 0000000..f88d22e
--- /dev/null
+++ b/models/admin/classes/divisions.php
@@ -0,0 +1,87 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/divisions.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataDivisions.php';
+
+/**
+ * EventManagementAdminDivisions class
+ *
+ * Event Management and Reservations System - Admin Code - Divisions section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/divisions.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminDivisions extends EventManagementDataDivisions
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get State Divisions
+ *
+ * @return object containing array as sub-objects
+ */
+ function getDivisionsStats()
+ {
+ $divisionsStats = array(
+ 'all' => $this->getStats(),
+ 'event' => 0,
+ 'state' => 0
+ );
+
+ // Get event ID from session - if available get stats for teams listed with this event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ $divisionsStats['event'] = $this->getStats("
+ conv = $eventID
+ ");
+ }
+
+ return $divisionsStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/entrances.php b/models/admin/classes/entrances.php
new file mode 100644
index 0000000..a863ca6
--- /dev/null
+++ b/models/admin/classes/entrances.php
@@ -0,0 +1,81 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/entrances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataEntrances.php';
+
+/**
+ * EventManagementAdminContacts class
+ *
+ * Event Management and Reservations System - Admin Code - Entrances section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Entrances
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/entrances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminEntrances extends EventManagementDataEntrances
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Entrances Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberEntrancesStats($memberID = false)
+ {
+ // Get member ID from session - if available get stats for member
+ if ($memberID || ($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ return $this->getStats("member = $memberID");
+ }
+ return 0;
+ }
+ function getEntrancesStats()
+ {
+ $entrancesStats = array(
+ 'all' => $this->getStats(),
+ 'member' => $this->getMemberEntrancesStats()
+ );
+
+ return $entrancesStats;
+ }
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/eventFees.php b/models/admin/classes/eventFees.php
new file mode 100644
index 0000000..0218d87
--- /dev/null
+++ b/models/admin/classes/eventFees.php
@@ -0,0 +1,86 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/eventFees.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataFees.php';
+
+/**
+ * EventManagementAdminStates class
+ *
+ * Event Management and Reservations System - Admin Code - Event Fees Section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/eventFees.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminEventFees extends EventManagementDataFees
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Event Fees Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getEventFeesStats()
+ {
+ $eventFeesStats = array(
+ 'all' => $this->getStats(),
+ 'event' => 0
+ );
+
+ // Get event ID from session - if available get stats for teams listed with this event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ $eventFeesStats['event'] = $this->getStats("
+ owner = $eventID
+ ");
+ }
+
+ return $eventFeesStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/eventReport.php b/models/admin/classes/eventReport.php
new file mode 100644
index 0000000..a091d24
--- /dev/null
+++ b/models/admin/classes/eventReport.php
@@ -0,0 +1,206 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/eventReport.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/Reports/dataEventReport.php';
+
+/**
+ * EventManagementAdminEvents class
+ *
+ * Event Management and Reservations System - Admin Code - Event Report section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Events
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminEventReport extends EventManagementDataEventReport
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ function __construct($dbh, $config)
+ {
+ parent::__construct($dbh, $config);
+ }
+
+ /**
+ * Get Report Request Form
+ *
+ * @return object containing array as sub-objects
+ */
+ function getForm()
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'reason' => array(),
+ 'form' => array()
+ );
+
+ $reportData['form'] = $this->newControls();
+
+ return $reportData;
+ }
+
+ /**
+ * Process Report
+ *
+ * @return object containing array as sub-objects
+ */
+ function getReport()
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'output' => false,
+ 'reason' => array(),
+ 'report' => array()
+ );
+
+ /*
+ * Try to process report form request
+ */
+ $request = $this->processInputData();
+ if (!$request['status']) {
+ $reportData['status'] = false;
+
+ if ($request['fieldFail']['event_name']) {
+ $reportData['reason'][] = 'An event was not selected';
+ }
+
+ if ($request['fieldFail']['output_type']) {
+ $reportData['reason'][] = 'An output type was not selected';
+ }
+
+ }
+
+ // Get selections
+ $r = $request['fieldData'];
+ $event = $r['event_name']['in'];
+ $statistics = $r['statistics_section']['value'];
+ $contacts = $r['contacts_section']['value'];
+ $housing = $r['housing_section']['value'];
+ $housing_available_only = $r['housing_available_only']['value'];
+ $housing_summary_only = $r['housing_summary_only']['value'];
+ $reservations = $r['reservations_section']['value'];
+ $reservations_summary_only = $r['reservations_summary_only']['value'];
+ $reportData['output'] = $r['output_type']['value'];
+
+ // If the request is valid - Produce the report
+ if ($reportData['status']) {
+
+ /*
+ * Get report data
+ */
+
+ // Get Event data
+ $sql = "SELECT * FROM eventmgt.event WHERE id = $event;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['event'] = $eventData;
+
+ // Get Statistics
+ $reportData['report']['doingStatistics'] = $statistics;
+ if ($statistics) {
+ // Not built yet
+ }
+
+ // Get Contacts
+ $reportData['report']['doingContacts'] = $contacts;
+ if ($contacts) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataContacts.php';
+ $Contacts = new EventManagementDataContacts($this->dbh, $this->config);
+ $where = "T.contact_type = ".$this->config->reference_type->event." AND affiliation = $event";
+ $contactsList = $Contacts->getList($where);
+ $reportData['report']['contacts'] = $contactsList;
+ }
+
+ // Get Housing and Inventory
+
+ $reportData['report']['doingHousing'] = $housing;
+ $reportData['report']['showAllInventoryDataDetail'] = !$housing_available_only;
+ $reportData['report']['showHousingDetail'] = !$housing_summary_only;
+ if ($housing) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataInventory.php';
+ $Inventory = new EventManagementDataInventory($this->dbh, $this->config);
+ $inventoryList = $Inventory->getInvenList('event', $event);
+
+ // Sort inventory by summary
+ function sortByMember($a, $b)
+ {
+ if ($a['name'] > $b['name']) {
+ return 1;
+ } elseif ($b['name'] > $a['name']) {
+ return -1;
+ }
+ return 0;
+ }
+ while (list($k, $v) = each($inventoryList['sum'])) {
+ uasort($v['memb'], 'sortByMember');
+ $inventoryList['sum'][$k] = $v;
+ }
+
+ $reportData['report']['housing'] = $inventoryList;
+ }
+
+ // Get Reservations - Use existing report class for reservations
+ $reportData['report']['doingReservations'] = $reservations;
+ $reportData['report']['showReservationsDetail'] = !$reservations_summary_only;
+ if ($reservations) {
+ require 'reservationReport.php';
+ $Reservations = new EventManagementAdminReservationReport($this->dbh, $this->config);
+ $reservationsList = $Reservations->getReport($event);
+ $reportData['report']['reservations'] = $reservationsList['report'];
+ }
+
+ }
+
+ return $reportData;
+ }
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/events.php b/models/admin/classes/events.php
new file mode 100644
index 0000000..2fa7625
--- /dev/null
+++ b/models/admin/classes/events.php
@@ -0,0 +1,153 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataEvents.php';
+
+/**
+ * EventManagementAdminEvents class
+ *
+ * Event Management and Reservations System - Admin Code - Events section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Events
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminEvents extends EventManagementDataEvents
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Events Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getEventsStats()
+ {
+ $eventsStats = array(
+ 'all' => $this->getStats(),
+ 'active' => $this->getStats('active'),
+ 'inactive' => $this->getStats('NOT active'),
+ 'expired' => $this->getStats("active AND end_date < 'now'"),
+ 'archived' => $this->getStats("NOT active AND end_date < 'now'"),
+ 'member' => 0,
+ 'team' => 0
+ );
+
+ // Get member ID from session - if available get stats for events for this member
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $eventsStats['member'] = $this->getStats("
+ id IN (
+ SELECT DISTINCT event
+ FROM eventmgt.inventory
+ WHERE member = $memberID
+ )
+ ");
+/* Trying to not use event_prop table for this
+ $eventsStats['member'] = $this->getStats("
+ id IN (
+ SELECT DISTINCT event
+ FROM eventmgt.event_prop
+ WHERE property = $memberID
+ )
+ ");
+*/
+ }
+
+ // Get team ID from session - if available get stats for bookings listed with this team
+ if (($teamID = $_SESSION[GLM_EVENT_SESSION]['Team'])) {
+ $bookingsStats['team'] = $this->getStats("
+ id IN (
+ SELECT DISTINCT event
+ FROM eventmgt.team_property
+ WHERE team = $teamID
+ )
+ ");
+ }
+
+ return $eventsStats;
+ }
+
+ /**
+ * Get Member Events
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberEvents()
+ {
+ // Get member ID
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ // Get the event ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ } else {
+ // Otherwise, we don't have a member id
+ return false;
+ }
+
+ // Only look for events for the specified property
+ $where = "T.id IN (
+ SELECT DISTINCT event
+ FROM eventmgt.inventory
+ WHERE member = $memberID
+ )";
+/* Trying to not use event_prop table for this
+ $where = "T.id IN (
+ SELECT event
+ FROM eventmgt.event_prop
+ WHERE property = $memberID
+ )";
+*/
+ $memberEvents = $this->getEventsList($where);
+
+ if (count($memberEvents) == 0) {
+ return false;
+ }
+
+ return $memberEvents;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/inventory.php b/models/admin/classes/inventory.php
new file mode 100644
index 0000000..dddc77a
--- /dev/null
+++ b/models/admin/classes/inventory.php
@@ -0,0 +1,124 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/invetory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataInventory.php';
+
+/**
+ * EventManagementAdminInventory class
+ *
+ * Event Management and Reservations System - Admin Code - Inventory section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/inventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminInventory extends EventManagementDataInventory
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Inventory Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getEventInvenStats()
+ {
+ // Get event ID from session - if available get stats for event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ return $this->getStats("conv = $eventID");
+ }
+ return 0;
+ }
+ function getMemberInvenStats()
+ {
+ // Get member ID from session - if available get stats for member
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ return $this->getStats("member = $memberID");
+ }
+ return 0;
+ }
+ function getAccomInvenStats()
+ {
+ // Get accommodation ID from session - if available get stats for accommodation
+ if (($accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+ return $this->getStats("accommodation = $accomID");
+ }
+ return 0;
+ }
+ function getTeamInvenStats()
+ {
+ // Get team ID from session - if available get stats for team
+ if (($teamID = $_SESSION[GLM_EVENT_SESSION]['Team'])) {
+ return $this->getStats("
+ id in
+ (
+ SELECT I.id
+ FROM eventmgt.inventory I, eventmgt.team_property TP
+ WHERE TP.team = $teamID
+ AND I.member = TP.property
+ AND I.date between TP.start AND TP.stop
+ )
+ ");
+ }
+ return 0;
+ }
+ function getInvenStats()
+ {
+ $invenStats = array(
+ 'all' => $this->getStats(),
+ 'event' => $this->getEventInvenStats(),
+ 'member' => $this->getMemberInvenStats(),
+ 'accom' => $this->getAccomInvenStats(),
+ 'team' => $this->getTeamInvenStats()
+ );
+ return $invenStats;
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/memberAmenities.php b/models/admin/classes/memberAmenities.php
new file mode 100644
index 0000000..201a22d
--- /dev/null
+++ b/models/admin/classes/memberAmenities.php
@@ -0,0 +1,86 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/memberAmenities.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataAmenities.php';
+
+/**
+ * EventManagementAdminStates class
+ *
+ * Event Management and Reservations System - Admin Code - Member Amenities Section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/memberAmenities.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminMemberAmenities extends EventManagementDataAmenities
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Member Amenities Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberAmenitiesStats()
+ {
+ $memberAmenitiesStats = array(
+ 'all' => $this->getStats(),
+ 'member' => 0
+ );
+
+ // Get member ID from session - if available get stats
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $memberAmenitiesStats['member'] = $this->getStats("
+ owner = $memberID
+ ");
+ }
+
+ return $memberAmenitiesStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/memberFees.php b/models/admin/classes/memberFees.php
new file mode 100644
index 0000000..d1f43a8
--- /dev/null
+++ b/models/admin/classes/memberFees.php
@@ -0,0 +1,86 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/memberFees.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataFees.php';
+
+/**
+ * EventManagementAdminStates class
+ *
+ * Event Management and Reservations System - Admin Code - Member Fees Section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/memberFees.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminMemberFees extends EventManagementDataFees
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Member Fees Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberFeesStats()
+ {
+ $memberFeesStats = array(
+ 'all' => $this->getStats(),
+ 'member' => 0
+ );
+
+ // Get member ID from session - if available get stats
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $memberFeesStats['member'] = $this->getStats("
+ owner = $memberID
+ ");
+ }
+
+ return $memberFeesStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/members.php b/models/admin/classes/members.php
new file mode 100644
index 0000000..1605604
--- /dev/null
+++ b/models/admin/classes/members.php
@@ -0,0 +1,198 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/members.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMembers.php';
+
+/**
+ * EventManagementAdminMembers class
+ *
+ * Event Management and Reservations System - Admin Code - Members section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/members.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminMembers extends EventManagementDataMembers
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Members Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMembersStats()
+ {
+ // Basic member stats
+ $membersStats = array(
+ 'all' => $this->getStats() // Count of all members
+ );
+
+ // Get event ID from session - if available get stats for members listed with this event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ $membersStats['event'] = $this->getStats("
+ id in
+ (
+ SELECT DISTINCT(member)
+ FROM eventmgt.inventory
+ WHERE conv = $eventID
+ )
+ ");
+ } else {
+ // Otherwise if no event number is 0
+ $membersStats['event'] = 0;
+ }
+
+ // If doing accommodations - get accommodation stats
+ if ($this->config->option->accommodations) {
+ $membersStats['accom'] = $this->getStats("
+ id in
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.accommodation
+ )
+ ");
+ }
+
+ // If doing tickets - get ticket stats
+ if ($this->config->option->tickets) {
+ $membersStats['ticket'] = $this->getStats("
+ id in
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.ticket
+ )
+ ");
+ };
+
+ // determine if there's any status flags we should set
+ $membersStats['flags'] = false;
+ $membersStats['flag'] = false;
+ if ($membersStats['all'] == 0) {
+ $membersStats['flags']['noMembers'] = true;
+ $membersStats['flag'] = true;
+ }
+ if ($this->config->option->accommodations && $membersStats['accom'] == 0) {
+ $membersStats['flags']['noMemberAccoms'] = true;
+ $membersStats['flag'] = true;
+ }
+ if ($this->config->option->tickets && $membersStats['ticket'] == 0) {
+ $membersStats['flags']['noMemberTickets'] = true;
+ $membersStats['flag'] = true;
+ }
+ if ($this->config->option->events && $membersStats['event'] == 0) {
+ $membersStats['flags']['noMemberEvents'] = true;
+ $membersStats['flag'] = true;
+ }
+
+ return $membersStats;
+ }
+
+ function checkNewMembers()
+ {
+ // This function should not be called if it's not an integrated database
+ if ($this->config->option->member_db_integrated == false) {
+ return false;
+ }
+
+ // Check that referenced members also have an entry in the res_member table
+ $sql = "SELECT member_id, member_name
+ FROM members.member
+ WHERE member_id IN
+ (
+ SELECT member_id
+ FROM members.member_category
+ WHERE category_id IN
+ (
+ SELECT category_id
+ FROM members.category
+ WHERE accommodations
+ )
+ )
+ AND member_id NOT IN
+ (
+ SELECT id
+ FROM eventmgt.member
+ );
+ ";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $members = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ $r['reason'] = array();
+ $sql = array();
+ if ($members && count($members) > 0 ) {
+ foreach ($members as $memb ) {
+ // Add an entry in the res_member table
+ $sql[] = "
+ INSERT INTO eventmgt.member
+ (id, name)
+ VALUES
+ (".$memb['member_id'].", '".addslashes($memb['member_name'])."');
+ ";
+ }
+
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ $r['status'] = false;
+ $r['reason'][] = 'Unable to store new properties for unknown reason. ';
+ }
+
+ }
+
+ return $r;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/misc.php b/models/admin/classes/misc.php
new file mode 100644
index 0000000..37c7131
--- /dev/null
+++ b/models/admin/classes/misc.php
@@ -0,0 +1,58 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/misc.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMisc.php';
+
+/**
+ * EventManagementAdminSold class
+ *
+ * Event Management and Reservations System - Admin Code - Misc
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/misc.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementAdminMisc extends EventManagementDataMisc
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/orders.php b/models/admin/classes/orders.php
new file mode 100644
index 0000000..d0e1fa7
--- /dev/null
+++ b/models/admin/classes/orders.php
@@ -0,0 +1,58 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/orders.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataOrders.php';
+
+/**
+ * EventManagementAdminOrders class
+ *
+ * Event Management and Reservations System - Admin Code - Contacts ticket
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/orders.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementAdminOrders extends EventManagementDataOrders
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/performances.php b/models/admin/classes/performances.php
new file mode 100644
index 0000000..7a3683c
--- /dev/null
+++ b/models/admin/classes/performances.php
@@ -0,0 +1,79 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/performances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPerformances.php';
+
+/**
+ * EventManagementAdminContacts class
+ *
+ * Event Management and Reservations System - Admin Code - Performances Section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Performances
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/performances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminPerformances extends EventManagementDataPerformances
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Performances Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberPerformancesStats($memberID = false)
+ {
+ // Get member ID from session - if available get stats for member
+ if ($memberID || ($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ return $this->getStats("member = $memberID AND active");
+ }
+ return 0;
+ }
+ function getPerformancesStats()
+ {
+ $performancesStats = array(
+ 'all' => $this->getStats(),
+ 'member' => $this->getMemberPerformancesStats()
+ );
+
+ return $performancesStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/promoTickets.php b/models/admin/classes/promoTickets.php
new file mode 100644
index 0000000..9a0b827
--- /dev/null
+++ b/models/admin/classes/promoTickets.php
@@ -0,0 +1,126 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/promoTickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPromoTickets.php';
+
+/**
+ * EventManagementAdminPromoTickets class
+ *
+ * Event Management and Reservations System - Admin Code - Promotion Tickets section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Add-Ons
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/promoTickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminPromoTickets extends EventManagementDataPromoTickets
+{
+ /**
+ * Configuration information object
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $data
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Promos Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromoTicketsStats()
+ {
+ return $this->getStats();
+ }
+
+ /**
+ * Process Promomotion Tickets and return list
+ *
+ * @return object containing array as sub-objects
+ */
+ function processPromoTicketsList($promoID)
+ {
+
+ // Check for promotion tickets update
+ if (isset($_REQUEST['Option']) && $_REQUEST['Option'] = 'update_promoTickets') {
+
+ // Process all promotion ticket requests
+ $sql = '';
+ if (isset($_REQUEST['type']) && count($_REQUEST['type']) > 0) {
+ while (list($k, $v) = each($_REQUEST['type'])) {
+
+ // If this is a new addition
+ if ($k == 0 && ($_REQUEST['ticket'][$k]-0) > 0 && ($_REQUEST['amount'][$k]-0) > 0) {
+ $sql .= "INSERT INTO eventmgt.promo_ticket
+ (promo, ticket, promo_type, amount, notes)
+ VALUES
+ (
+ $promoID,
+ ".($_REQUEST['ticket'][$k]-0).",
+ ".($_REQUEST['type'][$k]-0).",
+ ".($_REQUEST['amount'][$k]-0.0).",
+ '".addslashes($_REQUEST['notes'][$k])."'
+ );
+ ";
+
+ // If it's a delete request
+ } elseif (isset($_REQUEST['delete'][$k])) {
+ $sql .= "DELETE FROM eventmgt.promo_ticket WHERE id = $k;
+ ";
+
+ // Otherwise update it
+ } else {
+ $sql .= "UPDATE eventmgt.promo_ticket SET
+ amount = ".($_REQUEST['amount'][$k]-0.0).",
+ notes = '".addslashes($_REQUEST['notes'][$k])."'
+ WHERE id = $k;
+ ";
+ }
+
+ }
+ if ($sql != '') {
+ $this->dbh->exec($sql);
+ }
+
+ }
+
+ }
+
+ // Get updated list of promotion tickets
+ $promoTicketsList = $this->getPromoTicketsList($promoID);
+
+ return $promoTicketsList;
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/promos.php b/models/admin/classes/promos.php
new file mode 100644
index 0000000..034e6f3
--- /dev/null
+++ b/models/admin/classes/promos.php
@@ -0,0 +1,68 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/promos.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPromos.php';
+
+/**
+ * EventManagementAdminPromos class
+ *
+ * Event Management and Reservations System - Admin Code - Promotionss section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Add-Ons
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/promos.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminPromos extends EventManagementDataPromos
+{
+ /**
+ * Configuration information object
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $data
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Promos Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromosStats()
+ {
+ return $this->getStats();
+
+ return 0;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/promosSold.php b/models/admin/classes/promosSold.php
new file mode 100644
index 0000000..9d18aec
--- /dev/null
+++ b/models/admin/classes/promosSold.php
@@ -0,0 +1,57 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/promosSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPromoSold.php';
+
+/**
+ * EventManagementAdminPromosSold class
+ *
+ * Event Management and Reservations System - Admin Code - Sold Ticket promos
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/promosSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementAdminPromosSold extends EventManagementDataPromoSold
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/reservationReport.php b/models/admin/classes/reservationReport.php
new file mode 100644
index 0000000..1712904
--- /dev/null
+++ b/models/admin/classes/reservationReport.php
@@ -0,0 +1,343 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/reservationReporteport.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/Reports/dataReservationReport.php';
+
+/**
+ * EventManagementAdminEvents class
+ *
+ * Event Management and Reservations System - Admin Code - Reservation Report section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Events
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminReservationReport extends EventManagementDataReservationReport
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ function __construct($dbh, $config)
+ {
+ parent::__construct($dbh, $config);
+ }
+
+ /**
+ * Get Report Request Form
+ *
+ * @return object containing array as sub-objects
+ */
+ function getForm()
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'reason' => array(),
+ 'form' => array()
+ );
+
+ $reportData['form'] = $this->newControls();
+
+ $this->addDebug("classes/reservationReport.inc", 'getForm()', print_r($reportData,1));
+
+ return $reportData;
+ }
+
+ /**
+ * Process Report
+ *
+ * @return object containing array as sub-objects
+ */
+ function getReport($setEvent = false, $setState = false)
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'output' => false,
+ 'reason' => array(),
+ 'report' => array()
+ );
+
+ // If no specific event and state rep is requested, then process input for selections
+ if ($setState == false) {
+
+ /*
+ * Try to process report form request
+ */
+ $request = $this->processInputData();
+ if (!$request['status']) {
+ $reportData['status'] = false;
+
+ if ($request['fieldFail']['event_name']) {
+ $reportData['reason'][] = 'An event was not selected';
+ }
+
+ if ($request['fieldFail']['output_type']) {
+ $reportData['reason'][] = 'An output type was not selected';
+ }
+
+ }
+ $r = $request['fieldData'];
+
+
+ /*
+ * Get report data
+ */
+ // Check for specified event
+ if ($setEvent) {
+ $event = $setEvent;
+ } else {
+ $event = $request['fieldData']['event_name']['in'];
+ }
+
+ $state = ($r['state_rep']['in'] != '0' ? $r['state_rep']['in'] : false);
+ $team = ($r['team_code']['in'] != '0' ? $r['team_code']['in'] : false);
+ $property = ($r['prop_name']['in'] != '0' ? $r['prop_name']['in'] : false);
+ $status = $r['status']['value'];
+ $where = '';
+
+ // Make Reservation Report Request Data available to template
+ $reportData['report']['event'] = false;
+ if ($event > 0) {
+
+ // Get Event data
+ $sql = "SELECT * FROM eventmgt.event WHERE id = $event;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['event'] = $eventData;
+
+ $where = "conv = $event";
+
+ }
+
+ // Check for State Rep filter
+ if ($state > 0) {
+ $where .= ($where!=''?' AND ':'')." T.state_rep = $state";
+ }
+
+ // If a team has been selected, filter by that.
+ if ($team) {
+ $where .= ($where!=''?' AND ':'')." T.team_id = $team";
+ }
+
+ // If a property has been selected, filter by that.
+ if ($property) {
+ $where .= ($where!=''?' AND ':'')." T.member = $property";
+ }
+
+ // Select by status
+ switch ($status) {
+ case 'pending':
+ $where .= ($where!=''?' AND ':'')." NOT T.confirmed AND NOT T.declined";
+ break;
+ case 'confirmed':
+ $where .= ($where!=''?' AND ':'')." T.confirmed AND NOT T.declined";
+ break;
+ case 'declined':
+ $where .= ($where!=''?' AND ':'')." T.declined";
+ break;
+ case 'all':
+ default:
+ break;
+ }
+
+ } else {
+
+ // There's been a specific request
+ $event = $setEvent;
+ $state = $setState;
+ $team = false;
+ $where = " T.state_rep = $state";
+
+ }
+
+
+ // If a State Rep is selected filter by that
+ if ($state) {
+
+ // Build query where clause to filter for any requested state
+ $where .= ($where!=''?' AND ':'')." T.team_id IN (SELECT team.id FROM eventmgt.team WHERE state = $state)";
+
+ // Also get state information
+ $sql = "SELECT * FROM eventmgt.state_rep WHERE id = $state;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $stateData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['state'] = $stateData;
+
+ }
+
+ // If a team has been selected, filter by that.
+ if ($team) {
+
+ $where .= ($where!=''?' AND ':'')." T.team_id = $team";
+
+ // Also get team information
+ $sql = "SELECT * FROM eventmgt.team WHERE id = $team;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['team'] = $teamData;
+ }
+
+ // If a property has been selected, filter by that.
+ if ($property) {
+
+ $where .= ($where!=''?' AND ':'')." T.member = $property";
+
+ // Also get team information
+ $sql = "SELECT * FROM eventmgt.member WHERE id = $property;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $propertyData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['property'] = $propertyData;
+ }
+
+ // Get Event Reservations
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataReservations.php';
+ $Reservations = new EventManagementDataReservations($this->dbh, $this->config);
+ $reservationsList = $Reservations->getList($where);
+
+ // Build totals
+ $numb_res = 0;
+ $total_hotel = 0;
+ $total_taxes = 0;
+ $total_fees = 0;
+ $grand_total = 0;
+ if (is_array($reservationsList) && count($reservationsList) > 0) {
+ reset($reservationsList);
+ while (list($k, $v) = each($reservationsList)) {
+ $reservationsList[$k]['detail'] = unserialize($v['res_detail']);
+ $taxes = 0;
+ $fees = 0;
+ // Make sure we decoded the res_detail (there's been some problems with that)
+ if($reservationsList[$k]['detail']) {
+
+ $x = $reservationsList[$k]['detail']['propFees'];
+ foreach ($x as $f) {
+ $fees += $f['fee_calculated'];
+ }
+
+/* This doesn't seem to work. Need to revisit this when done with Kalamazoo Fee structure
+ $x = $reservationsList[$k]['detail']['propAccom'];
+ foreach ($x as $accom) {
+ // In case we get the values with leading "$"
+ if($accom['accom_fees_taxable'][0] == '$') {
+ $accom['accom_fees_taxable'] = substr($accom['accom_fees_non_taxable'],1);
+ }
+ if($accom['accom_fees_non_taxable'][0] == '$') {
+ $accom['accom_fees_non_taxable'] = substr($accom['accom_fees_non_taxable'],1);
+ }
+ // Now add the taxes and fees
+ $taxes += ($accom['accom_fees_taxable']-0);
+ $fees += ($accom['accom_fees_non_taxable']-0);
+
+ }
+*/
+
+ $numb_res++;
+ $total_taxes += $taxes;
+ $total_fees += $fees;
+ $reservationsList[$k]['taxes'] = $this->money($taxes);
+ $reservationsList[$k]['fees'] = $this->money($fees);
+ $reservationsList[$k]['taxes_and_fees'] = $this->money($taxes + $fees);
+ $total_hotel += $v['hotel_price_numb'];
+ $grand_total += $v['grand_total_numb'];
+ } else {
+ // We get here if the res_detail field doesn't unserialize or if there's nothing in the field.
+ // Had a problem with this originally due to corruption of the serialized data by using stripslashes(). Don't do that!
+ echo "System Error: Unable to decode reservation detail for reservation # ".$v['id']." - Please contact Gaslight Media. ";
+ }
+ }
+ }
+
+ $reportData['report']['reservations'] = $reservationsList;
+ $reportData['output'] = $r['output_type']['value'];
+
+ $reportData['report']['totals'] = array(
+ 'numb_reservations' => $numb_res,
+ 'hotel' => $this->money($total_hotel),
+ 'taxes' => $this->money($total_taxes),
+ 'fees' => $this->money($total_fees),
+ 'taxes_and_fees' => $this->money($total_taxes + $total_fees),
+ 'grand_total' => $this->money($grand_total)
+ );
+
+ $this->addDebug("classes/reservationReport.inc", 'getReport', print_r($reportData,1));
+
+ return $reportData;
+ }
+
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ public function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/reservations.php b/models/admin/classes/reservations.php
new file mode 100644
index 0000000..80f5525
--- /dev/null
+++ b/models/admin/classes/reservations.php
@@ -0,0 +1,103 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/reservations.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataReservations.php';
+
+/**
+ * EventManagementAdminReservations class
+ *
+ * Event Management and Reservations System - Admin Code - Reservations section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/reservations.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminReservations extends EventManagementDataReservations
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Reservations Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getReservationsStats()
+ {
+ $resStats = array(
+ 'all' => $this->getStats(),
+ 'event' => 0,
+ 'member' => 0,
+ 'accom' => 0,
+ 'team' => 0
+ );
+
+ // Get stats for selected event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ $resStats['event'] = $this->getStats("conv = $eventID");
+ }
+
+ // Get stats for selected member
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $resStats['member'] = $this->getStats("member = $memberID");
+ }
+
+ // Get stats for selected accommodation
+ if (($accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+ $resStats['accom'] = $this->getStats("accommodation = $accomID");
+ }
+
+ // Get stats for selected team
+ if (($teamID = $_SESSION[GLM_EVENT_SESSION]['Team'])) {
+ $resStats['event'] = $this->getStats("team = $teamID");
+ }
+
+ // var_dump($resStats);
+ return $resStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/roomBlockReport.php b/models/admin/classes/roomBlockReport.php
new file mode 100644
index 0000000..174a2ff
--- /dev/null
+++ b/models/admin/classes/roomBlockReport.php
@@ -0,0 +1,240 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/roomBlockReporteport.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/Reports/dataRoomBlockReport.php';
+
+/**
+ * EventManagementAdminEvents class
+ *
+ * Event Management and Reservations System - Admin Code - Reservation Report section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Events
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminRoomBlockReport extends EventManagementDataRoomBlockReport
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ function __construct($dbh, $config)
+ {
+ parent::__construct($dbh, $config);
+ }
+
+ /**
+ * Get Report Request Form
+ *
+ * @return object containing array as sub-objects
+ */
+ function getForm()
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'reason' => array(),
+ 'form' => array()
+ );
+
+ $reportData['form'] = $this->newControls();
+
+ $this->addDebug("classes/roomBlockReport.inc", 'getForm()', print_r($reportData,1));
+
+ return $reportData;
+ }
+
+ /**
+ * Process Report
+ *
+ * @return object containing array as sub-objects
+ */
+ function getReport($setEvent = false, $setState = false)
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'reason' => array(),
+ 'report' => array()
+ );
+
+ // If no specific event and state rep is requested, then process input for selections
+ if ($setState == false) {
+
+ /*
+ * Try to process report form request
+ */
+ $request = $this->processInputData();
+ if (!$request['status']) {
+ $reportData['status'] = false;
+
+ if ($request['fieldFail']['event_name']) {
+ $reportData['reason'][] = 'An event was not selected';
+ }
+
+ if ($request['fieldFail']['output_type']) {
+ $reportData['reason'][] = 'An output type was not selected';
+ }
+
+ }
+
+ /*
+ * Get report data
+ */
+ $r = $request['fieldData'];
+ $event = $r['event_name']['in'];
+ $state = ($r['state_rep']['in'] != '0' ? $r['state_rep']['in'] : false);
+ $team = ($r['team_code']['in'] != '0' ? $r['team_code']['in'] : false);
+ $property = ($r['prop_name']['in'] != '0' ? $r['prop_name']['in'] : false);
+ $reportData['report']['doingProperties'] = $r['property_section']['value'];
+ $reportData['report']['doingAssigned'] = $r['assigned_section']['value'];
+ $reportData['report']['doingOptionAssigned'] = $r['option_assigned']['value'];
+ $reportData['output'] = $r['output_type']['value'];
+
+ } else {
+
+ // There's been a specific request
+ $event = $setEvent;
+ $state = $setState;
+
+ $team = false;
+ $property = false;
+ $reportData['report']['doingProperties'] = true;
+ $reportData['report']['doingAssigned'] = true;
+ $reportData['report']['doingOptionAssigned'] = false;
+ $reportData['output'] = 'html';
+
+ }
+
+ // If the request is valid - Produce the report
+ if ($reportData['status']) {
+
+ // Get Event data
+ $sql = "SELECT * FROM eventmgt.event WHERE id = $event;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['event'] = $eventData;
+
+ // Get State data
+ $reportData['report']['state'] = false;
+ if ($state) {
+ $sql = "SELECT * FROM eventmgt.state_rep WHERE id = $state;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $stateData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['state'] = $stateData;
+ }
+
+ // Get Team data
+ $reportData['report']['team'] = false;
+ if ($team) {
+ $sql = "SELECT * FROM eventmgt.team WHERE id = $team;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['team'] = $teamData;
+ }
+
+ // Get Property data
+ $reportData['report']['property'] = false;
+ if ($property) {
+ $sql = "SELECT * FROM eventmgt.member WHERE id = $property;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $propertyData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['property'] = $propertyData;
+ }
+
+ // Get Event Room Blocks
+
+ require 'blocks.php';
+ $Blocks = new EventManagementAdminBlocks($this->dbh, $this->config);
+ // Get room block list sorted and in summary mode (see function for explanation)
+ $blocksList = $Blocks->getRoomBlocks($event, true, true, $state, $team, $property);
+ $reportData['report']['roomBlocks'] = $blocksList;
+
+ // Check for results
+ if (!is_array($blocksList) || count($blocksList) == 0) {
+ $reportData['status'] = false;
+ $reportData['reason'][] = 'No data was returned for this report.';
+ }
+
+ }
+
+ $this->addDebug("classes/roomBlockReport.inc", 'getReport()', print_r($reportData,1));
+
+ return $reportData;
+ }
+
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ public function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/roomRequestReport.php b/models/admin/classes/roomRequestReport.php
new file mode 100644
index 0000000..2bdb02c
--- /dev/null
+++ b/models/admin/classes/roomRequestReport.php
@@ -0,0 +1,383 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/roomRequestReporteport.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/Reports/dataRoomRequestReport.php';
+
+/**
+ * EventManagementAdminEvents class
+ *
+ * Event Management and Reservations System - Admin Code - Room Request Report section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Events
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/events.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminRoomRequestReport extends EventManagementDataRoomRequestReport
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ function __construct($dbh, $config)
+ {
+ parent::__construct($dbh, $config);
+ }
+
+ /**
+ * Get Report Request Form
+ *
+ * @return object containing array as sub-objects
+ */
+ function getForm()
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'reason' => array(),
+ 'form' => array()
+ );
+
+ $reportData['form'] = $this->newControls();
+
+ $this->addDebug("classes/roomRequestReport.inc", 'getForm()', print_r($reportData,1));
+
+ return $reportData;
+ }
+
+ /**
+ * Process Report
+ *
+ * @return object containing array as sub-objects
+ */
+ function getReport($setEvent = false)
+ {
+
+ $reportData = array(
+ 'status' => true,
+ 'output' => false,
+ 'reason' => array(),
+ 'report' => array()
+ );
+
+ /*
+ * Try to process report form request
+ */
+ $request = $this->processInputData();
+ if (!$request['status']) {
+ $reportData['status'] = false;
+
+ if ($request['fieldFail']['event_name']) {
+ $reportData['reason'][] = 'An event was not selected';
+ }
+
+ if ($request['fieldFail']['output_type']) {
+ $reportData['reason'][] = 'An output type was not selected';
+ }
+
+ }
+ $r = $request['fieldData'];
+
+ // Check for specified event
+ if ($setEvent) {
+ $event = $setEvent;
+ } else {
+ $event = $request['fieldData']['event_name']['in'];
+ }
+
+ /*
+ * Get report data
+ */
+ $state = ($r['state_rep']['in'] != '0' ? $r['state_rep']['in'] : false);
+ $team = ($r['team_code']['in'] != '0' ? $r['team_code']['in'] : false);
+ $property = ($r['prop_name']['in'] != '0' ? $r['prop_name']['in'] : false);
+ $reportData['report']['doingAvailable'] = false;
+ $reportData['report']['doingPending'] = $r['pending_select']['value'];
+ $reportData['report']['doingConfirmed'] = $r['confirmed_select']['value'];
+ $reportData['report']['doingDeclined'] = $r['declined_select']['value'];
+ $where = '';
+
+ // If an event is selected, get that data
+ $reportData['report']['event'] = false;
+ if ($event > 0) {
+
+ // Get Event data
+ $sql = "SELECT * FROM eventmgt.event WHERE id = $event;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['event'] = $eventData;
+
+ $where = "conv = $event";
+
+ } else {
+ // No event selected, so show for all events that haven't ended yet
+ $where = ($where!=''?' AND ':'')."T.conv_end > 'now'";
+ }
+
+ // If a State Rep is selected filter by that
+ if ($state) {
+
+ // Build query where clause to filter for any requested state
+ $where .= ($where!=''?' AND ':'')." T.team_id IN (SELECT team.id FROM eventmgt.team WHERE state = $state)";
+
+ // Also get state information
+ $sql = "SELECT * FROM eventmgt.state_rep WHERE id = $state;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $stateData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['state'] = $stateData;
+
+ }
+
+ // If a team has been selected, filter by that.
+ if ($team) {
+
+ $where .= ($where!=''?' AND ':'')." T.team_id = $team";
+
+ // Also get team information
+ $sql = "SELECT * FROM eventmgt.team WHERE id = $team;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['team'] = $teamData;
+
+ // Also check if availability requested.
+ $reportData['report']['doingAvailable'] = $r['available_select']['value'];
+ // If doingAvailable, override Pending, Confirmed, Declined
+ if ($reportData['report']['doingAvailable']) {
+ $reportData['report']['doingPending'] = true;
+ $reportData['report']['doingConfirmed'] = true;
+ $reportData['report']['doingDeclined'] = false;
+ }
+
+ }
+
+ // If a property has been selected, filter by that.
+ if ($property) {
+
+ $where .= ($where!=''?' AND ':'')." T.member = $property";
+
+ // Also get team information
+ $sql = "SELECT * FROM eventmgt.member WHERE id = $property;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $propertyData = $stmt->fetch(PDO::FETCH_ASSOC);
+ $reportData['report']['property'] = $propertyData;
+ }
+
+ // Get Event Reservations
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataReservations.php';
+ $Reservations = new EventManagementDataReservations($this->dbh, $this->config);
+ $reservationsList = $Reservations->getList($where);
+
+ // Build totals
+ $numb_res = 0;
+ $total_hotel = 0;
+ $total_taxes = 0;
+ $total_fees = 0;
+ $grand_total = 0;
+ $grand_total_rooms = 0;
+
+ // Reorganize reservations data as room report and collect totals
+ if (is_array($reservationsList) && count($reservationsList) > 0) {
+
+ reset($reservationsList);
+ $roomRequests = array();
+ while (list($k, $v) = each($reservationsList)) {
+
+ // Check if request matches filters
+ $show = false;
+ if ($reportData['report']['doingPending'] && !$v['confirmed']['value'] && !$v['declined']['value']) {
+ $show = true;
+ }
+ if ($reportData['report']['doingConfirmed'] && $v['confirmed']['value']) {
+ $show = true;
+ }
+ if ($reportData['report']['doingDeclined'] && $v['declined']['value']) {
+ $show = true;
+ }
+
+ if ($show) {
+
+ // Extract detail in case we need it
+ $v['detail'] = unserialize($v['res_detail']);
+
+ // Put fees into results - NEED TO FIX AND GET FROM DATABASE
+ $fees = 25;
+ $reportData['report']['reservations'][$k]['fees'] = '$25.00';
+
+ // Add to totals
+ $numb_res++;
+ $total_hotel += $v['hotel_price_numb'];
+ $total_taxes += $v['taxes_numb'];
+ $total_fees += $fees;
+ $grand_total += $v['grand_total_numb'];
+
+ // If property hasn't been created yet, do it now
+ // $propId = $v['detail']['propId'];
+ $propId = $v['member_id'];
+ if (!isset($roomRequests[$propId])) {
+ $roomRequests[$propId] = array(
+ 'propName' => $v['detail']['propName'],
+ 'propCity' => $v['detail']['propCity'],
+ 'propState' => $v['detail']['propState'],
+ 'propPhone' => $v['detail']['propPhone'],
+ 'propRoomsTotal' => 0,
+ 'accoms' => array()
+ );
+ }
+
+ // For each accommodation with this reservation
+ if ($v['detail']['propAccom']) {
+ foreach ($v['detail']['propAccom'] as $accom) {
+
+ // If accommodation hasn't been created yet, do it now
+ if (!isset($roomRequests[$propId]['accoms'][$accom['accomId']])) {
+ $roomRequests[$propId]['accoms'][$accom['accomId']] = array(
+ 'accomTitle' => $accom['accomTitle'],
+ 'accomRoomsTotal' => 0,
+ 'roomRequests' => array()
+ );
+
+ // Get assigned and available for this accommodation/team (from room_block_seg).
+ $sql = "SELECT B.block_name, S.id, S.allocated, S.available
+ FROM eventmgt.room_block B, eventmgt.room_block_seg S, eventmgt.team T
+ WHERE B.state_rep = ".$v['state_rep']."
+ AND T.name = '".$v['org']."'
+ AND B.team = T.id
+ AND S.block = B.id
+ AND S.accommodation = ".$accom['accomId'].";";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $blockData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ $roomRequests[$propId]['accoms'][$accom['accomId']]['blockName'] = $blockData['block_name'];
+ $roomRequests[$propId]['accoms'][$accom['accomId']]['blockAssigned'] = $blockData['allocated'];
+ $roomRequests[$propId]['accoms'][$accom['accomId']]['blockAvailable'] = $blockData['available'];
+ $roomRequests[$propId]['accoms'][$accom['accomId']]['blockAvailableActual'] = $blockData['allocated'];;
+ }
+
+ // Add this accommodation request
+ $grand_total_rooms += $accom['accomQuant'];
+ $roomRequests[$propId]['propRoomsTotal'] += $accom['accomQuant'];
+ $roomRequests[$propId]['accoms'][$accom['accomId']]['accomRoomsTotal'] += $accom['accomQuant'];
+ $roomRequests[$propId]['accoms'][$accom['accomId']]['blockAvailableActual'] -= $accom['accomQuant'];
+ $roomRequests[$propId]['accoms'][$accom['accomId']]['roomRequests'][] = array(
+ 'org' => trim($v['org']),
+ 'fname' => $v['fname'],
+ 'lname' => $v['lname'],
+ 'city' => $v['city'],
+ 'state' => $v['state'],
+ 'phone' => $v['phone'],
+ 'dateRequested' => $v['date_entered']['date'],
+ 'confirmed' => $v['confirmed']['value'],
+ 'dateConfirmed' => $v['date_confirmed']['date'],
+ 'confirmedBy' => $v['conf_by'],
+ 'declined' => $v['declined']['value'],
+ 'accomQuant' => $accom['accomQuant'],
+ 'arriveDate' => $accom['accomArrive'],
+ 'departDate' => $accom['accomDepart'],
+ 'nights' => $accom['accom_nights']
+ );
+
+ } // each accom
+ } else {
+// echo "Problem retrieving reservation detail for: ".$v['lname'].", ".$v['fname'].", res # $propId ";
+ }
+ } // if show
+
+ } // each reservation
+
+//echo "
".print_r($roomRequests,1)."
";
+
+ }
+//echo "
".print_r($reservationsList,1)."
";
+
+ $reportData['report']['roomRequests'] = $roomRequests;
+ $reportData['output'] = $r['output_type']['value'];
+
+ $reportData['report']['totals'] = array(
+ 'numb_reservations' => $numb_res,
+ 'hotel' => $this->money($total_hotel),
+ 'taxes' => $this->money($total_taxes),
+ 'fees' => $this->money($total_fees),
+ 'grand_total' => $this->money($grand_total),
+ 'grand_total_rooms' => $grand_total_rooms
+ );
+
+ $this->addDebug("classes/roomRequestReport.inc", 'getReport()', print_r($reportData,1));
+
+ return $reportData;
+ }
+
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ public function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/rooms.php b/models/admin/classes/rooms.php
new file mode 100644
index 0000000..cfd0427
--- /dev/null
+++ b/models/admin/classes/rooms.php
@@ -0,0 +1,68 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/rooms.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataRooms.php';
+
+/**
+ * EventManagementAdminRooms class
+ *
+ * Event Management and Reservations System - Admin Code - Accommodations section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Accommodations
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/rooms.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminRooms extends EventManagementDataRooms
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+ /**
+ * Get Rooms Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getRoomsStats()
+ {
+ return false;
+ }
+
+
+}
+
+?>
+
diff --git a/models/admin/classes/sections.php b/models/admin/classes/sections.php
new file mode 100644
index 0000000..bf3acc5
--- /dev/null
+++ b/models/admin/classes/sections.php
@@ -0,0 +1,81 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/sections.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+
+/**
+ * EventManagementAdminContacts class
+ *
+ * Event Management and Reservations System - Admin Code - Contacts section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Sections
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/sections.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminSections extends EventManagementDataSections
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Sectionss Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberSectionsStats($memberID = false)
+ {
+ // Get member ID from session - if available get stats for member
+ if ($memberID || ($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ return $this->getStats("member = $memberID");
+ }
+ return 0;
+ }
+ function getSectionsStats()
+ {
+ $sectionsStats = array(
+ 'all' => $this->getStats(),
+ 'member' => $this->getMemberSectionsStats()
+ );
+
+ return $sectionsStats;
+ }
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/sold.php b/models/admin/classes/sold.php
new file mode 100644
index 0000000..9fbdb71
--- /dev/null
+++ b/models/admin/classes/sold.php
@@ -0,0 +1,58 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/sold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSold.php';
+
+/**
+ * EventManagementAdminSold class
+ *
+ * Event Management and Reservations System - Admin Code - Sold Tickets
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/sold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementAdminSold extends EventManagementDataSold
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/states.php b/models/admin/classes/states.php
new file mode 100644
index 0000000..1952d46
--- /dev/null
+++ b/models/admin/classes/states.php
@@ -0,0 +1,86 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/states.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataStates.php';
+
+/**
+ * EventManagementAdminStates class
+ *
+ * Event Management and Reservations System - Admin Code - States section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/states.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminStates extends EventManagementDataStates
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get State Reps Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getStatesStats()
+ {
+ $statesStats = array(
+ 'all' => $this->getStats(),
+ 'event' => 0
+ );
+
+ // Get event ID from session - if available get stats for teams listed with this event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ $statesStats['event'] = $this->getStats("
+ conv = $eventID
+ ");
+ }
+
+ return $statesStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/teams.php b/models/admin/classes/teams.php
new file mode 100644
index 0000000..6c988f5
--- /dev/null
+++ b/models/admin/classes/teams.php
@@ -0,0 +1,98 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/teams.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTeams.php';
+
+/**
+ * EventManagementAdminTeams class
+ *
+ * Event Management and Reservations System - Admin Code - Teams section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Members
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/teams.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminTeams extends EventManagementDataTeams
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $data;
+
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+
+
+ /**
+ * Get Members Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTeamsStats()
+ {
+ $teamsStats = array(
+ 'all' => $this->getStats(),
+ 'member' => 0,
+ 'event' => 0
+ );
+
+ // Get member ID from session - if available get stats for teams with booking for this member
+ if (($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $teamsStats['member'] = $this->getStats("
+ id in (
+ SELECT team
+ FROM eventmgt.team_property
+ WHERE property = $memberID
+ )
+ ");
+ }
+
+ // Get event ID from session - if available get stats for teams listed with this event
+ if (($eventID = $_SESSION[GLM_EVENT_SESSION]['Event'])) {
+ $teamsStats['event'] = $this->getStats("
+ conv = $eventID
+ ");
+ }
+
+ return $teamsStats;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/ticketInventory.php b/models/admin/classes/ticketInventory.php
new file mode 100644
index 0000000..20ca4df
--- /dev/null
+++ b/models/admin/classes/ticketInventory.php
@@ -0,0 +1,231 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/ticketInventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketInventory.php';
+
+/**
+ * EventManagementAdminContacts class
+ *
+ * Event Management and Reservations System - Admin Code - Contacts ticket
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/tickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementAdminTicketInventory extends EventManagementDataTicketInventory
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+ /**
+ * Get Tickets Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketTicketInventoryStats($ticketID = false)
+ {
+ if ($ticketID == false) {
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+ }
+ if (($ticketID)) {
+ return $this->getStats("ticket = $ticketID");
+ }
+ return 0;
+ }
+ function getPerformanceTicketInventoryStats($performanceID = false)
+ {
+ if ($performanceID == false) {
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+ }
+ if (($performanceID)) {
+ return $this->getStats("ticket in (SELECT id FROM eventmgt.ticket WHERE performance = $performanceID)");
+ }
+ return 0;
+ }
+ function getMemberTicketInventoryStats($memberID = false)
+ {
+
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+ // Get member ID from session - if available get stats for member
+ if (($memberID)) {
+ return $this->getStats("member = $memberID");
+ }
+ return 0;
+ }
+ function getMemberTicketInventorySalesStats($memberID = false, $where = '')
+ {
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+ // Get member ID from session - if available get stats for member
+ if (($memberID)) {
+ $sql = "
+ SELECT
+ (
+ SELECT COALESCE(SUM(I.quant),0)
+ FROM eventmgt.ticket_inventory I
+ WHERE I.ticket IN ( SELECT id FROM eventmgt.ticket WHERE member = $memberID )
+ $where
+ ) AS totalQuant,
+ (
+ SELECT COALESCE(SUM(I.sold),0)
+ FROM eventmgt.ticket_inventory I
+ WHERE I.ticket IN ( SELECT id FROM eventmgt.ticket WHERE member = $memberID )
+ $where
+ ) AS totalSold,
+ (
+ SELECT COALESCE(SUM(I.sold * T.price),0)
+ FROM eventmgt.ticket_inventory I, eventmgt.ticket T
+ WHERE I.ticket IN ( SELECT id FROM eventmgt.ticket WHERE member = $memberID )
+ $where
+ AND T.id = I.ticket
+ ) AS totalPrice
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $s = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ return $s;
+ }
+ return 0;
+ }
+ function getTicketInventoryStats()
+ {
+ $ticketInventoryStats = array(
+ 'all' => $this->getStats(),
+ 'member' => $this->getMemberTicketInventoryStats(),
+ 'performance' => $this->getPerformanceTicketInventoryStats(),
+ 'ticket' => $this->getTicketTicketInventoryStats(),
+ );
+
+ return $ticketsInventoryStats;
+ }
+
+ /**
+ * Generate Default Ticket Inventory
+ *
+ * @return object containing array as sub-objects
+ */
+ function generateDefaultTicketInventory($ticketID = false)
+ {
+
+ // If no ticket ID supplied, check session
+ if (!$ticketID) {
+ $ticketID = ($_SESSION[GLM_EVENT_SESSION]['Ticket'] - 0);
+ }
+
+ // If we have a ticket ID
+ if ($ticketID) {
+
+ // Get ticket information
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+ $Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+ $ticketDetail = $Tickets->getTicketDetail();
+ if (!$ticketDetail) {
+ return false;
+ }
+
+ // Get Performance Information
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $ticketDetail['performance_id'];
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+ $Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+ $performanceDetail = $Performances->getPerformanceDetail();
+ if (!$performanceDetail) {
+ return false;
+ }
+
+ // Check for existing ticket inventory - Don't generate default inventory if there's some already there
+ $inventoryStats = $this->getTicketTicketInventoryStats();
+ if ($inventoryStats > 0) {
+ return false;
+ }
+
+ // Collect needed data
+ $ticket = $ticketDetail['id'];
+ $member = $ticketDetail['member'];
+ $quant = $ticketDetail['quant'];
+ $time = 'null';
+ if ($ticketDetail['time_specific']['value']) {
+ $time = "'".trim($ticketDetail['ticket_time']['time'])."'";
+ }
+ $start = $ticketDetail['start_date']['timestamp'];
+ $end = $ticketDetail['end_date']['timestamp'];
+
+ // If not date specific, create a single inventory item with a null date
+ if (!$ticketDetail['date_specific']['value']) {
+
+ $sql = "INSERT INTO eventmgt.ticket_inventory
+ (ticket, member, quant, available, ticket_date, ticket_time, sold, active)
+ values
+ ($ticket, $member, $quant, $quant, null, $time, 0, true);\n";
+
+ } else {
+
+ // For each day of the performance
+ $sql = '';
+ for ($date = $start; $date <= $end; $date = strtotime(date('m/d/Y', $date).' +1 day')) {
+ $dateText = date('m/d/Y', $date);
+
+ // Check day of week settings and create inventory accordingly
+ $dow = date('w', $date);
+ if ($ticketDetail['days_of_week']['bitmap'][$dow]['default']) {
+ $sql .= "INSERT INTO eventmgt.ticket_inventory
+ (ticket, member, quant, available, ticket_date, ticket_time, sold, active)
+ values
+ ($ticket, $member, $quant, $quant, '$dateText', $time, 0, true);\n";
+ }
+
+ }
+ }
+
+ if ($sql != '') {
+ $this->dbh->exec($sql);
+ }
+
+ return true;
+ }
+
+ return false;
+
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/tickets.php b/models/admin/classes/tickets.php
new file mode 100644
index 0000000..7cc2380
--- /dev/null
+++ b/models/admin/classes/tickets.php
@@ -0,0 +1,82 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/tickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+
+/**
+ * EventManagementAdminContacts class
+ *
+ * Event Management and Reservations System - Admin Code - Contacts ticket
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/tickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementAdminTickets extends EventManagementDataTickets
+{
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $dbh
+ * @access public
+ */
+ public $data;
+
+
+ /**
+ * Get Tickets Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMemberTicketsStats($memberID = false)
+ {
+ // Get member ID from session - if available get stats for member
+ if ($memberID || ($memberID = $_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ return $this->getStats("member = $memberID");
+ }
+ return 0;
+ }
+ function getTicketsStats()
+ {
+ $ticketsStats = array(
+ 'all' => $this->getStats(),
+ 'member' => $this->getMemberTicketsStats()
+ );
+
+ return $ticketsStats;
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/classes/voucherCoupons.php b/models/admin/classes/voucherCoupons.php
new file mode 100755
index 0000000..727b0d6
--- /dev/null
+++ b/models/admin/classes/voucherCoupons.php
@@ -0,0 +1,68 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/voucherCoupons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataVoucherCoupons.php';
+
+/**
+ * EventManagementAdminVoucherCoupons class
+ *
+ * Event Management and Reservations System - Admin Code - Voucher Coupons section
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Voucher Coupons
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/voucherCoupons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementAdminVoucherCoupons extends EventManagementDataVoucherCoupons
+{
+ /**
+ * Configuration information object
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * Data Definitions Object
+ * @var $data
+ * @access public
+ */
+ public $data;
+
+ /**
+ * Get Voucher Coupons Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getVoucherCouponsStats()
+ {
+ return $this->getStats();
+
+ return 0;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/front/actions/Debug/start.inc b/models/front/actions/Debug/start.inc
new file mode 100644
index 0000000..d07c4fc
--- /dev/null
+++ b/models/front/actions/Debug/start.inc
@@ -0,0 +1,19 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->page->debugStartupTime = date('m/d/Y H:i:s');
+$this->templateFile = 'Debug/index.html';
+
+?>
+
diff --git a/models/front/actions/Debug/update.inc b/models/front/actions/Debug/update.inc
new file mode 100644
index 0000000..6a7e9e6
--- /dev/null
+++ b/models/front/actions/Debug/update.inc
@@ -0,0 +1,29 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+$this->page->debugUpdateTime = date('m/d/Y H:i:s');
+
+// If there's nothing to send, then don't
+if (!file_exists(DEBUG_DATA_FILENAME)) {
+ exit;
+}
+
+// Otherwise, send the current debug data
+$this->page->debugData = file_get_contents(DEBUG_DATA_FILENAME);
+unlink(DEBUG_DATA_FILENAME);
+
+$this->templateFile = 'Debug/index.html';
+
+?>
+
diff --git a/models/front/actions/Index/index.inc b/models/front/actions/Index/index.inc
new file mode 100644
index 0000000..bbd56e5
--- /dev/null
+++ b/models/front/actions/Index/index.inc
@@ -0,0 +1,21 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: event.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Reset Session
+$this->startSession(true);
+
+$this->templateFile = "index.html";
+
+?>
+
diff --git a/models/front/actions/Shop/PayPal.inc b/models/front/actions/Shop/PayPal.inc
new file mode 100644
index 0000000..a571bef
--- /dev/null
+++ b/models/front/actions/Shop/PayPal.inc
@@ -0,0 +1,110 @@
+dbh, $this->config);
+$cart = $Support->checkCart();
+$this->addDebug("Shop/checkoutSubmit.inc", 'Array: $cart', print_r($cart['cartData'],1));
+
+// Get selected cart data
+$memberID = ($_REQUEST['memberID']-0);
+$cartEntry = $cart['cartData'][$memberID];
+
+// If we can't find the correct cart entry
+if (!is_array($cartEntry)) {
+
+ $this->templateFile = "Shop/PayPalFail.html";
+
+ // We have the correct cart entry
+} else {
+
+ // Prepare for purchase authorization request with PayPal REST API
+ $account = array(
+ 'clientID' => $cartEntry['paypal_client_id'],
+ 'secret' => $cartEntry['paypal_secret'],
+ 'test' => $cartEntry['paypal_mode']['value'],
+ 'returnURL' => $this->page->baseURL."?Action=Shop_PayPalApproved&memberID=$memberID",
+ 'cancelURL' => $this->page->baseURL."?Action=Shop_PayPalCanceled&memberID=$memberID",
+ );
+ $payment = array(
+ 'name' => $cartEntry['name'],
+ 'charge' => $cartEntry['totalPrice_numb'],
+ 'invoice' => '',
+ 'description' => $config->term->event->cap.' Tickets',
+ 'items' => array(
+ )
+ );
+ $contact = array();
+
+ // Build items array from cart data
+ $items = array();
+ // For each date of tickets
+ foreach ($cartEntry['dates'] as $d) {
+
+ // For each Performance
+ foreach ($d['performances'] as $p) {
+
+ // For each Section
+ foreach ($p['sections'] as $s) {
+
+ // For each ticket
+ foreach ($s['tickets'] as $t) {
+
+ // Add this cart selection
+ $payment['items'][] = array(
+ 'quantity' => $t['selected'],
+ 'name' => $p['name'].", ".$d['date'].", ".$s['name'].", ".$t['name'],
+ 'price' => $t['price_numb'],
+ 'sku' => $t['invID']
+ );
+
+ }
+
+ }
+
+ }
+
+ }
+
+
+ // Create the PayPal object (note no previous access object)
+ $PayPal = new PayPalPaymentGateway($account, false, false);
+
+ // Was there an error?
+ if (!$PayPal->status) {
+ echo "Received an error: ".$PayPal->error;
+ exit;
+ }
+
+ // Try to enter Payment
+ $PayPal->processPayment($payment, $contact);
+
+ // Was there an error?
+ if (!$PayPal->status) {
+ echo "Received an error: ".$PayPal->error;
+ exit;
+ }
+
+ // Store access information
+ $_SESSION[GLM_EVENT_MGT_FRONT]['PayPal'][$memberID] = array(
+ 'account' => $account,
+ 'access' => $PayPal->access,
+ 'trans' => $PayPal->trans,
+ 'cart' => $cartEntry
+ );
+
+ // Show user link to PayPal for them to approve payment
+ // Note that uses a target to create a new window/tab
+ // Use browser redirect 302 to send user to PayPal.
+ // This is proper way to do so according to the API documentation.
+ header('Location: '.$PayPal->trans->urls->approval_url->href);
+ exit;
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/front/actions/Shop/PayPalApproved.inc b/models/front/actions/Shop/PayPalApproved.inc
new file mode 100644
index 0000000..866fb8e
--- /dev/null
+++ b/models/front/actions/Shop/PayPalApproved.inc
@@ -0,0 +1,96 @@
+dbh, $this->config);
+$cart = $Support->checkCart();
+$this->addDebug("Shop/checkoutSubmit.inc", 'Array: $cart', print_r($cart['cartData'],1));
+
+// Get selected cart data
+$memberID = ($_REQUEST['memberID']-0);
+$cartEntry = $cart['cartData'][$memberID];
+
+// If we can't find the correct cart entry
+if (!is_array($cartEntry)) {
+
+ $this->templateFile = "Shop/PayPalFail.html";
+
+// We have the correct cart entry
+} else {
+
+ // Prepare to execute payment with PayPal REST API
+ $account = array(
+ 'clientID' => $cartEntry['gateway_par1'],
+ 'secret' => $cartEntry['gateway_par2'],
+ 'test' => $cartEntry['gateway_par3']['value'],
+ 'returnURL' => $this->page->baseURL."?Action=Shop_PayPalApproved&memberID=$memberID",
+ 'cancelURL' => $this->page->baseURL."?Action=Shop_PayPalCanceled&memberID=$memberID",
+ );
+
+ // Save Payer ID
+ $_SESSION[GLM_EVENT_MGT_FRONT]['PayPal'][$memberID]['payerID'] = $_REQUEST['PayerID']; // NEED TO FILTER THIS FOR PRODUCTION
+
+ // Create PayPal object with existing access object from the session
+ $PayPal = new PayPalPaymentGateway(
+ $_SESSION[GLM_EVENT_MGT_FRONT]['PayPal'][$memberID]['account'],
+ $_SESSION[GLM_EVENT_MGT_FRONT]['PayPal'][$memberID]['access'],
+ $_SESSION[GLM_EVENT_MGT_FRONT]['PayPal'][$memberID]['trans']
+ );
+
+ // Execute the PayPal payment
+ $payerID = $_REQUEST['PayerID'];
+ $r = $PayPal->executePayment($payerID);
+
+ // Check if payment executed correctly
+ if ($r['status']) {
+
+ $payment = array(
+ 'id' => $memberID,
+ 'status' => true,
+ 'type' => 'pp',
+ 'statusText' => $r['statusText'],
+ 'authCode' => '',
+ 'description' => $r['description'],
+ 'newApproval' => false,
+ 'spec_req' => '',
+ 'approved' => true,
+ 'cctype' => array('name' => 'PayPal'),
+ 'ccname' => array('value' => $r['payerName']),
+ 'ccexp' => array('value' => ''),
+ 'ccnumb' => '',
+ 'orderID' => ''
+ );
+var_dump($payment);
+
+ // Store order
+ $cart = $_SESSION[GLM_EVENT_MGT_FRONT]['PayPal'][$memberID]['cart'];
+ $contact = $_SESSION[GLM_EVENT_MGT_FRONT]['ContactInput'];
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/checkoutSupport.php';
+ $CheckoutSupport = new EventManagementFrontCheckoutSupport($this->dbh, $this->config, $Support);
+var_dump($contact);
+ $orderID = $CheckoutSupport->storePurchase($cart, $contact, $payment);
+echo "Order ID = $orderID
";
+
+ // Need to send E-Mail to customer
+
+
+
+ $this->templateFile = "Shop/PayPalApproved.html";
+
+
+ // Otherwise the payment didn't execute correctly
+ } else {
+
+ $this->templateFile = "Shop/PayPalFail.html";
+
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/front/actions/Shop/additionalInfo.inc b/models/front/actions/Shop/additionalInfo.inc
new file mode 100755
index 0000000..348b5b5
--- /dev/null
+++ b/models/front/actions/Shop/additionalInfo.inc
@@ -0,0 +1,177 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: cart.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// If this is a home page ticket selection, save default member
+if (isset($_REQUEST['locationSelect'])) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['Member'] = ($_REQUEST['locationSelect']-0);
+}
+
+// Load the front-end support class
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+// If cart sticky is enables
+if ($this->config->option->ticket_selection->show_cart_sticky_items) {
+
+ // Get list of cart sticky items - Items that always display in the cart even if there's no quant selected
+ $cartSticky = $Support->getCartStickyInventory();
+
+ // Default all current cart entries to sticky = false (will be updated if they're sticky)
+ while (list($k, $v) = each($cartSticky)) {
+ $cartSticky[$k]['sticky'] = false;
+ }
+
+}
+
+// Check if there's any promo codes
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPromos.php';
+$Promos = new EventManagementDataPromos($this->dbh, $this->config);
+$promoList = $Promos->getList();
+$this->page->havePromoCodes = false;
+if (is_array($promoList) && count($promoList) > 0) {
+ $this->page->havePromoCodes = true;
+}
+
+// Check for Promo Code Selection
+if (isset($_REQUEST['cart']) && $_REQUEST['cart'] == 'promo_code') {
+ $promo_code = filter_input(INPUT_GET, 'promo_code', FILTER_SANITIZE_STRING);
+ $_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'] = $promo_code;
+
+} elseif (isset($_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'])) {
+ $promo_code = $_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'];
+}
+
+// Check if we're getting a selection of assignment to a member/location
+if ($_REQUEST['cart'] == 'update_assignment') {
+
+ // If we don't have an assignment session array, start one
+ if (!isset($_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'])) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'] = array();
+ }
+
+ // Add/update this assignment
+ $_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'][($_REQUEST['member_assigned']-0)] = ($_REQUEST['assigned_to']-0);
+
+ // Also check if we need to handle entrance assignment
+ unset($_SESSION['GLM_EVENT_MGT_FRONT']['AssignmentEntrance'][($_REQUEST['member_assigned']-0)]);
+ if ($this->config->option->ticket_selection->select_entrance_on_consignment &&
+ isset($_REQUEST['entrance_assigned']) && ($_REQUEST['entrance_assigned']-0) > 0 ) {
+ // Add/update entrance assignment
+ $_SESSION['GLM_EVENT_MGT_FRONT']['AssignmentEntrance'][($_REQUEST['member_assigned']-0)] = ($_REQUEST['entrance_assigned']-0);
+ }
+
+}
+
+// Check if we're getting selection of a likely departure date
+if ($_REQUEST['cart'] == 'update_likelyDate') {
+
+ // If we don't have a likely date array, start one
+ if (!isset($_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'])) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'] = array();
+ }
+
+ // Validate likely date and store if it's sane
+ $likelyDate = date('m/d/Y', strtotime($_REQUEST['likely_date']));
+ if ($likelyDate != '12/31/1969') {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'][($_REQUEST['member']-0)] = $likelyDate;
+ } else {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'][($_REQUEST['member']-0)] = '';
+ }
+
+}
+
+// If cart sticky items is enabled and we have any cart sticky items
+$haveCartStickyItems = false;
+if ($this->config->option->ticket_selection->show_cart_sticky_items && $cartSticky) {
+
+ $haveCartStickyItems = true;
+
+ $this->addDebug("Shop/cart.inc", 'Array: $cartSticky', print_r($cartSticky,1));
+
+ // Make sure cart sticky inventory is in cart
+ foreach ($cartSticky as $c) {
+
+ // Check if there's no cart entry for this cart sticky item
+ if (!isset($_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'][$c['id']])) {
+
+ // Add to cart
+ $_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'][$c['id']] = array(
+ 'invenID' => $c['id'],
+ 'member' => $c['member'],
+ 'assigned' => false,
+ 'quant' => 0
+ );
+ }
+
+ // Mark entry as Sticky
+ $_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'][$c['id']]['sticky'] = true;
+
+ }
+
+}
+
+// Check if there's been anything added to the cart and get cart contents
+$cart = $Support->checkCart();
+
+// If we're already locked into checkout, go there
+if ($cart['forceCheckoutPhase']) {
+ $this->reason[] = 'You have partially paid for your purchases. We have returned you to checkout to complete your purchase.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+}
+
+// If there's no cart contents, make sure there's no cart array.
+if (!$cart['cartHasContents']) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'] = false;
+}
+
+// If we're doing cart promotions, get any performances with promote_on_cart set
+if ($this->config->option->cart_promotions) {
+ $cartPromotions = $Support->getCartPromotions();
+ if ($cartPromotions) {
+ $this->page->cartPromotions = $this->bindArrayToObject($cartPromotions);
+ }
+}
+
+//var_dump($this->page->cartPromotions);
+
+// Check if we received a vertical scroll position
+$vertScroll = 0;
+if ($_REQUEST['vertScroll']) {
+ $vertScroll = ($_REQUEST['vertScroll']-0);
+}
+$this->page->vertScroll = $vertScroll;
+
+// Otherwise we're OK to continue showing the cart
+$this->page->promoCode = $promo_code;
+$this->page->blockCheckout = $cart['blockCheckout'];
+$this->page->blockCheckoutNonAssignment = $cart['blockCheckoutNonAssignment'];
+$this->page->haveCartStickyItems = $haveCartStickyItems;
+$this->page->cartHasContents = $cart['cartHasContents'];
+$this->page->cartHasOneVenueOnly = $cart['cartHasOneVenueOnly'];
+$this->page->cart = $this->bindArrayToObject($cart['cartDataReorganized']); // Use reorganized cart
+$this->page->totals = $this->bindArrayToObject($cart['totals']);
+$this->reason = array_merge($this->reason, $cart['reason']);
+
+if ($cart['blockCheckoutNonAssignment']) {
+ $this->templateFile = "Shop/cart.html";
+} else {
+ $this->templateFile = "Shop/additionalInfo.html";
+}
+
+$this->addDebug("Shop/cart.inc", 'Array: $totals', print_r($cart['totals'],1));
+$this->addDebug("Shop/cart.inc", 'Array: $cart', print_r($rCart,1));
+
+?>
+
diff --git a/models/front/actions/Shop/cart.inc b/models/front/actions/Shop/cart.inc
new file mode 100644
index 0000000..2232bc0
--- /dev/null
+++ b/models/front/actions/Shop/cart.inc
@@ -0,0 +1,203 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: cart.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// If this is a home page ticket selection, save default member
+if (isset($_REQUEST['locationSelect'])) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['Member'] = ($_REQUEST['locationSelect']-0);
+}
+
+// Load the front-end support class
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+// If cart sticky is enables
+if ($this->config->option->ticket_selection->show_cart_sticky_items) {
+
+ // Get list of cart sticky items - Items that always display in the cart even if there's no quant selected
+ $cartSticky = $Support->getCartStickyInventory();
+
+ // Default all current cart entries to sticky = false (will be updated if they're sticky)
+ while (list($k, $v) = each($cartSticky)) {
+ $cartSticky[$k]['sticky'] = false;
+ }
+
+}
+
+// Check if there's any promo codes
+require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPromos.php';
+$Promos = new EventManagementDataPromos($this->dbh, $this->config);
+$promoList = $Promos->getList();
+$this->page->havePromoCodes = false;
+if (is_array($promoList) && count($promoList) > 0) {
+ $this->page->havePromoCodes = true;
+}
+
+// Check for Promo Code Selection
+if (isset($_REQUEST['cart']) && $_REQUEST['cart'] == 'promo_code') {
+ $promo_code = filter_input(INPUT_GET, 'promo_code', FILTER_SANITIZE_STRING);
+ $_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'] = $promo_code;
+} elseif (isset($_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'])) {
+ $promo_code = $_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'];
+}
+
+// Check if we're getting a selection of assignment to a member/location
+if ($_REQUEST['cart'] == 'update_assignment') {
+
+ // If we don't have an assignment session array, start one
+ if (!isset($_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'])) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'] = array();
+ }
+
+ // Add/update this assignment
+ $_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'][($_REQUEST['member_assigned']-0)] = ($_REQUEST['assigned_to']-0);
+
+ // Also check if we need to handle entrance assignment
+ unset($_SESSION['GLM_EVENT_MGT_FRONT']['AssignmentEntrance'][($_REQUEST['member_assigned']-0)]);
+ if ($this->config->option->ticket_selection->select_entrance_on_consignment &&
+ isset($_REQUEST['entrance_assigned']) && ($_REQUEST['entrance_assigned']-0) > 0 ) {
+ // Add/update entrance assignment
+ $_SESSION['GLM_EVENT_MGT_FRONT']['AssignmentEntrance'][($_REQUEST['member_assigned']-0)] = ($_REQUEST['entrance_assigned']-0);
+ }
+
+}
+
+// Check if we're getting selection of a likely departure date
+if ($_REQUEST['cart'] == 'update_likelyDate') {
+
+ // If we don't have a likely date array, start one
+ if (!isset($_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'])) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'] = array();
+ }
+
+ // Validate likely date and store if it's sane
+ $likelyDate = date('m/d/Y', strtotime($_REQUEST['likely_date']));
+ if ($likelyDate != '12/31/1969') {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'][($_REQUEST['member']-0)] = $likelyDate;
+ } else {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['LikelyDate'][($_REQUEST['member']-0)] = '';
+ }
+
+}
+
+// If cart sticky items is enabled and we have any cart sticky items
+$haveCartStickyItems = false;
+if ($this->config->option->ticket_selection->show_cart_sticky_items && $cartSticky) {
+
+ $haveCartStickyItems = true;
+
+ $this->addDebug("Shop/cart.inc", 'Array: $cartSticky', print_r($cartSticky,1));
+
+ // Make sure cart sticky inventory is in cart
+ foreach ($cartSticky as $c) {
+
+ // Check if there's no cart entry for this cart sticky item
+ if (!isset($_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'][$c['id']])) {
+
+ // Add to cart
+ $_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'][$c['id']] = array(
+ 'invenID' => $c['id'],
+ 'member' => $c['member'],
+ 'assigned' => false,
+ 'quant' => 0
+ );
+ }
+
+ // Mark entry as Sticky
+ $_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'][$c['id']]['sticky'] = true;
+
+ }
+
+}
+
+// Check if there's been anything added to the cart and get cart contents
+$cart = $Support->checkCart();
+;
+// If we're already locked into checkout, go there
+if ($cart['forceCheckoutPhase']) {
+ $this->reason[] = 'You have partially paid for your purchases. We have returned you to checkout to complete your purchase.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+}
+
+// If there's no cart contents, make sure there's no cart array.
+if (!$cart['cartHasContents'] || count($cart['cartDataReorganized']) == 0) {
+ $_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'] = false;
+
+ $cart['cartHasContents'] = false;
+// Otherwise check that we're not mixing no-payment location with other locations
+$this->page->blockCheckoutMixedPayment = false;
+} else {
+
+ $paid = false;
+ $nonpaid = false;
+
+ // For each venu in the cart
+ foreach ($cart['cartDataReorganized'] as $c) {
+
+ // Check for mix of credit card and manual payment
+ if ($c['payment_gateway']['value'] == 3) {
+ $nonpaid = true;
+ } else {
+ $paid = true;
+ }
+
+ }
+
+ // If there's a mix, warn the user and don't permit checkout.
+ if ($paid && $nonpaid) {
+ $this->reason[] = 'Mixing of credit card purchases and manual payment is not supported at this time.';
+ $this->page->blockCheckoutMixedPayment = true;
+ }
+
+}
+
+
+// If we're doing cart promotions, get any performances with promote_on_cart set
+if ($this->config->option->cart_promotions) {
+ $cartPromotions = $Support->getCartPromotions();
+ if ($cartPromotions) {
+ $this->page->cartPromotions = $this->bindArrayToObject($cartPromotions);
+ }
+}
+
+// echo "
".print_r($cart,1)."
";
+// var_dump($this->page->cartPromotions);
+
+// Check if we received a vertical scroll position
+$vertScroll = 0;
+if ($_REQUEST['vertScroll']) {
+ $vertScroll = ($_REQUEST['vertScroll']-0);
+}
+$this->page->vertScroll = $vertScroll;
+
+// Otherwise we're OK to continue showing the cart
+$this->page->promoCode = $promo_code;
+$this->page->blockCheckout = $cart['blockCheckout'];
+$this->page->blockCheckoutNonAssignment = $cart['blockCheckoutNonAssignment'];
+$this->page->doingAdditionalInfo = $cart['doingAdditionalInfo'];
+$this->page->haveCartStickyItems = $haveCartStickyItems;
+$this->page->cartHasContents = $cart['cartHasContents'];
+$this->page->cartHasOneVenueOnly = $cart['cartHasOneVenueOnly'];
+$this->page->cart = $this->bindArrayToObject($cart['cartDataReorganized']); // Use reorganized cart
+$this->page->totals = $this->bindArrayToObject($cart['totals']);
+$this->reason = array_merge($this->reason, $cart['reason']);
+$this->page->reason = $this->bindArrayToObject($this->reason);
+
+$this->templateFile = "Shop/cart.html";
+
+$this->addDebug("Shop/cart.inc", 'Array: $totals', print_r($cart['totals'],1));
+$this->addDebug("Shop/cart.inc", 'Array: $cart', print_r($rCart,1));
+
+?>
+
diff --git a/models/front/actions/Shop/checkout.inc b/models/front/actions/Shop/checkout.inc
new file mode 100644
index 0000000..bd84346
--- /dev/null
+++ b/models/front/actions/Shop/checkout.inc
@@ -0,0 +1,224 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: checkout.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Select the front-end support class
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/checkoutSupport.php';
+$CheckoutSupport = new EventManagementFrontCheckoutSupport($this->dbh, $this->config, $Support);
+
+// Clear any 0 quantity items from cart - This purges any 0 quant sticky items before trying to checkout
+if (is_array($_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart']) && count($_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart']) > 0) {
+ foreach ($_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'] as $c) {
+ if ($c['quant'] == 0) {
+ unset($_SESSION['GLM_EVENT_MGT_FRONT']['TicketCart'][$c['invenID']]);
+ }
+ }
+}
+
+// Check if we're coming back from checkoutSubmit.inc and already have cart data
+if (isset($checkoutCart)) {
+ $cart = $checkoutCart;
+} else {
+ // Check if there's been anything added to the cart and get cart contents (say we're doing checkout)
+ $cart = $Support->checkCart(true);
+}
+
+if (!$cart['cartHasContents']) {
+ $this->reason[] = 'Your cart is currently empty.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/cart.inc';
+ return;
+}
+$this->page->cartHasContents = true;
+
+// Check if there been partial payment and we're in a forced checkout phase - no cart changes or additions
+$this->page->forceCheckoutPhase = $cart['forceCheckoutPhase'];
+
+// Get a clear input value array and place payment data under each venue in $cart
+if (!isset($checkoutReturnFlag) || $checkoutReturnFlag == false ) {
+ $formData = $CheckoutSupport->checkoutInit($cart['cartData']);
+}
+
+// Is there central payment?
+if ($formData['centralPayment']) {
+
+ // Just a shortcut to the member data
+ $cpMemb = $formData['centralPayment']['membData'];
+
+ $cp = array(
+ 'havePayPal' => false,
+ 'haveCreditCards' => false,
+ 'havePaymentMethod' => false,
+ 'haveMultiplePaymentMethods' => false,
+ 'paymentForm' => $formData['payment']
+ );
+
+ // Check credit card payment setup for venu
+ if (
+ $cpMemb['payment_gateway']['value'] > 0 // Have processor selected
+ && count($cpMemb['cards_accepted']['names']) > 0 // Have credit cards selected
+ ) {
+
+ // Check for any needed gateway authentication information
+ $haveAuth = false;
+ switch($cpMemb['payment_gateway']['value']) {
+ case $this->config->ccard_processor_numb->authorize_net:
+ if ($cpMemb['gateway_par1'] != '' && $cpMemb['gateway_par2'] != '') {
+ $haveAuth = true;
+ }
+ break;
+ case $this->config->ccard_processor_numb->merchant_solutions:
+ if ($cpMemb['gateway_par1'] != '' && $cpMemb['gateway_par2'] != '') {
+ $haveAuth = true;
+ }
+ break;
+ case $this->config->ccard_processor_numb->test:
+ $haveAuth = true;
+ break;
+ }
+
+ if ($haveAuth) {
+
+ // Have good credit card gateway, have cards, have authentication
+ $cp['haveCreditCards'] = true;
+ $cp['havePaymentMethod'] = true;
+ }
+ }
+
+ // Check if we have PayPal authentication data
+ if (
+ $cpMemb['paypal']['value'] &&
+ $cpMemb['paypal_client_id'] != '' &&
+ $cpMemb['paypal_secret'] != ''
+ ){
+ $cp['havePayPal'] = true;
+ $cp['havePaymentMethod'] = true;
+
+ }
+
+ // Check if we have multiple payment methods for this member
+ if ($cp['haveCreditCards'] && $cp['havePayPal']) {
+ $cp['haveMultiplePaymentMethods'] = true;
+ }
+
+ $formData['centralPayment'] = array_merge($formData['centralPayment'], $cp);
+
+} else {
+
+ // Not doing Central Payment
+
+ if (is_array($formData['payment'])) {
+
+ foreach ($formData['payment'] as $p) {
+
+ // set shortcut to cart member/venue
+ $cm = &$cart['cartDataReorganized'][$p['id']];
+
+ // Add payment information
+ $cm['paymentForm'] = $p;
+
+ // Also check for valid payment methods
+ $cm['havePayPal'] = false;
+ $cm['haveCreditCards'] = false;
+ $cm['havePaymentMethod'] = false;
+ $cm['haveMultiplePaymentMethods'] = false;
+ if (
+ $cm['payment_gateway']['value'] > 0 // Have processor selected
+ && count($cm['cards_accepted']['names']) > 0 // Have credit cards selected
+ ) {
+ // Check for any needed gateway authentication information
+ $haveAuth = false;
+ switch($cm['payment_gateway']['value']) {
+ case $this->config->ccard_processor_numb->authorize_net:
+ if ($cm['gateway_par1'] != '' && $cm['gateway_par2'] != '') {
+ $haveAuth = true;
+ }
+ break;
+ case $this->config->ccard_processor_numb->merchant_solutions:
+ if ($cm['gateway_par1'] != '' && $cm['gateway_par2'] != '') {
+ $haveAuth = true;
+ }
+ break;
+ case $this->config->ccard_processor_numb->test:
+ $haveAuth = true;
+ break;
+ }
+
+ if ($haveAuth) {
+ // Have good credit card gateway, have cards, have authentication
+ $cm['haveCreditCards'] = true;
+ $cm['havePaymentMethod'] = true;
+ }
+ }
+
+ // Check if we have PayPal authentication data
+ if (
+ $cm['paypal']['value'] &&
+ $cm['paypal_client_id'] != '' &&
+ $cm['paypal_secret'] != ''
+ ) {
+ $cm['havePayPal'] = true;
+ $cm['havePaymentMethod'] = true;
+
+ }
+
+ // Check if we have multiple payment methods for this member
+ if ($cm['haveCreditCards'] && $cm['havePayPal']) {
+ $cm['haveMultiplePaymentMethods'] = true;
+ }
+
+ }
+ }
+}
+
+// If this an admin user
+$noPaymentReasons = false;
+if ($this->page->adminUser) {
+
+ // Get the misc settings
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+ $Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+ $miscDetail = $Misc->getEntry(1);
+
+ // If we have reasons for no payment
+ if (trim($miscDetail['no_payment_reasons']) != '') {
+
+ // Break it into an array and add to page data
+ $noPaymentReasons = explode(PHP_EOL, $miscDetail['no_payment_reasons']);
+ $this->page->noPaymentReasons = $noPaymentReasons;
+
+ }
+
+}
+
+
+unset($formData['payment']);
+
+// Otherwise we're OK to continue showing the cart
+$this->page->promoCode = $_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'];
+$this->page->cartHasContents = $cart['cartHasContents'];
+$this->page->cart = $this->bindArrayToObject($cart['cartDataReorganized']);
+$this->page->cartHasOneVenueOnly = $cart['cartHasOneVenueOnly'];
+$this->page->cartRequiresPayment = $cart['cartRequiresPayment'];
+$this->page->totals = $this->bindArrayToObject($cart['totals']);
+$this->page->formData = $this->bindArrayToObject($formData); // Blank form data for cleared fields
+$this->reason = array_merge($this->reason, $cart['reason']);
+
+$this->templateFile = "Shop/checkout.html";
+
+$this->addDebug("Shop/checkout.inc", 'Array: $totals', print_r($cart['totals'],1));
+$this->addDebug("Shop/checkout.inc", 'Array: $cart', print_r($cart['cartData'],1));
+$this->addDebug("Shop/checkout.inc", 'Array: $formData', print_r($formData,1));
+?>
+
diff --git a/models/front/actions/Shop/checkoutSubmit.inc b/models/front/actions/Shop/checkoutSubmit.inc
new file mode 100644
index 0000000..dea6f69
--- /dev/null
+++ b/models/front/actions/Shop/checkoutSubmit.inc
@@ -0,0 +1,323 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: checkout.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Select the front-end support class
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+/*
+ * Start by checking the cart and getting cart contents
+ */
+$cart = $Support->checkCart(true);
+
+// Assume we don't have to return to checkout
+$checkoutReturnFlag = false;
+
+// Need this before we put together the E-Mail summaries
+$this->page->promoCode = $_SESSION['GLM_EVENT_MGT_FRONT']['PromoCode'];
+
+// Check if there hasn't been a complete checkout yet.
+if (!$cart['checkoutComplete']) {
+
+ // Check for empty cart
+ if (!$cart['cartHasContents']) {
+ $this->reason[] = 'Your cart is currently empty.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/cart.inc';
+ return;
+ }
+
+ // If there's a problem with the cart, send the user back to the cart page
+ if ($cart['status'] == false) {
+ $this->reason = array_merge($this->reason, $cart['reason']);
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+ }
+
+ /*
+ * Check the submitted input for required and valid fields
+ */
+
+ // Load checkout support class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/checkoutSupport.php';
+ $CheckoutSupport = new EventManagementFrontCheckoutSupport($this->dbh, $this->config, $Support);
+
+ // Check submitted input to see if we have everything we need from the user
+ // Supply that data to the page and place payment data under each venue
+ $formData = $CheckoutSupport->checkoutInput($cart['cartDataReorganized']);
+
+ if ($formData != false) {
+
+
+ // If we didn't receive all needed input, display checkout form again
+ if (!$formData['status']) {
+ $checkoutReturnFlag = true;
+ $this->reason = array_merge($this->reason, $formData['reason']);
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+ }
+
+ // If we have Central Payment
+ if ($formData['centralPayment']) {
+
+ $membID = $formData['centralPayment']['membData']['id'];
+
+ // Check if reorganized cart data doesn't have central billing member.
+ if (!isset($cart['cartDataReorganized'][$membID])) {
+
+ // Didn't have it, so add the venue data now
+ $cart['cartDataReorganized'][$membID] = $formData['centralPayment']['membData'];
+
+ // Also flag that it's member data without any performances selected
+ $cart['cartDataReorganized'][$membID]['centralPaymentOnly'] = true;
+ } else {
+ $cart['cartDataReorganized'][$membID]['centralPaymentOnly'] = false;
+ }
+
+ // Mark the central billing member cart entry
+ $cart['cartDataReorganized'][$membID]['isCentralPaymentMember'] = true;
+
+ }
+
+ // Provide all cart and payment data back to the page for display
+ $this->page->formData = $this->bindArrayToObject($formData);
+
+ /*
+ * Try to process all payments - Supply our cart information and all user submitted information
+ */
+ $paymentResult = $CheckoutSupport->checkoutProcessPayments($cart['cartDataReorganized'], $formData);
+
+ // Inject payment results into cartData array and session data
+// foreach($paymentResult['payments'] as $r) {
+ while (list($key, $r) = each($paymentResult['payments'])) {
+
+ // Make sure there's a card ID in the payments entry.
+ $r['id'] = $key;
+
+ // If there's a payment error - Save that
+ if ($r['description'] != '') {
+ $this->reason[] = $r['description'];
+ }
+
+ // Create MD5 Check for access to order - Keeps people from tampering with ID # in URL line.
+ $r['orderVerification'] = md5($r['orderID'].$this->config->orderVerificationSecret);
+
+ // Place payment result under reorganized cart data for output
+ $cart['cartDataReorganized'][$r['id']]['paymentResult'] = $r;
+
+ // If this is a newly completed payment - Send all appropriate notices for this order
+ if ($r['newApproval']) {
+
+ // Get customer confirmation E-Mail
+ $sql = "
+ SELECT name, email, proc_email, proc_email2, checkout_email, checkout_notify
+ FROM eventmgt.member
+ WHERE id = ".$r['id']."
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $membData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Get any confirmation E-Mail content from Performances (only one per performance type)
+ $confTextArray = array();
+
+ if (count($cart['cartDataReorganized'][$r['id']]['performances']) > 0) {
+ foreach($cart['cartDataReorganized'][$r['id']]['performances'] as $p) {
+ // If there's confirmation text for this performance, add it with index of the performance ID
+ if (trim($p['conf_text']) != '') {
+ $confTextArray[$p['id']] = trim($p['conf_text']);
+ }
+
+ }
+ }
+
+ // If there's any confirmation text from performances, compile it all into one string.
+ $confText = '';
+ if (count($confTextArray) > 0) {
+ foreach($confTextArray as $ct) {
+ $confText .= "
$ct
\n";
+ }
+ }
+
+ $checkoutEmail = $membData['checkout_email'];
+
+ // If we have confirmation E-Mail header text then include that
+ // Otherwise it will be blank and we'll just send summary
+ if ($checkoutEmail != '') {
+
+ // Merge order data into E-Mail
+ $tags = array(
+ '{first-name}',
+ '{last-name}',
+ '{address-line-1}',
+ '{address-line-2}',
+ '{city}',
+ '{state}',
+ '{zip}',
+ '{country}',
+ '{'.$this->config->term->performance->norm.'-text}'
+ );
+ $vals = array(
+ $formData['contact']['fname']['value'],
+ $formData['contact']['lname']['value'],
+ $formData['contact']['addr1']['value'],
+ $formData['contact']['addr2']['value'],
+ $formData['contact']['city']['value'],
+ $formData['contact']['state']['value'],
+ $formData['contact']['zip']['value'],
+ $formData['contact']['country']['value'],
+ $confText
+ );
+
+ $checkoutEmail = str_replace($tags, $vals, $checkoutEmail);
+
+ }
+
+ // Create Purchase Summary
+ $templateFile = "Shop/paymentSummary.html";
+
+ $this->page->cartForSummaryCentral = $this->bindArrayToObject($cart['cartDataReorganized']);
+ $this->page->cartEntry = $this->bindArrayToObject($cart['cartDataReorganized'][$r['id']]);
+
+ $this->template->compile($this->userInterface.'/'.$templateFile);
+ $html_summary = $this->template->bufferedOutputObject($this->page);
+ unset($this->page->cartEntry);
+
+ // Try to send E-Mail to customer
+ $email_content = "--ContentBoundry\n"
+ ."Content-Type: text/plain; charset=\"US-ASCII\"\n"
+ ."\n"
+ ."This message may only be read using an HTML enabled E-Mail client."
+ ."\n"
+ ."--ContentBoundry\n"
+ ."Content-Type: text/html; charset=\"US-ASCII\"\n"
+ ."\n"
+ .$checkoutEmail
+ ."\n"
+ .$html_summary
+ ."\n"
+ ."--ContentBoundry--\n"
+ ."\n";
+
+ $emailAddress = $formData['contact']['email']['value'];
+ if (!empty($emailAddress)) {
+ $this->debug_mail(
+ $emailAddress,
+ htmlspecialchars_decode($membData['name'],ENT_QUOTES).' Purchase Confirmation',
+ $email_content,
+ "From: ".htmlspecialchars_decode($membData['name'],ENT_QUOTES)." <".$membData['email'].">"
+ ."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n"
+ );
+// This one goes to Chuck for testing.
+/*
+ $this->debug_mail(
+ 'cscott@gaslightmedia.com',
+ htmlspecialchars_decode($membData['name'],ENT_QUOTES).' Purchase Confirmation',
+ $email_content,
+ "From: ".htmlspecialchars_decode($membData['name'],ENT_QUOTES)." <".$membData['email'].">"
+ ."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n"
+ );
+*/
+ }
+
+ // If notifying member/venue
+ if ($membData['checkout_notify']) {
+
+ // Build processing E-Mail addresses
+ $procEmail = $membData['proc_email'];
+ if ($membData['proc_email2'] != '') {
+ if ($procEmail != '') {
+ $procEmail .= ',';
+ }
+ $procEmail .= $membData['proc_email2'];
+ }
+
+ // If we have a processing E-Mail address
+ if ($procEmail != '') {
+
+ // Send E-Mail to member/venue
+ $email_content = "--ContentBoundry\n"
+ ."Content-Type: text/plain; charset=\"US-ASCII\"\n"
+ ."\n"
+ ."This message may only be read using an HTML enabled E-Mail client."
+ ."\n"
+ ."--ContentBoundry\n"
+ ."Content-Type: text/html; charset=\"US-ASCII\"\n"
+ ."\n"
+ ."The following purchase has been made for your Venue."
+ ."\n"
+ .$html_summary
+ ."\n"
+ ."--ContentBoundry--\n"
+ ."\n";
+ $this->debug_mail(
+ $procEmail,
+ htmlspecialchars_decode($membData['name'],ENT_QUOTES).' Purchase Notification',
+ $email_content,
+ "From: ".htmlspecialchars_decode($membData['name'],ENT_QUOTES)." <".$membData['email'].">"
+ ."\nMime-Version: 1.0\nContent-Type: multipart/alternative; boundary=ContentBoundry\n"
+ );
+
+ } // Have processing E-Mail address
+
+ } // Doing notification to member/venue
+
+ // Clear new approval flag so we don't send notices again - If not checkout testing enabled
+ if (!$this->config->option->checkout_testing) {
+ $cart['cartDataReorganized'][$r['id']]['paymentResult']['newApproval'] = false;
+ } else {
+ // When doing checkout testing, add full SQL transaction to debug for each payment result
+ $this->addDebug("SQL Transaction for ".$cart['cartDataReorganized'][$r['id']]['name'], 'SQL Transaction', print_r($r['sqlTransaction'],1));
+ }
+ }
+
+ } // Each payment result
+
+ }
+
+ // Store the current payments data back into the session - If not checkout testing enabled
+ if (!$this->config->option->checkout_testing) {
+ $_SESSION[GLM_EVENT_SESSION]['TicketPayments'] = $paymentResult['payments'];
+ }
+
+ // If there was a problem processing any of the venue payments - return user to checkout page
+ if (!$paymentResult['status']) {
+
+ $checkoutReturnFlag = true;
+ $this->reason[] = 'There was a problem processing your request. ';
+ $checkoutCart = $cart; // Save because it's going to get overwritten by checkout.inc
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+
+ }
+
+
+} // If checkout not already complete
+$this->page->cartHasContents = $cart['cartHasContents'];
+$this->page->cart = $this->bindArrayToObject($cart['cartDataReorganized']);
+$this->page->totals = $this->bindArrayToObject($cart['totals']);
+$this->page->cartHasOneVenueOnly = $cart['cartHasOneVenueOnly'];
+$this->templateFile = "Shop/checkoutSuccess.html";
+
+$this->addDebug("Shop/checkoutSubmit.inc", 'Array: $totals', print_r($cart['totals'],1));
+$this->addDebug("Shop/checkoutSubmit.inc", 'Array: $cart', print_r($cart['cartDataReorganized'],1));
+$this->addDebug("Shop/checkoutSubmit.inc", 'Array: $formData', print_r($formData,1));
+
+// Destroy session to clear cart - If not doing checkout testing
+if (!$this->config->option->checkout_testing) {
+ $_SESSION[GLM_EVENT_SESSION]['TicketCart'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['ContactInput'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['TicketPayments'] = false;
+}
+?>
+
diff --git a/models/front/actions/Shop/printVoucher.inc b/models/front/actions/Shop/printVoucher.inc
new file mode 100644
index 0000000..5b1e5c4
--- /dev/null
+++ b/models/front/actions/Shop/printVoucher.inc
@@ -0,0 +1,60 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: printVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Get Order ID
+$orderID = $_REQUEST['OrderID'] - 0;
+if ($orderID == 0) {
+ exit;
+}
+
+// Check Order Verification Code - Prevents people just sticking order numbers into urls to get vouchers
+$orderVerify = md5($orderID.$this->config->orderVerificationSecret);
+if ($orderVerify != $_REQUEST['orderVerify']) {
+ // Bad verification code
+ echo "Voucher Fault Code: 21";
+ exit;
+}
+
+// Get Order Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/orders.php';
+$Orders = new EventManagementAdminOrders($this->dbh, $this->config);
+$orderDetail = $Orders->getOrderDetail($orderID);
+
+// Get Ticket Sold (voucher) detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/sold.php';
+$Sold = new EventManagementAdminSold($this->dbh, $this->config);
+$soldList = $Sold->getSoldList($orderID);
+
+// Get Venue Detail
+require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/members.php';
+$Members = new EventManagementAdminMembers($this->dbh, $this->config);
+$memberDetail = $Members->getMemberDetail($orderDetail['member']);
+
+// Load voucher design code as per the "voucher_design" config parameter in the site's config/applications/EventManagement.ini file
+if (is_file(EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucher.php')) {
+ if (isset($_REQUEST['Mobile'])) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucherMobile.php';
+ } else {
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/vouchers/'.$this->config->voucher_design.'/voucher.php';
+ }
+ $pdf = new PdfVoucher($orderDetail, $soldList, $memberDetail, $this->dbh, $this->config);
+} else {
+ echo "SYSTEM ERROR: Site is not configured with a valid voucher design file.";
+ exit;
+}
+
+// There's nothing to do from here. Output should go direct to browser.
+exit;
+
+?>
diff --git a/models/front/actions/Shop/sectionSelect.inc b/models/front/actions/Shop/sectionSelect.inc
new file mode 100644
index 0000000..b21553a
--- /dev/null
+++ b/models/front/actions/Shop/sectionSelect.inc
@@ -0,0 +1,83 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: sectionSelect.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+// Check If we're already locked into checkout, if so then go there
+$cart = $Support->checkCart();
+if ($cart['forceCheckoutPhase']) {
+ $this->reason[] = 'You have partially paid for your purchases. We have returned you to checkout to complete your purchase.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+}
+
+// If perfID hasn't been past to us, get selected Performance ID from input
+if (!isset($perfID)) {
+ $perfID = ($_REQUEST['PerformanceID'] - 0);
+}
+
+// Do we have a valid performance ID?
+if ($perfID == 0) {
+ $this->reason[] = 'No '.$this->config->term->event->norm.' has been selected.';
+} else {
+
+ // Get detail on selected performance
+ $performanceDetail = $this->support->getPerformanceData($perfID);
+ $this->page->performanceDetail = $this->bindArrayToObject($performanceDetail);
+
+ $this->addDebug("Shop/sectionSelect.inc", 'Array: $performanceDetail', print_r($performanceDetail,1));
+
+ // If we can't find the performance
+ if (!$performanceDetail) {
+ $this->reason[] = 'We were unable to find the selected '.$this->config->term->event->norm.'.';
+ } else {
+
+ // Query to find section IDs for sections that have active ticket inventory for the selected performance
+ $sql = "T.id in (
+ SELECT distinct(K.section)
+ FROM eventmgt.ticket K, eventmgt.ticket_inventory I
+ WHERE performance = $perfID
+ AND I.ticket = K.id
+ )";
+
+ // Get Section List for this performance for sections with available tickets
+ $sectionList = $this->support->getSectionList($false, $sql);
+ $this->page->sectionList = $this->bindArrayToObject($sectionList);
+
+ $this->addDebug("Shop/sectionSelect.inc", 'Array: $sectionList', print_r($sectionList, 1));
+
+ // If no sections found for this performance
+ if (!$sectionList) {
+ $this->reason[] = 'We were unable to find any '.$this->config->term->section->plur.' for this '.$this->config->term->event->norm.'.';
+ } else {
+
+ // if there's only one section, then select it for the user and move on to ticket selection - unless we're forcing section display
+ if (!$this->config->option->ticket_selection->force_section && count($sectionList) == 1) {
+
+ $this->addDebug("Shop/ticketSelect.inc", '*** Change to new method/view ***');
+
+ $passSectionID = $sectionList[0]['id'];
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/ticketSelect.inc';
+ return;
+ }
+
+ }
+ }
+}
+
+$this->templateFile = "Shop/sectionSelect.html";
+
+?>
+
diff --git a/models/front/actions/Shop/start.inc b/models/front/actions/Shop/start.inc
new file mode 100644
index 0000000..8f15c57
--- /dev/null
+++ b/models/front/actions/Shop/start.inc
@@ -0,0 +1,127 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: start.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+// Check If we're already locked into checkout, if so then go there
+$cart = $Support->checkCart();
+if ($cart['forceCheckoutPhase']) {
+ $this->reason[] = 'You have partially paid for your purchases. We have returned you to checkout to complete your purchase.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+}
+
+// Check if "Start at Cart" option is enabled. Generally used when there's cart-sticky items.
+if ($this->config->option->ticket_selection->start_at_cart) {
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/cart.inc';
+ return;
+}
+
+$this->templateFile = "Shop/start.html";
+
+// Get Members list - all active
+$membersList = $Support->getMembersList('active');
+
+// if there's no members listed
+if (count($membersList) == 0) {
+ $this->reason[] = 'There are no available '.$this->config->term->prop->plur.'.';
+ return;
+}
+
+// Get available performances data for each member and add them to the member data
+$havePerformance = false;
+$inventory = array();
+
+if (is_array($membersList) && count($membersList) > 0) {
+
+ reset($membersList);
+
+ while (list($k, $v) = each($membersList)) {
+
+ // Get list of performances for this member
+ $performancesList = $Support->getPerformancesList($v[id], 'member_and_active');
+
+ // If we have performances for this member
+ if ($performancesList) {
+
+ $havePerformances = true;
+
+ // For each performance, get the ticket data and add it to the array
+ reset($performancesList);
+ while (list($k2, $v2) = each($performancesList)) {
+
+ // Get all performance data for this performance
+ $perfData = $this->support->getAllPerformanceData($v2['id']);
+
+ // if we got any data, add it to the performance
+ if ($perfData) {
+
+ // Are we supposed to also provide actual ticket selection on this page?
+ if ($this->config->option->ticket_selection->show_tickets_on_start_page) {
+
+ // Add performance section/ticket data to the performance list
+ $performancesList[$k2]['oneSectionOnly'] = $perfData['oneSectionOnly'];
+ $performancesList[$k2]['sections'] = $perfData['sections'];
+
+ // Add inventory to the inventory array
+ $inventory += $perfData['inventory'];
+
+ } // Option to show tickets on start page
+
+ // If there's no performance data, then drop performance from list
+ } else {
+ unset($performancesList[$k2]);
+ } // have Performance data
+
+ } // for each performance
+
+ // Add all performance data, including tickets, to the member performances
+ $membersList[$k]['performances'] = $performancesList;
+
+ // Otherwise there's no active performances or tickets
+ } else {
+
+ // Since there's nothing to display, drop this member.
+ unset($membersList[$k]);
+ }
+
+ if ($k && !isset($membersList[$k]['performances'])) {
+ unset($membersList[$k]);
+ }
+
+ }
+}
+
+// Pass flag to show tickets on start page from config
+$this->page->showTickets = $this->config->option->ticket_selection->show_tickets_on_start_page;
+
+// Pass members list with performances and optional ticket data to template
+$this->page->membersList = $this->bindArrayToObject($membersList);
+
+// Also supply all ticket inventory as a JSON for the front-end scripts
+$this->page->ticketsJSON = json_encode($inventory, (int) JSON_PRETTY_PRINT);
+
+$this->addDebug("Shop/start.inc", 'Array: $membersList - with Performances', print_r($membersList, 1));
+$this->addDebug("Shop/start.inc", 'Array: $inventory', print_r($inventory, 1));
+
+// If we didn't get any performances to select from
+if (!$havePerformances) {
+echo "....";
+ $this->reason[] = 'There are no available '.$this->config->term->event->plur.'.';
+}
+
+
+?>
+
diff --git a/models/front/actions/Shop/ticketOpt.inc b/models/front/actions/Shop/ticketOpt.inc
new file mode 100644
index 0000000..5f52efe
--- /dev/null
+++ b/models/front/actions/Shop/ticketOpt.inc
@@ -0,0 +1,265 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: ticketOpt.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+// Check If we're already locked into checkout, if so then go there
+$cart = $Support->checkCart();
+if ($cart['forceCheckoutPhase']) {
+ $this->reason[] = 'You have partially paid for your purchases. We have returned you to checkout to complete your purchase.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+}
+
+// If perfID hasn't been passed to us, get selected Performance ID from input
+if (!isset($perfID)) {
+ $perfID = ($_REQUEST['PerformanceID'] - 0);
+}
+
+// Get selected Performance ID
+$perfID = ($_REQUEST['PerformanceID'] - 0);
+if ($perfID == 0) {
+ $this->reason[] = 'No '.$this->config->term->event->norm.' has been selected.';
+} else {
+
+ // Get selected performance data
+ $performanceDetail = $this->support->getPerformanceData($perfID);
+ $this->page->performanceDetail = $this->bindArrayToObject($performanceDetail);
+
+ $this->addDebug("Shop/ticketOpt.inc", 'Array: $performanceDetail', print_r($performanceDetail,1));
+
+ // If we can't find the performance
+ if (!$performanceDetail) {
+ $this->reason[] = 'We were unable to find the selected '.$this->config->term->event->norm.'.';
+ } else {
+
+ // If sectionID hasn't been past to us, get selected Section ID from input
+ if (!isset($sectionID)) {
+ $sectionID = ($_REQUEST['SectionID'] - 0);
+ }
+
+ if ($sectionID == 0) {
+ $this->reason[] = 'No '.$this->config->term->section->norm.' has been selected.';
+ } else {
+
+ // Get selected section data
+ $sectionDetail = $this->support->getSpecifiedSectionDetail($sectionID);
+ $this->page->sectionDetail = $this->bindArrayToObject($sectionDetail);
+
+ $this->addDebug("Shop/ticketOpt.inc", 'Array: $sectionDetail', print_r($sectionDetail,1));
+
+ // If section not found
+ if (!$sectionDetail) {
+ $this->reason[] = 'We were unable to find the selected '.$this->config->term->section->plur.'.';
+ } else {
+
+ // If ticketID hasn't been past to us, get selected ticket ID from input
+ if (!isset($ticketID)) {
+ $ticketID = ($_REQUEST['TicketID'] - 0);
+ }
+
+ if ($ticketID == 0) {
+ $this->reason[] = 'No '.$this->config->term->ticket->norm.' has been selected.';
+ } else {
+
+ // Get Ticket detail
+ $ticketDetail = $this->support->getSpecifiedTicketDetail($ticketID);
+ $this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+ $this->addDebug("Shop/ticketOpt.inc", 'Array: $ticketDetail', print_r($ticketDetail,1));
+
+ // If ticket not found
+ if (!$ticketDetail) {
+ $this->reason[] = 'We were unable to find the selected '.$this->config->term->ticket->plur.'.';
+ } else {
+
+ // Get inventory for this ticket
+ $inventoryList = $this->support->getInventoryList($ticketID, 'T.active', true);
+
+ // If no inventory found for this ticket
+ if (!$inventoryList) {
+ $this->reason[] = 'We were unable to find inventory for the selected '.$this->config->term->ticket->norm.'.';
+ } else {
+
+ // Determine if any of the dates are too late to buy on-line.
+ // If no timestamp then it's not a date-specific ticket, so no purchase leadtime issue.
+ while (list($k, $v) = each($inventoryList)) {
+ if ($v['ticket_date']['timestamp']) {
+ $inventoryList[$k]['tooLate'] = (time() > strtotime($k) - ($performanceDetail['purch_leadtime']*3600) );
+ } else {
+ $inventoryList[$k]['tooLate'] = false;
+ }
+ }
+
+ // We're now ready to pass the inventory list to the page
+ $this->page->inventoryList = $this->bindArrayToObject($inventoryList);
+
+ $this->addDebug("Shop/ticketOpt.inc", 'Array: $inventoryList', print_r($inventoryList,1));
+
+ // Also supply this list as a JSON for the scripts
+ $this->page->inventoryJSON = json_encode($inventoryList, (int) JSON_PRETTY_PRINT);
+ $this->addDebug("Shop/ticketOpt.inc", 'JSON: $inventoryJSON', print_r($this->page->inventoryJSON,1));
+
+ } // Have inventory list
+
+ } // Have ticket detail
+
+ } // Have ticket ID
+
+ } // Have section detail
+
+ } // Have section ID
+
+ } // Have performance detail
+
+} // Have performance ID
+
+$this->templateFile = "Shop/ticketOpt.html";
+
+
+/*
+
+
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+// Check If we're already locked into checkout, if so then go there
+$cart = $Support->checkCart();
+if ($cart['forceCheckoutPhase']) {
+ $this->reason[] = 'You have partially paid for your purchases. We have returned you to checkout to complete your purchase.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+}
+
+
+// Get selected ticket information
+$perfID = ($_REQUEST['TicketID'] - 0);
+if ($perfID == 0) {
+ $this->reason[] = 'No '.$this->config->term->ticket->norm.' has been selected.';
+} else {
+
+ // Get Tickets and Inventory Information
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+ $Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+ $Tickets->optionIncludeSelectListData = false;
+ $ticketDetail = $Tickets->getTicketDetail($TicketID);
+ $this->page->ticketDetail = $this->bindArrayToObject($ticketDetail);
+
+ // If we can't find the ticket
+ if (!$ticketDetail) {
+ $this->reason[] = 'We were unable to find the selected '.$this->config->term->ticket->norm.' information.';
+ } else {
+
+ // Get performance information
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPerformances.php';
+ $Performances = new EventManagementDataPerformances($this->dbh, $this->config);
+ $Performances->optionIncludeSelectListData = false;
+ $performanceDetail = $Performances->getPerformanceDetail($ticketDetail['performance_id']);
+ $this->page->performanceDetail = $this->bindArrayToObject($performanceDetail);
+
+ // If we can't find the performance information
+ if (!$performanceDetail) {
+ $this->reason[] = 'We were unable to find the selected '.$this->config->term->event->norm.' information.';
+ } else {
+
+
+
+ }
+ }
+}
+
+
+// Check that Venue has a valid payment method setup
+$this->page->havePayPal = false;
+$this->page->haveCreditCards = false;
+$this->page->havePaymentMethod = false;
+if (
+ $detail['member']['payment_gateway']['value'] > 0 // Have processor selected
+ && count($detail['member']['cards_accepted']['names']) > 0 // Have credit cards selected
+) {
+
+ // Check for any needed gateway authentication information
+ $haveAuth = false;
+ switch($detail['member']['payment_gateway']['value']) {
+ case $this->config->ccard_processor_numb->authorize_net:
+ if ($detail['member']['gateway_par1'] != '' && $detail['member']['gateway_par2'] != '') {
+ $haveAuth = true;
+ }
+ break;
+ case $this->config->ccard_processor_numb->merchant_solutions:
+ if ($detail['member']['gateway_par1'] != '' && $detail['member']['gateway_par2'] != '') {
+ $haveAuth = true;
+ }
+ break;
+ case $this->config->ccard_processor_numb->test:
+ $haveAuth = true;
+ break;
+ if ($haveAuth) {
+ // Have good credit card gateway, have cards, have authentication
+ $this->page->haveCreditCards = true;
+ $this->page->havePaymentMethod = true;
+ }
+}
+if (
+ $detail['member']['paypal']['value'] &&
+ $detail['member']['paypal_client_id'] != '' &&
+ $detail['member']['paypal_secret'] != ''
+){
+
+ $this->page->havePayPal = true;
+ $this->page->havePaymentMethod = true;
+
+}
+
+// If there's no possible payment method
+if (!$this->page->havePaymentMethod) {
+ $detail['reason'][] = 'This '.$this->config->term->prop->norm.' has not configured any payment method.
+ Please call to purchase '.$this->config->term->ticket->plur.'.';
+ $this->page->dissableAddToCart = true;
+}
+
+// Check if member is set to active
+if (!$detail['member']['active']['value']) {
+ $detail['reason'][] = 'This venue is not currently available to sell tickets on-line.';
+ $this->page->dissableAddToCart = true;
+}
+
+// Check for sections, tickets, and inventory
+$mesg = '';
+if (!$detail['haveSections']) {
+ $mesg .= ' sections?';
+}
+if (!$detail['haveTickets']) {
+ $mesg .= ' tickets?';
+}
+if (!$detail['haveInventory']) {
+ $mesg .= ' inventory?';
+}
+if ($mesg != '') {
+ $detail['reason'][] = 'No '.$this->config->term->ticket->plur.' are available for this '.$this->config->term->event->norm.". ($mesg )";
+}
+
+$this->reason = array_merge($this->reason, $detail['reason']);
+unset($detail['reason']);
+
+$this->page->detail = $this->bindArrayToObject($detail);
+
+$this->templateFile = "Shop/ticketOpt.html";
+
+// $this->addDebug("Shop/ticketOpt.inc", 'Array: $detail', print_r($detail,1));
+
+?>
+*/
diff --git a/models/front/actions/Shop/ticketSelect.inc b/models/front/actions/Shop/ticketSelect.inc
new file mode 100644
index 0000000..de0939a
--- /dev/null
+++ b/models/front/actions/Shop/ticketSelect.inc
@@ -0,0 +1,77 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: ticketSelect.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+$Support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+// Check If we're already locked into checkout, if so then go there
+$cart = $Support->checkCart();
+if ($cart['forceCheckoutPhase']) {
+ $this->reason[] = 'You have partially paid for your purchases. We have returned you to checkout to complete your purchase.';
+ include EVENT_MANAGEMENT_APP_BASE.'models/front/actions/Shop/checkout.inc';
+ return;
+}
+
+// Get performance ID that might have been passed to us - otherwise set to 0
+$perfID = 0;
+if (isset($_REQUEST['PerformanceID'])) {
+ $perfID = ($_REQUEST['PerformanceID'] - 0);
+ if ($perfID > 0) {
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $perfID;
+ }
+}
+
+// Get section ID that might have been passed to us - otherwise set to 0
+$sectID = 0;
+if (isset($passSectionID)) { // Passed by calling method (i.e. sectionSelect.inc)
+ $sectID = $passSectionID;
+} elseif (isset($_REQUEST['SectionID'])) {
+ $sectID = ($_REQUEST['SectionID'] - 0);
+}
+if ($sectID > 0) {
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectID;
+}
+
+// If we don't have a performance ID then fail this step
+if ($perfID == 0) {
+ $this->reason[] = 'No '.$this->config->term->event->norm.' has been selected.';
+} else {
+
+ // Get all performance data including all tickets prepped for use in a JSON for the front-end
+ $perfData = $this->support->getAllPerformanceData($perfID, $sectID);
+
+ // Save currently selected performance and member (venue)
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $perfID['id'];
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $perfID['member_id'];
+
+ // Pass performance detail and section and ticket information to the template
+ $this->page->oneSectionOnly = $perfData['oneSectionOnly'];
+ $this->page->performanceDetail = $this->bindArrayToObject($perfData['performanceDetail']);
+ $this->page->sections = $this->bindArrayToObject($perfData['sections']);
+
+ // Also supply all ticket inventory as a JSON for the front-end scripts
+ $this->page->ticketsJSON = json_encode($perfData['inventory'], (int) JSON_PRETTY_PRINT);
+
+ $this->addDebug("Shop/ticketSelect.inc", 'Performance Detail', print_r($perfData['performanceDetail'],1));
+ $this->addDebug("Shop/ticketSelect.inc", 'Section and Ticket Data', print_r($perfData['sections'],1));
+ $this->addDebug("Shop/ticketSelect.inc", 'Ticket Inventory Data', print_r($perfData['inventory'],1));
+ $this->addDebug("Shop/ticketSelect.inc", 'JSON: $ticketsJSON', print_r($this->page->ticketsJSON,1));
+
+} // Have performance ID
+
+$this->templateFile = "Shop/ticketSelect.html";
+
+
+?>
+
diff --git a/models/front/classes/checkoutSupport.php b/models/front/classes/checkoutSupport.php
new file mode 100644
index 0000000..fe1191f
--- /dev/null
+++ b/models/front/classes/checkoutSupport.php
@@ -0,0 +1,1750 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/checkoutSupport.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+/**
+ * EventManagementFrontCheckoutSupport class
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/checkoutSupport.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementFrontCheckoutSupport
+{
+
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ protected $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ protected $dbh;
+ /**
+ * Support class object
+ * @var $Support
+ * @access public
+ */
+ protected $Support;
+ /**
+ * Checkout Data Array
+ * @var $cd
+ * @access public
+ */
+ protected $cd;
+ /**
+ * Flag to indicate if there's an input problem
+ * @var $inputFail
+ * @access public
+ */
+ protected $inputFail = false;
+ /**
+ * SQL Transaction for passing back to calling methods when doing debug
+ * @var $sqlTransaction
+ * @access public
+ */
+ protected $sqlTransaction = false;
+
+ function __construct($dbh, $config, $Support)
+ {
+
+ $this->dbh = $dbh;
+ $this->config = $config;
+ $this->Support = $Support;
+
+ }
+
+ /*
+ * Initialize/reset checkout data array
+ */
+ public function checkoutInit($cart)
+ {
+
+ // Determine if we're running as an admin user for setting "required" for certain fields.
+ $admin_user_require = !$_SESSION[GLM_EVENT_SESSION]['AdminUser'];
+
+ // If there's not already checkout contact info in the session, start clean
+ if ($_SESSION[GLM_EVENT_SESSION]['ContactInput'] == false) {
+
+ if ($this->config->option->checkout_pre_fill) {
+
+ $this->cd = array(
+ 'contact' => array(
+ 'fname' => array('value' => 'John', 'required' => true, 'problem' => false),
+ 'lname' => array('value' => 'Smith', 'required' => true, 'problem' => false),
+ 'addr1' => array('value' => '120 E. Lake St.', 'required' => $admin_user_require, 'problem' => false),
+ 'addr2' => array('value' => 'Apt 2', 'required' => false, 'problem' => false),
+ 'city' => array('value' => 'Petoskey', 'required' => $admin_user_require, 'problem' => false),
+ 'state' => $this->createStatesArray('state', 'MI', $admin_user_require, false),
+ 'country' => $this->createCountriesArray('country', 'US', $admin_user_require, false),
+ 'phone' => array('value' => '231-487-0692', 'required' => true, 'problem' => false),
+ 'zip' => array('value' => '49770', 'required' => $admin_user_require, 'problem' => false),
+ 'email' => array('value' => 'info@gaslightmedia.com', 'required' => true, 'problem' => false),
+ 'email2' => array('value' => 'info@gaslightmedia.com', 'required' => true, 'problem' => false),
+ 'email_ok' => 'on',
+ 'opt_field_1' => array('value' => '', 'required' => false, 'problem' => false),
+ 'opt_field_2' => array('value' => '', 'required' => false, 'problem' => false),
+ 'opt_field_3' => array('value' => '', 'required' => false, 'problem' => false)
+ ),
+ 'payment' => array(),
+ 'status' => false,
+ 'centralPayment' => false
+ );
+ } else {
+
+ $this->cd = array(
+ 'contact' => array(
+ 'fname' => array('value' => '', 'required' => true, 'problem' => false),
+ 'lname' => array('value' => '', 'required' => true, 'problem' => false),
+ 'addr1' => array('value' => '', 'required' => $admin_user_require, 'problem' => false),
+ 'addr2' => array('value' => '', 'required' => false, 'problem' => false),
+ 'city' => array('value' => '', 'required' => $admin_user_require, 'problem' => false),
+ 'state' => $this->createStatesArray('state', false, $admin_user_require, false),
+ 'country' => $this->createCountriesArray('country', false, $admin_user_require, false),
+ 'phone' => array('value' => '', 'required' => true, 'problem' => false),
+ 'zip' => array('value' => '', 'required' => $admin_user_require, 'problem' => false),
+ 'email' => array('value' => '', 'required' => $admin_user_require, 'problem' => false),
+ 'email2' => array('value' => '', 'required' => $admin_user_require, 'problem' => false),
+ 'email_ok' => 'on',
+ 'opt_field_1' => array('value' => '', 'required' => false, 'problem' => false),
+ 'opt_field_2' => array('value' => '', 'required' => false, 'problem' => false),
+ 'opt_field_3' => array('value' => '', 'required' => false, 'problem' => false)
+ ),
+ 'payment' => array(),
+ 'status' => false,
+ 'centralPayment' => false
+ );
+ }
+
+ // Otherwise use the info stored in the session
+ } else {
+
+ $ci = &$_SESSION[GLM_EVENT_SESSION]['ContactInput'];
+
+ $this->cd = array(
+ 'contact' => array(
+ 'fname' => array('value' => $ci['fname'], 'required' => true, 'problem' => false),
+ 'lname' => array('value' => $ci['lname'], 'required' => true, 'problem' => false),
+ 'addr1' => array('value' => $ci['addr1'], 'required' => $admin_user_require, 'problem' => false),
+ 'addr2' => array('value' => $ci['addr2'], 'required' => false, 'problem' => false),
+ 'city' => array('value' => $ci['city'], 'required' => $admin_user_require, 'problem' => false),
+ 'state' => $this->createStatesArray('state', $ci['state'], $admin_user_require, false),
+ 'country' => $this->createCountriesArray('country', $ci['country'], $admin_user_require, false),
+ 'phone' => array('value' => $ci['phone'], 'required' => true, 'problem' => false),
+ 'zip' => array('value' => $ci['zip'], 'required' => $admin_user_require, 'problem' => false),
+ 'email' => array('value' => $ci['email'], 'required' => $admin_user_require, 'problem' => false),
+ 'email2' => array('value' => $ci['email2'], 'required' => $admin_user_require, 'problem' => false),
+ 'email_ok' => ($ci['email_ok'] ? 'on' : ''),
+ 'opt_field_1' => array('value' => $ci['opt_field_1'], 'required' => false, 'problem' => false),
+ 'opt_field_2' => array('value' => $ci['opt_field_2'], 'required' => false, 'problem' => false),
+ 'opt_field_3' => array('value' => $ci['opt_field_3'], 'required' => false, 'problem' => false)
+
+ ),
+ 'payment' => array(),
+ 'status' => false,
+ 'centralPayment' => false
+ );
+
+ }
+
+ // Check if there's central payment in use
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+ $Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+ $miscDetail = $Misc->getEntry(1);
+ if ($miscDetail['central_payment_id']) {
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMembers.php';
+ $Members = new EventManagementDataMembers($this->dbh, $this->config);
+ $Members->optionIncludeSelectListData = false;
+ $membData = $Members->getMemberDetail($miscDetail['central_payment_id']);
+
+ $this->cd['centralPayment'] = array(
+ 'id' => $miscDetail['central_payment_id'],
+ 'membData' => $membData
+ );
+
+ // Build card type array
+ $cctype = $this->buildCCTypeArray($membData, true, $membData, false, true);
+
+ if ($this->config->option->checkout_pre_fill) {
+
+ // Build expiration date array
+ $ccexp = $this->buildCCExpArray($required = true, $membData, 2, 2017, true);
+
+ $this->cd['payment'][$membData['id']] = array(
+ 'id' => $membData['id'],
+ 'spec_req' => array('value' => 'none', 'required' => false, 'problem' => false),
+ 'cctype' => $cctype,
+ 'ccname' => array('value' => 'JOHN SMITH', 'required' => true, 'problem' => false),
+ 'ccnumb' => array('value' => '0011001100110011', 'required' => true, 'problem' => false),
+ 'ccexp' => $ccexp,
+ 'cccode' => array('value' => '123', 'required' => true, 'problem' => false),
+ );
+
+ } else {
+
+ // Build expiration date array
+ $ccexp = $this->buildCCExpArray($required = true, $membData, false, false, true);
+
+ $this->cd['payment'][$membData['id']] = array(
+ 'id' => $membData['id'],
+ 'spec_req' => array('value' => '', 'required' => false, 'problem' => false),
+ 'cctype' => $cctype,
+ 'ccname' => array('value' => '', 'required' => true, 'problem' => false),
+ 'ccnumb' => array('value' => '', 'required' => true, 'problem' => false),
+ 'ccexp' => $ccexp,
+ 'cccode' => array('value' => '', 'required' => true, 'problem' => false),
+ );
+
+ }
+
+ } else {
+
+ // Build payment array for each venue
+ foreach($cart as $c) {
+
+ // Build card type array
+ $cctype = $this->buildCCTypeArray($c, true, $c['id'], false, true);
+
+ if ($this->config->option->checkout_pre_fill) {
+
+ // Build expiration date array
+ $ccexp = $this->buildCCExpArray($required = true, $c['id'], 2, 2017, true);
+
+ $this->cd['payment'][$c['id']] = array(
+ 'id' => $c['id'],
+ 'spec_req' => array('value' => 'none', 'required' => false, 'problem' => false),
+ 'cctype' => $cctype,
+ 'ccname' => array('value' => 'JOHN SMITH', 'required' => true, 'problem' => false),
+ 'ccnumb' => array('value' => '0011001100110011', 'required' => true, 'problem' => false),
+ 'ccexp' => $ccexp,
+ 'cccode' => array('value' => '123', 'required' => true, 'problem' => false),
+ );
+
+ } else {
+
+ // Build expiration date array
+ $ccexp = $this->buildCCExpArray($required = true, $c['id'], false, false, true);
+
+ $this->cd['payment'][$c['id']] = array(
+ 'id' => $c['id'],
+ 'spec_req' => array('value' => '', 'required' => false, 'problem' => false),
+ 'cctype' => $cctype,
+ 'ccname' => array('value' => '', 'required' => true, 'problem' => false),
+ 'ccnumb' => array('value' => '', 'required' => true, 'problem' => false),
+ 'ccexp' => $ccexp,
+ 'cccode' => array('value' => '', 'required' => true, 'problem' => false),
+ );
+
+ }
+ }
+ }
+
+ return $this->cd;
+ }
+
+ /*
+ * Get sanitized input data and store results in $this->cd
+ *
+ * @param $a Array element to store results - this function creates the entries
+ * @param $f Name of the parameter
+ * @param $filter Filter(s) to use
+ * @param $req Flag indicating if it's a required parameter
+ * @param $opt Optional filter option to use
+ * @param $id Optional sub-array id - also used as prefix to parameter
+ *
+ */
+ private function fieldInput($a, $f, $filter, $req, $opt = false, $id = false)
+ {
+ // Setup results
+ $r = array(
+ 'value' => false,
+ 'required' => $req,
+ 'problem' => ''
+ );
+
+ // Check for ID prefix
+ $fname = $f;
+ if ($id != false) {
+ $fname = $id."_".$f;
+ }
+
+ $in = trim(filter_input(INPUT_POST, $fname, $filter, $opt));
+
+ // If there's been a filter violation
+ if ($in === false) {
+
+ // Take what's safe
+ $r['value'] = filter_input(INPUT_POST, $f, FILTER_SANITIZE_STRING);
+
+ // Mark as bad input
+ $r['problem'] = 'Input is not valid.';
+ $this->inputFail = true;
+
+ // If nothing has been supplied
+ } elseif ($in === null || $in == '') {
+
+ // There's nothing
+ $r['value'] = '';
+
+ // If it's required, then say so
+ if ($req) {
+ $r['value'] = '';
+ $r['problem'] = 'Required input not provided.';
+ $this->inputFail = true;
+ }
+
+ // Otherwise, the input is valid
+ } else {
+
+ $r['value'] = $in;
+ $r['problem'] = false;
+
+ }
+
+ // Store results into destination array
+ if ($id) {
+ $this->cd[$a][$id][$f] = $r;
+ } else {
+ $this->cd[$a][$f] = $r;
+ }
+
+ }
+
+ /*
+ * Collect and validate checkout information
+ *
+ * @param $cart Array containing cart information
+ *
+ * @return object containing array as sub-objects
+ */
+ public function checkoutInput($cart)
+ {
+
+ // Determine if we're running as an admin user for setting "required" for certain fields.
+ $admin_user_require = !$_SESSION[GLM_EVENT_SESSION]['AdminUser'];
+
+ /*
+ * Initialize Destination Cart Data Array
+ * Set status to false (indicates fail - set to true later if all is Ok)
+ * This is where we're going to build the returned data
+ */
+ $this->cd = array(
+ 'contact' => false, // Where contact information goes
+ 'payment' => false, // Where payment information goes
+ 'status' => false, // A status flag
+ 'centralPayment' => false, // Assume no central payment
+ 'reason' => array() // Reasons we had problems
+ );
+
+ // Set input fail to false - calls below will change this if there's a problem
+ $this->inputFail = false;
+
+ /*
+ * Check all of the contact information required for checkout
+ * The checks below supply the various data to the $this->cd['contact'] array.
+ */
+ $this->fieldInput('contact', 'fname', FILTER_SANITIZE_STRING, true);
+ $this->fieldInput('contact', 'lname', FILTER_SANITIZE_STRING, true);
+ $this->fieldInput('contact', 'addr1', FILTER_SANITIZE_STRING, $admin_user_require);
+ $this->fieldInput('contact', 'addr2', FILTER_SANITIZE_STRING, false);
+ $this->fieldInput('contact', 'city', FILTER_SANITIZE_STRING, $admin_user_require);
+ $this->cd['contact']['state'] = $this->createStatesArray('state', false, $admin_user_require);
+ $this->cd['contact']['country'] = $this->createCountriesArray('country', false, $admin_user_require);
+ $this->fieldInput('contact', 'zip', FILTER_SANITIZE_STRING, $admin_user_require);
+ $this->fieldInput('contact', 'phone', FILTER_SANITIZE_STRING, true);
+ $this->fieldInput('contact', 'email', FILTER_VALIDATE_EMAIL, $admin_user_require);
+ $this->fieldInput('contact', 'email2', FILTER_VALIDATE_EMAIL, $admin_user_require);
+ $this->fieldInput('contact', 'opt_field_1', FILTER_SANITIZE_STRING, false);
+ $this->fieldInput('contact', 'opt_field_2', FILTER_SANITIZE_STRING, false);
+ $this->fieldInput('contact', 'opt_field_3', FILTER_SANITIZE_STRING, false);
+
+ // Also check the contact E-mail address and that they entered it twice properly
+ if ($this->cd['contact']['email']['value'] != $this->cd['contact']['email2']['value']) {
+ $this->cd['contact']['email2']['problem'] = 'Email addresses don\'t match.';
+ $this->inputFail = true;
+ }
+
+ // Say whether the user wanted to be contacted with other offers
+ $this->cd['contact']['email_ok'] = ($_REQUEST['email_ok'] == 'on');
+
+ /*
+ * Store the data values (only) collected so far into the session
+ * in case we come back to checkout for some reason.
+ * Only store the values, not all the other status data added to the
+ * $this->cd['contact'] array.
+ */
+ $ci = &$this->cd['contact'];
+ $_SESSION[GLM_EVENT_SESSION]['ContactInput'] = array(
+ 'fname' => $ci['fname']['value'],
+ 'lname' => $ci['lname']['value'],
+ 'addr1' => $ci['addr1']['value'],
+ 'addr2' => $ci['addr2']['value'],
+ 'city' => $ci['city']['value'],
+ 'state' => $ci['state']['value'],
+ 'country' => $ci['country']['value'],
+ 'zip' => $ci['zip']['value'],
+ 'phone' => $ci['phone']['value'],
+ 'email' => $ci['email']['value'],
+ 'email2' => $ci['email2']['value'],
+ 'email_ok' => $ci['email_ok'],
+ 'opt_field_1' => $ci['opt_field_1']['value'],
+ 'opt_field_2' => $ci['opt_field_2']['value'],
+ 'opt_field_3' => $ci['opt_field_3']['value']
+ );
+
+ // Check if there's central payment in use (if central payment member id is not 0)
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+ $Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+ $miscDetail = $Misc->getEntry(1);
+ $cpId = $miscDetail['central_payment_id'];
+
+ /*
+ * Build payment array for each venue - Main index in cart data is Venue
+ * Note that $c['id'] is used as an index into the payment array
+ * The Payment array is empty when we first get here - before any payments have been processed.
+ * If one payment was processed in a previous checkout attempt but another wasn't, the
+ * completed payment should be in here.
+ */
+ $centralPaymentAdded = false;
+ if (!is_array($cart)) {
+ return false;
+ }
+ foreach ($cart as $c) {
+
+ // Note: $c contains full info for a single venue with all selected cart data for it
+
+ // If this payment doesn't exist yet or has not yet been approved
+ if ( !isset($_SESSION[GLM_EVENT_SESSION]['TicketPayments'][$c['id']]) ||
+ !$_SESSION[GLM_EVENT_SESSION]['TicketPayments'][$c['id']]['approved']) {
+
+ // Create a payment entry under the current venue in our destination data with the current venue id
+ $this->cd['payment'][$c['id']] = array(
+ 'id' => $c['id'],
+ 'type' => false
+ );
+
+ /*
+ * Set the payment type the user selected for this venue
+ * We currently only have PayPal and Credit card. Will have to restructure this if we
+ * ever accept any other types of payments (comp codes, pay at event, ...)
+ */
+
+ if ( isset($_REQUEST[$c['id'].'_payTypeSelect']) && $_REQUEST[$c['id'].'_payTypeSelect'] == 'no' ) {
+
+ // Check for any special request for this venue and save it along with Payment information
+ $this->fieldInput('payment', 'spec_req', FILTER_SANITIZE_STRING, false, false, $c['id']);
+
+ $this->cd['payment'][$c['id']]['type'] = 'no';
+
+
+ } elseif ($_REQUEST[$c['id'].'_payTypeSelect'] == 'pp') {
+
+ // PayPal payment selected
+
+ // Check for any special request for this venue and save it along with Payment information
+ $this->fieldInput('payment', 'spec_req', FILTER_SANITIZE_STRING, false, false, $c['id']);
+
+ $this->cd['payment'][$c['id']]['type'] = 'pp';
+
+ } else {
+
+ if (isset($_REQUEST['AdminNoPayment']) && $_REQUEST['AdminNoPayment'] = 'TRUE') {
+
+ } else {
+
+ // If central credit card payment
+ if ($cpId) {
+
+ if (!$centralPaymentAdded) {
+
+ // Get the central payment venu and setup payment entry
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMembers.php';
+ $Members = new EventManagementDataMembers($this->dbh, $this->config);
+ $Members->optionIncludeSelectListData = false;
+ $cpMembData = $Members->getMemberDetail($miscDetail['central_payment_id']);
+
+ $this->cd['centralPayment'] = array(
+ 'id' => $miscDetail['central_payment_id'],
+ 'membData' => $cpMembData
+ );
+
+ // Check for any special request for this venue and save it along with Payment information
+ $this->fieldInput('payment', 'spec_req', FILTER_SANITIZE_STRING, false, false, $cpId);
+
+ /*
+ * Set the payment type the user selected for this venue
+ * We currently only have PayPal and Credit card. Will have to restructure this if we
+ * ever accept any other types of payments (comp codes, pay at event, ...)
+ */
+
+ if ($_REQUEST[$cpId.'_payTypeSelect'] == 'pp') {
+
+ // PayPal payment selected
+ $this->cd['payment'][$cpId]['type'] = 'pp';
+
+ } else {
+
+ // Credit Card payment selected
+ $this->cd['payment'][$cpId]['type'] = 'cc';
+
+ // Collect and verify submitted credit card information
+ $this->cd['payment'][$cpId]['cctype'] = $this->buildCCTypeArray($cpMembData, true, $cpId);
+ $this->fieldInput('payment', 'ccname', FILTER_SANITIZE_STRING, true, false, $cpId);
+ $this->ccnumbInput('payment', 'ccnumb', $this->cd['payment'][$cpId]['cctype']['value'], true, $cpId);
+ $this->cd['payment'][$cpId]['ccexp'] = $this->buildCCExpArray($required = true, $cpId);
+ $this->fieldInput('payment', 'cccode', FILTER_SANITIZE_NUMBER_INT, true, false, $cpId);
+
+ }
+
+ }
+
+ $centralPaymentAdded = true;
+
+ } else {
+
+ // Credit Card payment selected
+ $this->cd['payment'][$c['id']]['type'] = 'cc';
+
+ // Collect and verify submitted credit card information
+ $this->cd['payment'][$c['id']]['cctype'] = $this->buildCCTypeArray($c, true, $c['id']);
+ $this->fieldInput('payment', 'ccname', FILTER_SANITIZE_STRING, true, false, $c['id']);
+ $this->ccnumbInput('payment', 'ccnumb', $this->cd['payment'][$c['id']]['cctype']['value'], true, $c['id']);
+ $this->cd['payment'][$c['id']]['ccexp'] = $this->buildCCExpArray($required = true, $c['id']);
+ $this->fieldInput('payment', 'cccode', FILTER_SANITIZE_NUMBER_INT, true, false, $c['id']);
+ }
+ }
+ }
+ }
+
+ }
+
+ // If everything is OK, set status to true
+ if (!$this->inputFail) {
+ $this->cd['status'] = true;
+ } else {
+ // Otherwise let the user know there was a problem
+ $this->cd['reason'][] = 'Please see fields highlighted in red below.';
+ }
+
+ return $this->cd;
+ }
+
+ /*
+ * Try to process all payments
+ *
+ * Return data from processPayment() calls
+ *
+ * $res = array
+ * status Numeric return status code
+ * 1 Approved
+ * 2 Bad data supplied
+ * 3 Communications failure
+ * 4 Bad response
+ * 5 Transaction not valid
+ * 6 Merchant account problem
+ * 7 Card declined
+ * statusText Short name of status
+ * authCode Authorization code - blank if card not accepted
+ * description Longer description of result
+ *
+ *
+ * @param $cart Array containing cart information
+ * @param $contact Array containing contact information
+ *
+ * @return object containing array as sub-objects
+ *
+ * id ID of cart entry (member ID)
+ * status True if payment successful
+ * type Type of transaction ('cc' = Credit Card, 'pp' = PayPal)
+ * statusText Description of status
+ * authCode Any Authorization code returned
+ * description Description of action and result
+ * newApproval This payment has just been made, not on a previous page submission
+ * spec_req ?
+ * approved True if Approved
+ * cctype Card type name
+ * ccname Card holder name
+ * ccexp Expiration date
+ * ccnumb Card number (may be mudged)
+ * orderID ID of this order
+ *
+ */
+ public function checkoutProcessPayments($cart, $formData)
+ {
+
+ // Array that will take list of all payments
+ $payments = array();
+
+ // If this is an admin user and no payment has been selected
+ if (isset($_REQUEST['AdminNoPayment']) && $_REQUEST['AdminNoPayment'] = 'TRUE') {
+ while (list($key, $val) = each($formData['payment'])) {
+ $formData['payment'][$key]['type'] = 'no';
+ }
+ }
+
+ // If Central Payment
+ $grandTotal = 0;
+ $allPerf = array();
+ if ($formData['centralPayment']) {
+ foreach ($cart as $c) {
+
+ // If this isn't a no payment location
+ if ($c['payment_gateway']['value'] != 3) {
+
+ // Build complete payment total
+ $grandTotal += $c['totalPrice_numb'];
+
+ // Build array of all performances - This will be used to build a single order with all venues
+ if (count($c['performances']) > 0) {
+ foreach ($c['performances'] as $perf) {
+ $allPerf[$perf['id']] = $perf;
+ }
+ }
+ }
+
+ }
+ }
+
+ // Assume the payment can't be processed
+ $status = false;
+
+ // Get any previous payment data from the session
+ // Would be there if payment has already been tried and there was a failure
+ $ticketPayments = $_SESSION[GLM_EVENT_SESSION]['TicketPayments'];
+
+ // For each venue
+ reset($cart);
+ foreach ($cart as $c) {
+
+ // Short form for venue/cart entry ID
+ $id = $c['id'];
+
+ // If Central Payment then set grand total
+ if ($formData['centralPayment']) {
+ $c['totalPrice_numb'] = $grandTotal;
+ }
+
+ // If not Central Payment or this is not the central payment member (i.e. not consignment)
+ if (!$formData['centralPayment'] || $formData['centralPayment']['id'] == $c['id'] || $formData['payment'][$id]['type'] == 'no') {
+
+ // Check if payment has been completed for this venue
+ if (isset($ticketPayments[$id]) && $ticketPayments[$id]['status'] == 1) {
+
+ // If so, then we'll just use that
+ $payments[$id] = $ticketPayments[$id];
+
+ // Otheriwse, try to process this payment
+ } else {
+
+ // If this is a credit card purchase - (note PayPal is processed separately)
+ switch ($formData['payment'][$id]['type']) {
+
+ // No payment required
+ case 'no':
+
+ $res = array(
+ 'type' => 'no',
+ 'status' => 1,
+ 'statusText' => 'No Payment',
+ 'authCode' => '000000',
+ 'description' => 'No Payment Required',
+ 'spec_req' => $c['paymentForm']['spec_req']['value'],
+ 'approved' => true,
+ 'cctype' => '',
+ 'ccname' => '',
+ 'ccexp' => '',
+ 'ccnumb' => '',
+ 'newApproval' => true
+ );
+
+ $status = true;
+
+ break;
+
+ // Credit Card Payment
+ case 'cc':
+
+ // Build a more concise array with what we need
+ $payment = array(
+ 'gateway' => $c['payment_gateway']['value'], // Payment gateway to use
+ 'name' => $c['name'], // Name of venue
+ 'charge' => $c['totalPrice_numb'], // Total charges this venue
+ 'cctype' => $formData['payment'][$id]['cctype']['name'], // Card Type
+ 'ccname' => $formData['payment'][$id]['ccname']['value'], // Name on Card
+ 'ccnumb' => $formData['payment'][$id]['ccnumb']['value'], // Card Number
+ 'ccexp' => $formData['payment'][$id]['ccexp']['value'], // Expriation Date
+ 'cccode' => $formData['payment'][$id]['cccode']['value'], // CCV - security code
+ 'invoice' => $_SESSION[GLM_EVENT_SESSION]['SessionID'] // Invoice # is session ID (or some part thereof)
+ );
+
+ // Load selected payment processor and initialize
+ switch ($payment['gateway']) {
+
+ case $this->config->ccard_processor_numb->no_payment:
+
+ $account = array();
+
+ // load and initialize - No account data required
+ require_once COMMON_APP_BASE.'CommonAbstracts/'.$this->config->paymentProcessorsLocation.'/None/no_payment.php';
+ $Processor = new NoPaymentGateway();
+
+ break;
+
+ case $this->config->ccard_processor_numb->authorize_net:
+
+ // Get account data
+ $account = array(
+ 'login' => $c['gateway_par1'],
+ 'key' => $c['gateway_par2'],
+ 'test' => $c['gateway_par3']['value'],
+ 'conf' => $c['gateway_par4']['value'],
+ 'email' => $c['gateway_par5']
+ );
+
+ // load and initialize
+ require_once COMMON_APP_BASE.'CommonAbstracts/'.$this->config->paymentProcessorsLocation.'/Authorize.Net/AuthorizeNet.php';
+ $Processor = new AuthorizeNetPaymentGateway($account);
+
+ break;
+
+ case $this->config->ccard_processor_numb->merchant_solutions:
+
+ // Get account data
+ $account = array(
+ 'acctid' => $c['gateway_par1'],
+ 'merchantpin' => $c['gateway_par2'],
+ 'test' => $c['gateway_par3']['value'],
+ 'conf' => $c['gateway_par4']['value'],
+ 'email' => $c['gateway_par5']
+ );
+
+ // load and initialize
+ require_once COMMON_APP_BASE.'CommonAbstracts/'.$this->config->paymentProcessorsLocation.'/MerchantSolutions/MerchantSolutions.php';
+ $Processor = new MerchantSolutionsPaymentGateway($account);
+
+ break;
+
+ case $this->config->ccard_processor_numb->test:
+
+ $account = array();
+
+ // load and initialize - No account data required
+ require_once COMMON_APP_BASE.'CommonAbstracts/'.$this->config->paymentProcessorsLocation.'/Test/Test.php';
+ $Processor = new TestPaymentGateway();
+
+ break;
+
+ }
+
+ // Send payment request to payment processor - Use contact information in session
+ $res = $Processor->processPayment($payment, $_SESSION[GLM_EVENT_SESSION]['ContactInput']);
+
+ // Assume we don't have a new approval
+ $res['newApproval'] = false;
+
+ // If payment was successful - update the result with a mudged card number
+ if ($res['status'] == 1) {
+
+ $status = true;
+
+ $res['spec_req'] = $c['paymentForm']['spec_req']['value'];
+ $res['approved'] = true;
+ $res['cctype'] = $payment['cctype'];
+ $res['ccname'] = $payment['ccname'];
+ $res['ccexp'] = $payment['ccexp'];
+ $res['ccnumb'] = '**** **** **** '.substr($payment['ccnumb'], -4);
+ $res['newApproval'] = true;
+
+ }
+
+ // Add transaction type to result
+ $res['type'] = 'cc';
+
+ break;
+
+ } // case payment type
+
+ // If the transaction was successful
+ if ($status) {
+
+ // If Central Payment, put all performances into this order
+ if ($formData['centralPayment']) {
+ $c['performances'] = $allPerf;
+ }
+
+ // Store the purchase
+ $orderID = $this->storePurchase($c, $res);
+
+ if ($orderID == false) {
+
+ // Oops, some kind of failure to store purchase. Send Chuck a message
+ $message = "Event Management System V3\n\n"
+ ."Failure to store customer purchase - checkoutProcessPayments()\n\n"
+ ."Contact:\n\n".print_r($contact,1)."\n\n"
+ ."Cart:\n\n".print_r($c,1)."\n\n"
+ ."Result:\n\n".print_r($res,1)."\n\n"
+ ."Payment:\n\n".print_r($payment,1)."\n\n"
+ ."Gateway Account:\n\n".print_r($account,1)."\n\n";
+ mail(
+ 'cscott@gaslightmedia.com',
+ 'Event Management V3 Error: Failure to store purchase',
+ $message, $headers = '', $parameters = '' );
+
+ }
+
+ $res['orderID'] = $orderID;
+
+ // Add venue id to payment result
+ $res['id'] = $c['id'];
+
+ // Pass entire SQL Transaction back. If checkout debug isn't enabled this will simply be false;
+ $res['sqlTransaction'] = $this->sqlTransaction;
+
+ }
+
+ // Add payment information to the payments array
+ $payments[$c['id']] = $res;
+
+ } // if payment not already processed
+
+ } // if not central payment or member ID is the same as the central payment id
+
+ } // For each venue
+
+ return array(
+ 'payments' => $payments,
+ 'status' => $status
+ );
+
+ }
+
+ /*
+ * Attempt to store purchase
+ *
+ * @param $c Array of a single venue from the cart - Payment must have been successful
+ * @return object containing array as sub-objects
+ */
+ public function storePurchase($c, $res)
+ {
+
+ // Start transaction array
+ $transaction = array();
+
+ // Get contact information from the session
+ $contact = $_SESSION[GLM_EVENT_SESSION]['ContactInput'];
+
+ // Create unique session ID (extended with Date state to ensure it's unique)
+ $sid = $_SESSION[GLM_EVENT_SESSION]['SessionID'].'-'.time();
+
+ // Get optional checkout field prompts to store with order
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+ $Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+ $miscConfigDetail = $Misc->getEntry(1);
+
+ $user_trace =
+ $_SERVER["REMOTE_ADDR"]." - "
+ .date("m/d/Y H:i:s");
+
+ $pmt = $c['paymentForm'];
+ $specialNeeds = $res['spec_req']; // **** NEED TO GET THIS INTO CART
+
+ // Check for any no payment info reasons
+ $notes = '';
+ if (isset($_REQUEST['no_payment_reason']) && trim($_REQUEST['no_payment_reason']) != '') {
+ $notes = htmlspecialchars("Admin no payment info reason:\n".$_REQUEST['no_payment_reason'], ENT_QUOTES);
+ }
+
+ $transaction[] = "
+ INSERT INTO eventmgt.ticket_order
+ (
+ user_trace_info,
+ fname,
+ lname,
+ addr1,
+ addr2,
+ city,
+ state,
+ zip,
+ country,
+ phone,
+ email,
+ email_ok,
+ opt_field_1_name,
+ opt_field_1,
+ opt_field_2_name,
+ opt_field_2,
+ opt_field_3_name,
+ opt_field_3,
+ purchase_date,
+ member,
+ cctype,
+ ccnumber,
+ expire,
+ ccname,
+ ccconf,
+ charge_total,
+ special_needs,
+ notes,
+ session_id
+ )
+ VALUES
+ (
+ '$user_trace',
+ '".$contact['fname']."',
+ '".$contact['lname']."',
+ '".$contact['addr1']."',
+ '".$contact['addr2']."',
+ '".$contact['city']."',
+ '".$contact['state']."',
+ '".$contact['zip']."',
+ '".$contact['country']."',
+ '".$contact['phone']."',
+ '".$contact['email']."',
+ ".($contact['email_ok'] ? 'true' : 'false').",
+ '".addslashes($miscConfigDetail['opt_field_1_name'])."',
+ '".$contact['opt_field_1']['value']."',
+ '".addslashes($miscConfigDetail['opt_field_2_name'])."',
+ '".$contact['opt_field_2']['value']."',
+ '".addslashes($miscConfigDetail['opt_field_3_name'])."',
+ '".$contact['opt_field_3']['value']."',
+ 'today',
+ ".$c['id'].",
+ '".$res['cctype']."',
+ '".$res['ccnumb']."',
+ '".$res['ccexp']."',
+ '".$res['ccname']."',
+ '".$res['authCode']."',
+ ".$c['totalPrice_numb'].",
+ '".$specialNeeds."',
+ '".$notes."',
+ '".$sid."'
+ );
+ ";
+
+ // For each ticket date
+ $ticketSequence = 0;
+ foreach ($c['performances'] as $p) {
+
+ // Do a last validation on likely date
+ $likelyDate = date('m/d/Y', strtotime($c['likelyDate']));
+ if ($likelyDate == '12/31/1969') {
+ $likelyDate = '';
+ }
+
+ // For each performance
+ foreach ($p['dates'] as $d) {
+
+ // For each Section
+ foreach ($d['sections'] as $s) {
+
+ // For each ticket type
+ foreach ($s['tickets'] as $t) {
+
+ // If this ticket is type "package", get package contents for use below.
+ $isPackageTicket = false;
+ if ($this->config->option->tickets && $t['ticket_type']['value'] == 20) {
+
+ // get the package contents
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+ $TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+ $packageData = $TicketPackages->getPackageList("package = ".$t['id']);
+ $isPackageTicket = true;
+
+ }
+
+ // For each individual ticket
+ for ($i=1 ; $i<=$t['selected'] ; $i++) {
+
+ // If option "ticket_sold_member_actual" is true, force member for ticket_sold to the memeber listed in the "ticket" table.
+ // This overrides some of the "assignment" alterations when selling by consignment and forces reports to always point to the actual ticket member.
+ $ticketSoldMember = $c['id'];
+ if ($this->config->option->ticket_order->ticket_sold_member_actual) {
+ $ticketSoldMember = $t['member'];
+ }
+ // Check for empty date - Non date specific ticket
+ $tDate = "'".$d['date']."'";
+ if ($d['date'] == '') {
+ $tDate = 'null';
+ }
+
+ // Build text with any policies
+ $policies = '';
+ if (!empty($c['def_ticket_policy'])) {
+ $policies = $this->config->term->prop->cap." ".$this->config->term->ticket->norm
+ ." policy:\n".$c['def_ticket_policy']."\n\n";
+ }
+ if (!empty($p['policy'])) {
+ $policies .= $this->config->term->performance->cap
+ ." policy:\n".$p['policy']."\n\n";
+ }
+ if (!empty($policies)) {
+ $policies = addslashes($policies);
+ }
+
+ // Create a unique package sold ID to link the package ticket with the package contents sold ({ticketID}-{sessionID}-{timestamp})
+ $packageSoldID = $sid.'-'.++$ticketSequence;
+
+ // If this is not a package, create a i record - note that ticket_order number will be updated later
+ $transaction[] = "
+ INSERT INTO eventmgt.ticket_sold
+ (
+ ticket_order,
+ member,
+ member_name,
+ assigned,
+ assigned_from,
+ assigned_from_name,
+ performance,
+ performance_name,
+ entrance,
+ entrance_name,
+ entrance_color,
+ section,
+ section_name,
+ ticket,
+ ticket_name,
+ is_package,
+ package_sold_id,
+ ticket_package,
+ package_name,
+ date_specific,
+ ticket_date,
+ time_specific,
+ ticket_time,
+ start_date,
+ end_date,
+ likely_date,
+ price_paid,
+ voucher_type,
+ voucher_text,
+ policies,
+ unlimited_use,
+ numb_uses,
+ numb_claimed,
+ time_claimed,
+ session_id
+ )
+ VALUES
+ (
+ (SELECT currval('eventmgt.ticket_order_id_seq')),
+ ".$ticketSoldMember.",
+ '".$c['name']."',
+ ".($c['assigned'] ? 'true' : 'false').",
+ ".($c['assigned'] ? $c['assigned_from'] : 'NULL').",
+ '".($c['assigned'] ? $c['assigned_from_name'] : '')."',
+ ".$p['id'].",
+ '".$p['name']."',
+ ".(!empty($s['entrance']) ? $s['entrance'] : 'NULL').",
+ '".$s['entranceDetail']['name']."',
+ '".$s['entranceDetail']['color']['name']."',
+ ".$s['id'].",
+ '".$s['name']."',
+ ".$t['id'].",
+ '".$t['title']."',
+ ".($isPackageTicket ? 'true' : 'false').",
+ '$packageSoldID',
+ NULL,
+ '',
+ ".($t['date_specific']['value'] ? 'true' : 'false').",
+ $tDate,
+ ".($t['time_specific']['value'] ? 'true' : 'false').",
+ '".$t['ticket_timestamp']."',
+ ".(!empty($t['start_date']['date']) ? "'".$t['start_date']['date']."'" : 'NULL').",
+ ".(!empty($t['end_date']['date']) ? "'".$t['end_date']['date']."'" : 'NULL').",
+ ".(!empty($likelyDate) ? "'".$likelyDate."'" : 'NULL').",
+ ".$t['price_numb'].",
+ ".$t['voucher_type']['value'].",
+ '".$t['voucher_text']."',
+ '$policies',
+ ".($t['unlimited_use']['value'] ? 'true' : 'false').",
+ ".$t['uses'].",
+ 0,
+ null,
+ '".$sid."'
+ );
+ ";
+
+ // If this is a package, get package contents and save that as separate tickets sold.
+ if ($isPackageTicket) {
+
+ reset ($packageData);
+ foreach ($packageData as $p) {
+
+ // Get information on this package ticket
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+ $Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+ $pt = $Tickets->getTicketDetail($p['ticket']);
+
+ // If option "ticket_sold_member_actual" is true, force member for ticket_sold to the memeber listed in the "ticket" table.
+ // This overrides some of the "assignment" alterations when selling by consignment and forces reports to always point to the actual ticket member.
+ $ticketSoldMember = $pt['member'];
+ if ($this->config->option->ticket_order->ticket_sold_member_actual) {
+ $ticketSoldMember = $t['member'];
+ }
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+ $Sections = new EventManagementDataSections($this->dbh, $this->config);
+ $ps = $Sections->getSectionDetail($pt['section_id']);
+
+ // Get Entrance information for this ticket's section
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataEntrances.php';
+ $Entrances = new EventManagementDataEntrances($this->dbh, $this->config);
+ $pe = $Entrances->getEntranceDetail($ps['entrance']);
+
+
+ $transaction[] = "
+ INSERT INTO eventmgt.ticket_sold
+ (
+ ticket_order,
+ member,
+ member_name,
+ assigned,
+ assigned_from,
+ assigned_from_name,
+ performance,
+ performance_name,
+ entrance,
+ entrance_name,
+ entrance_color,
+ section,
+ section_name,
+ ticket,
+ ticket_name,
+ is_package,
+ package_sold_id,
+ ticket_package,
+ package_name,
+ date_specific,
+ ticket_date,
+ time_specific,
+ ticket_time,
+ start_date,
+ end_date,
+ likely_date,
+ price_paid,
+ voucher_type,
+ voucher_text,
+ policies,
+ unlimited_use,
+ numb_uses,
+ numb_claimed,
+ time_claimed,
+ session_id
+ )
+ VALUES
+ (
+ (SELECT currval('eventmgt.ticket_order_id_seq')),
+ ".$ticketSoldMember.",
+ '".$pt['member_name']."',
+ false,
+ NULL,
+ '',
+ ".$pt['performance_id'].",
+ '".$pt['performance']."',
+ ".(!empty($pt['section_id']) ? $pt['section_id'] : 'NULL').",
+ '".$pe['name']."',
+ '".$pe['color']['name']."',
+ ".$ps['id'].",
+ '".$ps['name']."',
+ ".$pt['id'].",
+ '".$pt['title']."',
+ false,
+ '$packageSoldID',
+ ".$t['id'].",
+ '".$t['title']."',
+ false,
+ NULL,
+ false,
+ '".$pt['ticket_timestamp']."',
+ ".(!empty($pt['start_date']['date']) ? "'".$pt['start_date']['date']."'" : 'NULL').",
+ ".(!empty($pt['end_date']['date']) ? "'".$pt['end_date']['date']."'" : 'NULL').",
+ NULL,
+ 0,
+ ".$pt['voucher_type']['value'].",
+ '".$pt['voucher_text']."',
+ '',
+ ".($pt['unlimited_use']['value'] ? 'true' : 'false').",
+ ".$pt['uses'].",
+ 0,
+ null,
+ '".$sid."'
+ );
+ ";
+
+
+ }
+
+ }
+
+ // Check for any add-ons included
+ if (isset($t['addons']) && count($t['addons']) > 0) {
+
+ // For each add-on for this ticket
+ foreach ($t['addons'] as $a) {
+
+ // If there's a quantity selected
+ if ($a['selected'] > 0) {
+
+ $transaction[] = "
+ INSERT INTO eventmgt.add_on_sold
+ (
+ ticket_order,
+ ticket_sold,
+ add_on_name,
+ add_on_type,
+ add_on_type_name,
+ unit_name,
+ unit_price,
+ quant,
+ price_paid,
+ session_id
+ )
+ VALUES
+ (
+ (SELECT currval('eventmgt.ticket_order_id_seq')),
+ (SELECT currval('eventmgt.ticket_sold_id_seq')),
+ '".$a['name']."',
+ ".$a['add_on_type']['value'].",
+ '".$a['add_on_type']['nameEsc']."',
+ '".$a['unit_name']."',
+ ".$a['unit_cost_numb'].",
+ ".$a['selected'].",
+ ".($a['unit_cost_numb'] * $a['selected']).",
+ '".$sid."'
+ );
+ ";
+
+ } // quant selected
+ } // each add-on
+ } // have add-ons
+
+ // Check for any promos included
+ if (isset($t['promo']) && $t['promo']['credit_numb'] < 0) {
+
+ $transaction[] = "
+ INSERT INTO eventmgt.promo_sold
+ (
+ ticket_order,
+ ticket_sold,
+ promo,
+ promo_name,
+ promo_type,
+ promo_type_name,
+ amount,
+ session_id
+ )
+ VALUES
+ (
+ (SELECT currval('eventmgt.ticket_order_id_seq')),
+ (SELECT currval('eventmgt.ticket_sold_id_seq')),
+ ".$t['promo']['promo'].",
+ '".$t['promo']['promo_name']."',
+ ".$t['promo']['promo_type'].",
+ '".$t['promo']['promo_type_name']."',
+ ".$t['promo']['credit_each'].",
+ '".$sid."'
+ );
+ ";
+
+ } // promo
+
+ } // each individual ticket
+
+ // Update inventory
+ $availDecr = '';
+ if (!$t['unlimited_quant']) {
+ $availDecr = "available = available - ".$t['selected'].",";
+ }
+ $transaction[] = "
+ UPDATE eventmgt.ticket_inventory
+ SET $availDecr
+ sold = sold + ".$t['selected']."
+ WHERE id = ".$t['invID']."
+ ";
+
+ } // Each ticket type (inventory ID)
+
+ } // Each section
+
+ } // Each performance
+
+ } // Each ticket date
+
+ // Add SQL to clear holds
+ $transaction[] = "DELETE FROM eventmgt.inven_hold WHERE session_id = '".$sid."';";
+
+ // Attempt to process as a transaction - If checkout testing is not enabled.
+ if (!$this->config->option->checkout_testing) {
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($transaction as $sql) {
+ $this->dbh->exec($sql);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ $error_msg = $e->getMessage();
+
+ $trouble_email .= "Error storing request: $error_msg\n\n".print_r($checkout_sql, 1)."\n\n";
+
+ $this->debug_mail(
+ 'cscott@gaslightmedia.com',
+ 'Event Management V3 - Check-Out SQL Failure',
+ "Event Management V3 - Check-Out SQL Failure\n\n"
+ ."Error Msg: ".$error_msg."\n\n"
+ .print_r($sql,1)."\n\n"
+ ."Entire Transaction:\n\n".print_r($transaction,1),
+ ''
+ );
+
+ // Say we couldn't store the order
+ return false;
+ }
+
+ // Get order numbers and assign to proper cart entries
+ $sql = "
+ SELECT id
+ FROM eventmgt.ticket_order
+ WHERE session_id = '".$sid."'
+ AND member = ".$c['id']."
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $order = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Say we were able to store the order just fine
+ return $order['id'];
+
+ } else {
+ // When checkout testing send the entire transaction to the debug page rather than execute it.
+ $this->sqlTransaction = $transaction;
+ }
+
+ }
+
+ /**
+ * Credit Card Number Input and Validation
+ *
+ * @param string $a Array element to store results - this function creates the entries
+ * @param string $f Name of the parameter
+ * @param string $cctype Selected card type
+ * @param string $ccnumb Card Number
+ * @param bool $req Required field flag
+ *
+ * @return array Array containing status and possible message
+ */
+ private function ccnumbInput($a, $f, $cctype, $req, $id)
+ {
+ // Check for ID prefix
+ $fname = $f;
+ if ($id != false) {
+ $fname = $id."_".$f;
+ }
+
+ // Get the card number
+ $in = preg_replace("/[^0-9.]/", "", trim(filter_input(INPUT_POST, $fname, FILTER_SANITIZE_NUMBER_INT)));
+
+ // Always pass GLM test card number - last digit controls auth response - see classes/paymentProcessors/Test.php
+ if (substr($in,0,15) == '001100110011001') {
+
+ $match = true;
+
+ // Otherwise we're going to check the card number against the specified card type
+ } else {
+
+ // Get the matching pattern for the supplied card type
+ $pattern = $this->config->ccverify->{$cctype};
+
+ // If we have a pattern then we have a valid card type, so try a match, otherwise it's just false
+ $match = false;
+ if ($pattern != '') {
+ $match = preg_match('/'.$pattern.'/', $in);
+ }
+
+ }
+
+ // Check the result
+ if (!$match) {
+ $problem = 'Card number does not appear to be correct for the selected card type.';
+ $this->inputFail = true;
+ }
+
+ // Setup results
+ $r = array(
+ 'value' => $in,
+ 'required' => $req,
+ 'problem' => $problem
+ );
+
+ // Store results into destination array
+ if ($id) {
+ $this->cd[$a][$id][$f] = $r;
+ } else {
+ $this->cd[$a][$f] = $r;
+ }
+
+ }
+
+ /**
+ * Create credit card type selection array
+ *
+ * array(
+ * 'value' = {selected card name if selected},
+ * 'required' = {field is required flag},
+ * 'problem' = {Problem description or empty string},
+ * 'cccards' = array(
+ * {month#} => array(
+ * 'month' => {month#},
+ * 'name' => {name of month},
+ * 'selected' = {bool}
+ * )
+ * )
+ * )
+ *
+ * @param $c Array of credit cards for venue with accepted flags
+ * @param $required Field is required flag
+ * @param $venue ID number of venue
+ * @param $cctype Supplied value of cctype or false if not supplied
+ * @param $init If set don't expect a value
+ *
+ * @return object containing array as sub-objects
+ */
+ private function buildCCTypeArray($c, $required = false, $venue = false, $cctypeVal = false, $init = false)
+ {
+
+ // Build credit cards accepted array
+ $cctype = array(
+ 'value' => '',
+ 'name' => '',
+ 'required' => $required,
+ 'problem' => '',
+ 'ccards' => array()
+ );
+
+ // If card is not specified in the function call, check for input value
+ if ($cctypeVal == false && isset($_REQUEST[$venue.'_cctype'])) {
+ $cctypeVal = (string) $_REQUEST[$venue.'_cctype'];
+ }
+
+ // Scan card types for accepted by venue
+ foreach ($c['cards_accepted']['bitmap'] as $ca) {
+
+ // If the card is selected for this venue
+ if ($ca['default']) {
+
+ // Check if this is the selected card
+ $selected = false;
+
+ // Make sure cctypeVal is not '' since 0 may be a valid card index
+ if ($cctypeVal != '' && $ca['value'] == $cctypeVal) {
+ $cctype['value'] = $ca['value'];
+ $cctype['name'] = $ca['name'];
+ $selected = true;
+ }
+
+ // Add it to the array
+ $cctype['ccards'][$ca['value']] = array(
+ 'name' => $ca['name'],
+ 'value' => $ca['value'],
+ 'selected' => $selected
+ );
+ }
+ }
+
+ // Check if required value was not supplied
+ if (!$init && $required && $cctype['value'] === '') {
+ $cctype['problem'] = 'Required value not supplied';
+ $this->inputFail = true;
+ }
+
+ return $cctype;
+
+ }
+
+ /**
+ * Create arrays for credit card expiration picks
+ *
+ * array(
+ * 'value' = {text value of expiration if set - i.e. 05/2013},
+ * 'required' = {field is required flag},
+ * 'problem' = {Problem description or empty string},
+ * 'ccmonths' = array(
+ * {month#} => array(
+ * 'month' => {month#},
+ * 'name' => {name of month},
+ * 'selected' = {bool}
+ * )
+ * ),
+ * 'ccyears' = array(
+ * {year} => array(
+ * 'year' => {year - 4 digits},
+ * 'selected' => {bool}
+ * )
+ * )
+ *
+ * @return object containing array as sub-objects
+ */
+ private function buildCCExpArray($required = false, $venue = false, $ccmonth = false, $ccyear = false, $init = false)
+ {
+
+ $monthNames = array(
+ 1 => 'January',
+ 2 => 'February',
+ 3 => 'March',
+ 4 => 'April',
+ 5 => 'May',
+ 6 => 'June',
+ 7 => 'July',
+ 8 => 'August',
+ 9 => 'September',
+ 10 => 'October',
+ 11 => 'November',
+ 12 => 'December'
+ );
+
+ $ccexp = array(
+ 'value' => '',
+ 'required' => $required,
+ 'problem' => '',
+ 'ccmonths' => array(),
+ 'ccyears' => array()
+ );
+
+ // If no month or specified in the function call, check for input values
+ if ($ccmonth == false && isset($_REQUEST[$venue.'_ccmonth'])) {
+ $ccmonth = ($_REQUEST[$venue.'_ccmonth'] - 0);
+ }
+ if ($ccyear == false && isset($_REQUEST[$venue.'_ccyear'])) {
+ $ccyear = ($_REQUEST[$venue.'_ccyear'] - 0);
+ }
+
+ // Build months list
+ $monthSelected = false;
+ for ($m=1 ; $m<=12 ; $m++) {
+ $selected = ($m == $ccmonth);
+ $ccexp['ccmonths'][$m] = array(
+ 'month' => $m,
+ 'name' => $monthNames[$m],
+ 'selected' => $selected
+ );
+ if ($selected) {
+ $monthSelected = true;
+ }
+ }
+
+ // If the supplied month didn't match anything, make sure it's set to false
+ if (!$monthSelected) {
+ $ccmonth = false;
+ }
+
+ // Build years list
+ $yearSelected = false;
+ for ($y=date('Y') ; $y<=date('Y',strtotime('now +10 years')) ; $y++) {
+ $selected = ($y == $ccyear);
+ $ccexp['ccyears'][$y] = array(
+ 'year' => $y,
+ 'selected' => $selected
+ );
+ if ($selected) {
+ $yearSelected = true;
+ }
+ }
+
+ // If this is an initialization of the field, then no validity checks
+ if ($init) {
+ return $ccexp;
+ }
+
+ // If the supplied year didn't match anything, make sure it's set to false
+ if (!$yearSelected) {
+ $ccyear = false;
+ }
+
+ // If there's a month and year, set the expriation value
+ if ($ccmonth != false && $ccyear != false) {
+ $ccexp['value'] = "$ccmonth/$ccyear";
+ }
+
+ // Check if required value was not supplied
+ if (!$init && $required && $ccexp['value'] == '') {
+ $ccexp['problem'] = 'Required value not supplied';
+ $this->inputFail = true;
+ return $ccexp;
+ }
+
+ // Check if supplied value is not in the past
+ $endOfExpMonth = strtotime("$ccmonth/1/$ccyear +1 month -1 day");
+ if (time() > $endOfExpMonth) {
+ $ccexp['problem'] = 'Expiration date has passed.';
+ $this->inputFail = true;
+ return $ccexp;
+ }
+
+ return $ccexp;
+ }
+
+ /**
+ * Build States array for use in pick-lists
+ *
+ * @param array $states Array of states
+ * @param string $selected State code of selected state
+ * @param boolean $required Is a required parameter
+ * @param boolean $checkProblem Set to false to prevent triggering problem output on initial setup
+ *
+ * @return array Array of states with 'stateID', 'stateName', 'stateSelected'
+ * @access public
+ */
+ private function createStatesArray($name, $selected = '', $required = false, $checkProblem = true)
+ {
+
+ $states = $this->config->states->toArray();
+
+ $value = false;
+ $problem = '';
+
+ // If nothing has been provided, check for URI input
+ if ($selected == '' || $selected == false) {
+ if (isset($_REQUEST[$name]) && $_REQUEST[$name] != '') {
+ $selected = $_REQUEST[$name];
+ }
+ }
+
+ $r = array();
+ while (list($key, $val) = each($states)) {
+ $r[$key] = array(
+ 'stateID' => $key,
+ 'stateName' => $val,
+ 'stateSelected' => ''
+ );
+
+ if ($key == $selected) {
+ $r[$key]['stateSelected'] = 'selected';
+ $value = $key;
+ $name = $val;
+ }
+ }
+
+ // Check for required
+ if ($required && $value == false && $checkProblem) {
+ $problem = 'Required but not selected.';
+ $this->inputFail = true;
+ }
+
+ $r = array(
+ 'value' => $value,
+ 'name' => $name,
+ 'required' => $required,
+ 'problem' => $problem,
+ 'states' => $r
+ );
+
+ return $r;
+ }
+
+ /**
+ * Build Countries array for use in pick-lists
+ *
+ * @param array $countries Array of countries
+ * @param string $selected Country code of selected country
+ * @param boolean $required Required parameter
+ * @param boolean $checkProblem Set to false to keep from triggering problem on initial setup
+ *
+ * @return array Array of countries with 'countryID', 'countryName', 'countrySelected'
+ * @access public
+ */
+ private function createCountriesArray($name, $selected = '', $required = false, $checkProblem = true)
+ {
+
+ $countries = $this->config->countries->toArray();
+
+ $value = false;
+ $problem = '';
+
+ // If nothing has been provided, check for URI input
+ if ($selected == '' || $selected == false) {
+ if (isset($_REQUEST[$name]) && $_REQUEST[$name] != '') {
+ $selected = $_REQUEST[$name];
+ }
+ }
+
+ $r = array();
+ while (list($key, $val) = each($countries)) {
+ $r[$key] = array(
+ 'countryID' => $key,
+ 'countryName' => $val,
+ 'countrySelected' => ''
+ );
+
+ if ($key == $selected) {
+ $r[$key]['countrySelected'] = 'selected';
+ $value = $key;
+ $name = $val;
+ }
+ }
+
+ // Check for required
+ if ($required && $value == false && $checkProblem) {
+ $problem = 'Required but not selected.';
+ $this->inputFail = true;
+ }
+
+ return array(
+ 'value' => $value,
+ 'name' => $name,
+ 'required' => $required,
+ 'problem' => $problem,
+ 'countries' => $r
+ );
+ }
+
+ /**
+ * If debug for mail turned on, display E-Mail messages rather than send them
+ *
+ * @access public
+ */
+ public function debug_mail( $to, $subject, $message, $headers = '', $parameters = '' )
+ {
+ if( $this->config->debug->mail )
+ {
+ echo '
+
+
MAIL DEBUG
+
Recipient(s): '.$to.'
+
Subject: '.$subject.'
+
Headers:
'.$headers.'
+
Parameters:
'.$parameters.'
+
'.$message.'
+
+
+ ';
+ return( true );
+ } else {
+ return( mail( $to, $subject, $message, $headers, $parameters ) );
+ }
+ }
+
+
+
+}
+
+?>
diff --git a/models/front/classes/support.php b/models/front/classes/support.php
new file mode 100644
index 0000000..4308f81
--- /dev/null
+++ b/models/front/classes/support.php
@@ -0,0 +1,1602 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/support.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+/**
+ * EventManagementFrontSupport class
+ *
+ * Event Management and Reservations System - Admin Code - Contacts ticket
+ *
+ * PHP version 5
+ *
+ * @category Event Management Admin Tickets
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: classes/support.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+class EventManagementFrontSupport
+{
+
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ protected $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ protected $dbh;
+
+ function __construct($dbh, $config)
+ {
+
+ $this->dbh = $dbh;
+ $this->config = $config;
+
+ }
+
+ /**
+ * Get list of active members
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getMembersList($option = 'all')
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMembers.php';
+ $Members = new EventManagementDataMembers($this->dbh, $this->config);
+ $Members->optionIncludeSelectListData = false;
+ $membersList = $Members->getMembersList($option, 'TRUE', 'sort, name');
+ return $membersList;
+ }
+
+ /**
+ * Get list of entrances for a specific member
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getEntrancesList($memberID)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataEntrances.php';
+ $Entrances = new EventManagementDataEntrances($this->dbh, $this->config);
+ $Entrances->optionIncludeSelectListData = false;
+ $entrancesList = $Entrances->getEntrancesList($memberID);
+ return $entrancesList;
+ }
+
+ /**
+ * Get information on a specific entrance
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getEntranceData($entranceID)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataEntrances.php';
+ $Entrances = new EventManagementDataEntrances($this->dbh, $this->config);
+ $Entrances->optionIncludeSelectListData = false;
+ $entranceDetail = $Entrances->getEntranceDetail($entranceID);
+ return $entranceDetail;
+ }
+
+ /**
+ * Get information on a specific venue/member
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getMemberData($memberID = false)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataMembers.php';
+ $Members = new EventManagementDataMembers($this->dbh, $this->config);
+ $Members->optionIncludeSelectListData = false;
+ $memberDetail = $Members->getMemberDetail($memberID);
+ return $memberDetail;
+ }
+
+ /**
+ * Get all information / tickets for a performance
+ * Organize for ticket selection on front end.
+ *
+ * This function returns detail about the performance,
+ * a list of sections, with a list of tickets under each,
+ * and a list of ticket inventory by ticket ID. The latter
+ * is sent to the front-end scripts as a JSON for interactive
+ * date and quantity selection.
+ *
+ * If the optional section ID is not provided, then all sections
+ * for the performance that have tickets will be included.
+ *
+ * @param $perfID integer A required performance ID
+ * @param $sectionID integer An optional sectionID
+ *
+ * @return object containing array of ...
+ * array(
+ * 'performanceDetail',
+ * 'sections',
+ * 'inventory'
+ * );
+ */
+ public function getAllPerformanceData($perfID = 0, $sectionID = 0)
+ {
+
+ $sections = array();
+ $inventory = array();
+ $oneSectionOnly = false;
+ $havePerformanceTickets = false;
+
+ // Check supplied Performance ID
+ if ($perfID == 0) {
+ $this->reason[] = 'No '.$this->config->term->event->norm.' has been selected.';
+ return false;
+ } else {
+
+ // Get selected performance data
+ $performanceDetail = $this->getPerformanceData($perfID);
+
+ // If we can't find the performance
+ if (!$performanceDetail) {
+ $this->reason[] = 'We were unable to find the selected '.$this->config->term->event->norm.'.';
+ } else {
+
+ // If a specific section is provided, then only do that section
+ $where = false;
+ if ($sectionID > 0) {
+ $where = "T.id = $sectionID";
+ }
+
+ // Get sections list for this member
+ $sectionsList = $this->getSectionList($performanceDetail['member_id'], $where);
+
+ // If there's only one, then note that for the template
+ if ($sectionsList && count($sectionsList) == 1) {
+ $oneSectionOnly = true;
+ }
+
+ // for each of the sections, get the performance data and tickets
+ foreach ($sectionsList as $section) {
+
+ $sectID = $section['id'];
+
+ // Get selected section data. We'll add this later if there's tickets found
+ $sectionDetail = $this->getSpecifiedSectionDetail($sectID);
+
+ // Get Ticket List for this performance and in the current section
+ $ticketList = $this->getSectionTicketList($perfID, $sectID);
+
+ // If no tickets found for this performance and section
+ if (!$ticketList) {
+ $this->reason[] = 'We were unable to find any '.$this->config->term->ticket->plur.' for this '.$this->config->term->event->norm.'.';
+ } else {
+
+ $havePerformanceTickets = true;
+
+ // Add this section to our sections list
+ $sections[$sectID] = array();
+ $sections[$sectID]['sectionDetail'] = $sectionDetail;
+
+ // Add ticket data to this section
+ $sections[$sectID]['ticketsData'] = array();
+ reset($ticketList);
+ foreach ($ticketList as $t) {
+ $sections[$sectID]['ticketsData'][$t['id']] = $t;
+ }
+
+ // Assemble data for each ticket (date, quant, etc)
+ $ticketsData = array();
+ reset($ticketList);
+ while (list($k, $v) = each($ticketList)) {
+
+ // Get inventory for this ticket
+ $inventoryList = $this->getInventoryList($v['id'], 'T.active', true);
+
+ $haveFutureInventory = false;
+
+ // For each inventory item
+ $invData = array();
+
+ // If no inventory found for this ticket
+ if (!$inventoryList) {
+
+ $this->reason[] = 'We were unable to find inventory for the selected '.$this->config->term->ticket->norm.'.';
+ } else {
+
+ foreach ($inventoryList as $inv) {
+
+ // Check for bogus inventory
+ if (($v['date_specific']['value'] == 1 && $inv['ticket_date']['date'] != '') ||
+ ($v['date_specific']['value'] != 1 && $inv['ticket_date']['date'] == '')) {
+
+ $invDate = $inv['ticket_date']['date'];
+
+ // Check if date in the future
+ if ($inv['ticket_date']['timestamp'] > strtotime('yesterday')) {
+ $haveFutureInventory = true;
+ }
+
+ // Trim unwanted data
+ unset($inv['ticket_name']);
+ unset($inv['ticket_id']);
+
+ // Determine if any of the dates are too late to buy on-line.
+ // If no timestamp then it's not a date-specific ticket, so no purchase leadtime issue.
+ if ($inv['ticket_date']['timestamp']) {
+ $timeStr = $inv['ticket_date']['date'].' '.$inv['ticket_time']['time'];
+ $ticketTime = strtotime($timeStr);
+ $leadTime = $performanceDetail['purch_leadtime']*3600;
+
+ // Admin users can override this
+ if ($_SESSION[GLM_EVENT_SESSION]['AdminUser']) {
+ $leadTime = 0;
+ }
+
+ $inv['tooLate'] = time() > ($ticketTime - $leadTime);
+
+
+ } else {
+ $inv['tooLate'] = false;
+ }
+
+ // Check for unlimited quantities
+ if ($inv['unlimited_quant']) {
+ $inv['available'] = $this->config->option->tickets_select_max;
+ }
+
+ $invData[$invDate] = $inv;
+
+ }
+ }
+ }
+
+ // Add ticket ID, date specific flag, and inventory list to our inventory array
+ $inventory[$v['id']] = array(
+ 'id' => $v['id'],
+ 'haveFutureInventory' => $haveFutureInventory,
+ 'dateSpecific' => $v['date_specific']['value'],
+ 'startDate' => $v['start_date']['date'],
+ 'endDate' => $v['end_date']['date'],
+ 'inventory' => $invData
+ );
+
+ // Check for ticket add-ons
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataAddons.php';
+ $Addons = new EventManagementDataAddons($this->dbh, $this->config);
+ $ticketAddonsList = $Addons->getAddonsList($v['id']);
+ if ($ticketAddonsList) {
+ foreach($ticketAddonsList as $ta) {
+ $ta['selected'] = 0;
+ $sections[$sectID]['ticketsData'][$v['id']]['addons'][$ta['id']] = $ta;
+ }
+ }
+
+ // Check for package data
+ if ($this->config->option->packages && $v['ticket_type']['value'] == 20) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+ $TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+ $packageData = $TicketPackages->getPackageList("package = ".$v['id']);
+ $sections[$sectID]['ticketsData'][$v['id']]['packageData'] = $packageData;
+ }
+
+ // Determine if tickets may or may not be purchased at this time
+ $mayBuyNow = true;
+ $tooEarlyToBuy = false;
+ if ($v['for_sale_start_date']['date'] != null && $v['for_sale_start_date']['date'] != '') {
+ if (time() < $v['for_sale_start_date']['timestamp']) {
+ $tooEarlyToBuy = true;
+ $mayBuyNow = false;
+ }
+ }
+ $tooLateToBuy = false;
+ if ($v['for_sale_end_date']['date'] != null && $v['for_sale_end_date']['date'] != '') {
+ if (time() > strtotime($v['for_sale_end_date']['date'].' +1 day')) {
+ $tooLateToBuy = true;
+ $mayBuyNow = false;
+ }
+ }
+ $sections[$sectID]['ticketsData'][$v['id']]['mayBuyNow'] = $mayBuyNow;
+ $sections[$sectID]['ticketsData'][$v['id']]['tooEarlyToBuy'] = $tooEarlyToBuy;
+ $sections[$sectID]['ticketsData'][$v['id']]['tooLateToBuy'] = $tooLateToBuy;
+
+ $sections[$sectID]['ticketsData'][$v['id']]['start_end_dates_same'] = ($v['start_date'] == $v['end_date']);
+
+ } // each ticket
+
+ } // Have tickets
+
+ } // For each section for this member
+
+ } // Have performance data
+
+ } // Have performance ID
+
+ if (!$havePerformanceTickets) {
+ return false;
+ }
+
+ // Assemble return data array
+ $perfData = array(
+ 'oneSectionOnly' => $oneSectionOnly, // Flag that indicates if we have more than one section listed
+ 'performanceDetail' => $performanceDetail, // Detail about requested Performance
+ 'sections' => $sections, // Array of sections with section detail and ticket data
+ 'inventory' => $inventory // Array of ticket inventory
+
+ );
+
+ return $perfData;
+
+ }
+
+
+ /**
+ * Get information on a specific performance based on performance selected in URI or session
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getPerformancesList($memberID, $listType = 'member')
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPerformances.php';
+ $Performances = new EventManagementDataPerformances($this->dbh, $this->config);
+ $Performances->optionIncludeSelectListData = false;
+ $performancesList = $Performances->getPerformancesList($listType, $memberID, $_SESSION[GLM_EVENT_SESSION]['AdminUser']);
+ return $performancesList;
+ }
+
+ /**
+ * Get information on a specific performance based on performance selected in URI or session
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getPerformanceData($perfID = false)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPerformances.php';
+ $Performances = new EventManagementDataPerformances($this->dbh, $this->config);
+ $Performances->optionIncludeSelectListData = false;
+ $performanceDetail = $Performances->getPerformanceDetail($perfID);
+ return $performanceDetail;
+ }
+
+ /**
+ * Get information on sections for a member
+ *
+ * @var $id ID of member
+ * @return object containing array as sub-objects
+ */
+ public function getSectionList($memberID = false, $where = false)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+ $Sections = new EventManagementDataSections($this->dbh, $this->config);
+ $Sections->optionIncludeSelectListData = false;
+ $sectionsList = $Sections->getSectionsList($memberID, $where);
+ return $sectionsList;
+ }
+
+ /**
+ * Get information on a specific section
+ *
+ * @var $id ID of section
+ * @return object containing array as sub-objects
+ */
+ public function getSpecifiedSectionDetail($sectionID = false)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+ $Sections = new EventManagementDataSections($this->dbh, $this->config);
+ $Sections->optionIncludeSelectListData = false;
+ $sectionsDetail = $Sections->getSectionDetail($sectionID);
+ return $sectionsDetail;
+ }
+
+ /**
+ * Get section ticket list
+ *
+ * @var $id ID of section
+ * @return object containing array as sub-objects
+ */
+ public function getSectionTicketList($performance, $section)
+ {
+ // Get Tickets and Inventory Information
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+ $Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+ $Tickets->optionIncludeSelectListData = false;
+ $ticketsList = $Tickets->getTicketsList(false, $performance, $section, false, true, false, $_SESSION[GLM_EVENT_SESSION]['AdminUser'], false, $this->config->option->packages);
+
+ return $ticketsList;
+ }
+
+ /**
+ * Get specific ticket detail
+ *
+ * @var $id ID of ticket
+ * @return object containing array as sub-objects
+ */
+ public function getSpecifiedTicketDetail($ticketID = false)
+ {
+ // Get Tickets and Inventory Information
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+ $Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+ $Tickets->optionIncludeSelectListData = false;
+ $ticketDetail = $Tickets->getTicketDetail($ticketID);
+
+ // Check for ticket add-ons
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataAddons.php';
+ $Addons = new EventManagementDataAddons($this->dbh, $this->config);
+ $Addons->optionIncludeSelectListData = false;
+ $ticketAddonsList = $Addons->getAddonsList($ticketID);
+ if ($ticketAddonsList) {
+ foreach($ticketAddonsList as $ta) {
+ $ta['selected'] = 0;
+ $ticketDetail['addons'][$ta['id']] = $ta;
+ }
+ }
+
+ return $ticketDetail;
+ }
+
+ /**
+ * Get inventory for a ticket
+ *
+ * @var $id ID of inventory item
+ * @return object containing array as sub-objects
+ */
+ public function getInventoryList($ticketID = false, $where = 'T.active', $dateKey = false)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketInventory.php';
+ $TicketInventory = new EventManagementDataTicketInventory($this->dbh, $this->config);
+ $TicketInventory->optionIncludeSelectListData = false;
+ $inventoryList = $TicketInventory->getTicketInventoryList($ticketID, $where, $dateKey);
+ return $inventoryList;
+ }
+
+ /**
+ * Get specific ticket inventory item information
+ * Optionally get extended data for section and entrance
+ *
+ * @var $id ID of inventory item
+ * @return object containing array as sub-objects
+ */
+ public function getInventoryDetail($invenID = false, $extended = false)
+ {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketInventory.php';
+ $TicketInventory = new EventManagementDataTicketInventory($this->dbh, $this->config);
+ $TicketInventory->optionIncludeSelectListData = false;
+ $inventoryDetail = $TicketInventory->getTicketInventoryDetail($invenID, $extended);
+ return $inventoryDetail;
+ }
+
+ /**
+ * Get list of tickets for a particular promo code
+ *
+ * @var $ticketID ID of ticket
+ * @return object containing array as sub-objects
+ */
+ public function getPromoTicketsList($promoCode)
+ {
+ // Get Tickets and Inventory Information
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPromoTickets.php';
+ $promoTickets = new EventManagementDataPromoTickets($this->dbh, $this->config);
+ $promoTickets->optionIncludeSelectListData = false;
+
+ $promoTicketsList = $promoTickets->getPromoTicketsList(false, $promoCode);
+
+ // Use ticket IDs as the index
+ $pt = array();
+ if ($promoTicketsList && count($promoTicketsList) > 0) {
+ foreach($promoTicketsList as $p) {
+ $pt[$p['ticket']] = $p;
+ }
+ }
+
+ return $pt;
+ }
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ private function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+ /*
+ * Get current number held and number available
+ * Also return if unlimited quantity ticket
+ *
+ * @var $id ID of ticket_inventory item
+ * @return object containing array as sub-objects
+ */
+ private function getInvenStatus($id)
+ {
+
+ // Check if inventory ID is sane
+ if (($id-0) == 0) {
+ return false;
+ }
+
+ // Get available and held quantities.
+ $sql = "
+ SELECT I.available as available,
+ T.unlimited_quant as unlimited_quant,
+ (
+ SELECT SUM(quant)
+ FROM eventmgt.inven_hold
+ WHERE hold_type = ".$this->config->hold_types->ticket."
+ AND inventory = $id
+ AND expire_time > 'now'
+ ) AS held
+ FROM eventmgt.ticket_inventory I,
+ eventmgt.ticket T
+ WHERE I.id = $id
+ AND T.id = I.ticket
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $s = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Calculated net available
+ $s['avail_not_held'] = $s['available'] - ($s['held'] - 0);
+
+ // Check if unlimited quant and if so set to maximum selectable
+ if ($s['unlimited_quant']) {
+ $s['available'] = $this->config->option->tickets_select_max;
+ $s['avail_not_held'] = $this->config->option->tickets_select_max;
+ }
+
+ // Include inventory item ID for reference
+ $s['invID'] = $id;
+
+ return $s;
+ }
+
+ /**
+ * Check for new cart submission and get all cart data
+ *
+ * @param cart Array containing status, reasons, and cart contents
+ * @return object containing array as sub-objects
+ */
+ private function checkCartAdd($d)
+ {
+
+ // If there's nothing being added
+ if (!isset($_REQUEST['cart']) || $_REQUEST['cart'] != 'add') {
+ return $d;
+ }
+
+ // Check if we received a single item
+ if (isset($_REQUEST['ticket_inv'])) {
+ $invItem = ($_REQUEST['ticket_inv']-0);
+ $addon = ($_REQUEST['addon']-0);
+ $quant = ($_REQUEST['quant']-0);
+
+ if (($quant-0) > 0) {
+
+ $d = $this->addItemToCart($d, invItem, $addon, quant);
+
+ }
+ }
+
+ // Check if we're receiving an array of new additions
+ if (isset($_REQUEST['ticket_inv_array'])) {
+
+ // Key is ticket ID, value is inventory ID
+ $tickInvArray = $_REQUEST['ticket_inv_array'];
+ if (is_array($tickInvArray) && count($tickInvArray) > 0) {
+ while (list($k, $v) = each($tickInvArray)) {
+ $invItem = $v;
+ $quant = $_REQUEST['quant'][$k];
+ if (($quant-0) > 0) {
+ $d = $this->addItemToCart($d, $v, 0, $quant);
+ }
+ }
+ }
+
+ // Check for any add-ons
+ $GLMaddonTicketInvID = $_REQUEST['GLMaddonTicketInvID'];
+ if (is_array($GLMaddonTicketInvID) && count($GLMaddonTicketInvID) > 0) {
+ while (list($k2, $v2) = each($GLMaddonTicketInvID)) {
+ $addon = $_REQUEST['GLMaddonID'][$k2];
+ $quant = $_REQUEST['GLMaddonQuant'][$k2];
+ if (($quant-0) > 0) {
+ $d = $this->addItemToCart($d, $v2, $addon, $quant);
+ }
+ }
+ }
+ }
+
+ // Update cart in session
+ $_SESSION[GLM_EVENT_SESSION]['TicketCart'] = $d['cart'];
+
+ return $d;
+
+ }
+
+ /**
+ * Add a ticket to the cart
+ *
+ * @param cart Array containing status, reasons, and cart contents
+ * other parameters to be determined
+ * @return object containing array as sub-objects
+ */
+ private function addItemToCart($d, $invItem, $addon, $quant)
+ {
+
+ // Check if request is sane
+ if ($invItem > 0 && $quant > 0) {
+
+ // If this is an add-on request
+ if ($addon > 0) {
+
+ // Check if this addon is the same as another entry and merge
+ if (isset($d['cart'][$invItem]['addons'][$addon])) {
+ // Add the new quantity
+ $d['cart'][$invItem]['addons'][$addon]['quant'] += 1;
+ } else {
+ $d['cart'][$invItem]['addons'][$addon] = array(
+ 'id' => $addon,
+ 'quant' => $quant
+ );
+ }
+
+ return $d;
+
+ }
+
+ // Get current quantity and number held (also clears old entries)
+ $ticketQuant = $this->getInvenStatus($invItem);
+
+ // If there's not enough available
+ if (!$ticketQuant['unlimited_quant'] && $quant > $ticketQuant['avail_not_held']) {
+ $d['reason'][] = 'The quantity requested was greater than number currently available.';
+ return $d;
+ }
+
+ } else {
+ $d['reason'][] = 'The request to add to the cart was not complete or an unknown error occurred.';
+ return $d;
+ }
+
+ // Check if the new tickets are the same as another entry and merge
+ if (isset($d['cart'][$invItem])) {
+
+ // Add the new quantity
+ $d['cart'][$invItem]['quant'] += $quant;
+
+ } else {
+
+ // Get inventory item data
+ $invenDetail = $this->getInventoryDetail($invItem);
+
+ // Not same as an existing entry, so add it
+ $d['cart'][$invItem] = array(
+ 'invenID' => $invItem,
+ 'member' => $invenDetail['member'],
+ 'assigned' => false,
+ 'quant' => $quant
+ );
+
+ }
+
+ return $d;
+
+ }
+
+ /**
+ * Check for cart update
+ *
+ * @param cart Array containing status, reasons, and cart contents
+ * @return object containing array as sub-objects
+ */
+ private function checkCartUpdate($d)
+ {
+
+ // If the cart's not being updated
+ if (!isset($_REQUEST['cart']) || $_REQUEST['cart'] != 'update') {
+ return $d;
+ }
+
+ // Get updated ticket data
+ $invItem = ($_REQUEST['ticket_inv']-0);
+ $addon = ($_REQUEST['addon']-0);
+ $quant = ($_REQUEST['quant']-0);
+
+ // Check if request isn't sane
+ if ($invItem == 0) {
+ $d['reason'][] = 'The request to change a cart quantity was not complete or an unknown error occurred.';
+ return $d;
+ }
+
+ // If this is an add-on update
+ if ($addon > 0) {
+
+ $d['cart'][$invItem]['addons'][$addon] = array(
+ 'id' => $addon,
+ 'quant' => $quant
+ );
+
+ // Otherwise it's a regular ticket update
+ } else {
+
+ // Get current quantity and number held
+ $ticketQuant = $this->getInvenStatus($invItem);
+
+ // If there's not enough available (for this session, which is why we add the selected quant back in)
+ if (!$ticketQuant['unlimited_quant'] && $quant > $ticketQuant['avail_not_held'] + $d['cart'][$invItem]['quant']) {
+ $d['reason'][] = 'The quantity requested was greater than number currently available.';
+ return $d;
+ }
+
+ // If quantity is 0 then delete the entry unless it's a sticky item, otherwise update it
+ if ($quant == 0 && !$_SESSION[GLM_EVENT_SESSION]['TicketCart'][$invItem]['sticky']) {
+ unset($d['cart'][$invItem]);
+ } else {
+ $d['cart'][$invItem]['quant'] = $quant;
+ }
+
+ // If there's still a cart entry and it's 0 now
+ if (isset($d['cart'][$invItem]) && $d['cart'][$invItem]['quant'] == 0) {
+
+ // Set any addons to 0
+ if (isset($d['cart'][$invItem]['addons']) && count($d['cart'][$invItem]['addons']) > 0) {
+ foreach ($d['cart'][$invItem]['addons'] as $a) {
+ $d['cart'][$invItem]['addons'][$a['id']]['quant'] = 0;
+ }
+ }
+
+ }
+
+ }
+
+ // Update cart in session
+ $_SESSION[GLM_EVENT_SESSION]['TicketCart'] = $d['cart'];
+
+ return $d;
+
+ }
+
+ /**
+ * Update holds for the provided cart
+ *
+ * @param cart Array containing status, reasons, and cart contents
+ * @return null
+ */
+ private function updateHolds($cart)
+ {
+
+ // Start by deleting all holds for this session
+ $sql = "
+ BEGIN;
+ DELETE FROM eventmgt.inven_hold
+ WHERE session_id = '".$_SESSION[GLM_EVENT_SESSION]['SessionID']."'
+ ;";
+
+ $expTime = date('r', strtotime('now +'.$this->config->ticket_hold_time.' minutes'));
+
+ // For each cart entry
+ if ($cart != false) {
+
+ foreach ($cart as $c) {
+
+ // Check if this is a valid cart entry
+ if (isset($c['invenID']) && count($c['invenID']) > 0) {
+
+ // Recreate hold with updated expire time
+ $sql .= "
+ INSERT INTO eventmgt.inven_hold
+ (
+ hold_type, inventory, quant, expire_time, session_id
+ )
+ VALUES
+ (
+ ".$this->config->hold_types->ticket.",
+ ".$c['invenID'].",
+ ".$c['quant'].",
+ '$expTime',
+ '".$_SESSION[GLM_EVENT_SESSION]['SessionID']."'
+ )
+ ;";
+
+ }
+ }
+
+ }
+
+ $sql .= 'COMMIT;';
+ $this->dbh->exec($sql);
+
+ }
+
+ /**
+ * Check cart for new submissions or updates and return current cart data
+ *
+ * Structure of cart array in SESSION
+ *
+ * array(
+ * 'cartID' => array(
+ * 'invenID' => {ID of the eventmgt.ticket_inventory item},
+ * 'quant' => {number requested}
+ * )
+ * )
+ *
+ * @return object containing array as sub-objects
+ */
+ public function checkCart($checkout = false)
+ {
+ // Housecleaning: Remove all old hold entries
+ // If they timed out they don't matter anyway, but this cleans up the table
+ $this->dbh->exec("DELETE FROM eventmgt.inven_hold WHERE expire_time < 'now';");
+
+ $r = array(
+ 'status' => false,
+ 'reason' => array(),
+ 'cartHasContents' => false,
+ 'cartRequiresPayment' => true,
+ 'cart' => $_SESSION[GLM_EVENT_SESSION]['TicketCart'],
+ 'cartData' => false,
+ 'cartDataReorganized' => false,
+ 'blockCheckout' => false,
+ 'blockCheckoutNonAssignment' => false,
+ 'doingAdditionalInfo' => false,
+ 'forceCheckoutPhase' => false,
+ 'checkoutComplete' => false
+ );
+
+ /*
+ * Check if any credit cards have been charged for any venues.
+ * If none are charged then we're not checked out but we aren't forcing checkout phase
+ * If some were charged and others weren't, then we're forcing checkout phase
+ * If all were charged, then checkout is complete
+ */
+ if ($_SESSION[GLM_EVENT_SESSION]['TicketPayments'] != false) {
+
+ // Check each payment entry to see if any have been charged and any are not
+ $charged = false;
+ $notCharged = false;
+ foreach ($_SESSION[GLM_EVENT_SESSION]['TicketPayments'] as $pmt) {
+ if ($pmt['approved']) {
+ $charged = true;
+ } else {
+ $notCharged = true;
+ }
+ }
+
+ // if all were charged and none not charged
+ if ($charged && !$notCharged) {
+ $r['checkoutComplete'] = true; // Checkout complete
+ }
+
+ // If some were charged and some weren't
+ if ($charged && $notCharged) {
+ $r['forceCheckoutPhase'] = true; // Partial checkout so Set forceCheckoutPhase
+ }
+
+ }
+
+ // Only check for cart additions or updates if forceCheckoutPhase is not set
+ if (!$r['forceCheckoutPhase']) {
+
+ // Check if anything is being added to the cart
+ $r = $this->checkCartAdd($r);
+
+ // Check if there's a cart update
+ $r = $this->checkCartUpdate($r);
+
+ }
+
+ // Update Holds for this cart
+ $this->updateHolds($r['cart']);
+
+ // We're here so must be successful
+ $r['status'] = true;
+
+ /*
+ * We're now going to build an array of cart contents for output with the following structure
+ *
+ * [member & assignment], [date], [perfomance], [section], [ticket], [quant & inventory]
+ */
+ $cartData = array();
+
+ // Check if there's anything in the cart
+ $cartItemRemoved = false; // To track whether we had to delete an item from the cart for missing data
+ if ($r['cart'] != false) {
+
+ $totalVenues = 0;
+ $totalTickets = 0;
+ $totalNoPayment = 0;
+ $grandTotalPrice = 0;
+ $totalPrice = 0;
+
+ // Check to see if there's an active promo code and return ticket info for that code
+ $promoTicketsList = false;
+ if (isset($_SESSION[GLM_EVENT_SESSION]['PromoCode']) && $_SESSION[GLM_EVENT_SESSION]['PromoCode'] != '') {
+ $promoTicketsList = $this->getPromoTicketsList($_SESSION[GLM_EVENT_SESSION]['PromoCode']);
+ }
+
+ // Get all data associated with this cart entry
+ foreach ($r['cart'] as $c) {
+
+ // Get inventory record detail and status
+ $invID = $c['invenID'];
+ $invDetail = $this->getInventoryDetail($invID);
+ $invStatus = $this->getInvenStatus($invID);
+
+ // Get Ticket info
+ $ticketDetail = $this->getSpecifiedTicketDetail($invDetail['ticket_id']);
+
+ $memb = $ticketDetail['member'];
+
+ // Check for assignment
+ $assignedFrom = false;
+ $assigned = false;
+ $assignedEntrance = false;
+ if ($checkout && isset($_SESSION[GLM_EVENT_SESSION]['Assignment'][$memb])) {
+
+ // Keep track of original ticket member
+ $assignedFrom = $memb;
+
+ // Set assignment information for this cart entry
+ $assigned = $_SESSION[GLM_EVENT_SESSION]['Assignment'][$memb];
+
+ // And save back into session cart
+ $_SESSION[GLM_EVENT_SESSION]['TicketCart'][$invID]['assigned'] = $assigned;
+
+ // Now set our current member to the assignment
+ $memb = $assigned;
+
+ // Also get the assigned from member name
+ $mDet = $this->getMemberData($assignedFrom);
+ $assignedFromName = $mDet['name'];
+ unset($mDet);
+
+ // Also now check if there's been an entrance assignment
+ if (isset($_SESSION[GLM_EVENT_MGT_FRONT]['AssignmentEntrance'][$assignedFrom])) {
+ $assignedEntrance = $_SESSION[GLM_EVENT_SESSION]['AssignmentEntrance'][$assignedFrom];
+ }
+
+ }
+
+ // Get member info
+ $memberDetail = $this->getMemberData($memb);
+
+ // Get Section info
+ $sectionDetail = $this->getSpecifiedSectionDetail($ticketDetail['section_id']);
+
+ // Get performance info
+ $performanceDetail = $this->getPerformanceData($ticketDetail['performance_id']);
+
+ // Make sure we have all needed information - Perhaps something has been deleted
+ if ($ticketDetail && $memberDetail && $memberDetail['active']['value'] && $sectionDetail && performanceDetail) {
+
+ // If Venue/Member hasn't been added yet
+ $membID = $memberDetail['id'];
+ if (!isset($cartData[$membID])) {
+
+ $cartData[$membID] = $memberDetail;
+ $cartData[$membID]['assigned'] = ($assignedFrom != false);
+ $cartData[$membID]['assigned_from'] = $assignedFrom;
+ $cartData[$membID]['assigned_from_name'] = $assignedFromName;
+ $cartData[$membID]['needLikelyDate'] = false;
+ $cartData[$membID]['likelyDate'] = false;
+ $cartData[$membID]['dates'] = array();
+ $cartData[$membID]['totalTickets'] = 0;
+ $cartData[$membID]['totalPrice'] = 0;
+ $cartData[$membID]['totalPrice_numb'] = 0;
+ $cartData[$membID]['no_payment'] = false;
+
+ $totalVenues++;
+
+ // Also check for a completed payment for this member
+ if (isset($_SESSION[GLM_EVENT_SESSION]['TicketPayments'][$membID]) && $_SESSION[GLM_EVENT_SESSION]['TicketPayments'][$membID]['approved']) {
+
+ // Add this payment information to the cart
+ $cartData[$membID]['paymentResult'] = $_SESSION[GLM_EVENT_SESSION]['TicketPayments'][$membID];
+ }
+
+ }
+
+ // Set alias for dates array
+ $dates = &$cartData[$membID]['dates'];
+
+ // If Date hasn't been added yet - also check for no date (non date-specific)
+ $date = $invDetail['ticket_date']['date'];
+ if ($date == '') {
+ $date = 0;
+ }
+ if (!isset($dates[$date])) {
+ $dates[$date] = array(
+ 'date' => $date,
+ 'fullDate' => date('l F j, Y', strtotime($date)),
+ 'performances' => array(),
+ 'dateSpecific' => (trim($date) != '' && strtotime($date) > 0)
+ );
+ }
+ $performances = &$dates[$date]['performances'];
+
+ // If Performance hasn't been added yet
+ $perfID = $performanceDetail['id'];
+ if (!isset($performances[$perfID])) {
+ $performances[$perfID] = $performanceDetail;
+ $performances[$perfID]['sections'] = array();
+ }
+ $sections = &$performances[$perfID]['sections'];
+
+ // If Section hasn't been added yet
+ $sectID = $sectionDetail['id'];
+ if (!isset($sections[$sectID])) {
+ $sections[$sectID] = $sectionDetail;
+ $sections[$sectID]['tickets'] = array();
+
+ // Check if there's been an Entrance Assignment and use that for the entrance data for the section
+ if ($assignedEntrance) {
+ $sections[$sectID]['entrance'] = $assignedEntrance;
+ }
+
+ // If we have an entrance with this section, get the detail
+ if ($sections[$sectID]['entrance']) {
+ $sections[$sectID]['entranceDetail'] = $this->getEntranceData($sections[$sectID]['entrance']);
+ }
+
+ }
+ $tickets = &$sections[$sectID]['tickets'];
+
+ // If this ticket hasn't been added yet (shouldn't be)
+ $ticID = $ticketDetail['id'];
+ if (!isset($tickets[$ticID])) {
+
+ // Add ticket detail to tickets and set other standard parameters
+ $tickets[$ticID] = array_merge($ticketDetail, $invStatus);
+ $tickets[$ticID]['selected'] = $c['quant'];
+ $tickets[$ticID]['show_price'] = true; // False if only price is with add-ons
+ $tickets[$ticID]['show_accumulated_total'] = false; // Use when add-ons are included
+ $tickets[$ticID]['show_addons'] = false; // Use when add-ons are included
+ $tickets[$ticID]['problem'] = false;
+
+ // Calculate base ticket price
+ $ext = $c['quant'] * $ticketDetail['price_numb'];
+
+ // Do we have any addons for this ticket?
+ if (count($ticketDetail['addons']) > 0) {
+
+ // For each add-on associated with this ticket
+ $addons_ext = 0;
+ foreach ($ticketDetail['addons'] as $a) {
+
+ // If this addon is in the cart
+ if (isset($c['addons']) && isset($c['addons'][$a['id']])) {
+
+ // Check if no cost is with the ticket, only in the add-on
+ if ($ext == 0) {
+ $tickets[$ticID]['show_price'] = false;
+ }
+
+ // Set the quantity and tally price
+ $addon_quant = $c['addons'][$a['id']]['quant'];
+ $tickets[$ticID]['addons'][$a['id']]['selected'] = $addon_quant;
+ $addon_ext = $addon_quant * $a['unit_cost_numb'] * $c['quant'];
+ $tickets[$ticID]['addons'][$a['id']]['ext'] = $addon_ext;
+ $tickets[$ticID]['addons'][$a['id']]['money'] = $this->money($addon_ext);
+
+ // add to total addons for this ticket
+ $addons_ext += $addon_ext;
+
+ }
+ }
+
+ // determine what to show for this ticket
+ $tickets[$ticID]['show_accumulated_total'] = true;
+ if ($tickets[$ticID]['price_numb'] == 0) {
+ $tickets[$ticID]['show_price'] = false;
+ }
+
+ // If we have a ticket quantity, then show the addons
+ if ($c['quant'] > 0) {
+ $tickets[$ticID]['show_addons'] = true;
+ }
+
+ // Add the add-ons price to this ticket extended total
+ $ext += $addons_ext;
+
+ // Check if add-ons are required for this ticket type
+ $tickets[$ticID]['required_addon_not_supplied'] = false;
+ if ($c['quant'] > 0 && $ticketDetail['addon_required']['value'] && $addons_ext == 0) {
+ $tickets[$ticID]['required_addon_not_supplied'] = true;
+ $r['reason'][] = $ticketDetail['performance'].' requires selection of at least one associated add-on item!';
+ $r['blockCheckout'] = true;
+ $r['blockCheckoutNonAssignment'] = true;
+ $tickets[$ticID]['problem'] = true;
+ $tickets[$ticID]['problemText'] = $ticketDetail['performance'].' requires selection of at least one of the following!';
+ }
+
+ }
+
+ // If there's any ticket price > 0 and we have a promo with this ticket and it's within the date range
+ $promoCredit = 0;
+ $today = strtotime('today');
+ $tomorrow = strtotime('tomorrow');
+ if ($ext > 0 && isset($promoTicketsList[$ticID]) &&
+ strtotime($promoTicketsList[$ticID]['promo_start_date']) <= $today &&
+ strtotime($promoTicketsList[$ticID]['promo_end_date']) >= $today
+ ) {
+
+ // Promo and dates are valid, so credit accordingly
+ switch($promoTicketsList[$ticID]['promo_type']['value']) {
+
+ // $ amount
+ case 1:
+ $credit_each = $promoTicketsList[$ticID]['amount'];
+ $credit = -1 * $credit_each * $c['quant'];
+ break;
+
+ // Percentage
+ case 2:
+ $credit_each = $ext * ($promoTicketsList[$ticID]['amount']/100);
+ $credit = -1 * $credit_each * $c['quant'];
+ break;
+ }
+
+ // Add to ticket data
+ $tickets[$ticID]['promo'] = array(
+ 'promo' => $promoTicketsList[$ticID]['promo'],
+ 'promo_name' => $promoTicketsList[$ticID]['promo_name'],
+ 'promo_type' => $promoTicketsList[$ticID]['promo_type']['value'],
+ 'promo_type_name' => $promoTicketsList[$ticID]['promo_type']['nameEsc'],
+ 'credit_each' => $credit_each,
+ 'credit_numb' => $credit,
+ 'credit' => $this->money($credit)
+ );
+
+ // Update extended price for this ticket
+ $promoCredit += $credit;
+
+ }
+
+ $tickets[$ticID]['extended'] = $this->money($ext);
+ $tickets[$ticID]['extended_numb'] = $ext;
+
+ // Add to venue totals
+ $cartData[$membID]['totalTickets'] += $c['quant'];
+ $cartData[$membID]['totalPrice_numb'] += $ext + $promoCredit;
+ $cartData[$membID]['totalPrice'] = $this->money($cartData[$membID]['totalPrice_numb']);
+
+ // Add to master totals
+ $totalTickets += $c['quant'];
+ $grandTotalPrice += $ext + $promoCredit;
+ if ($memberDetail['payment_gateway']['value'] != $this->config->ccard_processor_numb->no_payment) {
+ $totalPrice += $ext + $promoCredit;
+
+ } else {
+ $totalNoPayment += $ext + $promoCredit;
+ $cartData[$membID]['no_payment'] = true;
+ }
+
+ // Calculate max number this session may select - Number not held + quantity this person has selected
+ $tickets[$ticID]['thisSessionSelectable'] = $invStatus['avail_not_held'] + $c['quant'];
+
+ } else {
+ $r['reason'][] = 'There has been a cart error: duplicate cart entries!';
+ return $r;
+ }
+
+ // Check if ticket is non-date-specific, and a voucher type < 80 (a ticket kind of thing), and it's sold, then it needs a likely date
+ if (!$ticketDetail['date_specific']['value'] && $ticketDetail['voucher_type']['value'] < 80 && $c['quant'] > 0) {
+
+ $cartData[$membID]['needLikelyDate'] = true;
+
+ // Also check if a likely date has been submitted
+ $dateMemb = $cartData[$membID]['assigned_from'];
+ if (($dateMemb-0) == 0) {
+ $dateMemb = $membID;
+ }
+ if (isset($_SESSION[GLM_EVENT_SESSION]['LikelyDate'][$dateMemb])) {
+ $cartData[$membID]['likelyDate'] = $_SESSION[GLM_EVENT_SESSION]['LikelyDate'][$dateMemb];
+ }
+ }
+
+ // Check for package data
+ if ($this->config->option->packages && $ticketDetail['ticket_type']['value'] == 20) {
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketPackages.php';
+ $TicketPackages = new EventManagementDataTicketPackages($this->dbh, $this->config);
+ $packageData = $TicketPackages->getPackageList("package = ".$ticID);
+ $tickets[$ticID]['packageData'] = $packageData;
+ }
+
+
+
+ // We apparently don't have all needed data for this cart entry
+ // Something has been turned off or deleted
+ } else {
+
+ // Remove this item from the cart
+ unset($_SESSION[GLM_EVENT_SESSION]['TicketCart'][$invID]);
+ $cartItemRemoved = true;
+
+ }
+
+ } // each cart entry
+
+ // Reorganize cart so dates are under events rather than the other way around
+ // [Member & Assignments], [Performance], [Date], [Section], [Ticket]
+ $rCart = array();
+
+ // For each venue
+ $venueCount = 0;
+ foreach($cartData as $c) {
+
+ // Assign venue information but not dates array
+ $rCart[$c['id']] = $c;
+ unset($rCart[$c['id']]['dates']);
+
+ // For each date
+ foreach($c['dates'] as $d) {
+
+ // For each performance
+ foreach($d['performances'] as $p) {
+
+ // If performance not added yet, do that now
+ if (!isset($rCart[$c['id']]['performances'][$p['id']])) {
+
+ // Assign performance information but not sections
+ $rCart[$c['id']]['performances'][$p['id']] = $p;
+ unset($rCart[$c['id']]['performances'][$p['id']]['sections']);
+
+ }
+
+ // If Date not added yet, do that now
+ if (!isset($rCart[$c['id']]['performances'][$p['id']]['dates'][$d['date']])) {
+
+ // Assign date information but not performance array
+ $rCart[$c['id']]['performances'][$p['id']]['dates'][$d['date']] = $d;
+ unset($rCart[$c['id']]['performances'][$p['id']]['dates'][$d['date']]['performances']);
+
+ }
+
+ // For each section
+ foreach($p['sections'] as $s) {
+
+ // If section not added, do that now
+ if (!isset($rCart[$c['id']]['performances'][$p['id']]['dates'][$d['date']]['sections'][$s['id']])) {
+
+ // Assign section information but not tickets
+ $rCart[$c['id']]['performances'][$p['id']]['dates'][$d['date']]['sections'][$s['id']] = $s;
+ unset($rCart[$c['id']]['performances'][$p['id']]['dates'][$d['date']]['sections'][$s['id']]['tickets']);
+
+ }
+
+ // For each ticket
+ foreach($s['tickets'] as $t) {
+
+ // Assign the ticket
+ $rCart[$c['id']]['performances'][$p['id']]['dates'][$d['date']]['sections'][$s['id']]['tickets'][$t['id']] = $t;
+
+ }
+
+ } // For each Section
+
+ // Determine if this performance has multiple sections
+ if (count($p['sections']) == 1) {
+ $rCart[$c['id']]['performances'][$p['id']]['oneSectionOnly'] = true;
+ } else {
+ $rCart[$c['id']]['performances'][$p['id']]['oneSectionOnly'] = false;
+ }
+
+ } // For each Performance
+ }// For each Date
+ } // For each Venue
+
+ // Determine if there's multiple venues in the cart
+ if (count($cartData) == 1) {
+ $r['cartHasOneVenueOnly'] = true;
+ } else {
+ $r['cartHasOneVenueOnly'] = false;
+ }
+
+ /*
+ * Sort everything the way it should be
+ */
+
+ // Sort Members
+ uasort ($rCart, function ($a, $b) {
+ if ($a['sort'] == $b['sort']) {
+ return 0;
+ }
+ return ($a['sort'] < $b['sort']) ? -1 : 1;
+ });
+ // For each Member
+ while (list($k1, $v1) = each($rCart)) {
+
+ // Flag all cart entries as not central payment member, will update that in the checkout process.
+ $rCart[$k1]['isCentralPaymentMember'] = false;
+
+ // Sort Performances
+ uasort ($rCart[$k1]['performances'], function ($a, $b) {
+ if ($a['sort'] == $b['sort']) {
+ return 0;
+ }
+ return ($a['sort'] < $b['sort']) ? -1 : 1;
+ });
+
+ // For each Performance
+ while (list($k2, $v2) = each($rCart[$k1]['performances'])) {
+ // Sort Dates
+ // Dates - Not doing this yet
+
+ //For each Date
+ while (list($k3, $v3) = each($rCart[$k1]['performances'][$k2]['dates'])) {
+
+ // Sort Sections
+ uasort ($rCart[$k1]['performances'][$k2]['dates'][$k3]['sections'], function ($a, $b) {
+ if ($a['sort'] == $b['sort']) {
+ return 0;
+ }
+ return ($a['sort'] < $b['sort']) ? -1 : 1;
+ });
+
+ // For each Section
+ while (list($k4, $v4) = each($rCart[$k1]['performances'][$k2]['dates'][$k3]['sections'])) {
+
+ // Sort Tickets
+ uasort ($rCart[$k1]['performances'][$k2]['dates'][$k3]['sections'][$k4]['tickets'], function ($a, $b) {
+ if ($a['sort'] == $b['sort']) {
+ return 0;
+ }
+ return ($a['sort'] < $b['sort']) ? -1 : 1;
+ });
+
+ } // Sections
+ } // Dates
+ } // Performances
+ } // Members
+
+ } // have cart entries
+
+// echo "
".print_r($rCart,1)."
";
+
+ // If we're not doing checkout, then also check to see if we need assignment selection info
+ if (!$checkout && is_array($rCart) && count($rCart) > 0) {
+
+ // Check for ticket assignment for sale by another member
+ foreach ($rCart as $c) {
+
+ $rCart[$c['id']]['needAssignment'] = false;
+ $rCart[$c['id']]['haveAssignment'] = false;
+
+ // Check if a type 3
+ if ($c['member_type']['value'] == 3) {
+ $r['doingAdditionalInfo'] = true;
+ }
+
+ // Check if type 3 and not assigned
+ if ($c['member_type']['value'] == 3 && (!isset($c['assignedTo']) || $c['assignedTo'] < 1)) {
+
+ // Assume we're going to fail to assign this - unless we don't have anything selected
+ if ($rCart[$c['id']]['totalPrice_numb'] > 0) {
+ $rCart[$c['id']]['needAssignment'] = true;
+ }
+
+ // Get list of members who this can be assigned to
+ $assignmentMembers = $this->getMembersList('type2');
+
+ if ($assignmentMembers) {
+
+ // Check session to see if there's been an assignment
+ $assignedTo = false;
+ $assignedToEntrance = false;
+ if (isset($_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'][$c['id']])) {
+ $assignedTo = $_SESSION['GLM_EVENT_MGT_FRONT']['Assignment'][$c['id']];
+ }
+ if ($this->config->option->ticket_selection->select_entrance_on_consignment &&
+ isset($_SESSION['GLM_EVENT_MGT_FRONT']['AssignmentEntrance'][$c['id']])) {
+ $assignedToEntrance = $_SESSION['GLM_EVENT_MGT_FRONT']['AssignmentEntrance'][$c['id']];
+ }
+
+ // If an assignment hasn't been made, block checkout
+ if (!$assignedTo && $c['totalTickets'] > 0) {
+ $r['blockCheckout'] = true;
+ }
+
+ // If a likely date is needed and not supplied, block checkout
+ if ($this->config->option->ask_for_likely_date && $c['needLikelyDate'] && empty($c['likelyDate'])) {
+ $r['blockCheckout'] = true;
+ }
+
+ // If a likely date is required, even one is supplied
+ if ($this->config->option->ask_for_likely_date && $c['needLikelyDate']) {
+ $r['doingAdditionalInfo'] = true;
+ }
+
+ // Provide list of assignment members for this entry
+ $a = array();
+ foreach ($assignmentMembers as $m) {
+
+ // Add this member to the list
+ $a[$m['id']] = array(
+ 'id' => $m['id'],
+ 'name' => $m['name'],
+ 'city' => $m['city'],
+ 'selected' => false,
+ 'entrances' => false
+ );
+
+ // Check if we should also look at entrances
+ if ($this->config->option->ticket_selection->select_entrance_on_consignment) {
+
+ // Get a list of entrances for this assignment member
+ $entrancesList = $this->getEntrancesList($m['id']);
+ if ($entrancesList) {
+ foreach($entrancesList as $e) {
+
+ $a[$m['id']]['entrances'][$e['id']] = $e;
+ $a[$m['id']]['entrances'][$e['id']]['selected'] = false;
+
+ // Determine if this entrance has been selected
+ if ($m['id'] == $assignedTo && $e['id'] == $assignedToEntrance) {
+ $a[$m['id']]['entrances'][$e['id']]['selected'] = true;
+ }
+
+ }
+
+ }
+
+ }
+
+ // If this is the assigned member
+ if ($m['id'] == $assignedTo) {
+
+ // Mark this member as assigned
+ $a[$m['id']]['selected'] = true;
+ $rCart[$c['id']]['haveAssignment'] = true;
+
+ }
+ }
+
+ // Add list to cart entry
+ $rCart[$c['id']]['assignmentMembers'] = $a;
+
+ } else {
+
+ // We've had an assignment problem, so fail this process
+ $r['reason'][] = 'There has been a system problem: There are no members to which we can assign unassigned cart items.';
+ $r['status'] = false;
+
+ }
+ }
+
+ // Check if we need either assignment or likely date
+ $rCart[$c['id']]['needAssignemntOrDate'] = false;
+ if ($rCart[$c['id']]['needAssignment'] || ($this->conf->ask_for_likely_date && $rCart[$c['id']]['needLikelyDate'])) {
+ $rCart[$c['id']]['needAssignemntOrDate'] = true;
+ }
+
+ } // For each cart entry
+ }
+
+ // If cart items have been removed - note that
+ if ($cartItemRemoved) {
+ $r['reason'][] = 'A '.$this->config->term->ticket->norm.' or '.$this->config->term->ticket->plur
+ .' have been removed from your cart because they have become unavailable for some reason.
+ We appolgize for the incovenience.';
+ }
+
+ // If the cart has a total price, then there must be cart contents
+// if ($totalPrice + $totalNoPayment > 0) {
+ if (count($r['cartData']) > 0) {
+ $r['cartHasContents'] = true;
+ }
+
+ if ($totalPrice == 0) {
+ $r['cartRequiresPayment'] = false;
+ }
+
+ // Return cart output data and indicate success
+ $r['cartData'] = $cartData;
+ $r['cartItemRemoved'] = $cartItemRemoved;
+ $r['cartDataReorganized'] = $rCart;
+ $r['totals'] = array(
+ 'venues' => $totalVenues,
+ 'tickets' => $totalTickets,
+ 'price_numb' => $totalPrice,
+ 'price' => $this->money($totalPrice),
+ 'grand_total_numb' => $grandTotalPrice,
+ 'grand_total_price' => $this->money($grandTotalPrice)
+ );
+
+ return $r;
+
+ }
+
+ /**
+ * Get Cart Sticky Inventory
+ *
+ * Cart-Sticky tickets are tickets that always show in the cart whether there's
+ * a selected quantity or 0 quantity. This permits a short 2-step process
+ * for the shop that includes only Cart and Checkout. It can also be used
+ * to ask users to select something you want them to buy.
+ *
+ * This method will look for active cart-sticky tickets and will return
+ * a list of inventory items and data useable to insert into a session cart.
+ *
+ * Cart-Sticky tickets may not be date-specific at this time. They must have
+ * only one inventory entry.
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getCartStickyInventory()
+ {
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTicketInventory.php';
+ $TicketInventory = new EventManagementDataTicketInventory($this->dbh, $this->config);
+
+ // Look only for members that are of type 3, are active, and where the performance is active
+ $where = "
+ (SELECT cart_sticky FROM eventmgt.ticket WHERE id = T.ticket)
+ AND (SELECT active FROM eventmgt.performance WHERE id = (SELECT performance FROM eventmgt.ticket WHERE id = T.ticket))
+ ";
+//T.member IN (SELECT id FROM eventmgt.member WHERE member_type = 3 AND active)
+// AND
+
+ // Get sticky inventory for all matching members (-1)
+ $inv = $TicketInventory->getTicketInventoryList(-1, $where);
+
+ // Order by ticket order field
+ uasort ($inv , function ($a, $b) {
+ if ($a['ticket_sort'] == $b['ticket_sort']) {
+ return 0;
+ }
+ return ($a['ticket_sort'] < $b['ticket_sort']) ? -1 : 1;
+ }
+ );
+
+ return $inv;
+ }
+
+ /**
+ * Get performances set for promotion on cart page
+ *
+ * Returns an array of performances that are set to be promoted on the cart page.
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getCartPromotions()
+ {
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataPerformances.php';
+ $Performances = new EventManagementDataPerformances($this->dbh, $this->config);
+ $Performances->optionIncludeSelectListData = false;
+ $performancesList = $Performances->getPerformancesList('cart_promotions');
+ return $performancesList;
+
+ }
+
+}
+
+?>
diff --git a/models/vouchers/Gaslight/voucher.php b/models/vouchers/Gaslight/voucher.php
new file mode 100644
index 0000000..1f7184c
--- /dev/null
+++ b/models/vouchers/Gaslight/voucher.php
@@ -0,0 +1,614 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: printVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once PDF_ABSTRACT;
+$Pdf = new GlmPdf();
+
+/**
+ * PdfVoucher class
+ *
+ * @category PdfVoucher
+ * @package PDFLib
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @link <>
+*/
+class PdfVoucher extends GlmPdf
+{
+
+ public $borderWidth = 1;
+ public $borderColor = 'black';
+ public $pdfCouponInterval = 5;
+ public $pdfMinCoupons = 3;
+ public $config;
+ public $companyContact = false;
+ public $venueContact = false;
+
+ function __construct($order, $vouchers, $member, $dbh, $config)
+ {
+
+ $this->config = $config;
+
+ // if debug.glmpdf is set in the configs/common.ini file in the CommonApp directory, do grids on PDFs
+ define ('GLMPDF_DEBUG', $this->config->debug->glmpdf);
+
+ // The following produces a color test sheet. There is no return from that call.
+ // $this->glmpdfShowValidColors();
+
+ // Start with cover page.
+ $this->glmpdfSetForms(
+ 1,
+ array(
+ 1 => array( 'x' => 0, 'y' => 0, 'xs' => 613, 'ys' => 792 )
+ ),
+ 'US Letter'
+ );
+
+ // Start page
+ $this->glmpdfStart( $this->config->owner->name, "Gaslight Media", "Ticket System Receipt/Vouchers" );
+
+ if( !$this->glmpdfAddFont( 'barcode', 'barcode/FREE3OF9.TTF' ) )
+ {
+ echo 'ERROR: Unable to add barcode font.
+ Did you place the barcode font provided in docs/BarcodeFonts into
+ a system fonts directory ("/usr/share/fonts/truetype/Barcode")?
+ Also check the GLMPDF_PDF_FONT_DIR setting in GlmPdf.php.';
+ exit;
+ }
+
+ // If coupon test is selected, print them all now.
+// if( isset($_REQUEST['test_coupons']) )
+// {
+// for( $i=1 ; $i<=count($coupons) ; $i++ )
+// $this->printCoupon( $i );
+//
+// glmpdf_send_to_browser( '', 'voucher.pdf' );
+// exit;
+// }
+
+ // Get images to tmp files
+ require_once IMAGE_SERVER_ABSTRACT;
+ $imServer = new ImageServerAbstract();
+
+ if (trim($member['image']) != '') {
+ $venueImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$member['image']);
+ if ($venueImageFile) {
+ $venueImage = $this->glmpdfOpenImage($venueImageFile);
+
+ // If failure getting the image
+ if ($venueImage == false) {
+ $venueImageFile = false;
+ }
+ }
+ } else {
+ $venueImageFile = false;
+ }
+
+ if (trim($member['parking_map']) != '') {
+ $parkingImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$member['parking_map']);
+ if ($parkingImageFile) {
+ $parkingImage = $this->glmpdfOpenImage($parkingImageFile);
+
+ // If failure getting the image
+ if ($parkingImage == false) {
+ $parkingImageFile = false;
+ }
+ }
+ } else {
+ $parkingImageFile = false;
+ }
+
+ if (trim($member['ticket_sec_map']) != '') {
+ $sectionImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$member['ticket_sec_map']);
+ if ($sectionImageFile) {
+ $sectionImage = $this->glmpdfOpenImage($sectionImageFile);
+
+ // If failure getting the image
+ if ($sectionImage == false) {
+ $sectionImageFile = false;
+ }
+ }
+ } else {
+ $sectionImageFile = false;
+ }
+
+ // Load entrance class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+ $Entrances = new EventManagementAdminEntrances($dbh, $config);
+
+ // Load performance class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+ $Performances = new EventManagementAdminPerformances($dbh, $config);
+
+ // Setup additional information
+ // Company contact info
+ if ($config->option->voucher->show_company_contact) {
+ $companyContact = '';
+ $sep = '';
+ if ($config->option->voucher->show_company_name) {
+ $companyContact .= $config->owner->name;
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_company_addr && $config->owner->addr1) {
+ $companyContact .= $sep.$config->owner->addr1;
+ $sep = ' - ';
+ if ($config->owner->addr2) {
+ $companyContact .= ', '.$config->owner->addr2;
+ }
+ }
+ if ($config->option->voucher->show_company_citystate) {
+ $companyContact .= $sep.$config->owner->city.', '.$config->owner->state;
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_company_phone) {
+ if ($config->owner->toll_free) {
+ $companyContact .= $sep.$config->owner->toll_free;
+ } else {
+ $companyContact .= $sep.$config->owner->phone;
+ }
+ }
+ }
+ // Venue/Location contact info
+ $venueContact = false;
+ if ($config->option->voucher->show_venue_contact) {
+ $venueContact = '';
+ $sep = '';
+ if ($config->option->voucher->show_venue_name) {
+ $venueContact .= $member['name'];
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_venue_addr && $member['addr1']) {
+ $venueContact .= $sep.$member['addr1'];
+ $sep = ' - ';
+ if ($member['addr2']) {
+ $venueContact .= ', '.$member['addr2'];
+ }
+ }
+ if ($config->option->voucher->show_venue_citystate) {
+ $venueContact .= $sep.$member['city'].', '.$member['state']['name'];
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_venue_phone) {
+ $venueContact .= $sep.$member['phone'];
+ }
+ }
+
+ // START VOUCHER PRINTOUT
+
+ $this->glmpdfNextForm();
+
+ /* Cover Page */
+
+ // Header
+ if ($venueImageFile) {
+ $coverImage = $this->glmpdfOpenImage($venueImageFile);
+ $this->glmpdfPlaceImage($coverImage, 30, 690, .5, false, 'center', 280, 140);
+ }
+ $this->glmpdfSetFont( "Helvetica-Bold", 18.0 ); // Header Text
+ $this->glmpdfPlaceText( $config->owner->name, 340, 750, "center", 'black', -400 );
+ $this->glmpdfSetFont( "Helvetica", 14.0 );
+ $this->glmpdfPlaceText( $config->owner->short_name." - ".$member['name'], 340, $this->glmpdfCurrentY-10, "center", 'black', -400 );
+ $this->glmpdfPlaceText( $member['addr1'], 340, $this->glmpdfCurrentY, "center", 'black', -400 );
+ $this->glmpdfPlaceText( $member['city'].", ".$member['state']['name']." ".$member['zip'], 340, $this->glmpdfCurrentY, "center", 'black', -400 );
+
+ // Sold To Information
+ $valCol = 60;
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $this->glmpdfPlaceText( $this->config->term->order->cap." ID: ".trim($order['id']), $valCol, 650, "left", 'black' );
+ $this->glmpdfPlaceText( trim($order['fname'].' '.$order['lname']), $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+ $this->glmpdfPlaceText( trim($order['addr1']), $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+ if( trim($order['addr2']) != '' )
+ $this->glmpdfPlaceText( trim($order['addr2']), $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+ $this->glmpdfPlaceText( trim($order['city']).', '.$order['state']['value'].' '.trim($order['zip']).' '.$order['country']['value'], $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+
+ // Purchace/Charge information
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $promptCol = 330;
+ $valCol = 420;
+ $this->glmpdfPlaceText( "Date of Purchase:", $promptCol, 650, "left", 'black' );
+ $this->glmpdfPlaceText( $order['purchase_date']['date'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Card Type:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['cctype'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Name on Card:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['ccname'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Card Number:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['ccnumber'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Confirmation:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['ccconf'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Total Charged:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['charge_total'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+
+ // Purchase Summary
+ $ticNumbCol = 20;
+ $perfNameCol = 80;
+ $ticNameCol = 200;
+ $secNameCol = 370;
+ $dateCol = 440;
+ $this->glmpdfPlaceText( '', $ticNumbCol, 550, "center", 'black', 0, '');
+
+ $this->glmpdfSetFont( "Helvetica", 8.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap, $ticNumbCol, $this->glmpdfCurrentY, "left", 'black', -52, '');
+ $this->glmpdfPlaceText( $this->config->term->performance->cap, $perfNameCol, $this->glmpdfLastY, "left", 'black', -110, '');
+ $this->glmpdfPlaceText( $this->config->term->ticket->cap, $ticNameCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ $this->glmpdfPlaceText( $this->config->term->section->cap, $secNameCol, $this->glmpdfLastY, "left", 'black', -60, '');
+ $this->glmpdfPlaceText( 'Date / Time', $dateCol, $this->glmpdfLastY, "left", 'black', -160, '');
+
+ $this->glmpdfPlaceText( '', $ticNumbCol, $this->glmpdfCurrentY-3, "center", 'black', 0, '');
+
+ foreach( $vouchers as $t ) {
+
+ $voucherCode = $this->addCheckCode($t['id']);
+
+ $this->glmpdfSetFont( "Helvetica", 8.0 );
+ $this->glmpdfPlaceText( $voucherCode, $ticNumbCol, $this->glmpdfCurrentY, "left", 'black', -52, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['performance_name'],ENT_QUOTES,"utf-8"), $perfNameCol, $this->glmpdfLastY, "left", 'black', -110, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['ticket_name'],ENT_QUOTES,"utf-8"), $ticNameCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['section_name'],ENT_QUOTES,"utf-8"), $secNameCol, $this->glmpdfLastY, "left", 'black', -60, '');
+ if ($t['date_specific']['value']) {
+ $this->glmpdfPlaceText( $t['ticket_date']['date'].' '.$t['ticket_time']['time'], $dateCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ } else {
+ $dateRange = 'Valid From '.$t['start_date']['date'].' through '.$t['end_date']['date'];
+ $this->glmpdfPlaceText( $dateRange, $dateCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ }
+
+ // Check for Ticket add-ons
+ if (isset($t['addons_sold']) && count($t['addons_sold']) > 0) {
+ foreach($t['addons_sold'] as $a) {
+
+ $addonText = $a['add_on_name'];
+ if (($a['add_on_type']['value']-0) == 2) {
+ $addonText = $addonText.', '.$a['quant'].' '.$a['unit_name'];
+ }
+ $this->glmpdfPlaceText( html_entity_decode($addonText,ENT_QUOTES,"utf-8"), $ticNameCol+10, $this->glmpdfCurrentY, "left", 'black', -240, '');
+ }
+ }
+
+ }
+
+ // Special Needs
+ $this->glmpdfSetFont( "Helvetica", 9.0 );
+ if (trim($order['special_needs']) != '') {
+ $this->glmpdfPlaceText( "Special Needs:", 20, $this->glmpdfCurrentY-30, "left", 'black' );
+ $this->glmpdfPlaceTextBox( $order['special_needs'], 100, $this->glmpdfCurrentY+16, 450, 50, "left", 'black' );
+ }
+
+ // General Member Policies
+ if (trim($member['def_ticket_pol']) != '') {
+ $this->glmpdfPlaceText( "Policies:", 20, $this->glmpdfCurrentY-30, "left", 'black' );
+ $this->glmpdfPlaceTextBox( $member['def_ticket_pol'], 100, $this->glmpdfCurrentY+16, 450, 50, "left", 'black' );
+ }
+
+ // Now setup ticket forms
+ $this->glmpdfSetForms(
+ 1,
+ array(
+ 1 => array( 'x' => 25, 'y' => 495, 'xs' => 560, 'ys' => 275 )
+// 2 => array( 'x' => 25, 'y' => 210, 'xs' => 560, 'ys' => 275 )
+ ),
+ 'US Letter'
+ );
+ // Also reset form count
+ $this->glmpdfNextPage();
+
+ // Display Footer
+ $this->glmpdfSetFont( "Helvetica-Bold", 8.5 );
+ $this->glmpdfPlaceText( $footer, 140.5, 2, "center", 'darkblue' );
+/*********CPS
+ // Display Parking Map
+ if ($parkingImage) {
+ $this->glmpdfNextForm();
+ $this->glmpdfPlaceImage( $parkingImage, 0, 2, 0, 'meet', 'center', 280, 125);
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+ $this->glmpdfPlaceText( 'Parking Map', 140, 130, "center", 'black' );
+ }
+
+ // Display Section Map
+ if ($sectionImage) {
+ $this->glmpdfNextForm();
+ $this->glmpdfPlaceImage( $sectionImage, 0, 2, 0, 'meet', 'center', 280, 125);
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+ $this->glmpdfPlaceText( 'Section Map', 140, 130, "center", 'black' );
+ }
+*/
+
+ // Load mask for darkening the bottom portion of the tickets
+// $ticketMask = $this->glmpdfOpenImage(EVENT_MANAGEMENT_APP_BASE.'web/custom/greatlakesbaymag/assets/ticket-gradient.png');
+
+ // Clear performance image loaded flag
+ $performanceLoaded = false;
+
+ // Process Vouchers - For each type of ticket purchased
+ $numb_tickets = 0;
+ foreach( $vouchers as $t )
+ {
+
+ if ($numb_tickets++ > 0) {
+ $this->glmpdfNextForm();
+ }
+ $this->glmpdfPlaceBox( $this->borderWidth, 0, 275, 560, 275, $this->borderColor );
+
+ // Display Logo - Only get performance image if it's not currently loaded
+ if ($performanceLoaded != $t['performance']) {
+
+ $performanceDetail = $Performances->getPerformanceDetail($t['performance']);
+
+ // If we have an image but it's the wrong one, dump the temp file
+ if ($performanceImageFile) {
+ unlink($performanceImageFile);
+ }
+
+ // This performance image is not currently loaded - so do that now
+
+ $performanceImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$performanceDetail['image']);
+ if ($performanceImageFile) {
+ // If we have the image, then load it
+ $performanceImage = $this->glmpdfOpenImage($performanceImageFile);
+ $performanceLoaded = $t['performance'];
+ } else {
+
+ // otherwise, try the venue image
+ $performanceLoaded = $venueImage;
+ }
+
+ }
+
+ // If we have the performance image, display it
+ $haveTopImage = false;
+ if ($performanceImage) {
+ $this->glmpdfPlaceImage( $performanceImage, 85, 195, 1, 'meet', 'center', 70, 75);
+ $haveTopImage = true;
+ } elseif ($venueImageFile) {
+ $this->glmpdfPlaceImage($coverImage, 85, 195, 1, 'meet', 'center', 70, 75);
+ $haveTopImage = true;
+ }
+
+ // Place owner name at top possitioned by whether or not there's an image supplied
+ $this->glmpdfSetFont( "Helvetica-Bold", 24.0 );
+ if ($haveTopImage) {
+
+// $this->glmpdfPlaceText( $config->owner->name, 315, 227, "center", 'black', -300, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['member_name'],ENT_QUOTES,"utf-8"), 315, 227, "center", 'black', -300, '');
+ } else {
+// $this->glmpdfPlaceText( $config->owner->name, 280, 227, "center", 'black', -350, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['member_name'],ENT_QUOTES,"utf-8"), 280, 227, "center", 'black', -350, '');
+ }
+
+ // Place mask
+ //$this->glmpdfPlaceImage($ticketMask, 0, 52, .25, false, 'center', 280, 140);
+
+ // If ticket has already been claimed, then mark ticket
+ if ($t['time_claimed']['date'] != '') {
+ $this->glmpdfSetFont( "Times-Bold", 72.0 );
+ $this->glmpdfPlaceText( "CLAIMED", 110, 80, "left", 'orangered', 0, '' ); // last parameter can be things like "rotate=90"
+ }
+
+ // Ticket Information Area
+ $this->glmpdfSetFont( "Helvetica-Bold", 24.0 );
+ $this->glmpdfPlaceLine(1, 80, 0, 80, 275, $color = "black", $dash = false, $d_a = 1, $d_b = 1);
+ $this->glmpdfPlaceLine(1, 480, 0, 480, 275, $color = "black", $dash = false, $d_a = 1, $d_b = 1);
+
+ // Left End of Ticket - NOTE: use only "left" in glmpdfPlaceText - use "position=..." in optlist instead.
+ if (($t['entrance']-0) > 0) {
+ $entranceDetail = $Entrances->getEntranceDetail($t['entrance']);
+ $this->glmpdfPlaceBox(1, 0, 0, 80, -275, '', $entranceDetail['color']['name'], 'miter');
+ }
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+// $this->glmpdfPlaceText( 'Departing from:', 7, 40, 'left', 'black', 0, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+ $this->glmpdfPlaceText( strtoupper(html_entity_decode($t['entrance_name'],ENT_QUOTES,"utf-8")), 40, 138, 'left', 'black', -250, 'position=center rotate=90');
+// $this->glmpdfPlaceText( strtoupper(html_entity_decode($t['member_name'],ENT_QUOTES,"utf-8")), 60, 138, 'left', 'black', -250, 'position=center rotate=90');
+
+ // Display values
+ $this->glmpdfSetFont( "Helvetica-Bold", 26.0 );
+ $this->glmpdfPlaceText( html_entity_decode($t['performance_name'],ENT_QUOTES,"utf-8"), 280, 170, "center", 'black', -370, '');
+ $this->glmpdfSetFont( "Helvetica-Bold", 24.0 );
+ $this->glmpdfPlaceText( html_entity_decode($t['ticket_name'],ENT_QUOTES,"utf-8"), 280, 140, "center", 'black', -370, '' );
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+// $this->glmpdfPlaceText( html_entity_decode($t['section_name'],ENT_QUOTES,"utf-8"), 280, 130, "center", 'black', -370, '' );
+ $this->glmpdfSetFont( "Helvetica", 18.0 );
+ if ($t['date_specific']['value']) {
+ $thisTime = '';
+ if ($t['time_specific']['value']) {
+ $thisTime = ' - '.$t['ticket_time']['time'];
+ }
+ $this->glmpdfPlaceText( $t['ticket_date']['date'].$thisTime, 280, 110, "center", 'black', -370, '' );
+ } else {
+ $dateRange = 'Valid From '.$t['start_date']['date'].' through '.$t['end_date']['date'];
+ $this->glmpdfPlaceText( $dateRange, 280, 110, "center", 'black', -370, '' );
+ }
+
+ $this->glmpdfSetFont( "Helvetica", 16.0 );
+
+ // Check for Ticket add-ons
+ if (isset($t['addons_sold']) && count($t['addons_sold']) > 0) {
+ $this->glmpdfSetFont( "Helvetica", 14.0 );
+ foreach($t['addons_sold'] as $a) {
+ $addonText = $a['add_on_name'];
+ if (($a['add_on_type']['value']-0) == 2) {
+ $addonText = $addonText.', '.$a['quant'].' '.$a['unit_name'];
+ }
+ $this->glmpdfPlaceText( $addonText, 280, $this->glmpdfCurrentY, "center", 'black', -370, '' );
+ }
+ }
+
+ // Display NON-REFUNDABLE MESSAGE
+ $this->glmpdfSetFont( "Helvetica", 14.0 );
+ $this->glmpdfPlaceText( "NON-REFUNDABLE", 280, $this->glmpdfCurrentY, "center", 'black', -300, '');
+
+ // Display address and contact information
+ if ($venueContact) {
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $this->glmpdfPlaceText( html_entity_decode($this->config->term->prop->cap.' contact information',ENT_QUOTES,"utf-8"), 280, $this->glmpdfCurrentY-5, "center", 'black', -300, '');
+ $this->glmpdfPlaceText( html_entity_decode($venueContact,ENT_QUOTES,"utf-8"), 280, $this->glmpdfCurrentY, "center", 'black', -300, '');
+ }
+
+ // Display address and contact information
+ if ($companyContact) {
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $this->glmpdfPlaceText( html_entity_decode($companyContact,ENT_QUOTES,"utf-8"), 280, 25, "center", 'black', -380, '');
+ }
+
+ // Display additional voucher text at the bottom of the voucher if provided
+ $voucherText = '';
+ if (trim($t['ticket_voucher_text']) != '') {
+ $voucherText = trim(html_entity_decode($t['ticket_voucher_text'],ENT_QUOTES,"utf-8"));
+ } elseif (trim($performanceDetail['voucher_text']) != '') {
+ $voucherText = trim(html_entity_decode($performanceDetail['voucher_text'],ENT_QUOTES,"utf-8"));
+ }
+ if ($voucherText != '') {
+ $this->glmpdfPlaceLine(1, 80, 20, 480, 20, 'black', false);
+ $this->glmpdfSetFont( "Helvetica-Bold", 14.0 );
+// $this->glmpdfPlaceBox(1, 80, 20, 400, 20, "black", "black");
+ $this->glmpdfPlaceText( html_entity_decode($voucherText,ENT_QUOTES,"utf-8"), 280, 6, "center", 'black', -370, '' );
+ }
+
+ // $this->glmpdfPlaceText( $t['ticket_date']['date'].' - '.$t['ticket_time']['time'], 120, $this->glmpdfCurrentY, "left", 'black', 0, '' );
+
+ // Print barcode = {ticket_sold ID}-{person type}-{person_sequence}
+ $barcode = $this->addCheckCode($t['id']);
+ // If we're supposed to print barcode and voucher number on ticket
+ switch ($t['ticket_voucher_type']) {
+
+ case 11: // Voucher/Ticket for Pickup - no Barcode
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+ $this->glmpdfPlaceText( "Pickup at ".$this->config->term->prop->norm, 510, 140, 'left', 'black', -260, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Courier", 12.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap." $barcode", 540, 140, 'left', 'black', -260, 'position=center rotate=90');
+ break;
+
+ case 12; // Voucher/Ticket to be mailed Mailed - no Barcode
+ case 82; // Object Sold (i.e. books) to be mailed - no Barcode
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+ $this->glmpdfPlaceText( "You will receive this by mail", 510, 140, 'left', 'black', -260, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Courier", 12.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap." $barcode", 540, 140, 'left', 'black', -260, 'position=center rotate=90');
+ break;
+
+ case 1: // Standard Voucher/Ticket with Barcode
+ case 81; // Object Sold (i.e. books) to be claimed - with Barcode
+ default:
+ $this->glmpdfSetFont( 'barcode', 54 );
+ $this->glmpdfPlaceText( "*$barcode*", 510, 140, 'left', 'black', 0, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Courier", 12.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap." $barcode", 540, 140, 'left', 'black', -260, 'position=center rotate=90');
+ break;
+
+ }
+
+ $this->glmpdfPlaceText( "Order #".$order['id'], 552, 140, 'left', 'black', 0, 'position=center rotate=90');
+
+ // Check if we need to display a coupon
+// if( ++$numb_tickets % $this->pdfCouponInterval == 0 )
+// $this->printCoupon();
+
+ } // Each voucher
+
+ // Make sure we print the minimum number of coupons
+// $numb_coupons = 0;
+// while( $numb_coupons < $this->pdfMinCoupons ) {
+// $this->printCoupon();
+// $numb_coupons++;
+// }
+
+ // Close PDF setup and send to user's browser
+ $this->glmpdfSendToBrowser( '', 'voucher.pdf' );
+
+ if ($venueImageFile) {
+ unlink($venueImageFile);
+ }
+ if ($parkingImageFile) {
+ unlink($parkingImageFile);
+ }
+ if ($sectionImageFile) {
+ unlink($sectionImageFile);
+ }
+ if ($sectionImageFile) {
+ unlink($sectionImageFile);
+ }
+
+ }
+
+
+ // function to print a coupon
+ function printCoupon()
+ {
+ // Print a Coupon
+ $this->glmpdfNextForm();
+ $this->glmpdfPlaceBox( $this->borderWidth, 0, 142, 281, 142, $this->borderColor );
+
+ // Place Coupon Image
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+ $this->glmpdfPlaceText( 'Coupon Title', 85, 130, "center", 'black' );
+ $this->glmpdfPlaceText( 'Expires on: 1/1/2020', 85, 75 );
+ $this->glmpdfSetFont( "Times-Bold", 30.0 );
+ $this->glmpdfPlaceText( "COUPON", 85, 95, "center", 'lightgrey' );
+ $this->glmpdfSetFont( "Helvetica", 8.0 );
+ $this->glmpdfPlaceTextBox( 'This is a coupon description. It describes this coupon.', 5, 55, 274, 40, "left", 'black' );
+ $this->glmpdfSetFont( "Helvetica-Bold", 8.5 );
+ $this->glmpdfPlaceText( "Mackinaw Area Visitors Bureau - Mackinaw City, MI - 800-666-0160", 140.5, 2, "center", 'darkblue' );
+
+ }
+
+ /*
+ * Function to add check character to end of voucher number
+ *
+ * Uses config->voucher_check_secret and voucher # to create MD5 string
+ * then takes last hex character off of that string and shifts it up to
+ * always be a character (adds 16 to numbers and 10 to the upper-case
+ * version of the character).
+ * i.e. 0 = A, 9 = J, A = K, F =
+ *
+ */
+ public function addCheckCode($voucherNumb)
+ {
+
+ // Create MD5 string using voucher number and secret
+ $md5 = md5($voucherNumb.$this->config->voucher_check_secret);
+
+ // Get last character code of the last character in the MD5
+ $cc = strtoupper(substr($md5, -2));
+ $cc[0] = $this->shiftCheckCodeCharacter($cc[0]);
+ $cc[1] = $this->shiftCheckCodeCharacter($cc[1]);
+
+ // Return voucher number with the new character on the end
+ $voucherNumb .= $cc;
+ return $voucherNumb;
+
+ }
+
+ private function shiftCheckCodeCharacter($c) {
+
+ $x = ord($c);
+
+ // If it's a digit, add 16
+ if ($x < 65) {
+ $x += 17;
+ // otherwise, add 10
+ } else {
+ $x += 10;
+ }
+
+ // Also skip the letter O
+ if (x >= ord('O')) {
+ $x += 1;
+ }
+
+ return chr($x);
+ }
+
+} // class
+
+// Absolutely nothing after next line
+?>
\ No newline at end of file
diff --git a/models/vouchers/Generic/voucher.php b/models/vouchers/Generic/voucher.php
new file mode 100644
index 0000000..6f06214
--- /dev/null
+++ b/models/vouchers/Generic/voucher.php
@@ -0,0 +1,607 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: printVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once PDF_ABSTRACT;
+$Pdf = new GlmPdf();
+
+/**
+ * PdfVoucher class
+ *
+ * @category PdfVoucher
+ * @package PDFLib
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @link <>
+*/
+class PdfVoucher extends GlmPdf
+{
+
+ public $borderWidth = 1;
+ public $borderColor = 'black';
+ public $pdfCouponInterval = 5;
+ public $pdfMinCoupons = 3;
+ public $config;
+ public $companyContact = false;
+ public $venueContact = false;
+
+ function __construct($order, $vouchers, $member, $dbh, $config)
+ {
+
+ $this->config = $config;
+
+ // if debug.glmpdf is set in the configs/common.ini file in the CommonApp directory, do grids on PDFs
+ define ('GLMPDF_DEBUG', $this->config->debug->glmpdf);
+
+ // The following produces a color test sheet. There is no return from that call.
+ // $this->glmpdfShowValidColors();
+
+ // Start with cover page.
+ $this->glmpdfSetForms(
+ 1,
+ array(
+ 1 => array( 'x' => 0, 'y' => 0, 'xs' => 613, 'ys' => 792 )
+ ),
+ 'US Letter'
+ );
+
+ // Start page
+ $this->glmpdfStart( $this->config->owner->name, "Gaslight Media", "Ticket System Receipt/Vouchers" );
+
+ if( !$this->glmpdfAddFont( 'barcode', 'barcode/FREE3OF9.TTF' ) )
+ {
+ echo 'ERROR: Unable to add barcode font.
+ Did you place the barcode font provided in docs/BarcodeFonts into
+ a system fonts directory ("/usr/share/fonts/truetype/Barcode")?
+ Also check the GLMPDF_PDF_FONT_DIR setting in GlmPdf.php.';
+ exit;
+ }
+
+ // If coupon test is selected, print them all now.
+// if( isset($_REQUEST['test_coupons']) )
+// {
+// for( $i=1 ; $i<=count($coupons) ; $i++ )
+// $this->printCoupon( $i );
+//
+// glmpdf_send_to_browser( '', 'voucher.pdf' );
+// exit;
+// }
+
+ // Get images to tmp files
+ require_once IMAGE_SERVER_ABSTRACT;
+ $imServer = new ImageServerAbstract();
+
+ if (trim($member['image']) != '') {
+ $venueImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$member['image']);
+ if ($venueImageFile) {
+ $venueImage = $this->glmpdfOpenImage($venueImageFile);
+
+ // If failure getting the image
+ if ($venueImage == false) {
+ $venueImageFile = false;
+ }
+ }
+ } else {
+ $venueImageFile = false;
+ }
+
+ if (trim($member['parking_map']) != '') {
+ $parkingImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$member['parking_map']);
+ if ($parkingImageFile) {
+ $parkingImage = $this->glmpdfOpenImage($parkingImageFile);
+
+ // If failure getting the image
+ if ($parkingImage == false) {
+ $parkingImageFile = false;
+ }
+ }
+ } else {
+ $parkingImageFile = false;
+ }
+
+ if (trim($member['ticket_sec_map']) != '') {
+ $sectionImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$member['ticket_sec_map']);
+ if ($sectionImageFile) {
+ $sectionImage = $this->glmpdfOpenImage($sectionImageFile);
+
+ // If failure getting the image
+ if ($sectionImage == false) {
+ $sectionImageFile = false;
+ }
+ }
+ } else {
+ $sectionImageFile = false;
+ }
+
+ // Load entrance class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/entrances.php';
+ $Entrances = new EventManagementAdminEntrances($dbh, $config);
+
+ // Load performance class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+ $Performances = new EventManagementAdminPerformances($dbh, $config);
+
+ // Setup additional information
+ // Company contact info
+ if ($config->option->voucher->show_company_contact) {
+ $companyContact = '';
+ $sep = '';
+ if ($config->option->voucher->show_company_name) {
+ $companyContact .= $config->owner->name;
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_company_addr && $config->owner->addr1) {
+ $companyContact .= $sep.$config->owner->addr1;
+ $sep = ' - ';
+ if ($config->owner->addr2) {
+ $companyContact .= ', '.$config->owner->addr2;
+ }
+ }
+ if ($config->option->voucher->show_company_citystate) {
+ $companyContact .= $sep.$config->owner->city.', '.$config->owner->state;
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_company_phone) {
+ if ($config->owner->toll_free) {
+ $companyContact .= $sep.$config->owner->toll_free;
+ } else {
+ $companyContact .= $sep.$config->owner->phone;
+ }
+ }
+ }
+ // Venue/Location contact info
+ $venueContact = false;
+ if ($config->option->voucher->show_venue_contact) {
+ $venueContact = '';
+ $sep = '';
+ if ($config->option->voucher->show_venue_name) {
+ $venueContact .= $member['name'];
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_venue_addr && $member['addr1']) {
+ $venueContact .= $sep.$member['addr1'];
+ $sep = ' - ';
+ if ($member['addr2']) {
+ $venueContact .= ', '.$member['addr2'];
+ }
+ }
+ if ($config->option->voucher->show_venue_citystate) {
+ $venueContact .= $sep.$member['city'].', '.$member['state']['name'];
+ $sep = ' - ';
+ }
+ if ($config->option->voucher->show_venue_phone) {
+ $venueContact .= $sep.$member['phone'];
+ }
+ }
+
+ // START VOUCHER PRINTOUT
+
+ $this->glmpdfNextForm();
+
+ /* Cover Page */
+
+ // Header
+ if ($venueImageFile) {
+ $coverImage = $this->glmpdfOpenImage($venueImageFile);
+ $this->glmpdfPlaceImage($coverImage, 30, 690, .5, false, 'center', 280, 140);
+ }
+ $this->glmpdfSetFont( "Helvetica-Bold", 18.0 ); // Header Text
+ $this->glmpdfPlaceText( $config->owner->name, 340, 750, "center", 'black', -400 );
+ $this->glmpdfSetFont( "Helvetica", 14.0 );
+ $this->glmpdfPlaceText( $config->owner->short_name." - ".$member['name'], 340, $this->glmpdfCurrentY-10, "center", 'black', -400 );
+ $this->glmpdfPlaceText( $member['addr1'], 340, $this->glmpdfCurrentY, "center", 'black', -400 );
+ $this->glmpdfPlaceText( $member['city'].", ".$member['state']['name']." ".$member['zip'], 340, $this->glmpdfCurrentY, "center", 'black', -400 );
+
+ // Sold To Information
+ $valCol = 60;
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $this->glmpdfPlaceText( $this->config->term->order->cap." ID: ".trim($order['id']), $valCol, 650, "left", 'black' );
+ $this->glmpdfPlaceText( trim($order['fname'].' '.$order['lname']), $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+ $this->glmpdfPlaceText( trim($order['addr1']), $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+ if( trim($order['addr2']) != '' )
+ $this->glmpdfPlaceText( trim($order['addr2']), $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+ $this->glmpdfPlaceText( trim($order['city']).', '.$order['state']['value'].' '.trim($order['zip']).' '.$order['country']['value'], $valCol, $this->glmpdfCurrentY-5, "left", 'black', -200 );
+
+ // Purchace/Charge information
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $promptCol = 330;
+ $valCol = 420;
+ $this->glmpdfPlaceText( "Date of Purchase:", $promptCol, 650, "left", 'black' );
+ $this->glmpdfPlaceText( $order['purchase_date']['date'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Card Type:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['cctype'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Name on Card:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['ccname'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Card Number:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['ccnumber'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Confirmation:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['ccconf'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+ $this->glmpdfPlaceText( "Total Charged:", $promptCol, $this->glmpdfCurrentY-5, "left", 'black' );
+ $this->glmpdfPlaceText( $order['charge_total'], $valCol, $this->glmpdfLastY, "left", 'black', -160 );
+
+ // Purchase Summary
+ $ticNumbCol = 20;
+ $perfNameCol = 80;
+ $ticNameCol = 200;
+ $secNameCol = 370;
+ $dateCol = 440;
+ $this->glmpdfPlaceText( '', $ticNumbCol, 550, "center", 'black', 0, '');
+
+ $this->glmpdfSetFont( "Helvetica", 8.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap, $ticNumbCol, $this->glmpdfCurrentY, "left", 'black', -52, '');
+ $this->glmpdfPlaceText( $this->config->term->performance->cap, $perfNameCol, $this->glmpdfLastY, "left", 'black', -110, '');
+ $this->glmpdfPlaceText( $this->config->term->ticket->cap, $ticNameCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ $this->glmpdfPlaceText( $this->config->term->section->cap, $secNameCol, $this->glmpdfLastY, "left", 'black', -60, '');
+ $this->glmpdfPlaceText( 'Date / Time', $dateCol, $this->glmpdfLastY, "left", 'black', -160, '');
+
+ $this->glmpdfPlaceText( '', $ticNumbCol, $this->glmpdfCurrentY-3, "center", 'black', 0, '');
+
+ foreach( $vouchers as $t ) {
+
+ $voucherCode = $this->addCheckCode($t['id']);
+
+ $this->glmpdfSetFont( "Helvetica", 8.0 );
+ $this->glmpdfPlaceText( $voucherCode, $ticNumbCol, $this->glmpdfCurrentY, "left", 'black', -52, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['performance_name'],ENT_QUOTES,"utf-8"), $perfNameCol, $this->glmpdfLastY, "left", 'black', -110, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['ticket_name'],ENT_QUOTES,"utf-8"), $ticNameCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ $this->glmpdfPlaceText( html_entity_decode($t['section_name'],ENT_QUOTES,"utf-8"), $secNameCol, $this->glmpdfLastY, "left", 'black', -60, '');
+ if ($t['date_specific']['value']) {
+ $this->glmpdfPlaceText( $t['ticket_date']['date'], $dateCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ } else {
+ $dateRange = 'Valid From '.$t['start_date']['date'].' through '.$t['end_date']['date'];
+ $this->glmpdfPlaceText( $dateRange, $dateCol, $this->glmpdfLastY, "left", 'black', -160, '');
+ }
+
+ // Check for Ticket add-ons
+ if (isset($t['addons_sold']) && count($t['addons_sold']) > 0) {
+ foreach($t['addons_sold'] as $a) {
+
+ $addonText = $a['add_on_name'];
+ if (($a['add_on_type']['value']-0) == 2) {
+ $addonText = $addonText.', '.$a['quant'].' '.$a['unit_name'];
+ }
+ $this->glmpdfPlaceText( html_entity_decode($addonText,ENT_QUOTES,"utf-8"), $ticNameCol+10, $this->glmpdfCurrentY, "left", 'black', -240, '');
+ }
+ }
+
+ }
+
+ // Special Needs
+ $this->glmpdfSetFont( "Helvetica", 9.0 );
+ if (trim($order['special_needs']) != '') {
+ $this->glmpdfPlaceText( "Special Needs:", 20, $this->glmpdfCurrentY-30, "left", 'black' );
+ $this->glmpdfPlaceTextBox( $order['special_needs'], 100, $this->glmpdfCurrentY+16, 450, 50, "left", 'black' );
+ }
+
+ // General Member Policies
+ if (trim($member['def_ticket_pol']) != '') {
+ $this->glmpdfPlaceText( "Policies:", 20, $this->glmpdfCurrentY-30, "left", 'black' );
+ $this->glmpdfPlaceTextBox( $member['def_ticket_pol'], 100, $this->glmpdfCurrentY+16, 450, 50, "left", 'black' );
+ }
+
+ // Now setup ticket forms
+ $this->glmpdfSetForms(
+ 1,
+ array(
+ 1 => array( 'x' => 25, 'y' => 495, 'xs' => 560, 'ys' => 275 )
+// 2 => array( 'x' => 25, 'y' => 210, 'xs' => 560, 'ys' => 275 )
+ ),
+ 'US Letter'
+ );
+ // Also reset form count
+ $this->glmpdfNextPage();
+
+ // Display Footer
+ $this->glmpdfSetFont( "Helvetica-Bold", 8.5 );
+ $this->glmpdfPlaceText( $footer, 140.5, 2, "center", 'darkblue' );
+/*********CPS
+ // Display Parking Map
+ if ($parkingImage) {
+ $this->glmpdfNextForm();
+ $this->glmpdfPlaceImage( $parkingImage, 0, 2, 0, 'meet', 'center', 280, 125);
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+ $this->glmpdfPlaceText( 'Parking Map', 140, 130, "center", 'black' );
+ }
+
+ // Display Section Map
+ if ($sectionImage) {
+ $this->glmpdfNextForm();
+ $this->glmpdfPlaceImage( $sectionImage, 0, 2, 0, 'meet', 'center', 280, 125);
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+ $this->glmpdfPlaceText( 'Section Map', 140, 130, "center", 'black' );
+ }
+*/
+
+ // Load mask for darkening the bottom portion of the tickets
+// $ticketMask = $this->glmpdfOpenImage(EVENT_MANAGEMENT_APP_BASE.'web/custom/greatlakesbaymag/assets/ticket-gradient.png');
+
+ // Clear performance image loaded flag
+ $performanceLoaded = false;
+
+ // Process Vouchers - For each type of ticket purchased
+ $numb_tickets = 0;
+ foreach( $vouchers as $t )
+ {
+
+ if ($numb_tickets++ > 0) {
+ $this->glmpdfNextForm();
+ }
+ $this->glmpdfPlaceBox( $this->borderWidth, 0, 275, 560, 275, $this->borderColor );
+
+ // Display Logo - Only get performance image if it's not currently loaded
+ if ($performanceLoaded != $t['performance']) {
+
+ $performanceDetail = $Performances->getPerformanceDetail($t['performance']);
+
+ // If we have an image but it's the wrong one, dump the temp file
+ if ($performanceImageFile) {
+ unlink($performanceImageFile);
+ }
+
+ // This performance image is not currently loaded - so do that now
+
+ $performanceImageFile = $imServer->saveImageToTemp(IMAGE_SERVER_PREFIX.'original/'.$performanceDetail['image']);
+ if ($performanceImageFile) {
+ // If we have the image, then load it
+ $performanceImage = $this->glmpdfOpenImage($performanceImageFile);
+ $performanceLoaded = $t['performance'];
+ } else {
+
+ // otherwise, try the venue image
+ $performanceLoaded = $venueImage;
+ }
+
+ }
+
+ // If we have the performance image, display it
+ $haveTopImage = false;
+ if ($performanceImage) {
+ $this->glmpdfPlaceImage( $performanceImage, 85, 195, 1, 'meet', 'center', 70, 75);
+ $haveTopImage = true;
+ } elseif ($venueImageFile) {
+ $this->glmpdfPlaceImage($coverImage, 85, 195, 1, 'meet', 'center', 70, 75);
+ $haveTopImage = true;
+ }
+
+ // Place owner name at top possitioned by whether or not there's an image supplied
+ $this->glmpdfSetFont( "Helvetica-Bold", 24.0 );
+ if ($haveTopImage) {
+ $this->glmpdfPlaceText( $config->owner->name, 315, 227, "center", 'black', -300, '');
+ } else {
+ $this->glmpdfPlaceText( $config->owner->name, 280, 227, "center", 'black', -350, '');
+ }
+
+ // Place mask
+ //$this->glmpdfPlaceImage($ticketMask, 0, 52, .25, false, 'center', 280, 140);
+
+ // If ticket has already been claimed, then mark ticket
+ if ($t['time_claimed']['date'] != '') {
+ $this->glmpdfSetFont( "Times-Bold", 72.0 );
+ $this->glmpdfPlaceText( "CLAIMED", 110, 80, "left", 'orangered', 0, '' ); // last parameter can be things like "rotate=90"
+ }
+
+ // Ticket Information Area
+ $this->glmpdfSetFont( "Helvetica-Bold", 24.0 );
+ $this->glmpdfPlaceLine(1, 80, 0, 80, 275, $color = "black", $dash = false, $d_a = 1, $d_b = 1);
+ $this->glmpdfPlaceLine(1, 480, 0, 480, 275, $color = "black", $dash = false, $d_a = 1, $d_b = 1);
+
+ // Left End of Ticket - NOTE: use only "left" in glmpdfPlaceText - use "position=..." in optlist instead.
+ if (($t['entrance']-0) > 0) {
+ $entranceDetail = $Entrances->getEntranceDetail($t['entrance']);
+ $this->glmpdfPlaceBox(1, 0, 0, 80, -275, '', $entranceDetail['color']['name'], 'miter');
+ }
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+ $this->glmpdfPlaceText( 'Departing from:', 7, 40, 'left', 'black', 0, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+ $this->glmpdfPlaceText( strtoupper(html_entity_decode($t['entrance_name'],ENT_QUOTES,"utf-8")), 30, 138, 'left', 'black', -250, 'position=center rotate=90');
+ $this->glmpdfPlaceText( strtoupper(html_entity_decode($t['member_name'],ENT_QUOTES,"utf-8")), 60, 138, 'left', 'black', -250, 'position=center rotate=90');
+
+ // Display values
+ $this->glmpdfSetFont( "Helvetica-Bold", 26.0 );
+ $this->glmpdfPlaceText( html_entity_decode($t['performance_name'],ENT_QUOTES,"utf-8"), 280, 170, "center", 'black', -370, '');
+ $this->glmpdfSetFont( "Helvetica-Bold", 24.0 );
+ $this->glmpdfPlaceText( html_entity_decode($t['ticket_name'],ENT_QUOTES,"utf-8"), 280, 140, "center", 'black', -370, '' );
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+// $this->glmpdfPlaceText( html_entity_decode($t['section_name'],ENT_QUOTES,"utf-8"), 280, 130, "center", 'black', -370, '' );
+ $this->glmpdfSetFont( "Helvetica", 18.0 );
+ if ($t['date_specific']['value']) {
+ $this->glmpdfPlaceText( $t['ticket_date']['date'], 280, 110, "center", 'black', -370, '' );
+ } else {
+ $dateRange = 'Valid From '.$t['start_date']['date'].' through '.$t['end_date']['date'];
+ $this->glmpdfPlaceText( $dateRange, 280, 110, "center", 'black', -370, '' );
+ }
+
+ $this->glmpdfSetFont( "Helvetica", 16.0 );
+
+ // Check for Ticket add-ons
+ if (isset($t['addons_sold']) && count($t['addons_sold']) > 0) {
+ $this->glmpdfSetFont( "Helvetica", 14.0 );
+ foreach($t['addons_sold'] as $a) {
+ $addonText = $a['add_on_name'];
+ if (($a['add_on_type']['value']-0) == 2) {
+ $addonText = $addonText.', '.$a['quant'].' '.$a['unit_name'];
+ }
+ $this->glmpdfPlaceText( $addonText, 280, $this->glmpdfCurrentY, "center", 'black', -370, '' );
+ }
+ }
+
+ // Display NON-REFUNDABLE MESSAGE
+ $this->glmpdfSetFont( "Helvetica", 14.0 );
+ $this->glmpdfPlaceText( "NON-REFUNDABLE", 280, $this->glmpdfCurrentY, "center", 'black', -300, '');
+
+ // Display address and contact information
+ if ($venueContact) {
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $this->glmpdfPlaceText( html_entity_decode($this->config->term->prop->cap.' contact information',ENT_QUOTES,"utf-8"), 280, $this->glmpdfCurrentY-5, "center", 'black', -300, '');
+ $this->glmpdfPlaceText( html_entity_decode($venueContact,ENT_QUOTES,"utf-8"), 280, $this->glmpdfCurrentY, "center", 'black', -300, '');
+ }
+
+ // Display address and contact information
+ if ($companyContact) {
+ $this->glmpdfSetFont( "Helvetica", 10.0 );
+ $this->glmpdfPlaceText( html_entity_decode($companyContact,ENT_QUOTES,"utf-8"), 280, 25, "center", 'black', -380, '');
+ }
+
+ // Display additional voucher text at the bottom of the voucher if provided
+ $voucherText = '';
+ if (trim($t['ticket_voucher_text']) != '') {
+ $voucherText = trim(html_entity_decode($t['ticket_voucher_text'],ENT_QUOTES,"utf-8"));
+ } elseif (trim($performanceDetail['voucher_text']) != '') {
+ $voucherText = trim(html_entity_decode($performanceDetail['voucher_text'],ENT_QUOTES,"utf-8"));
+ }
+ if ($voucherText != '') {
+ $this->glmpdfPlaceLine(1, 80, 20, 480, 20, 'black', false);
+ $this->glmpdfSetFont( "Helvetica-Bold", 14.0 );
+// $this->glmpdfPlaceBox(1, 80, 20, 400, 20, "black", "black");
+ $this->glmpdfPlaceText( html_entity_decode($voucherText,ENT_QUOTES,"utf-8"), 280, 6, "center", 'black', -370, '' );
+ }
+
+ // $this->glmpdfPlaceText( $t['ticket_date']['date'].' - '.$t['ticket_time']['time'], 120, $this->glmpdfCurrentY, "left", 'black', 0, '' );
+
+ // Print barcode = {ticket_sold ID}-{person type}-{person_sequence}
+ $barcode = $this->addCheckCode($t['id']);
+ // If we're supposed to print barcode and voucher number on ticket
+ switch ($t['ticket_voucher_type']) {
+
+ case 11: // Voucher/Ticket for Pickup - no Barcode
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+ $this->glmpdfPlaceText( "Pickup at ".$this->config->term->prop->norm, 510, 140, 'left', 'black', -260, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Courier", 12.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap." $barcode", 540, 140, 'left', 'black', -260, 'position=center rotate=90');
+ break;
+
+ case 12; // Voucher/Ticket to be mailed Mailed - no Barcode
+ case 82; // Object Sold (i.e. books) to be mailed - no Barcode
+ $this->glmpdfSetFont( "Helvetica-Bold", 20.0 );
+ $this->glmpdfPlaceText( "You will receive this by mail", 510, 140, 'left', 'black', -260, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Courier", 12.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap." $barcode", 540, 140, 'left', 'black', -260, 'position=center rotate=90');
+ break;
+
+ case 1: // Standard Voucher/Ticket with Barcode
+ case 81; // Object Sold (i.e. books) to be claimed - with Barcode
+ default:
+ $this->glmpdfSetFont( 'barcode', 54 );
+ $this->glmpdfPlaceText( "*$barcode*", 510, 140, 'left', 'black', 0, 'position=center rotate=90');
+ $this->glmpdfSetFont( "Courier", 12.0 );
+ $this->glmpdfPlaceText( $this->config->term->voucher->cap." $barcode", 540, 140, 'left', 'black', -260, 'position=center rotate=90');
+ break;
+
+ }
+
+ $this->glmpdfPlaceText( "Order #".$order['id'], 552, 140, 'left', 'black', 0, 'position=center rotate=90');
+
+ // Check if we need to display a coupon
+// if( ++$numb_tickets % $this->pdfCouponInterval == 0 )
+// $this->printCoupon();
+
+ } // Each voucher
+
+ // Make sure we print the minimum number of coupons
+// $numb_coupons = 0;
+// while( $numb_coupons < $this->pdfMinCoupons ) {
+// $this->printCoupon();
+// $numb_coupons++;
+// }
+
+ // Close PDF setup and send to user's browser
+ $this->glmpdfSendToBrowser( '', 'voucher.pdf' );
+
+ if ($venueImageFile) {
+ unlink($venueImageFile);
+ }
+ if ($parkingImageFile) {
+ unlink($parkingImageFile);
+ }
+ if ($sectionImageFile) {
+ unlink($sectionImageFile);
+ }
+ if ($sectionImageFile) {
+ unlink($sectionImageFile);
+ }
+
+ }
+
+
+ // function to print a coupon
+ function printCoupon()
+ {
+ // Print a Coupon
+ $this->glmpdfNextForm();
+ $this->glmpdfPlaceBox( $this->borderWidth, 0, 142, 281, 142, $this->borderColor );
+
+ // Place Coupon Image
+ $this->glmpdfSetFont( "Helvetica-Bold", 10.0 );
+ $this->glmpdfPlaceText( 'Coupon Title', 85, 130, "center", 'black' );
+ $this->glmpdfPlaceText( 'Expires on: 1/1/2020', 85, 75 );
+ $this->glmpdfSetFont( "Times-Bold", 30.0 );
+ $this->glmpdfPlaceText( "COUPON", 85, 95, "center", 'lightgrey' );
+ $this->glmpdfSetFont( "Helvetica", 8.0 );
+ $this->glmpdfPlaceTextBox( 'This is a coupon description. It describes this coupon.', 5, 55, 274, 40, "left", 'black' );
+ $this->glmpdfSetFont( "Helvetica-Bold", 8.5 );
+ $this->glmpdfPlaceText( "Mackinaw Area Visitors Bureau - Mackinaw City, MI - 800-666-0160", 140.5, 2, "center", 'darkblue' );
+
+ }
+
+ /*
+ * Function to add check character to end of voucher number
+ *
+ * Uses config->voucher_check_secret and voucher # to create MD5 string
+ * then takes last hex character off of that string and shifts it up to
+ * always be a character (adds 16 to numbers and 10 to the upper-case
+ * version of the character).
+ * i.e. 0 = A, 9 = J, A = K, F =
+ *
+ */
+ public function addCheckCode($voucherNumb)
+ {
+
+ // Create MD5 string using voucher number and secret
+ $md5 = md5($voucherNumb.$this->config->voucher_check_secret);
+
+ // Get last character code of the last character in the MD5
+ $cc = strtoupper(substr($md5, -2));
+ $cc[0] = $this->shiftCheckCodeCharacter($cc[0]);
+ $cc[1] = $this->shiftCheckCodeCharacter($cc[1]);
+
+ // Return voucher number with the new character on the end
+ $voucherNumb .= $cc;
+ return $voucherNumb;
+
+ }
+
+ private function shiftCheckCodeCharacter($c) {
+
+ $x = ord($c);
+
+ // If it's a digit, add 16
+ if ($x < 65) {
+ $x += 17;
+ // otherwise, add 10
+ } else {
+ $x += 10;
+ }
+
+ // Also skip the letter O
+ if (x >= ord('O')) {
+ $x += 1;
+ }
+
+ return chr($x);
+ }
+
+} // class
+
+// Absolutely nothing after next line
+?>
\ No newline at end of file
diff --git a/models/vouchers/MMM/voucher.php b/models/vouchers/MMM/voucher.php
new file mode 100644
index 0000000..5f541cd
--- /dev/null
+++ b/models/vouchers/MMM/voucher.php
@@ -0,0 +1,1146 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: printVoucher.inc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once PDF_ABSTRACT;
+$Pdf = new GlmPdf();
+
+/**
+ * PdfVoucher class
+ *
+ * @category PdfVoucher
+ * @package PDFLib
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @link <>
+*/
+class PdfVoucher extends GlmPdf
+{
+
+ public $borderWidth = 1;
+ public $borderColor = 'black';
+ public $pdfCouponInterval = 5;
+ public $pdfMinCoupons = 3;
+ public $config;
+ private $is;
+ private $dbh;
+
+ function __construct($order, $vouchers, $member, $dbh, $config, $couponTest = false)
+ {
+
+ $this->dbh = $dbh;
+ $this->config = $config;
+
+ // Load image server support
+ require_once IMAGE_SERVER_ABSTRACT;
+ $this->is = new ImageServerAbstract();
+
+ // if debug.glmpdf is set in the configs/common.ini file in the CommonApp directory, do grids on PDFs
+ define ('GLMPDF_DEBUG', $this->config->debug->glmpdf);
+
+ // The following produces a color test sheet. There is no return from that call.
+ // $this->glmpdfShowValidColors(); exit;
+
+ // Start with cover page.
+ $this->glmpdfSetForms(
+ 1,
+ array(
+ 1 => array( 'x' => 0, 'y' => 0, 'xs' => 613, 'ys' => 792 )
+ ),
+ 'US Letter'
+ );
+
+ // Start page
+ $this->glmpdfStart( $this->config->owner->name, "Gaslight Media", "Ticket System Receipt/Vouchers" );
+
+ if( !$this->glmpdfAddFont( 'barcode', 'barcode/FREE3OF9.TTF' ) )
+ {
+ echo 'ERROR: Unable to add barcode font.
');
+ e.preventDefault();
+ });
+
+ /*
+ * CKeditor actions
+ */
+
+ // Code to kick off CKEditor for specific fields
+// f_buildCkeditor($("#notes"));
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#notes"));
+ });
+
+ f_restartOnTabSelect();
+
+ // Code to start datepicker for each date input
+ $("#attendanceDateInput").datepicker({
+ dateFormat: "mm/dd/yy",
+ minDate: '{attendanceDetail.attendance_date.date_list.min}',
+ maxDate: '{attendanceDetail.attendance_date.date_list.max}'
+ });
+
+
+ });
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Attendance/list.html b/views/admin/tickets/Attendance/list.html
new file mode 100644
index 0000000..0c746ac
--- /dev/null
+++ b/views/admin/tickets/Attendance/list.html
@@ -0,0 +1,125 @@
+
+
+
+
+{if:checkPermission(#10#)}
+
+
Add a {term.attendance_log.cap}
+
+{end:}
+
+
Larger Table
+
+
+
+ Search {term.attendance_log.plur_cap}: (type any portion of a {term.attendance_log.norm} name)
+
+ {if:AttendanceList.Attendance_list}
+
+
');
+ e.preventDefault();
+ });
+
+ /*
+ * CKeditor actions
+ */
+
+ // Code to kick off CKEditor for specific fields
+// f_buildCkeditor($("#notes"));
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#notes"));
+ });
+
+ f_restartOnTabSelect();
+
+ });
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Contact/list.html b/views/admin/tickets/Contact/list.html
new file mode 100644
index 0000000..2e9c1bc
--- /dev/null
+++ b/views/admin/tickets/Contact/list.html
@@ -0,0 +1,125 @@
+
+
+
+
+{if:checkPermission(#10#)}
+
+
Add a Contact
+
+{end:}
+
+
Larger Table
+
+
+
+ Search Contacts: (type any portion of a contact name)
+
+ {if:contactList.contact_list}
+
+
+
+
+
Last Name
First Name
Organization
Phone
E-Mail
+
+
+ {foreach:contactList.contact_list,c}
+
+
{c.lname:h}
+
{c.fname:h}
+
{c.org}
+
{c.office_phone}
+
{c.email}
+
+ {end:}
+
+
+
+
+ {else:}
+
No contacts are currently listed.
+
You should have at least one contact listed for each {term.prop.norm}.
+{appAdminURL}
+
+
+
+
+ {startScript:h}
+
+ var reloadTimerHandle = false;
+ var reloadTime = 2000;
+
+ // Reload the current window with Action = Debug_update
+ function reloadThisWindow()
+ {
+ window.location.assign("{appAdminURL}&Action=Debug_update");
+ }
+
+ // Sets debug reload timer to pick up new data in some period of time. - Called from emDebugWindowReloadRequest() in main .js file
+ function debugReloadRequest()
+ {
+ // Clear any pending reload request
+ if (reloadTimerHandle != false) {
+ window.clearTimeout(reloadTimerHandle);
+ }
+
+ // Set timer to wait for additional actions before reloading debug page
+ reloadTimerHandle = window.setTimeout(reloadThisWindow, reloadTime);
+
+ // Clear current debug data and display wait message
+ document.getElementById('debugBody').innerHTML = '
Loading, waiting for possible additional requests...
';
+ }
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Debug/start.html b/views/admin/tickets/Debug/start.html
new file mode 100644
index 0000000..20b8a62
--- /dev/null
+++ b/views/admin/tickets/Debug/start.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
Startup: {debugStartupTime}
+
Event Management Admin Debug
+
+
Debug Startup
+
+ {startScript:h}
+
+ var reloadTimerHandle = false;
+ var reloadTime = 4000;
+
+ // Reload the current window with Action = Debug_update
+ function reloadThisWindow()
+ {
+ window.location.assign("?Action=Debug_update");
+ }
+
+ // Sets debug reload timer to pick up new data in some period of time. - Called from emDebugWindowReloadRequest() in main .js file
+ function debugReloadRequest()
+ {
+ // Clear any pending reload request
+ if (reloadTimerHandle != false) {
+ window.clearTimeout(reloadTimerHandle);
+ }
+
+ // Set timer to wait for additional actions before reloading debug page
+ reloadTimerHandle = window.setTimeout(reloadThisWindow, reloadTime);
+
+ // Clear current debug data and display wait message
+ document.getElementById('debugBody').innerHTML = '
Loading, waiting for possible additional requests...
';
+ }
+
+
+
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Entrance/delete.html b/views/admin/tickets/Entrance/delete.html
new file mode 100644
index 0000000..2be67ae
--- /dev/null
+++ b/views/admin/tickets/Entrance/delete.html
@@ -0,0 +1,55 @@
+
+
+
Delete this {term.entrance.cap}
+
+
{entranceDetail.name}
+
+{if:checkPermission(#10#)}
+
+
+
Confirm Delete
+
+
+
Cancel Delete
+
+
+{end:}
+
+ {if:entranceDetail}
+
+
+
+
+
+
Delete {term.entrance.cap}:
+
+
Clicking "Confirm Delete" on the right will permanently delete this {term.entrance.norm}.
');
+ e.preventDefault();
+ });
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#descr"));
+ });
+
+ /*
+ * CKeditor actions
+ */
+
+ // Code to kick off CKEditor for specific fields
+ f_buildCkeditor($("#descr"));
+ f_buildCkeditor($("#notes"));
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#descr"));
+ });
+
+ /*
+ * Map operations
+ */
+
+ // Code to kick off the geolocation-edit feature
+ $("#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"
+ }
+ });
+
+ f_restartOnTabSelect();
+
+ });
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Entrance/list.html b/views/admin/tickets/Entrance/list.html
new file mode 100644
index 0000000..f3b8924
--- /dev/null
+++ b/views/admin/tickets/Entrance/list.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+
Add a {term.entrance.cap}
+
+
+
Larger Table
+
+
+
+ Search {term.entrance.plur_cap}: (type any portion of a {term.entrance.norm} name)
+
+ {if:entranceList}
+
+
+
+
+
Sort Order
Name
{term.voucher.cap} Color
+
+
+ {foreach:entranceList,c}
+
+
{c.sort}
+
{c.name:h}
+
{c.color.name}
+
+ {end:}
+
+
+
+
+ {else:}
+
No {term.entrance.plur} listed.
+
+ You do not need to have a {term.entrance.norm}. If you do decide to add {term.entrance.plur},
+ you may associate specific ones with specific {term.section.plur} or {term.ticket.plur}.
+
+ WARNING: Deleting this {term.prop.norm} will remove all related data.
+ This will remove all history related to this {term.prop.norm} and will
+ remove all related data from reports.
+
+
+ You may want to simply mark this {term.prop.norm} as "inactive" by un-checking
+ the "Account Active" option in the {term.prop.norm} edit screen then delete the
+ {term.prop.norm} after all yearly reports have been produced.
+
+
+ If you are sure you want to continue, please enter exactly "Please Delete" in
+ the field below then click the "Confirm Delete" button. This action will not
+ be reversable!
+
diff --git a/views/admin/tickets/Misc/configDetail.html b/views/admin/tickets/Misc/configDetail.html
new file mode 100644
index 0000000..4e26267
--- /dev/null
+++ b/views/admin/tickets/Misc/configDetail.html
@@ -0,0 +1,81 @@
+
+
+
+ Miscellaneous System Configuration
+
+
+
+
+
Edit
+
+
+
+
+
+
+
+
Text for {term.performance.norm} selection page:
{miscConfigDetail.intro_text:h}
+
Text for {term.section.norm} selection page:
{miscConfigDetail.section_text:h}
+
Text for {term.ticket.norm} selection page:
{miscConfigDetail.ticket_text:h}
+
Text for cart page:
{miscConfigDetail.cart_text:h}
+
Text for checkout page:
{miscConfigDetail.checkout_text:h}
+
Text for checkout success page:
{miscConfigDetail.success_text:h}
+
Tracking script for checkout success page:
{miscConfigDetail.tracking}
+
+
+
Text prompts for optional checkout fields:
+
+ #1: {miscConfigDetail.opt_field_1_name}
+ #2: {miscConfigDetail.opt_field_2_name}
+ #3: {miscConfigDetail.opt_field_3_name}
+
+ (Blank fields are not included in the checkout page.)
+
+
+
Admin Checkout No Payment Info Reasons:
{miscConfigDetail.no_payment_reasons:h}
+
+
SSL Seal for Checkout Page:
+
+
+
Head Script:
{miscConfigDetail.ssl_seal_head_script}
+
Body Script:
{miscConfigDetail.ssl_seal_body_script}
+
+
+
+
+
Central Payment {term.prop.Cap}:
+
+ {if:miscConfigDetail.central_payment}
+ All payments will be processed through {miscConfigDetail.central_payment:h}.
+ {else:}
+ Payments will not be centrally processed.
+ {end:}
+
+ * Index file uploaded successfully.
+ Please test to make sure your new file works correctly.
+ If not, click the "Restore Previous File" button.
+
+ {end:}
+ {if:indexFileRestored}
+
+ * Previous Index file restored.
+ Please test to make sure your new file works correctly.
+ If not, please try to locate a known good file to upload.
+
+ {end:}
+{end:}
+
+
index.html: Last updated {indexTime}
+
+
+
+
+
+
+{if:doingStylesheet}
+ {if:reason}
+
+
We're sorry, we had a problem with your request:
+
+ {foreach:reason,r}{Chuck}
+
{r:h}
+ {end:}
+
+
+ {end:}
+ {if:stylesheetFileUploaded}
+
+ * Stylesheet file uploaded successfully.
+ Please test to make sure your new file works correctly. If not, click the "Restore Previous File" button.
+
+ {end:}
+ {if:stylesheetFileRestored}
+
+ * Previous Stylesheet file restored.
+ Please test to make sure your new file works correctly. If not, please try to locate a known good file to upload.
+
');
+ e.preventDefault();
+ });
+
+ /*
+ * CKeditor actions
+ */
+
+ // Code to kick off CKEditor for specific fields
+ f_buildCkeditor($("#descr"));
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#descr"));
+ });
+
+ f_restartOnTabSelect();
+
+ });
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Order/list.html b/views/admin/tickets/Order/list.html
new file mode 100644
index 0000000..98a9f22
--- /dev/null
+++ b/views/admin/tickets/Order/list.html
@@ -0,0 +1,132 @@
+
+
+
+
+
+
Larger Table
+
+
+
+ Search Orders: (start typing any data in list)
+
+ {if:orderList}
+
+
');
+ e.preventDefault();
+ });
+
+ /*
+ * CKeditor actions
+ */
+
+ // Code to kick off CKEditor for specific fields
+ f_buildCkeditor($("#descr"));
+ f_buildCkeditor($("#policy"));
+ f_buildCkeditor($("#conf_text"));
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#descr"));
+ f_removeCkeditor($("#policy"));
+ f_removeCkeditor($("#conf_text"));
+ });
+
+ /*
+ * Date input operations
+ */
+
+ // Code to start datepicker for each date input
+ $("#startDateInput").datepicker({
+ dateFormat: "mm/dd/yy",
+ minDate: '{performanceDetail.start_date.date_list.min}',
+ maxDate: '{performanceDetail.start_date.date_list.max}'
+ });
+ $("#endDateInput").datepicker({
+ dateFormat: "mm/dd/yy",
+ minDate: '{performanceDetail.end_date.date_list.min}',
+ maxDate: '{performanceDetail.end_date.date_list.max}'
+ });
+ $("#cutoffDateInput").datepicker({
+ dateFormat: "mm/dd/yy",
+ minDate: '{performanceDetail.cutoff_date.date_list.min}',
+ maxDate: '{performanceDetail.cutoff_date.date_list.max}'
+ });
+
+ f_restartOnTabSelect();
+
+ });
+
+
diff --git a/views/admin/tickets/Performance/list.html b/views/admin/tickets/Performance/list.html
new file mode 100644
index 0000000..4984341
--- /dev/null
+++ b/views/admin/tickets/Performance/list.html
@@ -0,0 +1,144 @@
+
+
+
+
+
+
Add a {term.performance.cap}
+
+
+
Larger Table
+
+
+
+ Search {term.performance.plur_cap}: (type any portion of a {term.performance.norm} name)
+
+ {if:performanceList}
+
+
+
+
+
Sort Order
Name
Active
Admin Only
{term.prop.cap}
Promote in Cart
+
+
+ {foreach:performanceList,c}
+
+
{c.sort}
+
{c.name:h}
+
{c.active.name}
+
{c.admin_only.name}
+
{c.member_name:h}
+
{c.promote_in_cart.name}
+
+ {end:}
+
+
+
+
+ {else:}
+
No {term.performance.plur} listed.
+
+ You need to have at least one {term.performance.norm} in order to sell {term.ticket.plur}.
+ If you have a {term.prop.norm} that sells {term.ticket.plur} through other {term.prop.plur},
+ then that {term.prop.norm} will need at least one {term.performance.norm}. If you're doing that,
+ the {term.prop.norm} that will be selling those {term.ticket.plur} does not need a
+ {term.performance.norm} unless it will be selling its own.
+
');
+ e.preventDefault();
+ });
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#descr"));
+ });
+
+ /*
+ * CKeditor actions
+ */
+
+ // Code to kick off CKEditor for specific fields
+ f_buildCkeditor($("#descr"));
+ f_buildCkeditor($("#notes"));
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#descr"));
+ });
+
+ f_restartOnTabSelect();
+
+ });
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Section/list.html b/views/admin/tickets/Section/list.html
new file mode 100644
index 0000000..48b7eec
--- /dev/null
+++ b/views/admin/tickets/Section/list.html
@@ -0,0 +1,127 @@
+
+
+
+
+
+
Add a {term.section.cap}
+
+
+
Larger Table
+
+
+
+ Search {term.section.plur_cap}: (type any portion of a {term.section.norm} name)
+
+ {if:sectionList}
+
+
+
+
+
Sort Order
Name
+
+
+ {foreach:sectionList,c}
+
+
{c.sort}
+
{c.name:h}
+
+ {end:}
+
+
+
+
+ {else:}
+
No {term.section.plur} listed.
+
+ You will need at least one {term.section.norm} in order to sell {term.ticket.plur}.
+ You may, however, use a single generic {term.section.norm} such as "General Admission".
+
Clicking "Confirm Delete" on the right will permanently delete this {term.ticket.norm}.
+
+
+
{term.prop.cap}
{ticketDetail.member_name:h}
+
{term.ticket.cap} Type:
{ticketDetail.ticket_type.name}
+
{term.ticket.cap} Name:
{ticketDetail.name}
+
{term.ticket.cap} Title:
{ticketDetail.title}
+
Active:
{ticketDetail.active.name}
+
Purchase by Admin Only:
{ticketDetail.admin_only.name}
+
{term.performance.cap}:
{ticketDetail.performance}
+
{term.section.cap}:
{ticketDetail.section}
+
+
Dates available for sale:
+
+ {if:ticketDetail.for_sale_start_date.date}
+ May be purchased starting on {ticketDetail.for_sale_start_date.date}
+ {else:}
+ {if:ticketDetail.for_sale_end_date.date}
+ {else:}
+ No purchase date restrictions
+ {end:}
+ {end:}
+ {if:ticketDetail.for_sale_end_date.date}
+ May be purchased through {ticketDetail.for_sale_end_date.date}
+ {end:}
+
+
+
+
Date:
+
+ {if:ticketDetail.date_specific.value}
+ Dates determined by inventory.
+ {else:}
+ {if:ticketDetail.start_date.date}
+ May be used from {ticketDetail.start_date.date} through {ticketDetail.end_date.date}
+ {else:}
+ May be used on any date.
+ {end:}
+ {end:}
+
+
+
+
Time:
+
+ {if:ticketDetail.time_specific.value}
+ {ticketDetail.ticket_time.time}
+ {else:}
+ No time specified.
+ {end:}
+
+
+
+
Uses per {term.ticket.cap}:
+
+ {if:ticketDetail.unlimited_use.value}
+ May be used an unlimited number of times.
+ {else:}
+ {ticketDetail.uses}
+ {end:}
+
+ Sorry, we are unable to delete the entry at this time.
+ {ticketDetail.reason:h}
+ {else:}
+
Deleted
+ {end:}
+ {else:}
+
+
Clicking the button above will permanently delete this {term.ticket.norm}.
+ {end:}
+
+
+ {end:}
+
{term.prop.cap}
{ticketDetail.member_name:h}
+
{term.ticket.cap} Name:
{ticketDetail.name}ID: {ticketDetail.id}
+
{term.ticket.cap} Title:
{ticketDetail.title:h}
+ {if:option.packages}
+
+
{term.ticket.cap} Type:
+
+
{ticketDetail.ticket_type.name}
+ {if:isPackage}
+
Package Tickets
+
+
+
Quant
Separate Voucher
Location
Category
Ticket
Active
+
+
+ {foreach:ticketPackage,y}
+
+
{y.quant}
+
{y.separate_voucher.name}
+
{y.member_name:h}
+
{y.performance_name:h}
+
{y.title:h}
+
{if:y.active}Yes{else:}No{end:}
+
+ {end:}
+
+
+ {end:}
+
+
+ {end:}
+
Active:
{ticketDetail.active.name}
+
Purchase by Admin Only:
{ticketDetail.admin_only.name}
+
{term.performance.cap}:
{ticketDetail.performance:h}
+
{term.section.cap}:
{ticketDetail.section}
+
+
Dates available for sale:
+
+ {if:ticketDetail.for_sale_start_date.date}
+ May be purchased starting on {ticketDetail.for_sale_start_date.date}
+ {else:}
+ {if:ticketDetail.for_sale_end_date.date}
+ {else:}
+ No purchase date restrictions
+ {end:}
+ {end:}
+ {if:ticketDetail.for_sale_end_date.date}
+ May be purchased through {ticketDetail.for_sale_end_date.date}
+ {end:}
+
+
+
+
Date:
+
+ {if:ticketDetail.date_specific.value}
+ Dates determined by inventory.
+
+ Days of week: {foreach:ticketDetail.days_of_week.names,s}{s} {end:}
+ {if:ticketDetail.start_date.date}
+ Inventory will be created from {ticketDetail.start_date.date} through {ticketDetail.end_date.date}
+ {end:}
+
+
+ {else:}
+ {if:ticketDetail.start_date.date}
+ May be used from {ticketDetail.start_date.date} through {ticketDetail.end_date.date}
+ {else:}
+ May be used on any date.
+ {end:}
+ {end:}
+
+
+
+
Time:
+
+ {if:ticketDetail.time_specific.value}
+ {ticketDetail.ticket_time.time}
+ {else:}
+ No time specified.
+ {end:}
+
+
+
+
Uses per {term.ticket.cap}:
+
+ {if:ticketDetail.unlimited_use.value}
+ May be used an unlimited number of times.
+ {else:}
+ {ticketDetail.uses}
+ {end:}
+
Click date cell to dissable or enable a partcular date.
+
Click on edit icon to change the values.
+
+
+
+
+
+{startScript:h}
+
+ $(function() {
+
+ // Send user notice if they click a non-inventory cell
+ $('.emCalDateCellNotice').click( function() {
+ alert('This is not within the date range for the {term.performance.norm}. To add inventory for this date, edit the {term.performance.norm} and change the start or end date.');
+ });
+
+ // Toggle date cell on-off
+ $('.emCalDateCellSelectable').click( function() {
+
+ var thisCell = $(this);
+ var thisId = $(this).attr('invId');
+ var invStatus;
+
+ // If the cell is currently selected
+ if (thisCell.hasClass("emCalDateCellSelected")) {
+ invStatus = 0; // Change to not selected
+ } else {
+ invStatus = 1; // Otherwise change to selected
+ }
+
+
+ $.ajax({
+ url: "{adminURL}&Action=Ticket_setActive&TicketInventoryID=" + thisId + "&TicketInventoryStatus=" + invStatus,
+ success: function() {
+ // Update cell status display
+ if (invStatus == 1) {
+ thisCell.addClass('emCalDateCellSelected');
+ } else {
+ thisCell.removeClass('emCalDateCellSelected');
+ }
+ } ,
+ error: function() {
+ alert(
+ 'There was an error while submitting this information.\n' +
+ 'The information may not have been updated.\n' +
+ 'Please try again later or call for support.'
+ );
+ }
+ });
+
+ });
+
+
+ // Pop-up calendar edit forms
+ $('.emCalDateEditIcon').click( function() {
+
+ // get needed parameters
+ var dateTime = $(this).attr('calDate');
+ var thisId = $(this).attr('invId');
+ var thisTime = $('#ticket_time_' + dateTime).html();
+ var thisQuant = $('#quant_' + dateTime).html();
+ var thisAvail = $('#avail_' + dateTime).html();
+ var thisSold = $('#sold_' + dateTime).html();
+
+ // Place edit form in cell edit container
+ $('#edit_'+dateTime).html(' \
+
+
+{startScript:h}
+
+ $(function() {
+
+ /*
+ * Table operations
+ */
+
+ $('.voucherCouponEditTable').dataTable({
+ "bPaginate": false,
+ "bLengthChange": false,
+ "bFilter": false,
+ "bSort": false,
+ "bInfo": false,
+ "bAutoWidth": false,
+ "bDestroy": true
+ });
+
+ // Block default form submission
+ $("form").submit(function (e) {
+ var date = $('#date').val();
+ var voucherWindow = window.open('{adminURL}&Action=Ticket_printSampleVoucher&testCoupons=true&date=' + date,
+ "voucherPrint",
+ "height=750,width=600,menubar=yes,toolbar=yes,alwaysRaised=yes,menu"
+ );
+ return false;
+ });
+
+ /*
+ * CKeditor actions
+ */
+
+ // Code to kick off CKEditor for specific fields
+ f_buildCkeditor($("#notes"));
+
+ // Remove the editors and store the data back in the textareas before the AJAX form submission
+ $('.emEditSubmit').click( function() {
+ f_removeCkeditor($("#notes"));
+ });
+
+ f_restartOnTabSelect();
+
+ /*
+ * Date input operations
+ */
+
+ // Code to start datepicker for each date input
+ $("#date").datepicker({
+ dateFormat: "mm/dd/yy",
+ minDate: '{voucherCouponDetail.display_from.date_list.min}',
+ maxDate: '{voucherCouponDetail.display_from.date_list.max}'
+ });
+
+ // Print test vouchers
+ $('.voucherPrint').click(function(){
+ var date = $(this).attr('emOrderID');
+ var orderVerify = $(this).attr('emOrderVerify');
+ var voucherWindow = window.open('{adminURL}&Action=Ticket_printSampleVoucher&testTicket={ticketDetail.id}',
+ "voucherPrint",
+ "height=750,width=600,menubar=yes,toolbar=yes,alwaysRaised=yes,menu"
+ );
+ voucherWindow.focus();
+ voucherWindow.print();
+ return false;
+ });
+
+
+
+ });
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/Welcome/index.html b/views/admin/tickets/Welcome/index.html
new file mode 100644
index 0000000..e2c8932
--- /dev/null
+++ b/views/admin/tickets/Welcome/index.html
@@ -0,0 +1,60 @@
+
+
+{if:userMemberID}
+
+
{userMemberVenueName} {term.ticket.cap} Management System
+ {if:checkPermission(#10#)}
+
+ For assistance with this system please call {owner.name} at {owner.phone}
+
+ {else:}
+
+ {end:}
+
+
+{else:}
+
+
Welcome to the Gaslight Media Event Management / Ticketing System.
+
+ In an effort to provide our customers with the best possible service, Gaslight Media will from time to
+ time make improvements to this application and correct problems that we have noticed
+ or that have been reported to us. Updates will be posted here so that you can be aware of improvements.
+ As always, please let us know if you have any concerns, need any assistance, or would like to suggest new features.
+
+
+
+
+
Updates for 3/26/2015
+
+
+
The following updates have been included in this version...
+
+
+
+ "Admin Only" Sales: There is now a tab at the upper-right of the Event Management / Ticketing System admin interface called
+ "Place an Order". When you click this, it will take you to the front-end of the the Event/Ticketing system to place an order. It
+ will also know that you are an admin user and will include certain categories and items that are not available to regular
+ users. To specify which items you would like to mark as "Admin Only", select either the "Categories" or "Items" tab, select
+ the desired entry from the list, edit that entry and check the "Purchase by Admin Only" checkbox then save by clicking the Update button.
+
+
+ Note that when you are in the front end as an "Admin" user, you will see the "Purchasing By Admin User" banner across the top of each
+ page.
+
+
+
+
+
+
+{end:}
+
+
+
+{startScript:h}
+
+ // jQuery Section
+ $(document).ready(function(){
+
+ });
+
+
\ No newline at end of file
diff --git a/views/admin/tickets/index.html b/views/admin/tickets/index.html
new file mode 100644
index 0000000..94a2289
--- /dev/null
+++ b/views/admin/tickets/index.html
@@ -0,0 +1,158 @@
+
+
+
+ {startScript:h}
+
+ // Pass some reference parameters to JAVAScript
+ var baseSiteURL = '{baseURL}';
+ var baseAdminURL = '{baseAdminURL}';
+ var appAdminURL = '{appAdminURL}';
+ var memberUser = '{MemberUser}';
+ var debugEnabled = {if:option.admin_debug}true{else:}false{end:};
+ var debugWidth = {option.admin_debug_size};
+ var startWithClaims = {startWithClaims};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {if:userMemberID}
+
+
+{if:userMemberID}
+ {userMemberVenueName} {term.ticket.cap} Management System
+ {if:checkPermission(#10#)}
+ For assistance with this system please call {owner.name} at {owner.phone}
+ {else:}
+
+ {end:}
+{else:}
+
+ Gaslight Media - Event Management and Ticketing System
+{end:}
+
+
+ {startScript:h}
+
+ $(function() {
+
+ if (startWithClaims) {
+ f_loadAction('Sold_claim', 'Main_container', "tabList=");
+ $('#claimStatusTab').addClass('emTabSelected');
+ }
+
+ });
+
+ // Link to front-end ticket ordering
+ $('#placeOrder').click( function() {
+ window.open('{frontEndOrderLink}?adminUserCheck={adminUserFrontLinkCheck}','_blank');
+ });
+
+
+
+
+
+
+
+
+
diff --git a/views/admin/tickets/index.html.SAVE b/views/admin/tickets/index.html.SAVE
new file mode 100644
index 0000000..4630d9f
--- /dev/null
+++ b/views/admin/tickets/index.html.SAVE
@@ -0,0 +1,155 @@
+
+
+
+ {startScript:h}
+
+ // Pass some reference parameters to JAVAScript
+ var baseSiteURL = '{baseURL}';
+ var baseAdminURL = '{baseAdminURL}';
+ var appAdminURL = '{appAdminURL}';
+ var memberUser = '{MemberUser}';
+ var debugEnabled = {if:option.admin_debug}true{else:}false{end:};
+ var debugWidth = {option.admin_debug_size};
+ var startWithClaims = {startWithClaims};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {if:userMemberID}
+
+
+{if:userMemberID}
+ {userMemberVenueName} {term.ticket.cap} Management System
+ {if:checkPermission(#10#)}
+ For assistance with this system please call {owner.name} at {owner.phone}
+ {else:}
+
+ {end:}
+{else:}
+
+ Gaslight Media - Event Management and Ticketing System
+{end:}
+
+ We were unable to find your purchase information and are therefore
+ are unable to process your payment through PayPal. This could be
+ due to you not performing any action with your pending purchase
+ for too long. Please click the "Return to selected tickets" button
+ at the top of the checkout page to see if your selections are still listed.
+