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/Setting.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 33 | * (GenCodeChecksum:a9b0b7aaf6ae42696ce402c1ff9acb89) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_Setting constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Core_DAO_Setting 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_setting'; | |
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 = false; | |
53 | /** | |
54 | * | |
55 | * @var int unsigned | |
56 | */ | |
57 | public $id; | |
58 | /** | |
59 | * Unique name for setting | |
60 | * | |
61 | * @var string | |
62 | */ | |
63 | public $name; | |
64 | /** | |
65 | * data associated with this group / name combo | |
66 | * | |
67 | * @var text | |
68 | */ | |
69 | public $value; | |
70 | /** | |
71 | * Which Domain is this menu item for | |
72 | * | |
73 | * @var int unsigned | |
74 | */ | |
75 | public $domain_id; | |
76 | /** | |
77 | * FK to Contact ID if the setting is localized to a contact | |
78 | * | |
79 | * @var int unsigned | |
80 | */ | |
81 | public $contact_id; | |
82 | /** | |
83 | * Is this setting a contact specific or site wide setting? | |
84 | * | |
85 | * @var boolean | |
86 | */ | |
87 | public $is_domain; | |
88 | /** | |
89 | * Component that this menu item belongs to | |
90 | * | |
91 | * @var int unsigned | |
92 | */ | |
93 | public $component_id; | |
94 | /** | |
95 | * When was the setting created | |
96 | * | |
97 | * @var datetime | |
98 | */ | |
99 | public $created_date; | |
100 | /** | |
101 | * FK to civicrm_contact, who created this setting | |
102 | * | |
103 | * @var int unsigned | |
104 | */ | |
105 | public $created_id; | |
106 | /** | |
f41f0342 | 107 | * Class constructor. |
e501603b TO |
108 | */ |
109 | function __construct() { | |
110 | $this->__table = 'civicrm_setting'; | |
111 | parent::__construct(); | |
112 | } | |
113 | /** | |
f41f0342 | 114 | * Returns foreign keys and entity references. |
e501603b TO |
115 | * |
116 | * @return array | |
117 | * [CRM_Core_Reference_Interface] | |
118 | */ | |
119 | static function getReferenceColumns() { | |
346aaaba TO |
120 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
121 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
122 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); | |
123 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
124 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); | |
125 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); | |
126 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 127 | } |
346aaaba | 128 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
129 | } |
130 | /** | |
131 | * Returns all the column names of this table | |
132 | * | |
133 | * @return array | |
134 | */ | |
135 | static function &fields() { | |
346aaaba TO |
136 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
137 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
138 | 'id' => array( |
139 | 'name' => 'id', | |
140 | 'type' => CRM_Utils_Type::T_INT, | |
141 | 'title' => ts('Setting ID') , | |
142 | 'required' => true, | |
522a26c9 | 143 | 'table_name' => 'civicrm_setting', |
144 | 'entity' => 'Setting', | |
145 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 146 | 'localizable' => 0, |
e501603b TO |
147 | ) , |
148 | 'name' => array( | |
149 | 'name' => 'name', | |
150 | 'type' => CRM_Utils_Type::T_STRING, | |
151 | 'title' => ts('Setting Name') , | |
152 | 'description' => 'Unique name for setting', | |
153 | 'maxlength' => 255, | |
154 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 155 | 'table_name' => 'civicrm_setting', |
156 | 'entity' => 'Setting', | |
157 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 158 | 'localizable' => 0, |
e501603b TO |
159 | ) , |
160 | 'value' => array( | |
161 | 'name' => 'value', | |
162 | 'type' => CRM_Utils_Type::T_TEXT, | |
163 | 'title' => ts('Value') , | |
164 | 'description' => 'data associated with this group / name combo', | |
522a26c9 | 165 | 'table_name' => 'civicrm_setting', |
166 | 'entity' => 'Setting', | |
167 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 168 | 'localizable' => 0, |
e501603b TO |
169 | ) , |
170 | 'domain_id' => array( | |
171 | 'name' => 'domain_id', | |
172 | 'type' => CRM_Utils_Type::T_INT, | |
173 | 'title' => ts('Setting Domain') , | |
174 | 'description' => 'Which Domain is this menu item for', | |
175 | 'required' => true, | |
522a26c9 | 176 | 'table_name' => 'civicrm_setting', |
177 | 'entity' => 'Setting', | |
178 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 179 | 'localizable' => 0, |
e501603b TO |
180 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
181 | 'pseudoconstant' => array( | |
182 | 'table' => 'civicrm_domain', | |
183 | 'keyColumn' => 'id', | |
184 | 'labelColumn' => 'name', | |
185 | ) | |
186 | ) , | |
187 | 'contact_id' => array( | |
188 | 'name' => 'contact_id', | |
189 | 'type' => CRM_Utils_Type::T_INT, | |
190 | 'title' => ts('Setting Contact') , | |
191 | 'description' => 'FK to Contact ID if the setting is localized to a contact', | |
522a26c9 | 192 | 'table_name' => 'civicrm_setting', |
193 | 'entity' => 'Setting', | |
194 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 195 | 'localizable' => 0, |
e501603b TO |
196 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
197 | ) , | |
198 | 'is_domain' => array( | |
199 | 'name' => 'is_domain', | |
200 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
201 | 'title' => ts('Is Domain Setting?') , | |
202 | 'description' => 'Is this setting a contact specific or site wide setting?', | |
522a26c9 | 203 | 'table_name' => 'civicrm_setting', |
204 | 'entity' => 'Setting', | |
205 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 206 | 'localizable' => 0, |
e501603b TO |
207 | ) , |
208 | 'component_id' => array( | |
209 | 'name' => 'component_id', | |
210 | 'type' => CRM_Utils_Type::T_INT, | |
211 | 'title' => ts('Setting Component') , | |
212 | 'description' => 'Component that this menu item belongs to', | |
522a26c9 | 213 | 'table_name' => 'civicrm_setting', |
214 | 'entity' => 'Setting', | |
215 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 216 | 'localizable' => 0, |
e501603b TO |
217 | 'FKClassName' => 'CRM_Core_DAO_Component', |
218 | 'html' => array( | |
219 | 'type' => 'Select', | |
220 | ) , | |
221 | 'pseudoconstant' => array( | |
222 | 'table' => 'civicrm_component', | |
223 | 'keyColumn' => 'id', | |
224 | 'labelColumn' => 'name', | |
225 | ) | |
226 | ) , | |
227 | 'created_date' => array( | |
228 | 'name' => 'created_date', | |
229 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
230 | 'title' => ts('Setting Created Date') , | |
231 | 'description' => 'When was the setting created', | |
522a26c9 | 232 | 'table_name' => 'civicrm_setting', |
233 | 'entity' => 'Setting', | |
234 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 235 | 'localizable' => 0, |
e501603b TO |
236 | ) , |
237 | 'created_id' => array( | |
238 | 'name' => 'created_id', | |
239 | 'type' => CRM_Utils_Type::T_INT, | |
240 | 'title' => ts('Setting Created By') , | |
241 | 'description' => 'FK to civicrm_contact, who created this setting', | |
522a26c9 | 242 | 'table_name' => 'civicrm_setting', |
243 | 'entity' => 'Setting', | |
244 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 245 | 'localizable' => 0, |
e501603b TO |
246 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
247 | ) , | |
248 | ); | |
346aaaba | 249 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 250 | } |
346aaaba | 251 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
252 | } |
253 | /** | |
bd8e0b14 | 254 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
255 | * |
256 | * @return array | |
bd8e0b14 | 257 | * Array(string $name => string $uniqueName). |
e501603b TO |
258 | */ |
259 | static function &fieldKeys() { | |
bd8e0b14 TO |
260 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
261 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 262 | } |
bd8e0b14 | 263 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
264 | } |
265 | /** | |
266 | * Returns the names of this table | |
267 | * | |
268 | * @return string | |
269 | */ | |
270 | static function getTableName() { | |
271 | return self::$_tableName; | |
272 | } | |
273 | /** | |
274 | * Returns if this table needs to be logged | |
275 | * | |
276 | * @return boolean | |
277 | */ | |
278 | function getLog() { | |
279 | return self::$_log; | |
280 | } | |
281 | /** | |
282 | * Returns the list of fields that can be imported | |
283 | * | |
284 | * @param bool $prefix | |
285 | * | |
286 | * @return array | |
287 | */ | |
288 | static function &import($prefix = false) { | |
60808919 TO |
289 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, array()); |
290 | return $r; | |
e501603b TO |
291 | } |
292 | /** | |
293 | * Returns the list of fields that can be exported | |
294 | * | |
295 | * @param bool $prefix | |
296 | * | |
297 | * @return array | |
298 | */ | |
299 | static function &export($prefix = false) { | |
60808919 TO |
300 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, array()); |
301 | return $r; | |
e501603b | 302 | } |
e7a6b91a AS |
303 | /** |
304 | * Returns the list of indices | |
305 | */ | |
306 | public static function indices($localize = TRUE) { | |
307 | $indices = array( | |
308 | 'index_domain_contact_name' => array( | |
309 | 'name' => 'index_domain_contact_name', | |
310 | 'field' => array( | |
311 | 0 => 'domain_id', | |
312 | 1 => 'contact_id', | |
313 | 2 => 'name', | |
314 | ) , | |
315 | 'localizable' => false, | |
316 | 'unique' => true, | |
317 | 'sig' => 'civicrm_setting::1::domain_id::contact_id::name', | |
318 | ) , | |
319 | ); | |
320 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
321 | } | |
e501603b | 322 | } |