Repository navigation
Expand file tree
/
Copy pathticketnetwork_event.class.php
More file actions
153 lines (130 loc) · 3.34 KB
/
Copy pathticketnetwork_event.class.php
File metadata and controls
153 lines (130 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
/**
* @file ticketnetwork_event.class.php
* @package TicketNetwork
*
* @license see LICENSE.txt
* @author jwwicks <jwwicks-at-gmail-dot-com>
*/
if(!class_exists('TicketNetworkBase')){
require_once('ticketnetwork.class.php');
}
/**
* @class TNEvent
* @brief TicketNetwork Events
*
* @since 0.0.1
*/
class TNEvent extends TicketNetworkBase{
public function __construct($options=false){
self::_defaults();
if($options){
self::config($options);
}
}
/**
* Values that can be set as params via send or get to TicketNetwork
*
* 'websiteConfigID' => WEB_CONF_ID, - Already set in base class
'numberOfEvents'=>null, - pagination
'eventID' => null,
'eventName' => 'wicked',
'eventDate' => null,
'beginDate'=>null,
'endDate' => null,
'venueID'=>null,
'venueName' => '',
'stateProvDesc' => '',
'stateID'=>null, 'cityZip' => '',
'nearZip' => '',
'parentCategoryID' => null,
'childCategoryID' => null,
'grandchildCategoryID' => null,
'performerID' => null,
'performerName' => '',
'noPerformers' => null,
'lowPrice' => null,
'highPrice' => null,
'modificationDate'=>null,
'onlyMine'=>null,
'whereClause'=>'',
'orderByClause'=>'' - defaults to Date
* @param string $params
* @return TNEvent
*/
public function get($params=false){
$this->_request['method'] = 'GetEvents';
if($params){
if(array_key_exists('method', $params)){
$this->_request['method'] = $params['method'];
unset($params['method']);
}else if(array_key_exists('eventID', $params)){
$this->_request['method'] = 'GetEvents';
}
$this->set($params);
}
return $this;
}
/**
*
* @param string $params
* @return TNEvent
*/
public function search($params=null){
$this->_request['method'] = 'SearchEvents';
if($params){
$this->set($params);
}
return $this;
}
/**
* Parse the results from TicketNetwork
* @return string|unknown
*/
public function parse(){
$this->_data = array();
try{
parent::parse();
if(!empty($this->_response)){
if($this->_request['method'] == 'GetEvents'){
if(is_array($this->_response->GetEventsResult->Event)){
foreach($this->_response->GetEventsResult->Event as $event){
$this->_data[] = $event;
}
}else if(is_object($this->_response->GetEventsResult->Event)){
$this->_data = $this->_response->GetEventsResult->Event;
}else{
$this->_data = null;
}
}else if($this->_request['method'] == 'SearchEvents'){
if(is_array($this->_response->SearchEventsResult->Event)){
foreach($this->_response->SearchEventsResult->Event as $event){
$this->_data[] = $event;
}
}else if(is_object($this->_response->SearchEventsResult->Event)){
$this->_data = $this->_response->SearchEventsResult->Event;
}else{
$this->_data = null;
}
}else{
if(!empty($this->_response->GetCountryByIDResult)){
$this->_data = $this->_response->GetCountryByIDResult;
}else{
$this->_data = null;
}
}
}
}catch(TNException $e){
$err = $this->debug($e->getMessage());
echo $err;
}
return $this;
}
protected function _defaults(){
parent::_defaults();
$this->_request = array(
'method' => 'GetEvents',
'parameters' => array('numberOfEvents'=>25, 'orderByClause'=>'Date ASC')
);
}
}