ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\User\Profile\PublicProfileGUI Class Reference

GUI class for public user profile presentation. More...

+ Collaboration diagram for ILIAS\User\Profile\PublicProfileGUI:

Public Member Functions

 setUserId (int $a_userid)
 
 getUserId ()
 
 setAdditional (array $a_additional)
 Set Additonal Information. More...
 
 getAdditional ()
 
 setBackUrl (string $backurl)
 Set Back Link URL. More...
 
 getBackUrl ()
 
 setCustomPrefs (array $a_prefs)
 Set custom preferences for public profile fields. More...
 
 setEmbedded (bool $a_value, bool $a_offline=false)
 
 executeCommand ()
 
 view ()
 View. More...
 
 getHTML ()
 
 getEmbeddable (bool $a_add_goto=false)
 get public profile html code Used in Personal Profile (as preview) and Portfolio (as page block) More...
 
 deliverVCard ()
 Deliver vcard information. More...
 
 renderTitle ()
 

Data Fields

const string DEFAULT_CMD = 'view'
 

Protected Member Functions

 getPublicPref (\ilObjUser $a_user, string $a_id)
 Get user preference for public profile. More...
 
 isProfilePublic ()
 
 validateUser (int $usr_id)
 Check if given user id is valid. More...
 
 getProfilePortfolio ()
 Check if current profile portfolio is accessible. More...
 
 doProfileAutoComplete ()
 
 approveContactRequest ()
 
 ignoreContactRequest ()
 

Private Attributes

bool $offline = false
 
GUIRequest $profile_request
 
int $userid = 0
 
string $backurl = ''
 
array $additional = []
 
bool $embedded = false
 
array $custom_prefs = []
 
ilObjUser $current_user
 
Profile $profile
 
ilSetting $setting
 
ilCtrl $ctrl
 
ilTabsGUI $tabs
 
ilGlobalTemplateInterface $tpl
 
ilRbacSystem $rbac_system
 
Language $lng
 
PublicUserProfileBadgesRenderer $badges_renderer
 

Detailed Description

GUI class for public user profile presentation.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de @ilCtrl_Calls ILIAS\User\Profile\PublicProfileGUI: ilObjPortfolioGUI

Definition at line 33 of file class.PublicProfileGUI.php.

Member Function Documentation

◆ approveContactRequest()

ILIAS\User\Profile\PublicProfileGUI::approveContactRequest ( )
protected

Definition at line 768 of file class.PublicProfileGUI.php.

768 : void
769 {
770 $osd_id = $this->profile_request->getOsdId();
771 if ($osd_id) {
772 $this->ctrl->setParameterByClass('ilBuddySystemGUI', 'osd_id', $osd_id);
773 }
774 $this->ctrl->setParameterByClass('ilBuddySystemGUI', 'user_id', $this->getUserId());
775 $this->ctrl->redirectByClass([self::class, 'ilBuddySystemGUI'], 'link');
776 }

References ILIAS\Repository\ctrl(), and ILIAS\User\Profile\PublicProfileGUI\getUserId().

+ Here is the call graph for this function:

◆ deliverVCard()

ILIAS\User\Profile\PublicProfileGUI::deliverVCard ( )

Deliver vcard information.

Definition at line 577 of file class.PublicProfileGUI.php.

