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:039e37edb86cfd25e6c882ce4950e3c9)
13 * Database access object for the PCPBlock entity.
15 class CRM_PCP_DAO_PCPBlock
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_pcp_block';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
44 * FK to civicrm_contribution_page.id OR civicrm_event.id
51 * The type of entity that this pcp targets
55 public $target_entity_type;
58 * The entity that this pcp targets
62 public $target_entity_id;
65 * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
69 public $supporter_profile_id;
72 * FK to civicrm_option_group with name = PCP owner notifications
76 public $owner_notify_id;
79 * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
83 public $is_approval_needed;
86 * Does Personal Campaign Page allow using tell a friend?
90 public $is_tellfriend_enabled;
93 * Maximum recipient fields allowed in tell a friend
97 public $tellfriend_limit;
107 * Is Personal Campaign Page Block enabled/active?
114 * If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page
118 public $notify_email;
123 public function __construct() {
124 $this->__table
= 'civicrm_pcp_block';
125 parent
::__construct();
129 * Returns localized title of this entity.
131 public static function getEntityTitle() {
132 return ts('PCPBlocks');
136 * Returns foreign keys and entity references.
139 * [CRM_Core_Reference_Interface]
141 public static function getReferenceColumns() {
142 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
143 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
144 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id');
145 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
146 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type');
147 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
149 return Civi
::$statics[__CLASS__
]['links'];
153 * Returns all the column names of this table
157 public static function &fields() {
158 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
159 Civi
::$statics[__CLASS__
]['fields'] = [
162 'type' => CRM_Utils_Type
::T_INT
,
163 'title' => ts('PCP Block ID'),
164 'description' => ts('PCP block Id'),
166 'where' => 'civicrm_pcp_block.id',
167 'table_name' => 'civicrm_pcp_block',
168 'entity' => 'PCPBlock',
169 'bao' => 'CRM_PCP_BAO_PCPBlock',
174 'name' => 'entity_table',
175 'type' => CRM_Utils_Type
::T_STRING
,
176 'title' => ts('Entity Table'),
178 'size' => CRM_Utils_Type
::BIG
,
179 'where' => 'civicrm_pcp_block.entity_table',
180 'table_name' => 'civicrm_pcp_block',
181 'entity' => 'PCPBlock',
182 'bao' => 'CRM_PCP_BAO_PCPBlock',
187 'name' => 'entity_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Entity'),
190 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
192 'where' => 'civicrm_pcp_block.entity_id',
193 'table_name' => 'civicrm_pcp_block',
194 'entity' => 'PCPBlock',
195 'bao' => 'CRM_PCP_BAO_PCPBlock',
199 'target_entity_type' => [
200 'name' => 'target_entity_type',
201 'type' => CRM_Utils_Type
::T_STRING
,
202 'title' => ts('Target Entity'),
203 'description' => ts('The type of entity that this pcp targets'),
206 'size' => CRM_Utils_Type
::HUGE
,
207 'where' => 'civicrm_pcp_block.target_entity_type',
208 'default' => 'contribute',
209 'table_name' => 'civicrm_pcp_block',
210 'entity' => 'PCPBlock',
211 'bao' => 'CRM_PCP_BAO_PCPBlock',
215 'target_entity_id' => [
216 'name' => 'target_entity_id',
217 'type' => CRM_Utils_Type
::T_INT
,
218 'title' => ts('Target Entity ID'),
219 'description' => ts('The entity that this pcp targets'),
221 'where' => 'civicrm_pcp_block.target_entity_id',
222 'table_name' => 'civicrm_pcp_block',
223 'entity' => 'PCPBlock',
224 'bao' => 'CRM_PCP_BAO_PCPBlock',
228 'supporter_profile_id' => [
229 'name' => 'supporter_profile_id',
230 'type' => CRM_Utils_Type
::T_INT
,
231 'title' => ts('Supporter Profile'),
232 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
233 'where' => 'civicrm_pcp_block.supporter_profile_id',
235 'table_name' => 'civicrm_pcp_block',
236 'entity' => 'PCPBlock',
237 'bao' => 'CRM_PCP_BAO_PCPBlock',
239 'FKClassName' => 'CRM_Core_DAO_UFGroup',
242 'owner_notify_id' => [
243 'name' => 'owner_notify_id',
244 'type' => CRM_Utils_Type
::T_INT
,
245 'title' => ts('Owner Notification'),
246 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
247 'where' => 'civicrm_pcp_block.owner_notify_id',
249 'table_name' => 'civicrm_pcp_block',
250 'entity' => 'PCPBlock',
251 'bao' => 'CRM_PCP_BAO_PCPBlock',
256 'pseudoconstant' => [
257 'optionGroupName' => 'pcp_owner_notify',
258 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
262 'is_approval_needed' => [
263 'name' => 'is_approval_needed',
264 'type' => CRM_Utils_Type
::T_BOOLEAN
,
265 'title' => ts('Approval Required?'),
266 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
267 'where' => 'civicrm_pcp_block.is_approval_needed',
269 'table_name' => 'civicrm_pcp_block',
270 'entity' => 'PCPBlock',
271 'bao' => 'CRM_PCP_BAO_PCPBlock',
275 'is_tellfriend_enabled' => [
276 'name' => 'is_tellfriend_enabled',
277 'type' => CRM_Utils_Type
::T_BOOLEAN
,
278 'title' => ts('Tell a Friend Enabled?'),
279 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
280 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
282 'table_name' => 'civicrm_pcp_block',
283 'entity' => 'PCPBlock',
284 'bao' => 'CRM_PCP_BAO_PCPBlock',
288 'tellfriend_limit' => [
289 'name' => 'tellfriend_limit',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Tell A Friend Limit'),
292 'description' => ts('Maximum recipient fields allowed in tell a friend'),
293 'where' => 'civicrm_pcp_block.tellfriend_limit',
295 'table_name' => 'civicrm_pcp_block',
296 'entity' => 'PCPBlock',
297 'bao' => 'CRM_PCP_BAO_PCPBlock',
302 'name' => 'link_text',
303 'type' => CRM_Utils_Type
::T_STRING
,
304 'title' => ts('Link Text'),
305 'description' => ts('Link text for PCP.'),
307 'size' => CRM_Utils_Type
::HUGE
,
308 'where' => 'civicrm_pcp_block.link_text',
310 'table_name' => 'civicrm_pcp_block',
311 'entity' => 'PCPBlock',
312 'bao' => 'CRM_PCP_BAO_PCPBlock',
317 'name' => 'is_active',
318 'type' => CRM_Utils_Type
::T_BOOLEAN
,
319 'title' => ts('Enabled?'),
320 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
321 'where' => 'civicrm_pcp_block.is_active',
323 'table_name' => 'civicrm_pcp_block',
324 'entity' => 'PCPBlock',
325 'bao' => 'CRM_PCP_BAO_PCPBlock',
330 'name' => 'notify_email',
331 'type' => CRM_Utils_Type
::T_STRING
,
332 'title' => ts('Notification Email'),
333 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
335 'size' => CRM_Utils_Type
::HUGE
,
336 'where' => 'civicrm_pcp_block.notify_email',
338 'table_name' => 'civicrm_pcp_block',
339 'entity' => 'PCPBlock',
340 'bao' => 'CRM_PCP_BAO_PCPBlock',
345 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
347 return Civi
::$statics[__CLASS__
]['fields'];
351 * Return a mapping from field-name to the corresponding key (as used in fields()).
354 * Array(string $name => string $uniqueName).
356 public static function &fieldKeys() {
357 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
358 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
360 return Civi
::$statics[__CLASS__
]['fieldKeys'];
364 * Returns the names of this table
368 public static function getTableName() {
369 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
373 * Returns if this table needs to be logged
377 public function getLog() {
382 * Returns the list of fields that can be imported
384 * @param bool $prefix
388 public static function &import($prefix = FALSE) {
389 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp_block', $prefix, []);
394 * Returns the list of fields that can be exported
396 * @param bool $prefix
400 public static function &export($prefix = FALSE) {
401 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp_block', $prefix, []);
406 * Returns the list of indices
408 * @param bool $localize
412 public static function indices($localize = TRUE) {
414 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;