ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\User\Profile\DatabaseDataRepository Class Reference
+ Inheritance diagram for ILIAS\User\Profile\DatabaseDataRepository:
+ Collaboration diagram for ILIAS\User\Profile\DatabaseDataRepository:

Public Member Functions

 __construct (private readonly \ilDBInterface $db, private readonly ResourceStorage $irss)
 
 getDefault ()
 
 getSingle (int $id)
 
 getMultiple (array $user_ids)
 
 store (Data $user_data)
 
 deleteForFieldIdentifier (string $identifier)
 
 deleteForUser (int $usr_id)
 
 storePasswordFor (int $usr_id, string $password, string $encoding_type, ?string $salt)
 
 storeLoginFor (int $usr_id, string $login)
 
 storeLastVisitedFor (int $usr_id, array $last_visited)
 
 searchUsers (SettingsDataRepository $settings_data_repository, ProfileFieldsConfigurationRepository $profile_fields_config_repo, AutocompleteQuery $autocomplete_query)
 
 getProfileDataQuery (array $select_fields)
 
 getCountAndRecordsForQuery (DataQuery $query, int $offset, int $limit)
 
 getDefault ()
 
 getSingle (int $id)
 
 getMultiple (array $user_ids)
 
 store (Data $user_data)
 
 deleteForFieldIdentifier (string $identifier)
 
 deleteForUser (int $usr_id)
 
 storePasswordFor (int $usr_id, string $password, string $encoding_type, ?string $salt)
 
 storeLoginFor (int $usr_id, string $login)
 
 storeLastVisitedFor (int $usr_id, array $last_visited)
 
 searchUsers (SettingsDataRepository $settings_data_repository, ProfileFieldsConfigurationRepository $profile_fields_config_repo, AutocompleteQuery $search_term)
 
 getProfileDataQuery (array $select_fields)
 
 getCountAndRecordsForQuery (DataQuery $query, int $offset, int $limit)
 

Data Fields

const string USER_VALUES_TABLE = 'usr_profile_data'
 

Private Member Functions

 buildFromData (\stdClass $base_data, array $additional_data)
 
 storeAdditionalFields (Data $user_data)
 
 buildSearchUsersWhereString (ProfileFieldsConfigurationRepository $profile_fields_config_repo, AutocompleteQuery $autocomplete_query)
 
 getSearchFieldsWithAvailability (ProfileFieldsConfigurationRepository $profile_fields_config_repo, AutocompleteQuery $autocomplete_query)
 
 buildLastVisited (?string $last_visited)
 
 retrieveRecordsFromQuery (DataQuery $query)
 

Private Attributes

const string USER_BASE_TABLE = 'usr_data'
 
const string NO_AVATAR_RID = '-'
 
const array SEARCH_FIELDS
 

Detailed Description

Definition at line 34 of file DatabaseDataRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Profile\DatabaseDataRepository::__construct ( private readonly \ilDBInterface  $db,
private readonly ResourceStorage  $irss 
)

Definition at line 49 of file DatabaseDataRepository.php.

52 {
53 }

Member Function Documentation

◆ buildFromData()

ILIAS\User\Profile\DatabaseDataRepository::buildFromData ( \stdClass  $base_data,
array  $additional_data 
)
private

Definition at line 314 of file DatabaseDataRepository.php.

