ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\User\Profile\PublicProfileGUI Class Reference

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

+ Inheritance diagram for ILIAS\User\Profile\PublicProfileGUI:
+ 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 ()
 

Protected Member Functions

 getPublicPref (\ilObjUser $a_user, string $a_id)
 Get user preference for public profile. More...
 
 isProfilePublic ()
 
 validateUser (int $usrId)
 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 772 of file class.PublicProfileGUI.php.

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

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 581 of file class.PublicProfileGUI.php.

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

738 : void
739 {
740 $field_id = $this->profile_request->getFieldId();
741 $term = $this->profile_request->getTerm();
742
743 $result = [];
744 $multi_fields = [
745 'interests_general',
746 'interests_help_offered',
747 'interests_help_looking'
748 ];
749 if (in_array($field_id, $multi_fields) && $term) {
750 // registration has no current user
751 $user_id = null;
752 if ($this->current_user->getId() !== 0 && $this->current_user->getId() !== ANONYMOUS_USER_ID) {
753 $user_id = $this->current_user->getId();
754 }
755
756 $result = [];
757 $cnt = 0;
758
759 // term is searched in ALL interest fields, no distinction
760 foreach (\ilObjUser::findInterests($term, $this->current_user->getId()) as $item) {
761 $result[$cnt] = new stdClass();
762 $result[$cnt]->value = $item;
763 $result[$cnt]->label = $item;
764 $cnt++;
765 }
766 }
767
768 echo json_encode($result, JSON_THROW_ON_ERROR);
769 exit();
770 }
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 159 of file class.PublicProfileGUI.php.

159 : string
160 {
161 $ret = '';
162 if (!$this->validateUser($this->getUserId())) {
163 return '';
164 }
165 $next_class = $this->ctrl->getNextClass($this);
166 $cmd = $this->ctrl->getCmd();
167
168 $this->tpl->loadStandardTemplate();
169
170 switch ($next_class) {
171 case strtolower(\ilBuddySystemGUI::class):
172 $gui = new \ilBuddySystemGUI();
173 $this->ctrl->setReturn($this, 'view');
174 $this->ctrl->forwardCommand($gui);
175 break;
176 case strtolower(\ilObjPortfolioGUI::class):
177 $portfolio_id = $this->getProfilePortfolio();
178 if ($portfolio_id
179 && $cmd !== 'deliverVCard') {
180 $gui = new \ilObjPortfolioGUI($portfolio_id); // #11876
181 $gui->setAdditional($this->getAdditional());
182 $gui->setPermaLink($this->getUserId(), 'usr');
183 $this->ctrl->forwardCommand($gui);
184 break;
185 }
186 // no break
187 default:
188 $ret = $this->$cmd();
189 $this->tpl->setContent($ret);
190 break;
191 }
192
193 // only for direct links
194 if (strtolower($this->profile_request->getBaseClass()) === strtolower(self::class)) {
195 $this->tpl->printToStdout();
196 }
197 return (string) $ret;
198 }
getProfilePortfolio()
Check if current profile portfolio is accessible.
validateUser(int $usrId)
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 128 of file class.PublicProfileGUI.php.

128 : string
129 {
130 return $this->backurl;
131 }

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 260 of file class.PublicProfileGUI.php.

