Merge pull request #14302 from mlutfy/drupal19
[civicrm-core.git] / CRM / PCP / DAO / PCP.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e130d04d9fad8bcec628fac504ff9da7)
10 */
11
12 /**
13 * Database access object for the PCP entity.
14 */
15 class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_pcp';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Personal Campaign Page ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int
42 */
43 public $contact_id;
44
45 /**
46 * @var int
47 */
48 public $status_id;
49
50 /**
51 * @var string
52 */
53 public $title;
54
55 /**
56 * @var text
57 */
58 public $intro_text;
59
60 /**
61 * @var text
62 */
63 public $page_text;
64
65 /**
66 * @var string
67 */
68 public $donate_link_text;
69
70 /**
71 * The Contribution or Event Page which triggered this pcp
72 *
73 * @var int
74 */
75 public $page_id;
76
77 /**
78 * The type of PCP this is: contribute or event
79 *
80 * @var string
81 */
82 public $page_type;
83
84 /**
85 * The pcp block that this pcp page was created from
86 *
87 * @var int
88 */
89 public $pcp_block_id;
90
91 /**
92 * @var int
93 */
94 public $is_thermometer;
95
96 /**
97 * @var int
98 */
99 public $is_honor_roll;
100
101 /**
102 * Goal amount of this Personal Campaign Page.
103 *
104 * @var float
105 */
106 public $goal_amount;
107
108 /**
109 * 3 character string, value from config setting or input via user.
110 *
111 * @var string
112 */
113 public $currency;
114
115 /**
116 * Is Personal Campaign Page enabled/active?
117 *
118 * @var bool
119 */
120 public $is_active;
121
122 /**
123 * Notify owner via email when someone donates to page?
124 *
125 * @var bool
126 */
127 public $is_notify;
128
129 /**
130 * Class constructor.
131 */
132 public function __construct() {
133 $this->__table = 'civicrm_pcp';
134 parent::__construct();
135 }
136
137 /**
138 * Returns foreign keys and entity references.
139 *
140 * @return array
141 * [CRM_Core_Reference_Interface]
142 */
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']);
148 }
149 return Civi::$statics[__CLASS__]['links'];
150 }
151
152 /**
153 * Returns all the column names of this table
154 *
155 * @return array
156 */
157 public static function &fields() {
158 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
159 Civi::$statics[__CLASS__]['fields'] = [
160 'pcp_id' => [
161 'name' => 'id',
162 'type' => CRM_Utils_Type::T_INT,
163 'title' => ts('Personal Campaign Page ID'),
164 'description' => ts('Personal Campaign Page ID'),
165 'required' => TRUE,
166 'where' => 'civicrm_pcp.id',
167 'table_name' => 'civicrm_pcp',
168 'entity' => 'PCP',
169 'bao' => 'CRM_PCP_BAO_PCP',
170 'localizable' => 0,
171 ],
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'),
177 'required' => TRUE,
178 'where' => 'civicrm_pcp.contact_id',
179 'table_name' => 'civicrm_pcp',
180 'entity' => 'PCP',
181 'bao' => 'CRM_PCP_BAO_PCP',
182 'localizable' => 0,
183 'FKClassName' => 'CRM_Contact_DAO_Contact',
184 'html' => [
185 'type' => 'EntityRef',
186 ],
187 ],
188 'status_id' => [
189 'name' => 'status_id',
190 'type' => CRM_Utils_Type::T_INT,
191 'title' => ts('Personal Campaign Page Status'),
192 'required' => TRUE,
193 'where' => 'civicrm_pcp.status_id',
194 'table_name' => 'civicrm_pcp',
195 'entity' => 'PCP',
196 'bao' => 'CRM_PCP_BAO_PCP',
197 'localizable' => 0,
198 'html' => [
199 'type' => 'Select',
200 ],
201 'pseudoconstant' => [
202 'optionGroupName' => 'pcp_status',
203 'optionEditPath' => 'civicrm/admin/options/pcp_status',
204 ],
205 ],
206 'title' => [
207 'name' => 'title',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('Personal Campaign Page Title'),
210 'maxlength' => 255,
211 'size' => CRM_Utils_Type::HUGE,
212 'where' => 'civicrm_pcp.title',
213 'default' => 'NULL',
214 'table_name' => 'civicrm_pcp',
215 'entity' => 'PCP',
216 'bao' => 'CRM_PCP_BAO_PCP',
217 'localizable' => 0,
218 'html' => [
219 'type' => 'Text',
220 ],
221 ],
222 'intro_text' => [
223 'name' => 'intro_text',
224 'type' => CRM_Utils_Type::T_TEXT,
225 'title' => ts('Intro Text'),
226 'where' => 'civicrm_pcp.intro_text',
227 'default' => 'NULL',
228 'table_name' => 'civicrm_pcp',
229 'entity' => 'PCP',
230 'bao' => 'CRM_PCP_BAO_PCP',
231 'localizable' => 0,
232 'html' => [
233 'type' => 'TextArea',
234 ],
235 ],
236 'page_text' => [
237 'name' => 'page_text',
238 'type' => CRM_Utils_Type::T_TEXT,
239 'title' => ts('Page Text'),
240 'where' => 'civicrm_pcp.page_text',
241 'default' => 'NULL',
242 'table_name' => 'civicrm_pcp',
243 'entity' => 'PCP',
244 'bao' => 'CRM_PCP_BAO_PCP',
245 'localizable' => 0,
246 'html' => [
247 'type' => 'TextArea',
248 ],
249 ],
250 'donate_link_text' => [
251 'name' => 'donate_link_text',
252 'type' => CRM_Utils_Type::T_STRING,
253 'title' => ts('Donate Link Text'),
254 'maxlength' => 255,
255 'size' => CRM_Utils_Type::HUGE,
256 'where' => 'civicrm_pcp.donate_link_text',
257 'default' => 'NULL',
258 'table_name' => 'civicrm_pcp',
259 'entity' => 'PCP',
260 'bao' => 'CRM_PCP_BAO_PCP',
261 'localizable' => 0,
262 'html' => [
263 'type' => 'Text',
264 ],
265 ],
266 'page_id' => [
267 'name' => 'page_id',
268 'type' => CRM_Utils_Type::T_INT,
269 'title' => ts('Contribution Page'),
270 'description' => ts('The Contribution or Event Page which triggered this pcp'),
271 'required' => TRUE,
272 'where' => 'civicrm_pcp.page_id',
273 'table_name' => 'civicrm_pcp',
274 'entity' => 'PCP',
275 'bao' => 'CRM_PCP_BAO_PCP',
276 'localizable' => 0,
277 ],
278 'page_type' => [
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'),
283 'maxlength' => 64,
284 'size' => CRM_Utils_Type::BIG,
285 'where' => 'civicrm_pcp.page_type',
286 'default' => 'contribute',
287 'table_name' => 'civicrm_pcp',
288 'entity' => 'PCP',
289 'bao' => 'CRM_PCP_BAO_PCP',
290 'localizable' => 0,
291 'html' => [
292 'type' => 'Select',
293 ],
294 ],
295 'pcp_block_id' => [
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'),
300 'required' => TRUE,
301 'where' => 'civicrm_pcp.pcp_block_id',
302 'table_name' => 'civicrm_pcp',
303 'entity' => 'PCP',
304 'bao' => 'CRM_PCP_BAO_PCP',
305 'localizable' => 0,
306 ],
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',
312 'default' => '0',
313 'table_name' => 'civicrm_pcp',
314 'entity' => 'PCP',
315 'bao' => 'CRM_PCP_BAO_PCP',
316 'localizable' => 0,
317 'html' => [
318 'type' => 'CheckBox',
319 ],
320 ],
321 'is_honor_roll' => [
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',
326 'default' => '0',
327 'table_name' => 'civicrm_pcp',
328 'entity' => 'PCP',
329 'bao' => 'CRM_PCP_BAO_PCP',
330 'localizable' => 0,
331 'html' => [
332 'type' => 'CheckBox',
333 ],
334 ],
335 'goal_amount' => [
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.'),
340 'precision' => [
341 20,
342 2,
343 ],
344 'where' => 'civicrm_pcp.goal_amount',
345 'table_name' => 'civicrm_pcp',
346 'entity' => 'PCP',
347 'bao' => 'CRM_PCP_BAO_PCP',
348 'localizable' => 0,
349 'html' => [
350 'type' => 'Text',
351 ],
352 ],
353 'currency' => [
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.'),
358 'maxlength' => 3,
359 'size' => CRM_Utils_Type::FOUR,
360 'where' => 'civicrm_pcp.currency',
361 'default' => 'NULL',
362 'table_name' => 'civicrm_pcp',
363 'entity' => 'PCP',
364 'bao' => 'CRM_PCP_BAO_PCP',
365 'localizable' => 0,
366 'html' => [
367 'type' => 'Select',
368 ],
369 'pseudoconstant' => [
370 'table' => 'civicrm_currency',
371 'keyColumn' => 'name',
372 'labelColumn' => 'full_name',
373 'nameColumn' => 'name',
374 ],
375 ],
376 'is_active' => [
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',
382 'default' => '0',
383 'table_name' => 'civicrm_pcp',
384 'entity' => 'PCP',
385 'bao' => 'CRM_PCP_BAO_PCP',
386 'localizable' => 0,
387 'html' => [
388 'type' => 'CheckBox',
389 ],
390 ],
391 'is_notify' => [
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',
397 'default' => '0',
398 'table_name' => 'civicrm_pcp',
399 'entity' => 'PCP',
400 'bao' => 'CRM_PCP_BAO_PCP',
401 'localizable' => 0,
402 'html' => [
403 'type' => 'CheckBox',
404 ],
405 ],
406 ];
407 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
408 }
409 return Civi::$statics[__CLASS__]['fields'];
410 }
411
412 /**
413 * Return a mapping from field-name to the corresponding key (as used in fields()).
414 *
415 * @return array
416 * Array(string $name => string $uniqueName).
417 */
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()));
421 }
422 return Civi::$statics[__CLASS__]['fieldKeys'];
423 }
424
425 /**
426 * Returns the names of this table
427 *
428 * @return string
429 */
430 public static function getTableName() {
431 return self::$_tableName;
432 }
433
434 /**
435 * Returns if this table needs to be logged
436 *
437 * @return bool
438 */
439 public function getLog() {
440 return self::$_log;
441 }
442
443 /**
444 * Returns the list of fields that can be imported
445 *
446 * @param bool $prefix
447 *
448 * @return array
449 */
450 public static function &import($prefix = FALSE) {
451 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, []);
452 return $r;
453 }
454
455 /**
456 * Returns the list of fields that can be exported
457 *
458 * @param bool $prefix
459 *
460 * @return array
461 */
462 public static function &export($prefix = FALSE) {
463 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, []);
464 return $r;
465 }
466
467 /**
468 * Returns the list of indices
469 *
470 * @param bool $localize
471 *
472 * @return array
473 */
474 public static function indices($localize = TRUE) {
475 $indices = [];
476 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
477 }
478
479 }