3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Campaign/Campaign.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:02b05b18f25c40f15b6992e2f853f5da)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Campaign_DAO_Campaign constructor.
40 class CRM_Campaign_DAO_Campaign
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_campaign';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * Name of the Campaign.
66 * Title of the Campaign.
72 * Full description of Campaign.
78 * Date and time that Campaign starts.
84 * Date and time that Campaign ends.
90 * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type
94 public $campaign_type_id;
96 * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status
102 * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
106 public $external_identifier;
108 * Optional parent id for this Campaign.
114 * Is this Campaign enabled or disabled/cancelled?
120 * FK to civicrm_contact, who created this Campaign.
126 * Date and time that Campaign was created.
130 public $created_date;
132 * FK to civicrm_contact, who recently edited this Campaign.
136 public $last_modified_id;
138 * Date and time that Campaign was edited last time.
142 public $last_modified_date;
144 * General goals for Campaign.
148 public $goal_general;
150 * The target revenue for this campaign.
154 public $goal_revenue;
158 function __construct() {
159 $this->__table
= 'civicrm_campaign';
160 parent
::__construct();
163 * Returns foreign keys and entity references.
166 * [CRM_Core_Reference_Interface]
168 static function getReferenceColumns() {
169 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
170 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
171 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'parent_id', 'civicrm_campaign', 'id');
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'created_id', 'civicrm_contact', 'id');
173 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'last_modified_id', 'civicrm_contact', 'id');
174 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
176 return Civi
::$statics[__CLASS__
]['links'];
179 * Returns all the column names of this table
183 static function &fields() {
184 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
185 Civi
::$statics[__CLASS__
]['fields'] = array(
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Campaign ID') ,
190 'description' => 'Unique Campaign ID.',
193 'where' => 'civicrm_campaign.id',
194 'headerPattern' => '',
197 'table_name' => 'civicrm_campaign',
198 'entity' => 'Campaign',
199 'bao' => 'CRM_Campaign_BAO_Campaign',
204 'type' => CRM_Utils_Type
::T_STRING
,
205 'title' => ts('Campaign Name') ,
206 'description' => 'Name of the Campaign.',
209 'size' => CRM_Utils_Type
::HUGE
,
211 'where' => 'civicrm_campaign.name',
212 'headerPattern' => '',
215 'table_name' => 'civicrm_campaign',
216 'entity' => 'Campaign',
217 'bao' => 'CRM_Campaign_BAO_Campaign',
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Campaign Title') ,
227 'description' => 'Title of the Campaign.',
229 'size' => CRM_Utils_Type
::HUGE
,
231 'where' => 'civicrm_campaign.title',
232 'headerPattern' => '',
235 'table_name' => 'civicrm_campaign',
236 'entity' => 'Campaign',
237 'bao' => 'CRM_Campaign_BAO_Campaign',
243 'description' => array(
244 'name' => 'description',
245 'type' => CRM_Utils_Type
::T_TEXT
,
246 'title' => ts('Campaign Description') ,
247 'description' => 'Full description of Campaign.',
250 'table_name' => 'civicrm_campaign',
251 'entity' => 'Campaign',
252 'bao' => 'CRM_Campaign_BAO_Campaign',
255 'type' => 'TextArea',
258 'start_date' => array(
259 'name' => 'start_date',
260 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
261 'title' => ts('Campaign Start Date') ,
262 'description' => 'Date and time that Campaign starts.',
264 'where' => 'civicrm_campaign.start_date',
265 'headerPattern' => '/^start|(s(tart\s)?date)$/i',
268 'table_name' => 'civicrm_campaign',
269 'entity' => 'Campaign',
270 'bao' => 'CRM_Campaign_BAO_Campaign',
273 'type' => 'Select Date',
277 'name' => 'end_date',
278 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
279 'title' => ts('Campaign End Date') ,
280 'description' => 'Date and time that Campaign ends.',
282 'where' => 'civicrm_campaign.end_date',
283 'headerPattern' => '/^end|(e(nd\s)?date)$/i',
286 'table_name' => 'civicrm_campaign',
287 'entity' => 'Campaign',
288 'bao' => 'CRM_Campaign_BAO_Campaign',
291 'type' => 'Select Date',
294 'campaign_type_id' => array(
295 'name' => 'campaign_type_id',
296 'type' => CRM_Utils_Type
::T_INT
,
297 'title' => ts('Campaign Type') ,
298 'description' => 'Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type',
300 'where' => 'civicrm_campaign.campaign_type_id',
301 'headerPattern' => '',
305 'table_name' => 'civicrm_campaign',
306 'entity' => 'Campaign',
307 'bao' => 'CRM_Campaign_BAO_Campaign',
312 'pseudoconstant' => array(
313 'optionGroupName' => 'campaign_type',
314 'optionEditPath' => 'civicrm/admin/options/campaign_type',
317 'status_id' => array(
318 'name' => 'status_id',
319 'type' => CRM_Utils_Type
::T_INT
,
320 'title' => ts('Campaign Status') ,
321 'description' => 'Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status',
323 'where' => 'civicrm_campaign.status_id',
324 'headerPattern' => '',
328 'table_name' => 'civicrm_campaign',
329 'entity' => 'Campaign',
330 'bao' => 'CRM_Campaign_BAO_Campaign',
335 'pseudoconstant' => array(
336 'optionGroupName' => 'campaign_status',
337 'optionEditPath' => 'civicrm/admin/options/campaign_status',
340 'external_identifier' => array(
341 'name' => 'external_identifier',
342 'type' => CRM_Utils_Type
::T_STRING
,
343 'title' => ts('Campaign External ID') ,
344 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.',
346 'size' => CRM_Utils_Type
::MEDIUM
,
348 'where' => 'civicrm_campaign.external_identifier',
349 'headerPattern' => '/external\s?id/i',
350 'dataPattern' => '/^\d{11,}$/',
352 'table_name' => 'civicrm_campaign',
353 'entity' => 'Campaign',
354 'bao' => 'CRM_Campaign_BAO_Campaign',
360 'parent_id' => array(
361 'name' => 'parent_id',
362 'type' => CRM_Utils_Type
::T_INT
,
363 'title' => ts('Parent Campaign') ,
364 'description' => 'Optional parent id for this Campaign.',
366 'where' => 'civicrm_campaign.parent_id',
367 'headerPattern' => '',
371 'table_name' => 'civicrm_campaign',
372 'entity' => 'Campaign',
373 'bao' => 'CRM_Campaign_BAO_Campaign',
375 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
377 'type' => 'EntityRef',
380 'is_active' => array(
381 'name' => 'is_active',
382 'type' => CRM_Utils_Type
::T_BOOLEAN
,
383 'title' => ts('Is Campaign Active?') ,
384 'description' => 'Is this Campaign enabled or disabled/cancelled?',
386 'table_name' => 'civicrm_campaign',
387 'entity' => 'Campaign',
388 'bao' => 'CRM_Campaign_BAO_Campaign',
391 'type' => 'CheckBox',
394 'created_id' => array(
395 'name' => 'created_id',
396 'type' => CRM_Utils_Type
::T_INT
,
397 'title' => ts('Campaign Created By') ,
398 'description' => 'FK to civicrm_contact, who created this Campaign.',
399 'table_name' => 'civicrm_campaign',
400 'entity' => 'Campaign',
401 'bao' => 'CRM_Campaign_BAO_Campaign',
403 'FKClassName' => 'CRM_Contact_DAO_Contact',
405 'created_date' => array(
406 'name' => 'created_date',
407 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
408 'title' => ts('Campaign Created Date') ,
409 'description' => 'Date and time that Campaign was created.',
410 'table_name' => 'civicrm_campaign',
411 'entity' => 'Campaign',
412 'bao' => 'CRM_Campaign_BAO_Campaign',
415 'type' => 'Select Date',
418 'last_modified_id' => array(
419 'name' => 'last_modified_id',
420 'type' => CRM_Utils_Type
::T_INT
,
421 'title' => ts('Campaign Modified By') ,
422 'description' => 'FK to civicrm_contact, who recently edited this Campaign.',
423 'table_name' => 'civicrm_campaign',
424 'entity' => 'Campaign',
425 'bao' => 'CRM_Campaign_BAO_Campaign',
427 'FKClassName' => 'CRM_Contact_DAO_Contact',
429 'last_modified_date' => array(
430 'name' => 'last_modified_date',
431 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
432 'title' => ts('Campaign Modified Date') ,
433 'description' => 'Date and time that Campaign was edited last time.',
434 'table_name' => 'civicrm_campaign',
435 'entity' => 'Campaign',
436 'bao' => 'CRM_Campaign_BAO_Campaign',
439 'goal_general' => array(
440 'name' => 'goal_general',
441 'type' => CRM_Utils_Type
::T_TEXT
,
442 'title' => ts('Campaign Goals') ,
443 'description' => 'General goals for Campaign.',
444 'table_name' => 'civicrm_campaign',
445 'entity' => 'Campaign',
446 'bao' => 'CRM_Campaign_BAO_Campaign',
449 'type' => 'RichTextEditor',
452 'goal_revenue' => array(
453 'name' => 'goal_revenue',
454 'type' => CRM_Utils_Type
::T_MONEY
,
455 'title' => ts('Goal Revenue') ,
456 'description' => 'The target revenue for this campaign.',
457 'precision' => array(
461 'table_name' => 'civicrm_campaign',
462 'entity' => 'Campaign',
463 'bao' => 'CRM_Campaign_BAO_Campaign',
470 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
472 return Civi
::$statics[__CLASS__
]['fields'];
475 * Return a mapping from field-name to the corresponding key (as used in fields()).
478 * Array(string $name => string $uniqueName).
480 static function &fieldKeys() {
481 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
482 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
484 return Civi
::$statics[__CLASS__
]['fieldKeys'];
487 * Returns the names of this table
491 static function getTableName() {
492 return self
::$_tableName;
495 * Returns if this table needs to be logged
503 * Returns the list of fields that can be imported
505 * @param bool $prefix
509 static function &import($prefix = false) {
510 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'campaign', $prefix, array());
514 * Returns the list of fields that can be exported
516 * @param bool $prefix
520 static function &export($prefix = false) {
521 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'campaign', $prefix, array());
525 * Returns the list of indices
527 public static function indices($localize = TRUE) {
529 'UI_campaign_type_id' => array(
530 'name' => 'UI_campaign_type_id',
532 0 => 'campaign_type_id',
534 'localizable' => false,
535 'sig' => 'civicrm_campaign::0::campaign_type_id',
537 'UI_campaign_status_id' => array(
538 'name' => 'UI_campaign_status_id',
542 'localizable' => false,
543 'sig' => 'civicrm_campaign::0::status_id',
545 'UI_external_identifier' => array(
546 'name' => 'UI_external_identifier',
548 0 => 'external_identifier',
550 'localizable' => false,
552 'sig' => 'civicrm_campaign::1::external_identifier',
555 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;