317 : Data {
318 return (new Data(
319 $base_data->usr_id,
320 $base_data->login,
321 $base_data->rid !== null && $base_data->rid !== self::NO_AVATAR_RID
322 ? $this->irss->manage()->find($base_data->rid)
323 : null,
324 $base_data->firstname ?? '',
325 $base_data->lastname ?? '',
326 $base_data->title ?? '',
327 Genders::tryFrom($base_data->gender ?? ''),
328 $base_data->birthday !== null
329 ? new \DateTimeImmutable($base_data->birthday, new \DateTimeZone('UTC'))
330 : null,
331 $base_data->institution ?? '',
332 $base_data->department ?? '',
333 $base_data->street ?? '',
334 $base_data->city ?? '',
335 $base_data->zipcode ?? '',
336 $base_data->country ?? '',
337 $base_data->email ?? '',
338 $base_data->second_email,
339 $base_data->phone_office ?? '',
340 $base_data->phone_home ?? '',
341 $base_data->phone_mobile ?? '',
342 $base_data->fax ?? '',
343 $base_data->matriculation ?? '',
344 $base_data->hobby ?? '',
345 $base_data->referral_comment ?? '',
346 [
347 'latitude' => $base_data->latitude,
348 'longitude' => $base_data->longitude,
349 'zoom' => $base_data->loc_zoom
350 ],
351 array_reduce(
352 $additional_data,
353 static function (array $c, \stdClass $v): array {
354 if (!array_key_exists($v->field_id, $c)) {
355 $c[$v->field_id] = [];
356 }
357 $c[$v->field_id][] = $v->value;
358 return $c;
359 },
360 []
361 )
362 ))->withSystemInformation([
363 'last_password_change' => $base_data->last_password_change,
364 'login_attempts' => $base_data->login_attempts,
365 'passwd' => $base_data->passwd,
366 'passwd_salt' => $base_data->passwd_salt,
367 'passwd_enc_type' => $base_data->passwd_enc_type,
368 'passwd_policy_reset' => $base_data->passwd_policy_reset === 1,
369 'client_ip' => $base_data->client_ip ?? '',
370 'last_login' => $base_data->last_login ?? '',
371 'first_login' => $base_data->first_login ?? '',
372 'last_profile_prompt' => $base_data->last_profile_prompt ?? '',
373 'active' => $base_data->active,
374 'approve_date' => $base_data->approve_date,
375 'agree_date' => $base_data->agree_date,
376 'inactivation_date' => $base_data->inactivation_date,
377 'time_limit_owner' => $base_data->time_limit_owner,
378 'time_limit_unlimited' => $base_data->time_limit_unlimited === 1,
379 'time_limit_from' => $base_data->time_limit_from,
380 'time_limit_until' => $base_data->time_limit_until,
381 'profile_incomplete' => $base_data->profile_incomplete === 1,
382 'auth_mode' => $base_data->auth_mode,
383 'ext_account' => $base_data->ext_account,
384 'is_self_registered' => $base_data->is_self_registered === 1,
385 'last_update' => $base_data->last_update ?? '',
386 'create_date' => $base_data->create_date ?? '',
387 'last_visited' => $this->buildLastVisited($base_data->last_visited)
388 ]);
389 }
$c
Definition: deliver.php:25

References $c.

Referenced by ILIAS\User\Profile\DatabaseDataRepository\getMultiple(), and ILIAS\User\Profile\DatabaseDataRepository\getSingle().

+ Here is the caller graph for this function:

◆ buildLastVisited()

ILIAS\User\Profile\DatabaseDataRepository::buildLastVisited ( ?string  $last_visited)
private

Definition at line 477 of file DatabaseDataRepository.php.

477 : array
478 {
479 if ($last_visited === null) {
480 return [];
481 }
482
483 $unserialized = unserialize($last_visited, ['allowed_classes' => false]);
484
485 if (!is_array($unserialized)) {
486 return [];
487 }
488
489 return $unserialized;
490 }

◆ buildSearchUsersWhereString()

ILIAS\User\Profile\DatabaseDataRepository::buildSearchUsersWhereString ( ProfileFieldsConfigurationRepository  $profile_fields_config_repo,
AutocompleteQuery  $autocomplete_query 
)
private

Definition at line 409 of file DatabaseDataRepository.php.