577 : void
578 {
579 // get user object
580 if (!\ilObject::_exists($this->getUserId())) {
581 return;
582 }
583 $user = new \ilObjUser($this->getUserId());
584
585 $vcard = new VCard();
586
587 // ilsharedresourceGUI: embedded in shared portfolio
588 if ($user->getPref('public_profile') != 'y' &&
589 $user->getPref('public_profile') != 'g' &&
590 strtolower($this->profile_request->getBaseClass()) != 'ilsharedresourcegui' &&
591 $this->current_user->getId() != $this->getUserId()
592 ) {
593 return;
594 }
595
596 $vcard->setName($user->getLastname(), $user->getFirstname(), '', $user->getUTitle());
597 $vcard->setNickname($user->getLogin());
598
599 list($image, $type) = (new \ilUserAvatarResolver($this->getUserId()))->getUserPictureForVCard();
600 if ($image !== null) {
601 $vcard->setPhoto($image, $type);
602 }
603
604 $val_arr = [
605 'getOrgUnitsRepresentation' => 'org_units', 'getInstitution' => 'institution',
606 'getDepartment' => 'department', 'getStreet' => 'street',
607 'getZipcode' => 'zipcode', 'getCity' => 'city', 'getCountry' => 'country',
608 'getPhoneOffice' => 'phone_office', 'getPhoneHome' => 'phone_home',
609 'getPhoneMobile' => 'phone_mobile', 'getFax' => 'fax', 'getEmail' => 'email',
610 'getHobby' => 'hobby', 'getMatriculation' => 'matriculation',
611 'getClientIP' => 'client_ip', 'dummy' => 'location'
612 ];
613
614 $org = [];
615 $adr = [];
616 foreach ($val_arr as $key => $value) {
617 // if value 'y' show information
618 if ($user->getPref('public_' . $value) == 'y') {
619 switch ($value) {
620 case 'institution':
621 $org[0] = $user->$key();
622 break;
623 case 'department':
624 $org[1] = $user->$key();
625 break;
626 case 'street':
627 $adr[2] = $user->$key();
628 break;
629 case 'zipcode':
630 $adr[5] = $user->$key();
631 break;
632 case 'city':
633 $adr[3] = $user->$key();
634 break;
635 case 'country':
636 $adr[6] = $user->$key();
637 break;
638 case 'phone_office':
639 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_WORK);
640 break;
641 case 'phone_home':
642 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_HOME);
643 break;
644 case 'phone_mobile':
645 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_CELL);
646 break;
647 case 'fax':
648 $vcard->setPhone($user->$key(), VCard::TEL_TYPE_FAX);
649 break;
650 case 'email':
651 $vcard->setEmail($user->$key());
652 break;
653 case 'hobby':
654 $vcard->setNote($user->$key());
655 break;
656 case 'location':
657 $vcard->setPosition($user->getLatitude(), $user->getLongitude());
658 break;
659 }
660 }
661 }
662
663 if (count($org)) {
664 $vcard->setOrganization(implode(';', $org));
665 }
666 if (count($adr)) {
667 $vcard->setAddress(
668 $adr[0] ?? '',
669 $adr[1] ?? '',
670 $adr[2] ?? '',
671 $adr[3] ?? '',
672 $adr[4] ?? '',
673 $adr[5] ?? '',
674 $adr[6] ?? ''
675 );
676 }
677
678 \ilUtil::deliverData($vcard->buildVCard(), $vcard->getFilename(), $vcard->getMimetype());
679 }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")

References ilObject\_exists(), ilUtil\deliverData(), ILIAS\User\Profile\PublicProfileGUI\getUserId(), ILIAS\User\Profile\VCard\TEL_TYPE_CELL, ILIAS\User\Profile\VCard\TEL_TYPE_FAX, ILIAS\User\Profile\VCard\TEL_TYPE_HOME, and ILIAS\User\Profile\VCard\TEL_TYPE_WORK.

+ Here is the call graph for this function:

◆ doProfileAutoComplete()

ILIAS\User\Profile\PublicProfileGUI::doProfileAutoComplete ( )
protected

Definition at line 734 of file class.PublicProfileGUI.php.

734 : void
735 {
736 $field_id = $this->profile_request->getFieldId();
737 $term = $this->profile_request->getTerm();
738
739 $result = [];
740 $multi_fields = [
741 'interests_general',
742 'interests_help_offered',
743 'interests_help_looking'
744 ];
745 if (in_array($field_id, $multi_fields) && $term) {
746 // registration has no current user
747 $user_id = null;
748 if ($this->current_user->getId() !== 0 && $this->current_user->getId() !== ANONYMOUS_USER_ID) {
749 $user_id = $this->current_user->getId();
750 }
751
752 $result = [];
753 $cnt = 0;
754
755 // term is searched in ALL interest fields, no distinction
756 foreach (\ilObjUser::findInterests($term, $this->current_user->getId()) as $item) {
757 $result[$cnt] = new stdClass();
758 $result[$cnt]->value = $item;
759 $result[$cnt]->label = $item;
760 $cnt++;
761 }
762 }
763
764 echo json_encode($result, JSON_THROW_ON_ERROR);
765 exit();
766 }
static findInterests(string $a_term, ?int $a_user_id=null, ?string $a_field_id=null)
const ANONYMOUS_USER_ID
Definition: constants.php:27
exit

References $user_id, ANONYMOUS_USER_ID, exit, and ilObjUser\findInterests().

+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\User\Profile\PublicProfileGUI::executeCommand ( )

Definition at line 161 of file class.PublicProfileGUI.php.

