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:4e188de537dbafef837dcc55947ee1b4)
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';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_pcp_block';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
47 * FK to civicrm_contribution_page.id OR civicrm_event.id
54 * The type of entity that this pcp targets
58 public $target_entity_type;
61 * The entity that this pcp targets
65 public $target_entity_id;
68 * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
72 public $supporter_profile_id;
75 * FK to civicrm_option_group with name = PCP owner notifications
79 public $owner_notify_id;
82 * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
86 public $is_approval_needed;
89 * Does Personal Campaign Page allow using tell a friend?
93 public $is_tellfriend_enabled;
96 * Maximum recipient fields allowed in tell a friend
100 public $tellfriend_limit;
110 * Is Personal Campaign Page Block enabled/active?
117 * If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page
121 public $notify_email;
126 public function __construct() {
127 $this->__table
= 'civicrm_pcp_block';
128 parent
::__construct();
132 * Returns localized title of this entity.
134 * @param bool $plural
135 * Whether to return the plural version of the title.
137 public static function getEntityTitle($plural = FALSE) {
138 return $plural ?
ts('PCPBlocks') : ts('PCPBlock');
142 * Returns foreign keys and entity references.
145 * [CRM_Core_Reference_Interface]
147 public static function getReferenceColumns() {
148 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
149 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
150 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id');
151 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
152 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type');
153 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
155 return Civi
::$statics[__CLASS__
]['links'];
159 * Returns all the column names of this table
163 public static function &fields() {
164 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
165 Civi
::$statics[__CLASS__
]['fields'] = [
168 'type' => CRM_Utils_Type
::T_INT
,
169 'title' => ts('PCP Block ID'),
170 'description' => ts('PCP block Id'),
172 'where' => 'civicrm_pcp_block.id',
173 'table_name' => 'civicrm_pcp_block',
174 'entity' => 'PCPBlock',
175 'bao' => 'CRM_PCP_BAO_PCPBlock',
180 'name' => 'entity_table',
181 'type' => CRM_Utils_Type
::T_STRING
,
182 'title' => ts('Entity Table'),
184 'size' => CRM_Utils_Type
::BIG
,
185 'where' => 'civicrm_pcp_block.entity_table',
186 'table_name' => 'civicrm_pcp_block',
187 'entity' => 'PCPBlock',
188 'bao' => 'CRM_PCP_BAO_PCPBlock',
193 'name' => 'entity_id',
194 'type' => CRM_Utils_Type
::T_INT
,
195 'title' => ts('Entity'),
196 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
198 'where' => 'civicrm_pcp_block.entity_id',
199 'table_name' => 'civicrm_pcp_block',
200 'entity' => 'PCPBlock',
201 'bao' => 'CRM_PCP_BAO_PCPBlock',
205 'target_entity_type' => [
206 'name' => 'target_entity_type',
207 'type' => CRM_Utils_Type
::T_STRING
,
208 'title' => ts('Target Entity'),
209 'description' => ts('The type of entity that this pcp targets'),
212 'size' => CRM_Utils_Type
::HUGE
,
213 'where' => 'civicrm_pcp_block.target_entity_type',
214 'default' => 'contribute',
215 'table_name' => 'civicrm_pcp_block',
216 'entity' => 'PCPBlock',
217 'bao' => 'CRM_PCP_BAO_PCPBlock',
221 'target_entity_id' => [
222 'name' => 'target_entity_id',
223 'type' => CRM_Utils_Type
::T_INT
,
224 'title' => ts('Target Entity ID'),
225 'description' => ts('The entity that this pcp targets'),
227 'where' => 'civicrm_pcp_block.target_entity_id',
228 'table_name' => 'civicrm_pcp_block',
229 'entity' => 'PCPBlock',
230 'bao' => 'CRM_PCP_BAO_PCPBlock',
234 'supporter_profile_id' => [
235 'name' => 'supporter_profile_id',
236 'type' => CRM_Utils_Type
::T_INT
,
237 'title' => ts('Supporter Profile'),
238 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
239 'where' => 'civicrm_pcp_block.supporter_profile_id',
241 'table_name' => 'civicrm_pcp_block',
242 'entity' => 'PCPBlock',
243 'bao' => 'CRM_PCP_BAO_PCPBlock',
245 'FKClassName' => 'CRM_Core_DAO_UFGroup',
248 'owner_notify_id' => [
249 'name' => 'owner_notify_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Owner Notification'),
252 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
253 'where' => 'civicrm_pcp_block.owner_notify_id',
255 'table_name' => 'civicrm_pcp_block',
256 'entity' => 'PCPBlock',
257 'bao' => 'CRM_PCP_BAO_PCPBlock',
262 'pseudoconstant' => [
263 'optionGroupName' => 'pcp_owner_notify',
264 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
268 'is_approval_needed' => [
269 'name' => 'is_approval_needed',
270 'type' => CRM_Utils_Type
::T_BOOLEAN
,
271 'title' => ts('Approval Required?'),
272 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
273 'where' => 'civicrm_pcp_block.is_approval_needed',
275 'table_name' => 'civicrm_pcp_block',
276 'entity' => 'PCPBlock',
277 'bao' => 'CRM_PCP_BAO_PCPBlock',
281 'is_tellfriend_enabled' => [
282 'name' => 'is_tellfriend_enabled',
283 'type' => CRM_Utils_Type
::T_BOOLEAN
,
284 'title' => ts('Tell a Friend Enabled?'),
285 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
286 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
288 'table_name' => 'civicrm_pcp_block',
289 'entity' => 'PCPBlock',
290 'bao' => 'CRM_PCP_BAO_PCPBlock',
294 'tellfriend_limit' => [
295 'name' => 'tellfriend_limit',
296 'type' => CRM_Utils_Type
::T_INT
,
297 'title' => ts('Tell A Friend Limit'),
298 'description' => ts('Maximum recipient fields allowed in tell a friend'),
299 'where' => 'civicrm_pcp_block.tellfriend_limit',
301 'table_name' => 'civicrm_pcp_block',
302 'entity' => 'PCPBlock',
303 'bao' => 'CRM_PCP_BAO_PCPBlock',
308 'name' => 'link_text',
309 'type' => CRM_Utils_Type
::T_STRING
,
310 'title' => ts('Link Text'),
311 'description' => ts('Link text for PCP.'),
313 'size' => CRM_Utils_Type
::HUGE
,
314 'where' => 'civicrm_pcp_block.link_text',
316 'table_name' => 'civicrm_pcp_block',
317 'entity' => 'PCPBlock',
318 'bao' => 'CRM_PCP_BAO_PCPBlock',
323 'name' => 'is_active',
324 'type' => CRM_Utils_Type
::T_BOOLEAN
,
325 'title' => ts('Enabled?'),
326 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
327 'where' => 'civicrm_pcp_block.is_active',
329 'table_name' => 'civicrm_pcp_block',
330 'entity' => 'PCPBlock',
331 'bao' => 'CRM_PCP_BAO_PCPBlock',
336 'name' => 'notify_email',
337 'type' => CRM_Utils_Type
::T_STRING
,
338 'title' => ts('Notification Email'),
339 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
341 'size' => CRM_Utils_Type
::HUGE
,
342 'where' => 'civicrm_pcp_block.notify_email',
344 'table_name' => 'civicrm_pcp_block',
345 'entity' => 'PCPBlock',
346 'bao' => 'CRM_PCP_BAO_PCPBlock',
351 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
353 return Civi
::$statics[__CLASS__
]['fields'];
357 * Return a mapping from field-name to the corresponding key (as used in fields()).
360 * Array(string $name => string $uniqueName).
362 public static function &fieldKeys() {
363 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
364 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
366 return Civi
::$statics[__CLASS__
]['fieldKeys'];
370 * Returns the names of this table
374 public static function getTableName() {
375 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
379 * Returns if this table needs to be logged
383 public function getLog() {
388 * Returns the list of fields that can be imported
390 * @param bool $prefix
394 public static function &import($prefix = FALSE) {
395 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp_block', $prefix, []);
400 * Returns the list of fields that can be exported
402 * @param bool $prefix
406 public static function &export($prefix = FALSE) {
407 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp_block', $prefix, []);
412 * Returns the list of indices
414 * @param bool $localize
418 public static function indices($localize = TRUE) {
420 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;