CRM-20312 regenerated DAOS with indexes
[civicrm-core.git] / CRM / PCP / DAO / PCP.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/PCP/PCP.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:55283776659b636af6e8511f8978d660)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_PCP_DAO_PCP constructor.
39 */
e501603b
TO
40class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_pcp';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Personal Campaign Page ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * FK to Contact ID
61 *
62 * @var int unsigned
63 */
64 public $contact_id;
65 /**
66 *
67 * @var int unsigned
68 */
69 public $status_id;
70 /**
71 *
72 * @var string
73 */
74 public $title;
75 /**
76 *
77 * @var text
78 */
79 public $intro_text;
80 /**
81 *
82 * @var text
83 */
84 public $page_text;
85 /**
86 *
87 * @var string
88 */
89 public $donate_link_text;
90 /**
91 * The Contribution or Event Page which triggered this pcp
92 *
93 * @var int unsigned
94 */
95 public $page_id;
96 /**
97 * The type of PCP this is: contribute or event
98 *
99 * @var string
100 */
101 public $page_type;
102 /**
103 * The pcp block that this pcp page was created from
104 *
105 * @var int unsigned
106 */
107 public $pcp_block_id;
108 /**
109 *
110 * @var int unsigned
111 */
112 public $is_thermometer;
113 /**
114 *
115 * @var int unsigned
116 */
117 public $is_honor_roll;
118 /**
119 * Goal amount of this Personal Campaign Page.
120 *
121 * @var float
122 */
123 public $goal_amount;
124 /**
125 * 3 character string, value from config setting or input via user.
126 *
127 * @var string
128 */
129 public $currency;
130 /**
131 * Is Personal Campaign Page enabled/active?
132 *
133 * @var boolean
134 */
135 public $is_active;
136 /**
137 * Notify owner via email when someone donates to page?
138 *
139 * @var boolean
140 */
141 public $is_notify;
142 /**
f41f0342 143 * Class constructor.
e501603b
TO
144 */
145 function __construct() {
146 $this->__table = 'civicrm_pcp';
147 parent::__construct();
148 }
149 /**
f41f0342 150 * Returns foreign keys and entity references.
e501603b
TO
151 *
152 * @return array
153 * [CRM_Core_Reference_Interface]
154 */
155 static function getReferenceColumns() {
346aaaba
TO
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']);
e501603b 160 }
346aaaba 161 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
162 }
163 /**
164 * Returns all the column names of this table
165 *
166 * @return array
167 */
168 static function &fields() {
346aaaba
TO
169 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
170 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
171 'pcp_id' => array(
172 'name' => 'id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Personal Campaign Page ID') ,
175 'description' => 'Personal Campaign Page ID',
176 'required' => true,
522a26c9 177 'table_name' => 'civicrm_pcp',
178 'entity' => 'PCP',
179 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 180 'localizable' => 0,
e501603b
TO
181 ) ,
182 'pcp_contact_id' => array(
183 'name' => 'contact_id',
184 'type' => CRM_Utils_Type::T_INT,
185 'title' => ts('Contact ID') ,
186 'description' => 'FK to Contact ID',
187 'required' => true,
522a26c9 188 'table_name' => 'civicrm_pcp',
189 'entity' => 'PCP',
190 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 191 'localizable' => 0,
e501603b
TO
192 'FKClassName' => 'CRM_Contact_DAO_Contact',
193 'html' => array(
194 'type' => 'EntityRef',
195 ) ,
196 ) ,
197 'status_id' => array(
198 'name' => 'status_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Personal Campaign Page Status') ,
201 'required' => true,
522a26c9 202 'table_name' => 'civicrm_pcp',
203 'entity' => 'PCP',
204 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 205 'localizable' => 0,
e501603b
TO
206 'html' => array(
207 'type' => 'Select',
208 ) ,
209 'pseudoconstant' => array(
210 'optionGroupName' => 'pcp_status',
211 'optionEditPath' => 'civicrm/admin/options/pcp_status',
212 )
213 ) ,
214 'title' => array(
215 'name' => 'title',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('Personal Campaign Page Title') ,
218 'maxlength' => 255,
219 'size' => CRM_Utils_Type::HUGE,
220 'default' => 'NULL',
522a26c9 221 'table_name' => 'civicrm_pcp',
222 'entity' => 'PCP',
223 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 224 'localizable' => 0,
e501603b
TO
225 'html' => array(
226 'type' => 'Text',
227 ) ,
228 ) ,
229 'intro_text' => array(
230 'name' => 'intro_text',
231 'type' => CRM_Utils_Type::T_TEXT,
232 'title' => ts('Intro Text') ,
233 'default' => 'NULL',
522a26c9 234 'table_name' => 'civicrm_pcp',
235 'entity' => 'PCP',
236 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 237 'localizable' => 0,
e501603b
TO
238 'html' => array(
239 'type' => 'TexArea',
240 ) ,
241 ) ,
242 'page_text' => array(
243 'name' => 'page_text',
244 'type' => CRM_Utils_Type::T_TEXT,
245 'title' => ts('Page Text') ,
246 'default' => 'NULL',
522a26c9 247 'table_name' => 'civicrm_pcp',
248 'entity' => 'PCP',
249 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 250 'localizable' => 0,
e501603b
TO
251 'html' => array(
252 'type' => 'TexArea',
253 ) ,
254 ) ,
255 'donate_link_text' => array(
256 'name' => 'donate_link_text',
257 'type' => CRM_Utils_Type::T_STRING,
258 'title' => ts('Donate Link Text') ,
259 'maxlength' => 255,
260 'size' => CRM_Utils_Type::HUGE,
261 'default' => 'NULL',
522a26c9 262 'table_name' => 'civicrm_pcp',
263 'entity' => 'PCP',
264 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 265 'localizable' => 0,
e501603b
TO
266 'html' => array(
267 'type' => 'Text',
268 ) ,
269 ) ,
270 'page_id' => array(
271 'name' => 'page_id',
272 'type' => CRM_Utils_Type::T_INT,
273 'title' => ts('Contribution Page') ,
274 'description' => 'The Contribution or Event Page which triggered this pcp',
275 'required' => true,
522a26c9 276 'table_name' => 'civicrm_pcp',
277 'entity' => 'PCP',
278 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 279 'localizable' => 0,
e501603b
TO
280 ) ,
281 'page_type' => array(
282 'name' => 'page_type',
283 'type' => CRM_Utils_Type::T_STRING,
284 'title' => ts('PCP Page Type') ,
285 'description' => 'The type of PCP this is: contribute or event',
286 'maxlength' => 64,
287 'size' => CRM_Utils_Type::BIG,
288 'default' => 'contribute',
522a26c9 289 'table_name' => 'civicrm_pcp',
290 'entity' => 'PCP',
291 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 292 'localizable' => 0,
e501603b
TO
293 'html' => array(
294 'type' => 'Select',
295 ) ,
296 ) ,
297 'pcp_block_id' => array(
298 'name' => 'pcp_block_id',
299 'type' => CRM_Utils_Type::T_INT,
300 'title' => ts('PCP Block') ,
301 'description' => 'The pcp block that this pcp page was created from',
302 'required' => true,
522a26c9 303 'table_name' => 'civicrm_pcp',
304 'entity' => 'PCP',
305 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 306 'localizable' => 0,
e501603b
TO
307 ) ,
308 'is_thermometer' => array(
309 'name' => 'is_thermometer',
310 'type' => CRM_Utils_Type::T_INT,
311 'title' => ts('Use Thermometer?') ,
522a26c9 312 'table_name' => 'civicrm_pcp',
313 'entity' => 'PCP',
314 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 315 'localizable' => 0,
e501603b
TO
316 'html' => array(
317 'type' => 'CheckBox',
318 ) ,
319 ) ,
320 'is_honor_roll' => array(
321 'name' => 'is_honor_roll',
322 'type' => CRM_Utils_Type::T_INT,
323 'title' => ts('Show Honor Roll?') ,
522a26c9 324 'table_name' => 'civicrm_pcp',
325 'entity' => 'PCP',
326 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 327 'localizable' => 0,
e501603b
TO
328 'html' => array(
329 'type' => 'CheckBox',
330 ) ,
331 ) ,
332 'goal_amount' => array(
333 'name' => 'goal_amount',
334 'type' => CRM_Utils_Type::T_MONEY,
335 'title' => ts('Goal Amount') ,
336 'description' => 'Goal amount of this Personal Campaign Page.',
337 'precision' => array(
338 20,
339 2
340 ) ,
522a26c9 341 'table_name' => 'civicrm_pcp',
342 'entity' => 'PCP',
343 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 344 'localizable' => 0,
e501603b
TO
345 'html' => array(
346 'type' => 'Text',
347 ) ,
348 ) ,
349 'currency' => array(
350 'name' => 'currency',
351 'type' => CRM_Utils_Type::T_STRING,
352 'title' => ts('Currency') ,
353 'description' => '3 character string, value from config setting or input via user.',
354 'maxlength' => 3,
355 'size' => CRM_Utils_Type::FOUR,
356 'default' => 'NULL',
522a26c9 357 'table_name' => 'civicrm_pcp',
358 'entity' => 'PCP',
359 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 360 'localizable' => 0,
e501603b
TO
361 'html' => array(
362 'type' => 'Select',
363 ) ,
364 'pseudoconstant' => array(
365 'table' => 'civicrm_currency',
366 'keyColumn' => 'name',
367 'labelColumn' => 'full_name',
368 'nameColumn' => 'name',
369 )
370 ) ,
371 'is_active' => array(
372 'name' => 'is_active',
373 'type' => CRM_Utils_Type::T_BOOLEAN,
374 'title' => ts('Enabled?') ,
375 'description' => 'Is Personal Campaign Page enabled/active?',
522a26c9 376 'table_name' => 'civicrm_pcp',
377 'entity' => 'PCP',
378 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 379 'localizable' => 0,
e501603b
TO
380 'html' => array(
381 'type' => 'CheckBox',
382 ) ,
383 ) ,
384 'is_notify' => array(
385 'name' => 'is_notify',
386 'type' => CRM_Utils_Type::T_BOOLEAN,
387 'title' => ts('Notify Owner?') ,
388 'description' => 'Notify owner via email when someone donates to page?',
522a26c9 389 'table_name' => 'civicrm_pcp',
390 'entity' => 'PCP',
391 'bao' => 'CRM_PCP_BAO_PCP',
6a7e5e5d 392 'localizable' => 0,
e501603b
TO
393 'html' => array(
394 'type' => 'CheckBox',
395 ) ,
396 ) ,
397 );
346aaaba 398 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 399 }
346aaaba 400 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
401 }
402 /**
bd8e0b14 403 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
404 *
405 * @return array
bd8e0b14 406 * Array(string $name => string $uniqueName).
e501603b
TO
407 */
408 static function &fieldKeys() {
bd8e0b14
TO
409 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
410 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 411 }
bd8e0b14 412 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
413 }
414 /**
415 * Returns the names of this table
416 *
417 * @return string
418 */
419 static function getTableName() {
420 return self::$_tableName;
421 }
422 /**
423 * Returns if this table needs to be logged
424 *
425 * @return boolean
426 */
427 function getLog() {
428 return self::$_log;
429 }
430 /**
431 * Returns the list of fields that can be imported
432 *
433 * @param bool $prefix
434 *
435 * @return array
436 */
437 static function &import($prefix = false) {
60808919
TO
438 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, array());
439 return $r;
e501603b
TO
440 }
441 /**
442 * Returns the list of fields that can be exported
443 *
444 * @param bool $prefix
445 *
446 * @return array
447 */
448 static function &export($prefix = false) {
60808919
TO
449 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, array());
450 return $r;
e501603b 451 }
e7a6b91a
AS
452 /**
453 * Returns the list of indices
454 */
455 public static function indices($localize = TRUE) {
456 $indices = array();
457 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
458 }
e501603b 459}