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:520b1c5953cbbc59f2d8f017a47447ce)
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 * @param bool $plural
134 * Whether to return the plural version of the title.
136 public static function getEntityTitle($plural = FALSE) {
137 return $plural ?
ts('PCPBlocks') : ts('PCPBlock');
141 * Returns foreign keys and entity references.
144 * [CRM_Core_Reference_Interface]
146 public static function getReferenceColumns() {
147 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
148 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
149 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id');
150 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
151 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type');
152 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
154 return Civi
::$statics[__CLASS__
]['links'];
158 * Returns all the column names of this table
162 public static function &fields() {
163 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
164 Civi
::$statics[__CLASS__
]['fields'] = [
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('PCP Block ID'),
169 'description' => ts('PCP block Id'),
171 'where' => 'civicrm_pcp_block.id',
172 'table_name' => 'civicrm_pcp_block',
173 'entity' => 'PCPBlock',
174 'bao' => 'CRM_PCP_BAO_PCPBlock',
179 'name' => 'entity_table',
180 'type' => CRM_Utils_Type
::T_STRING
,
181 'title' => ts('Entity Table'),
183 'size' => CRM_Utils_Type
::BIG
,
184 'where' => 'civicrm_pcp_block.entity_table',
185 'table_name' => 'civicrm_pcp_block',
186 'entity' => 'PCPBlock',
187 'bao' => 'CRM_PCP_BAO_PCPBlock',
192 'name' => 'entity_id',
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Entity'),
195 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
197 'where' => 'civicrm_pcp_block.entity_id',
198 'table_name' => 'civicrm_pcp_block',
199 'entity' => 'PCPBlock',
200 'bao' => 'CRM_PCP_BAO_PCPBlock',
204 'target_entity_type' => [
205 'name' => 'target_entity_type',
206 'type' => CRM_Utils_Type
::T_STRING
,
207 'title' => ts('Target Entity'),
208 'description' => ts('The type of entity that this pcp targets'),
211 'size' => CRM_Utils_Type
::HUGE
,
212 'where' => 'civicrm_pcp_block.target_entity_type',
213 'default' => 'contribute',
214 'table_name' => 'civicrm_pcp_block',
215 'entity' => 'PCPBlock',
216 'bao' => 'CRM_PCP_BAO_PCPBlock',
220 'target_entity_id' => [
221 'name' => 'target_entity_id',
222 'type' => CRM_Utils_Type
::T_INT
,
223 'title' => ts('Target Entity ID'),
224 'description' => ts('The entity that this pcp targets'),
226 'where' => 'civicrm_pcp_block.target_entity_id',
227 'table_name' => 'civicrm_pcp_block',
228 'entity' => 'PCPBlock',
229 'bao' => 'CRM_PCP_BAO_PCPBlock',
233 'supporter_profile_id' => [
234 'name' => 'supporter_profile_id',
235 'type' => CRM_Utils_Type
::T_INT
,
236 'title' => ts('Supporter Profile'),
237 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
238 'where' => 'civicrm_pcp_block.supporter_profile_id',
240 'table_name' => 'civicrm_pcp_block',
241 'entity' => 'PCPBlock',
242 'bao' => 'CRM_PCP_BAO_PCPBlock',
244 'FKClassName' => 'CRM_Core_DAO_UFGroup',
247 'owner_notify_id' => [
248 'name' => 'owner_notify_id',
249 'type' => CRM_Utils_Type
::T_INT
,
250 'title' => ts('Owner Notification'),
251 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
252 'where' => 'civicrm_pcp_block.owner_notify_id',
254 'table_name' => 'civicrm_pcp_block',
255 'entity' => 'PCPBlock',
256 'bao' => 'CRM_PCP_BAO_PCPBlock',
261 'pseudoconstant' => [
262 'optionGroupName' => 'pcp_owner_notify',
263 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
267 'is_approval_needed' => [
268 'name' => 'is_approval_needed',
269 'type' => CRM_Utils_Type
::T_BOOLEAN
,
270 'title' => ts('Approval Required?'),
271 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
272 'where' => 'civicrm_pcp_block.is_approval_needed',
274 'table_name' => 'civicrm_pcp_block',
275 'entity' => 'PCPBlock',
276 'bao' => 'CRM_PCP_BAO_PCPBlock',
280 'is_tellfriend_enabled' => [
281 'name' => 'is_tellfriend_enabled',
282 'type' => CRM_Utils_Type
::T_BOOLEAN
,
283 'title' => ts('Tell a Friend Enabled?'),
284 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
285 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
287 'table_name' => 'civicrm_pcp_block',
288 'entity' => 'PCPBlock',
289 'bao' => 'CRM_PCP_BAO_PCPBlock',
293 'tellfriend_limit' => [
294 'name' => 'tellfriend_limit',
295 'type' => CRM_Utils_Type
::T_INT
,
296 'title' => ts('Tell A Friend Limit'),
297 'description' => ts('Maximum recipient fields allowed in tell a friend'),
298 'where' => 'civicrm_pcp_block.tellfriend_limit',
300 'table_name' => 'civicrm_pcp_block',
301 'entity' => 'PCPBlock',
302 'bao' => 'CRM_PCP_BAO_PCPBlock',
307 'name' => 'link_text',
308 'type' => CRM_Utils_Type
::T_STRING
,
309 'title' => ts('Link Text'),
310 'description' => ts('Link text for PCP.'),
312 'size' => CRM_Utils_Type
::HUGE
,
313 'where' => 'civicrm_pcp_block.link_text',
315 'table_name' => 'civicrm_pcp_block',
316 'entity' => 'PCPBlock',
317 'bao' => 'CRM_PCP_BAO_PCPBlock',
322 'name' => 'is_active',
323 'type' => CRM_Utils_Type
::T_BOOLEAN
,
324 'title' => ts('Enabled?'),
325 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
326 'where' => 'civicrm_pcp_block.is_active',
328 'table_name' => 'civicrm_pcp_block',
329 'entity' => 'PCPBlock',
330 'bao' => 'CRM_PCP_BAO_PCPBlock',
335 'name' => 'notify_email',
336 'type' => CRM_Utils_Type
::T_STRING
,
337 'title' => ts('Notification Email'),
338 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
340 'size' => CRM_Utils_Type
::HUGE
,
341 'where' => 'civicrm_pcp_block.notify_email',
343 'table_name' => 'civicrm_pcp_block',
344 'entity' => 'PCPBlock',
345 'bao' => 'CRM_PCP_BAO_PCPBlock',
350 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
352 return Civi
::$statics[__CLASS__
]['fields'];
356 * Return a mapping from field-name to the corresponding key (as used in fields()).
359 * Array(string $name => string $uniqueName).
361 public static function &fieldKeys() {
362 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
363 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
365 return Civi
::$statics[__CLASS__
]['fieldKeys'];
369 * Returns the names of this table
373 public static function getTableName() {
374 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
378 * Returns if this table needs to be logged
382 public function getLog() {
387 * Returns the list of fields that can be imported
389 * @param bool $prefix
393 public static function &import($prefix = FALSE) {
394 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp_block', $prefix, []);
399 * Returns the list of fields that can be exported
401 * @param bool $prefix
405 public static function &export($prefix = FALSE) {
406 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp_block', $prefix, []);
411 * Returns the list of indices
413 * @param bool $localize
417 public static function indices($localize = TRUE) {
419 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;