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