412 : ?string {
413 $available_fields = array_filter(
415 $profile_fields_config_repo,
416 $autocomplete_query
417 )
418 );
419
420 if ($available_fields === []) {
421 return null;
422 }
423
424 $outer_conditions = [];
425 $outer_conditions[] = 'usr_data.usr_id != ' . $this->db->quote(ANONYMOUS_USER_ID, \ilDBConstants::T_INTEGER);
426 $outer_conditions[] = 'usr_data.active != ' . $this->db->quote(0, \ilDBConstants::T_INTEGER);
427
428 if (\ilUserAccountSettings::getInstance()->isUserAccessRestricted()) {
429 $outer_conditions[] = $this->db->in(
430 'time_limit_owner',
431 \ilUserFilter::getInstance()->getFolderIds(),
432 false,
433 'integer'
434 );
435 }
436
437 $outer_conditions[] = '(' . implode(
438 ' OR ',
439 array_map(
440 fn(string $v) => $this->db->like($v, \ilDBConstants::T_TEXT, "%{$available_fields[$v]}%"),
441 array_keys($available_fields)
442 )
443 ) . ')';
444
445 return ' WHERE ' . implode(' AND ', $outer_conditions);
446 }
getSearchFieldsWithAvailability(ProfileFieldsConfigurationRepository $profile_fields_config_repo, AutocompleteQuery $autocomplete_query)
const ANONYMOUS_USER_ID
Definition: constants.php:27

◆ deleteForFieldIdentifier()

ILIAS\User\Profile\DatabaseDataRepository::deleteForFieldIdentifier ( string  $identifier)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 182 of file DatabaseDataRepository.php.

182 : void
183 {
184 $this->db->manipulateF(
185 'DELETE FROM ' . self::USER_VALUES_TABLE
186 . " WHERE field_id='{$this->db->quote($identifier, \ilDBConstants::T_TEXT)}'"
187 );
188 }

◆ deleteForUser()

ILIAS\User\Profile\DatabaseDataRepository::deleteForUser ( int  $usr_id)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 190 of file DatabaseDataRepository.php.

190 : void
191 {
192 $this->db->manipulate(
193 'DELETE FROM ' . self::USER_BASE_TABLE
194 . " WHERE usr_id='{$this->db->quote($usr_id, \ilDBConstants::T_INTEGER)}'"
195 );
196 $this->db->manipulate(
197 'DELETE FROM ' . self::USER_VALUES_TABLE
198 . " WHERE usr_id='{$this->db->quote($usr_id, \ilDBConstants::T_INTEGER)}'"
199 );
200 }

◆ getCountAndRecordsForQuery()

ILIAS\User\Profile\DatabaseDataRepository::getCountAndRecordsForQuery ( DataQuery  $query,
int  $offset,
int  $limit 
)
Returns
array{cnt: int, set: array{string, mixed}}

Implements ILIAS\User\Profile\DataRepository.

Definition at line 292 of file DatabaseDataRepository.php.

296 : array {
297 $prepared_query = $query->withAdditionalSelectAndJoinForUdfAndMultiValueFields();
298 $cnt = $this->db->fetchObject(
299 $this->db->query($prepared_query->buildCntQueryString())
300 )->cnt ?? 0;
301
302 if ($offset >= $cnt) {
303 $offset = 0;
304 }
305
306 $this->db->setLimit($limit, $offset);
307
308 return [
309 'cnt' => $cnt,
310 'set' => $this->retrieveRecordsFromQuery($prepared_query)
311 ];
312 }

◆ getDefault()

ILIAS\User\Profile\DatabaseDataRepository::getDefault ( )

Implements ILIAS\User\Profile\DataRepository.

Definition at line 55 of file DatabaseDataRepository.php.

55 : Data
56 {
57 return new Data();
58 }

◆ getMultiple()

ILIAS\User\Profile\DatabaseDataRepository::getMultiple ( array  $user_ids)
Parameters
array<int>$user_ids
Returns
Generator<UserData>

Implements ILIAS\User\Profile\DataRepository.

Definition at line 80 of file DatabaseDataRepository.php.

80 : \Generator
81 {
82 $query = $this->db->query(
83 'SELECT * FROM ' . self::USER_BASE_TABLE
84 . " WHERE {$this->db->in('usr_id', $user_ids, false, \ilDBConstants::T_INTEGER)}"
85 );
86
87 $prepared_query = $this->db->prepare('SELECT field_id, value FROM '
88 . self::USER_VALUES_TABLE . ' WHERE usr_id = ?');
89
90 while (($base_data = $this->db->fetchObject($query)) !== null) {
91 yield $this->buildFromData(
92 $base_data,
93 $this->db->fetchAll(
94 $this->db->execute($prepared_query, [$base_data->usr_id]),
96 )
97 );
98 }
99
100 $this->db->free($prepared_query);
101 }
buildFromData(\stdClass $base_data, array $additional_data)

