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