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