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