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