Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
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 | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Core/OptionGroup.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 33 | * (GenCodeChecksum:4f26b702ecd914e653257f0676896d87) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_OptionGroup constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_option_group'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = true; | |
53 | /** | |
54 | * Option Group ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name; | |
65 | /** | |
66 | * Option Group title. | |
67 | * | |
68 | * @var string | |
69 | */ | |
70 | public $title; | |
71 | /** | |
72 | * Option group description. | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $description; | |
7c61320c SL |
77 | /** |
78 | * Option group description. | |
79 | * | |
80 | * @var string | |
81 | */ | |
82 | public $data_type; | |
e501603b TO |
83 | /** |
84 | * Is this a predefined system option group (i.e. it can not be deleted)? | |
85 | * | |
86 | * @var boolean | |
87 | */ | |
88 | public $is_reserved; | |
89 | /** | |
90 | * Is this option group active? | |
91 | * | |
92 | * @var boolean | |
93 | */ | |
94 | public $is_active; | |
95 | /** | |
96 | * A lock to remove the ability to add new options via the UI. | |
97 | * | |
98 | * @var boolean | |
99 | */ | |
100 | public $is_locked; | |
101 | /** | |
f41f0342 | 102 | * Class constructor. |
e501603b TO |
103 | */ |
104 | function __construct() { | |
105 | $this->__table = 'civicrm_option_group'; | |
106 | parent::__construct(); | |
107 | } | |
108 | /** | |
109 | * Returns all the column names of this table | |
110 | * | |
111 | * @return array | |
112 | */ | |
113 | static function &fields() { | |
346aaaba TO |
114 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
115 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
116 | 'id' => array( |
117 | 'name' => 'id', | |
118 | 'type' => CRM_Utils_Type::T_INT, | |
119 | 'title' => ts('Option Group ID') , | |
120 | 'description' => 'Option Group ID', | |
121 | 'required' => true, | |
522a26c9 | 122 | 'table_name' => 'civicrm_option_group', |
123 | 'entity' => 'OptionGroup', | |
124 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 125 | 'localizable' => 0, |
e501603b TO |
126 | ) , |
127 | 'name' => array( | |
128 | 'name' => 'name', | |
129 | 'type' => CRM_Utils_Type::T_STRING, | |
130 | 'title' => ts('Option Group Name') , | |
131 | 'description' => 'Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.', | |
132 | 'required' => true, | |
133 | 'maxlength' => 64, | |
134 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 135 | 'table_name' => 'civicrm_option_group', |
136 | 'entity' => 'OptionGroup', | |
137 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 138 | 'localizable' => 0, |
e501603b TO |
139 | ) , |
140 | 'title' => array( | |
141 | 'name' => 'title', | |
142 | 'type' => CRM_Utils_Type::T_STRING, | |
143 | 'title' => ts('Option Group title') , | |
144 | 'description' => 'Option Group title.', | |
145 | 'maxlength' => 255, | |
146 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 147 | 'table_name' => 'civicrm_option_group', |
148 | 'entity' => 'OptionGroup', | |
149 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 150 | 'localizable' => 1, |
e501603b TO |
151 | ) , |
152 | 'description' => array( | |
153 | 'name' => 'description', | |
154 | 'type' => CRM_Utils_Type::T_STRING, | |
155 | 'title' => ts('Option Group Description') , | |
156 | 'description' => 'Option group description.', | |
157 | 'maxlength' => 255, | |
158 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 159 | 'table_name' => 'civicrm_option_group', |
160 | 'entity' => 'OptionGroup', | |
161 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 162 | 'localizable' => 1, |
e501603b | 163 | ) , |
7c61320c SL |
164 | 'data_type' => array( |
165 | 'name' => 'data_type', | |
166 | 'type' => CRM_Utils_Type::T_STRING, | |
167 | 'title' => ts('Data Type for this option group') , | |
168 | 'description' => 'Option group description.', | |
169 | 'maxlength' => 128, | |
170 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 171 | 'table_name' => 'civicrm_option_group', |
172 | 'entity' => 'OptionGroup', | |
173 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 174 | 'localizable' => 0, |
7c61320c SL |
175 | 'pseudoconstant' => array( |
176 | 'callback' => 'CRM_Utils_Type::dataTypes', | |
177 | ) | |
178 | ) , | |
e501603b TO |
179 | 'is_reserved' => array( |
180 | 'name' => 'is_reserved', | |
181 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
182 | 'title' => ts('Option Group Is Reserved?') , | |
183 | 'description' => 'Is this a predefined system option group (i.e. it can not be deleted)?', | |
184 | 'default' => '1', | |
522a26c9 | 185 | 'table_name' => 'civicrm_option_group', |
186 | 'entity' => 'OptionGroup', | |
187 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 188 | 'localizable' => 0, |
e501603b TO |
189 | ) , |
190 | 'is_active' => array( | |
191 | 'name' => 'is_active', | |
192 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
193 | 'title' => ts('Option Group Is Active?') , | |
194 | 'description' => 'Is this option group active?', | |
522a26c9 | 195 | 'table_name' => 'civicrm_option_group', |
196 | 'entity' => 'OptionGroup', | |
197 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 198 | 'localizable' => 0, |
e501603b TO |
199 | ) , |
200 | 'is_locked' => array( | |
201 | 'name' => 'is_locked', | |
202 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
203 | 'title' => ts('Option Group Is Locked') , | |
204 | 'description' => 'A lock to remove the ability to add new options via the UI.', | |
522a26c9 | 205 | 'table_name' => 'civicrm_option_group', |
206 | 'entity' => 'OptionGroup', | |
207 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 208 | 'localizable' => 0, |
e501603b TO |
209 | ) , |
210 | ); | |
346aaaba | 211 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 212 | } |
346aaaba | 213 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
214 | } |
215 | /** | |
bd8e0b14 | 216 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
217 | * |
218 | * @return array | |
bd8e0b14 | 219 | * Array(string $name => string $uniqueName). |
e501603b TO |
220 | */ |
221 | static function &fieldKeys() { | |
bd8e0b14 TO |
222 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
223 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 224 | } |
bd8e0b14 | 225 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
226 | } |
227 | /** | |
228 | * Returns the names of this table | |
229 | * | |
230 | * @return string | |
231 | */ | |
232 | static function getTableName() { | |
233 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
234 | } | |
235 | /** | |
236 | * Returns if this table needs to be logged | |
237 | * | |
238 | * @return boolean | |
239 | */ | |
240 | function getLog() { | |
241 | return self::$_log; | |
242 | } | |
243 | /** | |
244 | * Returns the list of fields that can be imported | |
245 | * | |
246 | * @param bool $prefix | |
247 | * | |
248 | * @return array | |
249 | */ | |
250 | static function &import($prefix = false) { | |
60808919 TO |
251 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_group', $prefix, array()); |
252 | return $r; | |
e501603b TO |
253 | } |
254 | /** | |
255 | * Returns the list of fields that can be exported | |
256 | * | |
257 | * @param bool $prefix | |
258 | * | |
259 | * @return array | |
260 | */ | |
261 | static function &export($prefix = false) { | |
60808919 TO |
262 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_group', $prefix, array()); |
263 | return $r; | |
e501603b | 264 | } |
e7a6b91a AS |
265 | /** |
266 | * Returns the list of indices | |
267 | */ | |
268 | public static function indices($localize = TRUE) { | |
269 | $indices = array( | |
270 | 'UI_name' => array( | |
271 | 'name' => 'UI_name', | |
272 | 'field' => array( | |
273 | 0 => 'name', | |
274 | ) , | |
275 | 'localizable' => false, | |
276 | 'unique' => true, | |
277 | 'sig' => 'civicrm_option_group::1::name', | |
278 | ) , | |
279 | ); | |
280 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
281 | } | |
e501603b | 282 | } |