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:e9d9e088056e37eb04e359efcc942c5c)
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',
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Campaign Name') ,
205 'description' => 'Name of the Campaign.',
208 'size' => CRM_Utils_Type
::HUGE
,
210 'where' => 'civicrm_campaign.name',
211 'headerPattern' => '',
214 'table_name' => 'civicrm_campaign',
215 'entity' => 'Campaign',
216 'bao' => 'CRM_Campaign_BAO_Campaign',
223 'type' => CRM_Utils_Type
::T_STRING
,
224 'title' => ts('Campaign Title') ,
225 'description' => 'Title of the Campaign.',
227 'size' => CRM_Utils_Type
::HUGE
,
229 'where' => 'civicrm_campaign.title',
230 'headerPattern' => '',
233 'table_name' => 'civicrm_campaign',
234 'entity' => 'Campaign',
235 'bao' => 'CRM_Campaign_BAO_Campaign',
240 'description' => array(
241 'name' => 'description',
242 'type' => CRM_Utils_Type
::T_TEXT
,
243 'title' => ts('Campaign Description') ,
244 'description' => 'Full description of Campaign.',
247 'table_name' => 'civicrm_campaign',
248 'entity' => 'Campaign',
249 'bao' => 'CRM_Campaign_BAO_Campaign',
251 'type' => 'TextArea',
254 'start_date' => array(
255 'name' => 'start_date',
256 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
257 'title' => ts('Campaign Start Date') ,
258 'description' => 'Date and time that Campaign starts.',
260 'where' => 'civicrm_campaign.start_date',
261 'headerPattern' => '/^start|(s(tart\s)?date)$/i',
264 'table_name' => 'civicrm_campaign',
265 'entity' => 'Campaign',
266 'bao' => 'CRM_Campaign_BAO_Campaign',
268 'type' => 'Select Date',
272 'name' => 'end_date',
273 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
274 'title' => ts('Campaign End Date') ,
275 'description' => 'Date and time that Campaign ends.',
277 'where' => 'civicrm_campaign.end_date',
278 'headerPattern' => '/^end|(e(nd\s)?date)$/i',
281 'table_name' => 'civicrm_campaign',
282 'entity' => 'Campaign',
283 'bao' => 'CRM_Campaign_BAO_Campaign',
285 'type' => 'Select Date',
288 'campaign_type_id' => array(
289 'name' => 'campaign_type_id',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Campaign Type') ,
292 'description' => 'Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type',
294 'where' => 'civicrm_campaign.campaign_type_id',
295 'headerPattern' => '',
299 'table_name' => 'civicrm_campaign',
300 'entity' => 'Campaign',
301 'bao' => 'CRM_Campaign_BAO_Campaign',
305 'pseudoconstant' => array(
306 'optionGroupName' => 'campaign_type',
307 'optionEditPath' => 'civicrm/admin/options/campaign_type',
310 'status_id' => array(
311 'name' => 'status_id',
312 'type' => CRM_Utils_Type
::T_INT
,
313 'title' => ts('Campaign Status') ,
314 'description' => 'Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status',
316 'where' => 'civicrm_campaign.status_id',
317 'headerPattern' => '',
321 'table_name' => 'civicrm_campaign',
322 'entity' => 'Campaign',
323 'bao' => 'CRM_Campaign_BAO_Campaign',
327 'pseudoconstant' => array(
328 'optionGroupName' => 'campaign_status',
329 'optionEditPath' => 'civicrm/admin/options/campaign_status',
332 'external_identifier' => array(
333 'name' => 'external_identifier',
334 'type' => CRM_Utils_Type
::T_STRING
,
335 'title' => ts('Campaign External ID') ,
336 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.',
338 'size' => CRM_Utils_Type
::MEDIUM
,
340 'where' => 'civicrm_campaign.external_identifier',
341 'headerPattern' => '/external\s?id/i',
342 'dataPattern' => '/^\d{11,}$/',
344 'table_name' => 'civicrm_campaign',
345 'entity' => 'Campaign',
346 'bao' => 'CRM_Campaign_BAO_Campaign',
351 'parent_id' => array(
352 'name' => 'parent_id',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Parent Campaign') ,
355 'description' => 'Optional parent id for this Campaign.',
357 'where' => 'civicrm_campaign.parent_id',
358 'headerPattern' => '',
362 'table_name' => 'civicrm_campaign',
363 'entity' => 'Campaign',
364 'bao' => 'CRM_Campaign_BAO_Campaign',
365 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
367 'type' => 'EntityRef',
370 'is_active' => array(
371 'name' => 'is_active',
372 'type' => CRM_Utils_Type
::T_BOOLEAN
,
373 'title' => ts('Is Campaign Active?') ,
374 'description' => 'Is this Campaign enabled or disabled/cancelled?',
376 'table_name' => 'civicrm_campaign',
377 'entity' => 'Campaign',
378 'bao' => 'CRM_Campaign_BAO_Campaign',
380 'type' => 'CheckBox',
383 'created_id' => array(
384 'name' => 'created_id',
385 'type' => CRM_Utils_Type
::T_INT
,
386 'title' => ts('Campaign Created By') ,
387 'description' => 'FK to civicrm_contact, who created this Campaign.',
388 'table_name' => 'civicrm_campaign',
389 'entity' => 'Campaign',
390 'bao' => 'CRM_Campaign_BAO_Campaign',
391 'FKClassName' => 'CRM_Contact_DAO_Contact',
393 'created_date' => array(
394 'name' => 'created_date',
395 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
396 'title' => ts('Campaign Created Date') ,
397 'description' => 'Date and time that Campaign was created.',
398 'table_name' => 'civicrm_campaign',
399 'entity' => 'Campaign',
400 'bao' => 'CRM_Campaign_BAO_Campaign',
402 'type' => 'Select Date',
405 'last_modified_id' => array(
406 'name' => 'last_modified_id',
407 'type' => CRM_Utils_Type
::T_INT
,
408 'title' => ts('Campaign Modified By') ,
409 'description' => 'FK to civicrm_contact, who recently edited this Campaign.',
410 'table_name' => 'civicrm_campaign',
411 'entity' => 'Campaign',
412 'bao' => 'CRM_Campaign_BAO_Campaign',
413 'FKClassName' => 'CRM_Contact_DAO_Contact',
415 'last_modified_date' => array(
416 'name' => 'last_modified_date',
417 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
418 'title' => ts('Campaign Modified Date') ,
419 'description' => 'Date and time that Campaign was edited last time.',
420 'table_name' => 'civicrm_campaign',
421 'entity' => 'Campaign',
422 'bao' => 'CRM_Campaign_BAO_Campaign',
424 'goal_general' => array(
425 'name' => 'goal_general',
426 'type' => CRM_Utils_Type
::T_TEXT
,
427 'title' => ts('Campaign Goals') ,
428 'description' => 'General goals for Campaign.',
429 'table_name' => 'civicrm_campaign',
430 'entity' => 'Campaign',
431 'bao' => 'CRM_Campaign_BAO_Campaign',
433 'type' => 'RichTextEditor',
436 'goal_revenue' => array(
437 'name' => 'goal_revenue',
438 'type' => CRM_Utils_Type
::T_MONEY
,
439 'title' => ts('Goal Revenue') ,
440 'description' => 'The target revenue for this campaign.',
441 'precision' => array(
445 'table_name' => 'civicrm_campaign',
446 'entity' => 'Campaign',
447 'bao' => 'CRM_Campaign_BAO_Campaign',
453 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
455 return Civi
::$statics[__CLASS__
]['fields'];
458 * Return a mapping from field-name to the corresponding key (as used in fields()).
461 * Array(string $name => string $uniqueName).
463 static function &fieldKeys() {
464 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
465 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
467 return Civi
::$statics[__CLASS__
]['fieldKeys'];
470 * Returns the names of this table
474 static function getTableName() {
475 return self
::$_tableName;
478 * Returns if this table needs to be logged
486 * Returns the list of fields that can be imported
488 * @param bool $prefix
492 static function &import($prefix = false) {
493 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'campaign', $prefix, array());
497 * Returns the list of fields that can be exported
499 * @param bool $prefix
503 static function &export($prefix = false) {
504 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'campaign', $prefix, array());