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 | |
d31fb4e3 | 9 | * (GenCodeChecksum:3648ad60c504d25253ecc5655c629d72) |
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 = [ | |
5c385299 | 46 | 'add' => 'civicrm/group/add?reset=1', |
a7bd99ff CW |
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 | 'maxlength' => 255, |
277 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 278 | 'where' => 'civicrm_group.title', |
522a26c9 | 279 | 'table_name' => 'civicrm_group', |
280 | 'entity' => 'Group', | |
281 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 282 | 'localizable' => 1, |
7da21f11 | 283 | 'html' => [ |
284 | 'type' => 'Text', | |
285 | ], | |
a9d0587b | 286 | 'add' => '1.1', |
c3fc2621 CW |
287 | ], |
288 | 'description' => [ | |
e501603b TO |
289 | 'name' => 'description', |
290 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 291 | 'title' => ts('Group Description'), |
215b423e | 292 | 'description' => ts('Optional verbose description of the group.'), |
e501603b TO |
293 | 'rows' => 2, |
294 | 'cols' => 60, | |
a36434b9 | 295 | 'where' => 'civicrm_group.description', |
522a26c9 | 296 | 'table_name' => 'civicrm_group', |
297 | 'entity' => 'Group', | |
298 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 299 | 'localizable' => 0, |
c3fc2621 | 300 | 'html' => [ |
e501603b | 301 | 'type' => 'TextArea', |
c3fc2621 | 302 | ], |
a9d0587b | 303 | 'add' => '1.1', |
c3fc2621 CW |
304 | ], |
305 | 'source' => [ | |
e501603b TO |
306 | 'name' => 'source', |
307 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 308 | 'title' => ts('Group Source'), |
215b423e | 309 | 'description' => ts('Module or process which created this group.'), |
e501603b TO |
310 | 'maxlength' => 64, |
311 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 312 | 'where' => 'civicrm_group.source', |
522a26c9 | 313 | 'table_name' => 'civicrm_group', |
314 | 'entity' => 'Group', | |
315 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 316 | 'localizable' => 0, |
a9d0587b | 317 | 'add' => '1.1', |
c3fc2621 CW |
318 | ], |
319 | 'saved_search_id' => [ | |
e501603b TO |
320 | 'name' => 'saved_search_id', |
321 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 322 | 'title' => ts('Saved Search ID'), |
215b423e | 323 | 'description' => ts('FK to saved search table.'), |
a36434b9 | 324 | 'where' => 'civicrm_group.saved_search_id', |
522a26c9 | 325 | 'table_name' => 'civicrm_group', |
326 | 'entity' => 'Group', | |
327 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 328 | 'localizable' => 0, |
e501603b | 329 | 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', |
a9d0587b | 330 | 'add' => '1.1', |
c3fc2621 CW |
331 | ], |
332 | 'is_active' => [ | |
e501603b TO |
333 | 'name' => 'is_active', |
334 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 335 | 'title' => ts('Group Enabled'), |
215b423e | 336 | 'description' => ts('Is this entry active?'), |
a36434b9 | 337 | 'where' => 'civicrm_group.is_active', |
522a26c9 | 338 | 'table_name' => 'civicrm_group', |
339 | 'entity' => 'Group', | |
340 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 341 | 'localizable' => 0, |
a9d0587b | 342 | 'add' => '1.1', |
c3fc2621 CW |
343 | ], |
344 | 'visibility' => [ | |
e501603b TO |
345 | 'name' => 'visibility', |
346 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 347 | 'title' => ts('Group Visibility Setting'), |
215b423e | 348 | 'description' => ts('In what context(s) is this field visible.'), |
e501603b TO |
349 | 'maxlength' => 24, |
350 | 'size' => CRM_Utils_Type::MEDIUM, | |
a36434b9 | 351 | 'where' => 'civicrm_group.visibility', |
e501603b | 352 | 'default' => 'User and User Admin Only', |
522a26c9 | 353 | 'table_name' => 'civicrm_group', |
354 | 'entity' => 'Group', | |
355 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 356 | 'localizable' => 0, |
c3fc2621 | 357 | 'html' => [ |
e501603b | 358 | 'type' => 'Select', |
c3fc2621 CW |
359 | ], |
360 | 'pseudoconstant' => [ | |
e501603b | 361 | 'callback' => 'CRM_Core_SelectValues::groupVisibility', |
e6ca0a57 | 362 | ], |
a9d0587b | 363 | 'add' => '1.2', |
c3fc2621 CW |
364 | ], |
365 | 'where_clause' => [ | |
e501603b TO |
366 | 'name' => 'where_clause', |
367 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 368 | 'title' => ts('Group Where Clause'), |
215b423e | 369 | 'description' => ts('the sql where clause if a saved search acl'), |
a36434b9 | 370 | 'where' => 'civicrm_group.where_clause', |
522a26c9 | 371 | 'table_name' => 'civicrm_group', |
372 | 'entity' => 'Group', | |
373 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 374 | 'localizable' => 0, |
a9d0587b | 375 | 'add' => '1.6', |
c3fc2621 CW |
376 | ], |
377 | 'select_tables' => [ | |
e501603b TO |
378 | 'name' => 'select_tables', |
379 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 380 | 'title' => ts('Tables For Select Clause'), |
215b423e | 381 | 'description' => ts('the tables to be included in a select data'), |
a36434b9 | 382 | 'where' => 'civicrm_group.select_tables', |
522a26c9 | 383 | 'table_name' => 'civicrm_group', |
384 | 'entity' => 'Group', | |
385 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 386 | 'localizable' => 0, |
2a5c9b4d | 387 | 'serialize' => self::SERIALIZE_PHP, |
a9d0587b | 388 | 'add' => '1.6', |
c3fc2621 CW |
389 | ], |
390 | 'where_tables' => [ | |
e501603b TO |
391 | 'name' => 'where_tables', |
392 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 393 | 'title' => ts('Tables For Where Clause'), |
215b423e | 394 | 'description' => ts('the tables to be included in the count statement'), |
a36434b9 | 395 | 'where' => 'civicrm_group.where_tables', |
522a26c9 | 396 | 'table_name' => 'civicrm_group', |
397 | 'entity' => 'Group', | |
398 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 399 | 'localizable' => 0, |
2a5c9b4d | 400 | 'serialize' => self::SERIALIZE_PHP, |
a9d0587b | 401 | 'add' => '1.6', |
c3fc2621 CW |
402 | ], |
403 | 'group_type' => [ | |
e501603b TO |
404 | 'name' => 'group_type', |
405 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 406 | 'title' => ts('Group Type'), |
215b423e | 407 | 'description' => ts('FK to group type'), |
e501603b TO |
408 | 'maxlength' => 128, |
409 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 410 | 'where' => 'civicrm_group.group_type', |
522a26c9 | 411 | 'table_name' => 'civicrm_group', |
412 | 'entity' => 'Group', | |
413 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 414 | 'localizable' => 0, |
2a5c9b4d | 415 | 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND, |
c3fc2621 | 416 | 'pseudoconstant' => [ |
e501603b TO |
417 | 'optionGroupName' => 'group_type', |
418 | 'optionEditPath' => 'civicrm/admin/options/group_type', | |
e6ca0a57 | 419 | ], |
a9d0587b | 420 | 'add' => '1.9', |
c3fc2621 CW |
421 | ], |
422 | 'cache_date' => [ | |
e501603b TO |
423 | 'name' => 'cache_date', |
424 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 425 | 'title' => ts('Group Cache Date'), |
215b423e | 426 | 'description' => ts('Date when we created the cache for a smart group'), |
c3fc2621 | 427 | 'required' => FALSE, |
a36434b9 | 428 | 'where' => 'civicrm_group.cache_date', |
522a26c9 | 429 | 'table_name' => 'civicrm_group', |
430 | 'entity' => 'Group', | |
431 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 432 | 'localizable' => 0, |
a9d0587b | 433 | 'add' => '2.1', |
c3fc2621 CW |
434 | ], |
435 | 'refresh_date' => [ | |
e501603b TO |
436 | 'name' => 'refresh_date', |
437 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 438 | 'title' => ts('Next Group Refresh Time'), |
215b423e | 439 | 'description' => ts('Date and time when we need to refresh the cache next.'), |
c3fc2621 | 440 | 'required' => FALSE, |
a36434b9 | 441 | 'where' => 'civicrm_group.refresh_date', |
522a26c9 | 442 | 'table_name' => 'civicrm_group', |
443 | 'entity' => 'Group', | |
444 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 445 | 'localizable' => 0, |
a9d0587b | 446 | 'add' => '4.3', |
c3fc2621 CW |
447 | ], |
448 | 'parents' => [ | |
e501603b TO |
449 | 'name' => 'parents', |
450 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 451 | 'title' => ts('Group Parents'), |
215b423e | 452 | 'description' => ts('IDs of the parent(s)'), |
a36434b9 | 453 | 'where' => 'civicrm_group.parents', |
522a26c9 | 454 | 'table_name' => 'civicrm_group', |
455 | 'entity' => 'Group', | |
456 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 457 | 'localizable' => 0, |
30208fab | 458 | 'serialize' => self::SERIALIZE_COMMA, |
1678a63b | 459 | 'pseudoconstant' => [ |
460 | 'callback' => 'CRM_Core_PseudoConstant::allGroup', | |
e6ca0a57 | 461 | ], |
a9d0587b | 462 | 'add' => '2.1', |
c3fc2621 CW |
463 | ], |
464 | 'children' => [ | |
e501603b TO |
465 | 'name' => 'children', |
466 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 467 | 'title' => ts('Group Children'), |
215b423e | 468 | 'description' => ts('IDs of the child(ren)'), |
a36434b9 | 469 | 'where' => 'civicrm_group.children', |
522a26c9 | 470 | 'table_name' => 'civicrm_group', |
471 | 'entity' => 'Group', | |
472 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 473 | 'localizable' => 0, |
a9d0587b | 474 | 'add' => '2.1', |
c3fc2621 CW |
475 | ], |
476 | 'is_hidden' => [ | |
e501603b TO |
477 | 'name' => 'is_hidden', |
478 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 479 | 'title' => ts('Group is Hidden'), |
215b423e | 480 | 'description' => ts('Is this group hidden?'), |
a36434b9 | 481 | 'where' => 'civicrm_group.is_hidden', |
45a83e42 | 482 | 'default' => '0', |
522a26c9 | 483 | 'table_name' => 'civicrm_group', |
484 | 'entity' => 'Group', | |
485 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 486 | 'localizable' => 0, |
a9d0587b | 487 | 'add' => '2.2', |
c3fc2621 CW |
488 | ], |
489 | 'is_reserved' => [ | |
e501603b TO |
490 | 'name' => 'is_reserved', |
491 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 492 | 'title' => ts('Group is Reserved'), |
a36434b9 | 493 | 'where' => 'civicrm_group.is_reserved', |
45a83e42 | 494 | 'default' => '0', |
522a26c9 | 495 | 'table_name' => 'civicrm_group', |
496 | 'entity' => 'Group', | |
497 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 498 | 'localizable' => 0, |
a9d0587b | 499 | 'add' => '4.2', |
c3fc2621 CW |
500 | ], |
501 | 'created_id' => [ | |
e501603b TO |
502 | 'name' => 'created_id', |
503 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 504 | 'title' => ts('Group Created By'), |
215b423e | 505 | 'description' => ts('FK to contact table.'), |
a36434b9 | 506 | 'where' => 'civicrm_group.created_id', |
522a26c9 | 507 | 'table_name' => 'civicrm_group', |
508 | 'entity' => 'Group', | |
509 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 510 | 'localizable' => 0, |
e501603b | 511 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 512 | 'add' => '4.3', |
c3fc2621 CW |
513 | ], |
514 | 'modified_id' => [ | |
e501603b TO |
515 | 'name' => 'modified_id', |
516 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 517 | 'title' => ts('Group Modified By'), |
215b423e | 518 | 'description' => ts('FK to contact table.'), |
a36434b9 | 519 | 'where' => 'civicrm_group.modified_id', |
522a26c9 | 520 | 'table_name' => 'civicrm_group', |
521 | 'entity' => 'Group', | |
522 | 'bao' => 'CRM_Contact_BAO_Group', | |
6a7e5e5d | 523 | 'localizable' => 0, |
e501603b | 524 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 525 | 'add' => '4.5', |
c3fc2621 | 526 | ], |
35fd9d21 SL |
527 | 'frontend_title' => [ |
528 | 'name' => 'frontend_title', | |
529 | 'type' => CRM_Utils_Type::T_STRING, | |
530 | 'title' => ts('Public Group Title'), | |
531 | 'description' => ts('Alternative public title for this Group.'), | |
532 | 'maxlength' => 255, | |
533 | 'size' => CRM_Utils_Type::HUGE, | |
534 | 'where' => 'civicrm_group.frontend_title', | |
535 | 'default' => 'NULL', | |
536 | 'table_name' => 'civicrm_group', | |
537 | 'entity' => 'Group', | |
538 | 'bao' => 'CRM_Contact_BAO_Group', | |
539 | 'localizable' => 1, | |
540 | 'html' => [ | |
541 | 'type' => 'Text', | |
542 | ], | |
543 | 'add' => '5.31', | |
544 | ], | |
545 | 'frontend_description' => [ | |
546 | 'name' => 'frontend_description', | |
547 | 'type' => CRM_Utils_Type::T_TEXT, | |
548 | 'title' => ts('Public Group Description'), | |
549 | 'description' => ts('Alternative public description of the group.'), | |
550 | 'rows' => 2, | |
551 | 'cols' => 60, | |
552 | 'where' => 'civicrm_group.frontend_description', | |
553 | 'default' => 'NULL', | |
554 | 'table_name' => 'civicrm_group', | |
555 | 'entity' => 'Group', | |
556 | 'bao' => 'CRM_Contact_BAO_Group', | |
557 | 'localizable' => 1, | |
558 | 'html' => [ | |
559 | 'type' => 'TextArea', | |
560 | ], | |
561 | 'add' => '5.31', | |
562 | ], | |
c3fc2621 | 563 | ]; |
346aaaba | 564 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 565 | } |
346aaaba | 566 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 567 | } |
c3fc2621 | 568 | |
e501603b | 569 | /** |
bd8e0b14 | 570 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
571 | * |
572 | * @return array | |
bd8e0b14 | 573 | * Array(string $name => string $uniqueName). |
e501603b | 574 | */ |
c3fc2621 | 575 | public static function &fieldKeys() { |
bd8e0b14 TO |
576 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
577 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 578 | } |
bd8e0b14 | 579 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 580 | } |
c3fc2621 | 581 | |
e501603b TO |
582 | /** |
583 | * Returns the names of this table | |
584 | * | |
585 | * @return string | |
586 | */ | |
c3fc2621 | 587 | public static function getTableName() { |
e501603b TO |
588 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
589 | } | |
c3fc2621 | 590 | |
e501603b TO |
591 | /** |
592 | * Returns if this table needs to be logged | |
593 | * | |
c3fc2621 | 594 | * @return bool |
e501603b | 595 | */ |
c3fc2621 | 596 | public function getLog() { |
e501603b TO |
597 | return self::$_log; |
598 | } | |
c3fc2621 | 599 | |
e501603b TO |
600 | /** |
601 | * Returns the list of fields that can be imported | |
602 | * | |
603 | * @param bool $prefix | |
604 | * | |
605 | * @return array | |
606 | */ | |
c3fc2621 CW |
607 | public static function &import($prefix = FALSE) { |
608 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group', $prefix, []); | |
60808919 | 609 | return $r; |
e501603b | 610 | } |
c3fc2621 | 611 | |
e501603b TO |
612 | /** |
613 | * Returns the list of fields that can be exported | |
614 | * | |
615 | * @param bool $prefix | |
616 | * | |
617 | * @return array | |
618 | */ | |
c3fc2621 CW |
619 | public static function &export($prefix = FALSE) { |
620 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group', $prefix, []); | |
60808919 | 621 | return $r; |
e501603b | 622 | } |
c3fc2621 | 623 | |
e7a6b91a AS |
624 | /** |
625 | * Returns the list of indices | |
c3fc2621 CW |
626 | * |
627 | * @param bool $localize | |
628 | * | |
629 | * @return array | |
e7a6b91a AS |
630 | */ |
631 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
632 | $indices = [ |
633 | 'index_group_type' => [ | |
e7a6b91a | 634 | 'name' => 'index_group_type', |
c3fc2621 | 635 | 'field' => [ |
e7a6b91a | 636 | 0 => 'group_type', |
c3fc2621 CW |
637 | ], |
638 | 'localizable' => FALSE, | |
e7a6b91a | 639 | 'sig' => 'civicrm_group::0::group_type', |
c3fc2621 CW |
640 | ], |
641 | 'UI_title' => [ | |
e7a6b91a | 642 | 'name' => 'UI_title', |
c3fc2621 | 643 | 'field' => [ |
e7a6b91a | 644 | 0 => 'title', |
c3fc2621 CW |
645 | ], |
646 | 'localizable' => TRUE, | |
647 | 'unique' => TRUE, | |
e7a6b91a | 648 | 'sig' => 'civicrm_group::1::title', |
c3fc2621 CW |
649 | ], |
650 | 'UI_name' => [ | |
e7a6b91a | 651 | 'name' => 'UI_name', |
c3fc2621 | 652 | 'field' => [ |
e7a6b91a | 653 | 0 => 'name', |
c3fc2621 CW |
654 | ], |
655 | 'localizable' => FALSE, | |
656 | 'unique' => TRUE, | |
e7a6b91a | 657 | 'sig' => 'civicrm_group::1::name', |
c3fc2621 CW |
658 | ], |
659 | ]; | |
e7a6b91a AS |
660 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
661 | } | |
c3fc2621 | 662 | |
e501603b | 663 | } |