Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
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-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Contact/GroupContact.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:679a5d513b09d5a9a945b81aa00bd4d8) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_group_contact'; | |
44 | /** | |
45 | * static instance to hold the field values | |
46 | * | |
47 | * @var array | |
48 | */ | |
49 | static $_fields = null; | |
50 | /** | |
51 | * static instance to hold the keys used in $_fields for each field. | |
52 | * | |
53 | * @var array | |
54 | */ | |
55 | static $_fieldKeys = null; | |
56 | /** | |
57 | * static instance to hold the FK relationships | |
58 | * | |
59 | * @var string | |
60 | */ | |
61 | static $_links = null; | |
62 | /** | |
63 | * static instance to hold the values that can | |
64 | * be imported | |
65 | * | |
66 | * @var array | |
67 | */ | |
68 | static $_import = null; | |
69 | /** | |
70 | * static instance to hold the values that can | |
71 | * be exported | |
72 | * | |
73 | * @var array | |
74 | */ | |
75 | static $_export = null; | |
76 | /** | |
77 | * static value to see if we should log any modifications to | |
78 | * this table in the civicrm_log table | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | static $_log = true; | |
83 | /** | |
84 | * primary key | |
85 | * | |
86 | * @var int unsigned | |
87 | */ | |
88 | public $id; | |
89 | /** | |
90 | * FK to civicrm_group | |
91 | * | |
92 | * @var int unsigned | |
93 | */ | |
94 | public $group_id; | |
95 | /** | |
96 | * FK to civicrm_contact | |
97 | * | |
98 | * @var int unsigned | |
99 | */ | |
100 | public $contact_id; | |
101 | /** | |
102 | * status of contact relative to membership in group | |
103 | * | |
104 | * @var string | |
105 | */ | |
106 | public $status; | |
107 | /** | |
108 | * Optional location to associate with this membership | |
109 | * | |
110 | * @var int unsigned | |
111 | */ | |
112 | public $location_id; | |
113 | /** | |
114 | * Optional email to associate with this membership | |
115 | * | |
116 | * @var int unsigned | |
117 | */ | |
118 | public $email_id; | |
119 | /** | |
120 | * class constructor | |
121 | * | |
122 | * @return civicrm_group_contact | |
123 | */ | |
124 | function __construct() { | |
125 | $this->__table = 'civicrm_group_contact'; | |
126 | parent::__construct(); | |
127 | } | |
128 | /** | |
129 | * Returns foreign keys and entity references | |
130 | * | |
131 | * @return array | |
132 | * [CRM_Core_Reference_Interface] | |
133 | */ | |
134 | static function getReferenceColumns() { | |
135 | if (!self::$_links) { | |
136 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
137 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); | |
138 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
139 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_id', 'civicrm_loc_block', 'id'); | |
140 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); | |
141 | } | |
142 | return self::$_links; | |
143 | } | |
144 | /** | |
145 | * Returns all the column names of this table | |
146 | * | |
147 | * @return array | |
148 | */ | |
149 | static function &fields() { | |
150 | if (!(self::$_fields)) { | |
151 | self::$_fields = array( | |
152 | 'id' => array( | |
153 | 'name' => 'id', | |
154 | 'type' => CRM_Utils_Type::T_INT, | |
155 | 'title' => ts('Group Contact ID') , | |
156 | 'description' => 'primary key', | |
157 | 'required' => true, | |
158 | ) , | |
159 | 'group_id' => array( | |
160 | 'name' => 'group_id', | |
161 | 'type' => CRM_Utils_Type::T_INT, | |
162 | 'title' => ts('Group ID') , | |
163 | 'description' => 'FK to civicrm_group', | |
164 | 'required' => true, | |
165 | 'FKClassName' => 'CRM_Contact_DAO_Group', | |
166 | 'html' => array( | |
167 | 'type' => 'Select', | |
168 | ) , | |
169 | 'pseudoconstant' => array( | |
170 | 'table' => 'civicrm_group', | |
171 | 'keyColumn' => 'id', | |
172 | 'labelColumn' => 'title', | |
173 | ) | |
174 | ) , | |
175 | 'contact_id' => array( | |
176 | 'name' => 'contact_id', | |
177 | 'type' => CRM_Utils_Type::T_INT, | |
178 | 'title' => ts('Contact ID') , | |
179 | 'description' => 'FK to civicrm_contact', | |
180 | 'required' => true, | |
181 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
182 | ) , | |
183 | 'status' => array( | |
184 | 'name' => 'status', | |
185 | 'type' => CRM_Utils_Type::T_STRING, | |
186 | 'title' => ts('Group Contact Status') , | |
187 | 'description' => 'status of contact relative to membership in group', | |
188 | 'maxlength' => 8, | |
189 | 'size' => CRM_Utils_Type::EIGHT, | |
190 | 'html' => array( | |
191 | 'type' => 'Select', | |
192 | ) , | |
193 | 'pseudoconstant' => array( | |
194 | 'callback' => 'CRM_Core_SelectValues::groupContactStatus', | |
195 | ) | |
196 | ) , | |
197 | 'location_id' => array( | |
198 | 'name' => 'location_id', | |
199 | 'type' => CRM_Utils_Type::T_INT, | |
200 | 'title' => ts('Group Contact Location') , | |
201 | 'description' => 'Optional location to associate with this membership', | |
202 | 'FKClassName' => 'CRM_Core_DAO_LocBlock', | |
203 | ) , | |
204 | 'email_id' => array( | |
205 | 'name' => 'email_id', | |
206 | 'type' => CRM_Utils_Type::T_INT, | |
207 | 'title' => ts('Group Contact Email') , | |
208 | 'description' => 'Optional email to associate with this membership', | |
209 | 'FKClassName' => 'CRM_Core_DAO_Email', | |
210 | ) , | |
211 | ); | |
212 | } | |
213 | return self::$_fields; | |
214 | } | |
215 | /** | |
216 | * Returns an array containing, for each field, the arary key used for that | |
217 | * field in self::$_fields. | |
218 | * | |
219 | * @return array | |
220 | */ | |
221 | static function &fieldKeys() { | |
222 | if (!(self::$_fieldKeys)) { | |
223 | self::$_fieldKeys = array( | |
224 | 'id' => 'id', | |
225 | 'group_id' => 'group_id', | |
226 | 'contact_id' => 'contact_id', | |
227 | 'status' => 'status', | |
228 | 'location_id' => 'location_id', | |
229 | 'email_id' => 'email_id', | |
230 | ); | |
231 | } | |
232 | return self::$_fieldKeys; | |
233 | } | |
234 | /** | |
235 | * Returns the names of this table | |
236 | * | |
237 | * @return string | |
238 | */ | |
239 | static function getTableName() { | |
240 | return self::$_tableName; | |
241 | } | |
242 | /** | |
243 | * Returns if this table needs to be logged | |
244 | * | |
245 | * @return boolean | |
246 | */ | |
247 | function getLog() { | |
248 | return self::$_log; | |
249 | } | |
250 | /** | |
251 | * Returns the list of fields that can be imported | |
252 | * | |
253 | * @param bool $prefix | |
254 | * | |
255 | * @return array | |
256 | */ | |
257 | static function &import($prefix = false) { | |
258 | if (!(self::$_import)) { | |
259 | self::$_import = array(); | |
260 | $fields = self::fields(); | |
261 | foreach($fields as $name => $field) { | |
262 | if (CRM_Utils_Array::value('import', $field)) { | |
263 | if ($prefix) { | |
264 | self::$_import['group_contact'] = & $fields[$name]; | |
265 | } else { | |
266 | self::$_import[$name] = & $fields[$name]; | |
267 | } | |
268 | } | |
269 | } | |
270 | } | |
271 | return self::$_import; | |
272 | } | |
273 | /** | |
274 | * Returns the list of fields that can be exported | |
275 | * | |
276 | * @param bool $prefix | |
277 | * | |
278 | * @return array | |
279 | */ | |
280 | static function &export($prefix = false) { | |
281 | if (!(self::$_export)) { | |
282 | self::$_export = array(); | |
283 | $fields = self::fields(); | |
284 | foreach($fields as $name => $field) { | |
285 | if (CRM_Utils_Array::value('export', $field)) { | |
286 | if ($prefix) { | |
287 | self::$_export['group_contact'] = & $fields[$name]; | |
288 | } else { | |
289 | self::$_export[$name] = & $fields[$name]; | |
290 | } | |
291 | } | |
292 | } | |
293 | } | |
294 | return self::$_export; | |
295 | } | |
296 | } |