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/Core/OptionGroup.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
33 | * (GenCodeChecksum:3fc50ba774dcb073e5ab1a2e84bf880f) | |
34 | */ | |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_option_group'; | |
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 | * Option Group ID | |
85 | * | |
86 | * @var int unsigned | |
87 | */ | |
88 | public $id; | |
89 | /** | |
90 | * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value. | |
91 | * | |
92 | * @var string | |
93 | */ | |
94 | public $name; | |
95 | /** | |
96 | * Option Group title. | |
97 | * | |
98 | * @var string | |
99 | */ | |
100 | public $title; | |
101 | /** | |
102 | * Option group description. | |
103 | * | |
104 | * @var string | |
105 | */ | |
106 | public $description; | |
107 | /** | |
108 | * Is this a predefined system option group (i.e. it can not be deleted)? | |
109 | * | |
110 | * @var boolean | |
111 | */ | |
112 | public $is_reserved; | |
113 | /** | |
114 | * Is this option group active? | |
115 | * | |
116 | * @var boolean | |
117 | */ | |
118 | public $is_active; | |
119 | /** | |
120 | * A lock to remove the ability to add new options via the UI. | |
121 | * | |
122 | * @var boolean | |
123 | */ | |
124 | public $is_locked; | |
125 | /** | |
126 | * class constructor | |
127 | * | |
128 | * @return civicrm_option_group | |
129 | */ | |
130 | function __construct() { | |
131 | $this->__table = 'civicrm_option_group'; | |
132 | parent::__construct(); | |
133 | } | |
134 | /** | |
135 | * Returns all the column names of this table | |
136 | * | |
137 | * @return array | |
138 | */ | |
139 | static function &fields() { | |
140 | if (!(self::$_fields)) { | |
141 | self::$_fields = array( | |
142 | 'id' => array( | |
143 | 'name' => 'id', | |
144 | 'type' => CRM_Utils_Type::T_INT, | |
145 | 'title' => ts('Option Group ID') , | |
146 | 'description' => 'Option Group ID', | |
147 | 'required' => true, | |
148 | ) , | |
149 | 'name' => array( | |
150 | 'name' => 'name', | |
151 | 'type' => CRM_Utils_Type::T_STRING, | |
152 | 'title' => ts('Option Group Name') , | |
153 | 'description' => 'Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.', | |
154 | 'required' => true, | |
155 | 'maxlength' => 64, | |
156 | 'size' => CRM_Utils_Type::BIG, | |
157 | ) , | |
158 | 'title' => array( | |
159 | 'name' => 'title', | |
160 | 'type' => CRM_Utils_Type::T_STRING, | |
161 | 'title' => ts('Option Group title') , | |
162 | 'description' => 'Option Group title.', | |
163 | 'maxlength' => 255, | |
164 | 'size' => CRM_Utils_Type::HUGE, | |
165 | ) , | |
166 | 'description' => array( | |
167 | 'name' => 'description', | |
168 | 'type' => CRM_Utils_Type::T_STRING, | |
169 | 'title' => ts('Option Group Description') , | |
170 | 'description' => 'Option group description.', | |
171 | 'maxlength' => 255, | |
172 | 'size' => CRM_Utils_Type::HUGE, | |
173 | ) , | |
174 | 'is_reserved' => array( | |
175 | 'name' => 'is_reserved', | |
176 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
177 | 'title' => ts('Option Group Is Reserved?') , | |
178 | 'description' => 'Is this a predefined system option group (i.e. it can not be deleted)?', | |
179 | 'default' => '1', | |
180 | ) , | |
181 | 'is_active' => array( | |
182 | 'name' => 'is_active', | |
183 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
184 | 'title' => ts('Option Group Is Active?') , | |
185 | 'description' => 'Is this option group active?', | |
186 | ) , | |
187 | 'is_locked' => array( | |
188 | 'name' => 'is_locked', | |
189 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
190 | 'title' => ts('Option Group Is Locked') , | |
191 | 'description' => 'A lock to remove the ability to add new options via the UI.', | |
192 | ) , | |
193 | ); | |
194 | } | |
195 | return self::$_fields; | |
196 | } | |
197 | /** | |
198 | * Returns an array containing, for each field, the arary key used for that | |
199 | * field in self::$_fields. | |
200 | * | |
201 | * @return array | |
202 | */ | |
203 | static function &fieldKeys() { | |
204 | if (!(self::$_fieldKeys)) { | |
205 | self::$_fieldKeys = array( | |
206 | 'id' => 'id', | |
207 | 'name' => 'name', | |
208 | 'title' => 'title', | |
209 | 'description' => 'description', | |
210 | 'is_reserved' => 'is_reserved', | |
211 | 'is_active' => 'is_active', | |
212 | 'is_locked' => 'is_locked', | |
213 | ); | |
214 | } | |
215 | return self::$_fieldKeys; | |
216 | } | |
217 | /** | |
218 | * Returns the names of this table | |
219 | * | |
220 | * @return string | |
221 | */ | |
222 | static function getTableName() { | |
223 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
224 | } | |
225 | /** | |
226 | * Returns if this table needs to be logged | |
227 | * | |
228 | * @return boolean | |
229 | */ | |
230 | function getLog() { | |
231 | return self::$_log; | |
232 | } | |
233 | /** | |
234 | * Returns the list of fields that can be imported | |
235 | * | |
236 | * @param bool $prefix | |
237 | * | |
238 | * @return array | |
239 | */ | |
240 | static function &import($prefix = false) { | |
241 | if (!(self::$_import)) { | |
242 | self::$_import = array(); | |
243 | $fields = self::fields(); | |
244 | foreach($fields as $name => $field) { | |
245 | if (CRM_Utils_Array::value('import', $field)) { | |
246 | if ($prefix) { | |
247 | self::$_import['option_group'] = & $fields[$name]; | |
248 | } else { | |
249 | self::$_import[$name] = & $fields[$name]; | |
250 | } | |
251 | } | |
252 | } | |
253 | } | |
254 | return self::$_import; | |
255 | } | |
256 | /** | |
257 | * Returns the list of fields that can be exported | |
258 | * | |
259 | * @param bool $prefix | |
260 | * | |
261 | * @return array | |
262 | */ | |
263 | static function &export($prefix = false) { | |
264 | if (!(self::$_export)) { | |
265 | self::$_export = array(); | |
266 | $fields = self::fields(); | |
267 | foreach($fields as $name => $field) { | |
268 | if (CRM_Utils_Array::value('export', $field)) { | |
269 | if ($prefix) { | |
270 | self::$_export['option_group'] = & $fields[$name]; | |
271 | } else { | |
272 | self::$_export[$name] = & $fields[$name]; | |
273 | } | |
274 | } | |
275 | } | |
276 | } | |
277 | return self::$_export; | |
278 | } | |
279 | } |