Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/OpenID.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 9 | * (GenCodeChecksum:cf502fe1aae4bbe85faa570c2c341336) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Unique OpenID ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to Contact ID | |
40 | * | |
41 | * @var int unsigned | |
42 | */ | |
43 | public $contact_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Which Location does this email belong to. | |
47 | * | |
48 | * @var int unsigned | |
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 | * | |
62 | * @var boolean | |
63 | */ | |
64 | public $allowed_to_login; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Is this the primary email for this contact and location. | |
68 | * | |
69 | * @var boolean | |
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 TO |
88 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
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'), |
e501603b | 108 | 'description' => 'Unique OpenID ID', |
c3fc2621 | 109 | 'required' => TRUE, |
522a26c9 | 110 | 'table_name' => 'civicrm_openid', |
111 | 'entity' => 'OpenID', | |
112 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 113 | 'localizable' => 0, |
c3fc2621 CW |
114 | ], |
115 | 'contact_id' => [ | |
e501603b TO |
116 | 'name' => 'contact_id', |
117 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 118 | 'title' => ts('OpenID Contact'), |
e501603b | 119 | 'description' => 'FK to Contact ID', |
522a26c9 | 120 | 'table_name' => 'civicrm_openid', |
121 | 'entity' => 'OpenID', | |
122 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 123 | 'localizable' => 0, |
e501603b | 124 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
125 | ], |
126 | 'location_type_id' => [ | |
e501603b TO |
127 | 'name' => 'location_type_id', |
128 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 129 | 'title' => ts('OpenID Location Type'), |
e501603b | 130 | 'description' => 'Which Location does this email belong to.', |
522a26c9 | 131 | 'table_name' => 'civicrm_openid', |
132 | 'entity' => 'OpenID', | |
133 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 134 | 'localizable' => 0, |
c3fc2621 CW |
135 | ], |
136 | 'openid' => [ | |
e501603b TO |
137 | 'name' => 'openid', |
138 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 139 | 'title' => ts('OpenID'), |
e501603b TO |
140 | 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM', |
141 | 'maxlength' => 255, | |
142 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 143 | 'import' => TRUE, |
e501603b TO |
144 | 'where' => 'civicrm_openid.openid', |
145 | 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i', | |
146 | 'dataPattern' => '/^[\w\/\:\.]+$/', | |
c3fc2621 | 147 | 'export' => TRUE, |
e501603b | 148 | 'rule' => 'url', |
522a26c9 | 149 | 'table_name' => 'civicrm_openid', |
150 | 'entity' => 'OpenID', | |
151 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 152 | 'localizable' => 0, |
c3fc2621 CW |
153 | ], |
154 | 'allowed_to_login' => [ | |
e501603b TO |
155 | 'name' => 'allowed_to_login', |
156 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 157 | 'title' => ts('Allowed to login?'), |
e501603b | 158 | 'description' => 'Whether or not this user is allowed to login', |
c3fc2621 | 159 | 'required' => TRUE, |
522a26c9 | 160 | 'table_name' => 'civicrm_openid', |
161 | 'entity' => 'OpenID', | |
162 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 163 | 'localizable' => 0, |
c3fc2621 CW |
164 | ], |
165 | 'is_primary' => [ | |
e501603b TO |
166 | 'name' => 'is_primary', |
167 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 168 | 'title' => ts('Is OpenID Primary?'), |
e501603b | 169 | 'description' => 'Is this the primary email for this contact and location.', |
522a26c9 | 170 | 'table_name' => 'civicrm_openid', |
171 | 'entity' => 'OpenID', | |
172 | 'bao' => 'CRM_Core_BAO_OpenID', | |
6a7e5e5d | 173 | 'localizable' => 0, |
c3fc2621 CW |
174 | ], |
175 | ]; | |
346aaaba | 176 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 177 | } |
346aaaba | 178 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 179 | } |
c3fc2621 | 180 | |
e501603b | 181 | /** |
bd8e0b14 | 182 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
183 | * |
184 | * @return array | |
bd8e0b14 | 185 | * Array(string $name => string $uniqueName). |
e501603b | 186 | */ |
c3fc2621 | 187 | public static function &fieldKeys() { |
bd8e0b14 TO |
188 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
189 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 190 | } |
bd8e0b14 | 191 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 192 | } |
c3fc2621 | 193 | |
e501603b TO |
194 | /** |
195 | * Returns the names of this table | |
196 | * | |
197 | * @return string | |
198 | */ | |
c3fc2621 | 199 | public static function getTableName() { |
e501603b TO |
200 | return self::$_tableName; |
201 | } | |
c3fc2621 | 202 | |
e501603b TO |
203 | /** |
204 | * Returns if this table needs to be logged | |
205 | * | |
c3fc2621 | 206 | * @return bool |
e501603b | 207 | */ |
c3fc2621 | 208 | public function getLog() { |
e501603b TO |
209 | return self::$_log; |
210 | } | |
c3fc2621 | 211 | |
e501603b TO |
212 | /** |
213 | * Returns the list of fields that can be imported | |
214 | * | |
215 | * @param bool $prefix | |
216 | * | |
217 | * @return array | |
218 | */ | |
c3fc2621 CW |
219 | public static function &import($prefix = FALSE) { |
220 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []); | |
60808919 | 221 | return $r; |
e501603b | 222 | } |
c3fc2621 | 223 | |
e501603b TO |
224 | /** |
225 | * Returns the list of fields that can be exported | |
226 | * | |
227 | * @param bool $prefix | |
228 | * | |
229 | * @return array | |
230 | */ | |
c3fc2621 CW |
231 | public static function &export($prefix = FALSE) { |
232 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []); | |
60808919 | 233 | return $r; |
e501603b | 234 | } |
c3fc2621 | 235 | |
e7a6b91a AS |
236 | /** |
237 | * Returns the list of indices | |
c3fc2621 CW |
238 | * |
239 | * @param bool $localize | |
240 | * | |
241 | * @return array | |
e7a6b91a AS |
242 | */ |
243 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
244 | $indices = [ |
245 | 'index_location_type' => [ | |
e7a6b91a | 246 | 'name' => 'index_location_type', |
c3fc2621 | 247 | 'field' => [ |
e7a6b91a | 248 | 0 => 'location_type_id', |
c3fc2621 CW |
249 | ], |
250 | 'localizable' => FALSE, | |
e7a6b91a | 251 | 'sig' => 'civicrm_openid::0::location_type_id', |
c3fc2621 CW |
252 | ], |
253 | 'UI_openid' => [ | |
e7a6b91a | 254 | 'name' => 'UI_openid', |
c3fc2621 | 255 | 'field' => [ |
e7a6b91a | 256 | 0 => 'openid', |
c3fc2621 CW |
257 | ], |
258 | 'localizable' => FALSE, | |
259 | 'unique' => TRUE, | |
e7a6b91a | 260 | 'sig' => 'civicrm_openid::1::openid', |
c3fc2621 CW |
261 | ], |
262 | ]; | |
e7a6b91a AS |
263 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
264 | } | |
c3fc2621 | 265 | |
e501603b | 266 | } |