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/Timezone.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
2562d09a | 9 | * (GenCodeChecksum:a1960975c14d40dedac3cbf6121044db) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Timezone entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_Timezone extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.8'; | |
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_timezone'; |
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 = FALSE; |
c3fc2621 | 32 | |
e501603b | 33 | /** |
2cbbebe8 | 34 | * Timezone ID |
e501603b | 35 | * |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Timezone full name | |
42 | * | |
43 | * @var string | |
44 | */ | |
45 | public $name; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * ISO Code for timezone abbreviation | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $abbreviation; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * GMT name of the timezone | |
56 | * | |
57 | * @var string | |
58 | */ | |
59 | public $gmt; | |
c3fc2621 | 60 | |
e501603b | 61 | /** |
e501603b TO |
62 | * @var int |
63 | */ | |
64 | public $offset; | |
c3fc2621 | 65 | |
e501603b | 66 | /** |
2cbbebe8 | 67 | * Country ID |
e501603b | 68 | * |
e6ca0a57 | 69 | * @var int |
e501603b TO |
70 | */ |
71 | public $country_id; | |
c3fc2621 | 72 | |
e501603b | 73 | /** |
f41f0342 | 74 | * Class constructor. |
e501603b | 75 | */ |
c3fc2621 | 76 | public function __construct() { |
e501603b TO |
77 | $this->__table = 'civicrm_timezone'; |
78 | parent::__construct(); | |
79 | } | |
c3fc2621 | 80 | |
449c4e6b CW |
81 | /** |
82 | * Returns localized title of this entity. | |
7b66c3b5 AH |
83 | * |
84 | * @param bool $plural | |
85 | * Whether to return the plural version of the title. | |
449c4e6b | 86 | */ |
7b66c3b5 AH |
87 | public static function getEntityTitle($plural = FALSE) { |
88 | return $plural ? ts('Timezones') : ts('Timezone'); | |
449c4e6b CW |
89 | } |
90 | ||
e501603b | 91 | /** |
f41f0342 | 92 | * Returns foreign keys and entity references. |
e501603b TO |
93 | * |
94 | * @return array | |
95 | * [CRM_Core_Reference_Interface] | |
96 | */ | |
c3fc2621 | 97 | public static function getReferenceColumns() { |
346aaaba | 98 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 99 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 100 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'country_id', 'civicrm_country', 'id'); |
346aaaba | 101 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 102 | } |
346aaaba | 103 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 104 | } |
c3fc2621 | 105 | |
e501603b TO |
106 | /** |
107 | * Returns all the column names of this table | |
108 | * | |
109 | * @return array | |
110 | */ | |
c3fc2621 | 111 | public static function &fields() { |
346aaaba | 112 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
113 | Civi::$statics[__CLASS__]['fields'] = [ |
114 | 'id' => [ | |
e501603b TO |
115 | 'name' => 'id', |
116 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 117 | 'title' => ts('Timezone ID'), |
2cbbebe8 | 118 | 'description' => ts('Timezone ID'), |
c3fc2621 | 119 | 'required' => TRUE, |
a36434b9 | 120 | 'where' => 'civicrm_timezone.id', |
522a26c9 | 121 | 'table_name' => 'civicrm_timezone', |
122 | 'entity' => 'Timezone', | |
123 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 124 | 'localizable' => 0, |
2cbbebe8 A |
125 | 'html' => [ |
126 | 'type' => 'Number', | |
127 | ], | |
1fe423d6 | 128 | 'readonly' => TRUE, |
a9d0587b | 129 | 'add' => '1.8', |
c3fc2621 CW |
130 | ], |
131 | 'name' => [ | |
e501603b TO |
132 | 'name' => 'name', |
133 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 134 | 'title' => ts('Timezone Name'), |
215b423e | 135 | 'description' => ts('Timezone full name'), |
e501603b TO |
136 | 'maxlength' => 64, |
137 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 138 | 'where' => 'civicrm_timezone.name', |
522a26c9 | 139 | 'table_name' => 'civicrm_timezone', |
140 | 'entity' => 'Timezone', | |
141 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 142 | 'localizable' => 0, |
a9d0587b | 143 | 'add' => '1.8', |
c3fc2621 CW |
144 | ], |
145 | 'abbreviation' => [ | |
e501603b TO |
146 | 'name' => 'abbreviation', |
147 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 148 | 'title' => ts('Timezone Abbreviation'), |
215b423e | 149 | 'description' => ts('ISO Code for timezone abbreviation'), |
e501603b TO |
150 | 'maxlength' => 3, |
151 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 152 | 'where' => 'civicrm_timezone.abbreviation', |
522a26c9 | 153 | 'table_name' => 'civicrm_timezone', |
154 | 'entity' => 'Timezone', | |
155 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 156 | 'localizable' => 0, |
a9d0587b | 157 | 'add' => '1.8', |
c3fc2621 CW |
158 | ], |
159 | 'gmt' => [ | |
e501603b TO |
160 | 'name' => 'gmt', |
161 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 162 | 'title' => ts('GMT Name of Timezone'), |
215b423e | 163 | 'description' => ts('GMT name of the timezone'), |
e501603b TO |
164 | 'maxlength' => 64, |
165 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 166 | 'where' => 'civicrm_timezone.gmt', |
522a26c9 | 167 | 'table_name' => 'civicrm_timezone', |
168 | 'entity' => 'Timezone', | |
169 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 170 | 'localizable' => 0, |
a9d0587b | 171 | 'add' => '1.8', |
c3fc2621 CW |
172 | ], |
173 | 'offset' => [ | |
e501603b TO |
174 | 'name' => 'offset', |
175 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 176 | 'title' => ts('GMT Offset'), |
a36434b9 | 177 | 'where' => 'civicrm_timezone.offset', |
522a26c9 | 178 | 'table_name' => 'civicrm_timezone', |
179 | 'entity' => 'Timezone', | |
180 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 181 | 'localizable' => 0, |
a9d0587b | 182 | 'add' => '1.8', |
c3fc2621 CW |
183 | ], |
184 | 'country_id' => [ | |
e501603b TO |
185 | 'name' => 'country_id', |
186 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 A |
187 | 'title' => ts('Country ID'), |
188 | 'description' => ts('Country ID'), | |
c3fc2621 | 189 | 'required' => TRUE, |
a36434b9 | 190 | 'where' => 'civicrm_timezone.country_id', |
522a26c9 | 191 | 'table_name' => 'civicrm_timezone', |
192 | 'entity' => 'Timezone', | |
193 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 194 | 'localizable' => 0, |
e501603b | 195 | 'FKClassName' => 'CRM_Core_DAO_Country', |
2cbbebe8 A |
196 | 'html' => [ |
197 | 'label' => ts("Country"), | |
198 | ], | |
a9d0587b | 199 | 'add' => '1.8', |
c3fc2621 CW |
200 | ], |
201 | ]; | |
346aaaba | 202 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 203 | } |
346aaaba | 204 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 205 | } |
c3fc2621 | 206 | |
e501603b | 207 | /** |
bd8e0b14 | 208 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
209 | * |
210 | * @return array | |
bd8e0b14 | 211 | * Array(string $name => string $uniqueName). |
e501603b | 212 | */ |
c3fc2621 | 213 | public static function &fieldKeys() { |
bd8e0b14 TO |
214 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
215 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 216 | } |
bd8e0b14 | 217 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 218 | } |
c3fc2621 | 219 | |
e501603b TO |
220 | /** |
221 | * Returns the names of this table | |
222 | * | |
223 | * @return string | |
224 | */ | |
c3fc2621 | 225 | public static function getTableName() { |
e501603b TO |
226 | return self::$_tableName; |
227 | } | |
c3fc2621 | 228 | |
e501603b TO |
229 | /** |
230 | * Returns if this table needs to be logged | |
231 | * | |
c3fc2621 | 232 | * @return bool |
e501603b | 233 | */ |
c3fc2621 | 234 | public function getLog() { |
e501603b TO |
235 | return self::$_log; |
236 | } | |
c3fc2621 | 237 | |
e501603b TO |
238 | /** |
239 | * Returns the list of fields that can be imported | |
240 | * | |
241 | * @param bool $prefix | |
242 | * | |
243 | * @return array | |
244 | */ | |
c3fc2621 CW |
245 | public static function &import($prefix = FALSE) { |
246 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []); | |
60808919 | 247 | return $r; |
e501603b | 248 | } |
c3fc2621 | 249 | |
e501603b TO |
250 | /** |
251 | * Returns the list of fields that can be exported | |
252 | * | |
253 | * @param bool $prefix | |
254 | * | |
255 | * @return array | |
256 | */ | |
c3fc2621 CW |
257 | public static function &export($prefix = FALSE) { |
258 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []); | |
60808919 | 259 | return $r; |
e501603b | 260 | } |
c3fc2621 | 261 | |
e7a6b91a AS |
262 | /** |
263 | * Returns the list of indices | |
c3fc2621 CW |
264 | * |
265 | * @param bool $localize | |
266 | * | |
267 | * @return array | |
e7a6b91a AS |
268 | */ |
269 | public static function indices($localize = TRUE) { | |
c3fc2621 | 270 | $indices = []; |
e7a6b91a AS |
271 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
272 | } | |
c3fc2621 | 273 | |
e501603b | 274 | } |