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