Merge pull request #10549 from jitendrapurohit/CRM-20761
[civicrm-core.git] / CRM / Core / DAO / UFGroup.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/Core/UFGroup.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:d716aaa0c1ca4a43bbd533faef6d94c7)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_UFGroup constructor.
39 */
40 class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_uf_group';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Unique table ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Is this form currently active? If false, hide all related fields for all sharing contexts.
61 *
62 * @var boolean
63 */
64 public $is_active;
65 /**
66 * This column will store a comma separated list of the type(s) of profile fields.
67 *
68 * @var string
69 */
70 public $group_type;
71 /**
72 * Form title.
73 *
74 * @var string
75 */
76 public $title;
77 /**
78 * Optional verbose description of the profile.
79 *
80 * @var text
81 */
82 public $description;
83 /**
84 * Description and/or help text to display before fields in form.
85 *
86 * @var text
87 */
88 public $help_pre;
89 /**
90 * Description and/or help text to display after fields in form.
91 *
92 * @var text
93 */
94 public $help_post;
95 /**
96 * Group id, foreign key from civicrm_group
97 *
98 * @var int unsigned
99 */
100 public $limit_listings_group_id;
101 /**
102 * Redirect to URL.
103 *
104 * @var string
105 */
106 public $post_URL;
107 /**
108 * foreign key to civicrm_group_id
109 *
110 * @var int unsigned
111 */
112 public $add_to_group_id;
113 /**
114 * Should a CAPTCHA widget be included this Profile form.
115 *
116 * @var boolean
117 */
118 public $add_captcha;
119 /**
120 * Do we want to map results from this profile.
121 *
122 * @var boolean
123 */
124 public $is_map;
125 /**
126 * Should edit link display in profile selector
127 *
128 * @var boolean
129 */
130 public $is_edit_link;
131 /**
132 * Should we display a link to the website profile in profile selector
133 *
134 * @var boolean
135 */
136 public $is_uf_link;
137 /**
138 * Should we update the contact record if we find a duplicate
139 *
140 * @var boolean
141 */
142 public $is_update_dupe;
143 /**
144 * Redirect to URL when Cancle button clik .
145 *
146 * @var string
147 */
148 public $cancel_URL;
149 /**
150 * Should we create a cms user for this profile
151 *
152 * @var boolean
153 */
154 public $is_cms_user;
155 /**
156 *
157 * @var text
158 */
159 public $notify;
160 /**
161 * Is this group reserved for use by some other CiviCRM functionality?
162 *
163 * @var boolean
164 */
165 public $is_reserved;
166 /**
167 * Name of the UF group for directly addressing it in the codebase
168 *
169 * @var string
170 */
171 public $name;
172 /**
173 * FK to civicrm_contact, who created this UF group
174 *
175 * @var int unsigned
176 */
177 public $created_id;
178 /**
179 * Date and time this UF group was created.
180 *
181 * @var datetime
182 */
183 public $created_date;
184 /**
185 * Should we include proximity search feature in this profile search form?
186 *
187 * @var boolean
188 */
189 public $is_proximity_search;
190 /**
191 * Class constructor.
192 */
193 function __construct() {
194 $this->__table = 'civicrm_uf_group';
195 parent::__construct();
196 }
197 /**
198 * Returns foreign keys and entity references.
199 *
200 * @return array
201 * [CRM_Core_Reference_Interface]
202 */
203 static function getReferenceColumns() {
204 if (!isset(Civi::$statics[__CLASS__]['links'])) {
205 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
206 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'limit_listings_group_id', 'civicrm_group', 'id');
207 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'add_to_group_id', 'civicrm_group', 'id');
208 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
209 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
210 }
211 return Civi::$statics[__CLASS__]['links'];
212 }
213 /**
214 * Returns all the column names of this table
215 *
216 * @return array
217 */
218 static function &fields() {
219 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
220 Civi::$statics[__CLASS__]['fields'] = array(
221 'id' => array(
222 'name' => 'id',
223 'type' => CRM_Utils_Type::T_INT,
224 'title' => ts('Profile ID') ,
225 'description' => 'Unique table ID',
226 'required' => true,
227 'table_name' => 'civicrm_uf_group',
228 'entity' => 'UFGroup',
229 'bao' => 'CRM_Core_BAO_UFGroup',
230 'localizable' => 0,
231 ) ,
232 'is_active' => array(
233 'name' => 'is_active',
234 'type' => CRM_Utils_Type::T_BOOLEAN,
235 'title' => ts('Profile Is Active') ,
236 'description' => 'Is this form currently active? If false, hide all related fields for all sharing contexts.',
237 'default' => '1',
238 'table_name' => 'civicrm_uf_group',
239 'entity' => 'UFGroup',
240 'bao' => 'CRM_Core_BAO_UFGroup',
241 'localizable' => 0,
242 ) ,
243 'group_type' => array(
244 'name' => 'group_type',
245 'type' => CRM_Utils_Type::T_STRING,
246 'title' => ts('Profile Group Type') ,
247 'description' => 'This column will store a comma separated list of the type(s) of profile fields.',
248 'maxlength' => 255,
249 'size' => CRM_Utils_Type::HUGE,
250 'import' => true,
251 'where' => 'civicrm_uf_group.group_type',
252 'headerPattern' => '',
253 'dataPattern' => '',
254 'export' => true,
255 'table_name' => 'civicrm_uf_group',
256 'entity' => 'UFGroup',
257 'bao' => 'CRM_Core_BAO_UFGroup',
258 'localizable' => 0,
259 ) ,
260 'title' => array(
261 'name' => 'title',
262 'type' => CRM_Utils_Type::T_STRING,
263 'title' => ts('Title') ,
264 'description' => 'Form title.',
265 'required' => true,
266 'maxlength' => 64,
267 'size' => CRM_Utils_Type::BIG,
268 'table_name' => 'civicrm_uf_group',
269 'entity' => 'UFGroup',
270 'bao' => 'CRM_Core_BAO_UFGroup',
271 'localizable' => 1,
272 ) ,
273 'description' => array(
274 'name' => 'description',
275 'type' => CRM_Utils_Type::T_TEXT,
276 'title' => ts('Profile Description') ,
277 'description' => 'Optional verbose description of the profile.',
278 'rows' => 2,
279 'cols' => 60,
280 'table_name' => 'civicrm_uf_group',
281 'entity' => 'UFGroup',
282 'bao' => 'CRM_Core_BAO_UFGroup',
283 'localizable' => 0,
284 'html' => array(
285 'type' => 'TextArea',
286 ) ,
287 ) ,
288 'help_pre' => array(
289 'name' => 'help_pre',
290 'type' => CRM_Utils_Type::T_TEXT,
291 'title' => ts('Help Pre') ,
292 'description' => 'Description and/or help text to display before fields in form.',
293 'rows' => 4,
294 'cols' => 80,
295 'table_name' => 'civicrm_uf_group',
296 'entity' => 'UFGroup',
297 'bao' => 'CRM_Core_BAO_UFGroup',
298 'localizable' => 1,
299 'html' => array(
300 'type' => 'TextArea',
301 ) ,
302 ) ,
303 'help_post' => array(
304 'name' => 'help_post',
305 'type' => CRM_Utils_Type::T_TEXT,
306 'title' => ts('Profile Post Text') ,
307 'description' => 'Description and/or help text to display after fields in form.',
308 'rows' => 4,
309 'cols' => 80,
310 'table_name' => 'civicrm_uf_group',
311 'entity' => 'UFGroup',
312 'bao' => 'CRM_Core_BAO_UFGroup',
313 'localizable' => 1,
314 'html' => array(
315 'type' => 'TextArea',
316 ) ,
317 ) ,
318 'limit_listings_group_id' => array(
319 'name' => 'limit_listings_group_id',
320 'type' => CRM_Utils_Type::T_INT,
321 'title' => ts('Profile Search Limit Group') ,
322 'description' => 'Group id, foreign key from civicrm_group',
323 'table_name' => 'civicrm_uf_group',
324 'entity' => 'UFGroup',
325 'bao' => 'CRM_Core_BAO_UFGroup',
326 'localizable' => 0,
327 'FKClassName' => 'CRM_Contact_DAO_Group',
328 ) ,
329 'post_URL' => array(
330 'name' => 'post_URL',
331 'type' => CRM_Utils_Type::T_STRING,
332 'title' => ts('Post Url') ,
333 'description' => 'Redirect to URL.',
334 'maxlength' => 255,
335 'size' => CRM_Utils_Type::HUGE,
336 'table_name' => 'civicrm_uf_group',
337 'entity' => 'UFGroup',
338 'bao' => 'CRM_Core_BAO_UFGroup',
339 'localizable' => 0,
340 ) ,
341 'add_to_group_id' => array(
342 'name' => 'add_to_group_id',
343 'type' => CRM_Utils_Type::T_INT,
344 'title' => ts('Add Contact To Group') ,
345 'description' => 'foreign key to civicrm_group_id',
346 'table_name' => 'civicrm_uf_group',
347 'entity' => 'UFGroup',
348 'bao' => 'CRM_Core_BAO_UFGroup',
349 'localizable' => 0,
350 'FKClassName' => 'CRM_Contact_DAO_Group',
351 ) ,
352 'add_captcha' => array(
353 'name' => 'add_captcha',
354 'type' => CRM_Utils_Type::T_BOOLEAN,
355 'title' => ts('Show Captcha On Profile') ,
356 'description' => 'Should a CAPTCHA widget be included this Profile form.',
357 'table_name' => 'civicrm_uf_group',
358 'entity' => 'UFGroup',
359 'bao' => 'CRM_Core_BAO_UFGroup',
360 'localizable' => 0,
361 ) ,
362 'is_map' => array(
363 'name' => 'is_map',
364 'type' => CRM_Utils_Type::T_BOOLEAN,
365 'title' => ts('Map Profile') ,
366 'description' => 'Do we want to map results from this profile.',
367 'table_name' => 'civicrm_uf_group',
368 'entity' => 'UFGroup',
369 'bao' => 'CRM_Core_BAO_UFGroup',
370 'localizable' => 0,
371 ) ,
372 'is_edit_link' => array(
373 'name' => 'is_edit_link',
374 'type' => CRM_Utils_Type::T_BOOLEAN,
375 'title' => ts('Show Edit Link?') ,
376 'description' => 'Should edit link display in profile selector',
377 'table_name' => 'civicrm_uf_group',
378 'entity' => 'UFGroup',
379 'bao' => 'CRM_Core_BAO_UFGroup',
380 'localizable' => 0,
381 ) ,
382 'is_uf_link' => array(
383 'name' => 'is_uf_link',
384 'type' => CRM_Utils_Type::T_BOOLEAN,
385 'title' => ts('Show Link to CMS User') ,
386 'description' => 'Should we display a link to the website profile in profile selector',
387 'table_name' => 'civicrm_uf_group',
388 'entity' => 'UFGroup',
389 'bao' => 'CRM_Core_BAO_UFGroup',
390 'localizable' => 0,
391 ) ,
392 'is_update_dupe' => array(
393 'name' => 'is_update_dupe',
394 'type' => CRM_Utils_Type::T_BOOLEAN,
395 'title' => ts('Update on Duplicate') ,
396 'description' => 'Should we update the contact record if we find a duplicate',
397 'table_name' => 'civicrm_uf_group',
398 'entity' => 'UFGroup',
399 'bao' => 'CRM_Core_BAO_UFGroup',
400 'localizable' => 0,
401 ) ,
402 'cancel_URL' => array(
403 'name' => 'cancel_URL',
404 'type' => CRM_Utils_Type::T_STRING,
405 'title' => ts('Profile Cancel URL') ,
406 'description' => 'Redirect to URL when Cancle button clik .',
407 'maxlength' => 255,
408 'size' => CRM_Utils_Type::HUGE,
409 'table_name' => 'civicrm_uf_group',
410 'entity' => 'UFGroup',
411 'bao' => 'CRM_Core_BAO_UFGroup',
412 'localizable' => 0,
413 ) ,
414 'is_cms_user' => array(
415 'name' => 'is_cms_user',
416 'type' => CRM_Utils_Type::T_BOOLEAN,
417 'title' => ts('Create CMS User?') ,
418 'description' => 'Should we create a cms user for this profile ',
419 'table_name' => 'civicrm_uf_group',
420 'entity' => 'UFGroup',
421 'bao' => 'CRM_Core_BAO_UFGroup',
422 'localizable' => 0,
423 ) ,
424 'notify' => array(
425 'name' => 'notify',
426 'type' => CRM_Utils_Type::T_TEXT,
427 'title' => ts('Notify on Profile Submit') ,
428 'table_name' => 'civicrm_uf_group',
429 'entity' => 'UFGroup',
430 'bao' => 'CRM_Core_BAO_UFGroup',
431 'localizable' => 0,
432 ) ,
433 'is_reserved' => array(
434 'name' => 'is_reserved',
435 'type' => CRM_Utils_Type::T_BOOLEAN,
436 'title' => ts('Profile Is Reserved') ,
437 'description' => 'Is this group reserved for use by some other CiviCRM functionality?',
438 'table_name' => 'civicrm_uf_group',
439 'entity' => 'UFGroup',
440 'bao' => 'CRM_Core_BAO_UFGroup',
441 'localizable' => 0,
442 ) ,
443 'name' => array(
444 'name' => 'name',
445 'type' => CRM_Utils_Type::T_STRING,
446 'title' => ts('Profile Name') ,
447 'description' => 'Name of the UF group for directly addressing it in the codebase',
448 'maxlength' => 64,
449 'size' => CRM_Utils_Type::BIG,
450 'table_name' => 'civicrm_uf_group',
451 'entity' => 'UFGroup',
452 'bao' => 'CRM_Core_BAO_UFGroup',
453 'localizable' => 0,
454 ) ,
455 'created_id' => array(
456 'name' => 'created_id',
457 'type' => CRM_Utils_Type::T_INT,
458 'title' => ts('Profile Created By') ,
459 'description' => 'FK to civicrm_contact, who created this UF group',
460 'table_name' => 'civicrm_uf_group',
461 'entity' => 'UFGroup',
462 'bao' => 'CRM_Core_BAO_UFGroup',
463 'localizable' => 0,
464 'FKClassName' => 'CRM_Contact_DAO_Contact',
465 ) ,
466 'created_date' => array(
467 'name' => 'created_date',
468 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
469 'title' => ts('UF Group Created Date') ,
470 'description' => 'Date and time this UF group was created.',
471 'table_name' => 'civicrm_uf_group',
472 'entity' => 'UFGroup',
473 'bao' => 'CRM_Core_BAO_UFGroup',
474 'localizable' => 0,
475 ) ,
476 'is_proximity_search' => array(
477 'name' => 'is_proximity_search',
478 'type' => CRM_Utils_Type::T_BOOLEAN,
479 'title' => ts('Include Proximity Search?') ,
480 'description' => 'Should we include proximity search feature in this profile search form?',
481 'table_name' => 'civicrm_uf_group',
482 'entity' => 'UFGroup',
483 'bao' => 'CRM_Core_BAO_UFGroup',
484 'localizable' => 0,
485 ) ,
486 );
487 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
488 }
489 return Civi::$statics[__CLASS__]['fields'];
490 }
491 /**
492 * Return a mapping from field-name to the corresponding key (as used in fields()).
493 *
494 * @return array
495 * Array(string $name => string $uniqueName).
496 */
497 static function &fieldKeys() {
498 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
499 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
500 }
501 return Civi::$statics[__CLASS__]['fieldKeys'];
502 }
503 /**
504 * Returns the names of this table
505 *
506 * @return string
507 */
508 static function getTableName() {
509 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
510 }
511 /**
512 * Returns if this table needs to be logged
513 *
514 * @return boolean
515 */
516 function getLog() {
517 return self::$_log;
518 }
519 /**
520 * Returns the list of fields that can be imported
521 *
522 * @param bool $prefix
523 *
524 * @return array
525 */
526 static function &import($prefix = false) {
527 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_group', $prefix, array());
528 return $r;
529 }
530 /**
531 * Returns the list of fields that can be exported
532 *
533 * @param bool $prefix
534 *
535 * @return array
536 */
537 static function &export($prefix = false) {
538 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_group', $prefix, array());
539 return $r;
540 }
541 /**
542 * Returns the list of indices
543 */
544 public static function indices($localize = TRUE) {
545 $indices = array(
546 'UI_name' => array(
547 'name' => 'UI_name',
548 'field' => array(
549 0 => 'name',
550 ) ,
551 'localizable' => false,
552 'unique' => true,
553 'sig' => 'civicrm_uf_group::1::name',
554 ) ,
555 );
556 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
557 }
558 }