5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4585e6f51f50242cba89fe9325c44c44)
13 * Database access object for the PCP entity.
15 class CRM_PCP_DAO_PCP
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_pcp';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
32 * Personal Campaign Page ID
68 public $donate_link_text;
71 * The Contribution or Event Page which triggered this pcp
78 * The type of PCP this is: contribute or event
85 * The pcp block that this pcp page was created from
94 public $is_thermometer;
99 public $is_honor_roll;
102 * Goal amount of this Personal Campaign Page.
109 * 3 character string, value from config setting or input via user.
116 * Is Personal Campaign Page enabled/active?
123 * Notify owner via email when someone donates to page?
132 public function __construct() {
133 $this->__table
= 'civicrm_pcp';
134 parent
::__construct();
138 * Returns foreign keys and entity references.
141 * [CRM_Core_Reference_Interface]
143 public static function getReferenceColumns() {
144 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
145 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
146 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
147 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
149 return Civi
::$statics[__CLASS__
]['links'];
153 * Returns all the column names of this table
157 public static function &fields() {
158 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
159 Civi
::$statics[__CLASS__
]['fields'] = [
162 'type' => CRM_Utils_Type
::T_INT
,
163 'title' => ts('Personal Campaign Page ID'),
164 'description' => ts('Personal Campaign Page ID'),
166 'where' => 'civicrm_pcp.id',
167 'table_name' => 'civicrm_pcp',
169 'bao' => 'CRM_PCP_BAO_PCP',
172 'pcp_contact_id' => [
173 'name' => 'contact_id',
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Contact ID'),
176 'description' => ts('FK to Contact ID'),
178 'where' => 'civicrm_pcp.contact_id',
179 'table_name' => 'civicrm_pcp',
181 'bao' => 'CRM_PCP_BAO_PCP',
183 'FKClassName' => 'CRM_Contact_DAO_Contact',
185 'type' => 'EntityRef',
189 'name' => 'status_id',
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Personal Campaign Page Status'),
193 'where' => 'civicrm_pcp.status_id',
194 'table_name' => 'civicrm_pcp',
196 'bao' => 'CRM_PCP_BAO_PCP',
201 'pseudoconstant' => [
202 'optionGroupName' => 'pcp_status',
203 'optionEditPath' => 'civicrm/admin/options/pcp_status',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Personal Campaign Page Title'),
211 'size' => CRM_Utils_Type
::HUGE
,
212 'where' => 'civicrm_pcp.title',
214 'table_name' => 'civicrm_pcp',
216 'bao' => 'CRM_PCP_BAO_PCP',
223 'name' => 'intro_text',
224 'type' => CRM_Utils_Type
::T_TEXT
,
225 'title' => ts('Intro Text'),
226 'where' => 'civicrm_pcp.intro_text',
228 'table_name' => 'civicrm_pcp',
230 'bao' => 'CRM_PCP_BAO_PCP',
233 'type' => 'TextArea',
237 'name' => 'page_text',
238 'type' => CRM_Utils_Type
::T_TEXT
,
239 'title' => ts('Page Text'),
240 'where' => 'civicrm_pcp.page_text',
242 'table_name' => 'civicrm_pcp',
244 'bao' => 'CRM_PCP_BAO_PCP',
247 'type' => 'TextArea',
250 'donate_link_text' => [
251 'name' => 'donate_link_text',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Donate Link Text'),
255 'size' => CRM_Utils_Type
::HUGE
,
256 'where' => 'civicrm_pcp.donate_link_text',
258 'table_name' => 'civicrm_pcp',
260 'bao' => 'CRM_PCP_BAO_PCP',
268 'type' => CRM_Utils_Type
::T_INT
,
269 'title' => ts('Contribution Page'),
270 'description' => ts('The Contribution or Event Page which triggered this pcp'),
272 'where' => 'civicrm_pcp.page_id',
273 'table_name' => 'civicrm_pcp',
275 'bao' => 'CRM_PCP_BAO_PCP',
279 'name' => 'page_type',
280 'type' => CRM_Utils_Type
::T_STRING
,
281 'title' => ts('PCP Page Type'),
282 'description' => ts('The type of PCP this is: contribute or event'),
284 'size' => CRM_Utils_Type
::BIG
,
285 'where' => 'civicrm_pcp.page_type',
286 'default' => 'contribute',
287 'table_name' => 'civicrm_pcp',
289 'bao' => 'CRM_PCP_BAO_PCP',
296 'name' => 'pcp_block_id',
297 'type' => CRM_Utils_Type
::T_INT
,
298 'title' => ts('PCP Block'),
299 'description' => ts('The pcp block that this pcp page was created from'),
301 'where' => 'civicrm_pcp.pcp_block_id',
302 'table_name' => 'civicrm_pcp',
304 'bao' => 'CRM_PCP_BAO_PCP',
307 'is_thermometer' => [
308 'name' => 'is_thermometer',
309 'type' => CRM_Utils_Type
::T_INT
,
310 'title' => ts('Use Thermometer?'),
311 'where' => 'civicrm_pcp.is_thermometer',
313 'table_name' => 'civicrm_pcp',
315 'bao' => 'CRM_PCP_BAO_PCP',
318 'type' => 'CheckBox',
322 'name' => 'is_honor_roll',
323 'type' => CRM_Utils_Type
::T_INT
,
324 'title' => ts('Show Honor Roll?'),
325 'where' => 'civicrm_pcp.is_honor_roll',
327 'table_name' => 'civicrm_pcp',
329 'bao' => 'CRM_PCP_BAO_PCP',
332 'type' => 'CheckBox',
336 'name' => 'goal_amount',
337 'type' => CRM_Utils_Type
::T_MONEY
,
338 'title' => ts('Goal Amount'),
339 'description' => ts('Goal amount of this Personal Campaign Page.'),
344 'where' => 'civicrm_pcp.goal_amount',
345 'table_name' => 'civicrm_pcp',
347 'bao' => 'CRM_PCP_BAO_PCP',
354 'name' => 'currency',
355 'type' => CRM_Utils_Type
::T_STRING
,
356 'title' => ts('Currency'),
357 'description' => ts('3 character string, value from config setting or input via user.'),
359 'size' => CRM_Utils_Type
::FOUR
,
360 'where' => 'civicrm_pcp.currency',
362 'table_name' => 'civicrm_pcp',
364 'bao' => 'CRM_PCP_BAO_PCP',
369 'pseudoconstant' => [
370 'table' => 'civicrm_currency',
371 'keyColumn' => 'name',
372 'labelColumn' => 'full_name',
373 'nameColumn' => 'name',
377 'name' => 'is_active',
378 'type' => CRM_Utils_Type
::T_BOOLEAN
,
379 'title' => ts('Enabled?'),
380 'description' => ts('Is Personal Campaign Page enabled/active?'),
381 'where' => 'civicrm_pcp.is_active',
383 'table_name' => 'civicrm_pcp',
385 'bao' => 'CRM_PCP_BAO_PCP',
388 'type' => 'CheckBox',
392 'name' => 'is_notify',
393 'type' => CRM_Utils_Type
::T_BOOLEAN
,
394 'title' => ts('Notify Owner?'),
395 'description' => ts('Notify owner via email when someone donates to page?'),
396 'where' => 'civicrm_pcp.is_notify',
398 'table_name' => 'civicrm_pcp',
400 'bao' => 'CRM_PCP_BAO_PCP',
403 'type' => 'CheckBox',
407 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
409 return Civi
::$statics[__CLASS__
]['fields'];
413 * Return a mapping from field-name to the corresponding key (as used in fields()).
416 * Array(string $name => string $uniqueName).
418 public static function &fieldKeys() {
419 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
420 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
422 return Civi
::$statics[__CLASS__
]['fieldKeys'];
426 * Returns the names of this table
430 public static function getTableName() {
431 return self
::$_tableName;
435 * Returns if this table needs to be logged
439 public function getLog() {
444 * Returns the list of fields that can be imported
446 * @param bool $prefix
450 public static function &import($prefix = FALSE) {
451 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
456 * Returns the list of fields that can be exported
458 * @param bool $prefix
462 public static function &export($prefix = FALSE) {
463 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
468 * Returns the list of indices
470 * @param bool $localize
474 public static function indices($localize = TRUE) {
476 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;