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:4b5ca843e0a3a2e4b439d03513b20682)
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',
184 'name' => 'entity_table',
185 'type' => CRM_Utils_Type
::T_STRING
,
186 'title' => ts('Entity Table'),
188 'size' => CRM_Utils_Type
::BIG
,
189 'where' => 'civicrm_pcp_block.entity_table',
190 'table_name' => 'civicrm_pcp_block',
191 'entity' => 'PCPBlock',
192 'bao' => 'CRM_PCP_BAO_PCPBlock',
197 'name' => 'entity_id',
198 'type' => CRM_Utils_Type
::T_INT
,
199 'title' => ts('Entity'),
200 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
202 'where' => 'civicrm_pcp_block.entity_id',
203 'table_name' => 'civicrm_pcp_block',
204 'entity' => 'PCPBlock',
205 'bao' => 'CRM_PCP_BAO_PCPBlock',
209 'target_entity_type' => [
210 'name' => 'target_entity_type',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Target Entity'),
213 'description' => ts('The type of entity that this pcp targets'),
216 'size' => CRM_Utils_Type
::HUGE
,
217 'where' => 'civicrm_pcp_block.target_entity_type',
218 'default' => 'contribute',
219 'table_name' => 'civicrm_pcp_block',
220 'entity' => 'PCPBlock',
221 'bao' => 'CRM_PCP_BAO_PCPBlock',
225 'target_entity_id' => [
226 'name' => 'target_entity_id',
227 'type' => CRM_Utils_Type
::T_INT
,
228 'title' => ts('Target Entity ID'),
229 'description' => ts('The entity that this pcp targets'),
231 'where' => 'civicrm_pcp_block.target_entity_id',
232 'table_name' => 'civicrm_pcp_block',
233 'entity' => 'PCPBlock',
234 'bao' => 'CRM_PCP_BAO_PCPBlock',
238 'supporter_profile_id' => [
239 'name' => 'supporter_profile_id',
240 'type' => CRM_Utils_Type
::T_INT
,
241 'title' => ts('Supporter Profile ID'),
242 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
243 'where' => 'civicrm_pcp_block.supporter_profile_id',
245 'table_name' => 'civicrm_pcp_block',
246 'entity' => 'PCPBlock',
247 'bao' => 'CRM_PCP_BAO_PCPBlock',
249 'FKClassName' => 'CRM_Core_DAO_UFGroup',
251 'label' => ts("Supporter Profile"),
255 'owner_notify_id' => [
256 'name' => 'owner_notify_id',
257 'type' => CRM_Utils_Type
::T_INT
,
258 'title' => ts('Owner Notification'),
259 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
260 'where' => 'civicrm_pcp_block.owner_notify_id',
262 'table_name' => 'civicrm_pcp_block',
263 'entity' => 'PCPBlock',
264 'bao' => 'CRM_PCP_BAO_PCPBlock',
269 'pseudoconstant' => [
270 'optionGroupName' => 'pcp_owner_notify',
271 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
275 'is_approval_needed' => [
276 'name' => 'is_approval_needed',
277 'type' => CRM_Utils_Type
::T_BOOLEAN
,
278 'title' => ts('Approval Required?'),
279 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
280 'where' => 'civicrm_pcp_block.is_approval_needed',
282 'table_name' => 'civicrm_pcp_block',
283 'entity' => 'PCPBlock',
284 'bao' => 'CRM_PCP_BAO_PCPBlock',
288 'is_tellfriend_enabled' => [
289 'name' => 'is_tellfriend_enabled',
290 'type' => CRM_Utils_Type
::T_BOOLEAN
,
291 'title' => ts('Tell a Friend Enabled?'),
292 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
293 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
295 'table_name' => 'civicrm_pcp_block',
296 'entity' => 'PCPBlock',
297 'bao' => 'CRM_PCP_BAO_PCPBlock',
301 'tellfriend_limit' => [
302 'name' => 'tellfriend_limit',
303 'type' => CRM_Utils_Type
::T_INT
,
304 'title' => ts('Tell A Friend Limit'),
305 'description' => ts('Maximum recipient fields allowed in tell a friend'),
306 'where' => 'civicrm_pcp_block.tellfriend_limit',
308 'table_name' => 'civicrm_pcp_block',
309 'entity' => 'PCPBlock',
310 'bao' => 'CRM_PCP_BAO_PCPBlock',
315 'name' => 'link_text',
316 'type' => CRM_Utils_Type
::T_STRING
,
317 'title' => ts('Link Text'),
318 'description' => ts('Link text for PCP.'),
320 'size' => CRM_Utils_Type
::HUGE
,
321 'where' => 'civicrm_pcp_block.link_text',
323 'table_name' => 'civicrm_pcp_block',
324 'entity' => 'PCPBlock',
325 'bao' => 'CRM_PCP_BAO_PCPBlock',
330 'name' => 'is_active',
331 'type' => CRM_Utils_Type
::T_BOOLEAN
,
332 'title' => ts('Enabled?'),
333 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
334 'where' => 'civicrm_pcp_block.is_active',
336 'table_name' => 'civicrm_pcp_block',
337 'entity' => 'PCPBlock',
338 'bao' => 'CRM_PCP_BAO_PCPBlock',
343 'name' => 'notify_email',
344 'type' => CRM_Utils_Type
::T_STRING
,
345 'title' => ts('Notification Email'),
346 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
348 'size' => CRM_Utils_Type
::HUGE
,
349 'where' => 'civicrm_pcp_block.notify_email',
351 'table_name' => 'civicrm_pcp_block',
352 'entity' => 'PCPBlock',
353 'bao' => 'CRM_PCP_BAO_PCPBlock',
358 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
360 return Civi
::$statics[__CLASS__
]['fields'];
364 * Return a mapping from field-name to the corresponding key (as used in fields()).
367 * Array(string $name => string $uniqueName).
369 public static function &fieldKeys() {
370 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
371 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
373 return Civi
::$statics[__CLASS__
]['fieldKeys'];
377 * Returns the names of this table
381 public static function getTableName() {
382 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
386 * Returns if this table needs to be logged
390 public function getLog() {
395 * Returns the list of fields that can be imported
397 * @param bool $prefix
401 public static function &import($prefix = FALSE) {
402 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp_block', $prefix, []);
407 * Returns the list of fields that can be exported
409 * @param bool $prefix
413 public static function &export($prefix = FALSE) {
414 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp_block', $prefix, []);
419 * Returns the list of indices
421 * @param bool $localize
425 public static function indices($localize = TRUE) {
427 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;