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/Setting.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:cc5f4aca441eb6d874c637a53cabddd8) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Core_DAO_Setting extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_setting'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = false; | |
51 | /** | |
52 | * | |
53 | * @var int unsigned | |
54 | */ | |
55 | public $id; | |
56 | /** | |
57 | * Unique name for setting | |
58 | * | |
59 | * @var string | |
60 | */ | |
61 | public $name; | |
62 | /** | |
63 | * data associated with this group / name combo | |
64 | * | |
65 | * @var text | |
66 | */ | |
67 | public $value; | |
68 | /** | |
69 | * Which Domain is this menu item for | |
70 | * | |
71 | * @var int unsigned | |
72 | */ | |
73 | public $domain_id; | |
74 | /** | |
75 | * FK to Contact ID if the setting is localized to a contact | |
76 | * | |
77 | * @var int unsigned | |
78 | */ | |
79 | public $contact_id; | |
80 | /** | |
81 | * Is this setting a contact specific or site wide setting? | |
82 | * | |
83 | * @var boolean | |
84 | */ | |
85 | public $is_domain; | |
86 | /** | |
87 | * Component that this menu item belongs to | |
88 | * | |
89 | * @var int unsigned | |
90 | */ | |
91 | public $component_id; | |
92 | /** | |
93 | * When was the setting created | |
94 | * | |
95 | * @var datetime | |
96 | */ | |
97 | public $created_date; | |
98 | /** | |
99 | * FK to civicrm_contact, who created this setting | |
100 | * | |
101 | * @var int unsigned | |
102 | */ | |
103 | public $created_id; | |
104 | /** | |
105 | * class constructor | |
106 | * | |
107 | * @return civicrm_setting | |
108 | */ | |
109 | function __construct() { | |
110 | $this->__table = 'civicrm_setting'; | |
111 | parent::__construct(); | |
112 | } | |
113 | /** | |
114 | * Returns foreign keys and entity references | |
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, | |
143 | ) , | |
144 | 'name' => array( | |
145 | 'name' => 'name', | |
146 | 'type' => CRM_Utils_Type::T_STRING, | |
147 | 'title' => ts('Setting Name') , | |
148 | 'description' => 'Unique name for setting', | |
149 | 'maxlength' => 255, | |
150 | 'size' => CRM_Utils_Type::HUGE, | |
151 | ) , | |
152 | 'value' => array( | |
153 | 'name' => 'value', | |
154 | 'type' => CRM_Utils_Type::T_TEXT, | |
155 | 'title' => ts('Value') , | |
156 | 'description' => 'data associated with this group / name combo', | |
157 | ) , | |
158 | 'domain_id' => array( | |
159 | 'name' => 'domain_id', | |
160 | 'type' => CRM_Utils_Type::T_INT, | |
161 | 'title' => ts('Setting Domain') , | |
162 | 'description' => 'Which Domain is this menu item for', | |
163 | 'required' => true, | |
164 | 'FKClassName' => 'CRM_Core_DAO_Domain', | |
165 | 'pseudoconstant' => array( | |
166 | 'table' => 'civicrm_domain', | |
167 | 'keyColumn' => 'id', | |
168 | 'labelColumn' => 'name', | |
169 | ) | |
170 | ) , | |
171 | 'contact_id' => array( | |
172 | 'name' => 'contact_id', | |
173 | 'type' => CRM_Utils_Type::T_INT, | |
174 | 'title' => ts('Setting Contact') , | |
175 | 'description' => 'FK to Contact ID if the setting is localized to a contact', | |
176 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
177 | ) , | |
178 | 'is_domain' => array( | |
179 | 'name' => 'is_domain', | |
180 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
181 | 'title' => ts('Is Domain Setting?') , | |
182 | 'description' => 'Is this setting a contact specific or site wide setting?', | |
183 | ) , | |
184 | 'component_id' => array( | |
185 | 'name' => 'component_id', | |
186 | 'type' => CRM_Utils_Type::T_INT, | |
187 | 'title' => ts('Setting Component') , | |
188 | 'description' => 'Component that this menu item belongs to', | |
189 | 'FKClassName' => 'CRM_Core_DAO_Component', | |
190 | 'html' => array( | |
191 | 'type' => 'Select', | |
192 | ) , | |
193 | 'pseudoconstant' => array( | |
194 | 'table' => 'civicrm_component', | |
195 | 'keyColumn' => 'id', | |
196 | 'labelColumn' => 'name', | |
197 | ) | |
198 | ) , | |
199 | 'created_date' => array( | |
200 | 'name' => 'created_date', | |
201 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
202 | 'title' => ts('Setting Created Date') , | |
203 | 'description' => 'When was the setting created', | |
204 | ) , | |
205 | 'created_id' => array( | |
206 | 'name' => 'created_id', | |
207 | 'type' => CRM_Utils_Type::T_INT, | |
208 | 'title' => ts('Setting Created By') , | |
209 | 'description' => 'FK to civicrm_contact, who created this setting', | |
210 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
211 | ) , | |
212 | ); | |
346aaaba | 213 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 214 | } |
346aaaba | 215 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
216 | } |
217 | /** | |
bd8e0b14 | 218 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
219 | * |
220 | * @return array | |
bd8e0b14 | 221 | * Array(string $name => string $uniqueName). |
e501603b TO |
222 | */ |
223 | static function &fieldKeys() { | |
bd8e0b14 TO |
224 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
225 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 226 | } |
bd8e0b14 | 227 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
228 | } |
229 | /** | |
230 | * Returns the names of this table | |
231 | * | |
232 | * @return string | |
233 | */ | |
234 | static function getTableName() { | |
235 | return self::$_tableName; | |
236 | } | |
237 | /** | |
238 | * Returns if this table needs to be logged | |
239 | * | |
240 | * @return boolean | |
241 | */ | |
242 | function getLog() { | |
243 | return self::$_log; | |
244 | } | |
245 | /** | |
246 | * Returns the list of fields that can be imported | |
247 | * | |
248 | * @param bool $prefix | |
249 | * | |
250 | * @return array | |
251 | */ | |
252 | static function &import($prefix = false) { | |
60808919 TO |
253 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, array()); |
254 | return $r; | |
e501603b TO |
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) { | |
60808919 TO |
264 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, array()); |
265 | return $r; | |
e501603b TO |
266 | } |
267 | } |