curious
[civicrm-core.git] / CRM / PCP / DAO / PCPBlock.php
CommitLineData
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
2562d09a 9 * (GenCodeChecksum:4b5ca843e0a3a2e4b439d03513b20682)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PCPBlock entity.
f41f0342 14 */
e501603b 15class 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 ],
1fe423d6 180 'readonly' => TRUE,
a9d0587b 181 'add' => '2.2',
c3fc2621
CW
182 ],
183 'entity_table' => [
e501603b
TO
184 'name' => 'entity_table',
185 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 186 'title' => ts('Entity Table'),
e501603b
TO
187 'maxlength' => 64,
188 'size' => CRM_Utils_Type::BIG,
a36434b9 189 'where' => 'civicrm_pcp_block.entity_table',
522a26c9 190 'table_name' => 'civicrm_pcp_block',
191 'entity' => 'PCPBlock',
192 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 193 'localizable' => 0,
a9d0587b 194 'add' => '2.2',
c3fc2621
CW
195 ],
196 'entity_id' => [
e501603b
TO
197 'name' => 'entity_id',
198 'type' => CRM_Utils_Type::T_INT,
c3fc2621 199 'title' => ts('Entity'),
215b423e 200 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
c3fc2621 201 'required' => TRUE,
a36434b9 202 'where' => 'civicrm_pcp_block.entity_id',
522a26c9 203 'table_name' => 'civicrm_pcp_block',
204 'entity' => 'PCPBlock',
205 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 206 'localizable' => 0,
a9d0587b 207 'add' => '2.2',
c3fc2621
CW
208 ],
209 'target_entity_type' => [
e501603b
TO
210 'name' => 'target_entity_type',
211 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 212 'title' => ts('Target Entity'),
215b423e 213 'description' => ts('The type of entity that this pcp targets'),
c3fc2621 214 'required' => TRUE,
e501603b
TO
215 'maxlength' => 255,
216 'size' => CRM_Utils_Type::HUGE,
a36434b9 217 'where' => 'civicrm_pcp_block.target_entity_type',
e501603b 218 'default' => 'contribute',
522a26c9 219 'table_name' => 'civicrm_pcp_block',
220 'entity' => 'PCPBlock',
221 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 222 'localizable' => 0,
a9d0587b 223 'add' => '4.1',
c3fc2621
CW
224 ],
225 'target_entity_id' => [
e501603b
TO
226 'name' => 'target_entity_id',
227 'type' => CRM_Utils_Type::T_INT,
c3fc2621 228 'title' => ts('Target Entity ID'),
215b423e 229 'description' => ts('The entity that this pcp targets'),
c3fc2621 230 'required' => TRUE,
a36434b9 231 'where' => 'civicrm_pcp_block.target_entity_id',
522a26c9 232 'table_name' => 'civicrm_pcp_block',
233 'entity' => 'PCPBlock',
234 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 235 'localizable' => 0,
a9d0587b 236 'add' => '4.1',
c3fc2621
CW
237 ],
238 'supporter_profile_id' => [
e501603b
TO
239 'name' => 'supporter_profile_id',
240 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 241 'title' => ts('Supporter Profile ID'),
215b423e 242 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
a36434b9 243 'where' => 'civicrm_pcp_block.supporter_profile_id',
5fb0de1f 244 'default' => NULL,
522a26c9 245 'table_name' => 'civicrm_pcp_block',
246 'entity' => 'PCPBlock',
247 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 248 'localizable' => 0,
e501603b 249 'FKClassName' => 'CRM_Core_DAO_UFGroup',
2cbbebe8
A
250 'html' => [
251 'label' => ts("Supporter Profile"),
252 ],
a9d0587b 253 'add' => '2.2',
c3fc2621
CW
254 ],
255 'owner_notify_id' => [
e501603b
TO
256 'name' => 'owner_notify_id',
257 'type' => CRM_Utils_Type::T_INT,
c3fc2621 258 'title' => ts('Owner Notification'),
215b423e 259 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
a36434b9 260 'where' => 'civicrm_pcp_block.owner_notify_id',
45a83e42 261 'default' => '0',
522a26c9 262 'table_name' => 'civicrm_pcp_block',
263 'entity' => 'PCPBlock',
264 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 265 'localizable' => 0,
c3fc2621 266 'html' => [
e501603b 267 'type' => 'Radio',
c3fc2621
CW
268 ],
269 'pseudoconstant' => [
e501603b
TO
270 'optionGroupName' => 'pcp_owner_notify',
271 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
e6ca0a57 272 ],
a9d0587b 273 'add' => '4.6',
c3fc2621
CW
274 ],
275 'is_approval_needed' => [
e501603b
TO
276 'name' => 'is_approval_needed',
277 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 278 'title' => ts('Approval Required?'),
215b423e 279 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
a36434b9 280 'where' => 'civicrm_pcp_block.is_approval_needed',
5fb0de1f 281 'default' => NULL,
522a26c9 282 'table_name' => 'civicrm_pcp_block',
283 'entity' => 'PCPBlock',
284 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 285 'localizable' => 0,
a9d0587b 286 'add' => '2.2',
c3fc2621
CW
287 ],
288 'is_tellfriend_enabled' => [
e501603b
TO
289 'name' => 'is_tellfriend_enabled',
290 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 291 'title' => ts('Tell a Friend Enabled?'),
215b423e 292 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
a36434b9 293 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
5fb0de1f 294 'default' => NULL,
522a26c9 295 'table_name' => 'civicrm_pcp_block',
296 'entity' => 'PCPBlock',
297 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 298 'localizable' => 0,
a9d0587b 299 'add' => '2.2',
c3fc2621
CW
300 ],
301 'tellfriend_limit' => [
e501603b
TO
302 'name' => 'tellfriend_limit',
303 'type' => CRM_Utils_Type::T_INT,
c3fc2621 304 'title' => ts('Tell A Friend Limit'),
215b423e 305 'description' => ts('Maximum recipient fields allowed in tell a friend'),
a36434b9 306 'where' => 'civicrm_pcp_block.tellfriend_limit',
5fb0de1f 307 'default' => NULL,
522a26c9 308 'table_name' => 'civicrm_pcp_block',
309 'entity' => 'PCPBlock',
310 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 311 'localizable' => 0,
a9d0587b 312 'add' => '2.2',
c3fc2621
CW
313 ],
314 'link_text' => [
e501603b
TO
315 'name' => 'link_text',
316 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 317 'title' => ts('Link Text'),
215b423e 318 'description' => ts('Link text for PCP.'),
e501603b
TO
319 'maxlength' => 255,
320 'size' => CRM_Utils_Type::HUGE,
a36434b9 321 'where' => 'civicrm_pcp_block.link_text',
5fb0de1f 322 'default' => NULL,
522a26c9 323 'table_name' => 'civicrm_pcp_block',
324 'entity' => 'PCPBlock',
325 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 326 'localizable' => 1,
a9d0587b 327 'add' => '2.2',
c3fc2621
CW
328 ],
329 'is_active' => [
e501603b
TO
330 'name' => 'is_active',
331 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 332 'title' => ts('Enabled?'),
215b423e 333 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
a36434b9 334 'where' => 'civicrm_pcp_block.is_active',
e501603b 335 'default' => '1',
522a26c9 336 'table_name' => 'civicrm_pcp_block',
337 'entity' => 'PCPBlock',
338 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 339 'localizable' => 0,
a9d0587b 340 'add' => '2.2',
c3fc2621
CW
341 ],
342 'notify_email' => [
e501603b
TO
343 'name' => 'notify_email',
344 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 345 'title' => ts('Notification Email'),
215b423e 346 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
e501603b
TO
347 'maxlength' => 255,
348 'size' => CRM_Utils_Type::HUGE,
a36434b9 349 'where' => 'civicrm_pcp_block.notify_email',
5fb0de1f 350 'default' => NULL,
522a26c9 351 'table_name' => 'civicrm_pcp_block',
352 'entity' => 'PCPBlock',
353 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 354 'localizable' => 0,
a9d0587b 355 'add' => '2.2',
c3fc2621
CW
356 ],
357 ];
346aaaba 358 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 359 }
346aaaba 360 return Civi::$statics[__CLASS__]['fields'];
e501603b 361 }
c3fc2621 362
e501603b 363 /**
bd8e0b14 364 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
365 *
366 * @return array
bd8e0b14 367 * Array(string $name => string $uniqueName).
e501603b 368 */
c3fc2621 369 public static function &fieldKeys() {
bd8e0b14
TO
370 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
371 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 372 }
bd8e0b14 373 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 374 }
c3fc2621 375
e501603b
TO
376 /**
377 * Returns the names of this table
378 *
379 * @return string
380 */
c3fc2621 381 public static function getTableName() {
e501603b
TO
382 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
383 }
c3fc2621 384
e501603b
TO
385 /**
386 * Returns if this table needs to be logged
387 *
c3fc2621 388 * @return bool
e501603b 389 */
c3fc2621 390 public function getLog() {
e501603b
TO
391 return self::$_log;
392 }
c3fc2621 393
e501603b
TO
394 /**
395 * Returns the list of fields that can be imported
396 *
397 * @param bool $prefix
398 *
399 * @return array
400 */
c3fc2621
CW
401 public static function &import($prefix = FALSE) {
402 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, []);
60808919 403 return $r;
e501603b 404 }
c3fc2621 405
e501603b
TO
406 /**
407 * Returns the list of fields that can be exported
408 *
409 * @param bool $prefix
410 *
411 * @return array
412 */
c3fc2621
CW
413 public static function &export($prefix = FALSE) {
414 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, []);
60808919 415 return $r;
e501603b 416 }
c3fc2621 417
e7a6b91a
AS
418 /**
419 * Returns the list of indices
c3fc2621
CW
420 *
421 * @param bool $localize
422 *
423 * @return array
e7a6b91a
AS
424 */
425 public static function indices($localize = TRUE) {
c3fc2621 426 $indices = [];
e7a6b91a
AS
427 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
428 }
c3fc2621 429
e501603b 430}