Merge pull request #13201 from seamuslee001/event_template_cleanup
[civicrm-core.git] / CRM / PCP / DAO / PCP.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4585e6f51f50242cba89fe9325c44c44)
10 */
11
12 /**
13 * Database access object for the PCP entity.
14 */
15 class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_pcp';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = TRUE;
30
31 /**
32 * Personal Campaign Page ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
44
45 /**
46 * @var int unsigned
47 */
48 public $status_id;
49
50 /**
51 * @var string
52 */
53 public $title;
54
55 /**
56 * @var text
57 */
58 public $intro_text;
59
60 /**
61 * @var text
62 */
63 public $page_text;
64
65 /**
66 * @var string
67 */
68 public $donate_link_text;
69
70 /**
71 * The Contribution or Event Page which triggered this pcp
72 *
73 * @var int unsigned
74 */
75 public $page_id;
76
77 /**
78 * The type of PCP this is: contribute or event
79 *
80 * @var string
81 */
82 public $page_type;
83
84 /**
85 * The pcp block that this pcp page was created from
86 *
87 * @var int unsigned
88 */
89 public $pcp_block_id;
90
91 /**
92 * @var int unsigned
93 */
94 public $is_thermometer;
95
96 /**
97 * @var int unsigned
98 */
99 public $is_honor_roll;
100
101 /**
102 * Goal amount of this Personal Campaign Page.
103 *
104 * @var float
105 */
106 public $goal_amount;
107
108 /**
109 * 3 character string, value from config setting or input via user.
110 *
111 * @var string
112 */
113 public $currency;
114
115 /**
116 * Is Personal Campaign Page enabled/active?
117 *
118 * @var boolean
119 */
120 public $is_active;
121
122 /**
123 * Notify owner via email when someone donates to page?
124 *
125 * @var boolean
126 */
127 public $is_notify;
128
129 /**
130 * Class constructor.
131 */
132 public function __construct() {
133 $this->__table = 'civicrm_pcp';
134 parent::__construct();
135 }
136
137 /**
138 * Returns foreign keys and entity references.
139 *
140 * @return array
141 * [CRM_Core_Reference_Interface]
142 */
143 public static function getReferenceColumns() {
144 if (!isset(Civi::$statics[__CLASS__]['links'])) {
145 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
146 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
147 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
148 }
149 return Civi::$statics[__CLASS__]['links'];
150 }
151
152 /**
153 * Returns all the column names of this table
154 *
155 * @return array
156 */
157 public static function &fields() {
158 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
159 Civi::$statics[__CLASS__]['fields'] = [
160 'pcp_id' => [
161 'name' => 'id',
162 'type' => CRM_Utils_Type::T_INT,
163 'title' => ts('Personal Campaign Page ID'),
164 'description' => ts('Personal Campaign Page ID'),
165 'required' => TRUE,
166 'table_name' => 'civicrm_pcp',
167 'entity' => 'PCP',
168 'bao' => 'CRM_PCP_BAO_PCP',
169 'localizable' => 0,
170 ],
171 'pcp_contact_id' => [
172 'name' => 'contact_id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Contact ID'),
175 'description' => ts('FK to Contact ID'),
176 'required' => TRUE,
177 'table_name' => 'civicrm_pcp',
178 'entity' => 'PCP',
179 'bao' => 'CRM_PCP_BAO_PCP',
180 'localizable' => 0,
181 'FKClassName' => 'CRM_Contact_DAO_Contact',
182 'html' => [
183 'type' => 'EntityRef',
184 ],
185 ],
186 'status_id' => [
187 'name' => 'status_id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Personal Campaign Page Status'),
190 'required' => TRUE,
191 'table_name' => 'civicrm_pcp',
192 'entity' => 'PCP',
193 'bao' => 'CRM_PCP_BAO_PCP',
194 'localizable' => 0,
195 'html' => [
196 'type' => 'Select',
197 ],
198 'pseudoconstant' => [
199 'optionGroupName' => 'pcp_status',
200 'optionEditPath' => 'civicrm/admin/options/pcp_status',
201 ]
202 ],
203 'title' => [
204 'name' => 'title',
205 'type' => CRM_Utils_Type::T_STRING,
206 'title' => ts('Personal Campaign Page Title'),
207 'maxlength' => 255,
208 'size' => CRM_Utils_Type::HUGE,
209 'default' => 'NULL',
210 'table_name' => 'civicrm_pcp',
211 'entity' => 'PCP',
212 'bao' => 'CRM_PCP_BAO_PCP',
213 'localizable' => 0,
214 'html' => [
215 'type' => 'Text',
216 ],
217 ],
218 'intro_text' => [
219 'name' => 'intro_text',
220 'type' => CRM_Utils_Type::T_TEXT,
221 'title' => ts('Intro Text'),
222 'default' => 'NULL',
223 'table_name' => 'civicrm_pcp',
224 'entity' => 'PCP',
225 'bao' => 'CRM_PCP_BAO_PCP',
226 'localizable' => 0,
227 'html' => [
228 'type' => 'TextArea',
229 ],
230 ],
231 'page_text' => [
232 'name' => 'page_text',
233 'type' => CRM_Utils_Type::T_TEXT,
234 'title' => ts('Page Text'),
235 'default' => 'NULL',
236 'table_name' => 'civicrm_pcp',
237 'entity' => 'PCP',
238 'bao' => 'CRM_PCP_BAO_PCP',
239 'localizable' => 0,
240 'html' => [
241 'type' => 'TextArea',
242 ],
243 ],
244 'donate_link_text' => [
245 'name' => 'donate_link_text',
246 'type' => CRM_Utils_Type::T_STRING,
247 'title' => ts('Donate Link Text'),
248 'maxlength' => 255,
249 'size' => CRM_Utils_Type::HUGE,
250 'default' => 'NULL',
251 'table_name' => 'civicrm_pcp',
252 'entity' => 'PCP',
253 'bao' => 'CRM_PCP_BAO_PCP',
254 'localizable' => 0,
255 'html' => [
256 'type' => 'Text',
257 ],
258 ],
259 'page_id' => [
260 'name' => 'page_id',
261 'type' => CRM_Utils_Type::T_INT,
262 'title' => ts('Contribution Page'),
263 'description' => ts('The Contribution or Event Page which triggered this pcp'),
264 'required' => TRUE,
265 'table_name' => 'civicrm_pcp',
266 'entity' => 'PCP',
267 'bao' => 'CRM_PCP_BAO_PCP',
268 'localizable' => 0,
269 ],
270 'page_type' => [
271 'name' => 'page_type',
272 'type' => CRM_Utils_Type::T_STRING,
273 'title' => ts('PCP Page Type'),
274 'description' => ts('The type of PCP this is: contribute or event'),
275 'maxlength' => 64,
276 'size' => CRM_Utils_Type::BIG,
277 'default' => 'contribute',
278 'table_name' => 'civicrm_pcp',
279 'entity' => 'PCP',
280 'bao' => 'CRM_PCP_BAO_PCP',
281 'localizable' => 0,
282 'html' => [
283 'type' => 'Select',
284 ],
285 ],
286 'pcp_block_id' => [
287 'name' => 'pcp_block_id',
288 'type' => CRM_Utils_Type::T_INT,
289 'title' => ts('PCP Block'),
290 'description' => ts('The pcp block that this pcp page was created from'),
291 'required' => TRUE,
292 'table_name' => 'civicrm_pcp',
293 'entity' => 'PCP',
294 'bao' => 'CRM_PCP_BAO_PCP',
295 'localizable' => 0,
296 ],
297 'is_thermometer' => [
298 'name' => 'is_thermometer',
299 'type' => CRM_Utils_Type::T_INT,
300 'title' => ts('Use Thermometer?'),
301 'default' => '0',
302 'table_name' => 'civicrm_pcp',
303 'entity' => 'PCP',
304 'bao' => 'CRM_PCP_BAO_PCP',
305 'localizable' => 0,
306 'html' => [
307 'type' => 'CheckBox',
308 ],
309 ],
310 'is_honor_roll' => [
311 'name' => 'is_honor_roll',
312 'type' => CRM_Utils_Type::T_INT,
313 'title' => ts('Show Honor Roll?'),
314 'default' => '0',
315 'table_name' => 'civicrm_pcp',
316 'entity' => 'PCP',
317 'bao' => 'CRM_PCP_BAO_PCP',
318 'localizable' => 0,
319 'html' => [
320 'type' => 'CheckBox',
321 ],
322 ],
323 'goal_amount' => [
324 'name' => 'goal_amount',
325 'type' => CRM_Utils_Type::T_MONEY,
326 'title' => ts('Goal Amount'),
327 'description' => ts('Goal amount of this Personal Campaign Page.'),
328 'precision' => [
329 20,
330 2
331 ],
332 'table_name' => 'civicrm_pcp',
333 'entity' => 'PCP',
334 'bao' => 'CRM_PCP_BAO_PCP',
335 'localizable' => 0,
336 'html' => [
337 'type' => 'Text',
338 ],
339 ],
340 'currency' => [
341 'name' => 'currency',
342 'type' => CRM_Utils_Type::T_STRING,
343 'title' => ts('Currency'),
344 'description' => ts('3 character string, value from config setting or input via user.'),
345 'maxlength' => 3,
346 'size' => CRM_Utils_Type::FOUR,
347 'default' => 'NULL',
348 'table_name' => 'civicrm_pcp',
349 'entity' => 'PCP',
350 'bao' => 'CRM_PCP_BAO_PCP',
351 'localizable' => 0,
352 'html' => [
353 'type' => 'Select',
354 ],
355 'pseudoconstant' => [
356 'table' => 'civicrm_currency',
357 'keyColumn' => 'name',
358 'labelColumn' => 'full_name',
359 'nameColumn' => 'name',
360 ]
361 ],
362 'is_active' => [
363 'name' => 'is_active',
364 'type' => CRM_Utils_Type::T_BOOLEAN,
365 'title' => ts('Enabled?'),
366 'description' => ts('Is Personal Campaign Page enabled/active?'),
367 'default' => '0',
368 'table_name' => 'civicrm_pcp',
369 'entity' => 'PCP',
370 'bao' => 'CRM_PCP_BAO_PCP',
371 'localizable' => 0,
372 'html' => [
373 'type' => 'CheckBox',
374 ],
375 ],
376 'is_notify' => [
377 'name' => 'is_notify',
378 'type' => CRM_Utils_Type::T_BOOLEAN,
379 'title' => ts('Notify Owner?'),
380 'description' => ts('Notify owner via email when someone donates to page?'),
381 'default' => '0',
382 'table_name' => 'civicrm_pcp',
383 'entity' => 'PCP',
384 'bao' => 'CRM_PCP_BAO_PCP',
385 'localizable' => 0,
386 'html' => [
387 'type' => 'CheckBox',
388 ],
389 ],
390 ];
391 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
392 }
393 return Civi::$statics[__CLASS__]['fields'];
394 }
395
396 /**
397 * Return a mapping from field-name to the corresponding key (as used in fields()).
398 *
399 * @return array
400 * Array(string $name => string $uniqueName).
401 */
402 public static function &fieldKeys() {
403 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
404 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
405 }
406 return Civi::$statics[__CLASS__]['fieldKeys'];
407 }
408
409 /**
410 * Returns the names of this table
411 *
412 * @return string
413 */
414 public static function getTableName() {
415 return self::$_tableName;
416 }
417
418 /**
419 * Returns if this table needs to be logged
420 *
421 * @return bool
422 */
423 public function getLog() {
424 return self::$_log;
425 }
426
427 /**
428 * Returns the list of fields that can be imported
429 *
430 * @param bool $prefix
431 *
432 * @return array
433 */
434 public static function &import($prefix = FALSE) {
435 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, []);
436 return $r;
437 }
438
439 /**
440 * Returns the list of fields that can be exported
441 *
442 * @param bool $prefix
443 *
444 * @return array
445 */
446 public static function &export($prefix = FALSE) {
447 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, []);
448 return $r;
449 }
450
451 /**
452 * Returns the list of indices
453 *
454 * @param bool $localize
455 *
456 * @return array
457 */
458 public static function indices($localize = TRUE) {
459 $indices = [];
460 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
461 }
462
463 }