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