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