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 | |
2562d09a | 9 | * (GenCodeChecksum:6547ff2f60e61de44f3ca5a866c1df6a) |
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, |
2cbbebe8 A |
127 | 'html' => [ |
128 | 'type' => 'Number', | |
129 | ], | |
1fe423d6 | 130 | 'readonly' => TRUE, |
a9d0587b | 131 | 'add' => '2.0', |
c3fc2621 CW |
132 | ], |
133 | 'contact_id' => [ | |
e501603b TO |
134 | 'name' => 'contact_id', |
135 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 136 | 'title' => ts('Contact ID'), |
215b423e | 137 | 'description' => ts('FK to Contact ID'), |
a36434b9 | 138 | 'where' => 'civicrm_openid.contact_id', |
522a26c9 | 139 | 'table_name' => 'civicrm_openid', |
140 | 'entity' => 'OpenID', | |
141 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 142 | 'localizable' => 0, |
e501603b | 143 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
144 | 'html' => [ |
145 | 'label' => ts("Contact"), | |
146 | ], | |
a9d0587b | 147 | 'add' => '2.0', |
c3fc2621 CW |
148 | ], |
149 | 'location_type_id' => [ | |
e501603b TO |
150 | 'name' => 'location_type_id', |
151 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 152 | 'title' => ts('OpenID Location Type'), |
215b423e | 153 | 'description' => ts('Which Location does this email belong to.'), |
a36434b9 | 154 | 'where' => 'civicrm_openid.location_type_id', |
522a26c9 | 155 | 'table_name' => 'civicrm_openid', |
156 | 'entity' => 'OpenID', | |
157 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 158 | 'localizable' => 0, |
5058d73d PN |
159 | 'pseudoconstant' => [ |
160 | 'table' => 'civicrm_location_type', | |
161 | 'keyColumn' => 'id', | |
162 | 'labelColumn' => 'display_name', | |
163 | ], | |
a9d0587b | 164 | 'add' => '2.0', |
c3fc2621 CW |
165 | ], |
166 | 'openid' => [ | |
e501603b TO |
167 | 'name' => 'openid', |
168 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 169 | 'title' => ts('OpenID'), |
215b423e | 170 | 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'), |
e501603b TO |
171 | 'maxlength' => 255, |
172 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 173 | 'import' => TRUE, |
e501603b TO |
174 | 'where' => 'civicrm_openid.openid', |
175 | 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i', | |
176 | 'dataPattern' => '/^[\w\/\:\.]+$/', | |
c3fc2621 | 177 | 'export' => TRUE, |
e501603b | 178 | 'rule' => 'url', |
522a26c9 | 179 | 'table_name' => 'civicrm_openid', |
180 | 'entity' => 'OpenID', | |
181 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 182 | 'localizable' => 0, |
a9d0587b | 183 | 'add' => '2.0', |
c3fc2621 CW |
184 | ], |
185 | 'allowed_to_login' => [ | |
e501603b TO |
186 | 'name' => 'allowed_to_login', |
187 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 188 | 'title' => ts('Allowed to login?'), |
215b423e | 189 | 'description' => ts('Whether or not this user is allowed to login'), |
c3fc2621 | 190 | 'required' => TRUE, |
a36434b9 | 191 | 'where' => 'civicrm_openid.allowed_to_login', |
45a83e42 | 192 | 'default' => '0', |
522a26c9 | 193 | 'table_name' => 'civicrm_openid', |
194 | 'entity' => 'OpenID', | |
195 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 196 | 'localizable' => 0, |
a9d0587b | 197 | 'add' => '2.0', |
c3fc2621 CW |
198 | ], |
199 | 'is_primary' => [ | |
e501603b TO |
200 | 'name' => 'is_primary', |
201 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
b6673dcd | 202 | 'title' => ts('Primary ID'), |
215b423e | 203 | 'description' => ts('Is this the primary email for this contact and location.'), |
a36434b9 | 204 | 'where' => 'civicrm_openid.is_primary', |
45a83e42 | 205 | 'default' => '0', |
522a26c9 | 206 | 'table_name' => 'civicrm_openid', |
207 | 'entity' => 'OpenID', | |
208 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 209 | 'localizable' => 0, |
b6673dcd CW |
210 | 'html' => [ |
211 | 'type' => 'Radio', | |
212 | ], | |
a9d0587b | 213 | 'add' => '2.0', |
c3fc2621 CW |
214 | ], |
215 | ]; | |
346aaaba | 216 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 217 | } |
346aaaba | 218 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 219 | } |
c3fc2621 | 220 | |
e501603b | 221 | /** |
bd8e0b14 | 222 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
223 | * |
224 | * @return array | |
bd8e0b14 | 225 | * Array(string $name => string $uniqueName). |
e501603b | 226 | */ |
c3fc2621 | 227 | public static function &fieldKeys() { |
bd8e0b14 TO |
228 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
229 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 230 | } |
bd8e0b14 | 231 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 232 | } |
c3fc2621 | 233 | |
e501603b TO |
234 | /** |
235 | * Returns the names of this table | |
236 | * | |
237 | * @return string | |
238 | */ | |
c3fc2621 | 239 | public static function getTableName() { |
e501603b TO |
240 | return self::$_tableName; |
241 | } | |
c3fc2621 | 242 | |
e501603b TO |
243 | /** |
244 | * Returns if this table needs to be logged | |
245 | * | |
c3fc2621 | 246 | * @return bool |
e501603b | 247 | */ |
c3fc2621 | 248 | public function getLog() { |
e501603b TO |
249 | return self::$_log; |
250 | } | |
c3fc2621 | 251 | |
e501603b TO |
252 | /** |
253 | * Returns the list of fields that can be imported | |
254 | * | |
255 | * @param bool $prefix | |
256 | * | |
257 | * @return array | |
258 | */ | |
c3fc2621 CW |
259 | public static function &import($prefix = FALSE) { |
260 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []); | |
60808919 | 261 | return $r; |
e501603b | 262 | } |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns the list of fields that can be exported | |
266 | * | |
267 | * @param bool $prefix | |
268 | * | |
269 | * @return array | |
270 | */ | |
c3fc2621 CW |
271 | public static function &export($prefix = FALSE) { |
272 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []); | |
60808919 | 273 | return $r; |
e501603b | 274 | } |
c3fc2621 | 275 | |
e7a6b91a AS |
276 | /** |
277 | * Returns the list of indices | |
c3fc2621 CW |
278 | * |
279 | * @param bool $localize | |
280 | * | |
281 | * @return array | |
e7a6b91a AS |
282 | */ |
283 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
284 | $indices = [ |
285 | 'index_location_type' => [ | |
e7a6b91a | 286 | 'name' => 'index_location_type', |
c3fc2621 | 287 | 'field' => [ |
e7a6b91a | 288 | 0 => 'location_type_id', |
c3fc2621 CW |
289 | ], |
290 | 'localizable' => FALSE, | |
e7a6b91a | 291 | 'sig' => 'civicrm_openid::0::location_type_id', |
c3fc2621 CW |
292 | ], |
293 | 'UI_openid' => [ | |
e7a6b91a | 294 | 'name' => 'UI_openid', |
c3fc2621 | 295 | 'field' => [ |
e7a6b91a | 296 | 0 => 'openid', |
c3fc2621 CW |
297 | ], |
298 | 'localizable' => FALSE, | |
299 | 'unique' => TRUE, | |
e7a6b91a | 300 | 'sig' => 'civicrm_openid::1::openid', |
c3fc2621 CW |
301 | ], |
302 | ]; | |
e7a6b91a AS |
303 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
304 | } | |
c3fc2621 | 305 | |
e501603b | 306 | } |