Merge pull request #18276 from civicrm/5.29
[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:ea1b4158570c5a79356b1dc0ad80db6a)
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 public static function getEntityTitle() {
134 return ts('PCPBlocks');
135 }
136
137 /**
138 * Returns foreign keys and entity references.
139 *
140 * @return array
141 * [CRM_Core_Reference_Interface]
142 */
143 public static function getReferenceColumns() {
144 if (!isset(Civi::$statics[__CLASS__]['links'])) {
145 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
146 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id');
147 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
148 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type');
149 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
150 }
151 return Civi::$statics[__CLASS__]['links'];
152 }
153
154 /**
155 * Returns all the column names of this table
156 *
157 * @return array
158 */
159 public static function &fields() {
160 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
161 Civi::$statics[__CLASS__]['fields'] = [
162 'id' => [
163 'name' => 'id',
164 'type' => CRM_Utils_Type::T_INT,
165 'title' => ts('PCP Block ID'),
166 'description' => ts('PCP block Id'),
167 'required' => TRUE,
168 'where' => 'civicrm_pcp_block.id',
169 'table_name' => 'civicrm_pcp_block',
170 'entity' => 'PCPBlock',
171 'bao' => 'CRM_PCP_BAO_PCPBlock',
172 'localizable' => 0,
173 'add' => '2.2',
174 ],
175 'entity_table' => [
176 'name' => 'entity_table',
177 'type' => CRM_Utils_Type::T_STRING,
178 'title' => ts('Entity Table'),
179 'maxlength' => 64,
180 'size' => CRM_Utils_Type::BIG,
181 'where' => 'civicrm_pcp_block.entity_table',
182 'table_name' => 'civicrm_pcp_block',
183 'entity' => 'PCPBlock',
184 'bao' => 'CRM_PCP_BAO_PCPBlock',
185 'localizable' => 0,
186 'add' => '2.2',
187 ],
188 'entity_id' => [
189 'name' => 'entity_id',
190 'type' => CRM_Utils_Type::T_INT,
191 'title' => ts('Entity'),
192 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
193 'required' => TRUE,
194 'where' => 'civicrm_pcp_block.entity_id',
195 'table_name' => 'civicrm_pcp_block',
196 'entity' => 'PCPBlock',
197 'bao' => 'CRM_PCP_BAO_PCPBlock',
198 'localizable' => 0,
199 'add' => '2.2',
200 ],
201 'target_entity_type' => [
202 'name' => 'target_entity_type',
203 'type' => CRM_Utils_Type::T_STRING,
204 'title' => ts('Target Entity'),
205 'description' => ts('The type of entity that this pcp targets'),
206 'required' => TRUE,
207 'maxlength' => 255,
208 'size' => CRM_Utils_Type::HUGE,
209 'where' => 'civicrm_pcp_block.target_entity_type',
210 'default' => 'contribute',
211 'table_name' => 'civicrm_pcp_block',
212 'entity' => 'PCPBlock',
213 'bao' => 'CRM_PCP_BAO_PCPBlock',
214 'localizable' => 0,
215 'add' => '4.1',
216 ],
217 'target_entity_id' => [
218 'name' => 'target_entity_id',
219 'type' => CRM_Utils_Type::T_INT,
220 'title' => ts('Target Entity ID'),
221 'description' => ts('The entity that this pcp targets'),
222 'required' => TRUE,
223 'where' => 'civicrm_pcp_block.target_entity_id',
224 'table_name' => 'civicrm_pcp_block',
225 'entity' => 'PCPBlock',
226 'bao' => 'CRM_PCP_BAO_PCPBlock',
227 'localizable' => 0,
228 'add' => '4.1',
229 ],
230 'supporter_profile_id' => [
231 'name' => 'supporter_profile_id',
232 'type' => CRM_Utils_Type::T_INT,
233 'title' => ts('Supporter Profile'),
234 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
235 'where' => 'civicrm_pcp_block.supporter_profile_id',
236 'default' => 'NULL',
237 'table_name' => 'civicrm_pcp_block',
238 'entity' => 'PCPBlock',
239 'bao' => 'CRM_PCP_BAO_PCPBlock',
240 'localizable' => 0,
241 'FKClassName' => 'CRM_Core_DAO_UFGroup',
242 'add' => '2.2',
243 ],
244 'owner_notify_id' => [
245 'name' => 'owner_notify_id',
246 'type' => CRM_Utils_Type::T_INT,
247 'title' => ts('Owner Notification'),
248 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
249 'where' => 'civicrm_pcp_block.owner_notify_id',
250 'default' => '0',
251 'table_name' => 'civicrm_pcp_block',
252 'entity' => 'PCPBlock',
253 'bao' => 'CRM_PCP_BAO_PCPBlock',
254 'localizable' => 0,
255 'html' => [
256 'type' => 'Radio',
257 ],
258 'pseudoconstant' => [
259 'optionGroupName' => 'pcp_owner_notify',
260 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
261 ],
262 'add' => '4.6',
263 ],
264 'is_approval_needed' => [
265 'name' => 'is_approval_needed',
266 'type' => CRM_Utils_Type::T_BOOLEAN,
267 'title' => ts('Approval Required?'),
268 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
269 'where' => 'civicrm_pcp_block.is_approval_needed',
270 'default' => 'NULL',
271 'table_name' => 'civicrm_pcp_block',
272 'entity' => 'PCPBlock',
273 'bao' => 'CRM_PCP_BAO_PCPBlock',
274 'localizable' => 0,
275 'add' => '2.2',
276 ],
277 'is_tellfriend_enabled' => [
278 'name' => 'is_tellfriend_enabled',
279 'type' => CRM_Utils_Type::T_BOOLEAN,
280 'title' => ts('Tell a Friend Enabled?'),
281 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
282 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
283 'default' => 'NULL',
284 'table_name' => 'civicrm_pcp_block',
285 'entity' => 'PCPBlock',
286 'bao' => 'CRM_PCP_BAO_PCPBlock',
287 'localizable' => 0,
288 'add' => '2.2',
289 ],
290 'tellfriend_limit' => [
291 'name' => 'tellfriend_limit',
292 'type' => CRM_Utils_Type::T_INT,
293 'title' => ts('Tell A Friend Limit'),
294 'description' => ts('Maximum recipient fields allowed in tell a friend'),
295 'where' => 'civicrm_pcp_block.tellfriend_limit',
296 'default' => 'NULL',
297 'table_name' => 'civicrm_pcp_block',
298 'entity' => 'PCPBlock',
299 'bao' => 'CRM_PCP_BAO_PCPBlock',
300 'localizable' => 0,
301 'add' => '2.2',
302 ],
303 'link_text' => [
304 'name' => 'link_text',
305 'type' => CRM_Utils_Type::T_STRING,
306 'title' => ts('Link Text'),
307 'description' => ts('Link text for PCP.'),
308 'maxlength' => 255,
309 'size' => CRM_Utils_Type::HUGE,
310 'where' => 'civicrm_pcp_block.link_text',
311 'default' => 'NULL',
312 'table_name' => 'civicrm_pcp_block',
313 'entity' => 'PCPBlock',
314 'bao' => 'CRM_PCP_BAO_PCPBlock',
315 'localizable' => 1,
316 'add' => '2.2',
317 ],
318 'is_active' => [
319 'name' => 'is_active',
320 'type' => CRM_Utils_Type::T_BOOLEAN,
321 'title' => ts('Enabled?'),
322 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
323 'where' => 'civicrm_pcp_block.is_active',
324 'default' => '1',
325 'table_name' => 'civicrm_pcp_block',
326 'entity' => 'PCPBlock',
327 'bao' => 'CRM_PCP_BAO_PCPBlock',
328 'localizable' => 0,
329 'add' => '2.2',
330 ],
331 'notify_email' => [
332 'name' => 'notify_email',
333 'type' => CRM_Utils_Type::T_STRING,
334 'title' => ts('Notification Email'),
335 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
336 'maxlength' => 255,
337 'size' => CRM_Utils_Type::HUGE,
338 'where' => 'civicrm_pcp_block.notify_email',
339 'default' => 'NULL',
340 'table_name' => 'civicrm_pcp_block',
341 'entity' => 'PCPBlock',
342 'bao' => 'CRM_PCP_BAO_PCPBlock',
343 'localizable' => 0,
344 'add' => '2.2',
345 ],
346 ];
347 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
348 }
349 return Civi::$statics[__CLASS__]['fields'];
350 }
351
352 /**
353 * Return a mapping from field-name to the corresponding key (as used in fields()).
354 *
355 * @return array
356 * Array(string $name => string $uniqueName).
357 */
358 public static function &fieldKeys() {
359 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
360 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
361 }
362 return Civi::$statics[__CLASS__]['fieldKeys'];
363 }
364
365 /**
366 * Returns the names of this table
367 *
368 * @return string
369 */
370 public static function getTableName() {
371 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
372 }
373
374 /**
375 * Returns if this table needs to be logged
376 *
377 * @return bool
378 */
379 public function getLog() {
380 return self::$_log;
381 }
382
383 /**
384 * Returns the list of fields that can be imported
385 *
386 * @param bool $prefix
387 *
388 * @return array
389 */
390 public static function &import($prefix = FALSE) {
391 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, []);
392 return $r;
393 }
394
395 /**
396 * Returns the list of fields that can be exported
397 *
398 * @param bool $prefix
399 *
400 * @return array
401 */
402 public static function &export($prefix = FALSE) {
403 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, []);
404 return $r;
405 }
406
407 /**
408 * Returns the list of indices
409 *
410 * @param bool $localize
411 *
412 * @return array
413 */
414 public static function indices($localize = TRUE) {
415 $indices = [];
416 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
417 }
418
419 }