Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
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 | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Campaign/Survey.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 33 | * (GenCodeChecksum:67be20ebb798711191266af1aaba7f86) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Campaign_DAO_Survey constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_survey'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = false; | |
53 | /** | |
54 | * Survey id. | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Title of the Survey. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $title; | |
65 | /** | |
66 | * Foreign key to the Campaign. | |
67 | * | |
68 | * @var int unsigned | |
69 | */ | |
70 | public $campaign_id; | |
71 | /** | |
72 | * Implicit FK to civicrm_option_value where option_group = activity_type | |
73 | * | |
74 | * @var int unsigned | |
75 | */ | |
76 | public $activity_type_id; | |
77 | /** | |
78 | * Recontact intervals for each status. | |
79 | * | |
80 | * @var text | |
81 | */ | |
82 | public $recontact_interval; | |
83 | /** | |
84 | * Script instructions for volunteers to use for the survey. | |
85 | * | |
86 | * @var text | |
87 | */ | |
88 | public $instructions; | |
89 | /** | |
90 | * Number of days for recurrence of release. | |
91 | * | |
92 | * @var int unsigned | |
93 | */ | |
94 | public $release_frequency; | |
95 | /** | |
96 | * Maximum number of contacts to allow for survey. | |
97 | * | |
98 | * @var int unsigned | |
99 | */ | |
100 | public $max_number_of_contacts; | |
101 | /** | |
102 | * Default number of contacts to allow for survey. | |
103 | * | |
104 | * @var int unsigned | |
105 | */ | |
106 | public $default_number_of_contacts; | |
107 | /** | |
108 | * Is this survey enabled or disabled/cancelled? | |
109 | * | |
110 | * @var boolean | |
111 | */ | |
112 | public $is_active; | |
113 | /** | |
114 | * Is this default survey? | |
115 | * | |
116 | * @var boolean | |
117 | */ | |
118 | public $is_default; | |
119 | /** | |
120 | * FK to civicrm_contact, who created this Survey. | |
121 | * | |
122 | * @var int unsigned | |
123 | */ | |
124 | public $created_id; | |
125 | /** | |
126 | * Date and time that Survey was created. | |
127 | * | |
128 | * @var datetime | |
129 | */ | |
130 | public $created_date; | |
131 | /** | |
132 | * FK to civicrm_contact, who recently edited this Survey. | |
133 | * | |
134 | * @var int unsigned | |
135 | */ | |
136 | public $last_modified_id; | |
137 | /** | |
138 | * Date and time that Survey was edited last time. | |
139 | * | |
140 | * @var datetime | |
141 | */ | |
142 | public $last_modified_date; | |
143 | /** | |
144 | * Used to store option group id. | |
145 | * | |
146 | * @var int unsigned | |
147 | */ | |
148 | public $result_id; | |
149 | /** | |
150 | * Bypass the email verification. | |
151 | * | |
152 | * @var boolean | |
153 | */ | |
154 | public $bypass_confirm; | |
155 | /** | |
156 | * Title for Thank-you page (header title tag, and display at the top of the page). | |
157 | * | |
158 | * @var string | |
159 | */ | |
160 | public $thankyou_title; | |
161 | /** | |
162 | * text and html allowed. displayed above result on success page | |
163 | * | |
164 | * @var text | |
165 | */ | |
166 | public $thankyou_text; | |
167 | /** | |
168 | * Can people share the petition through social media? | |
169 | * | |
170 | * @var boolean | |
171 | */ | |
172 | public $is_share; | |
173 | /** | |
f41f0342 | 174 | * Class constructor. |
e501603b TO |
175 | */ |
176 | function __construct() { | |
177 | $this->__table = 'civicrm_survey'; | |
178 | parent::__construct(); | |
179 | } | |
180 | /** | |
f41f0342 | 181 | * Returns foreign keys and entity references. |
e501603b TO |
182 | * |
183 | * @return array | |
184 | * [CRM_Core_Reference_Interface] | |
185 | */ | |
186 | static function getReferenceColumns() { | |
346aaaba TO |
187 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
188 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
189 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); | |
190 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); | |
191 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'last_modified_id', 'civicrm_contact', 'id'); | |
192 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 193 | } |
346aaaba | 194 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
195 | } |
196 | /** | |
197 | * Returns all the column names of this table | |
198 | * | |
199 | * @return array | |
200 | */ | |
201 | static function &fields() { | |
346aaaba TO |
202 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
203 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
204 | 'id' => array( |
205 | 'name' => 'id', | |
206 | 'type' => CRM_Utils_Type::T_INT, | |
207 | 'title' => ts('Survey ID') , | |
208 | 'description' => 'Survey id.', | |
209 | 'required' => true, | |
522a26c9 | 210 | 'table_name' => 'civicrm_survey', |
211 | 'entity' => 'Survey', | |
212 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
213 | ) , |
214 | 'title' => array( | |
215 | 'name' => 'title', | |
216 | 'type' => CRM_Utils_Type::T_STRING, | |
217 | 'title' => ts('Survey Title') , | |
218 | 'description' => 'Title of the Survey.', | |
219 | 'required' => true, | |
220 | 'maxlength' => 255, | |
221 | 'size' => CRM_Utils_Type::HUGE, | |
222 | 'import' => true, | |
223 | 'where' => 'civicrm_survey.title', | |
224 | 'headerPattern' => '', | |
225 | 'dataPattern' => '', | |
226 | 'export' => true, | |
522a26c9 | 227 | 'table_name' => 'civicrm_survey', |
228 | 'entity' => 'Survey', | |
229 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
230 | ) , |
231 | 'campaign_id' => array( | |
232 | 'name' => 'campaign_id', | |
233 | 'type' => CRM_Utils_Type::T_INT, | |
234 | 'title' => ts('Survey Campaign ID') , | |
235 | 'description' => 'Foreign key to the Campaign.', | |
236 | 'default' => 'NULL', | |
522a26c9 | 237 | 'table_name' => 'civicrm_survey', |
238 | 'entity' => 'Survey', | |
239 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
240 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
241 | 'pseudoconstant' => array( | |
242 | 'table' => 'civicrm_campaign', | |
243 | 'keyColumn' => 'id', | |
244 | 'labelColumn' => 'title', | |
245 | ) | |
246 | ) , | |
247 | 'activity_type_id' => array( | |
248 | 'name' => 'activity_type_id', | |
249 | 'type' => CRM_Utils_Type::T_INT, | |
250 | 'title' => ts('Activity Type') , | |
251 | 'description' => 'Implicit FK to civicrm_option_value where option_group = activity_type', | |
252 | 'import' => true, | |
253 | 'where' => 'civicrm_survey.activity_type_id', | |
254 | 'headerPattern' => '', | |
255 | 'dataPattern' => '', | |
256 | 'export' => true, | |
257 | 'default' => 'NULL', | |
522a26c9 | 258 | 'table_name' => 'civicrm_survey', |
259 | 'entity' => 'Survey', | |
260 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
261 | 'html' => array( |
262 | 'type' => 'Select', | |
263 | ) , | |
264 | 'pseudoconstant' => array( | |
265 | 'optionGroupName' => 'activity_type', | |
266 | 'optionEditPath' => 'civicrm/admin/options/activity_type', | |
267 | ) | |
268 | ) , | |
269 | 'recontact_interval' => array( | |
270 | 'name' => 'recontact_interval', | |
271 | 'type' => CRM_Utils_Type::T_TEXT, | |
272 | 'title' => ts('Follow up Interval') , | |
273 | 'description' => 'Recontact intervals for each status.', | |
274 | 'rows' => 20, | |
275 | 'cols' => 80, | |
522a26c9 | 276 | 'table_name' => 'civicrm_survey', |
277 | 'entity' => 'Survey', | |
278 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
279 | 'html' => array( |
280 | 'type' => 'TextArea', | |
281 | ) , | |
282 | ) , | |
283 | 'instructions' => array( | |
284 | 'name' => 'instructions', | |
285 | 'type' => CRM_Utils_Type::T_TEXT, | |
286 | 'title' => ts('Instructions') , | |
287 | 'description' => 'Script instructions for volunteers to use for the survey.', | |
288 | 'rows' => 20, | |
289 | 'cols' => 80, | |
522a26c9 | 290 | 'table_name' => 'civicrm_survey', |
291 | 'entity' => 'Survey', | |
292 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
293 | 'html' => array( |
294 | 'type' => 'TextArea', | |
295 | ) , | |
296 | ) , | |
297 | 'release_frequency' => array( | |
298 | 'name' => 'release_frequency', | |
299 | 'type' => CRM_Utils_Type::T_INT, | |
300 | 'title' => ts('Survey Hold Duration') , | |
301 | 'description' => 'Number of days for recurrence of release.', | |
302 | 'default' => 'NULL', | |
522a26c9 | 303 | 'table_name' => 'civicrm_survey', |
304 | 'entity' => 'Survey', | |
305 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
306 | ) , |
307 | 'max_number_of_contacts' => array( | |
308 | 'name' => 'max_number_of_contacts', | |
309 | 'type' => CRM_Utils_Type::T_INT, | |
310 | 'title' => ts('Maximum number of contacts') , | |
311 | 'description' => 'Maximum number of contacts to allow for survey.', | |
312 | 'default' => 'NULL', | |
522a26c9 | 313 | 'table_name' => 'civicrm_survey', |
314 | 'entity' => 'Survey', | |
315 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
316 | ) , |
317 | 'default_number_of_contacts' => array( | |
318 | 'name' => 'default_number_of_contacts', | |
319 | 'type' => CRM_Utils_Type::T_INT, | |
320 | 'title' => ts('Default number of contacts') , | |
321 | 'description' => 'Default number of contacts to allow for survey.', | |
322 | 'default' => 'NULL', | |
522a26c9 | 323 | 'table_name' => 'civicrm_survey', |
324 | 'entity' => 'Survey', | |
325 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
326 | ) , |
327 | 'is_active' => array( | |
328 | 'name' => 'is_active', | |
329 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
330 | 'title' => ts('Survey Is Active') , | |
331 | 'description' => 'Is this survey enabled or disabled/cancelled?', | |
332 | 'default' => '1', | |
522a26c9 | 333 | 'table_name' => 'civicrm_survey', |
334 | 'entity' => 'Survey', | |
335 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
336 | ) , |
337 | 'is_default' => array( | |
338 | 'name' => 'is_default', | |
339 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
340 | 'title' => ts('Is Default Survey') , | |
341 | 'description' => 'Is this default survey?', | |
522a26c9 | 342 | 'table_name' => 'civicrm_survey', |
343 | 'entity' => 'Survey', | |
344 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
345 | ) , |
346 | 'created_id' => array( | |
347 | 'name' => 'created_id', | |
348 | 'type' => CRM_Utils_Type::T_INT, | |
349 | 'title' => ts('Survey Created By') , | |
350 | 'description' => 'FK to civicrm_contact, who created this Survey.', | |
522a26c9 | 351 | 'table_name' => 'civicrm_survey', |
352 | 'entity' => 'Survey', | |
353 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
354 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
355 | ) , | |
356 | 'created_date' => array( | |
357 | 'name' => 'created_date', | |
358 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
359 | 'title' => ts('Campaign Created Date') , | |
360 | 'description' => 'Date and time that Survey was created.', | |
522a26c9 | 361 | 'table_name' => 'civicrm_survey', |
362 | 'entity' => 'Survey', | |
363 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
364 | ) , |
365 | 'last_modified_id' => array( | |
366 | 'name' => 'last_modified_id', | |
367 | 'type' => CRM_Utils_Type::T_INT, | |
368 | 'title' => ts('Survey Modified') , | |
369 | 'description' => 'FK to civicrm_contact, who recently edited this Survey.', | |
522a26c9 | 370 | 'table_name' => 'civicrm_survey', |
371 | 'entity' => 'Survey', | |
372 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
373 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
374 | ) , | |
375 | 'last_modified_date' => array( | |
376 | 'name' => 'last_modified_date', | |
377 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
378 | 'title' => ts('Survey Modified On') , | |
379 | 'description' => 'Date and time that Survey was edited last time.', | |
522a26c9 | 380 | 'table_name' => 'civicrm_survey', |
381 | 'entity' => 'Survey', | |
382 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
383 | ) , |
384 | 'result_id' => array( | |
385 | 'name' => 'result_id', | |
386 | 'type' => CRM_Utils_Type::T_INT, | |
387 | 'title' => ts('Survey Result') , | |
388 | 'description' => 'Used to store option group id.', | |
389 | 'default' => 'NULL', | |
522a26c9 | 390 | 'table_name' => 'civicrm_survey', |
391 | 'entity' => 'Survey', | |
392 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
393 | ) , |
394 | 'bypass_confirm' => array( | |
395 | 'name' => 'bypass_confirm', | |
396 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
397 | 'title' => ts('No Email Verification') , | |
398 | 'description' => 'Bypass the email verification.', | |
522a26c9 | 399 | 'table_name' => 'civicrm_survey', |
400 | 'entity' => 'Survey', | |
401 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
402 | ) , |
403 | 'thankyou_title' => array( | |
404 | 'name' => 'thankyou_title', | |
405 | 'type' => CRM_Utils_Type::T_STRING, | |
406 | 'title' => ts('Thank-you Title') , | |
407 | 'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).', | |
408 | 'maxlength' => 255, | |
409 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 410 | 'table_name' => 'civicrm_survey', |
411 | 'entity' => 'Survey', | |
412 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
413 | ) , |
414 | 'thankyou_text' => array( | |
415 | 'name' => 'thankyou_text', | |
416 | 'type' => CRM_Utils_Type::T_TEXT, | |
417 | 'title' => ts('Thank-you Text') , | |
418 | 'description' => 'text and html allowed. displayed above result on success page', | |
419 | 'rows' => 8, | |
420 | 'cols' => 60, | |
522a26c9 | 421 | 'table_name' => 'civicrm_survey', |
422 | 'entity' => 'Survey', | |
423 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
424 | 'html' => array( |
425 | 'type' => 'TextArea', | |
426 | ) , | |
427 | ) , | |
428 | 'is_share' => array( | |
429 | 'name' => 'is_share', | |
430 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
431 | 'title' => ts('Is shared through social media') , | |
432 | 'description' => 'Can people share the petition through social media?', | |
433 | 'default' => '1', | |
522a26c9 | 434 | 'table_name' => 'civicrm_survey', |
435 | 'entity' => 'Survey', | |
436 | 'bao' => 'CRM_Campaign_BAO_Survey', | |
e501603b TO |
437 | ) , |
438 | ); | |
346aaaba | 439 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 440 | } |
346aaaba | 441 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
442 | } |
443 | /** | |
bd8e0b14 | 444 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
445 | * |
446 | * @return array | |
bd8e0b14 | 447 | * Array(string $name => string $uniqueName). |
e501603b TO |
448 | */ |
449 | static function &fieldKeys() { | |
bd8e0b14 TO |
450 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
451 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 452 | } |
bd8e0b14 | 453 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
454 | } |
455 | /** | |
456 | * Returns the names of this table | |
457 | * | |
458 | * @return string | |
459 | */ | |
460 | static function getTableName() { | |
461 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
462 | } | |
463 | /** | |
464 | * Returns if this table needs to be logged | |
465 | * | |
466 | * @return boolean | |
467 | */ | |
468 | function getLog() { | |
469 | return self::$_log; | |
470 | } | |
471 | /** | |
472 | * Returns the list of fields that can be imported | |
473 | * | |
474 | * @param bool $prefix | |
475 | * | |
476 | * @return array | |
477 | */ | |
478 | static function &import($prefix = false) { | |
60808919 TO |
479 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'survey', $prefix, array()); |
480 | return $r; | |
e501603b TO |
481 | } |
482 | /** | |
483 | * Returns the list of fields that can be exported | |
484 | * | |
485 | * @param bool $prefix | |
486 | * | |
487 | * @return array | |
488 | */ | |
489 | static function &export($prefix = false) { | |
60808919 TO |
490 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'survey', $prefix, array()); |
491 | return $r; | |
e501603b TO |
492 | } |
493 | } |