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