5 * @copyright CiviCRM LLC (c) 2004-2018
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 static $_tableName = 'civicrm_pcp';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_pcp',
168 'bao' => 'CRM_PCP_BAO_PCP',
171 'pcp_contact_id' => [
172 'name' => 'contact_id',
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('Contact ID'),
175 'description' => ts('FK to Contact ID'),
177 'table_name' => 'civicrm_pcp',
179 'bao' => 'CRM_PCP_BAO_PCP',
181 'FKClassName' => 'CRM_Contact_DAO_Contact',
183 'type' => 'EntityRef',
187 'name' => 'status_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Personal Campaign Page Status'),
191 'table_name' => 'civicrm_pcp',
193 'bao' => 'CRM_PCP_BAO_PCP',
198 'pseudoconstant' => [
199 'optionGroupName' => 'pcp_status',
200 'optionEditPath' => 'civicrm/admin/options/pcp_status',
205 'type' => CRM_Utils_Type
::T_STRING
,
206 'title' => ts('Personal Campaign Page Title'),
208 'size' => CRM_Utils_Type
::HUGE
,
210 'table_name' => 'civicrm_pcp',
212 'bao' => 'CRM_PCP_BAO_PCP',
219 'name' => 'intro_text',
220 'type' => CRM_Utils_Type
::T_TEXT
,
221 'title' => ts('Intro Text'),
223 'table_name' => 'civicrm_pcp',
225 'bao' => 'CRM_PCP_BAO_PCP',
228 'type' => 'TextArea',
232 'name' => 'page_text',
233 'type' => CRM_Utils_Type
::T_TEXT
,
234 'title' => ts('Page Text'),
236 'table_name' => 'civicrm_pcp',
238 'bao' => 'CRM_PCP_BAO_PCP',
241 'type' => 'TextArea',
244 'donate_link_text' => [
245 'name' => 'donate_link_text',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Donate Link Text'),
249 'size' => CRM_Utils_Type
::HUGE
,
251 'table_name' => 'civicrm_pcp',
253 'bao' => 'CRM_PCP_BAO_PCP',
261 'type' => CRM_Utils_Type
::T_INT
,
262 'title' => ts('Contribution Page'),
263 'description' => ts('The Contribution or Event Page which triggered this pcp'),
265 'table_name' => 'civicrm_pcp',
267 'bao' => 'CRM_PCP_BAO_PCP',
271 'name' => 'page_type',
272 'type' => CRM_Utils_Type
::T_STRING
,
273 'title' => ts('PCP Page Type'),
274 'description' => ts('The type of PCP this is: contribute or event'),
276 'size' => CRM_Utils_Type
::BIG
,
277 'default' => 'contribute',
278 'table_name' => 'civicrm_pcp',
280 'bao' => 'CRM_PCP_BAO_PCP',
287 'name' => 'pcp_block_id',
288 'type' => CRM_Utils_Type
::T_INT
,
289 'title' => ts('PCP Block'),
290 'description' => ts('The pcp block that this pcp page was created from'),
292 'table_name' => 'civicrm_pcp',
294 'bao' => 'CRM_PCP_BAO_PCP',
297 'is_thermometer' => [
298 'name' => 'is_thermometer',
299 'type' => CRM_Utils_Type
::T_INT
,
300 'title' => ts('Use Thermometer?'),
302 'table_name' => 'civicrm_pcp',
304 'bao' => 'CRM_PCP_BAO_PCP',
307 'type' => 'CheckBox',
311 'name' => 'is_honor_roll',
312 'type' => CRM_Utils_Type
::T_INT
,
313 'title' => ts('Show Honor Roll?'),
315 'table_name' => 'civicrm_pcp',
317 'bao' => 'CRM_PCP_BAO_PCP',
320 'type' => 'CheckBox',
324 'name' => 'goal_amount',
325 'type' => CRM_Utils_Type
::T_MONEY
,
326 'title' => ts('Goal Amount'),
327 'description' => ts('Goal amount of this Personal Campaign Page.'),
332 'table_name' => 'civicrm_pcp',
334 'bao' => 'CRM_PCP_BAO_PCP',
341 'name' => 'currency',
342 'type' => CRM_Utils_Type
::T_STRING
,
343 'title' => ts('Currency'),
344 'description' => ts('3 character string, value from config setting or input via user.'),
346 'size' => CRM_Utils_Type
::FOUR
,
348 'table_name' => 'civicrm_pcp',
350 'bao' => 'CRM_PCP_BAO_PCP',
355 'pseudoconstant' => [
356 'table' => 'civicrm_currency',
357 'keyColumn' => 'name',
358 'labelColumn' => 'full_name',
359 'nameColumn' => 'name',
363 'name' => 'is_active',
364 'type' => CRM_Utils_Type
::T_BOOLEAN
,
365 'title' => ts('Enabled?'),
366 'description' => ts('Is Personal Campaign Page enabled/active?'),
368 'table_name' => 'civicrm_pcp',
370 'bao' => 'CRM_PCP_BAO_PCP',
373 'type' => 'CheckBox',
377 'name' => 'is_notify',
378 'type' => CRM_Utils_Type
::T_BOOLEAN
,
379 'title' => ts('Notify Owner?'),
380 'description' => ts('Notify owner via email when someone donates to page?'),
382 'table_name' => 'civicrm_pcp',
384 'bao' => 'CRM_PCP_BAO_PCP',
387 'type' => 'CheckBox',
391 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
393 return Civi
::$statics[__CLASS__
]['fields'];
397 * Return a mapping from field-name to the corresponding key (as used in fields()).
400 * Array(string $name => string $uniqueName).
402 public static function &fieldKeys() {
403 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
404 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
406 return Civi
::$statics[__CLASS__
]['fieldKeys'];
410 * Returns the names of this table
414 public static function getTableName() {
415 return self
::$_tableName;
419 * Returns if this table needs to be logged
423 public function getLog() {
428 * Returns the list of fields that can be imported
430 * @param bool $prefix
434 public static function &import($prefix = FALSE) {
435 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
440 * Returns the list of fields that can be exported
442 * @param bool $prefix
446 public static function &export($prefix = FALSE) {
447 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
452 * Returns the list of indices
454 * @param bool $localize
458 public static function indices($localize = TRUE) {
460 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;