Merge pull request #9773 from monishdeb/CRM-19663
[civicrm-core.git] / CRM / SMS / DAO / Provider.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
30 *
31 * Generated from xml/schema/CRM/SMS/Provider.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:cae173c565ecbc84ccb905d80f1de8c1)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_SMS_DAO_Provider constructor.
39 */
40 class CRM_SMS_DAO_Provider extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_sms_provider';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * SMS Provider ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Provider internal name points to option_value of option_group sms_provider_name
61 *
62 * @var string
63 */
64 public $name;
65 /**
66 * Provider name visible to user
67 *
68 * @var string
69 */
70 public $title;
71 /**
72 *
73 * @var string
74 */
75 public $username;
76 /**
77 *
78 * @var string
79 */
80 public $password;
81 /**
82 * points to value in civicrm_option_value for group sms_api_type
83 *
84 * @var int unsigned
85 */
86 public $api_type;
87 /**
88 *
89 * @var string
90 */
91 public $api_url;
92 /**
93 * the api params in xml, http or smtp format
94 *
95 * @var text
96 */
97 public $api_params;
98 /**
99 *
100 * @var boolean
101 */
102 public $is_default;
103 /**
104 *
105 * @var boolean
106 */
107 public $is_active;
108 /**
109 * Which Domain is this sms provider for
110 *
111 * @var int unsigned
112 */
113 public $domain_id;
114 /**
115 * Class constructor.
116 */
117 function __construct() {
118 $this->__table = 'civicrm_sms_provider';
119 parent::__construct();
120 }
121 /**
122 * Returns foreign keys and entity references.
123 *
124 * @return array
125 * [CRM_Core_Reference_Interface]
126 */
127 static function getReferenceColumns() {
128 if (!isset(Civi::$statics[__CLASS__]['links'])) {
129 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
130 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
131 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
132 }
133 return Civi::$statics[__CLASS__]['links'];
134 }
135 /**
136 * Returns all the column names of this table
137 *
138 * @return array
139 */
140 static function &fields() {
141 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
142 Civi::$statics[__CLASS__]['fields'] = array(
143 'id' => array(
144 'name' => 'id',
145 'type' => CRM_Utils_Type::T_INT,
146 'title' => ts('SMS Provider ID') ,
147 'description' => 'SMS Provider ID',
148 'required' => true,
149 'table_name' => 'civicrm_sms_provider',
150 'entity' => 'Provider',
151 'bao' => 'CRM_SMS_BAO_Provider',
152 'localizable' => 0,
153 ) ,
154 'name' => array(
155 'name' => 'name',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('SMS Provider Name') ,
158 'description' => 'Provider internal name points to option_value of option_group sms_provider_name',
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
161 'table_name' => 'civicrm_sms_provider',
162 'entity' => 'Provider',
163 'bao' => 'CRM_SMS_BAO_Provider',
164 'localizable' => 0,
165 ) ,
166 'title' => array(
167 'name' => 'title',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('SMS Provider Title') ,
170 'description' => 'Provider name visible to user',
171 'maxlength' => 64,
172 'size' => CRM_Utils_Type::BIG,
173 'table_name' => 'civicrm_sms_provider',
174 'entity' => 'Provider',
175 'bao' => 'CRM_SMS_BAO_Provider',
176 'localizable' => 0,
177 'html' => array(
178 'type' => 'Text',
179 ) ,
180 ) ,
181 'username' => array(
182 'name' => 'username',
183 'type' => CRM_Utils_Type::T_STRING,
184 'title' => ts('SMS Provider Username') ,
185 'maxlength' => 255,
186 'size' => CRM_Utils_Type::HUGE,
187 'table_name' => 'civicrm_sms_provider',
188 'entity' => 'Provider',
189 'bao' => 'CRM_SMS_BAO_Provider',
190 'localizable' => 0,
191 'html' => array(
192 'type' => 'Text',
193 ) ,
194 ) ,
195 'password' => array(
196 'name' => 'password',
197 'type' => CRM_Utils_Type::T_STRING,
198 'title' => ts('SMS Provider Password') ,
199 'maxlength' => 255,
200 'size' => CRM_Utils_Type::HUGE,
201 'table_name' => 'civicrm_sms_provider',
202 'entity' => 'Provider',
203 'bao' => 'CRM_SMS_BAO_Provider',
204 'localizable' => 0,
205 'html' => array(
206 'type' => 'Text',
207 ) ,
208 ) ,
209 'api_type' => array(
210 'name' => 'api_type',
211 'type' => CRM_Utils_Type::T_INT,
212 'title' => ts('SMS Provider API') ,
213 'description' => 'points to value in civicrm_option_value for group sms_api_type',
214 'required' => true,
215 'table_name' => 'civicrm_sms_provider',
216 'entity' => 'Provider',
217 'bao' => 'CRM_SMS_BAO_Provider',
218 'localizable' => 0,
219 'html' => array(
220 'type' => 'Select',
221 ) ,
222 ) ,
223 'api_url' => array(
224 'name' => 'api_url',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('SMS Provider API URL') ,
227 'maxlength' => 128,
228 'size' => CRM_Utils_Type::HUGE,
229 'table_name' => 'civicrm_sms_provider',
230 'entity' => 'Provider',
231 'bao' => 'CRM_SMS_BAO_Provider',
232 'localizable' => 0,
233 'html' => array(
234 'type' => 'Text',
235 ) ,
236 ) ,
237 'api_params' => array(
238 'name' => 'api_params',
239 'type' => CRM_Utils_Type::T_TEXT,
240 'title' => ts('SMS Provider API Params') ,
241 'description' => 'the api params in xml, http or smtp format',
242 'table_name' => 'civicrm_sms_provider',
243 'entity' => 'Provider',
244 'bao' => 'CRM_SMS_BAO_Provider',
245 'localizable' => 0,
246 'html' => array(
247 'type' => 'Text',
248 ) ,
249 ) ,
250 'is_default' => array(
251 'name' => 'is_default',
252 'type' => CRM_Utils_Type::T_BOOLEAN,
253 'title' => ts('SMS Provider is Default?') ,
254 'table_name' => 'civicrm_sms_provider',
255 'entity' => 'Provider',
256 'bao' => 'CRM_SMS_BAO_Provider',
257 'localizable' => 0,
258 'html' => array(
259 'type' => 'CheckBox',
260 ) ,
261 ) ,
262 'is_active' => array(
263 'name' => 'is_active',
264 'type' => CRM_Utils_Type::T_BOOLEAN,
265 'title' => ts('SMS Provider is Active?') ,
266 'table_name' => 'civicrm_sms_provider',
267 'entity' => 'Provider',
268 'bao' => 'CRM_SMS_BAO_Provider',
269 'localizable' => 0,
270 'html' => array(
271 'type' => 'CheckBox',
272 ) ,
273 ) ,
274 'domain_id' => array(
275 'name' => 'domain_id',
276 'type' => CRM_Utils_Type::T_INT,
277 'title' => ts('SMS Domain') ,
278 'description' => 'Which Domain is this sms provider for',
279 'table_name' => 'civicrm_sms_provider',
280 'entity' => 'Provider',
281 'bao' => 'CRM_SMS_BAO_Provider',
282 'localizable' => 0,
283 'FKClassName' => 'CRM_Core_DAO_Domain',
284 'pseudoconstant' => array(
285 'table' => 'civicrm_domain',
286 'keyColumn' => 'id',
287 'labelColumn' => 'name',
288 )
289 ) ,
290 );
291 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
292 }
293 return Civi::$statics[__CLASS__]['fields'];
294 }
295 /**
296 * Return a mapping from field-name to the corresponding key (as used in fields()).
297 *
298 * @return array
299 * Array(string $name => string $uniqueName).
300 */
301 static function &fieldKeys() {
302 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
303 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
304 }
305 return Civi::$statics[__CLASS__]['fieldKeys'];
306 }
307 /**
308 * Returns the names of this table
309 *
310 * @return string
311 */
312 static function getTableName() {
313 return self::$_tableName;
314 }
315 /**
316 * Returns if this table needs to be logged
317 *
318 * @return boolean
319 */
320 function getLog() {
321 return self::$_log;
322 }
323 /**
324 * Returns the list of fields that can be imported
325 *
326 * @param bool $prefix
327 *
328 * @return array
329 */
330 static function &import($prefix = false) {
331 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, array());
332 return $r;
333 }
334 /**
335 * Returns the list of fields that can be exported
336 *
337 * @param bool $prefix
338 *
339 * @return array
340 */
341 static function &export($prefix = false) {
342 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, array());
343 return $r;
344 }
345 /**
346 * Returns the list of indices
347 */
348 public static function indices($localize = TRUE) {
349 $indices = array();
350 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
351 }
352 }