ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ilBuddySystemLinkButton Class Reference
+ 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
 

Additional Inherited Members

- Data Fields inherited from ilBuddySystemLinkButtonType
const ROOT_CSS_CLASS = 'ilBuddySystemLinkWidget'
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemLinkButton::__construct ( protected int  $usrId)
protected

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

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

28  {
29  global $DIC;
30  $this->buddyList = ilBuddyList::getInstanceByGlobalUser();
31 
32  $this->user = $DIC['ilUser'];
33  $this->lng = $DIC['lng'];
34  }
global $DIC
Definition: shib_login.php:26
static getInstanceByGlobalUser(?ilObjUser $user=null)
+ Here is the call graph for this function:

Member Function Documentation

◆ getBuddyList()

ilBuddySystemLinkButton::getBuddyList ( )

Implements ilBuddySystemLinkButtonType.

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

References $buddyList.

49  : ilBuddyList
50  {
51  return $this->buddyList;
52  }

◆ getHtml()

ilBuddySystemLinkButton::getHtml ( )

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

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

54  : string
55  {
56  $this->lng->loadLanguageModule('buddysystem');
57 
58  if (!ilBuddySystem::getInstance()->isEnabled()) {
59  return '';
60  }
61 
62  $relation = $this->buddyList->getRelationByUserId($this->getUsrId());
63 
64  // The ILIAS JF decided to add a new personal setting
65  if ($relation->isUnlinked() &&
66  !ilUtil::yn2tf((string) ilObjUser::_lookupPref($this->getUsrId(), 'bs_allow_to_contact_me'))) {
67  return '';
68  }
69 
70  $buttonTemplate = new ilTemplate(
71  'tpl.buddy_system_link_button.html',
72  true,
73  true,
74  'components/ILIAS/Contact/BuddySystem'
75  );
76  $buttonTemplate->setVariable(
77  'BUTTON_HTML',
78  ilBuddySystemRelationStateFactory::getInstance()->getStateButtonRendererByOwnerAndRelation(
79  $this->user->getId(),
80  $relation
81  )->getHtml()
82  );
83  $buttonTemplate->setVariable('BUTTON_BUDDY_ID', $this->getUsrId());
84  $buttonTemplate->setVariable('BUTTON_CSS_CLASS', ilBuddySystemLinkButtonType::ROOT_CSS_CLASS);
85  $buttonTemplate->setVariable('BUTTON_CURRENT_STATE', $relation->getState()::class);
86 
87  return $buttonTemplate->get();
88  }
$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 39 of file class.ilBuddySystemLinkButton.php.

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

39  : self
40  {
41  return new self($usrId);
42  }
+ Here is the caller graph for this function:

◆ getUsrId()

ilBuddySystemLinkButton::getUsrId ( )

Implements ilBuddySystemLinkButtonType.

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

Referenced by getHtml().

44  : int
45  {
46  return $this->usrId;
47  }
+ Here is the caller graph for this function:

Field Documentation

◆ $buddyList

ilBuddyList ilBuddySystemLinkButton::$buddyList
protected

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

Referenced by getBuddyList().

◆ $lng

ilLanguage ilBuddySystemLinkButton::$lng
protected

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

◆ $user

ilObjUser ilBuddySystemLinkButton::$user
protected

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


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