Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
29 | * @copyright CiviCRM LLC (c) 2004-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Contribute/Premium.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:c84ce7b79339fc7842fe872fe75eccc1) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_premiums'; | |
44 | /** | |
45 | * static instance to hold the field values | |
46 | * | |
47 | * @var array | |
48 | */ | |
49 | static $_fields = null; | |
50 | /** | |
51 | * static instance to hold the keys used in $_fields for each field. | |
52 | * | |
53 | * @var array | |
54 | */ | |
55 | static $_fieldKeys = null; | |
56 | /** | |
57 | * static instance to hold the FK relationships | |
58 | * | |
59 | * @var string | |
60 | */ | |
61 | static $_links = null; | |
62 | /** | |
63 | * static instance to hold the values that can | |
64 | * be imported | |
65 | * | |
66 | * @var array | |
67 | */ | |
68 | static $_import = null; | |
69 | /** | |
70 | * static instance to hold the values that can | |
71 | * be exported | |
72 | * | |
73 | * @var array | |
74 | */ | |
75 | static $_export = null; | |
76 | /** | |
77 | * static value to see if we should log any modifications to | |
78 | * this table in the civicrm_log table | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | static $_log = true; | |
83 | /** | |
84 | * | |
85 | * @var int unsigned | |
86 | */ | |
87 | public $id; | |
88 | /** | |
89 | * Joins these premium settings to another object. Always civicrm_contribution_page for now. | |
90 | * | |
91 | * @var string | |
92 | */ | |
93 | public $entity_table; | |
94 | /** | |
95 | * | |
96 | * @var int unsigned | |
97 | */ | |
98 | public $entity_id; | |
99 | /** | |
100 | * Is the Premiums feature enabled for this page? | |
101 | * | |
102 | * @var boolean | |
103 | */ | |
104 | public $premiums_active; | |
105 | /** | |
106 | * Title for Premiums section. | |
107 | * | |
108 | * @var string | |
109 | */ | |
110 | public $premiums_intro_title; | |
111 | /** | |
112 | * Displayed in <div> at top of Premiums section of page. Text and HTML allowed. | |
113 | * | |
114 | * @var text | |
115 | */ | |
116 | public $premiums_intro_text; | |
117 | /** | |
118 | * This email address is included in receipts if it is populated and a premium has been selected. | |
119 | * | |
120 | * @var string | |
121 | */ | |
122 | public $premiums_contact_email; | |
123 | /** | |
124 | * This phone number is included in receipts if it is populated and a premium has been selected. | |
125 | * | |
126 | * @var string | |
127 | */ | |
128 | public $premiums_contact_phone; | |
129 | /** | |
130 | * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions. | |
131 | * | |
132 | * @var boolean | |
133 | */ | |
134 | public $premiums_display_min_contribution; | |
135 | /** | |
136 | * Label displayed for No Thank-you option in premiums block (e.g. No thank you) | |
137 | * | |
138 | * @var string | |
139 | */ | |
140 | public $premiums_nothankyou_label; | |
141 | /** | |
142 | * | |
143 | * @var int unsigned | |
144 | */ | |
145 | public $premiums_nothankyou_position; | |
146 | /** | |
147 | * class constructor | |
148 | * | |
149 | * @return civicrm_premiums | |
150 | */ | |
151 | function __construct() { | |
152 | $this->__table = 'civicrm_premiums'; | |
153 | parent::__construct(); | |
154 | } | |
155 | /** | |
156 | * Returns foreign keys and entity references | |
157 | * | |
158 | * @return array | |
159 | * [CRM_Core_Reference_Interface] | |
160 | */ | |
161 | static function getReferenceColumns() { | |
162 | if (!self::$_links) { | |
163 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
164 | self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); | |
165 | } | |
166 | return self::$_links; | |
167 | } | |
168 | /** | |
169 | * Returns all the column names of this table | |
170 | * | |
171 | * @return array | |
172 | */ | |
173 | static function &fields() { | |
174 | if (!(self::$_fields)) { | |
175 | self::$_fields = array( | |
176 | 'id' => array( | |
177 | 'name' => 'id', | |
178 | 'type' => CRM_Utils_Type::T_INT, | |
179 | 'title' => ts('Premium ID') , | |
180 | 'required' => true, | |
181 | ) , | |
182 | 'entity_table' => array( | |
183 | 'name' => 'entity_table', | |
184 | 'type' => CRM_Utils_Type::T_STRING, | |
185 | 'title' => ts('Premium Entity') , | |
186 | 'description' => 'Joins these premium settings to another object. Always civicrm_contribution_page for now.', | |
187 | 'required' => true, | |
188 | 'maxlength' => 64, | |
189 | 'size' => CRM_Utils_Type::BIG, | |
190 | ) , | |
191 | 'entity_id' => array( | |
192 | 'name' => 'entity_id', | |
193 | 'type' => CRM_Utils_Type::T_INT, | |
194 | 'title' => ts('Premium entity ID') , | |
195 | 'required' => true, | |
196 | ) , | |
197 | 'premiums_active' => array( | |
198 | 'name' => 'premiums_active', | |
199 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
200 | 'title' => ts('Is Premium Active?') , | |
201 | 'description' => 'Is the Premiums feature enabled for this page?', | |
202 | 'required' => true, | |
203 | ) , | |
204 | 'premiums_intro_title' => array( | |
205 | 'name' => 'premiums_intro_title', | |
206 | 'type' => CRM_Utils_Type::T_STRING, | |
207 | 'title' => ts('Title for Premiums section') , | |
208 | 'description' => 'Title for Premiums section.', | |
209 | 'maxlength' => 255, | |
210 | 'size' => CRM_Utils_Type::HUGE, | |
211 | ) , | |
212 | 'premiums_intro_text' => array( | |
213 | 'name' => 'premiums_intro_text', | |
214 | 'type' => CRM_Utils_Type::T_TEXT, | |
215 | 'title' => ts('Premium Introductory Text') , | |
216 | 'description' => 'Displayed in <div> at top of Premiums section of page. Text and HTML allowed.', | |
217 | ) , | |
218 | 'premiums_contact_email' => array( | |
219 | 'name' => 'premiums_contact_email', | |
220 | 'type' => CRM_Utils_Type::T_STRING, | |
221 | 'title' => ts('Premium Contact Email') , | |
222 | 'description' => 'This email address is included in receipts if it is populated and a premium has been selected.', | |
223 | 'maxlength' => 100, | |
224 | 'size' => CRM_Utils_Type::HUGE, | |
225 | ) , | |
226 | 'premiums_contact_phone' => array( | |
227 | 'name' => 'premiums_contact_phone', | |
228 | 'type' => CRM_Utils_Type::T_STRING, | |
229 | 'title' => ts('Premiums Contact Phone') , | |
230 | 'description' => 'This phone number is included in receipts if it is populated and a premium has been selected.', | |
231 | 'maxlength' => 50, | |
232 | 'size' => CRM_Utils_Type::BIG, | |
233 | ) , | |
234 | 'premiums_display_min_contribution' => array( | |
235 | 'name' => 'premiums_display_min_contribution', | |
236 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
237 | 'title' => ts('Display Minimum Contribution?') , | |
238 | 'description' => 'Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.', | |
239 | 'required' => true, | |
240 | ) , | |
241 | 'premiums_nothankyou_label' => array( | |
242 | 'name' => 'premiums_nothankyou_label', | |
243 | 'type' => CRM_Utils_Type::T_STRING, | |
244 | 'title' => ts('No Thank-you Text') , | |
245 | 'description' => 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)', | |
246 | 'maxlength' => 255, | |
247 | 'size' => CRM_Utils_Type::HUGE, | |
248 | ) , | |
249 | 'premiums_nothankyou_position' => array( | |
250 | 'name' => 'premiums_nothankyou_position', | |
251 | 'type' => CRM_Utils_Type::T_INT, | |
252 | 'title' => ts('No Thank-you Position') , | |
253 | 'default' => '1', | |
254 | ) , | |
255 | ); | |
256 | } | |
257 | return self::$_fields; | |
258 | } | |
259 | /** | |
260 | * Returns an array containing, for each field, the arary key used for that | |
261 | * field in self::$_fields. | |
262 | * | |
263 | * @return array | |
264 | */ | |
265 | static function &fieldKeys() { | |
266 | if (!(self::$_fieldKeys)) { | |
267 | self::$_fieldKeys = array( | |
268 | 'id' => 'id', | |
269 | 'entity_table' => 'entity_table', | |
270 | 'entity_id' => 'entity_id', | |
271 | 'premiums_active' => 'premiums_active', | |
272 | 'premiums_intro_title' => 'premiums_intro_title', | |
273 | 'premiums_intro_text' => 'premiums_intro_text', | |
274 | 'premiums_contact_email' => 'premiums_contact_email', | |
275 | 'premiums_contact_phone' => 'premiums_contact_phone', | |
276 | 'premiums_display_min_contribution' => 'premiums_display_min_contribution', | |
277 | 'premiums_nothankyou_label' => 'premiums_nothankyou_label', | |
278 | 'premiums_nothankyou_position' => 'premiums_nothankyou_position', | |
279 | ); | |
280 | } | |
281 | return self::$_fieldKeys; | |
282 | } | |
283 | /** | |
284 | * Returns the names of this table | |
285 | * | |
286 | * @return string | |
287 | */ | |
288 | static function getTableName() { | |
289 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
290 | } | |
291 | /** | |
292 | * Returns if this table needs to be logged | |
293 | * | |
294 | * @return boolean | |
295 | */ | |
296 | function getLog() { | |
297 | return self::$_log; | |
298 | } | |
299 | /** | |
300 | * Returns the list of fields that can be imported | |
301 | * | |
302 | * @param bool $prefix | |
303 | * | |
304 | * @return array | |
305 | */ | |
306 | static function &import($prefix = false) { | |
307 | if (!(self::$_import)) { | |
308 | self::$_import = array(); | |
309 | $fields = self::fields(); | |
310 | foreach($fields as $name => $field) { | |
311 | if (CRM_Utils_Array::value('import', $field)) { | |
312 | if ($prefix) { | |
313 | self::$_import['premiums'] = & $fields[$name]; | |
314 | } else { | |
315 | self::$_import[$name] = & $fields[$name]; | |
316 | } | |
317 | } | |
318 | } | |
319 | } | |
320 | return self::$_import; | |
321 | } | |
322 | /** | |
323 | * Returns the list of fields that can be exported | |
324 | * | |
325 | * @param bool $prefix | |
326 | * | |
327 | * @return array | |
328 | */ | |
329 | static function &export($prefix = false) { | |
330 | if (!(self::$_export)) { | |
331 | self::$_export = array(); | |
332 | $fields = self::fields(); | |
333 | foreach($fields as $name => $field) { | |
334 | if (CRM_Utils_Array::value('export', $field)) { | |
335 | if ($prefix) { | |
336 | self::$_export['premiums'] = & $fields[$name]; | |
337 | } else { | |
338 | self::$_export[$name] = & $fields[$name]; | |
339 | } | |
340 | } | |
341 | } | |
342 | } | |
343 | return self::$_export; | |
344 | } | |
345 | } |