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