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:f458ad522680b056ea1fe27ef362b523)
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' => '',
200 'type' => CRM_Utils_Type
::T_STRING
,
201 'title' => ts('Campaign Name') ,
202 'description' => 'Name of the Campaign.',
205 'size' => CRM_Utils_Type
::HUGE
,
207 'where' => 'civicrm_campaign.name',
208 'headerPattern' => '',
217 'type' => CRM_Utils_Type
::T_STRING
,
218 'title' => ts('Campaign Title') ,
219 'description' => 'Title of the Campaign.',
221 'size' => CRM_Utils_Type
::HUGE
,
223 'where' => 'civicrm_campaign.title',
224 'headerPattern' => '',
231 'description' => array(
232 'name' => 'description',
233 'type' => CRM_Utils_Type
::T_TEXT
,
234 'title' => ts('Campaign Description') ,
235 'description' => 'Full description of Campaign.',
239 'type' => 'TextArea',
242 'start_date' => array(
243 'name' => 'start_date',
244 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
245 'title' => ts('Campaign Start Date') ,
246 'description' => 'Date and time that Campaign starts.',
248 'where' => 'civicrm_campaign.start_date',
249 'headerPattern' => '/^start|(s(tart\s)?date)$/i',
253 'type' => 'Select Date',
257 'name' => 'end_date',
258 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
259 'title' => ts('Campaign End Date') ,
260 'description' => 'Date and time that Campaign ends.',
262 'where' => 'civicrm_campaign.end_date',
263 'headerPattern' => '/^end|(e(nd\s)?date)$/i',
267 'type' => 'Select Date',
270 'campaign_type_id' => array(
271 'name' => 'campaign_type_id',
272 'type' => CRM_Utils_Type
::T_INT
,
273 'title' => ts('Campaign Type') ,
274 'description' => 'Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type',
276 'where' => 'civicrm_campaign.campaign_type_id',
277 'headerPattern' => '',
284 'pseudoconstant' => array(
285 'optionGroupName' => 'campaign_type',
286 'optionEditPath' => 'civicrm/admin/options/campaign_type',
289 'status_id' => array(
290 'name' => 'status_id',
291 'type' => CRM_Utils_Type
::T_INT
,
292 'title' => ts('Campaign Status') ,
293 'description' => 'Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status',
295 'where' => 'civicrm_campaign.status_id',
296 'headerPattern' => '',
303 'pseudoconstant' => array(
304 'optionGroupName' => 'campaign_status',
305 'optionEditPath' => 'civicrm/admin/options/campaign_status',
308 'external_identifier' => array(
309 'name' => 'external_identifier',
310 'type' => CRM_Utils_Type
::T_STRING
,
311 'title' => ts('Campaign External ID') ,
312 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.',
314 'size' => CRM_Utils_Type
::MEDIUM
,
316 'where' => 'civicrm_campaign.external_identifier',
317 'headerPattern' => '/external\s?id/i',
318 'dataPattern' => '/^\d{11,}$/',
324 'parent_id' => array(
325 'name' => 'parent_id',
326 'type' => CRM_Utils_Type
::T_INT
,
327 'title' => ts('Parent Campaign') ,
328 'description' => 'Optional parent id for this Campaign.',
330 'where' => 'civicrm_campaign.parent_id',
331 'headerPattern' => '',
335 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
337 'type' => 'EntityRef',
340 'is_active' => array(
341 'name' => 'is_active',
342 'type' => CRM_Utils_Type
::T_BOOLEAN
,
343 'title' => ts('Is Campaign Active?') ,
344 'description' => 'Is this Campaign enabled or disabled/cancelled?',
347 'type' => 'CheckBox',
350 'created_id' => array(
351 'name' => 'created_id',
352 'type' => CRM_Utils_Type
::T_INT
,
353 'title' => ts('Campaign Created By') ,
354 'description' => 'FK to civicrm_contact, who created this Campaign.',
355 'FKClassName' => 'CRM_Contact_DAO_Contact',
357 'created_date' => array(
358 'name' => 'created_date',
359 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
360 'title' => ts('Campaign Created Date') ,
361 'description' => 'Date and time that Campaign was created.',
363 'type' => 'Select Date',
366 'last_modified_id' => array(
367 'name' => 'last_modified_id',
368 'type' => CRM_Utils_Type
::T_INT
,
369 'title' => ts('Campaign Modified By') ,
370 'description' => 'FK to civicrm_contact, who recently edited this Campaign.',
371 'FKClassName' => 'CRM_Contact_DAO_Contact',
373 'last_modified_date' => array(
374 'name' => 'last_modified_date',
375 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
376 'title' => ts('Campaign Modified Date') ,
377 'description' => 'Date and time that Campaign was edited last time.',
379 'goal_general' => array(
380 'name' => 'goal_general',
381 'type' => CRM_Utils_Type
::T_TEXT
,
382 'title' => ts('Campaign Goals') ,
383 'description' => 'General goals for Campaign.',
385 'type' => 'RichTextEditor',
388 'goal_revenue' => array(
389 'name' => 'goal_revenue',
390 'type' => CRM_Utils_Type
::T_MONEY
,
391 'title' => ts('Goal Revenue') ,
392 'description' => 'The target revenue for this campaign.',
393 'precision' => array(
402 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
404 return Civi
::$statics[__CLASS__
]['fields'];
407 * Return a mapping from field-name to the corresponding key (as used in fields()).
410 * Array(string $name => string $uniqueName).
412 static function &fieldKeys() {
413 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
414 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
416 return Civi
::$statics[__CLASS__
]['fieldKeys'];
419 * Returns the names of this table
423 static function getTableName() {
424 return self
::$_tableName;
427 * Returns if this table needs to be logged
435 * Returns the list of fields that can be imported
437 * @param bool $prefix
441 static function &import($prefix = false) {
442 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'campaign', $prefix, array());
446 * Returns the list of fields that can be exported
448 * @param bool $prefix
452 static function &export($prefix = false) {
453 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'campaign', $prefix, array());