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 | |
7b66c3b5 | 9 | * (GenCodeChecksum:b49b5541f20c732fc7ff4cdc3687899b) |
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 TO |
33 | /** |
34 | * Timezone Id | |
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 TO |
66 | /** |
67 | * Country Id | |
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'), |
215b423e | 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, |
a9d0587b | 125 | 'add' => '1.8', |
c3fc2621 CW |
126 | ], |
127 | 'name' => [ | |
e501603b TO |
128 | 'name' => 'name', |
129 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 130 | 'title' => ts('Timezone Name'), |
215b423e | 131 | 'description' => ts('Timezone full name'), |
e501603b TO |
132 | 'maxlength' => 64, |
133 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 134 | 'where' => 'civicrm_timezone.name', |
522a26c9 | 135 | 'table_name' => 'civicrm_timezone', |
136 | 'entity' => 'Timezone', | |
137 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 138 | 'localizable' => 0, |
a9d0587b | 139 | 'add' => '1.8', |
c3fc2621 CW |
140 | ], |
141 | 'abbreviation' => [ | |
e501603b TO |
142 | 'name' => 'abbreviation', |
143 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 144 | 'title' => ts('Timezone Abbreviation'), |
215b423e | 145 | 'description' => ts('ISO Code for timezone abbreviation'), |
e501603b TO |
146 | 'maxlength' => 3, |
147 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 148 | 'where' => 'civicrm_timezone.abbreviation', |
522a26c9 | 149 | 'table_name' => 'civicrm_timezone', |
150 | 'entity' => 'Timezone', | |
151 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 152 | 'localizable' => 0, |
a9d0587b | 153 | 'add' => '1.8', |
c3fc2621 CW |
154 | ], |
155 | 'gmt' => [ | |
e501603b TO |
156 | 'name' => 'gmt', |
157 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 158 | 'title' => ts('GMT Name of Timezone'), |
215b423e | 159 | 'description' => ts('GMT name of the timezone'), |
e501603b TO |
160 | 'maxlength' => 64, |
161 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 162 | 'where' => 'civicrm_timezone.gmt', |
522a26c9 | 163 | 'table_name' => 'civicrm_timezone', |
164 | 'entity' => 'Timezone', | |
165 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 166 | 'localizable' => 0, |
a9d0587b | 167 | 'add' => '1.8', |
c3fc2621 CW |
168 | ], |
169 | 'offset' => [ | |
e501603b TO |
170 | 'name' => 'offset', |
171 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 172 | 'title' => ts('GMT Offset'), |
a36434b9 | 173 | 'where' => 'civicrm_timezone.offset', |
522a26c9 | 174 | 'table_name' => 'civicrm_timezone', |
175 | 'entity' => 'Timezone', | |
176 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 177 | 'localizable' => 0, |
a9d0587b | 178 | 'add' => '1.8', |
c3fc2621 CW |
179 | ], |
180 | 'country_id' => [ | |
e501603b TO |
181 | 'name' => 'country_id', |
182 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 183 | 'title' => ts('Country'), |
215b423e | 184 | 'description' => ts('Country Id'), |
c3fc2621 | 185 | 'required' => TRUE, |
a36434b9 | 186 | 'where' => 'civicrm_timezone.country_id', |
522a26c9 | 187 | 'table_name' => 'civicrm_timezone', |
188 | 'entity' => 'Timezone', | |
189 | 'bao' => 'CRM_Core_DAO_Timezone', | |
6a7e5e5d | 190 | 'localizable' => 0, |
e501603b | 191 | 'FKClassName' => 'CRM_Core_DAO_Country', |
a9d0587b | 192 | 'add' => '1.8', |
c3fc2621 CW |
193 | ], |
194 | ]; | |
346aaaba | 195 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 196 | } |
346aaaba | 197 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 198 | } |
c3fc2621 | 199 | |
e501603b | 200 | /** |
bd8e0b14 | 201 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
202 | * |
203 | * @return array | |
bd8e0b14 | 204 | * Array(string $name => string $uniqueName). |
e501603b | 205 | */ |
c3fc2621 | 206 | public static function &fieldKeys() { |
bd8e0b14 TO |
207 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
208 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 209 | } |
bd8e0b14 | 210 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 211 | } |
c3fc2621 | 212 | |
e501603b TO |
213 | /** |
214 | * Returns the names of this table | |
215 | * | |
216 | * @return string | |
217 | */ | |
c3fc2621 | 218 | public static function getTableName() { |
e501603b TO |
219 | return self::$_tableName; |
220 | } | |
c3fc2621 | 221 | |
e501603b TO |
222 | /** |
223 | * Returns if this table needs to be logged | |
224 | * | |
c3fc2621 | 225 | * @return bool |
e501603b | 226 | */ |
c3fc2621 | 227 | public function getLog() { |
e501603b TO |
228 | return self::$_log; |
229 | } | |
c3fc2621 | 230 | |
e501603b TO |
231 | /** |
232 | * Returns the list of fields that can be imported | |
233 | * | |
234 | * @param bool $prefix | |
235 | * | |
236 | * @return array | |
237 | */ | |
c3fc2621 CW |
238 | public static function &import($prefix = FALSE) { |
239 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []); | |
60808919 | 240 | return $r; |
e501603b | 241 | } |
c3fc2621 | 242 | |
e501603b TO |
243 | /** |
244 | * Returns the list of fields that can be exported | |
245 | * | |
246 | * @param bool $prefix | |
247 | * | |
248 | * @return array | |
249 | */ | |
c3fc2621 CW |
250 | public static function &export($prefix = FALSE) { |
251 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []); | |
60808919 | 252 | return $r; |
e501603b | 253 | } |
c3fc2621 | 254 | |
e7a6b91a AS |
255 | /** |
256 | * Returns the list of indices | |
c3fc2621 CW |
257 | * |
258 | * @param bool $localize | |
259 | * | |
260 | * @return array | |
e7a6b91a AS |
261 | */ |
262 | public static function indices($localize = TRUE) { | |
c3fc2621 | 263 | $indices = []; |
e7a6b91a AS |
264 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
265 | } | |
c3fc2621 | 266 | |
e501603b | 267 | } |