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 | |
88c31c05 | 9 | * (GenCodeChecksum:3825081bc48abd82f194a390677769bd) |
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. | |
7b66c3b5 AH |
110 | * |
111 | * @param bool $plural | |
112 | * Whether to return the plural version of the title. | |
449c4e6b | 113 | */ |
7b66c3b5 AH |
114 | public static function getEntityTitle($plural = FALSE) { |
115 | return $plural ? ts('Providers') : ts('Provider'); | |
449c4e6b CW |
116 | } |
117 | ||
4eae8dda SL |
118 | /** |
119 | * Returns foreign keys and entity references. | |
120 | * | |
121 | * @return array | |
122 | * [CRM_Core_Reference_Interface] | |
123 | */ | |
c3fc2621 | 124 | public static function getReferenceColumns() { |
4eae8dda | 125 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 126 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 127 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
4eae8dda SL |
128 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
129 | } | |
130 | return Civi::$statics[__CLASS__]['links']; | |
131 | } | |
c3fc2621 | 132 | |
e501603b TO |
133 | /** |
134 | * Returns all the column names of this table | |
135 | * | |
136 | * @return array | |
137 | */ | |
c3fc2621 | 138 | public static function &fields() { |
346aaaba | 139 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
140 | Civi::$statics[__CLASS__]['fields'] = [ |
141 | 'id' => [ | |
e501603b TO |
142 | 'name' => 'id', |
143 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 144 | 'title' => ts('SMS Provider ID'), |
215b423e | 145 | 'description' => ts('SMS Provider ID'), |
c3fc2621 | 146 | 'required' => TRUE, |
a36434b9 | 147 | 'where' => 'civicrm_sms_provider.id', |
522a26c9 | 148 | 'table_name' => 'civicrm_sms_provider', |
149 | 'entity' => 'Provider', | |
150 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 151 | 'localizable' => 0, |
2cbbebe8 A |
152 | 'html' => [ |
153 | 'type' => 'Number', | |
154 | ], | |
1fe423d6 | 155 | 'readonly' => TRUE, |
a9d0587b | 156 | 'add' => '4.2', |
c3fc2621 CW |
157 | ], |
158 | 'name' => [ | |
e501603b TO |
159 | 'name' => 'name', |
160 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 161 | 'title' => ts('SMS Provider Name'), |
215b423e | 162 | 'description' => ts('Provider internal name points to option_value of option_group sms_provider_name'), |
e501603b TO |
163 | 'maxlength' => 64, |
164 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 165 | 'where' => 'civicrm_sms_provider.name', |
522a26c9 | 166 | 'table_name' => 'civicrm_sms_provider', |
167 | 'entity' => 'Provider', | |
168 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 169 | 'localizable' => 0, |
a9d0587b | 170 | 'add' => '4.2', |
c3fc2621 CW |
171 | ], |
172 | 'title' => [ | |
e501603b TO |
173 | 'name' => 'title', |
174 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 175 | 'title' => ts('SMS Provider Title'), |
215b423e | 176 | 'description' => ts('Provider name visible to user'), |
e501603b TO |
177 | 'maxlength' => 64, |
178 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 179 | 'where' => 'civicrm_sms_provider.title', |
522a26c9 | 180 | 'table_name' => 'civicrm_sms_provider', |
181 | 'entity' => 'Provider', | |
182 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 183 | 'localizable' => 0, |
c3fc2621 | 184 | 'html' => [ |
e501603b | 185 | 'type' => 'Text', |
c3fc2621 | 186 | ], |
a9d0587b | 187 | 'add' => '4.2', |
c3fc2621 CW |
188 | ], |
189 | 'username' => [ | |
e501603b TO |
190 | 'name' => 'username', |
191 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 192 | 'title' => ts('SMS Provider Username'), |
e501603b TO |
193 | 'maxlength' => 255, |
194 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 195 | 'where' => 'civicrm_sms_provider.username', |
522a26c9 | 196 | 'table_name' => 'civicrm_sms_provider', |
197 | 'entity' => 'Provider', | |
198 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 199 | 'localizable' => 0, |
c3fc2621 | 200 | 'html' => [ |
e501603b | 201 | 'type' => 'Text', |
c3fc2621 | 202 | ], |
a9d0587b | 203 | 'add' => '4.2', |
c3fc2621 CW |
204 | ], |
205 | 'password' => [ | |
e501603b TO |
206 | 'name' => 'password', |
207 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 208 | 'title' => ts('SMS Provider Password'), |
e501603b TO |
209 | 'maxlength' => 255, |
210 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 211 | 'where' => 'civicrm_sms_provider.password', |
522a26c9 | 212 | 'table_name' => 'civicrm_sms_provider', |
213 | 'entity' => 'Provider', | |
214 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 215 | 'localizable' => 0, |
c3fc2621 | 216 | 'html' => [ |
e501603b | 217 | 'type' => 'Text', |
c3fc2621 | 218 | ], |
a9d0587b | 219 | 'add' => '4.2', |
c3fc2621 CW |
220 | ], |
221 | 'api_type' => [ | |
e501603b TO |
222 | 'name' => 'api_type', |
223 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 224 | 'title' => ts('SMS Provider API'), |
215b423e | 225 | 'description' => ts('points to value in civicrm_option_value for group sms_api_type'), |
c3fc2621 | 226 | 'required' => TRUE, |
a36434b9 | 227 | 'where' => 'civicrm_sms_provider.api_type', |
522a26c9 | 228 | 'table_name' => 'civicrm_sms_provider', |
229 | 'entity' => 'Provider', | |
230 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 231 | 'localizable' => 0, |
c3fc2621 | 232 | 'html' => [ |
e501603b | 233 | 'type' => 'Select', |
c3fc2621 | 234 | ], |
2d129ae5 PN |
235 | 'pseudoconstant' => [ |
236 | 'optionGroupName' => 'sms_api_type', | |
237 | 'optionEditPath' => 'civicrm/admin/options/sms_api_type', | |
238 | ], | |
a9d0587b | 239 | 'add' => '4.2', |
c3fc2621 CW |
240 | ], |
241 | 'api_url' => [ | |
e501603b TO |
242 | 'name' => 'api_url', |
243 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 244 | 'title' => ts('SMS Provider API URL'), |
e501603b TO |
245 | 'maxlength' => 128, |
246 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 247 | 'where' => 'civicrm_sms_provider.api_url', |
522a26c9 | 248 | 'table_name' => 'civicrm_sms_provider', |
249 | 'entity' => 'Provider', | |
250 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 251 | 'localizable' => 0, |
c3fc2621 | 252 | 'html' => [ |
e501603b | 253 | 'type' => 'Text', |
c3fc2621 | 254 | ], |
a9d0587b | 255 | 'add' => '4.2', |
c3fc2621 CW |
256 | ], |
257 | 'api_params' => [ | |
e501603b TO |
258 | 'name' => 'api_params', |
259 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 260 | 'title' => ts('SMS Provider API Params'), |
215b423e | 261 | 'description' => ts('the api params in xml, http or smtp format'), |
a36434b9 | 262 | 'where' => 'civicrm_sms_provider.api_params', |
522a26c9 | 263 | 'table_name' => 'civicrm_sms_provider', |
264 | 'entity' => 'Provider', | |
265 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 266 | 'localizable' => 0, |
c3fc2621 | 267 | 'html' => [ |
e501603b | 268 | 'type' => 'Text', |
c3fc2621 | 269 | ], |
a9d0587b | 270 | 'add' => '4.2', |
c3fc2621 CW |
271 | ], |
272 | 'is_default' => [ | |
e501603b TO |
273 | 'name' => 'is_default', |
274 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 275 | 'title' => ts('SMS Provider is Default?'), |
a36434b9 | 276 | 'where' => 'civicrm_sms_provider.is_default', |
45a83e42 | 277 | 'default' => '0', |
522a26c9 | 278 | 'table_name' => 'civicrm_sms_provider', |
279 | 'entity' => 'Provider', | |
280 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 281 | 'localizable' => 0, |
c3fc2621 | 282 | 'html' => [ |
e501603b | 283 | 'type' => 'CheckBox', |
c3fc2621 | 284 | ], |
a9d0587b | 285 | 'add' => '4.2', |
c3fc2621 CW |
286 | ], |
287 | 'is_active' => [ | |
e501603b TO |
288 | 'name' => 'is_active', |
289 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 290 | 'title' => ts('SMS Provider is Active?'), |
a36434b9 | 291 | 'where' => 'civicrm_sms_provider.is_active', |
45a83e42 | 292 | 'default' => '0', |
522a26c9 | 293 | 'table_name' => 'civicrm_sms_provider', |
294 | 'entity' => 'Provider', | |
295 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 296 | 'localizable' => 0, |
c3fc2621 | 297 | 'html' => [ |
e501603b | 298 | 'type' => 'CheckBox', |
c3fc2621 | 299 | ], |
a9d0587b | 300 | 'add' => '4.2', |
c3fc2621 CW |
301 | ], |
302 | 'domain_id' => [ | |
4eae8dda SL |
303 | 'name' => 'domain_id', |
304 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 305 | 'title' => ts('Domain ID'), |
215b423e | 306 | 'description' => ts('Which Domain is this sms provider for'), |
a36434b9 | 307 | 'where' => 'civicrm_sms_provider.domain_id', |
4eae8dda SL |
308 | 'table_name' => 'civicrm_sms_provider', |
309 | 'entity' => 'Provider', | |
310 | 'bao' => 'CRM_SMS_BAO_Provider', | |
6a7e5e5d | 311 | 'localizable' => 0, |
4eae8dda | 312 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
2cbbebe8 A |
313 | 'html' => [ |
314 | 'label' => ts("Domain"), | |
315 | ], | |
c3fc2621 | 316 | 'pseudoconstant' => [ |
4eae8dda SL |
317 | 'table' => 'civicrm_domain', |
318 | 'keyColumn' => 'id', | |
319 | 'labelColumn' => 'name', | |
e6ca0a57 | 320 | ], |
a9d0587b | 321 | 'add' => '4.7', |
c3fc2621 CW |
322 | ], |
323 | ]; | |
346aaaba | 324 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 325 | } |
346aaaba | 326 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 327 | } |
c3fc2621 | 328 | |
e501603b | 329 | /** |
bd8e0b14 | 330 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
331 | * |
332 | * @return array | |
bd8e0b14 | 333 | * Array(string $name => string $uniqueName). |
e501603b | 334 | */ |
c3fc2621 | 335 | public static function &fieldKeys() { |
bd8e0b14 TO |
336 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
337 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 338 | } |
bd8e0b14 | 339 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 340 | } |
c3fc2621 | 341 | |
e501603b TO |
342 | /** |
343 | * Returns the names of this table | |
344 | * | |
345 | * @return string | |
346 | */ | |
c3fc2621 | 347 | public static function getTableName() { |
e501603b TO |
348 | return self::$_tableName; |
349 | } | |
c3fc2621 | 350 | |
e501603b TO |
351 | /** |
352 | * Returns if this table needs to be logged | |
353 | * | |
c3fc2621 | 354 | * @return bool |
e501603b | 355 | */ |
c3fc2621 | 356 | public function getLog() { |
e501603b TO |
357 | return self::$_log; |
358 | } | |
c3fc2621 | 359 | |
e501603b TO |
360 | /** |
361 | * Returns the list of fields that can be imported | |
362 | * | |
363 | * @param bool $prefix | |
364 | * | |
365 | * @return array | |
366 | */ | |
c3fc2621 CW |
367 | public static function &import($prefix = FALSE) { |
368 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, []); | |
60808919 | 369 | return $r; |
e501603b | 370 | } |
c3fc2621 | 371 | |
e501603b TO |
372 | /** |
373 | * Returns the list of fields that can be exported | |
374 | * | |
375 | * @param bool $prefix | |
376 | * | |
377 | * @return array | |
378 | */ | |
c3fc2621 CW |
379 | public static function &export($prefix = FALSE) { |
380 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, []); | |
60808919 | 381 | return $r; |
e501603b | 382 | } |
c3fc2621 | 383 | |
e7a6b91a AS |
384 | /** |
385 | * Returns the list of indices | |
c3fc2621 CW |
386 | * |
387 | * @param bool $localize | |
388 | * | |
389 | * @return array | |
e7a6b91a AS |
390 | */ |
391 | public static function indices($localize = TRUE) { | |
c3fc2621 | 392 | $indices = []; |
e7a6b91a AS |
393 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
394 | } | |
c3fc2621 | 395 | |
e501603b | 396 | } |