ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilBuddySystemLinkButton Class Reference

Class ilBuddySystemLinkButton. More...

+ Inheritance diagram for ilBuddySystemLinkButton:
+ Collaboration diagram for ilBuddySystemLinkButton:

Public Member Functions

 getUsrId ()
 
 getBuddyList ()
 
 getHtml ()
 
- Public Member Functions inherited from ilBuddySystemLinkButtonType
 getHTML ()
 

Static Public Member Functions

static getInstanceByUserId (int $usrId)
 

Protected Member Functions

 __construct (protected int $usrId)
 

Protected Attributes

ilBuddyList $buddyList
 
ilLanguage $lng
 
ilObjUser $user
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemLinkButton::__construct ( protected int  $usrId)
protected

Definition at line 31 of file class.ilBuddySystemLinkButton.php.

References $DIC, ilBuddyList\getInstanceByGlobalUser(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

32  {
33  global $DIC;
34  $this->buddyList = ilBuddyList::getInstanceByGlobalUser();
35 
36  $this->user = $DIC['ilUser'];
37  $this->lng = $DIC['lng'];
38  }
global $DIC
Definition: feed.php:28
static getInstanceByGlobalUser(ilObjUser $user=null)
+ Here is the call graph for this function:

Member Function Documentation

◆ getBuddyList()

ilBuddySystemLinkButton::getBuddyList ( )

Implements ilBuddySystemLinkButtonType.

Definition at line 53 of file class.ilBuddySystemLinkButton.php.

References $buddyList.

53  : ilBuddyList
54  {
55  return $this->buddyList;
56  }

◆ getHtml()

ilBuddySystemLinkButton::getHtml ( )

Definition at line 58 of file class.ilBuddySystemLinkButton.php.

References $relation, ilObjUser\_lookupPref(), ilBuddySystemRelationStateFactory\getInstance(), ilBuddySystem\getInstance(), getUsrId(), ILIAS\Repository\lng(), ILIAS\Repository\user(), and ilUtil\yn2tf().

58  : string
59  {
60  $this->lng->loadLanguageModule('buddysystem');
61 
62  if (!ilBuddySystem::getInstance()->isEnabled()) {
63  return '';
64  }
65 
66  $relation = $this->buddyList->getRelationByUserId($this->getUsrId());
67 
68  // The ILIAS JF decided to add a new personal setting
69  if (
70  $relation->isUnlinked() &&
71  !ilUtil::yn2tf((string) ilObjUser::_lookupPref($this->getUsrId(), 'bs_allow_to_contact_me'))
72  ) {
73  return '';
74  }
75 
76  $buttonTemplate = new ilTemplate(
77  'tpl.buddy_system_link_button.html',
78  true,
79  true,
80  'Services/Contact/BuddySystem'
81  );
82  $buttonTemplate->setVariable(
83  'BUTTON_HTML',
84  ilBuddySystemRelationStateFactory::getInstance()->getStateButtonRendererByOwnerAndRelation(
85  (int) $this->user->getId(),
86  $relation
87  )->getHtml()
88  );
89  $buttonTemplate->setVariable('BUTTON_BUDDY_ID', $this->getUsrId());
90  $buttonTemplate->setVariable('BUTTON_CSS_CLASS', 'ilBuddySystemLinkWidget');
91  $buttonTemplate->setVariable('BUTTON_CURRENT_STATE', $relation->getState()::class);
92 
93  return $buttonTemplate->get();
94  }
$relation
static _lookupPref(int $a_usr_id, string $a_keyword)
static yn2tf(string $a_yn)
+ Here is the call graph for this function:

◆ getInstanceByUserId()

static ilBuddySystemLinkButton::getInstanceByUserId ( int  $usrId)
static
Exceptions
ilBuddySystemException

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

Referenced by ilRepositoryUserResultTableGUI\fillRow(), ilBuddySystemRelationsTableGUI\fillRow(), ilUsersGalleryGUI\getActionsSection(), and ilPublicUserProfileGUI\getEmbeddable().

43  : self
44  {
45  return new self($usrId);
46  }
+ Here is the caller graph for this function:

◆ getUsrId()

ilBuddySystemLinkButton::getUsrId ( )

Implements ilBuddySystemLinkButtonType.

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

Referenced by getHtml().

48  : int
49  {
50  return $this->usrId;
51  }
+ Here is the caller graph for this function:

Field Documentation

◆ $buddyList

ilBuddyList ilBuddySystemLinkButton::$buddyList
protected

Definition at line 27 of file class.ilBuddySystemLinkButton.php.

Referenced by getBuddyList().

◆ $lng

ilLanguage ilBuddySystemLinkButton::$lng
protected

Definition at line 28 of file class.ilBuddySystemLinkButton.php.

◆ $user

ilObjUser ilBuddySystemLinkButton::$user
protected

Definition at line 29 of file class.ilBuddySystemLinkButton.php.


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