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