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