ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilContactUserActionProvider Class Reference

Adds link to contact. More...

+ Inheritance diagram for ilContactUserActionProvider:
+ Collaboration diagram for ilContactUserActionProvider:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getComponentId ()
 
 getActionTypes ()
 
 collectActionsForTargetUser ($a_target_user)
 {} More...
 
- Public Member Functions inherited from ilUserActionProvider
 __construct ()
 Constructor. More...
 
 setUserId ($a_val)
 Set user id. More...
 
 getUserId ()
 Get user id. More...
 
 collectActionsForTargetUser ($a_target_user)
 Collect actions for a target user. More...
 
 getComponentId ()
 
 getActionTypes ()
 
 getJsScripts ($a_action_type)
 Get js scripts. More...
 
 getCssFiles ($a_action_type)
 Get css resource files. More...
 

Protected Attributes

 $user
 
- Protected Attributes inherited from ilUserActionProvider
 $user_id
 
 $lng
 
 $db
 

Static Private Attributes

static $state_to_perm_link_map
 

Detailed Description

Adds link to contact.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 11 of file class.ilContactUserActionProvider.php.

Constructor & Destructor Documentation

◆ __construct()

ilContactUserActionProvider::__construct ( )

Constructor.

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

References $DIC, and user().

22  {
23  global $DIC;
24 
25  parent::__construct();
26 
27  $this->user = $DIC['ilUser'];
28  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ collectActionsForTargetUser()

ilContactUserActionProvider::collectActionsForTargetUser (   $a_target_user)

{}

Definition at line 60 of file class.ilContactUserActionProvider.php.

References $f, ilLink\_getStaticLink(), ilObjUser\_isAnonymous(), ilStr\convertUpperCamelCaseToUnderscoreCase(), ilUserActionCollection\getInstance(), ilBuddySystem\getInstance(), ilBuddyList\getInstanceByGlobalUser(), ilUserActionProvider\getUserId(), and user().

61  {
62  require_once 'Services/User/Actions/classes/class.ilUserAction.php';
64 
65  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
66  if (!ilBuddySystem::getInstance()->isEnabled()) {
67  return $coll;
68  }
69 
70  if (ilObjUser::_isAnonymous($this->getUserId()) || $this->user->isAnonymous()) {
71  return $coll;
72  }
73 
74  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
76  $requested_contacts = $buddylist->getRequestRelationsForOwner()->getKeys();
77 
78  if (in_array($a_target_user, $requested_contacts)) {
79  require_once 'Services/Utilities/classes/class.ilStr.php';
80  require_once 'Services/Link/classes/class.ilLink.php';
81 
82  $this->lng->loadLanguageModule('buddysystem');
83 
84  $relation = $buddylist->getRelationByUserId($a_target_user);
85  foreach ($relation->getCurrentPossibleTargetStates() as $target_state) {
86  $f = new ilUserAction();
87  $f->setText(
88  $this->lng->txt('buddy_bs_act_btn_txt_requested_to_' .
89  ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName()))
90  );
91  $f->setType("handle_req");
92  $f->setHref(ilLink::_getStaticLink($a_target_user, 'usr', true, self::$state_to_perm_link_map[get_class($target_state)]));
93  $f->setData(
94  array(
95  'current-state' => get_class($relation->getState()),
96  'target-state' => get_class($target_state),
97  'buddy-id' => $a_target_user,
98  'action' => $target_state->getAction())
99  );
100  $coll->addAction($f);
101  }
102  }
103 
104  return $coll;
105  }
static convertUpperCamelCaseToUnderscoreCase($value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
static getInstanceByGlobalUser()
static getInstance()
Get instance.
user()
Definition: user.php:4
static _isAnonymous($usr_id)
Action that can be performed on a user.
+ Here is the call graph for this function:

◆ getActionTypes()

ilContactUserActionProvider::getActionTypes ( )

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

42  {
43  $this->lng->loadLanguageModule('buddysystem');
44  return array(
45  "handle_req" => $this->lng->txt("buddy_handle_contact_request")
46  );
47  }

◆ getComponentId()

ilContactUserActionProvider::getComponentId ( )

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

34  {
35  return "contact";
36  }

Field Documentation

◆ $state_to_perm_link_map

ilContactUserActionProvider::$state_to_perm_link_map
staticprivate
Initial value:
= array(
'ilBuddySystemLinkedRelationState' => '_contact_approved',
'ilBuddySystemIgnoredRequestRelationState' => '_contact_ignored'
)

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

◆ $user

ilContactUserActionProvider::$user
protected

Definition at line 16 of file class.ilContactUserActionProvider.php.


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