include title
[civicrm-core.git] / CRM / Campaign / DAO / Survey.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/Survey.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:55aa9d31d08f8b5353d42dde1278b7f2)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Campaign_DAO_Survey constructor.
39 */
40 class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_survey';
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 * 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 /**
174 * Class constructor.
175 */
176 function __construct() {
177 $this->__table = 'civicrm_survey';
178 parent::__construct();
179 }
180 /**
181 * Returns foreign keys and entity references.
182 *
183 * @return array
184 * [CRM_Core_Reference_Interface]
185 */
186 static function getReferenceColumns() {
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']);
193 }
194 return Civi::$statics[__CLASS__]['links'];
195 }
196 /**
197 * Returns all the column names of this table
198 *
199 * @return array
200 */
201 static function &fields() {
202 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
203 Civi::$statics[__CLASS__]['fields'] = array(
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,
210 'table_name' => 'civicrm_survey',
211 'entity' => 'Survey',
212 'bao' => 'CRM_Campaign_BAO_Survey',
213 'localizable' => 0,
214 ) ,
215 'title' => array(
216 'name' => 'title',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('Survey Title') ,
219 'description' => 'Title of the Survey.',
220 'required' => true,
221 'maxlength' => 255,
222 'size' => CRM_Utils_Type::HUGE,
223 'import' => true,
224 'where' => 'civicrm_survey.title',
225 'headerPattern' => '',
226 'dataPattern' => '',
227 'export' => true,
228 'table_name' => 'civicrm_survey',
229 'entity' => 'Survey',
230 'bao' => 'CRM_Campaign_BAO_Survey',
231 'localizable' => 1,
232 ) ,
233 'campaign_id' => array(
234 'name' => 'campaign_id',
235 'type' => CRM_Utils_Type::T_INT,
236 'title' => ts('Survey Campaign ID') ,
237 'description' => 'Foreign key to the Campaign.',
238 'default' => 'NULL',
239 'table_name' => 'civicrm_survey',
240 'entity' => 'Survey',
241 'bao' => 'CRM_Campaign_BAO_Survey',
242 'localizable' => 0,
243 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
244 'pseudoconstant' => array(
245 'table' => 'civicrm_campaign',
246 'keyColumn' => 'id',
247 'labelColumn' => 'title',
248 )
249 ) ,
250 'activity_type_id' => array(
251 'name' => 'activity_type_id',
252 'type' => CRM_Utils_Type::T_INT,
253 'title' => ts('Activity Type') ,
254 'description' => 'Implicit FK to civicrm_option_value where option_group = activity_type',
255 'import' => true,
256 'where' => 'civicrm_survey.activity_type_id',
257 'headerPattern' => '',
258 'dataPattern' => '',
259 'export' => true,
260 'default' => 'NULL',
261 'table_name' => 'civicrm_survey',
262 'entity' => 'Survey',
263 'bao' => 'CRM_Campaign_BAO_Survey',
264 'localizable' => 0,
265 'html' => array(
266 'type' => 'Select',
267 ) ,
268 'pseudoconstant' => array(
269 'optionGroupName' => 'activity_type',
270 'optionEditPath' => 'civicrm/admin/options/activity_type',
271 )
272 ) ,
273 'recontact_interval' => array(
274 'name' => 'recontact_interval',
275 'type' => CRM_Utils_Type::T_TEXT,
276 'title' => ts('Follow up Interval') ,
277 'description' => 'Recontact intervals for each status.',
278 'rows' => 20,
279 'cols' => 80,
280 'table_name' => 'civicrm_survey',
281 'entity' => 'Survey',
282 'bao' => 'CRM_Campaign_BAO_Survey',
283 'localizable' => 0,
284 'html' => array(
285 'type' => 'TextArea',
286 ) ,
287 ) ,
288 'instructions' => array(
289 'name' => 'instructions',
290 'type' => CRM_Utils_Type::T_TEXT,
291 'title' => ts('Instructions') ,
292 'description' => 'Script instructions for volunteers to use for the survey.',
293 'rows' => 20,
294 'cols' => 80,
295 'table_name' => 'civicrm_survey',
296 'entity' => 'Survey',
297 'bao' => 'CRM_Campaign_BAO_Survey',
298 'localizable' => 1,
299 'html' => array(
300 'type' => 'TextArea',
301 ) ,
302 ) ,
303 'release_frequency' => array(
304 'name' => 'release_frequency',
305 'type' => CRM_Utils_Type::T_INT,
306 'title' => ts('Survey Hold Duration') ,
307 'description' => 'Number of days for recurrence of release.',
308 'default' => 'NULL',
309 'table_name' => 'civicrm_survey',
310 'entity' => 'Survey',
311 'bao' => 'CRM_Campaign_BAO_Survey',
312 'localizable' => 0,
313 ) ,
314 'max_number_of_contacts' => array(
315 'name' => 'max_number_of_contacts',
316 'type' => CRM_Utils_Type::T_INT,
317 'title' => ts('Maximum number of contacts') ,
318 'description' => 'Maximum number of contacts to allow for survey.',
319 'default' => 'NULL',
320 'table_name' => 'civicrm_survey',
321 'entity' => 'Survey',
322 'bao' => 'CRM_Campaign_BAO_Survey',
323 'localizable' => 0,
324 ) ,
325 'default_number_of_contacts' => array(
326 'name' => 'default_number_of_contacts',
327 'type' => CRM_Utils_Type::T_INT,
328 'title' => ts('Default number of contacts') ,
329 'description' => 'Default number of contacts to allow for survey.',
330 'default' => 'NULL',
331 'table_name' => 'civicrm_survey',
332 'entity' => 'Survey',
333 'bao' => 'CRM_Campaign_BAO_Survey',
334 'localizable' => 0,
335 ) ,
336 'is_active' => array(
337 'name' => 'is_active',
338 'type' => CRM_Utils_Type::T_BOOLEAN,
339 'title' => ts('Survey Is Active') ,
340 'description' => 'Is this survey enabled or disabled/cancelled?',
341 'default' => '1',
342 'table_name' => 'civicrm_survey',
343 'entity' => 'Survey',
344 'bao' => 'CRM_Campaign_BAO_Survey',
345 'localizable' => 0,
346 ) ,
347 'is_default' => array(
348 'name' => 'is_default',
349 'type' => CRM_Utils_Type::T_BOOLEAN,
350 'title' => ts('Is Default Survey') ,
351 'description' => 'Is this default survey?',
352 'table_name' => 'civicrm_survey',
353 'entity' => 'Survey',
354 'bao' => 'CRM_Campaign_BAO_Survey',
355 'localizable' => 0,
356 ) ,
357 'created_id' => array(
358 'name' => 'created_id',
359 'type' => CRM_Utils_Type::T_INT,
360 'title' => ts('Survey Created By') ,
361 'description' => 'FK to civicrm_contact, who created this Survey.',
362 'table_name' => 'civicrm_survey',
363 'entity' => 'Survey',
364 'bao' => 'CRM_Campaign_BAO_Survey',
365 'localizable' => 0,
366 'FKClassName' => 'CRM_Contact_DAO_Contact',
367 ) ,
368 'created_date' => array(
369 'name' => 'created_date',
370 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
371 'title' => ts('Campaign Created Date') ,
372 'description' => 'Date and time that Survey was created.',
373 'table_name' => 'civicrm_survey',
374 'entity' => 'Survey',
375 'bao' => 'CRM_Campaign_BAO_Survey',
376 'localizable' => 0,
377 ) ,
378 'last_modified_id' => array(
379 'name' => 'last_modified_id',
380 'type' => CRM_Utils_Type::T_INT,
381 'title' => ts('Survey Modified') ,
382 'description' => 'FK to civicrm_contact, who recently edited this Survey.',
383 'table_name' => 'civicrm_survey',
384 'entity' => 'Survey',
385 'bao' => 'CRM_Campaign_BAO_Survey',
386 'localizable' => 0,
387 'FKClassName' => 'CRM_Contact_DAO_Contact',
388 ) ,
389 'last_modified_date' => array(
390 'name' => 'last_modified_date',
391 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
392 'title' => ts('Survey Modified On') ,
393 'description' => 'Date and time that Survey was edited last time.',
394 'table_name' => 'civicrm_survey',
395 'entity' => 'Survey',
396 'bao' => 'CRM_Campaign_BAO_Survey',
397 'localizable' => 0,
398 ) ,
399 'result_id' => array(
400 'name' => 'result_id',
401 'type' => CRM_Utils_Type::T_INT,
402 'title' => ts('Survey Result') ,
403 'description' => 'Used to store option group id.',
404 'default' => 'NULL',
405 'table_name' => 'civicrm_survey',
406 'entity' => 'Survey',
407 'bao' => 'CRM_Campaign_BAO_Survey',
408 'localizable' => 0,
409 ) ,
410 'bypass_confirm' => array(
411 'name' => 'bypass_confirm',
412 'type' => CRM_Utils_Type::T_BOOLEAN,
413 'title' => ts('No Email Verification') ,
414 'description' => 'Bypass the email verification.',
415 'table_name' => 'civicrm_survey',
416 'entity' => 'Survey',
417 'bao' => 'CRM_Campaign_BAO_Survey',
418 'localizable' => 0,
419 ) ,
420 'thankyou_title' => array(
421 'name' => 'thankyou_title',
422 'type' => CRM_Utils_Type::T_STRING,
423 'title' => ts('Thank-you Title') ,
424 'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).',
425 'maxlength' => 255,
426 'size' => CRM_Utils_Type::HUGE,
427 'table_name' => 'civicrm_survey',
428 'entity' => 'Survey',
429 'bao' => 'CRM_Campaign_BAO_Survey',
430 'localizable' => 1,
431 ) ,
432 'thankyou_text' => array(
433 'name' => 'thankyou_text',
434 'type' => CRM_Utils_Type::T_TEXT,
435 'title' => ts('Thank-you Text') ,
436 'description' => 'text and html allowed. displayed above result on success page',
437 'rows' => 8,
438 'cols' => 60,
439 'table_name' => 'civicrm_survey',
440 'entity' => 'Survey',
441 'bao' => 'CRM_Campaign_BAO_Survey',
442 'localizable' => 1,
443 'html' => array(
444 'type' => 'TextArea',
445 ) ,
446 ) ,
447 'is_share' => array(
448 'name' => 'is_share',
449 'type' => CRM_Utils_Type::T_BOOLEAN,
450 'title' => ts('Is shared through social media') ,
451 'description' => 'Can people share the petition through social media?',
452 'default' => '1',
453 'table_name' => 'civicrm_survey',
454 'entity' => 'Survey',
455 'bao' => 'CRM_Campaign_BAO_Survey',
456 'localizable' => 0,
457 ) ,
458 );
459 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
460 }
461 return Civi::$statics[__CLASS__]['fields'];
462 }
463 /**
464 * Return a mapping from field-name to the corresponding key (as used in fields()).
465 *
466 * @return array
467 * Array(string $name => string $uniqueName).
468 */
469 static function &fieldKeys() {
470 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
471 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
472 }
473 return Civi::$statics[__CLASS__]['fieldKeys'];
474 }
475 /**
476 * Returns the names of this table
477 *
478 * @return string
479 */
480 static function getTableName() {
481 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
482 }
483 /**
484 * Returns if this table needs to be logged
485 *
486 * @return boolean
487 */
488 function getLog() {
489 return self::$_log;
490 }
491 /**
492 * Returns the list of fields that can be imported
493 *
494 * @param bool $prefix
495 *
496 * @return array
497 */
498 static function &import($prefix = false) {
499 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'survey', $prefix, array());
500 return $r;
501 }
502 /**
503 * Returns the list of fields that can be exported
504 *
505 * @param bool $prefix
506 *
507 * @return array
508 */
509 static function &export($prefix = false) {
510 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'survey', $prefix, array());
511 return $r;
512 }
513 /**
514 * Returns the list of indices
515 */
516 public static function indices($localize = TRUE) {
517 $indices = array(
518 'UI_activity_type_id' => array(
519 'name' => 'UI_activity_type_id',
520 'field' => array(
521 0 => 'activity_type_id',
522 ) ,
523 'localizable' => false,
524 'sig' => 'civicrm_survey::0::activity_type_id',
525 ) ,
526 );
527 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
528 }
529 }