260 : string
261 {
262 $h = $v = '';
263
264 // get user object
265 if (!\ilObject::_exists($this->getUserId())) {
266 return '';
267 }
268 $user = new \ilObjUser($this->getUserId());
269
270 $tpl = new \ilTemplate(
271 'tpl.usr_public_profile.html',
272 true,
273 true,
274 'components/ILIAS/User'
275 );
276
277
278 $tpl->setVariable('ROWCOL1', 'tblrow1');
279 $tpl->setVariable('ROWCOL2', 'tblrow2');
280
281 if (!$this->offline && $this->current_user->getId() !== ANONYMOUS_USER_ID) {
282 $ref_url = str_replace('&', '&', $this->getBackUrl());
283 if ($ref_url === '') {
284 $ref_url = basename($_SERVER['REQUEST_URI']);
285 }
286
287 $mail_url = '';
288 if ($this->rbac_system->checkAccess('internal_mail', \ilMailGlobalServices::getMailObjectRefId())) {
290 $ref_url,
291 '',
292 [],
293 [
294 'type' => 'new',
295 'rcp_to' => $user->getLogin()
296 ]
297 );
298 } elseif ($user->getPref('public_profile') === 'g'
299 || !$this->current_user->isAnonymous()
300 && $user->getPref('public_profile') === 'y'
301 && $user->getPref('public_email')
302 && $user->getEmail() !== '') {
303 $mail_url = 'mailto:' . $user->getEmail();
304 }
305
306 if ($mail_url !== '') {
307 $tpl->setCurrentBlock('mail');
308 $tpl->setVariable('TXT_MAIL', $this->lng->txt('send_mail'));
309 $tpl->setVariable('HREF_MAIL', $mail_url);
311 }
312 }
313
314 if (!$this->isProfilePublic()) {
315 $tpl->setVariable('TXT_NAME', $this->lng->txt('name'));
316 $tpl->setVariable('FIRSTNAME', \ilUserUtil::getNamePresentation($user->getId()));
317 return $tpl->get();
318 }
319
320 $first_name = '';
321 if ($this->getPublicPref($user, 'public_title') === 'y') {
322 $first_name .= $user->getUTitle() . ' ';
323 }
324 $first_name .= $user->getFirstname();
325
326 if ($this->getPublicPref($user, 'public_gender') === 'y' && in_array($user->getGender(), ['m', 'f'])) {
328 'SALUTATION',
329 "{$this->lng->txt("salutation_{$user->getGender()}")} "
330 );
331 }
332
333 $tpl->setVariable('TXT_NAME', $this->lng->txt('name'));
334 $tpl->setVariable('FIRSTNAME', $first_name);
335 $tpl->setVariable('LASTNAME', $user->getLastname());
336
337 if ($user->getBirthday()
338 && $this->getPublicPref($user, 'public_birthday') == 'y') {
339 $tpl->setCurrentBlock('bday_bl');
340 $tpl->setVariable('TXT_BIRTHDAY', $this->lng->txt('birthday'));
341 $tpl->setVariable('VAL_BIRTHDAY', \ilDatePresentation::formatDate(new \ilDate($user->getBirthday(), IL_CAL_DATE)));
343 }
344
345 if (!$this->offline) {
346 $tpl->setCurrentBlock('vcard');
347 $tpl->setVariable('TXT_VCARD', $this->lng->txt('vcard'));
348 $tpl->setVariable('TXT_DOWNLOAD_VCARD', $this->lng->txt('vcard_download'));
349 $this->ctrl->setParameter($this, 'user_id', $this->getUserId());
350 $tpl->setVariable('HREF_VCARD', $this->ctrl->getLinkTarget($this, 'deliverVCard'));
351 }
352
353 $imagefile = \ilObjUser::_getPersonalPicturePath($user->getId(), 'big', false, true);
354 if ($this->getPublicPref($user, 'public_upload') === 'y' && $imagefile !== ''
355 && ($this->current_user->getId() !== ANONYMOUS_USER_ID || $user->getPref('public_profile') === 'g')) {
356
357 $tpl->setCurrentBlock('image');
358 $tpl->setVariable('TXT_IMAGE', $this->lng->txt('image'));
359 $tpl->setVariable('IMAGE_PATH', $imagefile);
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
489 $back = ($this->getBackUrl() != '')
490 ? $this->getBackUrl()
491 : \ilLink::_getStaticLink($this->getUserId(), 'usr', true);
493 [$this->getUserId()],
494 $back
495 );
496 $cnt = 0;
497 if ($port !== []) {
498 foreach ($port as $u) {
499 $tpl->setCurrentBlock('portfolio');
500 foreach ($u as $link => $title) {
501 $cnt++;
502 $tpl->setVariable('HREF_PORTFOLIO', $link);
503 $tpl->setVariable('TITLE_PORTFOLIO', $title);
505 }
506 }
507 $tpl->setCurrentBlock('portfolios');
508 if ($cnt > 1) {
509 $this->lng->loadLanguageModule('prtf');
510 $tpl->setVariable('TXT_PORTFOLIO', $this->lng->txt('prtf_portfolios'));
511 } else {
512 $tpl->setVariable('TXT_PORTFOLIO', $this->lng->txt('portfolio'));
513 }
515 }
516
517 // map
519 && $this->getPublicPref($user, 'public_location') === 'y'
520 && $user->getLatitude() != '') {
521 $tpl->setVariable('TXT_LOCATION', $this->lng->txt('location'));
522
523 $map_gui = \ilMapUtil::getMapGUI();
524 $map_gui->setMapId('user_map_' . md5($user->login))
525 ->setWidth('350px')
526 ->setHeight('230px')
527 ->setLatitude($user->getLatitude())
528 ->setLongitude($user->getLongitude())
529 ->setZoom($user->getLocationZoom())
530 ->setEnableNavigationControl(true)
531 ->addUserMarker($user->getId());
532
533 $tpl->setVariable('MAP_CONTENT', $map_gui->getHtml());
534 }
535
536 foreach ($this->profile->getVisibleUserDefinedFields(Context::User) as $field) {
537 // public setting
538 if ($this->getPublicPref($user, 'public_udf_' . $field->getIdentifier()) === 'y'
539 && !empty(($value = $field->retrieveValueFromUser($user)))) {
540 $tpl->setCurrentBlock('udf_data');
541 $tpl->setVariable('TXT_UDF_DATA', $field->getLabel($this->lng));
542 $tpl->setVariable('UDF_DATA', $value);
544 }
545 }
546
547 foreach ($this->getAdditional() as $key => $val) {
548 $tpl->setCurrentBlock('profile_data');
549 $tpl->setVariable('TXT_DATA', $key);
550 $tpl->setVariable('DATA', $val);
552 }
553
554 if ($this->getUserId() !== $this->current_user->getId()
555 && !$this->current_user->isAnonymous()
556 && !\ilObjUser::_isAnonymous($this->getUserId())) {
557 $button = \ilBuddySystemLinkButton::getInstanceByUserId($user->getId());
558 $tpl->setVariable('BUDDY_HTML', $button->getHtml());
559 }
560
561 //badge
562 $tpl->setVariable('USER_BADGES', $this->badges_renderer->render($user->getId()));
563
564 $goto = '';
565 if ($a_add_goto) {
566 $mtpl = $this->tpl;
567
568 $mtpl->setPermanentLink(
569 'usr',
570 $user->getId(),
571 '',
572 '_top'
573 );
574 }
575 return $tpl->get() . $goto;
576 }
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, ?string $a_back_url=null)
static _isAnonymous(int $usr_id)
static _getPersonalPicturePath(int $a_usr_id, string $a_size='small', bool $a_force_pic=false)
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\_getPersonalPicturePath(), ilLink\_getStaticLink(), 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 218 of file class.PublicProfileGUI.php.

