ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 321 of file DatabaseDataRepository.php.

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

484 : array
485 {
486 if ($last_visited === null) {
487 return [];
488 }
489
490 $unserialized = unserialize($last_visited, ['allowed_classes' => false]);
491
492 if (!is_array($unserialized)) {
493 return [];
494 }
495
496 return $unserialized;
497 }

◆ buildSearchUsersWhereString()

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

Definition at line 416 of file DatabaseDataRepository.php.

419 : ?string {
420 $available_fields = array_filter(
422 $profile_fields_config_repo,
423 $autocomplete_query
424 )
425 );
426
427 if ($available_fields === []) {
428 return null;
429 }
430
431 $outer_conditions = [];
432 $outer_conditions[] = 'usr_data.usr_id != ' . $this->db->quote(ANONYMOUS_USER_ID, \ilDBConstants::T_INTEGER);
433 $outer_conditions[] = 'usr_data.active != ' . $this->db->quote(0, \ilDBConstants::T_INTEGER);
434
435 if (\ilUserAccountSettings::getInstance()->isUserAccessRestricted()) {
436 $outer_conditions[] = $this->db->in(
437 'time_limit_owner',
438 \ilUserFilter::getInstance()->getFolderIds(),
439 false,
440 'integer'
441 );
442 }
443
444 $outer_conditions[] = '(' . implode(
445 ' OR ',
446 array_map(
447 fn(string $v) => $this->db->like($v, \ilDBConstants::T_TEXT, "%{$available_fields[$v]}%"),
448 array_keys($available_fields)
449 )
450 ) . ')';
451
452 return ' WHERE ' . implode(' AND ', $outer_conditions);
453 }
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 189 of file DatabaseDataRepository.php.

189 : void
190 {
191 $this->db->manipulateF(
192 'DELETE FROM ' . self::USER_VALUES_TABLE
193 . " WHERE field_id='{$this->db->quote($identifier, \ilDBConstants::T_TEXT)}'"
194 );
195 }

◆ deleteForUser()

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

Implements ILIAS\User\Profile\DataRepository.

Definition at line 197 of file DatabaseDataRepository.php.

197 : void
198 {
199 $this->db->manipulate(
200 'DELETE FROM ' . self::USER_BASE_TABLE
201 . " WHERE usr_id='{$this->db->quote($usr_id, \ilDBConstants::T_INTEGER)}'"
202 );
203 $this->db->manipulate(
204 'DELETE FROM ' . self::USER_VALUES_TABLE
205 . " WHERE usr_id='{$this->db->quote($usr_id, \ilDBConstants::T_INTEGER)}'"
206 );
207 }

◆ 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 299 of file DatabaseDataRepository.php.

303 : array {
304 $prepared_query = $query->withAdditionalSelectAndJoinForUdfAndMultiValueFields();
305 $cnt = $this->db->fetchObject(
306 $this->db->query($prepared_query->buildCntQueryString())
307 )->cnt ?? 0;
308
309 if ($offset >= $cnt) {
310 $offset = 0;
311 }
312
313 $this->db->setLimit($limit, $offset);
314
315 return [
316 'cnt' => $cnt,
317 'set' => $this->retrieveRecordsFromQuery($prepared_query)
318 ];
319 }

◆ 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 87 of file DatabaseDataRepository.php.

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

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 285 of file DatabaseDataRepository.php.

287 : DataQuery {
288 return new DataQuery(
289 $this->db,
290 self::USER_BASE_TABLE,
291 self::USER_VALUES_TABLE,
292 $select_fields
293 );
294 }

◆ getSearchFieldsWithAvailability()

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

Definition at line 455 of file DatabaseDataRepository.php.

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

◆ 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 $base_data = $this->db->fetchObject($base_query);
71 if ($base_data === null) {
72 throw \InvalidArgumentException(
73 'This user does not exist.'
74 );
75 }
76
77 return $this->buildFromData(
78 $base_data,
79 $this->db->fetchAll(
80 $additional_query,
82 )
83 );
84
85 }

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 499 of file DatabaseDataRepository.php.

499 : array
500 {
501 $statement = $this->db->query($query->buildRecordsQueryString());
502
503 $result = [];
504 while (($row = $this->db->fetchAssoc($statement)) !== null) {
505 $row['usr_id'] = (int) $row['usr_id'];
506 $result[] = $query->explodeArrayValues($row);
507 }
508 return $result;
509 }

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 251 of file DatabaseDataRepository.php.

255 : array {
256 $where = $this->buildSearchUsersWhereString(
257 $profile_fields_config_repo,
258 $autocomplete_query
259 );
260
261 if ($where === null) {
262 return [];
263 }
264
265 $query = $this->db->query(
266 $settings_data_repository->getSearchSelectConditionalOnVisibility(
267 self::USER_BASE_TABLE,
268 ...array_keys(self::SEARCH_FIELDS)
269 ) . PHP_EOL
270 . $where
271 );
272
273 $results = [];
274 while (($row = $this->db->fetchObject($query)) !== null) {
275 $results[] = new DefaultAutocompleteItem(
276 $row->login,
277 $row->lastname ?? '',
278 $row->firstname ?? '',
279 $autocomplete_query->getUnprocessedSearchTerm()
280 );
281 }
282 return $results;
283 }
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 110 of file DatabaseDataRepository.php.

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

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 398 of file DatabaseDataRepository.php.

398 : void
399 {
400 $this->db->manipulate(
401 'DELETE FROM ' . self::USER_VALUES_TABLE
402 . " WHERE usr_id = {$user_data->getId()}"
403 );
404
405 $values_for_storage = $user_data->getAdditionalFieldsStorageValues($this->db);
406 if ($values_for_storage === '') {
407 return;
408 }
409
410 $this->db->manipulate(
411 'INSERT INTO ' . self::USER_VALUES_TABLE . ' (usr_id, field_id, value) '
412 . 'VALUES ' . $values_for_storage
413 );
414 }

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 234 of file DatabaseDataRepository.php.

237 : void {
238 $this->db->manipulateF(
239 'UPDATE ' . self::USER_BASE_TABLE . ' SET last_visited = %s WHERE usr_id = %s',
241 [
242 $last_visited === [] ? null : serialize($last_visited),
243 $usr_id
244 ]
245 );
246 }

◆ storeLoginFor()

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

Implements ILIAS\User\Profile\DataRepository.

Definition at line 223 of file DatabaseDataRepository.php.

226 : void {
227 $this->db->manipulateF(
228 'UPDATE ' . self::USER_BASE_TABLE . ' SET login = %s WHERE usr_id = %s',
230 [$login, $usr_id]
231 );
232 }

◆ storePasswordFor()

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

Implements ILIAS\User\Profile\DataRepository.

Definition at line 209 of file DatabaseDataRepository.php.

214 : void {
215 $this->db->manipulateF(
216 'UPDATE ' . self::USER_BASE_TABLE . ' SET passwd = %s,' . PHP_EOL
217 . 'passwd_enc_type = %s, passwd_salt = %s WHERE usr_id = %s',
219 [$password, $encoding_type, $salt, $usr_id]
220 );
221 }

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: