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:d4817f5b53ace3909b94c7f6baff5964)
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',
173 'name' => 'entity_table',
174 'type' => CRM_Utils_Type
::T_STRING
,
175 'title' => ts('Entity Table'),
177 'size' => CRM_Utils_Type
::BIG
,
178 'where' => 'civicrm_pcp_block.entity_table',
179 'table_name' => 'civicrm_pcp_block',
180 'entity' => 'PCPBlock',
181 'bao' => 'CRM_PCP_BAO_PCPBlock',
185 'name' => 'entity_id',
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Entity'),
188 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
190 'where' => 'civicrm_pcp_block.entity_id',
191 'table_name' => 'civicrm_pcp_block',
192 'entity' => 'PCPBlock',
193 'bao' => 'CRM_PCP_BAO_PCPBlock',
196 'target_entity_type' => [
197 'name' => 'target_entity_type',
198 'type' => CRM_Utils_Type
::T_STRING
,
199 'title' => ts('Target Entity'),
200 'description' => ts('The type of entity that this pcp targets'),
203 'size' => CRM_Utils_Type
::HUGE
,
204 'where' => 'civicrm_pcp_block.target_entity_type',
205 'default' => 'contribute',
206 'table_name' => 'civicrm_pcp_block',
207 'entity' => 'PCPBlock',
208 'bao' => 'CRM_PCP_BAO_PCPBlock',
211 'target_entity_id' => [
212 'name' => 'target_entity_id',
213 'type' => CRM_Utils_Type
::T_INT
,
214 'title' => ts('Target Entity ID'),
215 'description' => ts('The entity that this pcp targets'),
217 'where' => 'civicrm_pcp_block.target_entity_id',
218 'table_name' => 'civicrm_pcp_block',
219 'entity' => 'PCPBlock',
220 'bao' => 'CRM_PCP_BAO_PCPBlock',
223 'supporter_profile_id' => [
224 'name' => 'supporter_profile_id',
225 'type' => CRM_Utils_Type
::T_INT
,
226 'title' => ts('Supporter Profile'),
227 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
228 'where' => 'civicrm_pcp_block.supporter_profile_id',
230 'table_name' => 'civicrm_pcp_block',
231 'entity' => 'PCPBlock',
232 'bao' => 'CRM_PCP_BAO_PCPBlock',
234 'FKClassName' => 'CRM_Core_DAO_UFGroup',
236 'owner_notify_id' => [
237 'name' => 'owner_notify_id',
238 'type' => CRM_Utils_Type
::T_INT
,
239 'title' => ts('Owner Notification'),
240 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
241 'where' => 'civicrm_pcp_block.owner_notify_id',
243 'table_name' => 'civicrm_pcp_block',
244 'entity' => 'PCPBlock',
245 'bao' => 'CRM_PCP_BAO_PCPBlock',
250 'pseudoconstant' => [
251 'optionGroupName' => 'pcp_owner_notify',
252 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
255 'is_approval_needed' => [
256 'name' => 'is_approval_needed',
257 'type' => CRM_Utils_Type
::T_BOOLEAN
,
258 'title' => ts('Approval Required?'),
259 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
260 'where' => 'civicrm_pcp_block.is_approval_needed',
262 'table_name' => 'civicrm_pcp_block',
263 'entity' => 'PCPBlock',
264 'bao' => 'CRM_PCP_BAO_PCPBlock',
267 'is_tellfriend_enabled' => [
268 'name' => 'is_tellfriend_enabled',
269 'type' => CRM_Utils_Type
::T_BOOLEAN
,
270 'title' => ts('Tell a Friend Enabled?'),
271 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
272 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
274 'table_name' => 'civicrm_pcp_block',
275 'entity' => 'PCPBlock',
276 'bao' => 'CRM_PCP_BAO_PCPBlock',
279 'tellfriend_limit' => [
280 'name' => 'tellfriend_limit',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('Tell A Friend Limit'),
283 'description' => ts('Maximum recipient fields allowed in tell a friend'),
284 'where' => 'civicrm_pcp_block.tellfriend_limit',
286 'table_name' => 'civicrm_pcp_block',
287 'entity' => 'PCPBlock',
288 'bao' => 'CRM_PCP_BAO_PCPBlock',
292 'name' => 'link_text',
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('Link Text'),
295 'description' => ts('Link text for PCP.'),
297 'size' => CRM_Utils_Type
::HUGE
,
298 'where' => 'civicrm_pcp_block.link_text',
300 'table_name' => 'civicrm_pcp_block',
301 'entity' => 'PCPBlock',
302 'bao' => 'CRM_PCP_BAO_PCPBlock',
306 'name' => 'is_active',
307 'type' => CRM_Utils_Type
::T_BOOLEAN
,
308 'title' => ts('Enabled?'),
309 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
310 'where' => 'civicrm_pcp_block.is_active',
312 'table_name' => 'civicrm_pcp_block',
313 'entity' => 'PCPBlock',
314 'bao' => 'CRM_PCP_BAO_PCPBlock',
318 'name' => 'notify_email',
319 'type' => CRM_Utils_Type
::T_STRING
,
320 'title' => ts('Notification Email'),
321 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
323 'size' => CRM_Utils_Type
::HUGE
,
324 'where' => 'civicrm_pcp_block.notify_email',
326 'table_name' => 'civicrm_pcp_block',
327 'entity' => 'PCPBlock',
328 'bao' => 'CRM_PCP_BAO_PCPBlock',
332 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
334 return Civi
::$statics[__CLASS__
]['fields'];
338 * Return a mapping from field-name to the corresponding key (as used in fields()).
341 * Array(string $name => string $uniqueName).
343 public static function &fieldKeys() {
344 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
345 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
347 return Civi
::$statics[__CLASS__
]['fieldKeys'];
351 * Returns the names of this table
355 public static function getTableName() {
356 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
360 * Returns if this table needs to be logged
364 public function getLog() {
369 * Returns the list of fields that can be imported
371 * @param bool $prefix
375 public static function &import($prefix = FALSE) {
376 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp_block', $prefix, []);
381 * Returns the list of fields that can be exported
383 * @param bool $prefix
387 public static function &export($prefix = FALSE) {
388 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp_block', $prefix, []);
393 * Returns the list of indices
395 * @param bool $localize
399 public static function indices($localize = TRUE) {
401 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;