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