fixup CRM-14885 - Import DAOs
[civicrm-core.git] / CRM / Contact / DAO / Group.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/Contact/Group.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:dfc60eae37cca2aa63dc674d2613264c)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Contact_DAO_Group extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_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 * Group ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Internal name of Group.
91 *
92 * @var string
93 */
94 public $name;
95 /**
96 * Name of Group.
97 *
98 * @var string
99 */
100 public $title;
101 /**
102 * Optional verbose description of the group.
103 *
104 * @var text
105 */
106 public $description;
107 /**
108 * Module or process which created this group.
109 *
110 * @var string
111 */
112 public $source;
113 /**
114 * FK to saved search table.
115 *
116 * @var int unsigned
117 */
118 public $saved_search_id;
119 /**
120 * Is this entry active?
121 *
122 * @var boolean
123 */
124 public $is_active;
125 /**
126 * In what context(s) is this field visible.
127 *
128 * @var string
129 */
130 public $visibility;
131 /**
132 * the sql where clause if a saved search acl
133 *
134 * @var text
135 */
136 public $where_clause;
137 /**
138 * the tables to be included in a select data
139 *
140 * @var text
141 */
142 public $select_tables;
143 /**
144 * the tables to be included in the count statement
145 *
146 * @var text
147 */
148 public $where_tables;
149 /**
150 * FK to group type
151 *
152 * @var string
153 */
154 public $group_type;
155 /**
156 * Date when we created the cache for a smart group
157 *
158 * @var timestamp
159 */
160 public $cache_date;
161 /**
162 * Date and time when we need to refresh the cache next.
163 *
164 * @var timestamp
165 */
166 public $refresh_date;
167 /**
168 * IDs of the parent(s)
169 *
170 * @var text
171 */
172 public $parents;
173 /**
174 * IDs of the child(ren)
175 *
176 * @var text
177 */
178 public $children;
179 /**
180 * Is this group hidden?
181 *
182 * @var boolean
183 */
184 public $is_hidden;
185 /**
186 *
187 * @var boolean
188 */
189 public $is_reserved;
190 /**
191 * FK to contact table.
192 *
193 * @var int unsigned
194 */
195 public $created_id;
196 /**
197 * FK to contact table.
198 *
199 * @var int unsigned
200 */
201 public $modified_id;
202 /**
203 * class constructor
204 *
205 * @return civicrm_group
206 */
207 function __construct() {
208 $this->__table = 'civicrm_group';
209 parent::__construct();
210 }
211 /**
212 * Returns foreign keys and entity references
213 *
214 * @return array
215 * [CRM_Core_Reference_Interface]
216 */
217 static function getReferenceColumns() {
218 if (!self::$_links) {
219 self::$_links = static ::createReferenceColumns(__CLASS__);
220 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'saved_search_id', 'civicrm_saved_search', 'id');
221 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
222 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id');
223 }
224 return self::$_links;
225 }
226 /**
227 * Returns all the column names of this table
228 *
229 * @return array
230 */
231 static function &fields() {
232 if (!(self::$_fields)) {
233 self::$_fields = array(
234 'id' => array(
235 'name' => 'id',
236 'type' => CRM_Utils_Type::T_INT,
237 'title' => ts('Group ID') ,
238 'description' => 'Group ID',
239 'required' => true,
240 ) ,
241 'name' => array(
242 'name' => 'name',
243 'type' => CRM_Utils_Type::T_STRING,
244 'title' => ts('Group Name') ,
245 'description' => 'Internal name of Group.',
246 'maxlength' => 64,
247 'size' => CRM_Utils_Type::BIG,
248 ) ,
249 'title' => array(
250 'name' => 'title',
251 'type' => CRM_Utils_Type::T_STRING,
252 'title' => ts('Group Title') ,
253 'description' => 'Name of Group.',
254 'maxlength' => 64,
255 'size' => CRM_Utils_Type::BIG,
256 ) ,
257 'description' => array(
258 'name' => 'description',
259 'type' => CRM_Utils_Type::T_TEXT,
260 'title' => ts('Group Description') ,
261 'description' => 'Optional verbose description of the group.',
262 'rows' => 2,
263 'cols' => 60,
264 'html' => array(
265 'type' => 'TextArea',
266 ) ,
267 ) ,
268 'source' => array(
269 'name' => 'source',
270 'type' => CRM_Utils_Type::T_STRING,
271 'title' => ts('Group Source') ,
272 'description' => 'Module or process which created this group.',
273 'maxlength' => 64,
274 'size' => CRM_Utils_Type::BIG,
275 ) ,
276 'saved_search_id' => array(
277 'name' => 'saved_search_id',
278 'type' => CRM_Utils_Type::T_INT,
279 'title' => ts('Saved Search ID') ,
280 'description' => 'FK to saved search table.',
281 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
282 ) ,
283 'is_active' => array(
284 'name' => 'is_active',
285 'type' => CRM_Utils_Type::T_BOOLEAN,
286 'title' => ts('Group Enabled') ,
287 'description' => 'Is this entry active?',
288 ) ,
289 'visibility' => array(
290 'name' => 'visibility',
291 'type' => CRM_Utils_Type::T_STRING,
292 'title' => ts('Group Visibility Setting') ,
293 'description' => 'In what context(s) is this field visible.',
294 'maxlength' => 24,
295 'size' => CRM_Utils_Type::MEDIUM,
296 'default' => 'User and User Admin Only',
297 'html' => array(
298 'type' => 'Select',
299 ) ,
300 'pseudoconstant' => array(
301 'callback' => 'CRM_Core_SelectValues::groupVisibility',
302 )
303 ) ,
304 'where_clause' => array(
305 'name' => 'where_clause',
306 'type' => CRM_Utils_Type::T_TEXT,
307 'title' => ts('Group Where Clause') ,
308 'description' => 'the sql where clause if a saved search acl',
309 ) ,
310 'select_tables' => array(
311 'name' => 'select_tables',
312 'type' => CRM_Utils_Type::T_TEXT,
313 'title' => ts('Tables For Select Clause') ,
314 'description' => 'the tables to be included in a select data',
315 ) ,
316 'where_tables' => array(
317 'name' => 'where_tables',
318 'type' => CRM_Utils_Type::T_TEXT,
319 'title' => ts('Tables For Where Clause') ,
320 'description' => 'the tables to be included in the count statement',
321 ) ,
322 'group_type' => array(
323 'name' => 'group_type',
324 'type' => CRM_Utils_Type::T_STRING,
325 'title' => ts('Group Type') ,
326 'description' => 'FK to group type',
327 'maxlength' => 128,
328 'size' => CRM_Utils_Type::HUGE,
329 'pseudoconstant' => array(
330 'optionGroupName' => 'group_type',
331 'optionEditPath' => 'civicrm/admin/options/group_type',
332 )
333 ) ,
334 'cache_date' => array(
335 'name' => 'cache_date',
336 'type' => CRM_Utils_Type::T_TIMESTAMP,
337 'title' => ts('Group Cache Date') ,
338 'description' => 'Date when we created the cache for a smart group',
339 'required' => false,
340 ) ,
341 'refresh_date' => array(
342 'name' => 'refresh_date',
343 'type' => CRM_Utils_Type::T_TIMESTAMP,
344 'title' => ts('Next Group Refresh Time') ,
345 'description' => 'Date and time when we need to refresh the cache next.',
346 'required' => false,
347 ) ,
348 'parents' => array(
349 'name' => 'parents',
350 'type' => CRM_Utils_Type::T_TEXT,
351 'title' => ts('Group Parents') ,
352 'description' => 'IDs of the parent(s)',
353 ) ,
354 'children' => array(
355 'name' => 'children',
356 'type' => CRM_Utils_Type::T_TEXT,
357 'title' => ts('Group Children') ,
358 'description' => 'IDs of the child(ren)',
359 ) ,
360 'is_hidden' => array(
361 'name' => 'is_hidden',
362 'type' => CRM_Utils_Type::T_BOOLEAN,
363 'title' => ts('Group is Hidden') ,
364 'description' => 'Is this group hidden?',
365 ) ,
366 'is_reserved' => array(
367 'name' => 'is_reserved',
368 'type' => CRM_Utils_Type::T_BOOLEAN,
369 'title' => ts('Group is Reserved') ,
370 ) ,
371 'created_id' => array(
372 'name' => 'created_id',
373 'type' => CRM_Utils_Type::T_INT,
374 'title' => ts('Group Created By') ,
375 'description' => 'FK to contact table.',
376 'FKClassName' => 'CRM_Contact_DAO_Contact',
377 ) ,
378 'modified_id' => array(
379 'name' => 'modified_id',
380 'type' => CRM_Utils_Type::T_INT,
381 'title' => ts('Group Modified By') ,
382 'description' => 'FK to contact table.',
383 'FKClassName' => 'CRM_Contact_DAO_Contact',
384 ) ,
385 );
386 }
387 return self::$_fields;
388 }
389 /**
390 * Returns an array containing, for each field, the arary key used for that
391 * field in self::$_fields.
392 *
393 * @return array
394 */
395 static function &fieldKeys() {
396 if (!(self::$_fieldKeys)) {
397 self::$_fieldKeys = array(
398 'id' => 'id',
399 'name' => 'name',
400 'title' => 'title',
401 'description' => 'description',
402 'source' => 'source',
403 'saved_search_id' => 'saved_search_id',
404 'is_active' => 'is_active',
405 'visibility' => 'visibility',
406 'where_clause' => 'where_clause',
407 'select_tables' => 'select_tables',
408 'where_tables' => 'where_tables',
409 'group_type' => 'group_type',
410 'cache_date' => 'cache_date',
411 'refresh_date' => 'refresh_date',
412 'parents' => 'parents',
413 'children' => 'children',
414 'is_hidden' => 'is_hidden',
415 'is_reserved' => 'is_reserved',
416 'created_id' => 'created_id',
417 'modified_id' => 'modified_id',
418 );
419 }
420 return self::$_fieldKeys;
421 }
422 /**
423 * Returns the names of this table
424 *
425 * @return string
426 */
427 static function getTableName() {
428 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
429 }
430 /**
431 * Returns if this table needs to be logged
432 *
433 * @return boolean
434 */
435 function getLog() {
436 return self::$_log;
437 }
438 /**
439 * Returns the list of fields that can be imported
440 *
441 * @param bool $prefix
442 *
443 * @return array
444 */
445 static function &import($prefix = false) {
446 if (!(self::$_import)) {
447 self::$_import = array();
448 $fields = self::fields();
449 foreach($fields as $name => $field) {
450 if (CRM_Utils_Array::value('import', $field)) {
451 if ($prefix) {
452 self::$_import['group'] = & $fields[$name];
453 } else {
454 self::$_import[$name] = & $fields[$name];
455 }
456 }
457 }
458 }
459 return self::$_import;
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 if (!(self::$_export)) {
470 self::$_export = array();
471 $fields = self::fields();
472 foreach($fields as $name => $field) {
473 if (CRM_Utils_Array::value('export', $field)) {
474 if ($prefix) {
475 self::$_export['group'] = & $fields[$name];
476 } else {
477 self::$_export[$name] = & $fields[$name];
478 }
479 }
480 }
481 }
482 return self::$_export;
483 }
484}