3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2015
31 * Generated from xml/schema/CRM/Contact/Group.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Contact_DAO_Group
extends CRM_Core_DAO
{
38 * static instance to hold the table name
42 static $_tableName = 'civicrm_group';
44 * static instance to hold the field values
48 static $_fields = null;
50 * static instance to hold the keys used in $_fields for each field.
54 static $_fieldKeys = null;
56 * static instance to hold the FK relationships
60 static $_links = null;
62 * static instance to hold the values that can
67 static $_import = null;
69 * static instance to hold the values that can
74 static $_export = null;
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
89 * Internal name of Group.
101 * Optional verbose description of the group.
107 * Module or process which created this group.
113 * FK to saved search table.
117 public $saved_search_id;
119 * Is this entry active?
125 * In what context(s) is this field visible.
131 * the sql where clause if a saved search acl
135 public $where_clause;
137 * the tables to be included in a select data
141 public $select_tables;
143 * the tables to be included in the count statement
147 public $where_tables;
155 * Date when we created the cache for a smart group
161 * Date and time when we need to refresh the cache next.
165 public $refresh_date;
167 * IDs of the parent(s)
173 * IDs of the child(ren)
179 * Is this group hidden?
190 * FK to contact table.
196 * FK to contact table.
204 * @return civicrm_group
206 function __construct() {
207 $this->__table
= 'civicrm_group';
208 parent
::__construct();
211 * Returns foreign keys and entity references
214 * [CRM_Core_Reference_Interface]
216 static function getReferenceColumns() {
217 if (!self
::$_links) {
218 self
::$_links = static ::createReferenceColumns(__CLASS__
);
219 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'saved_search_id', 'civicrm_saved_search', 'id');
220 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'created_id', 'civicrm_contact', 'id');
221 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'modified_id', 'civicrm_contact', 'id');
223 return self
::$_links;
226 * Returns all the column names of this table
230 static function &fields() {
231 if (!(self
::$_fields)) {
232 self
::$_fields = array(
235 'type' => CRM_Utils_Type
::T_INT
,
236 'title' => ts('Group ID') ,
237 'description' => 'Group ID',
242 'type' => CRM_Utils_Type
::T_STRING
,
243 'title' => ts('Group Name') ,
244 'description' => 'Internal name of Group.',
246 'size' => CRM_Utils_Type
::BIG
,
250 'type' => CRM_Utils_Type
::T_STRING
,
251 'title' => ts('Group Title') ,
252 'description' => 'Name of Group.',
254 'size' => CRM_Utils_Type
::BIG
,
256 'description' => array(
257 'name' => 'description',
258 'type' => CRM_Utils_Type
::T_TEXT
,
259 'title' => ts('Group Description') ,
260 'description' => 'Optional verbose description of the group.',
264 'type' => 'TextArea',
269 'type' => CRM_Utils_Type
::T_STRING
,
270 'title' => ts('Group Source') ,
271 'description' => 'Module or process which created this group.',
273 'size' => CRM_Utils_Type
::BIG
,
275 'saved_search_id' => array(
276 'name' => 'saved_search_id',
277 'type' => CRM_Utils_Type
::T_INT
,
278 'title' => ts('Saved Search ID') ,
279 'description' => 'FK to saved search table.',
280 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
282 'is_active' => array(
283 'name' => 'is_active',
284 'type' => CRM_Utils_Type
::T_BOOLEAN
,
285 'title' => ts('Group Enabled') ,
286 'description' => 'Is this entry active?',
288 'visibility' => array(
289 'name' => 'visibility',
290 'type' => CRM_Utils_Type
::T_STRING
,
291 'title' => ts('Group Visibility Setting') ,
292 'description' => 'In what context(s) is this field visible.',
294 'size' => CRM_Utils_Type
::MEDIUM
,
295 'default' => 'User and User Admin Only',
299 'pseudoconstant' => array(
300 'callback' => 'CRM_Core_SelectValues::groupVisibility',
303 'where_clause' => array(
304 'name' => 'where_clause',
305 'type' => CRM_Utils_Type
::T_TEXT
,
306 'title' => ts('Group Where Clause') ,
307 'description' => 'the sql where clause if a saved search acl',
309 'select_tables' => array(
310 'name' => 'select_tables',
311 'type' => CRM_Utils_Type
::T_TEXT
,
312 'title' => ts('Tables For Select Clause') ,
313 'description' => 'the tables to be included in a select data',
315 'where_tables' => array(
316 'name' => 'where_tables',
317 'type' => CRM_Utils_Type
::T_TEXT
,
318 'title' => ts('Tables For Where Clause') ,
319 'description' => 'the tables to be included in the count statement',
321 'group_type' => array(
322 'name' => 'group_type',
323 'type' => CRM_Utils_Type
::T_STRING
,
324 'title' => ts('Group Type') ,
325 'description' => 'FK to group type',
327 'size' => CRM_Utils_Type
::HUGE
,
328 'pseudoconstant' => array(
329 'optionGroupName' => 'group_type',
330 'optionEditPath' => 'civicrm/admin/options/group_type',
333 'cache_date' => array(
334 'name' => 'cache_date',
335 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
336 'title' => ts('Group Cache Date') ,
337 'description' => 'Date when we created the cache for a smart group',
340 'refresh_date' => array(
341 'name' => 'refresh_date',
342 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
343 'title' => ts('Next Group Refresh Time') ,
344 'description' => 'Date and time when we need to refresh the cache next.',
349 'type' => CRM_Utils_Type
::T_TEXT
,
350 'title' => ts('Group Parents') ,
351 'description' => 'IDs of the parent(s)',
354 'name' => 'children',
355 'type' => CRM_Utils_Type
::T_TEXT
,
356 'title' => ts('Group Children') ,
357 'description' => 'IDs of the child(ren)',
359 'is_hidden' => array(
360 'name' => 'is_hidden',
361 'type' => CRM_Utils_Type
::T_BOOLEAN
,
362 'title' => ts('Group is Hidden') ,
363 'description' => 'Is this group hidden?',
365 'is_reserved' => array(
366 'name' => 'is_reserved',
367 'type' => CRM_Utils_Type
::T_BOOLEAN
,
368 'title' => ts('Group is Reserved') ,
370 'created_id' => array(
371 'name' => 'created_id',
372 'type' => CRM_Utils_Type
::T_INT
,
373 'title' => ts('Group Created By') ,
374 'description' => 'FK to contact table.',
375 'FKClassName' => 'CRM_Contact_DAO_Contact',
377 'modified_id' => array(
378 'name' => 'modified_id',
379 'type' => CRM_Utils_Type
::T_INT
,
380 'title' => ts('Group Modified By') ,
381 'description' => 'FK to contact table.',
382 'FKClassName' => 'CRM_Contact_DAO_Contact',
386 return self
::$_fields;
389 * Returns an array containing, for each field, the arary key used for that
390 * field in self::$_fields.
394 static function &fieldKeys() {
395 if (!(self
::$_fieldKeys)) {
396 self
::$_fieldKeys = array(
400 'description' => 'description',
401 'source' => 'source',
402 'saved_search_id' => 'saved_search_id',
403 'is_active' => 'is_active',
404 'visibility' => 'visibility',
405 'where_clause' => 'where_clause',
406 'select_tables' => 'select_tables',
407 'where_tables' => 'where_tables',
408 'group_type' => 'group_type',
409 'cache_date' => 'cache_date',
410 'refresh_date' => 'refresh_date',
411 'parents' => 'parents',
412 'children' => 'children',
413 'is_hidden' => 'is_hidden',
414 'is_reserved' => 'is_reserved',
415 'created_id' => 'created_id',
416 'modified_id' => 'modified_id',
419 return self
::$_fieldKeys;
422 * Returns the names of this table
426 static function getTableName() {
427 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
430 * Returns if this table needs to be logged
438 * Returns the list of fields that can be imported
440 * @param bool $prefix
444 static function &import($prefix = false) {
445 if (!(self
::$_import)) {
446 self
::$_import = array();
447 $fields = self
::fields();
448 foreach($fields as $name => $field) {
449 if (CRM_Utils_Array
::value('import', $field)) {
451 self
::$_import['group'] = & $fields[$name];
453 self
::$_import[$name] = & $fields[$name];
458 return self
::$_import;
461 * Returns the list of fields that can be exported
463 * @param bool $prefix
467 static function &export($prefix = false) {
468 if (!(self
::$_export)) {
469 self
::$_export = array();
470 $fields = self
::fields();
471 foreach($fields as $name => $field) {
472 if (CRM_Utils_Array
::value('export', $field)) {
474 self
::$_export['group'] = & $fields[$name];
476 self
::$_export[$name] = & $fields[$name];
481 return self
::$_export;