Commit | Line | Data |
---|---|---|
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 | |
522a26c9 | 33 | * (GenCodeChecksum:b0ad3c4d4285b2ea74ea434530fa6f64) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_PCP_DAO_PCP constructor. | |
39 | */ | |
e501603b TO |
40 | class 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', | |
e501603b TO |
180 | ) , |
181 | 'pcp_contact_id' => array( | |
182 | 'name' => 'contact_id', | |
183 | 'type' => CRM_Utils_Type::T_INT, | |
184 | 'title' => ts('Contact ID') , | |
185 | 'description' => 'FK to Contact ID', | |
186 | 'required' => true, | |
522a26c9 | 187 | 'table_name' => 'civicrm_pcp', |
188 | 'entity' => 'PCP', | |
189 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
190 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
191 | 'html' => array( | |
192 | 'type' => 'EntityRef', | |
193 | ) , | |
194 | ) , | |
195 | 'status_id' => array( | |
196 | 'name' => 'status_id', | |
197 | 'type' => CRM_Utils_Type::T_INT, | |
198 | 'title' => ts('Personal Campaign Page Status') , | |
199 | 'required' => true, | |
522a26c9 | 200 | 'table_name' => 'civicrm_pcp', |
201 | 'entity' => 'PCP', | |
202 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
203 | 'html' => array( |
204 | 'type' => 'Select', | |
205 | ) , | |
206 | 'pseudoconstant' => array( | |
207 | 'optionGroupName' => 'pcp_status', | |
208 | 'optionEditPath' => 'civicrm/admin/options/pcp_status', | |
209 | ) | |
210 | ) , | |
211 | 'title' => array( | |
212 | 'name' => 'title', | |
213 | 'type' => CRM_Utils_Type::T_STRING, | |
214 | 'title' => ts('Personal Campaign Page Title') , | |
215 | 'maxlength' => 255, | |
216 | 'size' => CRM_Utils_Type::HUGE, | |
217 | 'default' => 'NULL', | |
522a26c9 | 218 | 'table_name' => 'civicrm_pcp', |
219 | 'entity' => 'PCP', | |
220 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
221 | 'html' => array( |
222 | 'type' => 'Text', | |
223 | ) , | |
224 | ) , | |
225 | 'intro_text' => array( | |
226 | 'name' => 'intro_text', | |
227 | 'type' => CRM_Utils_Type::T_TEXT, | |
228 | 'title' => ts('Intro Text') , | |
229 | 'default' => 'NULL', | |
522a26c9 | 230 | 'table_name' => 'civicrm_pcp', |
231 | 'entity' => 'PCP', | |
232 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
233 | 'html' => array( |
234 | 'type' => 'TexArea', | |
235 | ) , | |
236 | ) , | |
237 | 'page_text' => array( | |
238 | 'name' => 'page_text', | |
239 | 'type' => CRM_Utils_Type::T_TEXT, | |
240 | 'title' => ts('Page Text') , | |
241 | 'default' => 'NULL', | |
522a26c9 | 242 | 'table_name' => 'civicrm_pcp', |
243 | 'entity' => 'PCP', | |
244 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
245 | 'html' => array( |
246 | 'type' => 'TexArea', | |
247 | ) , | |
248 | ) , | |
249 | 'donate_link_text' => array( | |
250 | 'name' => 'donate_link_text', | |
251 | 'type' => CRM_Utils_Type::T_STRING, | |
252 | 'title' => ts('Donate Link Text') , | |
253 | 'maxlength' => 255, | |
254 | 'size' => CRM_Utils_Type::HUGE, | |
255 | 'default' => 'NULL', | |
522a26c9 | 256 | 'table_name' => 'civicrm_pcp', |
257 | 'entity' => 'PCP', | |
258 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
259 | 'html' => array( |
260 | 'type' => 'Text', | |
261 | ) , | |
262 | ) , | |
263 | 'page_id' => array( | |
264 | 'name' => 'page_id', | |
265 | 'type' => CRM_Utils_Type::T_INT, | |
266 | 'title' => ts('Contribution Page') , | |
267 | 'description' => 'The Contribution or Event Page which triggered this pcp', | |
268 | 'required' => true, | |
522a26c9 | 269 | 'table_name' => 'civicrm_pcp', |
270 | 'entity' => 'PCP', | |
271 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
272 | ) , |
273 | 'page_type' => array( | |
274 | 'name' => 'page_type', | |
275 | 'type' => CRM_Utils_Type::T_STRING, | |
276 | 'title' => ts('PCP Page Type') , | |
277 | 'description' => 'The type of PCP this is: contribute or event', | |
278 | 'maxlength' => 64, | |
279 | 'size' => CRM_Utils_Type::BIG, | |
280 | 'default' => 'contribute', | |
522a26c9 | 281 | 'table_name' => 'civicrm_pcp', |
282 | 'entity' => 'PCP', | |
283 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
284 | 'html' => array( |
285 | 'type' => 'Select', | |
286 | ) , | |
287 | ) , | |
288 | 'pcp_block_id' => array( | |
289 | 'name' => 'pcp_block_id', | |
290 | 'type' => CRM_Utils_Type::T_INT, | |
291 | 'title' => ts('PCP Block') , | |
292 | 'description' => 'The pcp block that this pcp page was created from', | |
293 | 'required' => true, | |
522a26c9 | 294 | 'table_name' => 'civicrm_pcp', |
295 | 'entity' => 'PCP', | |
296 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
297 | ) , |
298 | 'is_thermometer' => array( | |
299 | 'name' => 'is_thermometer', | |
300 | 'type' => CRM_Utils_Type::T_INT, | |
301 | 'title' => ts('Use Thermometer?') , | |
522a26c9 | 302 | 'table_name' => 'civicrm_pcp', |
303 | 'entity' => 'PCP', | |
304 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
305 | 'html' => array( |
306 | 'type' => 'CheckBox', | |
307 | ) , | |
308 | ) , | |
309 | 'is_honor_roll' => array( | |
310 | 'name' => 'is_honor_roll', | |
311 | 'type' => CRM_Utils_Type::T_INT, | |
312 | 'title' => ts('Show Honor Roll?') , | |
522a26c9 | 313 | 'table_name' => 'civicrm_pcp', |
314 | 'entity' => 'PCP', | |
315 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
316 | 'html' => array( |
317 | 'type' => 'CheckBox', | |
318 | ) , | |
319 | ) , | |
320 | 'goal_amount' => array( | |
321 | 'name' => 'goal_amount', | |
322 | 'type' => CRM_Utils_Type::T_MONEY, | |
323 | 'title' => ts('Goal Amount') , | |
324 | 'description' => 'Goal amount of this Personal Campaign Page.', | |
325 | 'precision' => array( | |
326 | 20, | |
327 | 2 | |
328 | ) , | |
522a26c9 | 329 | 'table_name' => 'civicrm_pcp', |
330 | 'entity' => 'PCP', | |
331 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
332 | 'html' => array( |
333 | 'type' => 'Text', | |
334 | ) , | |
335 | ) , | |
336 | 'currency' => array( | |
337 | 'name' => 'currency', | |
338 | 'type' => CRM_Utils_Type::T_STRING, | |
339 | 'title' => ts('Currency') , | |
340 | 'description' => '3 character string, value from config setting or input via user.', | |
341 | 'maxlength' => 3, | |
342 | 'size' => CRM_Utils_Type::FOUR, | |
343 | 'default' => 'NULL', | |
522a26c9 | 344 | 'table_name' => 'civicrm_pcp', |
345 | 'entity' => 'PCP', | |
346 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
347 | 'html' => array( |
348 | 'type' => 'Select', | |
349 | ) , | |
350 | 'pseudoconstant' => array( | |
351 | 'table' => 'civicrm_currency', | |
352 | 'keyColumn' => 'name', | |
353 | 'labelColumn' => 'full_name', | |
354 | 'nameColumn' => 'name', | |
355 | ) | |
356 | ) , | |
357 | 'is_active' => array( | |
358 | 'name' => 'is_active', | |
359 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
360 | 'title' => ts('Enabled?') , | |
361 | 'description' => 'Is Personal Campaign Page enabled/active?', | |
522a26c9 | 362 | 'table_name' => 'civicrm_pcp', |
363 | 'entity' => 'PCP', | |
364 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
365 | 'html' => array( |
366 | 'type' => 'CheckBox', | |
367 | ) , | |
368 | ) , | |
369 | 'is_notify' => array( | |
370 | 'name' => 'is_notify', | |
371 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
372 | 'title' => ts('Notify Owner?') , | |
373 | 'description' => 'Notify owner via email when someone donates to page?', | |
522a26c9 | 374 | 'table_name' => 'civicrm_pcp', |
375 | 'entity' => 'PCP', | |
376 | 'bao' => 'CRM_PCP_BAO_PCP', | |
e501603b TO |
377 | 'html' => array( |
378 | 'type' => 'CheckBox', | |
379 | ) , | |
380 | ) , | |
381 | ); | |
346aaaba | 382 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 383 | } |
346aaaba | 384 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
385 | } |
386 | /** | |
bd8e0b14 | 387 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
388 | * |
389 | * @return array | |
bd8e0b14 | 390 | * Array(string $name => string $uniqueName). |
e501603b TO |
391 | */ |
392 | static function &fieldKeys() { | |
bd8e0b14 TO |
393 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
394 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 395 | } |
bd8e0b14 | 396 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
397 | } |
398 | /** | |
399 | * Returns the names of this table | |
400 | * | |
401 | * @return string | |
402 | */ | |
403 | static function getTableName() { | |
404 | return self::$_tableName; | |
405 | } | |
406 | /** | |
407 | * Returns if this table needs to be logged | |
408 | * | |
409 | * @return boolean | |
410 | */ | |
411 | function getLog() { | |
412 | return self::$_log; | |
413 | } | |
414 | /** | |
415 | * Returns the list of fields that can be imported | |
416 | * | |
417 | * @param bool $prefix | |
418 | * | |
419 | * @return array | |
420 | */ | |
421 | static function &import($prefix = false) { | |
60808919 TO |
422 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, array()); |
423 | return $r; | |
e501603b TO |
424 | } |
425 | /** | |
426 | * Returns the list of fields that can be exported | |
427 | * | |
428 | * @param bool $prefix | |
429 | * | |
430 | * @return array | |
431 | */ | |
432 | static function &export($prefix = false) { | |
60808919 TO |
433 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, array()); |
434 | return $r; | |
e501603b TO |
435 | } |
436 | } |