Merge pull request #9680 from h-c-c/CRM-19881
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.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/CustomGroup.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:190b0c5691831c6708b5de7ce556836d)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_CustomGroup constructor.
39 */
40 class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_custom_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 Custom Group ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Variable name/programmatic handle for this group.
61 *
62 * @var string
63 */
64 public $name;
65 /**
66 * Friendly Name.
67 *
68 * @var string
69 */
70 public $title;
71 /**
72 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
73 *
74 * @var string
75 */
76 public $extends;
77 /**
78 * FK to civicrm_option_value.id (for option group custom_data_type.)
79 *
80 * @var int unsigned
81 */
82 public $extends_entity_column_id;
83 /**
84 * linking custom group for dynamic object
85 *
86 * @var string
87 */
88 public $extends_entity_column_value;
89 /**
90 * Visual relationship between this form and its parent.
91 *
92 * @var string
93 */
94 public $style;
95 /**
96 * Will this group be in collapsed or expanded mode on initial display ?
97 *
98 * @var int unsigned
99 */
100 public $collapse_display;
101 /**
102 * Description and/or help text to display before fields in form.
103 *
104 * @var text
105 */
106 public $help_pre;
107 /**
108 * Description and/or help text to display after fields in form.
109 *
110 * @var text
111 */
112 public $help_post;
113 /**
114 * Controls display order when multiple extended property groups are setup for the same class.
115 *
116 * @var int
117 */
118 public $weight;
119 /**
120 * Is this property active?
121 *
122 * @var boolean
123 */
124 public $is_active;
125 /**
126 * Name of the table that holds the values for this group.
127 *
128 * @var string
129 */
130 public $table_name;
131 /**
132 * Does this group hold multiple values?
133 *
134 * @var boolean
135 */
136 public $is_multiple;
137 /**
138 * minimum number of multiple records (typically 0?)
139 *
140 * @var int unsigned
141 */
142 public $min_multiple;
143 /**
144 * maximum number of multiple records, if 0 - no max
145 *
146 * @var int unsigned
147 */
148 public $max_multiple;
149 /**
150 * Will this group be in collapsed or expanded mode on advanced search display ?
151 *
152 * @var int unsigned
153 */
154 public $collapse_adv_display;
155 /**
156 * FK to civicrm_contact, who created this custom group
157 *
158 * @var int unsigned
159 */
160 public $created_id;
161 /**
162 * Date and time this custom group was created.
163 *
164 * @var datetime
165 */
166 public $created_date;
167 /**
168 * Is this a reserved Custom Group?
169 *
170 * @var boolean
171 */
172 public $is_reserved;
173 /**
174 * Class constructor.
175 */
176 function __construct() {
177 $this->__table = 'civicrm_custom_group';
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() , 'created_id', 'civicrm_contact', 'id');
190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
191 }
192 return Civi::$statics[__CLASS__]['links'];
193 }
194 /**
195 * Returns all the column names of this table
196 *
197 * @return array
198 */
199 static function &fields() {
200 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
201 Civi::$statics[__CLASS__]['fields'] = array(
202 'id' => array(
203 'name' => 'id',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Custom Group ID') ,
206 'description' => 'Unique Custom Group ID',
207 'required' => true,
208 'table_name' => 'civicrm_custom_group',
209 'entity' => 'CustomGroup',
210 'bao' => 'CRM_Core_BAO_CustomGroup',
211 ) ,
212 'name' => array(
213 'name' => 'name',
214 'type' => CRM_Utils_Type::T_STRING,
215 'title' => ts('Custom Group Name') ,
216 'description' => 'Variable name/programmatic handle for this group.',
217 'maxlength' => 64,
218 'size' => CRM_Utils_Type::BIG,
219 'table_name' => 'civicrm_custom_group',
220 'entity' => 'CustomGroup',
221 'bao' => 'CRM_Core_BAO_CustomGroup',
222 ) ,
223 'title' => array(
224 'name' => 'title',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Custom Group Title') ,
227 'description' => 'Friendly Name.',
228 'required' => true,
229 'maxlength' => 64,
230 'size' => CRM_Utils_Type::BIG,
231 'table_name' => 'civicrm_custom_group',
232 'entity' => 'CustomGroup',
233 'bao' => 'CRM_Core_BAO_CustomGroup',
234 ) ,
235 'extends' => array(
236 'name' => 'extends',
237 'type' => CRM_Utils_Type::T_STRING,
238 'title' => ts('Custom Group Extends') ,
239 'description' => 'Type of object this group extends (can add other options later e.g. contact_address, etc.).',
240 'maxlength' => 255,
241 'size' => CRM_Utils_Type::HUGE,
242 'default' => 'Contact',
243 'table_name' => 'civicrm_custom_group',
244 'entity' => 'CustomGroup',
245 'bao' => 'CRM_Core_BAO_CustomGroup',
246 ) ,
247 'extends_entity_column_id' => array(
248 'name' => 'extends_entity_column_id',
249 'type' => CRM_Utils_Type::T_INT,
250 'title' => ts('Custom Group Subtype List') ,
251 'description' => 'FK to civicrm_option_value.id (for option group custom_data_type.)',
252 'default' => 'NULL',
253 'table_name' => 'civicrm_custom_group',
254 'entity' => 'CustomGroup',
255 'bao' => 'CRM_Core_BAO_CustomGroup',
256 ) ,
257 'extends_entity_column_value' => array(
258 'name' => 'extends_entity_column_value',
259 'type' => CRM_Utils_Type::T_STRING,
260 'title' => ts('Custom Group Subtype') ,
261 'description' => 'linking custom group for dynamic object',
262 'maxlength' => 255,
263 'size' => CRM_Utils_Type::HUGE,
264 'table_name' => 'civicrm_custom_group',
265 'entity' => 'CustomGroup',
266 'bao' => 'CRM_Core_BAO_CustomGroup',
267 ) ,
268 'style' => array(
269 'name' => 'style',
270 'type' => CRM_Utils_Type::T_STRING,
271 'title' => ts('Custom Group Style') ,
272 'description' => 'Visual relationship between this form and its parent.',
273 'maxlength' => 15,
274 'size' => CRM_Utils_Type::TWELVE,
275 'table_name' => 'civicrm_custom_group',
276 'entity' => 'CustomGroup',
277 'bao' => 'CRM_Core_BAO_CustomGroup',
278 'html' => array(
279 'type' => 'Select',
280 ) ,
281 'pseudoconstant' => array(
282 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
283 )
284 ) ,
285 'collapse_display' => array(
286 'name' => 'collapse_display',
287 'type' => CRM_Utils_Type::T_INT,
288 'title' => ts('Collapse Custom Group?') ,
289 'description' => 'Will this group be in collapsed or expanded mode on initial display ?',
290 'table_name' => 'civicrm_custom_group',
291 'entity' => 'CustomGroup',
292 'bao' => 'CRM_Core_BAO_CustomGroup',
293 ) ,
294 'help_pre' => array(
295 'name' => 'help_pre',
296 'type' => CRM_Utils_Type::T_TEXT,
297 'title' => ts('Custom Group Pre Text') ,
298 'description' => 'Description and/or help text to display before fields in form.',
299 'rows' => 4,
300 'cols' => 80,
301 'table_name' => 'civicrm_custom_group',
302 'entity' => 'CustomGroup',
303 'bao' => 'CRM_Core_BAO_CustomGroup',
304 'html' => array(
305 'type' => 'TextArea',
306 ) ,
307 ) ,
308 'help_post' => array(
309 'name' => 'help_post',
310 'type' => CRM_Utils_Type::T_TEXT,
311 'title' => ts('Custom Group Post Text') ,
312 'description' => 'Description and/or help text to display after fields in form.',
313 'rows' => 4,
314 'cols' => 80,
315 'table_name' => 'civicrm_custom_group',
316 'entity' => 'CustomGroup',
317 'bao' => 'CRM_Core_BAO_CustomGroup',
318 'html' => array(
319 'type' => 'TextArea',
320 ) ,
321 ) ,
322 'weight' => array(
323 'name' => 'weight',
324 'type' => CRM_Utils_Type::T_INT,
325 'title' => ts('Order') ,
326 'description' => 'Controls display order when multiple extended property groups are setup for the same class.',
327 'required' => true,
328 'default' => '1',
329 'table_name' => 'civicrm_custom_group',
330 'entity' => 'CustomGroup',
331 'bao' => 'CRM_Core_BAO_CustomGroup',
332 ) ,
333 'is_active' => array(
334 'name' => 'is_active',
335 'type' => CRM_Utils_Type::T_BOOLEAN,
336 'title' => ts('Custom Group Is Active?') ,
337 'description' => 'Is this property active?',
338 'table_name' => 'civicrm_custom_group',
339 'entity' => 'CustomGroup',
340 'bao' => 'CRM_Core_BAO_CustomGroup',
341 ) ,
342 'table_name' => array(
343 'name' => 'table_name',
344 'type' => CRM_Utils_Type::T_STRING,
345 'title' => ts('Table Name') ,
346 'description' => 'Name of the table that holds the values for this group.',
347 'maxlength' => 255,
348 'size' => CRM_Utils_Type::HUGE,
349 'table_name' => 'civicrm_custom_group',
350 'entity' => 'CustomGroup',
351 'bao' => 'CRM_Core_BAO_CustomGroup',
352 ) ,
353 'is_multiple' => array(
354 'name' => 'is_multiple',
355 'type' => CRM_Utils_Type::T_BOOLEAN,
356 'title' => ts('Supports Multiple Records') ,
357 'description' => 'Does this group hold multiple values?',
358 'table_name' => 'civicrm_custom_group',
359 'entity' => 'CustomGroup',
360 'bao' => 'CRM_Core_BAO_CustomGroup',
361 ) ,
362 'min_multiple' => array(
363 'name' => 'min_multiple',
364 'type' => CRM_Utils_Type::T_INT,
365 'title' => ts('Minimum Multiple Records') ,
366 'description' => 'minimum number of multiple records (typically 0?)',
367 'table_name' => 'civicrm_custom_group',
368 'entity' => 'CustomGroup',
369 'bao' => 'CRM_Core_BAO_CustomGroup',
370 ) ,
371 'max_multiple' => array(
372 'name' => 'max_multiple',
373 'type' => CRM_Utils_Type::T_INT,
374 'title' => ts('Maximum Multiple Records') ,
375 'description' => 'maximum number of multiple records, if 0 - no max',
376 'table_name' => 'civicrm_custom_group',
377 'entity' => 'CustomGroup',
378 'bao' => 'CRM_Core_BAO_CustomGroup',
379 ) ,
380 'collapse_adv_display' => array(
381 'name' => 'collapse_adv_display',
382 'type' => CRM_Utils_Type::T_INT,
383 'title' => ts('Collapse Group Display') ,
384 'description' => 'Will this group be in collapsed or expanded mode on advanced search display ?',
385 'table_name' => 'civicrm_custom_group',
386 'entity' => 'CustomGroup',
387 'bao' => 'CRM_Core_BAO_CustomGroup',
388 ) ,
389 'created_id' => array(
390 'name' => 'created_id',
391 'type' => CRM_Utils_Type::T_INT,
392 'title' => ts('Custom Group Created By') ,
393 'description' => 'FK to civicrm_contact, who created this custom group',
394 'table_name' => 'civicrm_custom_group',
395 'entity' => 'CustomGroup',
396 'bao' => 'CRM_Core_BAO_CustomGroup',
397 'FKClassName' => 'CRM_Contact_DAO_Contact',
398 ) ,
399 'created_date' => array(
400 'name' => 'created_date',
401 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
402 'title' => ts('Custom Group Created Date') ,
403 'description' => 'Date and time this custom group was created.',
404 'table_name' => 'civicrm_custom_group',
405 'entity' => 'CustomGroup',
406 'bao' => 'CRM_Core_BAO_CustomGroup',
407 ) ,
408 'is_reserved' => array(
409 'name' => 'is_reserved',
410 'type' => CRM_Utils_Type::T_BOOLEAN,
411 'title' => ts('Reserved Group?') ,
412 'description' => 'Is this a reserved Custom Group?',
413 'table_name' => 'civicrm_custom_group',
414 'entity' => 'CustomGroup',
415 'bao' => 'CRM_Core_BAO_CustomGroup',
416 ) ,
417 );
418 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
419 }
420 return Civi::$statics[__CLASS__]['fields'];
421 }
422 /**
423 * Return a mapping from field-name to the corresponding key (as used in fields()).
424 *
425 * @return array
426 * Array(string $name => string $uniqueName).
427 */
428 static function &fieldKeys() {
429 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
430 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
431 }
432 return Civi::$statics[__CLASS__]['fieldKeys'];
433 }
434 /**
435 * Returns the names of this table
436 *
437 * @return string
438 */
439 static function getTableName() {
440 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
441 }
442 /**
443 * Returns if this table needs to be logged
444 *
445 * @return boolean
446 */
447 function getLog() {
448 return self::$_log;
449 }
450 /**
451 * Returns the list of fields that can be imported
452 *
453 * @param bool $prefix
454 *
455 * @return array
456 */
457 static function &import($prefix = false) {
458 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, array());
459 return $r;
460 }
461 /**
462 * Returns the list of fields that can be exported
463 *
464 * @param bool $prefix
465 *
466 * @return array
467 */
468 static function &export($prefix = false) {
469 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, array());
470 return $r;
471 }
472 }