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:2232571099c216fb7a823556f5bd8328)
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';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_pcp';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
34 * Personal Campaign Page ID
70 public $donate_link_text;
73 * The Contribution or Event Page which triggered this pcp
80 * The type of PCP this is: contribute or event
87 * The pcp block that this pcp page was created from
96 public $is_thermometer;
101 public $is_honor_roll;
104 * Goal amount of this Personal Campaign Page.
111 * 3 character string, value from config setting or input via user.
118 * Is Personal Campaign Page enabled/active?
125 * Notify owner via email when someone donates to page?
134 public function __construct() {
135 $this->__table
= 'civicrm_pcp';
136 parent
::__construct();
140 * Returns localized title of this entity.
142 * @param bool $plural
143 * Whether to return the plural version of the title.
145 public static function getEntityTitle($plural = FALSE) {
146 return $plural ?
ts('PCPs') : ts('PCP');
150 * Returns foreign keys and entity references.
153 * [CRM_Core_Reference_Interface]
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']);
161 return Civi
::$statics[__CLASS__
]['links'];
165 * Returns all the column names of this table
169 public static function &fields() {
170 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
171 Civi
::$statics[__CLASS__
]['fields'] = [
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Personal Campaign Page ID'),
176 'description' => ts('Personal Campaign Page ID'),
178 'where' => 'civicrm_pcp.id',
179 'table_name' => 'civicrm_pcp',
181 'bao' => 'CRM_PCP_BAO_PCP',
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'),
191 'where' => 'civicrm_pcp.contact_id',
192 'table_name' => 'civicrm_pcp',
194 'bao' => 'CRM_PCP_BAO_PCP',
196 'FKClassName' => 'CRM_Contact_DAO_Contact',
198 'type' => 'EntityRef',
203 'name' => 'status_id',
204 'type' => CRM_Utils_Type
::T_INT
,
205 'title' => ts('Personal Campaign Page Status'),
207 'where' => 'civicrm_pcp.status_id',
208 'table_name' => 'civicrm_pcp',
210 'bao' => 'CRM_PCP_BAO_PCP',
215 'pseudoconstant' => [
216 'optionGroupName' => 'pcp_status',
217 'optionEditPath' => 'civicrm/admin/options/pcp_status',
223 'type' => CRM_Utils_Type
::T_STRING
,
224 'title' => ts('Personal Campaign Page Title'),
226 'size' => CRM_Utils_Type
::HUGE
,
227 'where' => 'civicrm_pcp.title',
229 'table_name' => 'civicrm_pcp',
231 'bao' => 'CRM_PCP_BAO_PCP',
239 'name' => 'intro_text',
240 'type' => CRM_Utils_Type
::T_TEXT
,
241 'title' => ts('Intro Text'),
242 'where' => 'civicrm_pcp.intro_text',
244 'table_name' => 'civicrm_pcp',
246 'bao' => 'CRM_PCP_BAO_PCP',
249 'type' => 'TextArea',
254 'name' => 'page_text',
255 'type' => CRM_Utils_Type
::T_TEXT
,
256 'title' => ts('Page Text'),
257 'where' => 'civicrm_pcp.page_text',
259 'table_name' => 'civicrm_pcp',
261 'bao' => 'CRM_PCP_BAO_PCP',
264 'type' => 'TextArea',
268 'donate_link_text' => [
269 'name' => 'donate_link_text',
270 'type' => CRM_Utils_Type
::T_STRING
,
271 'title' => ts('Donate Link Text'),
273 'size' => CRM_Utils_Type
::HUGE
,
274 'where' => 'civicrm_pcp.donate_link_text',
276 'table_name' => 'civicrm_pcp',
278 'bao' => 'CRM_PCP_BAO_PCP',
287 'type' => CRM_Utils_Type
::T_INT
,
288 'title' => ts('Contribution Page'),
289 'description' => ts('The Contribution or Event Page which triggered this pcp'),
291 'where' => 'civicrm_pcp.page_id',
292 'table_name' => 'civicrm_pcp',
294 'bao' => 'CRM_PCP_BAO_PCP',
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'),
304 'size' => CRM_Utils_Type
::BIG
,
305 'where' => 'civicrm_pcp.page_type',
306 'default' => 'contribute',
307 'table_name' => 'civicrm_pcp',
309 'bao' => 'CRM_PCP_BAO_PCP',
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'),
322 'where' => 'civicrm_pcp.pcp_block_id',
323 'table_name' => 'civicrm_pcp',
325 'bao' => 'CRM_PCP_BAO_PCP',
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',
335 'table_name' => 'civicrm_pcp',
337 'bao' => 'CRM_PCP_BAO_PCP',
340 'type' => 'CheckBox',
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',
350 'table_name' => 'civicrm_pcp',
352 'bao' => 'CRM_PCP_BAO_PCP',
355 'type' => 'CheckBox',
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.'),
368 'where' => 'civicrm_pcp.goal_amount',
369 'table_name' => 'civicrm_pcp',
371 'bao' => 'CRM_PCP_BAO_PCP',
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.'),
384 'size' => CRM_Utils_Type
::FOUR
,
385 'where' => 'civicrm_pcp.currency',
387 'table_name' => 'civicrm_pcp',
389 'bao' => 'CRM_PCP_BAO_PCP',
394 'pseudoconstant' => [
395 'table' => 'civicrm_currency',
396 'keyColumn' => 'name',
397 'labelColumn' => 'full_name',
398 'nameColumn' => 'name',
399 'abbrColumn' => 'symbol',
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',
410 'table_name' => 'civicrm_pcp',
412 'bao' => 'CRM_PCP_BAO_PCP',
415 'type' => 'CheckBox',
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',
426 'table_name' => 'civicrm_pcp',
428 'bao' => 'CRM_PCP_BAO_PCP',
431 'type' => 'CheckBox',
436 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
438 return Civi
::$statics[__CLASS__
]['fields'];
442 * Return a mapping from field-name to the corresponding key (as used in fields()).
445 * Array(string $name => string $uniqueName).
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()));
451 return Civi
::$statics[__CLASS__
]['fieldKeys'];
455 * Returns the names of this table
459 public static function getTableName() {
460 return self
::$_tableName;
464 * Returns if this table needs to be logged
468 public function getLog() {
473 * Returns the list of fields that can be imported
475 * @param bool $prefix
479 public static function &import($prefix = FALSE) {
480 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
485 * Returns the list of fields that can be exported
487 * @param bool $prefix
491 public static function &export($prefix = FALSE) {
492 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
497 * Returns the list of indices
499 * @param bool $localize
503 public static function indices($localize = TRUE) {
505 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;