161 : string
162 {
163 $ret = '';
164 if (!$this->validateUser($this->getUserId())) {
165 return '';
166 }
167 $next_class = $this->ctrl->getNextClass($this);
168 $cmd = $this->ctrl->getCmd();
169
170 $this->tpl->loadStandardTemplate();
171
172 switch ($next_class) {
173 case strtolower(\ilBuddySystemGUI::class):
174 $gui = new \ilBuddySystemGUI();
175 $this->ctrl->setReturn($this, 'view');
176 $this->ctrl->forwardCommand($gui);
177 break;
178 case strtolower(\ilObjPortfolioGUI::class):
179 $portfolio_id = $this->getProfilePortfolio();
180 if ($portfolio_id
181 && $cmd !== 'deliverVCard') {
182 $gui = new \ilObjPortfolioGUI($portfolio_id); // #11876
183 $gui->setAdditional($this->getAdditional());
184 $gui->setPermaLink($this->getUserId(), 'usr');
185 $this->ctrl->forwardCommand($gui);
186 break;
187 }
188 // no break
189 default:
190 $ret = $this->$cmd();
191 $this->tpl->setContent($ret);
192 break;
193 }
194
195 return (string) $ret;
196 }
getProfilePortfolio()
Check if current profile portfolio is accessible.
validateUser(int $usr_id)
Check if given user id is valid.
Class ilBuddySystemGUI.

References ILIAS\Repository\ctrl(), ILIAS\User\Profile\PublicProfileGUI\getAdditional(), ILIAS\User\Profile\PublicProfileGUI\getProfilePortfolio(), ILIAS\User\Profile\PublicProfileGUI\getUserId(), and ILIAS\User\Profile\PublicProfileGUI\validateUser().

+ Here is the call graph for this function:

◆ getAdditional()

ILIAS\User\Profile\PublicProfileGUI::getAdditional ( )

◆ getBackUrl()

ILIAS\User\Profile\PublicProfileGUI::getBackUrl ( )

Definition at line 130 of file class.PublicProfileGUI.php.

130 : string
131 {
132 return $this->backurl;
133 }

References ILIAS\User\Profile\PublicProfileGUI\$backurl.

Referenced by ILIAS\User\Profile\PublicProfileGUI\getEmbeddable().

+ Here is the caller graph for this function:

◆ getEmbeddable()

ILIAS\User\Profile\PublicProfileGUI::getEmbeddable ( bool  $a_add_goto = false)

get public profile html code Used in Personal Profile (as preview) and Portfolio (as page block)

Definition at line 258 of file class.PublicProfileGUI.php.