References ILIAS\User\Profile\DatabaseDataRepository\buildFromData(), and ilDBConstants\FETCHMODE_OBJECT.

+ Here is the call graph for this function:

◆ getProfileDataQuery()

ILIAS\User\Profile\DatabaseDataRepository::getProfileDataQuery ( array  $select_fields)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 278 of file DatabaseDataRepository.php.

280 : DataQuery {
281 return new DataQuery(
282 $this->db,
283 self::USER_BASE_TABLE,
284 self::USER_VALUES_TABLE,
285 $select_fields
286 );
287 }

◆ getSearchFieldsWithAvailability()

ILIAS\User\Profile\DatabaseDataRepository::getSearchFieldsWithAvailability ( ProfileFieldsConfigurationRepository  $profile_fields_config_repo,
AutocompleteQuery  $autocomplete_query 
)
private

Definition at line 448 of file DatabaseDataRepository.php.

451 : array {
452 $search_term = $autocomplete_query->getSearchTermQueryString();
453 $search_term_long_enough = $autocomplete_query->checkSearchTermLength($search_term);
454 $firstname_term = $autocomplete_query->getFirstnameQueryString();
455 $lastname_term = $autocomplete_query->getLastnameQueryString();
456
457 return array_merge(
458 self::SEARCH_FIELDS,
459 [
460 'login' => $search_term_long_enough ? $search_term : null,
461 'firstname' => $profile_fields_config_repo->getByClass(FirstName::class)->isSearchable()
462 && $autocomplete_query->checkSearchTermLength($firstname_term)
463 ? $firstname_term : null,
464 'lastname' => $profile_fields_config_repo->getByClass(LastName::class)->isSearchable()
465 && $autocomplete_query->checkSearchTermLength($lastname_term)
466 ? $autocomplete_query->getLastnameQueryString() : null,
467 'email' => $profile_fields_config_repo->getByClass(Email::class)->isSearchable()
468 && $search_term_long_enough
469 ? $autocomplete_query->getSearchTermQueryString() : null,
470 'second_email' => $profile_fields_config_repo->getByClass(SecondEmail::class)->isSearchable()
471 && $search_term_long_enough
472 ? $autocomplete_query->getSearchTermQueryString() : null
473 ]
474 );
475 }

◆ getSingle()

ILIAS\User\Profile\DatabaseDataRepository::getSingle ( int  $id)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 60 of file DatabaseDataRepository.php.

60 : Data
61 {
62 $base_query = $this->db->query(
63 'SELECT * FROM ' . self::USER_BASE_TABLE . " WHERE usr_id={$id}"
64 );
65
66 $additional_query = $this->db->query(
67 'SELECT field_id, value FROM ' . self::USER_VALUES_TABLE . " WHERE usr_id = {$id}"
68 );
69
70 return $this->buildFromData(
71 $this->db->fetchObject($base_query),
72 $this->db->fetchAll(
73 $additional_query,
75 )
76 );
77
78 }

References ILIAS\User\Profile\DatabaseDataRepository\buildFromData(), and ilDBConstants\FETCHMODE_OBJECT.

+ Here is the call graph for this function:

◆ retrieveRecordsFromQuery()

ILIAS\User\Profile\DatabaseDataRepository::retrieveRecordsFromQuery ( DataQuery  $query)
private

Definition at line 492 of file DatabaseDataRepository.php.

492 : array
493 {
494 $statement = $this->db->query($query->buildRecordsQueryString());
495
496 $result = [];
497 while (($row = $this->db->fetchAssoc($statement)) !== null) {
498 $row['usr_id'] = (int) $row['usr_id'];
499 $result[] = $query->explodeArrayValues($row);
500 }
501 return $result;
502 }

