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