Merge pull request #9599 from colemanw/CRM-19812
[civicrm-core.git] / CRM / Campaign / DAO / Survey.php
CommitLineData
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/Survey.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:c45e190f503b80f0ee057a9ed43a5753)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class 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';
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 * Survey id.
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Title of the Survey.
59 *
60 * @var string
61 */
62 public $title;
63 /**
64 * Foreign key to the Campaign.
65 *
66 * @var int unsigned
67 */
68 public $campaign_id;
69 /**
70 * Implicit FK to civicrm_option_value where option_group = activity_type
71 *
72 * @var int unsigned
73 */
74 public $activity_type_id;
75 /**
76 * Recontact intervals for each status.
77 *
78 * @var text
79 */
80 public $recontact_interval;
81 /**
82 * Script instructions for volunteers to use for the survey.
83 *
84 * @var text
85 */
86 public $instructions;
87 /**
88 * Number of days for recurrence of release.
89 *
90 * @var int unsigned
91 */
92 public $release_frequency;
93 /**
94 * Maximum number of contacts to allow for survey.
95 *
96 * @var int unsigned
97 */
98 public $max_number_of_contacts;
99 /**
100 * Default number of contacts to allow for survey.
101 *
102 * @var int unsigned
103 */
104 public $default_number_of_contacts;
105 /**
106 * Is this survey enabled or disabled/cancelled?
107 *
108 * @var boolean
109 */
110 public $is_active;
111 /**
112 * Is this default survey?
113 *
114 * @var boolean
115 */
116 public $is_default;
117 /**
118 * FK to civicrm_contact, who created this Survey.
119 *
120 * @var int unsigned
121 */
122 public $created_id;
123 /**
124 * Date and time that Survey was created.
125 *
126 * @var datetime
127 */
128 public $created_date;
129 /**
130 * FK to civicrm_contact, who recently edited this Survey.
131 *
132 * @var int unsigned
133 */
134 public $last_modified_id;
135 /**
136 * Date and time that Survey was edited last time.
137 *
138 * @var datetime
139 */
140 public $last_modified_date;
141 /**
142 * Used to store option group id.
143 *
144 * @var int unsigned
145 */
146 public $result_id;
147 /**
148 * Bypass the email verification.
149 *
150 * @var boolean
151 */
152 public $bypass_confirm;
153 /**
154 * Title for Thank-you page (header title tag, and display at the top of the page).
155 *
156 * @var string
157 */
158 public $thankyou_title;
159 /**
160 * text and html allowed. displayed above result on success page
161 *
162 * @var text
163 */
164 public $thankyou_text;
165 /**
166 * Can people share the petition through social media?
167 *
168 * @var boolean
169 */
170 public $is_share;
171 /**
172 * class constructor
173 *
174 * @return civicrm_survey
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() {
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,
210 ) ,
211 'title' => array(
212 'name' => 'title',
213 'type' => CRM_Utils_Type::T_STRING,
214 'title' => ts('Survey Title') ,
215 'description' => 'Title of the Survey.',
216 'required' => true,
217 'maxlength' => 255,
218 'size' => CRM_Utils_Type::HUGE,
219 'import' => true,
220 'where' => 'civicrm_survey.title',
221 'headerPattern' => '',
222 'dataPattern' => '',
223 'export' => true,
224 ) ,
225 'campaign_id' => array(
226 'name' => 'campaign_id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Survey Campaign ID') ,
229 'description' => 'Foreign key to the Campaign.',
230 'default' => 'NULL',
231 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
232 'pseudoconstant' => array(
233 'table' => 'civicrm_campaign',
234 'keyColumn' => 'id',
235 'labelColumn' => 'title',
236 )
237 ) ,
238 'activity_type_id' => array(
239 'name' => 'activity_type_id',
240 'type' => CRM_Utils_Type::T_INT,
241 'title' => ts('Activity Type') ,
242 'description' => 'Implicit FK to civicrm_option_value where option_group = activity_type',
243 'import' => true,
244 'where' => 'civicrm_survey.activity_type_id',
245 'headerPattern' => '',
246 'dataPattern' => '',
247 'export' => true,
248 'default' => 'NULL',
249 'html' => array(
250 'type' => 'Select',
251 ) ,
252 'pseudoconstant' => array(
253 'optionGroupName' => 'activity_type',
254 'optionEditPath' => 'civicrm/admin/options/activity_type',
255 )
256 ) ,
257 'recontact_interval' => array(
258 'name' => 'recontact_interval',
259 'type' => CRM_Utils_Type::T_TEXT,
260 'title' => ts('Follow up Interval') ,
261 'description' => 'Recontact intervals for each status.',
262 'rows' => 20,
263 'cols' => 80,
264 'html' => array(
265 'type' => 'TextArea',
266 ) ,
267 ) ,
268 'instructions' => array(
269 'name' => 'instructions',
270 'type' => CRM_Utils_Type::T_TEXT,
271 'title' => ts('Instructions') ,
272 'description' => 'Script instructions for volunteers to use for the survey.',
273 'rows' => 20,
274 'cols' => 80,
275 'html' => array(
276 'type' => 'TextArea',
277 ) ,
278 ) ,
279 'release_frequency' => array(
280 'name' => 'release_frequency',
281 'type' => CRM_Utils_Type::T_INT,
282 'title' => ts('Survey Hold Duration') ,
283 'description' => 'Number of days for recurrence of release.',
284 'default' => 'NULL',
285 ) ,
286 'max_number_of_contacts' => array(
287 'name' => 'max_number_of_contacts',
288 'type' => CRM_Utils_Type::T_INT,
289 'title' => ts('Maximum number of contacts') ,
290 'description' => 'Maximum number of contacts to allow for survey.',
291 'default' => 'NULL',
292 ) ,
293 'default_number_of_contacts' => array(
294 'name' => 'default_number_of_contacts',
295 'type' => CRM_Utils_Type::T_INT,
296 'title' => ts('Default number of contacts') ,
297 'description' => 'Default number of contacts to allow for survey.',
298 'default' => 'NULL',
299 ) ,
300 'is_active' => array(
301 'name' => 'is_active',
302 'type' => CRM_Utils_Type::T_BOOLEAN,
303 'title' => ts('Survey Is Active') ,
304 'description' => 'Is this survey enabled or disabled/cancelled?',
305 'default' => '1',
306 ) ,
307 'is_default' => array(
308 'name' => 'is_default',
309 'type' => CRM_Utils_Type::T_BOOLEAN,
310 'title' => ts('Is Default Survey') ,
311 'description' => 'Is this default survey?',
312 ) ,
313 'created_id' => array(
314 'name' => 'created_id',
315 'type' => CRM_Utils_Type::T_INT,
316 'title' => ts('Survey Created By') ,
317 'description' => 'FK to civicrm_contact, who created this Survey.',
318 'FKClassName' => 'CRM_Contact_DAO_Contact',
319 ) ,
320 'created_date' => array(
321 'name' => 'created_date',
322 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
323 'title' => ts('Campaign Created Date') ,
324 'description' => 'Date and time that Survey was created.',
325 ) ,
326 'last_modified_id' => array(
327 'name' => 'last_modified_id',
328 'type' => CRM_Utils_Type::T_INT,
329 'title' => ts('Survey Modified') ,
330 'description' => 'FK to civicrm_contact, who recently edited this Survey.',
331 'FKClassName' => 'CRM_Contact_DAO_Contact',
332 ) ,
333 'last_modified_date' => array(
334 'name' => 'last_modified_date',
335 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
336 'title' => ts('Survey Modified On') ,
337 'description' => 'Date and time that Survey was edited last time.',
338 ) ,
339 'result_id' => array(
340 'name' => 'result_id',
341 'type' => CRM_Utils_Type::T_INT,
342 'title' => ts('Survey Result') ,
343 'description' => 'Used to store option group id.',
344 'default' => 'NULL',
345 ) ,
346 'bypass_confirm' => array(
347 'name' => 'bypass_confirm',
348 'type' => CRM_Utils_Type::T_BOOLEAN,
349 'title' => ts('No Email Verification') ,
350 'description' => 'Bypass the email verification.',
351 ) ,
352 'thankyou_title' => array(
353 'name' => 'thankyou_title',
354 'type' => CRM_Utils_Type::T_STRING,
355 'title' => ts('Thank-you Title') ,
356 'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).',
357 'maxlength' => 255,
358 'size' => CRM_Utils_Type::HUGE,
359 ) ,
360 'thankyou_text' => array(
361 'name' => 'thankyou_text',
362 'type' => CRM_Utils_Type::T_TEXT,
363 'title' => ts('Thank-you Text') ,
364 'description' => 'text and html allowed. displayed above result on success page',
365 'rows' => 8,
366 'cols' => 60,
367 'html' => array(
368 'type' => 'TextArea',
369 ) ,
370 ) ,
371 'is_share' => array(
372 'name' => 'is_share',
373 'type' => CRM_Utils_Type::T_BOOLEAN,
374 'title' => ts('Is shared through social media') ,
375 'description' => 'Can people share the petition through social media?',
376 'default' => '1',
377 ) ,
378 );
346aaaba 379 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 380 }
346aaaba 381 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
382 }
383 /**
bd8e0b14 384 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
385 *
386 * @return array
bd8e0b14 387 * Array(string $name => string $uniqueName).
e501603b
TO
388 */
389 static function &fieldKeys() {
bd8e0b14
TO
390 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
391 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 392 }
bd8e0b14 393 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
394 }
395 /**
396 * Returns the names of this table
397 *
398 * @return string
399 */
400 static function getTableName() {
401 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
402 }
403 /**
404 * Returns if this table needs to be logged
405 *
406 * @return boolean
407 */
408 function getLog() {
409 return self::$_log;
410 }
411 /**
412 * Returns the list of fields that can be imported
413 *
414 * @param bool $prefix
415 *
416 * @return array
417 */
418 static function &import($prefix = false) {
60808919
TO
419 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'survey', $prefix, array());
420 return $r;
e501603b
TO
421 }
422 /**
423 * Returns the list of fields that can be exported
424 *
425 * @param bool $prefix
426 *
427 * @return array
428 */
429 static function &export($prefix = false) {
60808919
TO
430 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'survey', $prefix, array());
431 return $r;
e501603b
TO
432 }
433}