5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0d2fc92a3a801a3eb5eca71989b21557)
13 * Database access object for the PCP entity.
15 class CRM_PCP_DAO_PCP
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.2';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_pcp';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
35 * Personal Campaign Page ID
71 public $donate_link_text;
74 * The Contribution or Event Page which triggered this pcp
81 * The type of PCP this is: contribute or event
88 * The pcp block that this pcp page was created from
97 public $is_thermometer;
102 public $is_honor_roll;
105 * Goal amount of this Personal Campaign Page.
112 * 3 character string, value from config setting or input via user.
119 * Is Personal Campaign Page enabled/active?
126 * Notify owner via email when someone donates to page?
135 public function __construct() {
136 $this->__table
= 'civicrm_pcp';
137 parent
::__construct();
141 * Returns localized title of this entity.
143 * @param bool $plural
144 * Whether to return the plural version of the title.
146 public static function getEntityTitle($plural = FALSE) {
147 return $plural ?
ts('PCPs') : ts('PCP');
151 * Returns foreign keys and entity references.
154 * [CRM_Core_Reference_Interface]
156 public static function getReferenceColumns() {
157 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
158 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
159 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
160 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
162 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 public static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = [
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Personal Campaign Page ID'),
177 'description' => ts('Personal Campaign Page ID'),
179 'where' => 'civicrm_pcp.id',
180 'table_name' => 'civicrm_pcp',
182 'bao' => 'CRM_PCP_BAO_PCP',
190 'pcp_contact_id' => [
191 'name' => 'contact_id',
192 'type' => CRM_Utils_Type
::T_INT
,
193 'title' => ts('Contact ID'),
194 'description' => ts('FK to Contact ID'),
196 'where' => 'civicrm_pcp.contact_id',
197 'table_name' => 'civicrm_pcp',
199 'bao' => 'CRM_PCP_BAO_PCP',
201 'FKClassName' => 'CRM_Contact_DAO_Contact',
203 'type' => 'EntityRef',
204 'label' => ts("Contact"),
209 'name' => 'status_id',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Personal Campaign Page Status'),
213 'where' => 'civicrm_pcp.status_id',
214 'table_name' => 'civicrm_pcp',
216 'bao' => 'CRM_PCP_BAO_PCP',
221 'pseudoconstant' => [
222 'optionGroupName' => 'pcp_status',
223 'optionEditPath' => 'civicrm/admin/options/pcp_status',
229 'type' => CRM_Utils_Type
::T_STRING
,
230 'title' => ts('Personal Campaign Page Title'),
232 'size' => CRM_Utils_Type
::HUGE
,
233 'where' => 'civicrm_pcp.title',
235 'table_name' => 'civicrm_pcp',
237 'bao' => 'CRM_PCP_BAO_PCP',
245 'name' => 'intro_text',
246 'type' => CRM_Utils_Type
::T_TEXT
,
247 'title' => ts('Intro Text'),
248 'where' => 'civicrm_pcp.intro_text',
250 'table_name' => 'civicrm_pcp',
252 'bao' => 'CRM_PCP_BAO_PCP',
255 'type' => 'TextArea',
256 'label' => ts("Intro Text"),
261 'name' => 'page_text',
262 'type' => CRM_Utils_Type
::T_TEXT
,
263 'title' => ts('Page Text'),
264 'where' => 'civicrm_pcp.page_text',
266 'table_name' => 'civicrm_pcp',
268 'bao' => 'CRM_PCP_BAO_PCP',
271 'type' => 'TextArea',
272 'label' => ts("Page Text"),
276 'donate_link_text' => [
277 'name' => 'donate_link_text',
278 'type' => CRM_Utils_Type
::T_STRING
,
279 'title' => ts('Donate Link Text'),
281 'size' => CRM_Utils_Type
::HUGE
,
282 'where' => 'civicrm_pcp.donate_link_text',
284 'table_name' => 'civicrm_pcp',
286 'bao' => 'CRM_PCP_BAO_PCP',
295 'type' => CRM_Utils_Type
::T_INT
,
296 'title' => ts('Contribution Page'),
297 'description' => ts('The Contribution or Event Page which triggered this pcp'),
299 'where' => 'civicrm_pcp.page_id',
300 'table_name' => 'civicrm_pcp',
302 'bao' => 'CRM_PCP_BAO_PCP',
307 'name' => 'page_type',
308 'type' => CRM_Utils_Type
::T_STRING
,
309 'title' => ts('PCP Page Type'),
310 'description' => ts('The type of PCP this is: contribute or event'),
312 'size' => CRM_Utils_Type
::BIG
,
313 'where' => 'civicrm_pcp.page_type',
314 'default' => 'contribute',
315 'table_name' => 'civicrm_pcp',
317 'bao' => 'CRM_PCP_BAO_PCP',
325 'name' => 'pcp_block_id',
326 'type' => CRM_Utils_Type
::T_INT
,
327 'title' => ts('PCP Block'),
328 'description' => ts('The pcp block that this pcp page was created from'),
330 'where' => 'civicrm_pcp.pcp_block_id',
331 'table_name' => 'civicrm_pcp',
333 'bao' => 'CRM_PCP_BAO_PCP',
337 'is_thermometer' => [
338 'name' => 'is_thermometer',
339 'type' => CRM_Utils_Type
::T_INT
,
340 'title' => ts('Use Thermometer?'),
341 'where' => 'civicrm_pcp.is_thermometer',
343 'table_name' => 'civicrm_pcp',
345 'bao' => 'CRM_PCP_BAO_PCP',
348 'type' => 'CheckBox',
353 'name' => 'is_honor_roll',
354 'type' => CRM_Utils_Type
::T_INT
,
355 'title' => ts('Show Honor Roll?'),
356 'where' => 'civicrm_pcp.is_honor_roll',
358 'table_name' => 'civicrm_pcp',
360 'bao' => 'CRM_PCP_BAO_PCP',
363 'type' => 'CheckBox',
368 'name' => 'goal_amount',
369 'type' => CRM_Utils_Type
::T_MONEY
,
370 'title' => ts('Goal Amount'),
371 'description' => ts('Goal amount of this Personal Campaign Page.'),
376 'where' => 'civicrm_pcp.goal_amount',
377 'table_name' => 'civicrm_pcp',
379 'bao' => 'CRM_PCP_BAO_PCP',
387 'name' => 'currency',
388 'type' => CRM_Utils_Type
::T_STRING
,
389 'title' => ts('Currency'),
390 'description' => ts('3 character string, value from config setting or input via user.'),
392 'size' => CRM_Utils_Type
::FOUR
,
393 'where' => 'civicrm_pcp.currency',
395 'table_name' => 'civicrm_pcp',
397 'bao' => 'CRM_PCP_BAO_PCP',
402 'pseudoconstant' => [
403 'table' => 'civicrm_currency',
404 'keyColumn' => 'name',
405 'labelColumn' => 'full_name',
406 'nameColumn' => 'name',
407 'abbrColumn' => 'symbol',
412 'name' => 'is_active',
413 'type' => CRM_Utils_Type
::T_BOOLEAN
,
414 'title' => ts('Enabled?'),
415 'description' => ts('Is Personal Campaign Page enabled/active?'),
416 'where' => 'civicrm_pcp.is_active',
418 'table_name' => 'civicrm_pcp',
420 'bao' => 'CRM_PCP_BAO_PCP',
423 'type' => 'CheckBox',
428 'name' => 'is_notify',
429 'type' => CRM_Utils_Type
::T_BOOLEAN
,
430 'title' => ts('Notify Owner?'),
431 'description' => ts('Notify owner via email when someone donates to page?'),
432 'where' => 'civicrm_pcp.is_notify',
434 'table_name' => 'civicrm_pcp',
436 'bao' => 'CRM_PCP_BAO_PCP',
439 'type' => 'CheckBox',
444 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
446 return Civi
::$statics[__CLASS__
]['fields'];
450 * Return a mapping from field-name to the corresponding key (as used in fields()).
453 * Array(string $name => string $uniqueName).
455 public static function &fieldKeys() {
456 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
457 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
459 return Civi
::$statics[__CLASS__
]['fieldKeys'];
463 * Returns the names of this table
467 public static function getTableName() {
468 return self
::$_tableName;
472 * Returns if this table needs to be logged
476 public function getLog() {
481 * Returns the list of fields that can be imported
483 * @param bool $prefix
487 public static function &import($prefix = FALSE) {
488 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
493 * Returns the list of fields that can be exported
495 * @param bool $prefix
499 public static function &export($prefix = FALSE) {
500 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
505 * Returns the list of indices
507 * @param bool $localize
511 public static function indices($localize = TRUE) {
513 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;