Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
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-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Campaign/Campaign.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:f458ad522680b056ea1fe27ef362b523) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_campaign'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = false; | |
51 | /** | |
52 | * Unique Campaign ID. | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * Name of the Campaign. | |
59 | * | |
60 | * @var string | |
61 | */ | |
62 | public $name; | |
63 | /** | |
64 | * Title of the Campaign. | |
65 | * | |
66 | * @var string | |
67 | */ | |
68 | public $title; | |
69 | /** | |
70 | * Full description of Campaign. | |
71 | * | |
72 | * @var text | |
73 | */ | |
74 | public $description; | |
75 | /** | |
76 | * Date and time that Campaign starts. | |
77 | * | |
78 | * @var datetime | |
79 | */ | |
80 | public $start_date; | |
81 | /** | |
82 | * Date and time that Campaign ends. | |
83 | * | |
84 | * @var datetime | |
85 | */ | |
86 | public $end_date; | |
87 | /** | |
88 | * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type | |
89 | * | |
90 | * @var int unsigned | |
91 | */ | |
92 | public $campaign_type_id; | |
93 | /** | |
94 | * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status | |
95 | * | |
96 | * @var int unsigned | |
97 | */ | |
98 | public $status_id; | |
99 | /** | |
100 | * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations. | |
101 | * | |
102 | * @var string | |
103 | */ | |
104 | public $external_identifier; | |
105 | /** | |
106 | * Optional parent id for this Campaign. | |
107 | * | |
108 | * @var int unsigned | |
109 | */ | |
110 | public $parent_id; | |
111 | /** | |
112 | * Is this Campaign enabled or disabled/cancelled? | |
113 | * | |
114 | * @var boolean | |
115 | */ | |
116 | public $is_active; | |
117 | /** | |
118 | * FK to civicrm_contact, who created this Campaign. | |
119 | * | |
120 | * @var int unsigned | |
121 | */ | |
122 | public $created_id; | |
123 | /** | |
124 | * Date and time that Campaign was created. | |
125 | * | |
126 | * @var datetime | |
127 | */ | |
128 | public $created_date; | |
129 | /** | |
130 | * FK to civicrm_contact, who recently edited this Campaign. | |
131 | * | |
132 | * @var int unsigned | |
133 | */ | |
134 | public $last_modified_id; | |
135 | /** | |
136 | * Date and time that Campaign was edited last time. | |
137 | * | |
138 | * @var datetime | |
139 | */ | |
140 | public $last_modified_date; | |
141 | /** | |
142 | * General goals for Campaign. | |
143 | * | |
144 | * @var text | |
145 | */ | |
146 | public $goal_general; | |
147 | /** | |
148 | * The target revenue for this campaign. | |
149 | * | |
150 | * @var float | |
151 | */ | |
152 | public $goal_revenue; | |
153 | /** | |
154 | * class constructor | |
155 | * | |
156 | * @return civicrm_campaign | |
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() { | |
346aaaba TO |
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']); | |
e501603b | 175 | } |
346aaaba | 176 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
177 | } |
178 | /** | |
179 | * Returns all the column names of this table | |
180 | * | |
181 | * @return array | |
182 | */ | |
183 | static function &fields() { | |
346aaaba TO |
184 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
185 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
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 | ); | |
346aaaba | 402 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 403 | } |
346aaaba | 404 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
405 | } |
406 | /** | |
bd8e0b14 | 407 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
408 | * |
409 | * @return array | |
bd8e0b14 | 410 | * Array(string $name => string $uniqueName). |
e501603b TO |
411 | */ |
412 | static function &fieldKeys() { | |
bd8e0b14 TO |
413 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
414 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 415 | } |
bd8e0b14 | 416 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
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) { | |
60808919 TO |
442 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, array()); |
443 | return $r; | |
e501603b TO |
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) { | |
60808919 TO |
453 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, array()); |
454 | return $r; | |
e501603b TO |
455 | } |
456 | } |