218 : string
219 {
220 if ($this->embedded) {
221 return $this->getEmbeddable();
222 }
223
224 // #15438 - (currently) inactive user?
225 $is_active = true;
226 $user = new \ilObjUser($this->getUserId());
227 if (!$user->getActive() ||
228 !$user->checkTimeLimit()) {
229 $is_active = false;
230 }
231
232 if ($is_active && $this->getProfilePortfolio()) {
233 $this->ctrl->redirectByClass('ilobjportfoliogui', 'preview');
234 }
235
236 if (!$is_active) {
237 \ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
238 }
239
240 $profile_public = $user->getPref('public_profile');
241 if ($user->getPref('public_profile') === 'g' && !$this->setting->get('enable_global_profiles')) {
242 $profile_public = 'y';
243 }
244
245 if ($profile_public !== 'y'
246 && ($profile_public !== 'g' || !$this->setting->get('enable_global_profiles'))
247 && !$this->custom_prefs) {
248 \ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
249 }
250
251 $this->renderTitle();
252 return $this->getEmbeddable(true);
253 }
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 726 of file class.PublicProfileGUI.php.

726 : ?int
727 {
728 $portfolio_id = \ilObjPortfolio::getDefaultPortfolio($this->getUserId());
729 if ($portfolio_id) {
730 $access_handler = new \ilPortfolioAccessHandler();
731 if ($access_handler->checkAccess('read', '', $portfolio_id)) {
732 return $portfolio_id;
733 }
734 }
735 return null;
736 }
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 144 of file class.PublicProfileGUI.php.

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

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 782 of file class.PublicProfileGUI.php.

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

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 208 of file class.PublicProfileGUI.php.

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

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 716 of file class.PublicProfileGUI.php.

716 : void
717 {
718 $this->tpl->resetHeaderBlock();
719 $this->tpl->setTitle(\ilUserUtil::getNamePresentation($this->getUserId()));
720 $this->tpl->setTitleIcon(\ilObjUser::_getPersonalPicturePath($this->getUserId(), 'xsmall'));
721 }

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 103 of file class.PublicProfileGUI.php.

103 : void
104 {
105 $this->additional = $a_additional;
106 }

◆ setBackUrl()

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

Set Back Link URL.

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

116 : void
117 {
118 // we only allow relative links
119 $parts = parse_url($backurl);
120 $host = $parts['host'] ?? '';
121 if ($host !== '') {
122 $backurl = '#';
123 }
124 $this->backurl = $backurl;
125 $this->ctrl->setParameter($this, 'back_url', rawurlencode($backurl));
126 }
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 136 of file class.PublicProfileGUI.php.

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

◆ setEmbedded()

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

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

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

◆ setUserId()

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

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

90 : void
91 {
92 $this->userid = $a_userid;
93 }

◆ validateUser()

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

Check if given user id is valid.

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

688 : bool
689 {
690 if (\ilObject::_lookupType($usrId) != 'usr') {
691 return false;
692 }
693
694 $user = new \ilObjUser($usrId);
695
696 if ($this->current_user->isAnonymous()) {
697 if (strtolower($this->ctrl->getCmd()) == strtolower('approveContactRequest')) {
698 $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usrId . '_contact_approved');
699 } elseif (strtolower($this->ctrl->getCmd()) == strtolower('ignoreContactRequest')) {
700 $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usrId . '_contact_ignored');
701 }
702
703 if ($user->getPref('public_profile') != 'g') {
704 // #12151
705 if ($user->getPref('public_profile') == 'y') {
706 $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . $usrId);
707 }
708
709 return false;
710 }
711 }
712
713 return true;
714 }
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 203 of file class.PublicProfileGUI.php.

203 : string
204 {
205 return $this->getHTML();
206 }

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 50 of file class.PublicProfileGUI.php.

◆ $ctrl

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

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

◆ $current_user

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

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

◆ $custom_prefs

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

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

◆ $embedded

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

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

◆ $lng

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

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

◆ $offline

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

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

◆ $profile

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

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

◆ $profile_request

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

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

◆ $rbac_system

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

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

◆ $setting

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

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

◆ $tabs

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

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

◆ $tpl

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

◆ $userid

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

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