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:6799d7afab4c8caeb518d19653090978)
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',
186 'pcp_contact_id' => [
187 'name' => 'contact_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Contact ID'),
190 'description' => ts('FK to Contact ID'),
192 'where' => 'civicrm_pcp.contact_id',
193 'table_name' => 'civicrm_pcp',
195 'bao' => 'CRM_PCP_BAO_PCP',
197 'FKClassName' => 'CRM_Contact_DAO_Contact',
199 'type' => 'EntityRef',
204 'name' => 'status_id',
205 'type' => CRM_Utils_Type
::T_INT
,
206 'title' => ts('Personal Campaign Page Status'),
208 'where' => 'civicrm_pcp.status_id',
209 'table_name' => 'civicrm_pcp',
211 'bao' => 'CRM_PCP_BAO_PCP',
216 'pseudoconstant' => [
217 'optionGroupName' => 'pcp_status',
218 'optionEditPath' => 'civicrm/admin/options/pcp_status',
224 'type' => CRM_Utils_Type
::T_STRING
,
225 'title' => ts('Personal Campaign Page Title'),
227 'size' => CRM_Utils_Type
::HUGE
,
228 'where' => 'civicrm_pcp.title',
230 'table_name' => 'civicrm_pcp',
232 'bao' => 'CRM_PCP_BAO_PCP',
240 'name' => 'intro_text',
241 'type' => CRM_Utils_Type
::T_TEXT
,
242 'title' => ts('Intro Text'),
243 'where' => 'civicrm_pcp.intro_text',
245 'table_name' => 'civicrm_pcp',
247 'bao' => 'CRM_PCP_BAO_PCP',
250 'type' => 'TextArea',
255 'name' => 'page_text',
256 'type' => CRM_Utils_Type
::T_TEXT
,
257 'title' => ts('Page Text'),
258 'where' => 'civicrm_pcp.page_text',
260 'table_name' => 'civicrm_pcp',
262 'bao' => 'CRM_PCP_BAO_PCP',
265 'type' => 'TextArea',
269 'donate_link_text' => [
270 'name' => 'donate_link_text',
271 'type' => CRM_Utils_Type
::T_STRING
,
272 'title' => ts('Donate Link Text'),
274 'size' => CRM_Utils_Type
::HUGE
,
275 'where' => 'civicrm_pcp.donate_link_text',
277 'table_name' => 'civicrm_pcp',
279 'bao' => 'CRM_PCP_BAO_PCP',
288 'type' => CRM_Utils_Type
::T_INT
,
289 'title' => ts('Contribution Page'),
290 'description' => ts('The Contribution or Event Page which triggered this pcp'),
292 'where' => 'civicrm_pcp.page_id',
293 'table_name' => 'civicrm_pcp',
295 'bao' => 'CRM_PCP_BAO_PCP',
300 'name' => 'page_type',
301 'type' => CRM_Utils_Type
::T_STRING
,
302 'title' => ts('PCP Page Type'),
303 'description' => ts('The type of PCP this is: contribute or event'),
305 'size' => CRM_Utils_Type
::BIG
,
306 'where' => 'civicrm_pcp.page_type',
307 'default' => 'contribute',
308 'table_name' => 'civicrm_pcp',
310 'bao' => 'CRM_PCP_BAO_PCP',
318 'name' => 'pcp_block_id',
319 'type' => CRM_Utils_Type
::T_INT
,
320 'title' => ts('PCP Block'),
321 'description' => ts('The pcp block that this pcp page was created from'),
323 'where' => 'civicrm_pcp.pcp_block_id',
324 'table_name' => 'civicrm_pcp',
326 'bao' => 'CRM_PCP_BAO_PCP',
330 'is_thermometer' => [
331 'name' => 'is_thermometer',
332 'type' => CRM_Utils_Type
::T_INT
,
333 'title' => ts('Use Thermometer?'),
334 'where' => 'civicrm_pcp.is_thermometer',
336 'table_name' => 'civicrm_pcp',
338 'bao' => 'CRM_PCP_BAO_PCP',
341 'type' => 'CheckBox',
346 'name' => 'is_honor_roll',
347 'type' => CRM_Utils_Type
::T_INT
,
348 'title' => ts('Show Honor Roll?'),
349 'where' => 'civicrm_pcp.is_honor_roll',
351 'table_name' => 'civicrm_pcp',
353 'bao' => 'CRM_PCP_BAO_PCP',
356 'type' => 'CheckBox',
361 'name' => 'goal_amount',
362 'type' => CRM_Utils_Type
::T_MONEY
,
363 'title' => ts('Goal Amount'),
364 'description' => ts('Goal amount of this Personal Campaign Page.'),
369 'where' => 'civicrm_pcp.goal_amount',
370 'table_name' => 'civicrm_pcp',
372 'bao' => 'CRM_PCP_BAO_PCP',
380 'name' => 'currency',
381 'type' => CRM_Utils_Type
::T_STRING
,
382 'title' => ts('Currency'),
383 'description' => ts('3 character string, value from config setting or input via user.'),
385 'size' => CRM_Utils_Type
::FOUR
,
386 'where' => 'civicrm_pcp.currency',
388 'table_name' => 'civicrm_pcp',
390 'bao' => 'CRM_PCP_BAO_PCP',
395 'pseudoconstant' => [
396 'table' => 'civicrm_currency',
397 'keyColumn' => 'name',
398 'labelColumn' => 'full_name',
399 'nameColumn' => 'name',
400 'abbrColumn' => 'symbol',
405 'name' => 'is_active',
406 'type' => CRM_Utils_Type
::T_BOOLEAN
,
407 'title' => ts('Enabled?'),
408 'description' => ts('Is Personal Campaign Page enabled/active?'),
409 'where' => 'civicrm_pcp.is_active',
411 'table_name' => 'civicrm_pcp',
413 'bao' => 'CRM_PCP_BAO_PCP',
416 'type' => 'CheckBox',
421 'name' => 'is_notify',
422 'type' => CRM_Utils_Type
::T_BOOLEAN
,
423 'title' => ts('Notify Owner?'),
424 'description' => ts('Notify owner via email when someone donates to page?'),
425 'where' => 'civicrm_pcp.is_notify',
427 'table_name' => 'civicrm_pcp',
429 'bao' => 'CRM_PCP_BAO_PCP',
432 'type' => 'CheckBox',
437 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
439 return Civi
::$statics[__CLASS__
]['fields'];
443 * Return a mapping from field-name to the corresponding key (as used in fields()).
446 * Array(string $name => string $uniqueName).
448 public static function &fieldKeys() {
449 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
450 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
452 return Civi
::$statics[__CLASS__
]['fieldKeys'];
456 * Returns the names of this table
460 public static function getTableName() {
461 return self
::$_tableName;
465 * Returns if this table needs to be logged
469 public function getLog() {
474 * Returns the list of fields that can be imported
476 * @param bool $prefix
480 public static function &import($prefix = FALSE) {
481 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
486 * Returns the list of fields that can be exported
488 * @param bool $prefix
492 public static function &export($prefix = FALSE) {
493 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
498 * Returns the list of indices
500 * @param bool $localize
504 public static function indices($localize = TRUE) {
506 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;