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/SMS/Provider.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
929a1c14 | 9 | * (GenCodeChecksum:6ecda65bd52b36e04764cec8ee81e1b8) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Provider entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_SMS_DAO_Provider extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '4.2'; | |
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_sms_provider'; |
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 | * SMS Provider ID | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Provider internal name points to option_value of option_group sms_provider_name | |
42 | * | |
43 | * @var string | |
44 | */ | |
45 | public $name; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Provider name visible to user | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $title; | |
c3fc2621 | 53 | |
e501603b | 54 | /** |
e501603b TO |
55 | * @var string |
56 | */ | |
57 | public $username; | |
c3fc2621 | 58 | |
e501603b | 59 | /** |
e501603b TO |
60 | * @var string |
61 | */ | |
62 | public $password; | |
c3fc2621 | 63 | |
e501603b TO |
64 | /** |
65 | * points to value in civicrm_option_value for group sms_api_type | |
66 | * | |
e6ca0a57 | 67 | * @var int |
e501603b TO |
68 | */ |
69 | public $api_type; | |
c3fc2621 | 70 | |
e501603b | 71 | /** |
e501603b TO |
72 | * @var string |
73 | */ | |
74 | public $api_url; | |
c3fc2621 | 75 | |
e501603b TO |
76 | /** |
77 | * the api params in xml, http or smtp format | |
78 | * | |
79 | * @var text | |
80 | */ | |
81 | public $api_params; | |
c3fc2621 | 82 | |
e501603b | 83 | /** |
e6ca0a57 | 84 | * @var bool |
e501603b TO |
85 | */ |
86 | public $is_default; | |
c3fc2621 | 87 | |
e501603b | 88 | /** |
e6ca0a57 | 89 | * @var bool |
e501603b TO |
90 | */ |
91 | public $is_active; | |
c3fc2621 | 92 | |
4eae8dda SL |
93 | /** |
94 | * Which Domain is this sms provider for | |
95 | * | |
e6ca0a57 | 96 | * @var int |
4eae8dda SL |
97 | */ |
98 | public $domain_id; | |
c3fc2621 | 99 | |
e501603b | 100 | /** |
f41f0342 | 101 | * Class constructor. |
e501603b | 102 | */ |
c3fc2621 | 103 | public function __construct() { |
e501603b TO |
104 | $this->__table = 'civicrm_sms_provider'; |
105 | parent::__construct(); | |
106 | } | |
c3fc2621 | 107 | |
449c4e6b CW |
108 | /** |
109 | * Returns localized title of this entity. | |
110 | */ | |
111 | public static function getEntityTitle() { | |
112 | return ts('Providers'); | |
113 | } | |
114 | ||
4eae8dda SL |
115 | /** |
116 | * Returns foreign keys and entity references. | |
117 | * | |
118 | * @return array | |
119 | * [CRM_Core_Reference_Interface] | |
120 | */ | |
c3fc2621 | 121 | public static function getReferenceColumns() { |
4eae8dda | 122 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 123 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 124 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
4eae8dda SL |
125 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
126 | } | |
127 | return Civi::$statics[__CLASS__]['links']; | |
128 | } | |
c3fc2621 | 129 | |
e501603b TO |
130 | /** |
131 | * Returns all the column names of this table | |
132 | * | |
133 | * @return array | |
134 | */ | |
c3fc2621 | 135 | public static function &fields() { |
346aaaba | 136 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
137 | Civi::$statics[__CLASS__]['fields'] = [ |
138 | 'id' => [ | |
e501603b TO |
139 | 'name' => 'id', |
140 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 141 | 'title' => ts('SMS Provider ID'), |
215b423e | 142 | 'description' => ts('SMS Provider ID'), |
c3fc2621 | 143 | 'required' => TRUE, |
a36434b9 | 144 | 'where' => 'civicrm_sms_provider.id', |
522a26c9 | 145 | 'table_name' => 'civicrm_sms_provider', |
146 | 'entity' => 'Provider', | |
147 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 148 | 'localizable' => 0, |
a9d0587b | 149 | 'add' => '4.2', |
c3fc2621 CW |
150 | ], |
151 | 'name' => [ | |
e501603b TO |
152 | 'name' => 'name', |
153 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 154 | 'title' => ts('SMS Provider Name'), |
215b423e | 155 | 'description' => ts('Provider internal name points to option_value of option_group sms_provider_name'), |
e501603b TO |
156 | 'maxlength' => 64, |
157 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 158 | 'where' => 'civicrm_sms_provider.name', |
522a26c9 | 159 | 'table_name' => 'civicrm_sms_provider', |
160 | 'entity' => 'Provider', | |
161 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 162 | 'localizable' => 0, |
a9d0587b | 163 | 'add' => '4.2', |
c3fc2621 CW |
164 | ], |
165 | 'title' => [ | |
e501603b TO |
166 | 'name' => 'title', |
167 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 168 | 'title' => ts('SMS Provider Title'), |
215b423e | 169 | 'description' => ts('Provider name visible to user'), |
e501603b TO |
170 | 'maxlength' => 64, |
171 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 172 | 'where' => 'civicrm_sms_provider.title', |
522a26c9 | 173 | 'table_name' => 'civicrm_sms_provider', |
174 | 'entity' => 'Provider', | |
175 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 176 | 'localizable' => 0, |
c3fc2621 | 177 | 'html' => [ |
e501603b | 178 | 'type' => 'Text', |
c3fc2621 | 179 | ], |
a9d0587b | 180 | 'add' => '4.2', |
c3fc2621 CW |
181 | ], |
182 | 'username' => [ | |
e501603b TO |
183 | 'name' => 'username', |
184 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 185 | 'title' => ts('SMS Provider Username'), |
e501603b TO |
186 | 'maxlength' => 255, |
187 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 188 | 'where' => 'civicrm_sms_provider.username', |
522a26c9 | 189 | 'table_name' => 'civicrm_sms_provider', |
190 | 'entity' => 'Provider', | |
191 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 192 | 'localizable' => 0, |
c3fc2621 | 193 | 'html' => [ |
e501603b | 194 | 'type' => 'Text', |
c3fc2621 | 195 | ], |
a9d0587b | 196 | 'add' => '4.2', |
c3fc2621 CW |
197 | ], |
198 | 'password' => [ | |
e501603b TO |
199 | 'name' => 'password', |
200 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 201 | 'title' => ts('SMS Provider Password'), |
e501603b TO |
202 | 'maxlength' => 255, |
203 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 204 | 'where' => 'civicrm_sms_provider.password', |
522a26c9 | 205 | 'table_name' => 'civicrm_sms_provider', |
206 | 'entity' => 'Provider', | |
207 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 208 | 'localizable' => 0, |
c3fc2621 | 209 | 'html' => [ |
e501603b | 210 | 'type' => 'Text', |
c3fc2621 | 211 | ], |
a9d0587b | 212 | 'add' => '4.2', |
c3fc2621 CW |
213 | ], |
214 | 'api_type' => [ | |
e501603b TO |
215 | 'name' => 'api_type', |
216 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 217 | 'title' => ts('SMS Provider API'), |
215b423e | 218 | 'description' => ts('points to value in civicrm_option_value for group sms_api_type'), |
c3fc2621 | 219 | 'required' => TRUE, |
a36434b9 | 220 | 'where' => 'civicrm_sms_provider.api_type', |
522a26c9 | 221 | 'table_name' => 'civicrm_sms_provider', |
222 | 'entity' => 'Provider', | |
223 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 224 | 'localizable' => 0, |
c3fc2621 | 225 | 'html' => [ |
e501603b | 226 | 'type' => 'Select', |
c3fc2621 | 227 | ], |
2d129ae5 PN |
228 | 'pseudoconstant' => [ |
229 | 'optionGroupName' => 'sms_api_type', | |
230 | 'optionEditPath' => 'civicrm/admin/options/sms_api_type', | |
231 | ], | |
a9d0587b | 232 | 'add' => '4.2', |
c3fc2621 CW |
233 | ], |
234 | 'api_url' => [ | |
e501603b TO |
235 | 'name' => 'api_url', |
236 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 237 | 'title' => ts('SMS Provider API URL'), |
e501603b TO |
238 | 'maxlength' => 128, |
239 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 240 | 'where' => 'civicrm_sms_provider.api_url', |
522a26c9 | 241 | 'table_name' => 'civicrm_sms_provider', |
242 | 'entity' => 'Provider', | |
243 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 244 | 'localizable' => 0, |
c3fc2621 | 245 | 'html' => [ |
e501603b | 246 | 'type' => 'Text', |
c3fc2621 | 247 | ], |
a9d0587b | 248 | 'add' => '4.2', |
c3fc2621 CW |
249 | ], |
250 | 'api_params' => [ | |
e501603b TO |
251 | 'name' => 'api_params', |
252 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 253 | 'title' => ts('SMS Provider API Params'), |
215b423e | 254 | 'description' => ts('the api params in xml, http or smtp format'), |
a36434b9 | 255 | 'where' => 'civicrm_sms_provider.api_params', |
522a26c9 | 256 | 'table_name' => 'civicrm_sms_provider', |
257 | 'entity' => 'Provider', | |
258 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 259 | 'localizable' => 0, |
c3fc2621 | 260 | 'html' => [ |
e501603b | 261 | 'type' => 'Text', |
c3fc2621 | 262 | ], |
a9d0587b | 263 | 'add' => '4.2', |
c3fc2621 CW |
264 | ], |
265 | 'is_default' => [ | |
e501603b TO |
266 | 'name' => 'is_default', |
267 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 268 | 'title' => ts('SMS Provider is Default?'), |
a36434b9 | 269 | 'where' => 'civicrm_sms_provider.is_default', |
45a83e42 | 270 | 'default' => '0', |
522a26c9 | 271 | 'table_name' => 'civicrm_sms_provider', |
272 | 'entity' => 'Provider', | |
273 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 274 | 'localizable' => 0, |
c3fc2621 | 275 | 'html' => [ |
e501603b | 276 | 'type' => 'CheckBox', |
c3fc2621 | 277 | ], |
a9d0587b | 278 | 'add' => '4.2', |
c3fc2621 CW |
279 | ], |
280 | 'is_active' => [ | |
e501603b TO |
281 | 'name' => 'is_active', |
282 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 283 | 'title' => ts('SMS Provider is Active?'), |
a36434b9 | 284 | 'where' => 'civicrm_sms_provider.is_active', |
45a83e42 | 285 | 'default' => '0', |
522a26c9 | 286 | 'table_name' => 'civicrm_sms_provider', |
287 | 'entity' => 'Provider', | |
288 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 289 | 'localizable' => 0, |
c3fc2621 | 290 | 'html' => [ |
e501603b | 291 | 'type' => 'CheckBox', |
c3fc2621 | 292 | ], |
a9d0587b | 293 | 'add' => '4.2', |
c3fc2621 CW |
294 | ], |
295 | 'domain_id' => [ | |
4eae8dda SL |
296 | 'name' => 'domain_id', |
297 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 298 | 'title' => ts('SMS Domain'), |
215b423e | 299 | 'description' => ts('Which Domain is this sms provider for'), |
a36434b9 | 300 | 'where' => 'civicrm_sms_provider.domain_id', |
4eae8dda SL |
301 | 'table_name' => 'civicrm_sms_provider', |
302 | 'entity' => 'Provider', | |
303 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 304 | 'localizable' => 0, |
4eae8dda | 305 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 306 | 'pseudoconstant' => [ |
4eae8dda SL |
307 | 'table' => 'civicrm_domain', |
308 | 'keyColumn' => 'id', | |
309 | 'labelColumn' => 'name', | |
e6ca0a57 | 310 | ], |
a9d0587b | 311 | 'add' => '4.7', |
c3fc2621 CW |
312 | ], |
313 | ]; | |
346aaaba | 314 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 315 | } |
346aaaba | 316 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 317 | } |
c3fc2621 | 318 | |
e501603b | 319 | /** |
bd8e0b14 | 320 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
321 | * |
322 | * @return array | |
bd8e0b14 | 323 | * Array(string $name => string $uniqueName). |
e501603b | 324 | */ |
c3fc2621 | 325 | public static function &fieldKeys() { |
bd8e0b14 TO |
326 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
327 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 328 | } |
bd8e0b14 | 329 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 330 | } |
c3fc2621 | 331 | |
e501603b TO |
332 | /** |
333 | * Returns the names of this table | |
334 | * | |
335 | * @return string | |
336 | */ | |
c3fc2621 | 337 | public static function getTableName() { |
e501603b TO |
338 | return self::$_tableName; |
339 | } | |
c3fc2621 | 340 | |
e501603b TO |
341 | /** |
342 | * Returns if this table needs to be logged | |
343 | * | |
c3fc2621 | 344 | * @return bool |
e501603b | 345 | */ |
c3fc2621 | 346 | public function getLog() { |
e501603b TO |
347 | return self::$_log; |
348 | } | |
c3fc2621 | 349 | |
e501603b TO |
350 | /** |
351 | * Returns the list of fields that can be imported | |
352 | * | |
353 | * @param bool $prefix | |
354 | * | |
355 | * @return array | |
356 | */ | |
c3fc2621 CW |
357 | public static function &import($prefix = FALSE) { |
358 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, []); | |
60808919 | 359 | return $r; |
e501603b | 360 | } |
c3fc2621 | 361 | |
e501603b TO |
362 | /** |
363 | * Returns the list of fields that can be exported | |
364 | * | |
365 | * @param bool $prefix | |
366 | * | |
367 | * @return array | |
368 | */ | |
c3fc2621 CW |
369 | public static function &export($prefix = FALSE) { |
370 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, []); | |
60808919 | 371 | return $r; |
e501603b | 372 | } |
c3fc2621 | 373 | |
e7a6b91a AS |
374 | /** |
375 | * Returns the list of indices | |
c3fc2621 CW |
376 | * |
377 | * @param bool $localize | |
378 | * | |
379 | * @return array | |
e7a6b91a AS |
380 | */ |
381 | public static function indices($localize = TRUE) { | |
c3fc2621 | 382 | $indices = []; |
e7a6b91a AS |
383 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
384 | } | |
c3fc2621 | 385 | |
e501603b | 386 | } |