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/Country.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:3b3a4169f7747aa7b8fd5b6a81859e50) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Core_DAO_Country extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_country'; | |
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 | * Country Id | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * Country Name | |
59 | * | |
60 | * @var string | |
61 | */ | |
62 | public $name; | |
63 | /** | |
64 | * ISO Code | |
65 | * | |
66 | * @var string | |
67 | */ | |
68 | public $iso_code; | |
69 | /** | |
70 | * National prefix to be used when dialing TO this country. | |
71 | * | |
72 | * @var string | |
73 | */ | |
74 | public $country_code; | |
75 | /** | |
76 | * Foreign key to civicrm_address_format.id. | |
77 | * | |
78 | * @var int unsigned | |
79 | */ | |
80 | public $address_format_id; | |
81 | /** | |
82 | * International direct dialing prefix from within the country TO another country | |
83 | * | |
84 | * @var string | |
85 | */ | |
86 | public $idd_prefix; | |
87 | /** | |
88 | * Access prefix to call within a country to a different area | |
89 | * | |
90 | * @var string | |
91 | */ | |
92 | public $ndd_prefix; | |
93 | /** | |
94 | * Foreign key to civicrm_worldregion.id. | |
95 | * | |
96 | * @var int unsigned | |
97 | */ | |
98 | public $region_id; | |
99 | /** | |
100 | * Should state/province be displayed as abbreviation for contacts from this country? | |
101 | * | |
102 | * @var boolean | |
103 | */ | |
104 | public $is_province_abbreviated; | |
105 | /** | |
106 | * class constructor | |
107 | * | |
108 | * @return civicrm_country | |
109 | */ | |
110 | function __construct() { | |
111 | $this->__table = 'civicrm_country'; | |
112 | parent::__construct(); | |
113 | } | |
114 | /** | |
115 | * Returns foreign keys and entity references | |
116 | * | |
117 | * @return array | |
118 | * [CRM_Core_Reference_Interface] | |
119 | */ | |
120 | static function getReferenceColumns() { | |
346aaaba TO |
121 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
122 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
123 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_format_id', 'civicrm_address_format', 'id'); | |
124 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'region_id', 'civicrm_worldregion', 'id'); | |
125 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 126 | } |
346aaaba | 127 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
128 | } |
129 | /** | |
130 | * Returns all the column names of this table | |
131 | * | |
132 | * @return array | |
133 | */ | |
134 | static function &fields() { | |
346aaaba TO |
135 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
136 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
137 | 'id' => array( |
138 | 'name' => 'id', | |
139 | 'type' => CRM_Utils_Type::T_INT, | |
140 | 'title' => ts('Country ID') , | |
141 | 'description' => 'Country Id', | |
142 | 'required' => true, | |
143 | ) , | |
144 | 'name' => array( | |
145 | 'name' => 'name', | |
146 | 'type' => CRM_Utils_Type::T_STRING, | |
147 | 'title' => ts('Country') , | |
148 | 'description' => 'Country Name', | |
149 | 'maxlength' => 64, | |
150 | 'size' => CRM_Utils_Type::BIG, | |
151 | 'import' => true, | |
152 | 'where' => 'civicrm_country.name', | |
153 | 'headerPattern' => '/country/i', | |
154 | 'dataPattern' => '/^[A-Z][a-z]+\.?(\s+[A-Z][a-z]+){0,3}$/', | |
155 | 'export' => true, | |
156 | ) , | |
157 | 'iso_code' => array( | |
158 | 'name' => 'iso_code', | |
159 | 'type' => CRM_Utils_Type::T_STRING, | |
160 | 'title' => ts('Country ISO Code') , | |
161 | 'description' => 'ISO Code', | |
162 | 'maxlength' => 2, | |
163 | 'size' => CRM_Utils_Type::TWO, | |
164 | ) , | |
165 | 'country_code' => array( | |
166 | 'name' => 'country_code', | |
167 | 'type' => CRM_Utils_Type::T_STRING, | |
168 | 'title' => ts('Country Phone Prefix') , | |
169 | 'description' => 'National prefix to be used when dialing TO this country.', | |
170 | 'maxlength' => 4, | |
171 | 'size' => CRM_Utils_Type::FOUR, | |
172 | ) , | |
173 | 'address_format_id' => array( | |
174 | 'name' => 'address_format_id', | |
175 | 'type' => CRM_Utils_Type::T_INT, | |
176 | 'title' => ts('Address Format') , | |
177 | 'description' => 'Foreign key to civicrm_address_format.id.', | |
178 | 'FKClassName' => 'CRM_Core_DAO_AddressFormat', | |
179 | ) , | |
180 | 'idd_prefix' => array( | |
181 | 'name' => 'idd_prefix', | |
182 | 'type' => CRM_Utils_Type::T_STRING, | |
183 | 'title' => ts('Outgoing Phone Prefix') , | |
184 | 'description' => 'International direct dialing prefix from within the country TO another country', | |
185 | 'maxlength' => 4, | |
186 | 'size' => CRM_Utils_Type::FOUR, | |
187 | ) , | |
188 | 'ndd_prefix' => array( | |
189 | 'name' => 'ndd_prefix', | |
190 | 'type' => CRM_Utils_Type::T_STRING, | |
191 | 'title' => ts('Area Code') , | |
192 | 'description' => 'Access prefix to call within a country to a different area', | |
193 | 'maxlength' => 4, | |
194 | 'size' => CRM_Utils_Type::FOUR, | |
195 | ) , | |
196 | 'region_id' => array( | |
197 | 'name' => 'region_id', | |
198 | 'type' => CRM_Utils_Type::T_INT, | |
199 | 'title' => ts('Region') , | |
200 | 'description' => 'Foreign key to civicrm_worldregion.id.', | |
201 | 'required' => true, | |
202 | 'FKClassName' => 'CRM_Core_DAO_Worldregion', | |
203 | ) , | |
204 | 'is_province_abbreviated' => array( | |
205 | 'name' => 'is_province_abbreviated', | |
206 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
207 | 'title' => ts('Abbreviate Province?') , | |
208 | 'description' => 'Should state/province be displayed as abbreviation for contacts from this country?', | |
209 | ) , | |
210 | ); | |
346aaaba | 211 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 212 | } |
346aaaba | 213 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
214 | } |
215 | /** | |
bd8e0b14 | 216 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
217 | * |
218 | * @return array | |
bd8e0b14 | 219 | * Array(string $name => string $uniqueName). |
e501603b TO |
220 | */ |
221 | static function &fieldKeys() { | |
bd8e0b14 TO |
222 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
223 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 224 | } |
bd8e0b14 | 225 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
226 | } |
227 | /** | |
228 | * Returns the names of this table | |
229 | * | |
230 | * @return string | |
231 | */ | |
232 | static function getTableName() { | |
233 | return self::$_tableName; | |
234 | } | |
235 | /** | |
236 | * Returns if this table needs to be logged | |
237 | * | |
238 | * @return boolean | |
239 | */ | |
240 | function getLog() { | |
241 | return self::$_log; | |
242 | } | |
243 | /** | |
244 | * Returns the list of fields that can be imported | |
245 | * | |
246 | * @param bool $prefix | |
247 | * | |
248 | * @return array | |
249 | */ | |
250 | static function &import($prefix = false) { | |
60808919 TO |
251 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'country', $prefix, array()); |
252 | return $r; | |
e501603b TO |
253 | } |
254 | /** | |
255 | * Returns the list of fields that can be exported | |
256 | * | |
257 | * @param bool $prefix | |
258 | * | |
259 | * @return array | |
260 | */ | |
261 | static function &export($prefix = false) { | |
60808919 TO |
262 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'country', $prefix, array()); |
263 | return $r; | |
e501603b TO |
264 | } |
265 | } |