commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / CRM / Contact / DAO / Group.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2015
30 *
31 * Generated from xml/schema/CRM/Contact/Group.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 */
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Contact_DAO_Group extends CRM_Core_DAO {
37 /**
38 * static instance to hold the table name
39 *
40 * @var string
41 */
42 static $_tableName = 'civicrm_group';
43 /**
44 * static instance to hold the field values
45 *
46 * @var array
47 */
48 static $_fields = null;
49 /**
50 * static instance to hold the keys used in $_fields for each field.
51 *
52 * @var array
53 */
54 static $_fieldKeys = null;
55 /**
56 * static instance to hold the FK relationships
57 *
58 * @var string
59 */
60 static $_links = null;
61 /**
62 * static instance to hold the values that can
63 * be imported
64 *
65 * @var array
66 */
67 static $_import = null;
68 /**
69 * static instance to hold the values that can
70 * be exported
71 *
72 * @var array
73 */
74 static $_export = null;
75 /**
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
78 *
79 * @var boolean
80 */
81 static $_log = true;
82 /**
83 * Group ID
84 *
85 * @var int unsigned
86 */
87 public $id;
88 /**
89 * Internal name of Group.
90 *
91 * @var string
92 */
93 public $name;
94 /**
95 * Name of Group.
96 *
97 * @var string
98 */
99 public $title;
100 /**
101 * Optional verbose description of the group.
102 *
103 * @var text
104 */
105 public $description;
106 /**
107 * Module or process which created this group.
108 *
109 * @var string
110 */
111 public $source;
112 /**
113 * FK to saved search table.
114 *
115 * @var int unsigned
116 */
117 public $saved_search_id;
118 /**
119 * Is this entry active?
120 *
121 * @var boolean
122 */
123 public $is_active;
124 /**
125 * In what context(s) is this field visible.
126 *
127 * @var string
128 */
129 public $visibility;
130 /**
131 * the sql where clause if a saved search acl
132 *
133 * @var text
134 */
135 public $where_clause;
136 /**
137 * the tables to be included in a select data
138 *
139 * @var text
140 */
141 public $select_tables;
142 /**
143 * the tables to be included in the count statement
144 *
145 * @var text
146 */
147 public $where_tables;
148 /**
149 * FK to group type
150 *
151 * @var string
152 */
153 public $group_type;
154 /**
155 * Date when we created the cache for a smart group
156 *
157 * @var timestamp
158 */
159 public $cache_date;
160 /**
161 * Date and time when we need to refresh the cache next.
162 *
163 * @var timestamp
164 */
165 public $refresh_date;
166 /**
167 * IDs of the parent(s)
168 *
169 * @var text
170 */
171 public $parents;
172 /**
173 * IDs of the child(ren)
174 *
175 * @var text
176 */
177 public $children;
178 /**
179 * Is this group hidden?
180 *
181 * @var boolean
182 */
183 public $is_hidden;
184 /**
185 *
186 * @var boolean
187 */
188 public $is_reserved;
189 /**
190 * FK to contact table.
191 *
192 * @var int unsigned
193 */
194 public $created_id;
195 /**
196 * FK to contact table.
197 *
198 * @var int unsigned
199 */
200 public $modified_id;
201 /**
202 * class constructor
203 *
204 * @return civicrm_group
205 */
206 function __construct() {
207 $this->__table = 'civicrm_group';
208 parent::__construct();
209 }
210 /**
211 * Returns foreign keys and entity references
212 *
213 * @return array
214 * [CRM_Core_Reference_Interface]
215 */
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');
222 }
223 return self::$_links;
224 }
225 /**
226 * Returns all the column names of this table
227 *
228 * @return array
229 */
230 static function &fields() {
231 if (!(self::$_fields)) {
232 self::$_fields = array(
233 'id' => array(
234 'name' => 'id',
235 'type' => CRM_Utils_Type::T_INT,
236 'title' => ts('Group ID') ,
237 'description' => 'Group ID',
238 'required' => true,
239 ) ,
240 'name' => array(
241 'name' => 'name',
242 'type' => CRM_Utils_Type::T_STRING,
243 'title' => ts('Group Name') ,
244 'description' => 'Internal name of Group.',
245 'maxlength' => 64,
246 'size' => CRM_Utils_Type::BIG,
247 ) ,
248 'title' => array(
249 'name' => 'title',
250 'type' => CRM_Utils_Type::T_STRING,
251 'title' => ts('Group Title') ,
252 'description' => 'Name of Group.',
253 'maxlength' => 64,
254 'size' => CRM_Utils_Type::BIG,
255 ) ,
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.',
261 'rows' => 2,
262 'cols' => 60,
263 'html' => array(
264 'type' => 'TextArea',
265 ) ,
266 ) ,
267 'source' => array(
268 'name' => 'source',
269 'type' => CRM_Utils_Type::T_STRING,
270 'title' => ts('Group Source') ,
271 'description' => 'Module or process which created this group.',
272 'maxlength' => 64,
273 'size' => CRM_Utils_Type::BIG,
274 ) ,
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',
281 ) ,
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?',
287 ) ,
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.',
293 'maxlength' => 24,
294 'size' => CRM_Utils_Type::MEDIUM,
295 'default' => 'User and User Admin Only',
296 'html' => array(
297 'type' => 'Select',
298 ) ,
299 'pseudoconstant' => array(
300 'callback' => 'CRM_Core_SelectValues::groupVisibility',
301 )
302 ) ,
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',
308 ) ,
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',
314 ) ,
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',
320 ) ,
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',
326 'maxlength' => 128,
327 'size' => CRM_Utils_Type::HUGE,
328 'pseudoconstant' => array(
329 'optionGroupName' => 'group_type',
330 'optionEditPath' => 'civicrm/admin/options/group_type',
331 )
332 ) ,
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',
338 'required' => false,
339 ) ,
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.',
345 'required' => false,
346 ) ,
347 'parents' => array(
348 'name' => 'parents',
349 'type' => CRM_Utils_Type::T_TEXT,
350 'title' => ts('Group Parents') ,
351 'description' => 'IDs of the parent(s)',
352 ) ,
353 'children' => array(
354 'name' => 'children',
355 'type' => CRM_Utils_Type::T_TEXT,
356 'title' => ts('Group Children') ,
357 'description' => 'IDs of the child(ren)',
358 ) ,
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?',
364 ) ,
365 'is_reserved' => array(
366 'name' => 'is_reserved',
367 'type' => CRM_Utils_Type::T_BOOLEAN,
368 'title' => ts('Group is Reserved') ,
369 ) ,
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',
376 ) ,
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',
383 ) ,
384 );
385 }
386 return self::$_fields;
387 }
388 /**
389 * Returns an array containing, for each field, the arary key used for that
390 * field in self::$_fields.
391 *
392 * @return array
393 */
394 static function &fieldKeys() {
395 if (!(self::$_fieldKeys)) {
396 self::$_fieldKeys = array(
397 'id' => 'id',
398 'name' => 'name',
399 'title' => 'title',
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',
417 );
418 }
419 return self::$_fieldKeys;
420 }
421 /**
422 * Returns the names of this table
423 *
424 * @return string
425 */
426 static function getTableName() {
427 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
428 }
429 /**
430 * Returns if this table needs to be logged
431 *
432 * @return boolean
433 */
434 function getLog() {
435 return self::$_log;
436 }
437 /**
438 * Returns the list of fields that can be imported
439 *
440 * @param bool $prefix
441 *
442 * @return array
443 */
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)) {
450 if ($prefix) {
451 self::$_import['group'] = & $fields[$name];
452 } else {
453 self::$_import[$name] = & $fields[$name];
454 }
455 }
456 }
457 }
458 return self::$_import;
459 }
460 /**
461 * Returns the list of fields that can be exported
462 *
463 * @param bool $prefix
464 *
465 * @return array
466 */
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)) {
473 if ($prefix) {
474 self::$_export['group'] = & $fields[$name];
475 } else {
476 self::$_export[$name] = & $fields[$name];
477 }
478 }
479 }
480 }
481 return self::$_export;
482 }
483 }