ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
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 315 of file DatabaseDataRepository.php.

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

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

◆ buildSearchUsersWhereString()

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

Definition at line 410 of file DatabaseDataRepository.php.

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

Implements ILIAS\User\Profile\DataRepository.

Definition at line 293 of file DatabaseDataRepository.php.

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

◆ 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
list<int>$user_ids
Returns
\Generator<int, Data>

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

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

◆ getSearchFieldsWithAvailability()

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

Definition at line 449 of file DatabaseDataRepository.php.

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

◆ 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 new \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 493 of file DatabaseDataRepository.php.

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

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  $search_term 
)
Returns
list<\ILIAS\User\Search\AutocompleteItem>

Implements ILIAS\User\Profile\DataRepository.

Definition at line 248 of file DatabaseDataRepository.php.

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

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

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: