Merge pull request #17695 from MegaphoneJon/event-template-fix
[civicrm-core.git] / CRM / PCP / DAO / PCP.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:30c5a26e001449a2ace9e530714e833c)
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 public 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 public static $_log = TRUE;
30
31 /**
32 * Personal Campaign Page ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int
42 */
43 public $contact_id;
44
45 /**
46 * @var int
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
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
88 */
89 public $pcp_block_id;
90
91 /**
92 * @var int
93 */
94 public $is_thermometer;
95
96 /**
97 * @var int
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 bool
119 */
120 public $is_active;
121
122 /**
123 * Notify owner via email when someone donates to page?
124 *
125 * @var bool
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 localized title of this entity.
139 */
140 public static function getEntityTitle() {
141 return ts('PCPs');
142 }
143
144 /**
145 * Returns foreign keys and entity references.
146 *
147 * @return array
148 * [CRM_Core_Reference_Interface]
149 */
150 public static function getReferenceColumns() {
151 if (!isset(Civi::$statics[__CLASS__]['links'])) {
152 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
153 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
154 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
155 }
156 return Civi::$statics[__CLASS__]['links'];
157 }
158
159 /**
160 * Returns all the column names of this table
161 *
162 * @return array
163 */
164 public static function &fields() {
165 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
166 Civi::$statics[__CLASS__]['fields'] = [
167 'pcp_id' => [
168 'name' => 'id',
169 'type' => CRM_Utils_Type::T_INT,
170 'title' => ts('Personal Campaign Page ID'),
171 'description' => ts('Personal Campaign Page ID'),
172 'required' => TRUE,
173 'where' => 'civicrm_pcp.id',
174 'table_name' => 'civicrm_pcp',
175 'entity' => 'PCP',
176 'bao' => 'CRM_PCP_BAO_PCP',
177 'localizable' => 0,
178 'add' => '2.2',
179 ],
180 'pcp_contact_id' => [
181 'name' => 'contact_id',
182 'type' => CRM_Utils_Type::T_INT,
183 'title' => ts('Contact ID'),
184 'description' => ts('FK to Contact ID'),
185 'required' => TRUE,
186 'where' => 'civicrm_pcp.contact_id',
187 'table_name' => 'civicrm_pcp',
188 'entity' => 'PCP',
189 'bao' => 'CRM_PCP_BAO_PCP',
190 'localizable' => 0,
191 'FKClassName' => 'CRM_Contact_DAO_Contact',
192 'html' => [
193 'type' => 'EntityRef',
194 ],
195 'add' => '2.2',
196 ],
197 'status_id' => [
198 'name' => 'status_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Personal Campaign Page Status'),
201 'required' => TRUE,
202 'where' => 'civicrm_pcp.status_id',
203 'table_name' => 'civicrm_pcp',
204 'entity' => 'PCP',
205 'bao' => 'CRM_PCP_BAO_PCP',
206 'localizable' => 0,
207 'html' => [
208 'type' => 'Select',
209 ],
210 'pseudoconstant' => [
211 'optionGroupName' => 'pcp_status',
212 'optionEditPath' => 'civicrm/admin/options/pcp_status',
213 ],
214 'add' => '2.2',
215 ],
216 'title' => [
217 'name' => 'title',
218 'type' => CRM_Utils_Type::T_STRING,
219 'title' => ts('Personal Campaign Page Title'),
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
222 'where' => 'civicrm_pcp.title',
223 'default' => 'NULL',
224 'table_name' => 'civicrm_pcp',
225 'entity' => 'PCP',
226 'bao' => 'CRM_PCP_BAO_PCP',
227 'localizable' => 0,
228 'html' => [
229 'type' => 'Text',
230 ],
231 'add' => '2.2',
232 ],
233 'intro_text' => [
234 'name' => 'intro_text',
235 'type' => CRM_Utils_Type::T_TEXT,
236 'title' => ts('Intro Text'),
237 'where' => 'civicrm_pcp.intro_text',
238 'default' => 'NULL',
239 'table_name' => 'civicrm_pcp',
240 'entity' => 'PCP',
241 'bao' => 'CRM_PCP_BAO_PCP',
242 'localizable' => 0,
243 'html' => [
244 'type' => 'TextArea',
245 ],
246 'add' => '2.2',
247 ],
248 'page_text' => [
249 'name' => 'page_text',
250 'type' => CRM_Utils_Type::T_TEXT,
251 'title' => ts('Page Text'),
252 'where' => 'civicrm_pcp.page_text',
253 'default' => 'NULL',
254 'table_name' => 'civicrm_pcp',
255 'entity' => 'PCP',
256 'bao' => 'CRM_PCP_BAO_PCP',
257 'localizable' => 0,
258 'html' => [
259 'type' => 'TextArea',
260 ],
261 'add' => '2.2',
262 ],
263 'donate_link_text' => [
264 'name' => 'donate_link_text',
265 'type' => CRM_Utils_Type::T_STRING,
266 'title' => ts('Donate Link Text'),
267 'maxlength' => 255,
268 'size' => CRM_Utils_Type::HUGE,
269 'where' => 'civicrm_pcp.donate_link_text',
270 'default' => 'NULL',
271 'table_name' => 'civicrm_pcp',
272 'entity' => 'PCP',
273 'bao' => 'CRM_PCP_BAO_PCP',
274 'localizable' => 0,
275 'html' => [
276 'type' => 'Text',
277 ],
278 'add' => '2.2',
279 ],
280 'page_id' => [
281 'name' => 'page_id',
282 'type' => CRM_Utils_Type::T_INT,
283 'title' => ts('Contribution Page'),
284 'description' => ts('The Contribution or Event Page which triggered this pcp'),
285 'required' => TRUE,
286 'where' => 'civicrm_pcp.page_id',
287 'table_name' => 'civicrm_pcp',
288 'entity' => 'PCP',
289 'bao' => 'CRM_PCP_BAO_PCP',
290 'localizable' => 0,
291 'add' => '4.1',
292 ],
293 'page_type' => [
294 'name' => 'page_type',
295 'type' => CRM_Utils_Type::T_STRING,
296 'title' => ts('PCP Page Type'),
297 'description' => ts('The type of PCP this is: contribute or event'),
298 'maxlength' => 64,
299 'size' => CRM_Utils_Type::BIG,
300 'where' => 'civicrm_pcp.page_type',
301 'default' => 'contribute',
302 'table_name' => 'civicrm_pcp',
303 'entity' => 'PCP',
304 'bao' => 'CRM_PCP_BAO_PCP',
305 'localizable' => 0,
306 'html' => [
307 'type' => 'Select',
308 ],
309 'add' => '2.2',
310 ],
311 'pcp_block_id' => [
312 'name' => 'pcp_block_id',
313 'type' => CRM_Utils_Type::T_INT,
314 'title' => ts('PCP Block'),
315 'description' => ts('The pcp block that this pcp page was created from'),
316 'required' => TRUE,
317 'where' => 'civicrm_pcp.pcp_block_id',
318 'table_name' => 'civicrm_pcp',
319 'entity' => 'PCP',
320 'bao' => 'CRM_PCP_BAO_PCP',
321 'localizable' => 0,
322 'add' => '4.1',
323 ],
324 'is_thermometer' => [
325 'name' => 'is_thermometer',
326 'type' => CRM_Utils_Type::T_INT,
327 'title' => ts('Use Thermometer?'),
328 'where' => 'civicrm_pcp.is_thermometer',
329 'default' => '0',
330 'table_name' => 'civicrm_pcp',
331 'entity' => 'PCP',
332 'bao' => 'CRM_PCP_BAO_PCP',
333 'localizable' => 0,
334 'html' => [
335 'type' => 'CheckBox',
336 ],
337 'add' => '2.2',
338 ],
339 'is_honor_roll' => [
340 'name' => 'is_honor_roll',
341 'type' => CRM_Utils_Type::T_INT,
342 'title' => ts('Show Honor Roll?'),
343 'where' => 'civicrm_pcp.is_honor_roll',
344 'default' => '0',
345 'table_name' => 'civicrm_pcp',
346 'entity' => 'PCP',
347 'bao' => 'CRM_PCP_BAO_PCP',
348 'localizable' => 0,
349 'html' => [
350 'type' => 'CheckBox',
351 ],
352 'add' => '2.2',
353 ],
354 'goal_amount' => [
355 'name' => 'goal_amount',
356 'type' => CRM_Utils_Type::T_MONEY,
357 'title' => ts('Goal Amount'),
358 'description' => ts('Goal amount of this Personal Campaign Page.'),
359 'precision' => [
360 20,
361 2,
362 ],
363 'where' => 'civicrm_pcp.goal_amount',
364 'table_name' => 'civicrm_pcp',
365 'entity' => 'PCP',
366 'bao' => 'CRM_PCP_BAO_PCP',
367 'localizable' => 0,
368 'html' => [
369 'type' => 'Text',
370 ],
371 'add' => '2.2',
372 ],
373 'currency' => [
374 'name' => 'currency',
375 'type' => CRM_Utils_Type::T_STRING,
376 'title' => ts('Currency'),
377 'description' => ts('3 character string, value from config setting or input via user.'),
378 'maxlength' => 3,
379 'size' => CRM_Utils_Type::FOUR,
380 'where' => 'civicrm_pcp.currency',
381 'default' => 'NULL',
382 'table_name' => 'civicrm_pcp',
383 'entity' => 'PCP',
384 'bao' => 'CRM_PCP_BAO_PCP',
385 'localizable' => 0,
386 'html' => [
387 'type' => 'Select',
388 ],
389 'pseudoconstant' => [
390 'table' => 'civicrm_currency',
391 'keyColumn' => 'name',
392 'labelColumn' => 'full_name',
393 'nameColumn' => 'name',
394 'abbrColumn' => 'symbol',
395 ],
396 'add' => '3.2',
397 ],
398 'is_active' => [
399 'name' => 'is_active',
400 'type' => CRM_Utils_Type::T_BOOLEAN,
401 'title' => ts('Enabled?'),
402 'description' => ts('Is Personal Campaign Page enabled/active?'),
403 'where' => 'civicrm_pcp.is_active',
404 'default' => '0',
405 'table_name' => 'civicrm_pcp',
406 'entity' => 'PCP',
407 'bao' => 'CRM_PCP_BAO_PCP',
408 'localizable' => 0,
409 'html' => [
410 'type' => 'CheckBox',
411 ],
412 'add' => '2.2',
413 ],
414 'is_notify' => [
415 'name' => 'is_notify',
416 'type' => CRM_Utils_Type::T_BOOLEAN,
417 'title' => ts('Notify Owner?'),
418 'description' => ts('Notify owner via email when someone donates to page?'),
419 'where' => 'civicrm_pcp.is_notify',
420 'default' => '0',
421 'table_name' => 'civicrm_pcp',
422 'entity' => 'PCP',
423 'bao' => 'CRM_PCP_BAO_PCP',
424 'localizable' => 0,
425 'html' => [
426 'type' => 'CheckBox',
427 ],
428 'add' => '4.6',
429 ],
430 ];
431 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
432 }
433 return Civi::$statics[__CLASS__]['fields'];
434 }
435
436 /**
437 * Return a mapping from field-name to the corresponding key (as used in fields()).
438 *
439 * @return array
440 * Array(string $name => string $uniqueName).
441 */
442 public static function &fieldKeys() {
443 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
444 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
445 }
446 return Civi::$statics[__CLASS__]['fieldKeys'];
447 }
448
449 /**
450 * Returns the names of this table
451 *
452 * @return string
453 */
454 public static function getTableName() {
455 return self::$_tableName;
456 }
457
458 /**
459 * Returns if this table needs to be logged
460 *
461 * @return bool
462 */
463 public function getLog() {
464 return self::$_log;
465 }
466
467 /**
468 * Returns the list of fields that can be imported
469 *
470 * @param bool $prefix
471 *
472 * @return array
473 */
474 public static function &import($prefix = FALSE) {
475 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, []);
476 return $r;
477 }
478
479 /**
480 * Returns the list of fields that can be exported
481 *
482 * @param bool $prefix
483 *
484 * @return array
485 */
486 public static function &export($prefix = FALSE) {
487 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, []);
488 return $r;
489 }
490
491 /**
492 * Returns the list of indices
493 *
494 * @param bool $localize
495 *
496 * @return array
497 */
498 public static function indices($localize = TRUE) {
499 $indices = [];
500 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
501 }
502
503 }