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/OpenID.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
28979d65 | 9 | * (GenCodeChecksum:0e8f41d1f528dfadc08d7f53610948ca) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the OpenID entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_OpenID extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '2.0'; | |
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_openid'; |
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 | * Unique OpenID ID | |
35 | * | |
28979d65 CW |
36 | * @var int|string|null |
37 | * (SQL type: int unsigned) | |
38 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
39 | */ |
40 | public $id; | |
c3fc2621 | 41 | |
e501603b TO |
42 | /** |
43 | * FK to Contact ID | |
44 | * | |
28979d65 CW |
45 | * @var int|string|null |
46 | * (SQL type: int unsigned) | |
47 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
48 | */ |
49 | public $contact_id; | |
c3fc2621 | 50 | |
e501603b TO |
51 | /** |
52 | * Which Location does this email belong to. | |
53 | * | |
28979d65 CW |
54 | * @var int|string|null |
55 | * (SQL type: int unsigned) | |
56 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
57 | */ |
58 | public $location_type_id; | |
c3fc2621 | 59 | |
e501603b TO |
60 | /** |
61 | * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM | |
62 | * | |
28979d65 CW |
63 | * @var string|null |
64 | * (SQL type: varchar(255)) | |
65 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
66 | */ |
67 | public $openid; | |
c3fc2621 | 68 | |
e501603b TO |
69 | /** |
70 | * Whether or not this user is allowed to login | |
71 | * | |
28979d65 CW |
72 | * @var bool|string |
73 | * (SQL type: tinyint) | |
74 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
75 | */ |
76 | public $allowed_to_login; | |
c3fc2621 | 77 | |
e501603b TO |
78 | /** |
79 | * Is this the primary email for this contact and location. | |
80 | * | |
28979d65 CW |
81 | * @var bool|string|null |
82 | * (SQL type: tinyint) | |
83 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
84 | */ |
85 | public $is_primary; | |
c3fc2621 | 86 | |
e501603b | 87 | /** |
f41f0342 | 88 | * Class constructor. |
e501603b | 89 | */ |
c3fc2621 | 90 | public function __construct() { |
e501603b TO |
91 | $this->__table = 'civicrm_openid'; |
92 | parent::__construct(); | |
93 | } | |
c3fc2621 | 94 | |
449c4e6b CW |
95 | /** |
96 | * Returns localized title of this entity. | |
7b66c3b5 AH |
97 | * |
98 | * @param bool $plural | |
99 | * Whether to return the plural version of the title. | |
449c4e6b | 100 | */ |
7b66c3b5 AH |
101 | public static function getEntityTitle($plural = FALSE) { |
102 | return $plural ? ts('Open IDs') : ts('Open ID'); | |
449c4e6b CW |
103 | } |
104 | ||
e501603b | 105 | /** |
f41f0342 | 106 | * Returns foreign keys and entity references. |
e501603b TO |
107 | * |
108 | * @return array | |
109 | * [CRM_Core_Reference_Interface] | |
110 | */ | |
c3fc2621 | 111 | public static function getReferenceColumns() { |
346aaaba | 112 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 113 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 114 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
346aaaba | 115 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 116 | } |
346aaaba | 117 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 118 | } |
c3fc2621 | 119 | |
e501603b TO |
120 | /** |
121 | * Returns all the column names of this table | |
122 | * | |
123 | * @return array | |
124 | */ | |
c3fc2621 | 125 | public static function &fields() { |
346aaaba | 126 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
127 | Civi::$statics[__CLASS__]['fields'] = [ |
128 | 'id' => [ | |
e501603b TO |
129 | 'name' => 'id', |
130 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 131 | 'title' => ts('Open ID identifier'), |
215b423e | 132 | 'description' => ts('Unique OpenID ID'), |
c3fc2621 | 133 | 'required' => TRUE, |
a36434b9 | 134 | 'where' => 'civicrm_openid.id', |
522a26c9 | 135 | 'table_name' => 'civicrm_openid', |
136 | 'entity' => 'OpenID', | |
137 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 138 | 'localizable' => 0, |
2cbbebe8 A |
139 | 'html' => [ |
140 | 'type' => 'Number', | |
141 | ], | |
1fe423d6 | 142 | 'readonly' => TRUE, |
a9d0587b | 143 | 'add' => '2.0', |
c3fc2621 CW |
144 | ], |
145 | 'contact_id' => [ | |
e501603b TO |
146 | 'name' => 'contact_id', |
147 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 148 | 'title' => ts('Contact ID'), |
215b423e | 149 | 'description' => ts('FK to Contact ID'), |
a36434b9 | 150 | 'where' => 'civicrm_openid.contact_id', |
522a26c9 | 151 | 'table_name' => 'civicrm_openid', |
152 | 'entity' => 'OpenID', | |
153 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 154 | 'localizable' => 0, |
e501603b | 155 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
156 | 'html' => [ |
157 | 'label' => ts("Contact"), | |
158 | ], | |
a9d0587b | 159 | 'add' => '2.0', |
c3fc2621 CW |
160 | ], |
161 | 'location_type_id' => [ | |
e501603b TO |
162 | 'name' => 'location_type_id', |
163 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 164 | 'title' => ts('OpenID Location Type'), |
215b423e | 165 | 'description' => ts('Which Location does this email belong to.'), |
a36434b9 | 166 | 'where' => 'civicrm_openid.location_type_id', |
522a26c9 | 167 | 'table_name' => 'civicrm_openid', |
168 | 'entity' => 'OpenID', | |
169 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 170 | 'localizable' => 0, |
5058d73d PN |
171 | 'pseudoconstant' => [ |
172 | 'table' => 'civicrm_location_type', | |
173 | 'keyColumn' => 'id', | |
174 | 'labelColumn' => 'display_name', | |
175 | ], | |
a9d0587b | 176 | 'add' => '2.0', |
c3fc2621 CW |
177 | ], |
178 | 'openid' => [ | |
e501603b TO |
179 | 'name' => 'openid', |
180 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 181 | 'title' => ts('OpenID'), |
215b423e | 182 | 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'), |
e501603b TO |
183 | 'maxlength' => 255, |
184 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 185 | 'import' => TRUE, |
e501603b TO |
186 | 'where' => 'civicrm_openid.openid', |
187 | 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i', | |
188 | 'dataPattern' => '/^[\w\/\:\.]+$/', | |
c3fc2621 | 189 | 'export' => TRUE, |
e501603b | 190 | 'rule' => 'url', |
522a26c9 | 191 | 'table_name' => 'civicrm_openid', |
192 | 'entity' => 'OpenID', | |
193 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 194 | 'localizable' => 0, |
a9d0587b | 195 | 'add' => '2.0', |
c3fc2621 CW |
196 | ], |
197 | 'allowed_to_login' => [ | |
e501603b TO |
198 | 'name' => 'allowed_to_login', |
199 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 200 | 'title' => ts('Allowed to login?'), |
215b423e | 201 | 'description' => ts('Whether or not this user is allowed to login'), |
c3fc2621 | 202 | 'required' => TRUE, |
a36434b9 | 203 | 'where' => 'civicrm_openid.allowed_to_login', |
45a83e42 | 204 | 'default' => '0', |
522a26c9 | 205 | 'table_name' => 'civicrm_openid', |
206 | 'entity' => 'OpenID', | |
207 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 208 | 'localizable' => 0, |
a9d0587b | 209 | 'add' => '2.0', |
c3fc2621 CW |
210 | ], |
211 | 'is_primary' => [ | |
e501603b TO |
212 | 'name' => 'is_primary', |
213 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
b6673dcd | 214 | 'title' => ts('Primary ID'), |
215b423e | 215 | 'description' => ts('Is this the primary email for this contact and location.'), |
a36434b9 | 216 | 'where' => 'civicrm_openid.is_primary', |
45a83e42 | 217 | 'default' => '0', |
522a26c9 | 218 | 'table_name' => 'civicrm_openid', |
219 | 'entity' => 'OpenID', | |
220 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 221 | 'localizable' => 0, |
b6673dcd CW |
222 | 'html' => [ |
223 | 'type' => 'Radio', | |
224 | ], | |
a9d0587b | 225 | 'add' => '2.0', |
c3fc2621 CW |
226 | ], |
227 | ]; | |
346aaaba | 228 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 229 | } |
346aaaba | 230 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 231 | } |
c3fc2621 | 232 | |
e501603b | 233 | /** |
bd8e0b14 | 234 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
235 | * |
236 | * @return array | |
bd8e0b14 | 237 | * Array(string $name => string $uniqueName). |
e501603b | 238 | */ |
c3fc2621 | 239 | public static function &fieldKeys() { |
bd8e0b14 TO |
240 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
241 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 242 | } |
bd8e0b14 | 243 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 244 | } |
c3fc2621 | 245 | |
e501603b TO |
246 | /** |
247 | * Returns the names of this table | |
248 | * | |
249 | * @return string | |
250 | */ | |
c3fc2621 | 251 | public static function getTableName() { |
e501603b TO |
252 | return self::$_tableName; |
253 | } | |
c3fc2621 | 254 | |
e501603b TO |
255 | /** |
256 | * Returns if this table needs to be logged | |
257 | * | |
c3fc2621 | 258 | * @return bool |
e501603b | 259 | */ |
c3fc2621 | 260 | public function getLog() { |
e501603b TO |
261 | return self::$_log; |
262 | } | |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns the list of fields that can be imported | |
266 | * | |
267 | * @param bool $prefix | |
268 | * | |
269 | * @return array | |
270 | */ | |
c3fc2621 CW |
271 | public static function &import($prefix = FALSE) { |
272 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []); | |
60808919 | 273 | return $r; |
e501603b | 274 | } |
c3fc2621 | 275 | |
e501603b TO |
276 | /** |
277 | * Returns the list of fields that can be exported | |
278 | * | |
279 | * @param bool $prefix | |
280 | * | |
281 | * @return array | |
282 | */ | |
c3fc2621 CW |
283 | public static function &export($prefix = FALSE) { |
284 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []); | |
60808919 | 285 | return $r; |
e501603b | 286 | } |
c3fc2621 | 287 | |
e7a6b91a AS |
288 | /** |
289 | * Returns the list of indices | |
c3fc2621 CW |
290 | * |
291 | * @param bool $localize | |
292 | * | |
293 | * @return array | |
e7a6b91a AS |
294 | */ |
295 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
296 | $indices = [ |
297 | 'index_location_type' => [ | |
e7a6b91a | 298 | 'name' => 'index_location_type', |
c3fc2621 | 299 | 'field' => [ |
e7a6b91a | 300 | 0 => 'location_type_id', |
c3fc2621 CW |
301 | ], |
302 | 'localizable' => FALSE, | |
e7a6b91a | 303 | 'sig' => 'civicrm_openid::0::location_type_id', |
c3fc2621 CW |
304 | ], |
305 | 'UI_openid' => [ | |
e7a6b91a | 306 | 'name' => 'UI_openid', |
c3fc2621 | 307 | 'field' => [ |
e7a6b91a | 308 | 0 => 'openid', |
c3fc2621 CW |
309 | ], |
310 | 'localizable' => FALSE, | |
311 | 'unique' => TRUE, | |
e7a6b91a | 312 | 'sig' => 'civicrm_openid::1::openid', |
c3fc2621 CW |
313 | ], |
314 | ]; | |
e7a6b91a AS |
315 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
316 | } | |
c3fc2621 | 317 | |
e501603b | 318 | } |