Merge pull request #9711 from KarinG/master
[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:19658f7692f6185ddf125d80f236aede)
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 ) ,
171 'entity_table' => array(
172 'name' => 'entity_table',
173 'type' => CRM_Utils_Type::T_STRING,
174 'title' => ts('Entity Table') ,
175 'maxlength' => 64,
176 'size' => CRM_Utils_Type::BIG,
177 'table_name' => 'civicrm_pcp_block',
178 'entity' => 'PCPBlock',
179 'bao' => 'CRM_PCP_BAO_PCPBlock',
180 ) ,
181 'entity_id' => array(
182 'name' => 'entity_id',
183 'type' => CRM_Utils_Type::T_INT,
184 'title' => ts('Entity') ,
185 'description' => 'FK to civicrm_contribution_page.id OR civicrm_event.id',
186 'required' => true,
187 'table_name' => 'civicrm_pcp_block',
188 'entity' => 'PCPBlock',
189 'bao' => 'CRM_PCP_BAO_PCPBlock',
190 ) ,
191 'target_entity_type' => array(
192 'name' => 'target_entity_type',
193 'type' => CRM_Utils_Type::T_STRING,
194 'title' => ts('Target Entity') ,
195 'description' => 'The type of entity that this pcp targets',
196 'required' => true,
197 'maxlength' => 255,
198 'size' => CRM_Utils_Type::HUGE,
199 'default' => 'contribute',
200 'table_name' => 'civicrm_pcp_block',
201 'entity' => 'PCPBlock',
202 'bao' => 'CRM_PCP_BAO_PCPBlock',
203 ) ,
204 'target_entity_id' => array(
205 'name' => 'target_entity_id',
206 'type' => CRM_Utils_Type::T_INT,
207 'title' => ts('Target Entity ID') ,
208 'description' => 'The entity that this pcp targets',
209 'required' => true,
210 'table_name' => 'civicrm_pcp_block',
211 'entity' => 'PCPBlock',
212 'bao' => 'CRM_PCP_BAO_PCPBlock',
213 ) ,
214 'supporter_profile_id' => array(
215 'name' => 'supporter_profile_id',
216 'type' => CRM_Utils_Type::T_INT,
217 'title' => ts('Supporter Profile') ,
218 'description' => 'FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?',
219 'default' => 'NULL',
220 'table_name' => 'civicrm_pcp_block',
221 'entity' => 'PCPBlock',
222 'bao' => 'CRM_PCP_BAO_PCPBlock',
223 'FKClassName' => 'CRM_Core_DAO_UFGroup',
224 ) ,
225 'owner_notify_id' => array(
226 'name' => 'owner_notify_id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Owner Notification') ,
229 'description' => 'FK to civicrm_option_group with name = PCP owner notifications',
230 'table_name' => 'civicrm_pcp_block',
231 'entity' => 'PCPBlock',
232 'bao' => 'CRM_PCP_BAO_PCPBlock',
233 'html' => array(
234 'type' => 'Radio',
235 ) ,
236 'pseudoconstant' => array(
237 'optionGroupName' => 'pcp_owner_notify',
238 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
239 )
240 ) ,
241 'is_approval_needed' => array(
242 'name' => 'is_approval_needed',
243 'type' => CRM_Utils_Type::T_BOOLEAN,
244 'title' => ts('Approval Required?') ,
245 'description' => 'Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?',
246 'default' => 'NULL',
247 'table_name' => 'civicrm_pcp_block',
248 'entity' => 'PCPBlock',
249 'bao' => 'CRM_PCP_BAO_PCPBlock',
250 ) ,
251 'is_tellfriend_enabled' => array(
252 'name' => 'is_tellfriend_enabled',
253 'type' => CRM_Utils_Type::T_BOOLEAN,
254 'title' => ts('Tell a Friend Enabled?') ,
255 'description' => 'Does Personal Campaign Page allow using tell a friend?',
256 'default' => 'NULL',
257 'table_name' => 'civicrm_pcp_block',
258 'entity' => 'PCPBlock',
259 'bao' => 'CRM_PCP_BAO_PCPBlock',
260 ) ,
261 'tellfriend_limit' => array(
262 'name' => 'tellfriend_limit',
263 'type' => CRM_Utils_Type::T_INT,
264 'title' => ts('Tell A Friend Limit') ,
265 'description' => 'Maximum recipient fields allowed in tell a friend',
266 'default' => 'NULL',
267 'table_name' => 'civicrm_pcp_block',
268 'entity' => 'PCPBlock',
269 'bao' => 'CRM_PCP_BAO_PCPBlock',
270 ) ,
271 'link_text' => array(
272 'name' => 'link_text',
273 'type' => CRM_Utils_Type::T_STRING,
274 'title' => ts('Link Text') ,
275 'description' => 'Link text for PCP.',
276 'maxlength' => 255,
277 'size' => CRM_Utils_Type::HUGE,
278 'default' => 'NULL',
279 'table_name' => 'civicrm_pcp_block',
280 'entity' => 'PCPBlock',
281 'bao' => 'CRM_PCP_BAO_PCPBlock',
282 ) ,
283 'is_active' => array(
284 'name' => 'is_active',
285 'type' => CRM_Utils_Type::T_BOOLEAN,
286 'title' => ts('Enabled?') ,
287 'description' => 'Is Personal Campaign Page Block enabled/active?',
288 'default' => '1',
289 'table_name' => 'civicrm_pcp_block',
290 'entity' => 'PCPBlock',
291 'bao' => 'CRM_PCP_BAO_PCPBlock',
292 ) ,
293 'notify_email' => array(
294 'name' => 'notify_email',
295 'type' => CRM_Utils_Type::T_STRING,
296 'title' => ts('Notification Email') ,
297 'description' => 'If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page',
298 'maxlength' => 255,
299 'size' => CRM_Utils_Type::HUGE,
300 'default' => 'NULL',
301 'table_name' => 'civicrm_pcp_block',
302 'entity' => 'PCPBlock',
303 'bao' => 'CRM_PCP_BAO_PCPBlock',
304 ) ,
305 );
306 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
307 }
308 return Civi::$statics[__CLASS__]['fields'];
309 }
310 /**
311 * Return a mapping from field-name to the corresponding key (as used in fields()).
312 *
313 * @return array
314 * Array(string $name => string $uniqueName).
315 */
316 static function &fieldKeys() {
317 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
318 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
319 }
320 return Civi::$statics[__CLASS__]['fieldKeys'];
321 }
322 /**
323 * Returns the names of this table
324 *
325 * @return string
326 */
327 static function getTableName() {
328 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
329 }
330 /**
331 * Returns if this table needs to be logged
332 *
333 * @return boolean
334 */
335 function getLog() {
336 return self::$_log;
337 }
338 /**
339 * Returns the list of fields that can be imported
340 *
341 * @param bool $prefix
342 *
343 * @return array
344 */
345 static function &import($prefix = false) {
346 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, array());
347 return $r;
348 }
349 /**
350 * Returns the list of fields that can be exported
351 *
352 * @param bool $prefix
353 *
354 * @return array
355 */
356 static function &export($prefix = false) {
357 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, array());
358 return $r;
359 }
360 }