@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | * |
27 | 27 | * ------------------------------------------------------------------------ |
28 | 28 | */ |
29 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
29 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
30 | 30 | |
31 | 31 | class EEM_Extra_Meta extends EEM_Base { |
32 | 32 | |
33 | 33 | // private instance of the Attendee object |
34 | 34 | protected static $_instance = NULL; |
35 | 35 | |
36 | - protected function __construct( $timezone = NULL ) { |
|
37 | - $this->singular_item = __('Extra Meta','event_espresso'); |
|
38 | - $this->plural_item = __('Extra Metas','event_espresso'); |
|
36 | + protected function __construct($timezone = NULL) { |
|
37 | + $this->singular_item = __('Extra Meta', 'event_espresso'); |
|
38 | + $this->plural_item = __('Extra Metas', 'event_espresso'); |
|
39 | 39 | $this->_tables = array( |
40 | 40 | 'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID') |
41 | 41 | ); |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | |
51 | 51 | )); |
52 | 52 | $this->_model_relations = array(); |
53 | - foreach($models_this_can_attach_to as $model){ |
|
53 | + foreach ($models_this_can_attach_to as $model) { |
|
54 | 54 | $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
55 | 55 | } |
56 | - parent::__construct( $timezone ); |
|
56 | + parent::__construct($timezone); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,30 +1,30 @@ |
||
1 | 1 | <?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
2 | 2 | exit('NO direct script access allowed'); |
3 | 3 | /** |
4 | - * Event Espresso |
|
5 | - * |
|
6 | - * Event Registration and Management Plugin for Wordpress |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @author Seth Shoultes |
|
10 | - * @copyright (c)2009-2012 Event Espresso All Rights Reserved. |
|
11 | - * @license @link http://eventespresso.com/support/terms-conditions/ ** see Plugin Licensing * * |
|
12 | - * @link http://www.eventespresso.com |
|
13 | - * @version 4.1 |
|
14 | - * |
|
15 | - * ------------------------------------------------------------------------ |
|
16 | - * |
|
17 | - * EEM_Message_Template |
|
18 | - * |
|
19 | - * |
|
20 | - * |
|
21 | - * @package Event Espresso |
|
22 | - * @subpackage includes/models/EEM_Message_Template.model.php |
|
23 | - * @author Darren Ethier |
|
24 | - * |
|
25 | - * |
|
26 | - * ------------------------------------------------------------------------ |
|
27 | - */ |
|
4 | + * Event Espresso |
|
5 | + * |
|
6 | + * Event Registration and Management Plugin for Wordpress |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @author Seth Shoultes |
|
10 | + * @copyright (c)2009-2012 Event Espresso All Rights Reserved. |
|
11 | + * @license @link http://eventespresso.com/support/terms-conditions/ ** see Plugin Licensing * * |
|
12 | + * @link http://www.eventespresso.com |
|
13 | + * @version 4.1 |
|
14 | + * |
|
15 | + * ------------------------------------------------------------------------ |
|
16 | + * |
|
17 | + * EEM_Message_Template |
|
18 | + * |
|
19 | + * |
|
20 | + * |
|
21 | + * @package Event Espresso |
|
22 | + * @subpackage includes/models/EEM_Message_Template.model.php |
|
23 | + * @author Darren Ethier |
|
24 | + * |
|
25 | + * |
|
26 | + * ------------------------------------------------------------------------ |
|
27 | + */ |
|
28 | 28 | class EEM_Message_Template extends EEM_Base { |
29 | 29 | //private instance of the EEM_Message_Template object |
30 | 30 | protected static $_instance = NULL; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
2 | 2 | exit('NO direct script access allowed'); |
3 | 3 | /** |
4 | 4 | * Event Espresso |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | * @access protected |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - protected function __construct( $timezone = NULL ) { |
|
40 | - $this->singular_item = __('Message Template','event_espresso'); |
|
41 | - $this->plural_item = __('Message Templates','event_espresso'); |
|
39 | + protected function __construct($timezone = NULL) { |
|
40 | + $this->singular_item = __('Message Template', 'event_espresso'); |
|
41 | + $this->plural_item = __('Message Templates', 'event_espresso'); |
|
42 | 42 | |
43 | 43 | $this->_tables = array( |
44 | - 'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID' ) |
|
44 | + 'Message_Template' => new EE_Primary_Table('esp_message_template', 'MTP_ID') |
|
45 | 45 | ); |
46 | 46 | $this->_fields = array( |
47 | 47 | 'Message_Template'=> array( |
48 | 48 | 'MTP_ID'=> new EE_Primary_Key_Int_Field('MTP_ID', __('Message Template ID', 'event_espresso')), |
49 | - 'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso'), FALSE, 0, 'Message_Template_Group' ), |
|
50 | - 'MTP_template_field'=>new EE_Plain_Text_Field('MTP_template_field', __('Field Name for this Template', 'event_espresso'), false, 'default' ), |
|
51 | - 'MTP_context'=>new EE_Plain_Text_Field('MTP_context', __('Message Type Context for this field', 'event_espresso'),false,'admin' ), |
|
49 | + 'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso'), FALSE, 0, 'Message_Template_Group'), |
|
50 | + 'MTP_template_field'=>new EE_Plain_Text_Field('MTP_template_field', __('Field Name for this Template', 'event_espresso'), false, 'default'), |
|
51 | + 'MTP_context'=>new EE_Plain_Text_Field('MTP_context', __('Message Type Context for this field', 'event_espresso'), false, 'admin'), |
|
52 | 52 | 'MTP_content'=>new EE_Serialized_Text_Field('MTP_content', __('The field content for the template', 'event_espresso'), false, ''), |
53 | 53 | ) |
54 | 54 | ); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | 'Message_Template_Group' => new EE_Belongs_To_Relation() |
58 | 58 | ); |
59 | 59 | $this->_model_chain_to_wp_user = 'Message_Template_Group'; |
60 | - foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ){ |
|
61 | - $this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global( 'Message_Template_Group.MTP_is_global'); |
|
60 | + foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) { |
|
61 | + $this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_Global('Message_Template_Group.MTP_is_global'); |
|
62 | 62 | } |
63 | 63 | $this->_caps_slug = 'messages'; |
64 | - parent::__construct( $timezone ); |
|
64 | + parent::__construct($timezone); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 |
@@ -1,5 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
2 | 2 | exit('NO direct script access allowed'); |
3 | +} |
|
3 | 4 | /** |
4 | 5 | * Event Espresso |
5 | 6 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
3 | 5 | /** |
4 | 6 | * |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | |
18 | 18 | |
19 | 19 | /** |
20 | - * Status id in esp_status table that represents an approved payment |
|
21 | - */ |
|
20 | + * Status id in esp_status table that represents an approved payment |
|
21 | + */ |
|
22 | 22 | const status_id_approved = 'PAP'; |
23 | 23 | |
24 | 24 | |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | |
112 | 112 | |
113 | 113 | /** |
114 | - * retrieve all payments from db for a particular transaction, optionally with |
|
114 | + * retrieve all payments from db for a particular transaction, optionally with |
|
115 | 115 | * a particular status |
116 | - * |
|
117 | - * @access public |
|
118 | - * @param $TXN_ID |
|
116 | + * |
|
117 | + * @access public |
|
118 | + * @param $TXN_ID |
|
119 | 119 | * @param string $status_of_payment one of EEM_Payment::status_id_*, like 'PAP','PCN',etc. If none is provided, gets payments with any status |
120 | - * @return EE_Payment[] |
|
121 | - */ |
|
120 | + * @return EE_Payment[] |
|
121 | + */ |
|
122 | 122 | public function get_payments_for_transaction( $TXN_ID = FALSE, $status_of_payment = null ) { |
123 | 123 | // all payments for a TXN ordered chronologically |
124 | 124 | $query_params = array( array( 'TXN_ID' => $TXN_ID ), 'order_by' => array( 'PAY_timestamp' => 'ASC' )); |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | |
146 | 146 | |
147 | 147 | /** |
148 | - * retrieve all payments from db between two dates |
|
149 | - * |
|
150 | - * @access public |
|
151 | - * @param string $start_date |
|
152 | - * @param string $end_date |
|
153 | - * @return EE_Payment[] |
|
154 | - */ |
|
148 | + * retrieve all payments from db between two dates |
|
149 | + * |
|
150 | + * @access public |
|
151 | + * @param string $start_date |
|
152 | + * @param string $end_date |
|
153 | + * @return EE_Payment[] |
|
154 | + */ |
|
155 | 155 | public function get_payments_made_between_dates( $start_date = '', $end_date = '' ) { |
156 | 156 | // initial values |
157 | 157 | $start_date = ! empty( $start_date ) ? $start_date : date('Y-m-d',current_time('timestamp')); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Payment Model |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author Michael Nelson, Brent Christensen |
10 | 10 | * |
11 | 11 | */ |
12 | -class EEM_Payment extends EEM_Base implements EEMI_Payment{ |
|
12 | +class EEM_Payment extends EEM_Base implements EEMI_Payment { |
|
13 | 13 | |
14 | 14 | // private instance of the Payment object |
15 | 15 | protected static $_instance = NULL; |
@@ -57,28 +57,28 @@ discard block |
||
57 | 57 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
58 | 58 | * @return EEM_Payment |
59 | 59 | */ |
60 | - protected function __construct( $timezone ) { |
|
60 | + protected function __construct($timezone) { |
|
61 | 61 | |
62 | - $this->singular_item = __('Payment','event_espresso'); |
|
63 | - $this->plural_item = __('Payments','event_espresso'); |
|
62 | + $this->singular_item = __('Payment', 'event_espresso'); |
|
63 | + $this->plural_item = __('Payments', 'event_espresso'); |
|
64 | 64 | |
65 | 65 | $this->_tables = array( |
66 | - 'Payment'=>new EE_Primary_Table('esp_payment','PAY_ID') |
|
66 | + 'Payment'=>new EE_Primary_Table('esp_payment', 'PAY_ID') |
|
67 | 67 | ); |
68 | 68 | $this->_fields = array( |
69 | 69 | 'Payment'=>array( |
70 | - 'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID','event_espresso')), |
|
71 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
72 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Payment::status_id_failed, 'Status'), |
|
73 | - 'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted','event_espresso'), false, current_time('timestamp'), $timezone ), |
|
74 | - 'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment','event_espresso'), false, 'CART'), |
|
75 | - 'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for','event_espresso'), false, 0), |
|
70 | + 'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso')), |
|
71 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
72 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Payment::status_id_failed, 'Status'), |
|
73 | + 'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted', 'event_espresso'), false, current_time('timestamp'), $timezone), |
|
74 | + 'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment', 'event_espresso'), false, 'CART'), |
|
75 | + 'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for', 'event_espresso'), false, 0), |
|
76 | 76 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Payment Method ID", 'event_espresso'), false, NULL, 'Payment_Method'), |
77 | - 'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment','event_espresso'), false, ''), |
|
78 | - 'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number','event_espresso'), true, ''), |
|
79 | - 'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number','event_espresso'), true, ''), |
|
80 | - 'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info','event_espresso'), true, ''), |
|
81 | - 'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment','event_espresso'), true, ''), |
|
77 | + 'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment', 'event_espresso'), false, ''), |
|
78 | + 'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number', 'event_espresso'), true, ''), |
|
79 | + 'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number', 'event_espresso'), true, ''), |
|
80 | + 'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info', 'event_espresso'), true, ''), |
|
81 | + 'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment', 'event_espresso'), true, ''), |
|
82 | 82 | 'PAY_redirect_url'=>new EE_Plain_Text_Field('PAY_redirect_url', __("Redirect URL", 'event_espresso'), true), |
83 | 83 | 'PAY_redirect_args'=>new EE_Serialized_Text_Field('PAY_redirect_args', __("Key-Value POST vars to send along with redirect", 'event_espresso'), true) |
84 | 84 | ) |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | 'Transaction'=> new EE_Belongs_To_Relation(), |
88 | 88 | 'Status'=> new EE_Belongs_To_Relation(), |
89 | 89 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
90 | - 'Registration' => new EE_HABTM_Relation( 'Registration_Payment' ), |
|
90 | + 'Registration' => new EE_HABTM_Relation('Registration_Payment'), |
|
91 | 91 | ); |
92 | 92 | $this->_model_chain_to_wp_user = 'Payment_Method'; |
93 | 93 | $this->_caps_slug = 'transactions'; |
94 | - parent::__construct( $timezone ); |
|
94 | + parent::__construct($timezone); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $PAY_txn_id_chq_nmbr |
104 | 104 | * @return EE_Payment |
105 | 105 | */ |
106 | - public function get_payment_by_txn_id_chq_nmbr( $PAY_txn_id_chq_nmbr ){ |
|
106 | + public function get_payment_by_txn_id_chq_nmbr($PAY_txn_id_chq_nmbr) { |
|
107 | 107 | return $this->get_one(array(array('PAY_txn_id_chq_nmbr'=>$PAY_txn_id_chq_nmbr))); |
108 | 108 | } |
109 | 109 | |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | * @param string $status_of_payment one of EEM_Payment::status_id_*, like 'PAP','PCN',etc. If none is provided, gets payments with any status |
120 | 120 | * @return EE_Payment[] |
121 | 121 | */ |
122 | - public function get_payments_for_transaction( $TXN_ID = FALSE, $status_of_payment = null ) { |
|
122 | + public function get_payments_for_transaction($TXN_ID = FALSE, $status_of_payment = null) { |
|
123 | 123 | // all payments for a TXN ordered chronologically |
124 | - $query_params = array( array( 'TXN_ID' => $TXN_ID ), 'order_by' => array( 'PAY_timestamp' => 'ASC' )); |
|
124 | + $query_params = array(array('TXN_ID' => $TXN_ID), 'order_by' => array('PAY_timestamp' => 'ASC')); |
|
125 | 125 | // if provided with a status, search specifically for that status. Otherwise get them all |
126 | - if ( $status_of_payment ){ |
|
126 | + if ($status_of_payment) { |
|
127 | 127 | $query_params[0]['STS_ID'] = $status_of_payment; |
128 | 128 | } |
129 | 129 | // retrieve payments |
130 | - return $this->get_all ( $query_params ); |
|
130 | + return $this->get_all($query_params); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | * @param int $TXN_ID |
138 | 138 | * @return EE_Payment[] |
139 | 139 | */ |
140 | - public function get_approved_payments_for_transaction( $TXN_ID = 0 ) { |
|
141 | - return $this->get_payments_for_transaction( $TXN_ID, EEM_Payment::status_id_approved ); |
|
140 | + public function get_approved_payments_for_transaction($TXN_ID = 0) { |
|
141 | + return $this->get_payments_for_transaction($TXN_ID, EEM_Payment::status_id_approved); |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | |
@@ -152,20 +152,20 @@ discard block |
||
152 | 152 | * @param string $end_date |
153 | 153 | * @return EE_Payment[] |
154 | 154 | */ |
155 | - public function get_payments_made_between_dates( $start_date = '', $end_date = '' ) { |
|
155 | + public function get_payments_made_between_dates($start_date = '', $end_date = '') { |
|
156 | 156 | // initial values |
157 | - $start_date = ! empty( $start_date ) ? $start_date : date('Y-m-d',current_time('timestamp')); |
|
158 | - $end_date = ! empty( $end_date ) ? $end_date : date('Y-m-d',current_time('timestamp')); |
|
157 | + $start_date = ! empty($start_date) ? $start_date : date('Y-m-d', current_time('timestamp')); |
|
158 | + $end_date = ! empty($end_date) ? $end_date : date('Y-m-d', current_time('timestamp')); |
|
159 | 159 | // make sure our timestamps start and end right at the boundaries for each day |
160 | - $start_date = date( 'Y-m-d', strtotime( $start_date )) . ' 00:00:00'; |
|
161 | - $end_date = date( 'Y-m-d', strtotime( $end_date )) . ' 23:59:59'; |
|
160 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
161 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
162 | 162 | // convert to timestamps |
163 | - $start_date = strtotime( $start_date ); |
|
164 | - $end_date = strtotime( $end_date ); |
|
163 | + $start_date = strtotime($start_date); |
|
164 | + $end_date = strtotime($end_date); |
|
165 | 165 | // make sure our start date is the lowest value and vice versa |
166 | - $start_date = min( $start_date, $end_date ); |
|
167 | - $end_date = max( $start_date, $end_date ); |
|
168 | - return $this->get_all(array(array('PAY_timestamp'=>array('>=',$start_date),'PAY_timestamp*'=>array('<=',$end_date)))); |
|
166 | + $start_date = min($start_date, $end_date); |
|
167 | + $end_date = max($start_date, $end_date); |
|
168 | + return $this->get_all(array(array('PAY_timestamp'=>array('>=', $start_date), 'PAY_timestamp*'=>array('<=', $end_date)))); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -175,35 +175,35 @@ discard block |
||
175 | 175 | * returns a string for the approved status |
176 | 176 | * @return string |
177 | 177 | */ |
178 | - function approved_status(){ |
|
178 | + function approved_status() { |
|
179 | 179 | return self::status_id_approved; |
180 | 180 | } |
181 | 181 | /** |
182 | 182 | * returns a string for the pending status |
183 | 183 | * @return string |
184 | 184 | */ |
185 | - function pending_status(){ |
|
185 | + function pending_status() { |
|
186 | 186 | return self::status_id_pending; |
187 | 187 | } |
188 | 188 | /** |
189 | 189 | * returns a string for the cancelled status |
190 | 190 | * @return string |
191 | 191 | */ |
192 | - function cancelled_status(){ |
|
192 | + function cancelled_status() { |
|
193 | 193 | return self::status_id_cancelled; |
194 | 194 | } |
195 | 195 | /** |
196 | 196 | * returns a string for the failed status |
197 | 197 | * @return string |
198 | 198 | */ |
199 | - function failed_status(){ |
|
199 | + function failed_status() { |
|
200 | 200 | return self::status_id_failed; |
201 | 201 | } |
202 | 202 | /** |
203 | 203 | * returns a string for the declined status |
204 | 204 | * @return string |
205 | 205 | */ |
206 | - function declined_status(){ |
|
206 | + function declined_status() { |
|
207 | 207 | return self::status_id_declined; |
208 | 208 | } |
209 | 209 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once( EE_CLASSES . 'EE_Question.class.php'); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Question extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | // private instance of the Attendee object |
70 | 70 | protected static $_instance = NULL; |
71 | 71 | |
72 | - protected function __construct( $timezone = NULL ) { |
|
73 | - $this->singular_item = __('Question','event_espresso'); |
|
74 | - $this->plural_item = __('Questions','event_espresso'); |
|
75 | - $this->_allowed_question_types=apply_filters( |
|
72 | + protected function __construct($timezone = NULL) { |
|
73 | + $this->singular_item = __('Question', 'event_espresso'); |
|
74 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
75 | + $this->_allowed_question_types = apply_filters( |
|
76 | 76 | 'FHEE__EEM_Question__construct__allowed_question_types', |
77 | 77 | array( |
78 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
79 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
80 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
81 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
82 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
83 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
84 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
85 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
86 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
78 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
79 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
80 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
81 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
82 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
83 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
84 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
85 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
86 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | $this->_question_type_categories = apply_filters( |
@@ -102,21 +102,21 @@ discard block |
||
102 | 102 | ); |
103 | 103 | |
104 | 104 | $this->_tables = array( |
105 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
105 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
106 | 106 | ); |
107 | 107 | $this->_fields = array( |
108 | 108 | 'Question'=>array( |
109 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
110 | - 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
111 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
112 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ), |
|
113 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
114 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
115 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
116 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
117 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
118 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
119 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
109 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
110 | + 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
111 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
112 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL), |
|
113 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
114 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
115 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
116 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
117 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
118 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
119 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
120 | 120 | ) |
121 | 121 | ); |
122 | 122 | $this->_model_relations = array( |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
129 | 129 | ); |
130 | 130 | //this model is generally available for reading |
131 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
132 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
133 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
134 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
135 | - parent::__construct( $timezone ); |
|
131 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
132 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
133 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
134 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
135 | + parent::__construct($timezone); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * but they can be extended |
141 | 141 | * @return string[] |
142 | 142 | */ |
143 | - public function allowed_question_types(){ |
|
143 | + public function allowed_question_types() { |
|
144 | 144 | return $this->_allowed_question_types; |
145 | 145 | } |
146 | 146 | /** |
@@ -148,16 +148,16 @@ discard block |
||
148 | 148 | * @param string $question_type one of EEM_Question::allowed_question_types( |
149 | 149 | * @return string[] like EEM_Question::allowed_question_types() |
150 | 150 | */ |
151 | - public function question_types_in_same_category( $question_type ) { |
|
152 | - $question_types = array( $question_type ); |
|
153 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
154 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
151 | + public function question_types_in_same_category($question_type) { |
|
152 | + $question_types = array($question_type); |
|
153 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
154 | + if (in_array($question_type, $question_types_in_category)) { |
|
155 | 155 | $question_types = $question_types_in_category; |
156 | 156 | break; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
160 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city'); |
168 | 168 | * @return int of QST_ID for the question that corresponds to that QST_system |
169 | 169 | */ |
170 | - public function get_Question_ID_from_system_string($QST_system){ |
|
170 | + public function get_Question_ID_from_system_string($QST_system) { |
|
171 | 171 | $conversion_array = array( |
172 | 172 | 'fname'=> EEM_Attendee::fname_question_id, |
173 | 173 | 'lname'=> EEM_Attendee::lname_question_id, |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | 'phone'=> EEM_Attendee::phone_question_id |
182 | 182 | ); |
183 | 183 | |
184 | - return isset( $conversion_array[ $QST_system ] ) ? $conversion_array[ $QST_system ] : NULL; |
|
184 | + return isset($conversion_array[$QST_system]) ? $conversion_array[$QST_system] : NULL; |
|
185 | 185 | |
186 | 186 | } |
187 | 187 | |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function get_latest_question_order() { |
195 | 195 | $columns_to_select = array( |
196 | - 'max_order' => array("MAX(QST_order)","%d") |
|
196 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
197 | 197 | ); |
198 | - $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select ); |
|
198 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
199 | 199 | return $max[0]['max_order']; |
200 | 200 | } |
201 | 201 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once( EE_CLASSES . 'EE_Question_Group.class.php'); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once(EE_CLASSES.'EE_Question_Group.class.php'); |
|
26 | 26 | class EEM_Question_Group extends EEM_Soft_Delete_Base { |
27 | 27 | const system_personal = 1; |
28 | 28 | const system_address = 2; |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | protected static $_instance = NULL; |
31 | 31 | |
32 | 32 | |
33 | - protected function __construct( $timezone = NULL ) { |
|
34 | - $this->singular_item = __('Question Group','event_espresso'); |
|
35 | - $this->plural_item = __('Question Groups','event_espresso'); |
|
33 | + protected function __construct($timezone = NULL) { |
|
34 | + $this->singular_item = __('Question Group', 'event_espresso'); |
|
35 | + $this->plural_item = __('Question Groups', 'event_espresso'); |
|
36 | 36 | |
37 | 37 | $this->_tables = array( |
38 | - 'Question_Group'=>new EE_Primary_Table('esp_question_group','QSG_ID') |
|
38 | + 'Question_Group'=>new EE_Primary_Table('esp_question_group', 'QSG_ID') |
|
39 | 39 | ); |
40 | 40 | $this->_fields = array( |
41 | 41 | 'Question_Group'=>array( |
42 | - 'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID','event_espresso')), |
|
43 | - 'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name','event_espresso'), false, ''), |
|
44 | - 'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group','event_espresso'), false, ''), |
|
45 | - 'QSG_desc'=>new EE_Full_HTML_Field('QSG_desc', __('Description of Question Group','event_espresso'), true, ''), |
|
46 | - 'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group','event_espresso'), true, 0), |
|
47 | - 'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page','event_espresso'), false, true), |
|
48 | - 'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page','event_espresso'), false, false), |
|
49 | - 'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE ), |
|
50 | - 'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.','event_espresso'), false, 0), |
|
51 | - 'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted','event_espresso'), false, false) |
|
42 | + 'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso')), |
|
43 | + 'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name', 'event_espresso'), false, ''), |
|
44 | + 'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group', 'event_espresso'), false, ''), |
|
45 | + 'QSG_desc'=>new EE_Full_HTML_Field('QSG_desc', __('Description of Question Group', 'event_espresso'), true, ''), |
|
46 | + 'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group', 'event_espresso'), true, 0), |
|
47 | + 'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page', 'event_espresso'), false, true), |
|
48 | + 'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page', 'event_espresso'), false, false), |
|
49 | + 'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE), |
|
50 | + 'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.', 'event_espresso'), false, 0), |
|
51 | + 'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted', 'event_espresso'), false, false) |
|
52 | 52 | ) |
53 | 53 | ); |
54 | 54 | $this->_model_relations = array( |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | 'WP_User' => new EE_Belongs_To_Relation(), |
59 | 59 | ); |
60 | 60 | //this model is generally available for reading |
61 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
62 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
63 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
64 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
65 | - parent::__construct( $timezone ); |
|
61 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
62 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
63 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
64 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
65 | + parent::__construct($timezone); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function get_latest_question_group_order() { |
77 | 77 | $columns_to_select = array( |
78 | - 'max_order' => array("MAX(QSG_order)","%d") |
|
78 | + 'max_order' => array("MAX(QSG_order)", "%d") |
|
79 | 79 | ); |
80 | - $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select ); |
|
80 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
81 | 81 | return $max[0]['max_order']; |
82 | 82 | } |
83 | 83 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -26,26 +26,26 @@ discard block |
||
26 | 26 | * |
27 | 27 | * ------------------------------------------------------------------------ |
28 | 28 | */ |
29 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
30 | -require_once( EE_CLASSES . 'EE_Question_Group_Question.class.php'); |
|
29 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
30 | +require_once(EE_CLASSES.'EE_Question_Group_Question.class.php'); |
|
31 | 31 | class EEM_Question_Group_Question extends EEM_Base { |
32 | 32 | |
33 | 33 | // private instance of the Attendee object |
34 | 34 | protected static $_instance = NULL; |
35 | 35 | |
36 | 36 | |
37 | - protected function __construct( $timezone = NULL ) { |
|
38 | - $this->singular_item = __('Question Group to Question Link','event_espresso'); |
|
39 | - $this->plural_item = __('Question Group to Question Links','event_espresso'); |
|
37 | + protected function __construct($timezone = NULL) { |
|
38 | + $this->singular_item = __('Question Group to Question Link', 'event_espresso'); |
|
39 | + $this->plural_item = __('Question Group to Question Links', 'event_espresso'); |
|
40 | 40 | $this->_tables = array( |
41 | - 'Question_Group_Question'=>new EE_Primary_Table('esp_question_group_question','QGQ_ID') |
|
41 | + 'Question_Group_Question'=>new EE_Primary_Table('esp_question_group_question', 'QGQ_ID') |
|
42 | 42 | ); |
43 | 43 | $this->_fields = array( |
44 | 44 | 'Question_Group_Question'=>array( |
45 | - 'QGQ_ID'=>new EE_Primary_Key_Int_Field('QGQ_ID', __('Question Group to Question Link ID','event_espresso')), |
|
46 | - 'QSG_ID'=>new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group ID','event_espresso'), false, 0, 'Question_Group'), |
|
47 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question Id','event_espresso'), false, 0, 'Question'), |
|
48 | - 'QGQ_order' => new EE_Integer_Field('QGQ_order', __('Question Group Question Order', 'event_espresso'), false, 0 ) |
|
45 | + 'QGQ_ID'=>new EE_Primary_Key_Int_Field('QGQ_ID', __('Question Group to Question Link ID', 'event_espresso')), |
|
46 | + 'QSG_ID'=>new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso'), false, 0, 'Question_Group'), |
|
47 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question Id', 'event_espresso'), false, 0, 'Question'), |
|
48 | + 'QGQ_order' => new EE_Integer_Field('QGQ_order', __('Question Group Question Order', 'event_espresso'), false, 0) |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | $this->_model_relations = array( |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | |
56 | 56 | $this->_model_chain_to_wp_user = 'Question_Group'; |
57 | 57 | //this model is generally available for reading |
58 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
59 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system'); |
|
60 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system'); |
|
61 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system'); |
|
58 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
59 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system'); |
|
60 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system'); |
|
61 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Group.QSG_system'); |
|
62 | 62 | //use the caps for question groups |
63 | 63 | $this->_caps_slug = 'question_groups'; |
64 | - parent::__construct( $timezone ); |
|
64 | + parent::__construct($timezone); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once( EE_CLASSES . 'EE_Question_Option.class.php'); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once(EE_CLASSES.'EE_Question_Option.class.php'); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | class EEM_Question_Option extends EEM_Soft_Delete_Base { |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | // private instance of the Attendee object |
31 | 31 | protected static $_instance = NULL; |
32 | 32 | |
33 | - protected function __construct( $timezone = NULL ) { |
|
34 | - $this->singular_item = __('Question Option','event_espresso'); |
|
35 | - $this->plural_item = __('Question Options','event_espresso'); |
|
33 | + protected function __construct($timezone = NULL) { |
|
34 | + $this->singular_item = __('Question Option', 'event_espresso'); |
|
35 | + $this->plural_item = __('Question Options', 'event_espresso'); |
|
36 | 36 | |
37 | 37 | $this->_tables = array( |
38 | - 'Question_Option'=>new EE_Primary_Table('esp_question_option','QSO_ID') |
|
38 | + 'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID') |
|
39 | 39 | ); |
40 | 40 | $this->_fields = array( |
41 | 41 | 'Question_Option'=>array( |
42 | - 'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID','event_espresso')), |
|
43 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
44 | - 'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"),false,''), |
|
45 | - 'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description','event_espresso'), false, ''), |
|
46 | - 'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso' ), false, 0 ), |
|
47 | - 'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false) |
|
42 | + 'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')), |
|
43 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
44 | + 'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''), |
|
45 | + 'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''), |
|
46 | + 'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0), |
|
47 | + 'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false) |
|
48 | 48 | ) |
49 | 49 | ); |
50 | 50 | $this->_model_relations = array( |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | |
54 | 54 | $this->_model_chain_to_wp_user = 'Question'; |
55 | 55 | //this model is generally available for reading |
56 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
57 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
58 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
59 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
56 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
57 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
58 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
59 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
60 | 60 | $this->_caps_slug = 'questions'; |
61 | - parent::__construct( $timezone ); |
|
61 | + parent::__construct($timezone); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
3 | 5 | require_once ( EE_CLASSES . 'EE_Registration.class.php' ); |
4 | 6 | /** |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
3 | -require_once ( EE_CLASSES . 'EE_Registration.class.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
3 | +require_once (EE_CLASSES.'EE_Registration.class.php'); |
|
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * Registration Model |
@@ -92,31 +92,31 @@ discard block |
||
92 | 92 | * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
93 | 93 | * @return \EEM_Registration |
94 | 94 | */ |
95 | - protected function __construct( $timezone ) { |
|
96 | - $this->singular_item = __('Registration','event_espresso'); |
|
97 | - $this->plural_item = __('Registrations','event_espresso'); |
|
95 | + protected function __construct($timezone) { |
|
96 | + $this->singular_item = __('Registration', 'event_espresso'); |
|
97 | + $this->plural_item = __('Registrations', 'event_espresso'); |
|
98 | 98 | |
99 | 99 | $this->_tables = array( |
100 | - 'Registration'=>new EE_Primary_Table('esp_registration','REG_ID') |
|
100 | + 'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID') |
|
101 | 101 | ); |
102 | 102 | $this->_fields = array( |
103 | 103 | 'Registration'=>array( |
104 | - 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')), |
|
105 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID','event_espresso'), false, 0, 'Event'), |
|
106 | - 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'), |
|
107 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
108 | - 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'), |
|
109 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | - 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, current_time('timestamp'), $timezone ), |
|
111 | - 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Final Price of registration after all ticket/price modifications','event_espresso'), false, 0), |
|
112 | - 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0), |
|
113 | - 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''), |
|
114 | - 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''), |
|
115 | - 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''), |
|
116 | - 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1), |
|
117 | - 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1), |
|
118 | - 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false), |
|
119 | - 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false ) |
|
104 | + 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')), |
|
105 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID', 'event_espresso'), false, 0, 'Event'), |
|
106 | + 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'), |
|
107 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
108 | + 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'), |
|
109 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | + 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, current_time('timestamp'), $timezone), |
|
111 | + 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Final Price of registration after all ticket/price modifications', 'event_espresso'), false, 0), |
|
112 | + 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0), |
|
113 | + 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''), |
|
114 | + 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''), |
|
115 | + 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''), |
|
116 | + 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1), |
|
117 | + 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1), |
|
118 | + 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false), |
|
119 | + 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false) |
|
120 | 120 | ) |
121 | 121 | ); |
122 | 122 | $this->_model_relations = array( |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | 'Status'=>new EE_Belongs_To_Relation(), |
128 | 128 | 'Answer'=>new EE_Has_Many_Relation(), |
129 | 129 | 'Checkin'=>new EE_Has_Many_Relation(), |
130 | - 'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ), |
|
130 | + 'Payment'=>new EE_HABTM_Relation('Registration_Payment'), |
|
131 | 131 | ); |
132 | 132 | $this->_model_chain_to_wp_user = 'Event'; |
133 | 133 | |
134 | - parent::__construct( $timezone ); |
|
134 | + parent::__construct($timezone); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @param bool $translated If true will return the values as singular localized strings |
165 | 165 | * @return array |
166 | 166 | */ |
167 | - public static function reg_status_array( $exclude = array(), $translated = FALSE ) { |
|
168 | - EEM_Registration::instance()->_get_registration_status_array( $exclude ); |
|
169 | - return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
167 | + public static function reg_status_array($exclude = array(), $translated = FALSE) { |
|
168 | + EEM_Registration::instance()->_get_registration_status_array($exclude); |
|
169 | + return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -177,19 +177,19 @@ discard block |
||
177 | 177 | * @param array $exclude |
178 | 178 | * @return array |
179 | 179 | */ |
180 | - private function _get_registration_status_array( $exclude = array() ) { |
|
180 | + private function _get_registration_status_array($exclude = array()) { |
|
181 | 181 | //in the very rare circumstance that we are deleting a model's table's data |
182 | 182 | //and the table hasn't actually been created, this could have an error |
183 | 183 | /** @type WPDB $wpdb */ |
184 | 184 | global $wpdb; |
185 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
186 | - if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){ |
|
187 | - $SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"'; |
|
188 | - $results = $wpdb->get_results( $SQL ); |
|
185 | + EE_Registry::instance()->load_helper('Activation'); |
|
186 | + if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) { |
|
187 | + $SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"'; |
|
188 | + $results = $wpdb->get_results($SQL); |
|
189 | 189 | self::$_reg_status = array(); |
190 | - foreach ( $results as $status ) { |
|
191 | - if ( ! in_array( $status->STS_ID, $exclude )) { |
|
192 | - self::$_reg_status[ $status->STS_ID ] = $status->STS_code; |
|
190 | + foreach ($results as $status) { |
|
191 | + if ( ! in_array($status->STS_ID, $exclude)) { |
|
192 | + self::$_reg_status[$status->STS_ID] = $status->STS_code; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | } |
@@ -204,15 +204,15 @@ discard block |
||
204 | 204 | * @param array $where_params Array of query_params as described in the comments for EEM_Base::get_all() |
205 | 205 | * @return wpdb results array |
206 | 206 | */ |
207 | - public function get_reg_months_and_years( $where_params ) { |
|
207 | + public function get_reg_months_and_years($where_params) { |
|
208 | 208 | $query_params[0] = $where_params; |
209 | 209 | $query_params['group_by'] = array('reg_year', 'reg_month'); |
210 | - $query_params['order_by'] = array( 'REG_date' => 'DESC' ); |
|
210 | + $query_params['order_by'] = array('REG_date' => 'DESC'); |
|
211 | 211 | $columns_to_select = array( |
212 | 212 | 'reg_year' => array('YEAR(REG_date)', '%s'), |
213 | 213 | 'reg_month' => array('MONTHNAME(REG_date)', '%s') |
214 | 214 | ); |
215 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
215 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | * @param int $ATT_ID |
225 | 225 | * @return EE_Registration[] |
226 | 226 | */ |
227 | - public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
|
228 | - if ( ! $ATT_ID ) { |
|
227 | + public function get_all_registrations_for_attendee($ATT_ID = 0) { |
|
228 | + if ( ! $ATT_ID) { |
|
229 | 229 | return FALSE; |
230 | 230 | } |
231 | - return $this->get_all( array( array( 'ATT_ID' => $ATT_ID ))); |
|
231 | + return $this->get_all(array(array('ATT_ID' => $ATT_ID))); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * @param string $REG_url_link |
240 | 240 | * @return EE_Registration |
241 | 241 | */ |
242 | - public function get_registration_for_reg_url_link($REG_url_link){ |
|
243 | - if(!$REG_url_link){ |
|
242 | + public function get_registration_for_reg_url_link($REG_url_link) { |
|
243 | + if ( ! $REG_url_link) { |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | return $this->get_one(array(array('REG_url_link'=>$REG_url_link))); |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
259 | 259 | * @return mixed array on success, FALSE on fail |
260 | 260 | */ |
261 | - public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
|
261 | + public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) { |
|
262 | 262 | return $this->get_one(array( |
263 | 263 | array( |
264 | 264 | 'TXN_ID'=>$TXN_ID, |
265 | 265 | 'ATT_ID'=>$ATT_ID |
266 | 266 | ), |
267 | - 'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 ) |
|
267 | + 'limit'=>array(min(($att_nmbr - 1), 0), 1) |
|
268 | 268 | )); |
269 | 269 | } |
270 | 270 | |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
277 | 277 | * @return stdClass[] with properties regDate and total |
278 | 278 | */ |
279 | - public function get_registrations_per_day_report( $period = '-1 month' ) { |
|
279 | + public function get_registrations_per_day_report($period = '-1 month') { |
|
280 | 280 | $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
281 | 281 | |
282 | 282 | //don't include incomplete regs by default |
283 | - $where = array('REG_date'=>array('>=',$sql_date), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
283 | + $where = array('REG_date'=>array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
284 | 284 | |
285 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) { |
|
285 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) { |
|
286 | 286 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
287 | 287 | } |
288 | 288 | |
@@ -294,8 +294,8 @@ discard block |
||
294 | 294 | ), |
295 | 295 | OBJECT, |
296 | 296 | array( |
297 | - 'regDate'=>array('DATE(Registration.REG_date)','%s'), |
|
298 | - 'total'=>array('count(REG_ID)','%d') |
|
297 | + 'regDate'=>array('DATE(Registration.REG_date)', '%s'), |
|
298 | + 'total'=>array('count(REG_ID)', '%d') |
|
299 | 299 | )); |
300 | 300 | return $results; |
301 | 301 | } |
@@ -310,24 +310,24 @@ discard block |
||
310 | 310 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
311 | 311 | * @return stdClass[] each with properties event_name, reg_limit, and total |
312 | 312 | */ |
313 | - public function get_registrations_per_event_report( $period = '-1 month' ) { |
|
313 | + public function get_registrations_per_event_report($period = '-1 month') { |
|
314 | 314 | $date_sql = date("Y-m-d H:i:s", strtotime($period)); |
315 | 315 | |
316 | 316 | //do not include incomplete registrations by default |
317 | 317 | |
318 | - $where = array( 'REG_date'=>array('>=',$date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
319 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
318 | + $where = array('REG_date'=>array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
319 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
320 | 320 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
321 | 321 | } |
322 | 322 | $results = $this->_get_all_wpdb_results(array( |
323 | 323 | $where, |
324 | 324 | 'group_by'=>'Event.EVT_name', |
325 | 325 | 'order_by'=>'Event.EVT_name', |
326 | - 'limit'=>array(0,24)), |
|
326 | + 'limit'=>array(0, 24)), |
|
327 | 327 | OBJECT, |
328 | 328 | array( |
329 | - 'event_name'=>array('Event_CPT.post_title','%s'), |
|
330 | - 'total'=>array('COUNT(REG_ID)','%s') |
|
329 | + 'event_name'=>array('Event_CPT.post_title', '%s'), |
|
330 | + 'total'=>array('COUNT(REG_ID)', '%s') |
|
331 | 331 | ) |
332 | 332 | ); |
333 | 333 | |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | * @param int $TXN_ID |
342 | 342 | * @return EE_Registration |
343 | 343 | */ |
344 | - public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){ |
|
345 | - if( ! $TXN_ID ){ |
|
344 | + public function get_primary_registration_for_transaction_ID($TXN_ID = 0) { |
|
345 | + if ( ! $TXN_ID) { |
|
346 | 346 | return false; |
347 | 347 | } |
348 | - return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
348 | + return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | * @param boolean $for_incomplete_payments |
358 | 358 | * @return int |
359 | 359 | */ |
360 | - public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) { |
|
360 | + public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) { |
|
361 | 361 | // we only count approved registrations towards registration limits |
362 | - $query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) ); |
|
363 | - if( $for_incomplete_payments ){ |
|
364 | - $query_params[0]['Transaction.STS_ID']=array('!=', EEM_Transaction::complete_status_code); |
|
362 | + $query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved)); |
|
363 | + if ($for_incomplete_payments) { |
|
364 | + $query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | return $this->count($query_params); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | /** @type WPDB $wpdb */ |
378 | 378 | global $wpdb; |
379 | 379 | return $wpdb->query( |
380 | - 'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
380 | + 'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | /** |
203 | 203 | * This returns a wpdb->results array of all registration date month and years matching the incoming query params and grouped by month and year. |
204 | 204 | * @param array $where_params Array of query_params as described in the comments for EEM_Base::get_all() |
205 | - * @return wpdb results array |
|
205 | + * @return stdClass[] results array |
|
206 | 206 | */ |
207 | 207 | public function get_reg_months_and_years( $where_params ) { |
208 | 208 | $query_params[0] = $where_params; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param int $TXN_ID |
257 | 257 | * @param int $ATT_ID |
258 | 258 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
259 | - * @return mixed array on success, FALSE on fail |
|
259 | + * @return EE_Soft_Delete_Base_Class|null array on success, FALSE on fail |
|
260 | 260 | */ |
261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
262 | 262 | return $this->get_one(array( |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
222 | - * retrieve ALL registrations for a particular Attendee from db |
|
223 | - * @access public |
|
224 | - * @param int $ATT_ID |
|
225 | - * @return EE_Registration[] |
|
226 | - */ |
|
222 | + * retrieve ALL registrations for a particular Attendee from db |
|
223 | + * @access public |
|
224 | + * @param int $ATT_ID |
|
225 | + * @return EE_Registration[] |
|
226 | + */ |
|
227 | 227 | public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
228 | 228 | if ( ! $ATT_ID ) { |
229 | 229 | return FALSE; |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | |
251 | 251 | |
252 | 252 | /** |
253 | - * retrieve registration for a specific transaction attendee from db |
|
254 | - * |
|
255 | - * @access public |
|
256 | - * @param int $TXN_ID |
|
257 | - * @param int $ATT_ID |
|
258 | - * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | - * @return mixed array on success, FALSE on fail |
|
260 | - */ |
|
253 | + * retrieve registration for a specific transaction attendee from db |
|
254 | + * |
|
255 | + * @access public |
|
256 | + * @param int $TXN_ID |
|
257 | + * @param int $ATT_ID |
|
258 | + * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | + * @return mixed array on success, FALSE on fail |
|
260 | + */ |
|
261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
262 | 262 | return $this->get_one(array( |
263 | 263 | array( |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | |
271 | 271 | |
272 | 272 | /** |
273 | - * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
273 | + * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
274 | 274 | * (doesn't utilize models because it's a fairly specialized query) |
275 | - * @access public |
|
275 | + * @access public |
|
276 | 276 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
277 | 277 | * @return stdClass[] with properties regDate and total |
278 | - */ |
|
278 | + */ |
|
279 | 279 | public function get_registrations_per_day_report( $period = '-1 month' ) { |
280 | 280 | $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
281 | 281 | |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
308 | - * get the number of registrations per event for the Registration Admin page Reports Tab |
|
309 | - * @access public |
|
308 | + * get the number of registrations per event for the Registration Admin page Reports Tab |
|
309 | + * @access public |
|
310 | 310 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
311 | 311 | * @return stdClass[] each with properties event_name, reg_limit, and total |
312 | - */ |
|
312 | + */ |
|
313 | 313 | public function get_registrations_per_event_report( $period = '-1 month' ) { |
314 | 314 | $date_sql = date("Y-m-d H:i:s", strtotime($period)); |
315 | 315 |
@@ -15,21 +15,21 @@ discard block |
||
15 | 15 | protected static $_instance = NULL; |
16 | 16 | |
17 | 17 | |
18 | - protected function __construct( $timezone = NULL ) { |
|
18 | + protected function __construct($timezone = NULL) { |
|
19 | 19 | |
20 | - $this->singular_item = __( 'Registration Payment', 'event_espresso' ); |
|
21 | - $this->plural_item = __( 'Registration Payments', 'event_espresso' ); |
|
20 | + $this->singular_item = __('Registration Payment', 'event_espresso'); |
|
21 | + $this->plural_item = __('Registration Payments', 'event_espresso'); |
|
22 | 22 | |
23 | 23 | $this->_tables = array( |
24 | - 'Registration_Payment' => new EE_Primary_Table( 'esp_registration_payment', 'RPY_ID' ) |
|
24 | + 'Registration_Payment' => new EE_Primary_Table('esp_registration_payment', 'RPY_ID') |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | $this->_fields = array( |
28 | 28 | 'Registration_Payment'=>array( |
29 | - 'RPY_ID' => new EE_Primary_Key_Int_Field( 'RPY_ID', __( 'Registration Payment ID', 'event_espresso' )), |
|
30 | - 'REG_ID' => new EE_Foreign_Key_Int_Field( 'REG_ID', __( 'Registration ID', 'event_espresso' ), false, 0, 'Registration' ), |
|
31 | - 'PAY_ID' => new EE_Foreign_Key_Int_Field( 'PAY_ID', __( 'Payment ID', 'event_espresso' ), true, null, 'Payment' ), |
|
32 | - 'RPY_amount' => new EE_Money_Field( 'RPY_amount', __( 'Amount attributed to the registration', 'event_espresso' ), false, 0 ), |
|
29 | + 'RPY_ID' => new EE_Primary_Key_Int_Field('RPY_ID', __('Registration Payment ID', 'event_espresso')), |
|
30 | + 'REG_ID' => new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
31 | + 'PAY_ID' => new EE_Foreign_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso'), true, null, 'Payment'), |
|
32 | + 'RPY_amount' => new EE_Money_Field('RPY_amount', __('Amount attributed to the registration', 'event_espresso'), false, 0), |
|
33 | 33 | ) |
34 | 34 | ); |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'Payment' => new EE_Belongs_To_Relation(), |
39 | 39 | ); |
40 | 40 | |
41 | - parent::__construct( $timezone ); |
|
41 | + parent::__construct($timezone); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * EEM_Registration_Payment |
4 | 6 | * |