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