Merge pull request #9678 from GinkgoFJG/CRM-19877-joomla-setting-create
[civicrm-core.git] / CRM / Campaign / DAO / Campaign.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Campaign/Campaign.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:f458ad522680b056ea1fe27ef362b523)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Campaign_DAO_Campaign constructor.
39 */
40 class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_campaign';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Unique Campaign ID.
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Name of the Campaign.
61 *
62 * @var string
63 */
64 public $name;
65 /**
66 * Title of the Campaign.
67 *
68 * @var string
69 */
70 public $title;
71 /**
72 * Full description of Campaign.
73 *
74 * @var text
75 */
76 public $description;
77 /**
78 * Date and time that Campaign starts.
79 *
80 * @var datetime
81 */
82 public $start_date;
83 /**
84 * Date and time that Campaign ends.
85 *
86 * @var datetime
87 */
88 public $end_date;
89 /**
90 * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type
91 *
92 * @var int unsigned
93 */
94 public $campaign_type_id;
95 /**
96 * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status
97 *
98 * @var int unsigned
99 */
100 public $status_id;
101 /**
102 * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.
103 *
104 * @var string
105 */
106 public $external_identifier;
107 /**
108 * Optional parent id for this Campaign.
109 *
110 * @var int unsigned
111 */
112 public $parent_id;
113 /**
114 * Is this Campaign enabled or disabled/cancelled?
115 *
116 * @var boolean
117 */
118 public $is_active;
119 /**
120 * FK to civicrm_contact, who created this Campaign.
121 *
122 * @var int unsigned
123 */
124 public $created_id;
125 /**
126 * Date and time that Campaign was created.
127 *
128 * @var datetime
129 */
130 public $created_date;
131 /**
132 * FK to civicrm_contact, who recently edited this Campaign.
133 *
134 * @var int unsigned
135 */
136 public $last_modified_id;
137 /**
138 * Date and time that Campaign was edited last time.
139 *
140 * @var datetime
141 */
142 public $last_modified_date;
143 /**
144 * General goals for Campaign.
145 *
146 * @var text
147 */
148 public $goal_general;
149 /**
150 * The target revenue for this campaign.
151 *
152 * @var float
153 */
154 public $goal_revenue;
155 /**
156 * Class constructor.
157 */
158 function __construct() {
159 $this->__table = 'civicrm_campaign';
160 parent::__construct();
161 }
162 /**
163 * Returns foreign keys and entity references.
164 *
165 * @return array
166 * [CRM_Core_Reference_Interface]
167 */
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']);
175 }
176 return Civi::$statics[__CLASS__]['links'];
177 }
178 /**
179 * Returns all the column names of this table
180 *
181 * @return array
182 */
183 static function &fields() {
184 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
185 Civi::$statics[__CLASS__]['fields'] = array(
186 'id' => array(
187 'name' => 'id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Campaign ID') ,
190 'description' => 'Unique Campaign ID.',
191 'required' => true,
192 'import' => true,
193 'where' => 'civicrm_campaign.id',
194 'headerPattern' => '',
195 'dataPattern' => '',
196 'export' => true,
197 ) ,
198 'name' => array(
199 'name' => 'name',
200 'type' => CRM_Utils_Type::T_STRING,
201 'title' => ts('Campaign Name') ,
202 'description' => 'Name of the Campaign.',
203 'required' => true,
204 'maxlength' => 255,
205 'size' => CRM_Utils_Type::HUGE,
206 'import' => true,
207 'where' => 'civicrm_campaign.name',
208 'headerPattern' => '',
209 'dataPattern' => '',
210 'export' => true,
211 'html' => array(
212 'type' => 'Text',
213 ) ,
214 ) ,
215 'title' => array(
216 'name' => 'title',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('Campaign Title') ,
219 'description' => 'Title of the Campaign.',
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
222 'import' => true,
223 'where' => 'civicrm_campaign.title',
224 'headerPattern' => '',
225 'dataPattern' => '',
226 'export' => true,
227 'html' => array(
228 'type' => 'Text',
229 ) ,
230 ) ,
231 'description' => array(
232 'name' => 'description',
233 'type' => CRM_Utils_Type::T_TEXT,
234 'title' => ts('Campaign Description') ,
235 'description' => 'Full description of Campaign.',
236 'rows' => 8,
237 'cols' => 60,
238 'html' => array(
239 'type' => 'TextArea',
240 ) ,
241 ) ,
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.',
247 'import' => true,
248 'where' => 'civicrm_campaign.start_date',
249 'headerPattern' => '/^start|(s(tart\s)?date)$/i',
250 'dataPattern' => '',
251 'export' => true,
252 'html' => array(
253 'type' => 'Select Date',
254 ) ,
255 ) ,
256 'end_date' => array(
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.',
261 'import' => true,
262 'where' => 'civicrm_campaign.end_date',
263 'headerPattern' => '/^end|(e(nd\s)?date)$/i',
264 'dataPattern' => '',
265 'export' => true,
266 'html' => array(
267 'type' => 'Select Date',
268 ) ,
269 ) ,
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',
275 'import' => true,
276 'where' => 'civicrm_campaign.campaign_type_id',
277 'headerPattern' => '',
278 'dataPattern' => '',
279 'export' => true,
280 'default' => 'NULL',
281 'html' => array(
282 'type' => 'Select',
283 ) ,
284 'pseudoconstant' => array(
285 'optionGroupName' => 'campaign_type',
286 'optionEditPath' => 'civicrm/admin/options/campaign_type',
287 )
288 ) ,
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',
294 'import' => true,
295 'where' => 'civicrm_campaign.status_id',
296 'headerPattern' => '',
297 'dataPattern' => '',
298 'export' => true,
299 'default' => 'NULL',
300 'html' => array(
301 'type' => 'Select',
302 ) ,
303 'pseudoconstant' => array(
304 'optionGroupName' => 'campaign_status',
305 'optionEditPath' => 'civicrm/admin/options/campaign_status',
306 )
307 ) ,
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.',
313 'maxlength' => 32,
314 'size' => CRM_Utils_Type::MEDIUM,
315 'import' => true,
316 'where' => 'civicrm_campaign.external_identifier',
317 'headerPattern' => '/external\s?id/i',
318 'dataPattern' => '/^\d{11,}$/',
319 'export' => true,
320 'html' => array(
321 'type' => 'Text',
322 ) ,
323 ) ,
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.',
329 'import' => true,
330 'where' => 'civicrm_campaign.parent_id',
331 'headerPattern' => '',
332 'dataPattern' => '',
333 'export' => true,
334 'default' => 'NULL',
335 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
336 'html' => array(
337 'type' => 'EntityRef',
338 ) ,
339 ) ,
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?',
345 'default' => '1',
346 'html' => array(
347 'type' => 'CheckBox',
348 ) ,
349 ) ,
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',
356 ) ,
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.',
362 'html' => array(
363 'type' => 'Select Date',
364 ) ,
365 ) ,
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',
372 ) ,
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.',
378 ) ,
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.',
384 'html' => array(
385 'type' => 'RichTextEditor',
386 ) ,
387 ) ,
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(
394 20,
395 2
396 ) ,
397 'html' => array(
398 'type' => 'Text',
399 ) ,
400 ) ,
401 );
402 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
403 }
404 return Civi::$statics[__CLASS__]['fields'];
405 }
406 /**
407 * Return a mapping from field-name to the corresponding key (as used in fields()).
408 *
409 * @return array
410 * Array(string $name => string $uniqueName).
411 */
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()));
415 }
416 return Civi::$statics[__CLASS__]['fieldKeys'];
417 }
418 /**
419 * Returns the names of this table
420 *
421 * @return string
422 */
423 static function getTableName() {
424 return self::$_tableName;
425 }
426 /**
427 * Returns if this table needs to be logged
428 *
429 * @return boolean
430 */
431 function getLog() {
432 return self::$_log;
433 }
434 /**
435 * Returns the list of fields that can be imported
436 *
437 * @param bool $prefix
438 *
439 * @return array
440 */
441 static function &import($prefix = false) {
442 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, array());
443 return $r;
444 }
445 /**
446 * Returns the list of fields that can be exported
447 *
448 * @param bool $prefix
449 *
450 * @return array
451 */
452 static function &export($prefix = false) {
453 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, array());
454 return $r;
455 }
456 }