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