Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/LocationType.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
2562d09a | 9 | * (GenCodeChecksum:f9c5e451793d7a168906f173ea492ba7) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the LocationType entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_LocationType extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.1'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_location_type'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = TRUE; |
c3fc2621 | 32 | |
e501603b TO |
33 | /** |
34 | * Location Type ID | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Location Type Name. | |
42 | * | |
43 | * @var string | |
44 | */ | |
45 | public $name; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Location Type Display Name. | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $display_name; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * vCard Location Type Name. | |
56 | * | |
57 | * @var string | |
58 | */ | |
59 | public $vcard_name; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * Location Type Description. | |
63 | * | |
64 | * @var string | |
65 | */ | |
66 | public $description; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Is this location type a predefined system location? | |
70 | * | |
e6ca0a57 | 71 | * @var bool |
e501603b TO |
72 | */ |
73 | public $is_reserved; | |
c3fc2621 | 74 | |
e501603b TO |
75 | /** |
76 | * Is this property active? | |
77 | * | |
e6ca0a57 | 78 | * @var bool |
e501603b TO |
79 | */ |
80 | public $is_active; | |
c3fc2621 | 81 | |
e501603b TO |
82 | /** |
83 | * Is this location type the default? | |
84 | * | |
e6ca0a57 | 85 | * @var bool |
e501603b TO |
86 | */ |
87 | public $is_default; | |
c3fc2621 | 88 | |
e501603b | 89 | /** |
f41f0342 | 90 | * Class constructor. |
e501603b | 91 | */ |
c3fc2621 | 92 | public function __construct() { |
e501603b TO |
93 | $this->__table = 'civicrm_location_type'; |
94 | parent::__construct(); | |
95 | } | |
449c4e6b CW |
96 | |
97 | /** | |
98 | * Returns localized title of this entity. | |
7b66c3b5 AH |
99 | * |
100 | * @param bool $plural | |
101 | * Whether to return the plural version of the title. | |
449c4e6b | 102 | */ |
7b66c3b5 AH |
103 | public static function getEntityTitle($plural = FALSE) { |
104 | return $plural ? ts('Location Types') : ts('Location Type'); | |
449c4e6b | 105 | } |
c3fc2621 | 106 | |
e501603b TO |
107 | /** |
108 | * Returns all the column names of this table | |
109 | * | |
110 | * @return array | |
111 | */ | |
c3fc2621 | 112 | public static function &fields() { |
346aaaba | 113 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
114 | Civi::$statics[__CLASS__]['fields'] = [ |
115 | 'id' => [ | |
e501603b TO |
116 | 'name' => 'id', |
117 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 118 | 'title' => ts('Location Type ID'), |
215b423e | 119 | 'description' => ts('Location Type ID'), |
c3fc2621 | 120 | 'required' => TRUE, |
a36434b9 | 121 | 'where' => 'civicrm_location_type.id', |
522a26c9 | 122 | 'table_name' => 'civicrm_location_type', |
123 | 'entity' => 'LocationType', | |
124 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 125 | 'localizable' => 0, |
2cbbebe8 A |
126 | 'html' => [ |
127 | 'type' => 'Number', | |
128 | ], | |
1fe423d6 | 129 | 'readonly' => TRUE, |
a9d0587b | 130 | 'add' => '1.1', |
c3fc2621 CW |
131 | ], |
132 | 'name' => [ | |
e501603b TO |
133 | 'name' => 'name', |
134 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 135 | 'title' => ts('Location Type'), |
215b423e | 136 | 'description' => ts('Location Type Name.'), |
e501603b TO |
137 | 'maxlength' => 64, |
138 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 139 | 'where' => 'civicrm_location_type.name', |
522a26c9 | 140 | 'table_name' => 'civicrm_location_type', |
141 | 'entity' => 'LocationType', | |
142 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 143 | 'localizable' => 0, |
a9d0587b | 144 | 'add' => '1.1', |
c3fc2621 CW |
145 | ], |
146 | 'display_name' => [ | |
e501603b TO |
147 | 'name' => 'display_name', |
148 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 149 | 'title' => ts('Display Name'), |
215b423e | 150 | 'description' => ts('Location Type Display Name.'), |
e501603b TO |
151 | 'maxlength' => 64, |
152 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 153 | 'where' => 'civicrm_location_type.display_name', |
522a26c9 | 154 | 'table_name' => 'civicrm_location_type', |
155 | 'entity' => 'LocationType', | |
156 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 157 | 'localizable' => 1, |
a9d0587b | 158 | 'add' => '4.1', |
c3fc2621 CW |
159 | ], |
160 | 'vcard_name' => [ | |
e501603b TO |
161 | 'name' => 'vcard_name', |
162 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 163 | 'title' => ts('vCard Location Type'), |
215b423e | 164 | 'description' => ts('vCard Location Type Name.'), |
e501603b TO |
165 | 'maxlength' => 64, |
166 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 167 | 'where' => 'civicrm_location_type.vcard_name', |
522a26c9 | 168 | 'table_name' => 'civicrm_location_type', |
169 | 'entity' => 'LocationType', | |
170 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 171 | 'localizable' => 0, |
a9d0587b | 172 | 'add' => '1.1', |
c3fc2621 CW |
173 | ], |
174 | 'description' => [ | |
e501603b TO |
175 | 'name' => 'description', |
176 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 177 | 'title' => ts('Description'), |
215b423e | 178 | 'description' => ts('Location Type Description.'), |
e501603b TO |
179 | 'maxlength' => 255, |
180 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 181 | 'where' => 'civicrm_location_type.description', |
522a26c9 | 182 | 'table_name' => 'civicrm_location_type', |
183 | 'entity' => 'LocationType', | |
184 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 185 | 'localizable' => 0, |
c23563e3 SL |
186 | 'html' => [ |
187 | 'label' => ts("Description"), | |
188 | ], | |
a9d0587b | 189 | 'add' => '1.1', |
c3fc2621 CW |
190 | ], |
191 | 'is_reserved' => [ | |
e501603b TO |
192 | 'name' => 'is_reserved', |
193 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 194 | 'title' => ts('Location Type is Reserved?'), |
215b423e | 195 | 'description' => ts('Is this location type a predefined system location?'), |
a36434b9 | 196 | 'where' => 'civicrm_location_type.is_reserved', |
522a26c9 | 197 | 'table_name' => 'civicrm_location_type', |
198 | 'entity' => 'LocationType', | |
199 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 200 | 'localizable' => 0, |
a9d0587b | 201 | 'add' => '1.1', |
c3fc2621 CW |
202 | ], |
203 | 'is_active' => [ | |
e501603b TO |
204 | 'name' => 'is_active', |
205 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 206 | 'title' => ts('Location Type is Active?'), |
215b423e | 207 | 'description' => ts('Is this property active?'), |
a36434b9 | 208 | 'where' => 'civicrm_location_type.is_active', |
522a26c9 | 209 | 'table_name' => 'civicrm_location_type', |
210 | 'entity' => 'LocationType', | |
211 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 212 | 'localizable' => 0, |
a9d0587b | 213 | 'add' => '1.1', |
c3fc2621 CW |
214 | ], |
215 | 'is_default' => [ | |
e501603b TO |
216 | 'name' => 'is_default', |
217 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 218 | 'title' => ts('Default Location Type?'), |
215b423e | 219 | 'description' => ts('Is this location type the default?'), |
a36434b9 | 220 | 'where' => 'civicrm_location_type.is_default', |
522a26c9 | 221 | 'table_name' => 'civicrm_location_type', |
222 | 'entity' => 'LocationType', | |
223 | 'bao' => 'CRM_Core_BAO_LocationType', | |
6a7e5e5d | 224 | 'localizable' => 0, |
a9d0587b | 225 | 'add' => '1.1', |
c3fc2621 CW |
226 | ], |
227 | ]; | |
346aaaba | 228 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 229 | } |
346aaaba | 230 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 231 | } |
c3fc2621 | 232 | |
e501603b | 233 | /** |
bd8e0b14 | 234 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
235 | * |
236 | * @return array | |
bd8e0b14 | 237 | * Array(string $name => string $uniqueName). |
e501603b | 238 | */ |
c3fc2621 | 239 | public static function &fieldKeys() { |
bd8e0b14 TO |
240 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
241 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 242 | } |
bd8e0b14 | 243 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 244 | } |
c3fc2621 | 245 | |
e501603b TO |
246 | /** |
247 | * Returns the names of this table | |
248 | * | |
249 | * @return string | |
250 | */ | |
c3fc2621 | 251 | public static function getTableName() { |
e501603b TO |
252 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
253 | } | |
c3fc2621 | 254 | |
e501603b TO |
255 | /** |
256 | * Returns if this table needs to be logged | |
257 | * | |
c3fc2621 | 258 | * @return bool |
e501603b | 259 | */ |
c3fc2621 | 260 | public function getLog() { |
e501603b TO |
261 | return self::$_log; |
262 | } | |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns the list of fields that can be imported | |
266 | * | |
267 | * @param bool $prefix | |
268 | * | |
269 | * @return array | |
270 | */ | |
c3fc2621 CW |
271 | public static function &import($prefix = FALSE) { |
272 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []); | |
60808919 | 273 | return $r; |
e501603b | 274 | } |
c3fc2621 | 275 | |
e501603b TO |
276 | /** |
277 | * Returns the list of fields that can be exported | |
278 | * | |
279 | * @param bool $prefix | |
280 | * | |
281 | * @return array | |
282 | */ | |
c3fc2621 CW |
283 | public static function &export($prefix = FALSE) { |
284 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []); | |
60808919 | 285 | return $r; |
e501603b | 286 | } |
c3fc2621 | 287 | |
e7a6b91a AS |
288 | /** |
289 | * Returns the list of indices | |
c3fc2621 CW |
290 | * |
291 | * @param bool $localize | |
292 | * | |
293 | * @return array | |
e7a6b91a AS |
294 | */ |
295 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
296 | $indices = [ |
297 | 'UI_name' => [ | |
e7a6b91a | 298 | 'name' => 'UI_name', |
c3fc2621 | 299 | 'field' => [ |
e7a6b91a | 300 | 0 => 'name', |
c3fc2621 CW |
301 | ], |
302 | 'localizable' => FALSE, | |
303 | 'unique' => TRUE, | |
e7a6b91a | 304 | 'sig' => 'civicrm_location_type::1::name', |
c3fc2621 CW |
305 | ], |
306 | ]; | |
e7a6b91a AS |
307 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
308 | } | |
c3fc2621 | 309 | |
e501603b | 310 | } |