References ILIAS\User\Profile\DataQuery\buildRecordsQueryString(), ILIAS\User\Profile\DataQuery\explodeArrayValues(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ searchUsers()

ILIAS\User\Profile\DatabaseDataRepository::searchUsers ( SettingsDataRepository  $settings_data_repository,
ProfileFieldsConfigurationRepository  $profile_fields_config_repo,
AutocompleteQuery  $autocomplete_query 
)
Returns
list<\ILIAS\User\Search\AutocompleteItem>

Implements ILIAS\User\Profile\DataRepository.

Definition at line 244 of file DatabaseDataRepository.php.

248 : array {
249 $where = $this->buildSearchUsersWhereString(
250 $profile_fields_config_repo,
251 $autocomplete_query
252 );
253
254 if ($where === null) {
255 return [];
256 }
257
258 $query = $this->db->query(
259 $settings_data_repository->getSearchSelectConditionalOnVisibility(
260 self::USER_BASE_TABLE,
261 ...array_keys(self::SEARCH_FIELDS)
262 ) . PHP_EOL
263 . $where
264 );
265
266 $results = [];
267 while (($row = $this->db->fetchObject($query)) !== null) {
268 $results[] = new DefaultAutocompleteItem(
269 $row->login,
270 $row->lastname ?? '',
271 $row->firstname ?? '',
272 $autocomplete_query->getUnprocessedSearchTerm()
273 );
274 }
275 return $results;
276 }
buildSearchUsersWhereString(ProfileFieldsConfigurationRepository $profile_fields_config_repo, AutocompleteQuery $autocomplete_query)
$results

◆ store()

ILIAS\User\Profile\DatabaseDataRepository::store ( Data  $user_data)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 103 of file DatabaseDataRepository.php.

103 : void
104 {
105 $system_information = $user_data->getSystemInformation();
106 $this->db->replace(
107 self::USER_BASE_TABLE,
108 [
109 'usr_id' => [
111 $user_data->getId()
112 ]
113 ],
114 [
115 'login' => [\ilDBConstants::T_TEXT, $user_data->getAlias()],
116 'firstname' => [\ilDBConstants::T_TEXT, $user_data->getFirstname()],
117 'lastname' => [\ilDBConstants::T_TEXT, $user_data->getLastname()],
118 'title' => [\ilDBConstants::T_TEXT, $user_data->getTitle()],
119 'gender' => [\ilDBConstants::T_TEXT, $user_data->getGender()?->value],
120 'rid' => [\ilDBConstants::T_TEXT, $user_data->getAvatarRid()?->serialize() ?? self::NO_AVATAR_RID],
121 'email' => [\ilDBConstants::T_TEXT, $user_data->getEmail()],
122 'second_email' => [\ilDBConstants::T_TEXT, $user_data->getSecondEmail()],
123 'hobby' => [\ilDBConstants::T_TEXT, $user_data->getHobby()],
124 'institution' => [\ilDBConstants::T_TEXT, $user_data->getInstitution()],
125 'department' => [\ilDBConstants::T_TEXT, $user_data->getDepartment()],
126 'street' => [\ilDBConstants::T_TEXT, $user_data->getStreet()],
127 'city' => [\ilDBConstants::T_TEXT, $user_data->getCity()],
128 'zipcode' => [\ilDBConstants::T_TEXT, $user_data->getZipcode()],
129 'country' => [\ilDBConstants::T_TEXT, $user_data->getCountry()],
130 'phone_office' => [\ilDBConstants::T_TEXT, $user_data->getPhoneOffice()],
131 'phone_home' => [\ilDBConstants::T_TEXT, $user_data->getPhoneHome()],
132 'phone_mobile' => [\ilDBConstants::T_TEXT, $user_data->getPhoneMobile()],
133 'fax' => [\ilDBConstants::T_TEXT, $user_data->getFax()],
134 'birthday' => [\ilDBConstants::T_DATE, $user_data->getBirthday()?->format('Y-m-d')],
135 'referral_comment' => [\ilDBConstants::T_TEXT, $user_data->getReferralComment()],
136 'matriculation' => [\ilDBConstants::T_TEXT, $user_data->getMatriculation()],
137 'latitude' => [\ilDBConstants::T_TEXT, $user_data->getGeoCoordinates()['latitude'] ?? null],
138 'longitude' => [\ilDBConstants::T_TEXT, $user_data->getGeoCoordinates()['longitude'] ?? null],
139 'loc_zoom' => [\ilDBConstants::T_INTEGER, $user_data->getGeoCoordinates()['zoom'] ?? 0],
140 'last_password_change' => [\ilDBConstants::T_INTEGER, $system_information['last_password_change']],
141 'passwd' => [\ilDBConstants::T_TEXT, $system_information['passwd']],
142 'passwd_salt' => [\ilDBConstants::T_TEXT, $system_information['passwd_salt']],
143 'passwd_enc_type' => [\ilDBConstants::T_TEXT, $system_information['passwd_enc_type']],
144 'passwd_policy_reset' => [\ilDBConstants::T_INTEGER, $system_information['passwd_policy_reset'] ? 1 : 0],
145 'client_ip' => [\ilDBConstants::T_TEXT, $system_information['client_ip']],
146 'last_login' => [
148 $system_information['last_login'] !== '' ? $system_information['last_login'] : null
149 ],
150 'first_login' => [
152 $system_information['first_login'] !== '' ? $system_information['first_login'] : null
153 ],
154 'last_profile_prompt' => [
156 $system_information['last_profile_prompt'] !== '' ? $system_information['last_profile_prompt'] : null
157 ],
158 'active' => [\ilDBConstants::T_INTEGER, $system_information['active']],
159 'approve_date' => [\ilDBConstants::T_TIMESTAMP, $system_information['approve_date']],
160 'agree_date' => [\ilDBConstants::T_TIMESTAMP, $system_information['agree_date']],
161 'inactivation_date' => [\ilDBConstants::T_TIMESTAMP, $system_information['inactivation_date']],
162 'time_limit_owner' => [\ilDBConstants::T_INTEGER, $system_information['time_limit_owner']],
163 'time_limit_unlimited' => [\ilDBConstants::T_INTEGER, $system_information['time_limit_unlimited'] ? 1 : 0],
164 'time_limit_from' => [\ilDBConstants::T_INTEGER, $system_information['time_limit_from']],
165 'time_limit_until' => [\ilDBConstants::T_INTEGER, $system_information['time_limit_until']],
166 'profile_incomplete' => [\ilDBConstants::T_INTEGER, $system_information['profile_incomplete']],
167 'auth_mode' => [\ilDBConstants::T_TEXT, $system_information['auth_mode']],
168 'ext_account' => [\ilDBConstants::T_TEXT, $system_information['ext_account']],
169 'is_self_registered' => [\ilDBConstants::T_INTEGER, $system_information['is_self_registered'] ? 1 : 0],
170 'last_update' => [\ilDBConstants::T_TIMESTAMP, date('Y-m-d H:i:s')],
171 'create_date' => [\ilDBConstants::T_TIMESTAMP, $system_information['create_date']],
172 'last_visited' => [
174 $system_information['last_visited'] === [] ? null : serialize($system_information['last_visited'])
175 ]
176 ]
177 );
178
179 $this->storeAdditionalFields($user_data);
180 }

References ILIAS\User\Profile\Data\getAlias(), ILIAS\User\Profile\Data\getAvatarRid(), ILIAS\User\Profile\Data\getBirthday(), ILIAS\User\Profile\Data\getCity(), ILIAS\User\Profile\Data\getCountry(), ILIAS\User\Profile\Data\getDepartment(), ILIAS\User\Profile\Data\getEmail(), ILIAS\User\Profile\Data\getFax(), ILIAS\User\Profile\Data\getFirstname(), ILIAS\User\Profile\Data\getGender(), ILIAS\User\Profile\Data\getGeoCoordinates(), ILIAS\User\Profile\Data\getHobby(), ILIAS\User\Profile\Data\getId(), ILIAS\User\Profile\Data\getInstitution(), ILIAS\User\Profile\Data\getLastname(), ILIAS\User\Profile\Data\getMatriculation(), ILIAS\User\Profile\Data\getPhoneHome(), ILIAS\User\Profile\Data\getPhoneMobile(), ILIAS\User\Profile\Data\getPhoneOffice(), ILIAS\User\Profile\Data\getReferralComment(), ILIAS\User\Profile\Data\getSecondEmail(), ILIAS\User\Profile\Data\getStreet(), ILIAS\User\Profile\Data\getSystemInformation(), ILIAS\User\Profile\Data\getTitle(), ILIAS\User\Profile\Data\getZipcode(), ILIAS\User\Profile\DatabaseDataRepository\storeAdditionalFields(), ilDBConstants\T_DATE, ilDBConstants\T_INTEGER, ilDBConstants\T_TEXT, and ilDBConstants\T_TIMESTAMP.

+ Here is the call graph for this function:

◆ storeAdditionalFields()

ILIAS\User\Profile\DatabaseDataRepository::storeAdditionalFields ( Data  $user_data)
private

Definition at line 391 of file DatabaseDataRepository.php.

391 : void
392 {
393 $this->db->manipulate(
394 'DELETE FROM ' . self::USER_VALUES_TABLE
395 . " WHERE usr_id = {$user_data->getId()}"
396 );
397
398 $values_for_storage = $user_data->getAdditionalFieldsStorageValues($this->db);
399 if ($values_for_storage === '') {
400 return;
401 }
402
403 $this->db->manipulate(
404 'INSERT INTO ' . self::USER_VALUES_TABLE . ' (usr_id, field_id, value) '
405 . 'VALUES ' . $values_for_storage
406 );
407 }

References ILIAS\User\Profile\Data\getAdditionalFieldsStorageValues().

Referenced by ILIAS\User\Profile\DatabaseDataRepository\store().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeLastVisitedFor()

ILIAS\User\Profile\DatabaseDataRepository::storeLastVisitedFor ( int  $usr_id,
array  $last_visited 
)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 227 of file DatabaseDataRepository.php.

230 : void {
231 $this->db->manipulateF(
232 'UPDATE ' . self::USER_BASE_TABLE . ' SET last_visited = %s WHERE usr_id = %s',
234 [
235 $last_visited === [] ? null : serialize($last_visited),
236 $usr_id
237 ]
238 );
239 }

◆ storeLoginFor()

ILIAS\User\Profile\DatabaseDataRepository::storeLoginFor ( int  $usr_id,
string  $login 
)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 216 of file DatabaseDataRepository.php.

219 : void {
220 $this->db->manipulateF(
221 'UPDATE ' . self::USER_BASE_TABLE . ' SET login = %s WHERE usr_id = %s',
223 [$login, $usr_id]
224 );
225 }

◆ storePasswordFor()

ILIAS\User\Profile\DatabaseDataRepository::storePasswordFor ( int  $usr_id,
string  $password,
string  $encoding_type,
?string  $salt 
)

Implements ILIAS\User\Profile\DataRepository.

Definition at line 202 of file DatabaseDataRepository.php.

207 : void {
208 $this->db->manipulateF(
209 'UPDATE ' . self::USER_BASE_TABLE . ' SET passwd = %s,' . PHP_EOL
210 . 'passwd_enc_type = %s, passwd_salt = %s WHERE usr_id = %s',
212 [$password, $encoding_type, $salt, $usr_id]
213 );
214 }

Field Documentation

◆ NO_AVATAR_RID

const string ILIAS\User\Profile\DatabaseDataRepository::NO_AVATAR_RID = '-'
private

Definition at line 39 of file DatabaseDataRepository.php.

◆ SEARCH_FIELDS

const array ILIAS\User\Profile\DatabaseDataRepository::SEARCH_FIELDS
private
Initial value:
= [
'login' => true,
'firstname' => false,
'lastname' => false,
'email' => false,
'second_email' => false
]

Definition at line 41 of file DatabaseDataRepository.php.

◆ USER_BASE_TABLE

const string ILIAS\User\Profile\DatabaseDataRepository::USER_BASE_TABLE = 'usr_data'
private

Definition at line 36 of file DatabaseDataRepository.php.

◆ USER_VALUES_TABLE

const string ILIAS\User\Profile\DatabaseDataRepository::USER_VALUES_TABLE = 'usr_profile_data'

Definition at line 37 of file DatabaseDataRepository.php.


The documentation for this class was generated from the following file: