Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/PCP/PCPBlock.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
a9d0587b | 9 | * (GenCodeChecksum:039e37edb86cfd25e6c882ce4950e3c9) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the PCPBlock entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_pcp_block'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * PCP block Id | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b | 38 | /** |
e501603b TO |
39 | * @var string |
40 | */ | |
41 | public $entity_table; | |
c3fc2621 | 42 | |
e501603b TO |
43 | /** |
44 | * FK to civicrm_contribution_page.id OR civicrm_event.id | |
45 | * | |
e6ca0a57 | 46 | * @var int |
e501603b TO |
47 | */ |
48 | public $entity_id; | |
c3fc2621 | 49 | |
e501603b TO |
50 | /** |
51 | * The type of entity that this pcp targets | |
52 | * | |
53 | * @var string | |
54 | */ | |
55 | public $target_entity_type; | |
c3fc2621 | 56 | |
e501603b TO |
57 | /** |
58 | * The entity that this pcp targets | |
59 | * | |
e6ca0a57 | 60 | * @var int |
e501603b TO |
61 | */ |
62 | public $target_entity_id; | |
c3fc2621 | 63 | |
e501603b TO |
64 | /** |
65 | * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)? | |
66 | * | |
e6ca0a57 | 67 | * @var int |
e501603b TO |
68 | */ |
69 | public $supporter_profile_id; | |
c3fc2621 | 70 | |
e501603b TO |
71 | /** |
72 | * FK to civicrm_option_group with name = PCP owner notifications | |
73 | * | |
e6ca0a57 | 74 | * @var int |
e501603b TO |
75 | */ |
76 | public $owner_notify_id; | |
c3fc2621 | 77 | |
e501603b TO |
78 | /** |
79 | * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)? | |
80 | * | |
e6ca0a57 | 81 | * @var bool |
e501603b TO |
82 | */ |
83 | public $is_approval_needed; | |
c3fc2621 | 84 | |
e501603b TO |
85 | /** |
86 | * Does Personal Campaign Page allow using tell a friend? | |
87 | * | |
e6ca0a57 | 88 | * @var bool |
e501603b TO |
89 | */ |
90 | public $is_tellfriend_enabled; | |
c3fc2621 | 91 | |
e501603b TO |
92 | /** |
93 | * Maximum recipient fields allowed in tell a friend | |
94 | * | |
e6ca0a57 | 95 | * @var int |
e501603b TO |
96 | */ |
97 | public $tellfriend_limit; | |
c3fc2621 | 98 | |
e501603b TO |
99 | /** |
100 | * Link text for PCP. | |
101 | * | |
102 | * @var string | |
103 | */ | |
104 | public $link_text; | |
c3fc2621 | 105 | |
e501603b TO |
106 | /** |
107 | * Is Personal Campaign Page Block enabled/active? | |
108 | * | |
e6ca0a57 | 109 | * @var bool |
e501603b TO |
110 | */ |
111 | public $is_active; | |
c3fc2621 | 112 | |
e501603b TO |
113 | /** |
114 | * If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page | |
115 | * | |
116 | * @var string | |
117 | */ | |
118 | public $notify_email; | |
c3fc2621 | 119 | |
e501603b | 120 | /** |
f41f0342 | 121 | * Class constructor. |
e501603b | 122 | */ |
c3fc2621 | 123 | public function __construct() { |
e501603b TO |
124 | $this->__table = 'civicrm_pcp_block'; |
125 | parent::__construct(); | |
126 | } | |
c3fc2621 | 127 | |
449c4e6b CW |
128 | /** |
129 | * Returns localized title of this entity. | |
130 | */ | |
131 | public static function getEntityTitle() { | |
132 | return ts('PCPBlocks'); | |
133 | } | |
134 | ||
e501603b | 135 | /** |
f41f0342 | 136 | * Returns foreign keys and entity references. |
e501603b TO |
137 | * |
138 | * @return array | |
139 | * [CRM_Core_Reference_Interface] | |
140 | */ | |
c3fc2621 | 141 | public static function getReferenceColumns() { |
346aaaba | 142 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 143 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
144 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id'); |
145 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
146 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type'); | |
346aaaba | 147 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 148 | } |
346aaaba | 149 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 150 | } |
c3fc2621 | 151 | |
e501603b TO |
152 | /** |
153 | * Returns all the column names of this table | |
154 | * | |
155 | * @return array | |
156 | */ | |
c3fc2621 | 157 | public static function &fields() { |
346aaaba | 158 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
159 | Civi::$statics[__CLASS__]['fields'] = [ |
160 | 'id' => [ | |
e501603b TO |
161 | 'name' => 'id', |
162 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 163 | 'title' => ts('PCP Block ID'), |
215b423e | 164 | 'description' => ts('PCP block Id'), |
c3fc2621 | 165 | 'required' => TRUE, |
a36434b9 | 166 | 'where' => 'civicrm_pcp_block.id', |
522a26c9 | 167 | 'table_name' => 'civicrm_pcp_block', |
168 | 'entity' => 'PCPBlock', | |
169 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 170 | 'localizable' => 0, |
a9d0587b | 171 | 'add' => '2.2', |
c3fc2621 CW |
172 | ], |
173 | 'entity_table' => [ | |
e501603b TO |
174 | 'name' => 'entity_table', |
175 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 176 | 'title' => ts('Entity Table'), |
e501603b TO |
177 | 'maxlength' => 64, |
178 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 179 | 'where' => 'civicrm_pcp_block.entity_table', |
522a26c9 | 180 | 'table_name' => 'civicrm_pcp_block', |
181 | 'entity' => 'PCPBlock', | |
182 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 183 | 'localizable' => 0, |
a9d0587b | 184 | 'add' => '2.2', |
c3fc2621 CW |
185 | ], |
186 | 'entity_id' => [ | |
e501603b TO |
187 | 'name' => 'entity_id', |
188 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 189 | 'title' => ts('Entity'), |
215b423e | 190 | 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'), |
c3fc2621 | 191 | 'required' => TRUE, |
a36434b9 | 192 | 'where' => 'civicrm_pcp_block.entity_id', |
522a26c9 | 193 | 'table_name' => 'civicrm_pcp_block', |
194 | 'entity' => 'PCPBlock', | |
195 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 196 | 'localizable' => 0, |
a9d0587b | 197 | 'add' => '2.2', |
c3fc2621 CW |
198 | ], |
199 | 'target_entity_type' => [ | |
e501603b TO |
200 | 'name' => 'target_entity_type', |
201 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 202 | 'title' => ts('Target Entity'), |
215b423e | 203 | 'description' => ts('The type of entity that this pcp targets'), |
c3fc2621 | 204 | 'required' => TRUE, |
e501603b TO |
205 | 'maxlength' => 255, |
206 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 207 | 'where' => 'civicrm_pcp_block.target_entity_type', |
e501603b | 208 | 'default' => 'contribute', |
522a26c9 | 209 | 'table_name' => 'civicrm_pcp_block', |
210 | 'entity' => 'PCPBlock', | |
211 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 212 | 'localizable' => 0, |
a9d0587b | 213 | 'add' => '4.1', |
c3fc2621 CW |
214 | ], |
215 | 'target_entity_id' => [ | |
e501603b TO |
216 | 'name' => 'target_entity_id', |
217 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 218 | 'title' => ts('Target Entity ID'), |
215b423e | 219 | 'description' => ts('The entity that this pcp targets'), |
c3fc2621 | 220 | 'required' => TRUE, |
a36434b9 | 221 | 'where' => 'civicrm_pcp_block.target_entity_id', |
522a26c9 | 222 | 'table_name' => 'civicrm_pcp_block', |
223 | 'entity' => 'PCPBlock', | |
224 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 225 | 'localizable' => 0, |
a9d0587b | 226 | 'add' => '4.1', |
c3fc2621 CW |
227 | ], |
228 | 'supporter_profile_id' => [ | |
e501603b TO |
229 | 'name' => 'supporter_profile_id', |
230 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 231 | 'title' => ts('Supporter Profile'), |
215b423e | 232 | 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'), |
a36434b9 | 233 | 'where' => 'civicrm_pcp_block.supporter_profile_id', |
e501603b | 234 | 'default' => 'NULL', |
522a26c9 | 235 | 'table_name' => 'civicrm_pcp_block', |
236 | 'entity' => 'PCPBlock', | |
237 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 238 | 'localizable' => 0, |
e501603b | 239 | 'FKClassName' => 'CRM_Core_DAO_UFGroup', |
a9d0587b | 240 | 'add' => '2.2', |
c3fc2621 CW |
241 | ], |
242 | 'owner_notify_id' => [ | |
e501603b TO |
243 | 'name' => 'owner_notify_id', |
244 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 245 | 'title' => ts('Owner Notification'), |
215b423e | 246 | 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'), |
a36434b9 | 247 | 'where' => 'civicrm_pcp_block.owner_notify_id', |
45a83e42 | 248 | 'default' => '0', |
522a26c9 | 249 | 'table_name' => 'civicrm_pcp_block', |
250 | 'entity' => 'PCPBlock', | |
251 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 252 | 'localizable' => 0, |
c3fc2621 | 253 | 'html' => [ |
e501603b | 254 | 'type' => 'Radio', |
c3fc2621 CW |
255 | ], |
256 | 'pseudoconstant' => [ | |
e501603b TO |
257 | 'optionGroupName' => 'pcp_owner_notify', |
258 | 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify', | |
e6ca0a57 | 259 | ], |
a9d0587b | 260 | 'add' => '4.6', |
c3fc2621 CW |
261 | ], |
262 | 'is_approval_needed' => [ | |
e501603b TO |
263 | 'name' => 'is_approval_needed', |
264 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 265 | 'title' => ts('Approval Required?'), |
215b423e | 266 | 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'), |
a36434b9 | 267 | 'where' => 'civicrm_pcp_block.is_approval_needed', |
e501603b | 268 | 'default' => 'NULL', |
522a26c9 | 269 | 'table_name' => 'civicrm_pcp_block', |
270 | 'entity' => 'PCPBlock', | |
271 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 272 | 'localizable' => 0, |
a9d0587b | 273 | 'add' => '2.2', |
c3fc2621 CW |
274 | ], |
275 | 'is_tellfriend_enabled' => [ | |
e501603b TO |
276 | 'name' => 'is_tellfriend_enabled', |
277 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 278 | 'title' => ts('Tell a Friend Enabled?'), |
215b423e | 279 | 'description' => ts('Does Personal Campaign Page allow using tell a friend?'), |
a36434b9 | 280 | 'where' => 'civicrm_pcp_block.is_tellfriend_enabled', |
e501603b | 281 | 'default' => 'NULL', |
522a26c9 | 282 | 'table_name' => 'civicrm_pcp_block', |
283 | 'entity' => 'PCPBlock', | |
284 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 285 | 'localizable' => 0, |
a9d0587b | 286 | 'add' => '2.2', |
c3fc2621 CW |
287 | ], |
288 | 'tellfriend_limit' => [ | |
e501603b TO |
289 | 'name' => 'tellfriend_limit', |
290 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 291 | 'title' => ts('Tell A Friend Limit'), |
215b423e | 292 | 'description' => ts('Maximum recipient fields allowed in tell a friend'), |
a36434b9 | 293 | 'where' => 'civicrm_pcp_block.tellfriend_limit', |
e501603b | 294 | 'default' => 'NULL', |
522a26c9 | 295 | 'table_name' => 'civicrm_pcp_block', |
296 | 'entity' => 'PCPBlock', | |
297 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 298 | 'localizable' => 0, |
a9d0587b | 299 | 'add' => '2.2', |
c3fc2621 CW |
300 | ], |
301 | 'link_text' => [ | |
e501603b TO |
302 | 'name' => 'link_text', |
303 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 304 | 'title' => ts('Link Text'), |
215b423e | 305 | 'description' => ts('Link text for PCP.'), |
e501603b TO |
306 | 'maxlength' => 255, |
307 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 308 | 'where' => 'civicrm_pcp_block.link_text', |
e501603b | 309 | 'default' => 'NULL', |
522a26c9 | 310 | 'table_name' => 'civicrm_pcp_block', |
311 | 'entity' => 'PCPBlock', | |
312 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 313 | 'localizable' => 1, |
a9d0587b | 314 | 'add' => '2.2', |
c3fc2621 CW |
315 | ], |
316 | 'is_active' => [ | |
e501603b TO |
317 | 'name' => 'is_active', |
318 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 319 | 'title' => ts('Enabled?'), |
215b423e | 320 | 'description' => ts('Is Personal Campaign Page Block enabled/active?'), |
a36434b9 | 321 | 'where' => 'civicrm_pcp_block.is_active', |
e501603b | 322 | 'default' => '1', |
522a26c9 | 323 | 'table_name' => 'civicrm_pcp_block', |
324 | 'entity' => 'PCPBlock', | |
325 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 326 | 'localizable' => 0, |
a9d0587b | 327 | 'add' => '2.2', |
c3fc2621 CW |
328 | ], |
329 | 'notify_email' => [ | |
e501603b TO |
330 | 'name' => 'notify_email', |
331 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 332 | 'title' => ts('Notification Email'), |
215b423e | 333 | 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'), |
e501603b TO |
334 | 'maxlength' => 255, |
335 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 336 | 'where' => 'civicrm_pcp_block.notify_email', |
e501603b | 337 | 'default' => 'NULL', |
522a26c9 | 338 | 'table_name' => 'civicrm_pcp_block', |
339 | 'entity' => 'PCPBlock', | |
340 | 'bao' => 'CRM_PCP_BAO_PCPBlock', | |
6a7e5e5d | 341 | 'localizable' => 0, |
a9d0587b | 342 | 'add' => '2.2', |
c3fc2621 CW |
343 | ], |
344 | ]; | |
346aaaba | 345 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 346 | } |
346aaaba | 347 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 348 | } |
c3fc2621 | 349 | |
e501603b | 350 | /** |
bd8e0b14 | 351 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
352 | * |
353 | * @return array | |
bd8e0b14 | 354 | * Array(string $name => string $uniqueName). |
e501603b | 355 | */ |
c3fc2621 | 356 | public static function &fieldKeys() { |
bd8e0b14 TO |
357 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
358 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 359 | } |
bd8e0b14 | 360 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 361 | } |
c3fc2621 | 362 | |
e501603b TO |
363 | /** |
364 | * Returns the names of this table | |
365 | * | |
366 | * @return string | |
367 | */ | |
c3fc2621 | 368 | public static function getTableName() { |
e501603b TO |
369 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
370 | } | |
c3fc2621 | 371 | |
e501603b TO |
372 | /** |
373 | * Returns if this table needs to be logged | |
374 | * | |
c3fc2621 | 375 | * @return bool |
e501603b | 376 | */ |
c3fc2621 | 377 | public function getLog() { |
e501603b TO |
378 | return self::$_log; |
379 | } | |
c3fc2621 | 380 | |
e501603b TO |
381 | /** |
382 | * Returns the list of fields that can be imported | |
383 | * | |
384 | * @param bool $prefix | |
385 | * | |
386 | * @return array | |
387 | */ | |
c3fc2621 CW |
388 | public static function &import($prefix = FALSE) { |
389 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, []); | |
60808919 | 390 | return $r; |
e501603b | 391 | } |
c3fc2621 | 392 | |
e501603b TO |
393 | /** |
394 | * Returns the list of fields that can be exported | |
395 | * | |
396 | * @param bool $prefix | |
397 | * | |
398 | * @return array | |
399 | */ | |
c3fc2621 CW |
400 | public static function &export($prefix = FALSE) { |
401 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, []); | |
60808919 | 402 | return $r; |
e501603b | 403 | } |
c3fc2621 | 404 | |
e7a6b91a AS |
405 | /** |
406 | * Returns the list of indices | |
c3fc2621 CW |
407 | * |
408 | * @param bool $localize | |
409 | * | |
410 | * @return array | |
e7a6b91a AS |
411 | */ |
412 | public static function indices($localize = TRUE) { | |
c3fc2621 | 413 | $indices = []; |
e7a6b91a AS |
414 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
415 | } | |
c3fc2621 | 416 | |
e501603b | 417 | } |