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