dev/translation#58 - Partially revert schema for civicrm_group.title
[civicrm-core.git] / CRM / Contact / DAO / Group.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contact/Group.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cab0c1d345870ec17420e9100fe2518f)
10 */
11
12 /**
13 * Database access object for the Group entity.
14 */
15 class CRM_Contact_DAO_Group extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_group';
25
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-users';
32
33 /**
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
35 *
36 * @var bool
37 */
38 public static $_log = TRUE;
39
40 /**
41 * Group ID
42 *
43 * @var int
44 */
45 public $id;
46
47 /**
48 * Internal name of Group.
49 *
50 * @var string
51 */
52 public $name;
53
54 /**
55 * Name of Group.
56 *
57 * @var string
58 */
59 public $title;
60
61 /**
62 * Optional verbose description of the group.
63 *
64 * @var text
65 */
66 public $description;
67
68 /**
69 * Module or process which created this group.
70 *
71 * @var string
72 */
73 public $source;
74
75 /**
76 * FK to saved search table.
77 *
78 * @var int
79 */
80 public $saved_search_id;
81
82 /**
83 * Is this entry active?
84 *
85 * @var bool
86 */
87 public $is_active;
88
89 /**
90 * In what context(s) is this field visible.
91 *
92 * @var string
93 */
94 public $visibility;
95
96 /**
97 * the sql where clause if a saved search acl
98 *
99 * @var text
100 */
101 public $where_clause;
102
103 /**
104 * the tables to be included in a select data
105 *
106 * @var text
107 */
108 public $select_tables;
109
110 /**
111 * the tables to be included in the count statement
112 *
113 * @var text
114 */
115 public $where_tables;
116
117 /**
118 * FK to group type
119 *
120 * @var string
121 */
122 public $group_type;
123
124 /**
125 * Date when we created the cache for a smart group
126 *
127 * @var timestamp
128 */
129 public $cache_date;
130
131 /**
132 * Date and time when we need to refresh the cache next.
133 *
134 * @var timestamp
135 */
136 public $refresh_date;
137
138 /**
139 * IDs of the parent(s)
140 *
141 * @var text
142 */
143 public $parents;
144
145 /**
146 * IDs of the child(ren)
147 *
148 * @var text
149 */
150 public $children;
151
152 /**
153 * Is this group hidden?
154 *
155 * @var bool
156 */
157 public $is_hidden;
158
159 /**
160 * @var bool
161 */
162 public $is_reserved;
163
164 /**
165 * FK to contact table.
166 *
167 * @var int
168 */
169 public $created_id;
170
171 /**
172 * FK to contact table.
173 *
174 * @var int
175 */
176 public $modified_id;
177
178 /**
179 * Alternative public title for this Group.
180 *
181 * @var string
182 */
183 public $frontend_title;
184
185 /**
186 * Alternative public description of the group.
187 *
188 * @var text
189 */
190 public $frontend_description;
191
192 /**
193 * Class constructor.
194 */
195 public function __construct() {
196 $this->__table = 'civicrm_group';
197 parent::__construct();
198 }
199
200 /**
201 * Returns localized title of this entity.
202 *
203 * @param bool $plural
204 * Whether to return the plural version of the title.
205 */
206 public static function getEntityTitle($plural = FALSE) {
207 return $plural ? ts('Groups') : ts('Group');
208 }
209
210 /**
211 * Returns foreign keys and entity references.
212 *
213 * @return array
214 * [CRM_Core_Reference_Interface]
215 */
216 public static function getReferenceColumns() {
217 if (!isset(Civi::$statics[__CLASS__]['links'])) {
218 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
219 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
220 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
221 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id');
222 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
223 }
224 return Civi::$statics[__CLASS__]['links'];
225 }
226
227 /**
228 * Returns all the column names of this table
229 *
230 * @return array
231 */
232 public static function &fields() {
233 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
234 Civi::$statics[__CLASS__]['fields'] = [
235 'id' => [
236 'name' => 'id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Group ID'),
239 'description' => ts('Group ID'),
240 'required' => TRUE,
241 'where' => 'civicrm_group.id',
242 'table_name' => 'civicrm_group',
243 'entity' => 'Group',
244 'bao' => 'CRM_Contact_BAO_Group',
245 'localizable' => 0,
246 'add' => '1.1',
247 ],
248 'name' => [
249 'name' => 'name',
250 'type' => CRM_Utils_Type::T_STRING,
251 'title' => ts('Group Name'),
252 'description' => ts('Internal name of Group.'),
253 'maxlength' => 64,
254 'size' => CRM_Utils_Type::BIG,
255 'where' => 'civicrm_group.name',
256 'table_name' => 'civicrm_group',
257 'entity' => 'Group',
258 'bao' => 'CRM_Contact_BAO_Group',
259 'localizable' => 0,
260 'add' => '1.1',
261 ],
262 'title' => [
263 'name' => 'title',
264 'type' => CRM_Utils_Type::T_STRING,
265 'title' => ts('Group Title'),
266 'description' => ts('Name of Group.'),
267 'maxlength' => 255,
268 'size' => CRM_Utils_Type::HUGE,
269 'where' => 'civicrm_group.title',
270 'table_name' => 'civicrm_group',
271 'entity' => 'Group',
272 'bao' => 'CRM_Contact_BAO_Group',
273 'localizable' => 1,
274 'html' => [
275 'type' => 'Text',
276 ],
277 'add' => '1.1',
278 ],
279 'description' => [
280 'name' => 'description',
281 'type' => CRM_Utils_Type::T_TEXT,
282 'title' => ts('Group Description'),
283 'description' => ts('Optional verbose description of the group.'),
284 'rows' => 2,
285 'cols' => 60,
286 'where' => 'civicrm_group.description',
287 'table_name' => 'civicrm_group',
288 'entity' => 'Group',
289 'bao' => 'CRM_Contact_BAO_Group',
290 'localizable' => 0,
291 'html' => [
292 'type' => 'TextArea',
293 ],
294 'add' => '1.1',
295 ],
296 'source' => [
297 'name' => 'source',
298 'type' => CRM_Utils_Type::T_STRING,
299 'title' => ts('Group Source'),
300 'description' => ts('Module or process which created this group.'),
301 'maxlength' => 64,
302 'size' => CRM_Utils_Type::BIG,
303 'where' => 'civicrm_group.source',
304 'table_name' => 'civicrm_group',
305 'entity' => 'Group',
306 'bao' => 'CRM_Contact_BAO_Group',
307 'localizable' => 0,
308 'add' => '1.1',
309 ],
310 'saved_search_id' => [
311 'name' => 'saved_search_id',
312 'type' => CRM_Utils_Type::T_INT,
313 'title' => ts('Saved Search ID'),
314 'description' => ts('FK to saved search table.'),
315 'where' => 'civicrm_group.saved_search_id',
316 'table_name' => 'civicrm_group',
317 'entity' => 'Group',
318 'bao' => 'CRM_Contact_BAO_Group',
319 'localizable' => 0,
320 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
321 'add' => '1.1',
322 ],
323 'is_active' => [
324 'name' => 'is_active',
325 'type' => CRM_Utils_Type::T_BOOLEAN,
326 'title' => ts('Group Enabled'),
327 'description' => ts('Is this entry active?'),
328 'where' => 'civicrm_group.is_active',
329 'table_name' => 'civicrm_group',
330 'entity' => 'Group',
331 'bao' => 'CRM_Contact_BAO_Group',
332 'localizable' => 0,
333 'add' => '1.1',
334 ],
335 'visibility' => [
336 'name' => 'visibility',
337 'type' => CRM_Utils_Type::T_STRING,
338 'title' => ts('Group Visibility Setting'),
339 'description' => ts('In what context(s) is this field visible.'),
340 'maxlength' => 24,
341 'size' => CRM_Utils_Type::MEDIUM,
342 'where' => 'civicrm_group.visibility',
343 'default' => 'User and User Admin Only',
344 'table_name' => 'civicrm_group',
345 'entity' => 'Group',
346 'bao' => 'CRM_Contact_BAO_Group',
347 'localizable' => 0,
348 'html' => [
349 'type' => 'Select',
350 ],
351 'pseudoconstant' => [
352 'callback' => 'CRM_Core_SelectValues::groupVisibility',
353 ],
354 'add' => '1.2',
355 ],
356 'where_clause' => [
357 'name' => 'where_clause',
358 'type' => CRM_Utils_Type::T_TEXT,
359 'title' => ts('Group Where Clause'),
360 'description' => ts('the sql where clause if a saved search acl'),
361 'where' => 'civicrm_group.where_clause',
362 'table_name' => 'civicrm_group',
363 'entity' => 'Group',
364 'bao' => 'CRM_Contact_BAO_Group',
365 'localizable' => 0,
366 'add' => '1.6',
367 ],
368 'select_tables' => [
369 'name' => 'select_tables',
370 'type' => CRM_Utils_Type::T_TEXT,
371 'title' => ts('Tables For Select Clause'),
372 'description' => ts('the tables to be included in a select data'),
373 'where' => 'civicrm_group.select_tables',
374 'table_name' => 'civicrm_group',
375 'entity' => 'Group',
376 'bao' => 'CRM_Contact_BAO_Group',
377 'localizable' => 0,
378 'serialize' => self::SERIALIZE_PHP,
379 'add' => '1.6',
380 ],
381 'where_tables' => [
382 'name' => 'where_tables',
383 'type' => CRM_Utils_Type::T_TEXT,
384 'title' => ts('Tables For Where Clause'),
385 'description' => ts('the tables to be included in the count statement'),
386 'where' => 'civicrm_group.where_tables',
387 'table_name' => 'civicrm_group',
388 'entity' => 'Group',
389 'bao' => 'CRM_Contact_BAO_Group',
390 'localizable' => 0,
391 'serialize' => self::SERIALIZE_PHP,
392 'add' => '1.6',
393 ],
394 'group_type' => [
395 'name' => 'group_type',
396 'type' => CRM_Utils_Type::T_STRING,
397 'title' => ts('Group Type'),
398 'description' => ts('FK to group type'),
399 'maxlength' => 128,
400 'size' => CRM_Utils_Type::HUGE,
401 'where' => 'civicrm_group.group_type',
402 'table_name' => 'civicrm_group',
403 'entity' => 'Group',
404 'bao' => 'CRM_Contact_BAO_Group',
405 'localizable' => 0,
406 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
407 'pseudoconstant' => [
408 'optionGroupName' => 'group_type',
409 'optionEditPath' => 'civicrm/admin/options/group_type',
410 ],
411 'add' => '1.9',
412 ],
413 'cache_date' => [
414 'name' => 'cache_date',
415 'type' => CRM_Utils_Type::T_TIMESTAMP,
416 'title' => ts('Group Cache Date'),
417 'description' => ts('Date when we created the cache for a smart group'),
418 'required' => FALSE,
419 'where' => 'civicrm_group.cache_date',
420 'table_name' => 'civicrm_group',
421 'entity' => 'Group',
422 'bao' => 'CRM_Contact_BAO_Group',
423 'localizable' => 0,
424 'add' => '2.1',
425 ],
426 'refresh_date' => [
427 'name' => 'refresh_date',
428 'type' => CRM_Utils_Type::T_TIMESTAMP,
429 'title' => ts('Next Group Refresh Time'),
430 'description' => ts('Date and time when we need to refresh the cache next.'),
431 'required' => FALSE,
432 'where' => 'civicrm_group.refresh_date',
433 'table_name' => 'civicrm_group',
434 'entity' => 'Group',
435 'bao' => 'CRM_Contact_BAO_Group',
436 'localizable' => 0,
437 'add' => '4.3',
438 ],
439 'parents' => [
440 'name' => 'parents',
441 'type' => CRM_Utils_Type::T_TEXT,
442 'title' => ts('Group Parents'),
443 'description' => ts('IDs of the parent(s)'),
444 'where' => 'civicrm_group.parents',
445 'table_name' => 'civicrm_group',
446 'entity' => 'Group',
447 'bao' => 'CRM_Contact_BAO_Group',
448 'localizable' => 0,
449 'serialize' => self::SERIALIZE_COMMA,
450 'pseudoconstant' => [
451 'callback' => 'CRM_Core_PseudoConstant::allGroup',
452 ],
453 'add' => '2.1',
454 ],
455 'children' => [
456 'name' => 'children',
457 'type' => CRM_Utils_Type::T_TEXT,
458 'title' => ts('Group Children'),
459 'description' => ts('IDs of the child(ren)'),
460 'where' => 'civicrm_group.children',
461 'table_name' => 'civicrm_group',
462 'entity' => 'Group',
463 'bao' => 'CRM_Contact_BAO_Group',
464 'localizable' => 0,
465 'add' => '2.1',
466 ],
467 'is_hidden' => [
468 'name' => 'is_hidden',
469 'type' => CRM_Utils_Type::T_BOOLEAN,
470 'title' => ts('Group is Hidden'),
471 'description' => ts('Is this group hidden?'),
472 'where' => 'civicrm_group.is_hidden',
473 'default' => '0',
474 'table_name' => 'civicrm_group',
475 'entity' => 'Group',
476 'bao' => 'CRM_Contact_BAO_Group',
477 'localizable' => 0,
478 'add' => '2.2',
479 ],
480 'is_reserved' => [
481 'name' => 'is_reserved',
482 'type' => CRM_Utils_Type::T_BOOLEAN,
483 'title' => ts('Group is Reserved'),
484 'where' => 'civicrm_group.is_reserved',
485 'default' => '0',
486 'table_name' => 'civicrm_group',
487 'entity' => 'Group',
488 'bao' => 'CRM_Contact_BAO_Group',
489 'localizable' => 0,
490 'add' => '4.2',
491 ],
492 'created_id' => [
493 'name' => 'created_id',
494 'type' => CRM_Utils_Type::T_INT,
495 'title' => ts('Group Created By'),
496 'description' => ts('FK to contact table.'),
497 'where' => 'civicrm_group.created_id',
498 'table_name' => 'civicrm_group',
499 'entity' => 'Group',
500 'bao' => 'CRM_Contact_BAO_Group',
501 'localizable' => 0,
502 'FKClassName' => 'CRM_Contact_DAO_Contact',
503 'add' => '4.3',
504 ],
505 'modified_id' => [
506 'name' => 'modified_id',
507 'type' => CRM_Utils_Type::T_INT,
508 'title' => ts('Group Modified By'),
509 'description' => ts('FK to contact table.'),
510 'where' => 'civicrm_group.modified_id',
511 'table_name' => 'civicrm_group',
512 'entity' => 'Group',
513 'bao' => 'CRM_Contact_BAO_Group',
514 'localizable' => 0,
515 'FKClassName' => 'CRM_Contact_DAO_Contact',
516 'add' => '4.5',
517 ],
518 'frontend_title' => [
519 'name' => 'frontend_title',
520 'type' => CRM_Utils_Type::T_STRING,
521 'title' => ts('Public Group Title'),
522 'description' => ts('Alternative public title for this Group.'),
523 'maxlength' => 255,
524 'size' => CRM_Utils_Type::HUGE,
525 'where' => 'civicrm_group.frontend_title',
526 'default' => 'NULL',
527 'table_name' => 'civicrm_group',
528 'entity' => 'Group',
529 'bao' => 'CRM_Contact_BAO_Group',
530 'localizable' => 1,
531 'html' => [
532 'type' => 'Text',
533 ],
534 'add' => '5.31',
535 ],
536 'frontend_description' => [
537 'name' => 'frontend_description',
538 'type' => CRM_Utils_Type::T_TEXT,
539 'title' => ts('Public Group Description'),
540 'description' => ts('Alternative public description of the group.'),
541 'rows' => 2,
542 'cols' => 60,
543 'where' => 'civicrm_group.frontend_description',
544 'default' => 'NULL',
545 'table_name' => 'civicrm_group',
546 'entity' => 'Group',
547 'bao' => 'CRM_Contact_BAO_Group',
548 'localizable' => 1,
549 'html' => [
550 'type' => 'TextArea',
551 ],
552 'add' => '5.31',
553 ],
554 ];
555 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
556 }
557 return Civi::$statics[__CLASS__]['fields'];
558 }
559
560 /**
561 * Return a mapping from field-name to the corresponding key (as used in fields()).
562 *
563 * @return array
564 * Array(string $name => string $uniqueName).
565 */
566 public static function &fieldKeys() {
567 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
568 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
569 }
570 return Civi::$statics[__CLASS__]['fieldKeys'];
571 }
572
573 /**
574 * Returns the names of this table
575 *
576 * @return string
577 */
578 public static function getTableName() {
579 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
580 }
581
582 /**
583 * Returns if this table needs to be logged
584 *
585 * @return bool
586 */
587 public function getLog() {
588 return self::$_log;
589 }
590
591 /**
592 * Returns the list of fields that can be imported
593 *
594 * @param bool $prefix
595 *
596 * @return array
597 */
598 public static function &import($prefix = FALSE) {
599 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group', $prefix, []);
600 return $r;
601 }
602
603 /**
604 * Returns the list of fields that can be exported
605 *
606 * @param bool $prefix
607 *
608 * @return array
609 */
610 public static function &export($prefix = FALSE) {
611 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group', $prefix, []);
612 return $r;
613 }
614
615 /**
616 * Returns the list of indices
617 *
618 * @param bool $localize
619 *
620 * @return array
621 */
622 public static function indices($localize = TRUE) {
623 $indices = [
624 'index_group_type' => [
625 'name' => 'index_group_type',
626 'field' => [
627 0 => 'group_type',
628 ],
629 'localizable' => FALSE,
630 'sig' => 'civicrm_group::0::group_type',
631 ],
632 'UI_title' => [
633 'name' => 'UI_title',
634 'field' => [
635 0 => 'title',
636 ],
637 'localizable' => TRUE,
638 'unique' => TRUE,
639 'sig' => 'civicrm_group::1::title',
640 ],
641 'UI_name' => [
642 'name' => 'UI_name',
643 'field' => [
644 0 => 'name',
645 ],
646 'localizable' => FALSE,
647 'unique' => TRUE,
648 'sig' => 'civicrm_group::1::name',
649 ],
650 ];
651 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
652 }
653
654 }