ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilBuddySystemLinkButton Class Reference

Class ilBuddySystemLinkButton. More...

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

Public Member Functions

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

Static Public Member Functions

static getInstanceByUserId ($usr_id)
 

Protected Member Functions

 __construct ($usr_id)
 

Protected Attributes

 $usr_id
 
 $buddylist
 
 $lng
 
 $user
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemLinkButton::__construct (   $usr_id)
protected
Parameters
$usr_id

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

References $DIC, $usr_id, ilBuddyList\getInstanceByGlobalUser(), and user().

40  {
41  global $DIC;
42 
43  $this->usr_id = $usr_id;
44  $this->buddylist = ilBuddyList::getInstanceByGlobalUser();
45 
46  $this->user = $DIC['ilUser'];
47  $this->lng = $DIC['lng'];
48  }
static getInstanceByGlobalUser()
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ getBuddyList()

ilBuddySystemLinkButton::getBuddyList ( )
Returns
ilBuddyList

Implements ilBuddySystemLinkButtonType.

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

References $buddylist.

◆ getHtml()

ilBuddySystemLinkButton::getHtml ( )
Returns
string

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

References ilObjUser\_lookupPref(), ilBuddySystem\getInstance(), ilBuddySystemRelationStateFactory\getInstance(), getUsrId(), ilBuddySystemGUI\initializeFrontend(), user(), and ilUtil\yn2tf().

87  {
88  $this->lng->loadLanguageModule('buddysystem');
89 
91 
92  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
93  if (!ilBuddySystem::getInstance()->isEnabled()) {
94  return '';
95  }
96 
97  $relation = $this->buddylist->getRelationByUserId($this->getUsrId());
98 
99  // The ILIAS JF decided to add a new personal setting
100  if ($relation->isUnlinked() && !ilUtil::yn2tf(ilObjUser::_lookupPref($this->getUsrId(), 'bs_allow_to_contact_me'))) {
101  return '';
102  }
103 
104  $button_tpl = new ilTemplate('tpl.buddy_system_link_button.html', true, true, 'Services/Contact/BuddySystem');
105  $button_tpl->setVariable('BUTTON_HTML', ilBuddySystemRelationStateFactory::getInstance()->getRendererByOwnerAndRelation($this->user->getId(), $relation)->getHtml());
106  $button_tpl->setVariable('BUTTON_BUDDY_ID', $this->getUsrId());
107  $button_tpl->setVariable('BUTTON_CSS_CLASS', 'ilBuddySystemLinkWidget');
108  $button_tpl->setVariable('BUTTON_CURRENT_STATE', get_class($relation->getState()));
109  return $button_tpl->get();
110  }
user()
Definition: user.php:4
special template class to simplify handling of ITX/PEAR
static _lookupPref($a_usr_id, $a_keyword)
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ Here is the call graph for this function:

◆ getInstanceByUserId()

static ilBuddySystemLinkButton::getInstanceByUserId (   $usr_id)
static

◆ getUsrId()

ilBuddySystemLinkButton::getUsrId ( )
Returns
int

Implements ilBuddySystemLinkButtonType.

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

References $usr_id.

Referenced by getHtml().

+ Here is the caller graph for this function:

◆ setUsrId()

ilBuddySystemLinkButton::setUsrId (   $usr_id)
Parameters
int$usr_id

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

References $usr_id.

71  {
72  $this->usr_id = $usr_id;
73  }

Field Documentation

◆ $buddylist

ilBuddySystemLinkButton::$buddylist
protected

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

Referenced by getBuddyList().

◆ $lng

ilBuddySystemLinkButton::$lng
protected

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

◆ $user

ilBuddySystemLinkButton::$user
protected

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

◆ $usr_id

ilBuddySystemLinkButton::$usr_id
protected

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