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