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