5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/PCP/PCPBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ea1b4158570c5a79356b1dc0ad80db6a)
13 * Database access object for the PCPBlock entity.
15 class CRM_PCP_DAO_PCPBlock
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.2';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_pcp_block';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
46 * FK to civicrm_contribution_page.id OR civicrm_event.id
53 * The type of entity that this pcp targets
57 public $target_entity_type;
60 * The entity that this pcp targets
64 public $target_entity_id;
67 * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
71 public $supporter_profile_id;
74 * FK to civicrm_option_group with name = PCP owner notifications
78 public $owner_notify_id;
81 * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
85 public $is_approval_needed;
88 * Does Personal Campaign Page allow using tell a friend?
92 public $is_tellfriend_enabled;
95 * Maximum recipient fields allowed in tell a friend
99 public $tellfriend_limit;
109 * Is Personal Campaign Page Block enabled/active?
116 * If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page
120 public $notify_email;
125 public function __construct() {
126 $this->__table
= 'civicrm_pcp_block';
127 parent
::__construct();
131 * Returns localized title of this entity.
133 public static function getEntityTitle() {
134 return ts('PCPBlocks');
138 * Returns foreign keys and entity references.
141 * [CRM_Core_Reference_Interface]
143 public 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']);
151 return Civi
::$statics[__CLASS__
]['links'];
155 * Returns all the column names of this table
159 public static function &fields() {
160 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
161 Civi
::$statics[__CLASS__
]['fields'] = [
164 'type' => CRM_Utils_Type
::T_INT
,
165 'title' => ts('PCP Block ID'),
166 'description' => ts('PCP block Id'),
168 'where' => 'civicrm_pcp_block.id',
169 'table_name' => 'civicrm_pcp_block',
170 'entity' => 'PCPBlock',
171 'bao' => 'CRM_PCP_BAO_PCPBlock',
176 'name' => 'entity_table',
177 'type' => CRM_Utils_Type
::T_STRING
,
178 'title' => ts('Entity Table'),
180 'size' => CRM_Utils_Type
::BIG
,
181 'where' => 'civicrm_pcp_block.entity_table',
182 'table_name' => 'civicrm_pcp_block',
183 'entity' => 'PCPBlock',
184 'bao' => 'CRM_PCP_BAO_PCPBlock',
189 'name' => 'entity_id',
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Entity'),
192 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
194 'where' => 'civicrm_pcp_block.entity_id',
195 'table_name' => 'civicrm_pcp_block',
196 'entity' => 'PCPBlock',
197 'bao' => 'CRM_PCP_BAO_PCPBlock',
201 'target_entity_type' => [
202 'name' => 'target_entity_type',
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Target Entity'),
205 'description' => ts('The type of entity that this pcp targets'),
208 'size' => CRM_Utils_Type
::HUGE
,
209 'where' => 'civicrm_pcp_block.target_entity_type',
210 'default' => 'contribute',
211 'table_name' => 'civicrm_pcp_block',
212 'entity' => 'PCPBlock',
213 'bao' => 'CRM_PCP_BAO_PCPBlock',
217 'target_entity_id' => [
218 'name' => 'target_entity_id',
219 'type' => CRM_Utils_Type
::T_INT
,
220 'title' => ts('Target Entity ID'),
221 'description' => ts('The entity that this pcp targets'),
223 'where' => 'civicrm_pcp_block.target_entity_id',
224 'table_name' => 'civicrm_pcp_block',
225 'entity' => 'PCPBlock',
226 'bao' => 'CRM_PCP_BAO_PCPBlock',
230 'supporter_profile_id' => [
231 'name' => 'supporter_profile_id',
232 'type' => CRM_Utils_Type
::T_INT
,
233 'title' => ts('Supporter Profile'),
234 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
235 'where' => 'civicrm_pcp_block.supporter_profile_id',
237 'table_name' => 'civicrm_pcp_block',
238 'entity' => 'PCPBlock',
239 'bao' => 'CRM_PCP_BAO_PCPBlock',
241 'FKClassName' => 'CRM_Core_DAO_UFGroup',
244 'owner_notify_id' => [
245 'name' => 'owner_notify_id',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Owner Notification'),
248 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
249 'where' => 'civicrm_pcp_block.owner_notify_id',
251 'table_name' => 'civicrm_pcp_block',
252 'entity' => 'PCPBlock',
253 'bao' => 'CRM_PCP_BAO_PCPBlock',
258 'pseudoconstant' => [
259 'optionGroupName' => 'pcp_owner_notify',
260 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
264 'is_approval_needed' => [
265 'name' => 'is_approval_needed',
266 'type' => CRM_Utils_Type
::T_BOOLEAN
,
267 'title' => ts('Approval Required?'),
268 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
269 'where' => 'civicrm_pcp_block.is_approval_needed',
271 'table_name' => 'civicrm_pcp_block',
272 'entity' => 'PCPBlock',
273 'bao' => 'CRM_PCP_BAO_PCPBlock',
277 'is_tellfriend_enabled' => [
278 'name' => 'is_tellfriend_enabled',
279 'type' => CRM_Utils_Type
::T_BOOLEAN
,
280 'title' => ts('Tell a Friend Enabled?'),
281 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
282 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
284 'table_name' => 'civicrm_pcp_block',
285 'entity' => 'PCPBlock',
286 'bao' => 'CRM_PCP_BAO_PCPBlock',
290 'tellfriend_limit' => [
291 'name' => 'tellfriend_limit',
292 'type' => CRM_Utils_Type
::T_INT
,
293 'title' => ts('Tell A Friend Limit'),
294 'description' => ts('Maximum recipient fields allowed in tell a friend'),
295 'where' => 'civicrm_pcp_block.tellfriend_limit',
297 'table_name' => 'civicrm_pcp_block',
298 'entity' => 'PCPBlock',
299 'bao' => 'CRM_PCP_BAO_PCPBlock',
304 'name' => 'link_text',
305 'type' => CRM_Utils_Type
::T_STRING
,
306 'title' => ts('Link Text'),
307 'description' => ts('Link text for PCP.'),
309 'size' => CRM_Utils_Type
::HUGE
,
310 'where' => 'civicrm_pcp_block.link_text',
312 'table_name' => 'civicrm_pcp_block',
313 'entity' => 'PCPBlock',
314 'bao' => 'CRM_PCP_BAO_PCPBlock',
319 'name' => 'is_active',
320 'type' => CRM_Utils_Type
::T_BOOLEAN
,
321 'title' => ts('Enabled?'),
322 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
323 'where' => 'civicrm_pcp_block.is_active',
325 'table_name' => 'civicrm_pcp_block',
326 'entity' => 'PCPBlock',
327 'bao' => 'CRM_PCP_BAO_PCPBlock',
332 'name' => 'notify_email',
333 'type' => CRM_Utils_Type
::T_STRING
,
334 'title' => ts('Notification Email'),
335 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
337 'size' => CRM_Utils_Type
::HUGE
,
338 'where' => 'civicrm_pcp_block.notify_email',
340 'table_name' => 'civicrm_pcp_block',
341 'entity' => 'PCPBlock',
342 'bao' => 'CRM_PCP_BAO_PCPBlock',
347 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
349 return Civi
::$statics[__CLASS__
]['fields'];
353 * Return a mapping from field-name to the corresponding key (as used in fields()).
356 * Array(string $name => string $uniqueName).
358 public static function &fieldKeys() {
359 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
360 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
362 return Civi
::$statics[__CLASS__
]['fieldKeys'];
366 * Returns the names of this table
370 public static function getTableName() {
371 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
375 * Returns if this table needs to be logged
379 public function getLog() {
384 * Returns the list of fields that can be imported
386 * @param bool $prefix
390 public static function &import($prefix = FALSE) {
391 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp_block', $prefix, []);
396 * Returns the list of fields that can be exported
398 * @param bool $prefix
402 public static function &export($prefix = FALSE) {
403 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp_block', $prefix, []);
408 * Returns the list of indices
410 * @param bool $localize
414 public static function indices($localize = TRUE) {
416 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;