258 : string
259 {
260 $h = $v = '';
261
262 // get user object
263 if (!\ilObject::_exists($this->getUserId())) {
264 return '';
265 }
266 $user = new \ilObjUser($this->getUserId());
267
268 $tpl = new \ilTemplate(
269 'tpl.usr_public_profile.html',
270 true,
271 true,
272 'components/ILIAS/User'
273 );
274
275
276 $tpl->setVariable('ROWCOL1', 'tblrow1');
277 $tpl->setVariable('ROWCOL2', 'tblrow2');
278
279 if (!$this->offline && $this->current_user->getId() !== ANONYMOUS_USER_ID) {
280 $ref_url = str_replace('&', '&', $this->getBackUrl());
281 if ($ref_url === '') {
282 $ref_url = basename($_SERVER['REQUEST_URI']);
283 }
284
285 $mail_url = '';
286 if ($this->rbac_system->checkAccess('internal_mail', \ilMailGlobalServices::getMailObjectRefId())) {
288 $ref_url,
289 '',
290 [],
291 [
292 'type' => 'new',
293 'rcp_to' => $user->getLogin()
294 ]
295 );
296 } elseif ($user->getPref('public_profile') === 'g'
297 || !$this->current_user->isAnonymous()
298 && $user->getPref('public_profile') === 'y'
299 && $user->getPref('public_email')
300 && $user->getEmail() !== '') {
301 $mail_url = 'mailto:' . $user->getEmail();
302 }
303
304 if ($mail_url !== '') {
305 $tpl->setCurrentBlock('mail');
306 $tpl->setVariable('TXT_MAIL', $this->lng->txt('send_mail'));
307 $tpl->setVariable('HREF_MAIL', $mail_url);
309 }
310 }
311
312 if (!$this->isProfilePublic()) {
313 $tpl->setVariable('TXT_NAME', $this->lng->txt('name'));
314 $tpl->setVariable('FIRSTNAME', \ilUserUtil::getNamePresentation($user->getId()));
315 return $tpl->get();
316 }
317
318 $first_name = '';
319 if ($this->getPublicPref($user, 'public_title') === 'y') {
320 $first_name .= $user->getUTitle() . ' ';
321 }
322 $first_name .= $user->getFirstname();
323
324 if ($this->getPublicPref($user, 'public_gender') === 'y' && in_array($user->getGender(), ['m', 'f'])) {
326 'SALUTATION',
327 "{$this->lng->txt("salutation_{$user->getGender()}")} "
328 );
329 }
330
331 $tpl->setVariable('TXT_NAME', $this->lng->txt('name'));
332 $tpl->setVariable('FIRSTNAME', $first_name);
333 $tpl->setVariable('LASTNAME', $user->getLastname());
334
335 if ($user->getBirthday()
336 && $this->getPublicPref($user, 'public_birthday') == 'y') {
337 $tpl->setCurrentBlock('bday_bl');
338 $tpl->setVariable('TXT_BIRTHDAY', $this->lng->txt('birthday'));
339 $tpl->setVariable('VAL_BIRTHDAY', \ilDatePresentation::formatDate(new \ilDate($user->getBirthday(), IL_CAL_DATE)));
341 }
342
343 if (!$this->offline) {
344 $tpl->setCurrentBlock('vcard');
345 $tpl->setVariable('TXT_VCARD', $this->lng->txt('vcard'));
346 $tpl->setVariable('TXT_DOWNLOAD_VCARD', $this->lng->txt('vcard_download'));
347 $this->ctrl->setParameter($this, 'user_id', $this->getUserId());
348 $tpl->setVariable('HREF_VCARD', $this->ctrl->getLinkTarget($this, 'deliverVCard'));
349 }
350
351 if ($this->getPublicPref($user, 'public_avatar') === 'y'
352 && ($this->current_user->getId() !== ANONYMOUS_USER_ID || $user->getPref('public_profile') === 'g')) {
353 $define = new \ilUserAvatarResolver($user->getId());
354 $define->setForcePicture(false);
355 $define->setSize('big');
356
357 $tpl->setCurrentBlock('image');
358 $tpl->setVariable('TXT_IMAGE', $this->lng->txt('image'));
359 $tpl->setVariable('IMAGE_PATH', $define->getLegacyPictureURL());
360 $tpl->setVariable('IMAGE_ALT', $this->lng->txt('personal_picture'));
362 }
363
364 // address
365 if ($this->getPublicPref($user, 'public_street') == 'y' ||
366 $this->getPublicPref($user, 'public_zipcode') == 'y' ||
367 $this->getPublicPref($user, 'public_city') == 'y' ||
368 $this->getPublicPref($user, 'public_country') == 'y') {
369 $address = [];
370 $val_arr = [
371 'getStreet' => 'street',
372 'getZipcode' => 'zipcode',
373 'getCity' => 'city',
374 'getCountry' => 'country',
375 'getSelectedCountry' => 'sel_country'
376 ];
377 foreach ($val_arr as $key => $value) {
378 // if value 'y' show information
379 if ($this->getPublicPref($user, 'public_' . $value) == 'y') {
380 $address_value = $user->$key();
381
382 // only if set
383 if (trim($address_value) != '') {
384 switch ($value) {
385 case 'street':
386 $address[0] = $address_value;
387 break;
388
389 case 'zipcode':
390 case 'city':
391 $address[1] = isset($address[1])
392 ? "{$address[1]} {$address_value}"
393 : $address_value;
394 break;
395
396 case 'sel_country':
397 $this->lng->loadLanguageModule('meta');
398 $address[2] = $this->lng->txt('meta_c_' . $address_value);
399 break;
400
401 case 'country':
402 $address[2] = $address_value;
403 break;
404 }
405 }
406 }
407 }
408 if ($address !== []) {
409 $tpl->setCurrentBlock('address_line');
410 foreach ($address as $line) {
411 if (trim($line)) {
412 $tpl->setVariable('TXT_ADDRESS_LINE', trim($line));
414 }
415 }
416 $tpl->setCurrentBlock('address');
417 $tpl->setVariable('TXT_ADDRESS', $this->lng->txt('address'));
419 }
420 }
421
422 // if value 'y' show information
423 if ($this->getPublicPref($user, 'public_org_units') === 'y') {
424 $tpl->setCurrentBlock('org_units');
425 $tpl->setVariable('TXT_ORG_UNITS', $this->lng->txt('objs_orgu'));
426 $tpl->setVariable('ORG_UNITS', $user->getOrgUnitsRepresentation());
428 }
429
430 if ($this->getPublicPref($user, 'public_institution') === 'y'
431 || $this->getPublicPref($user, 'public_department') === 'y') {
432 $tpl->setCurrentBlock('inst_dep');
433 $sep = '';
434 if ($this->getPublicPref($user, 'public_institution') === 'y') {
435 $h = $this->lng->txt('institution');
436 $v = $user->getInstitution();
437 $sep = ' / ';
438 }
439 if ($this->getPublicPref($user, 'public_department') === 'y') {
440 $h .= $sep . $this->lng->txt('department');
441 $v .= $sep . $user->getDepartment();
442 }
443 $tpl->setVariable('TXT_INST_DEP', $h);
444 $tpl->setVariable('INST_DEP', $v);
446 }
447
448 // contact
449 $val_arr = [
450 'getPhoneOffice' => 'phone_office', 'getPhoneHome' => 'phone_home',
451 'getPhoneMobile' => 'phone_mobile', 'getFax' => 'fax', 'getEmail' => 'email', 'getSecondEmail' => 'second_email'
452 ];
453 $v = $sep = '';
454 foreach ($val_arr as $key => $value) {
455 // if value 'y' show information
456 if ($this->getPublicPref($user, 'public_' . $value) == 'y') {
457 $v .= $sep . $this->lng->txt($value) . ': ' . $user->$key();
458 $sep = '<br />';
459 }
460 }
461 if ($v != '') {
462 $tpl->parseCurrentBlock('contact');
463 $tpl->setVariable('TXT_CONTACT', $this->lng->txt('contact'));
464 $tpl->setVariable('CONTACT', $v);
466 }
467
468
469 $val_arr = [
470 'getHobby' => 'hobby',
471 'getGeneralInterestsAsText' => 'interests_general',
472 'getOfferingHelpAsText' => 'interests_help_offered',
473 'getLookingForHelpAsText' => 'interests_help_looking',
474 'getMatriculation' => 'matriculation',
475 'getClientIP' => 'client_ip'
476 ];
477
478 foreach ($val_arr as $key => $value) {
479 // if value 'y' show information
480 if ($this->getPublicPref($user, 'public_' . $value) == 'y') {
481 $tpl->setCurrentBlock('profile_data');
482 $tpl->setVariable('TXT_DATA', $this->lng->txt($value));
483 $tpl->setVariable('DATA', $user->$key());
485 }
486 }
487
488 // portfolios
490 [$this->getUserId()]
491 );
492 $cnt = 0;
493 if ($port !== []) {
494 foreach ($port as $u) {
495 $tpl->setCurrentBlock('portfolio');
496 foreach ($u as $link => $title) {
497 $cnt++;
498 $tpl->setVariable('HREF_PORTFOLIO', $link);
499 $tpl->setVariable('TITLE_PORTFOLIO', $title);
501 }
502 }
503 $tpl->setCurrentBlock('portfolios');
504 if ($cnt > 1) {
505 $this->lng->loadLanguageModule('prtf');
506 $tpl->setVariable('TXT_PORTFOLIO', $this->lng->txt('prtf_portfolios'));
507 } else {
508 $tpl->setVariable('TXT_PORTFOLIO', $this->lng->txt('portfolio'));
509 }
511 }
512
513 // map
515 && $this->getPublicPref($user, 'public_location') === 'y'
516 && $user->getLatitude() != '') {
517 $tpl->setVariable('TXT_LOCATION', $this->lng->txt('location'));
518
519 $map_gui = \ilMapUtil::getMapGUI();
520 $map_gui->setMapId('user_map_' . md5($user->getLogin()))
521 ->setWidth('350px')
522 ->setHeight('230px')
523 ->setLatitude($user->getLatitude())
524 ->setLongitude($user->getLongitude())
525 ->setZoom($user->getLocationZoom())
526 ->setEnableNavigationControl(true)
527 ->addUserMarker($user->getId());
528
529 $tpl->setVariable('MAP_CONTENT', $map_gui->getHtml());
530 }
531
532 foreach ($this->profile->getVisibleUserDefinedFields(Context::User) as $field) {
533 $value = $field->retrieveValueFromUser($user);
534 if ($value === '' || $value === '-' || $value === null) {
535 continue;
536 }
537 $tpl->setCurrentBlock('udf_data');
538 $tpl->setVariable('TXT_UDF_DATA', $field->getLabel($this->lng));
539 $tpl->setVariable('UDF_DATA', $value);
541 }
542
543 foreach ($this->getAdditional() as $key => $val) {
544 $tpl->setCurrentBlock('profile_data');
545 $tpl->setVariable('TXT_DATA', $key);
546 $tpl->setVariable('DATA', $val);
548 }
549
550 if ($this->getUserId() !== $this->current_user->getId()
551 && !$this->current_user->isAnonymous()
552 && !\ilObjUser::_isAnonymous($this->getUserId())) {
553 $button = \ilBuddySystemLinkButton::getInstanceByUserId($user->getId());
554 $tpl->setVariable('BUDDY_HTML', $button->getHtml());
555 }
556
557 //badge
558 $tpl->setVariable('USER_BADGES', $this->badges_renderer->render($user->getId()));
559
560 $goto = '';
561 if ($a_add_goto) {
562 $mtpl = $this->tpl;
563
564 $mtpl->setPermanentLink(
565 'usr',
566 $user->getId(),
567 '',
568 '_top'
569 );
570 }
571 return $tpl->get() . $goto;
572 }
getPublicPref(\ilObjUser $a_user, string $a_id)
Get user preference for public profile.
const IL_CAL_DATE
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
Class for single dates.
static getLinkTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static isActivated()
Checks whether Map feature is activated.
static getMapGUI()
Get an instance of the GUI class.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids)
static _isAnonymous(int $usr_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26

References $_SERVER, ILIAS\User\Profile\PublicProfileGUI\$tpl, ilObject\_exists(), ilObjUser\_isAnonymous(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ILIAS\UICore\GlobalTemplate\get(), ILIAS\User\Profile\PublicProfileGUI\getAdditional(), ilObjPortfolio\getAvailablePortfolioLinksForUserIds(), ILIAS\User\Profile\PublicProfileGUI\getBackUrl(), ilBuddySystemLinkButton\getInstanceByUserId(), ilMailFormCall\getLinkTarget(), ilMailGlobalServices\getMailObjectRefId(), ilMapUtil\getMapGUI(), ilUserUtil\getNamePresentation(), ILIAS\User\Profile\PublicProfileGUI\getPublicPref(), ILIAS\User\Profile\PublicProfileGUI\getUserId(), IL_CAL_DATE, ilMapUtil\isActivated(), ILIAS\User\Profile\PublicProfileGUI\isProfilePublic(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\Repository\profile(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\setPermanentLink(), and ILIAS\UICore\GlobalTemplate\setVariable().

Referenced by ILIAS\User\Profile\PublicProfileGUI\getHTML().

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

◆ getHTML()

ILIAS\User\Profile\PublicProfileGUI::getHTML ( )

Definition at line 216 of file class.PublicProfileGUI.php.

216 : string
217 {
218 if ($this->embedded) {
219 return $this->getEmbeddable();
220 }
221
222 // #15438 - (currently) inactive user?
223 $is_active = true;
224 $user = new \ilObjUser($this->getUserId());
225 if (!$user->getActive() ||
226 !$user->checkTimeLimit()) {
227 $is_active = false;
228 }
229
230 if ($is_active && $this->getProfilePortfolio()) {
231 $this->ctrl->redirectByClass('ilobjportfoliogui', 'preview');
232 }
233
234 if (!$is_active) {
235 \ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
236 }
237
238 $profile_public = $user->getPref('public_profile');
239 if ($user->getPref('public_profile') === 'g' && !$this->setting->get('enable_global_profiles')) {
240 $profile_public = 'y';
241 }
242
243 if ($profile_public !== 'y'
244 && ($profile_public !== 'g' || !$this->setting->get('enable_global_profiles'))
245 && !$this->custom_prefs) {
246 \ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
247 }
248
249 $this->renderTitle();
250 return $this->getEmbeddable(true);
251 }
getEmbeddable(bool $a_add_goto=false)
get public profile html code Used in Personal Profile (as preview) and Portfolio (as page block)
static redirect(string $a_script)

References ILIAS\Repository\ctrl(), ILIAS\User\Profile\PublicProfileGUI\getEmbeddable(), ILIAS\User\Profile\PublicProfileGUI\getProfilePortfolio(), ILIAS\User\Profile\PublicProfileGUI\getUserId(), ilUtil\redirect(), and ILIAS\User\Profile\PublicProfileGUI\renderTitle().

Referenced by ILIAS\User\Profile\PublicProfileGUI\view().

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

◆ getProfilePortfolio()

ILIAS\User\Profile\PublicProfileGUI::getProfilePortfolio ( )
protected

Check if current profile portfolio is accessible.

Definition at line 722 of file class.PublicProfileGUI.php.

722 : ?int
723 {
724 $portfolio_id = \ilObjPortfolio::getDefaultPortfolio($this->getUserId());
725 if ($portfolio_id) {
726 $access_handler = new \ilPortfolioAccessHandler();
727 if ($access_handler->checkAccess('read', '', $portfolio_id)) {
728 return $portfolio_id;
729 }
730 }
731 return null;
732 }
static getDefaultPortfolio(int $a_user_id)

References ilObjPortfolio\getDefaultPortfolio(), and ILIAS\User\Profile\PublicProfileGUI\getUserId().

Referenced by ILIAS\User\Profile\PublicProfileGUI\executeCommand(), and ILIAS\User\Profile\PublicProfileGUI\getHTML().

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

◆ getPublicPref()

ILIAS\User\Profile\PublicProfileGUI::getPublicPref ( \ilObjUser  $a_user,
string  $a_id 
)
protected

Get user preference for public profile.

Definition at line 146 of file class.PublicProfileGUI.php.

146 : string
147 {
148 if (!$this->custom_prefs) {
149 return (string) $a_user->getPref($a_id);
150 } else {
151 return (string) ($this->custom_prefs[$a_id] ?? '');
152 }
153 }

References ilObjUser\getPref().

Referenced by ILIAS\User\Profile\PublicProfileGUI\getEmbeddable().

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

◆ getUserId()

◆ ignoreContactRequest()

ILIAS\User\Profile\PublicProfileGUI::ignoreContactRequest ( )
protected

Definition at line 778 of file class.PublicProfileGUI.php.

778 : void
779 {
780 $osd_id = $this->profile_request->getOsdId();
781 if ($osd_id > 0) {
782 $this->ctrl->setParameterByClass('ilBuddySystemGUI', 'osd_id', $osd_id);
783 }
784
785 $this->ctrl->setParameterByClass('ilBuddySystemGUI', 'user_id', $this->getUserId());
786 $this->ctrl->redirectByClass([self::class, 'ilBuddySystemGUI'], 'ignore');
787 }

References ILIAS\Repository\ctrl(), and ILIAS\User\Profile\PublicProfileGUI\getUserId().

+ Here is the call graph for this function:

◆ isProfilePublic()

ILIAS\User\Profile\PublicProfileGUI::isProfilePublic ( )
protected

Definition at line 206 of file class.PublicProfileGUI.php.

206 : bool
207 {
208 $user = new \ilObjUser($this->getUserId());
209 $current = $user->getPref('public_profile');
210 if ($user->getPref('public_profile') === 'g' && !$this->setting->get('enable_global_profiles')) {
211 $current = 'y';
212 }
213 return in_array($current, ['g', 'y']);
214 }

References ILIAS\User\Profile\PublicProfileGUI\getUserId().

Referenced by ILIAS\User\Profile\PublicProfileGUI\getEmbeddable().

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

◆ renderTitle()

ILIAS\User\Profile\PublicProfileGUI::renderTitle ( )

Definition at line 712 of file class.PublicProfileGUI.php.

712 : void
713 {
714 $this->tpl->resetHeaderBlock();
715 $this->tpl->setTitle(\ilUserUtil::getNamePresentation($this->getUserId()));
716 $this->tpl->setTitleIcon(\ilObjUser::_getPersonalPicturePath($this->getUserId(), 'xsmall'));
717 }
static _getPersonalPicturePath(int $usr_id, string $size='small', bool $force_pic=false)

References ilObjUser\_getPersonalPicturePath(), ilUserUtil\getNamePresentation(), and ILIAS\User\Profile\PublicProfileGUI\getUserId().

Referenced by ILIAS\User\Profile\PublicProfileGUI\getHTML().

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

◆ setAdditional()

ILIAS\User\Profile\PublicProfileGUI::setAdditional ( array  $a_additional)

Set Additonal Information.

Definition at line 105 of file class.PublicProfileGUI.php.

105 : void
106 {
107 $this->additional = $a_additional;
108 }

◆ setBackUrl()

ILIAS\User\Profile\PublicProfileGUI::setBackUrl ( string  $backurl)

Set Back Link URL.

Definition at line 118 of file class.PublicProfileGUI.php.

118 : void
119 {
120 // we only allow relative links
121 $parts = parse_url($backurl);
122 $host = $parts['host'] ?? '';
123 if ($host !== '') {
124 $backurl = '#';
125 }
126 $this->backurl = $backurl;
127 $this->ctrl->setParameter($this, 'back_url', rawurlencode($backurl));
128 }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61

References ILIAS\User\Profile\PublicProfileGUI\$backurl, $parts, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ setCustomPrefs()

ILIAS\User\Profile\PublicProfileGUI::setCustomPrefs ( array  $a_prefs)

Set custom preferences for public profile fields.

Definition at line 138 of file class.PublicProfileGUI.php.

138 : void // Missing array type.
139 {
140 $this->custom_prefs = $a_prefs;
141 }

◆ setEmbedded()

ILIAS\User\Profile\PublicProfileGUI::setEmbedded ( bool  $a_value,
bool  $a_offline = false 
)

Definition at line 155 of file class.PublicProfileGUI.php.

155 : void
156 {
157 $this->embedded = $a_value;
158 $this->offline = $a_offline;
159 }

◆ setUserId()

ILIAS\User\Profile\PublicProfileGUI::setUserId ( int  $a_userid)

Definition at line 92 of file class.PublicProfileGUI.php.

92 : void
93 {
94 $this->userid = $a_userid;
95 }

◆ validateUser()

ILIAS\User\Profile\PublicProfileGUI::validateUser ( int  $usr_id)
protected

Check if given user id is valid.

Definition at line 684 of file class.PublicProfileGUI.php.

684 : bool
685 {
686 if (\ilObject::_lookupType($usr_id) !== 'usr') {
687 return false;
688 }
689
690 $user = new \ilObjUser($usr_id);
691
692 if ($this->current_user->isAnonymous()) {
693 if (strtolower($this->ctrl->getCmd()) == strtolower('approveContactRequest')) {
694 $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usr_id . '_contact_approved');
695 } elseif (strtolower($this->ctrl->getCmd()) == strtolower('ignoreContactRequest')) {
696 $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usr_id . '_contact_ignored');
697 }
698
699 if ($user->getPref('public_profile') != 'g') {
700 // #12151
701 if ($user->getPref('public_profile') == 'y') {
702 $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usr_id);
703 }
704
705 return false;
706 }
707 }
708
709 return true;
710 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType(), and ILIAS\Repository\ctrl().

Referenced by ILIAS\User\Profile\PublicProfileGUI\executeCommand().

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

◆ view()

ILIAS\User\Profile\PublicProfileGUI::view ( )

View.

This one is called e.g. through the goto script

Definition at line 201 of file class.PublicProfileGUI.php.

201 : string
202 {
203 return $this->getHTML();
204 }

References ILIAS\User\Profile\PublicProfileGUI\getHTML().

+ Here is the call graph for this function:

Field Documentation

◆ $additional

array ILIAS\User\Profile\PublicProfileGUI::$additional = []
private

◆ $backurl

string ILIAS\User\Profile\PublicProfileGUI::$backurl = ''
private

◆ $badges_renderer

PublicUserProfileBadgesRenderer ILIAS\User\Profile\PublicProfileGUI::$badges_renderer
private

Definition at line 52 of file class.PublicProfileGUI.php.

◆ $ctrl

ilCtrl ILIAS\User\Profile\PublicProfileGUI::$ctrl
private

Definition at line 47 of file class.PublicProfileGUI.php.

◆ $current_user

ilObjUser ILIAS\User\Profile\PublicProfileGUI::$current_user
private

Definition at line 44 of file class.PublicProfileGUI.php.

◆ $custom_prefs

array ILIAS\User\Profile\PublicProfileGUI::$custom_prefs = []
private

Definition at line 43 of file class.PublicProfileGUI.php.

◆ $embedded

bool ILIAS\User\Profile\PublicProfileGUI::$embedded = false
private

Definition at line 42 of file class.PublicProfileGUI.php.

◆ $lng

Language ILIAS\User\Profile\PublicProfileGUI::$lng
private

Definition at line 51 of file class.PublicProfileGUI.php.

◆ $offline

bool ILIAS\User\Profile\PublicProfileGUI::$offline = false
private

Definition at line 37 of file class.PublicProfileGUI.php.

◆ $profile

Profile ILIAS\User\Profile\PublicProfileGUI::$profile
private

Definition at line 45 of file class.PublicProfileGUI.php.

◆ $profile_request

GUIRequest ILIAS\User\Profile\PublicProfileGUI::$profile_request
private

Definition at line 38 of file class.PublicProfileGUI.php.

◆ $rbac_system

ilRbacSystem ILIAS\User\Profile\PublicProfileGUI::$rbac_system
private

Definition at line 50 of file class.PublicProfileGUI.php.

◆ $setting

ilSetting ILIAS\User\Profile\PublicProfileGUI::$setting
private

Definition at line 46 of file class.PublicProfileGUI.php.

◆ $tabs

ilTabsGUI ILIAS\User\Profile\PublicProfileGUI::$tabs
private

Definition at line 48 of file class.PublicProfileGUI.php.

◆ $tpl

ilGlobalTemplateInterface ILIAS\User\Profile\PublicProfileGUI::$tpl
private

◆ $userid

int ILIAS\User\Profile\PublicProfileGUI::$userid = 0
private

◆ DEFAULT_CMD

const string ILIAS\User\Profile\PublicProfileGUI::DEFAULT_CMD = 'view'

Definition at line 35 of file class.PublicProfileGUI.php.


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