ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContactUserActionProvider Class Reference

Class ilContactUserActionProvider. More...

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

Public Member Functions

 __construct ()
 ilContactUserActionProvider constructor. More...
 
 getComponentId ()
 
 getActionTypes ()
 
 collectActionsForTargetUser ($a_target_user)
 
- 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...
 

Protected Attributes

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

Private Attributes

 $stateToPermLinkMap
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilContactUserActionProvider::__construct ( )

ilContactUserActionProvider constructor.

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and user().

23  {
24  global $DIC;
25 
27 
28  $this->user = $DIC['ilUser'];
29  }
user()
Definition: user.php:4
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ collectActionsForTargetUser()

ilContactUserActionProvider::collectActionsForTargetUser (   $a_target_user)

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

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

54  {
56 
57  if (!ilBuddySystem::getInstance()->isEnabled()) {
58  return $coll;
59  }
60 
61  if (ilObjUser::_isAnonymous($this->getUserId()) || $this->user->isAnonymous()) {
62  return $coll;
63  }
64 
66  $requested_contacts = $buddyList->getRequestRelationsForOwner()->getKeys();
67 
68  if (in_array($a_target_user, $requested_contacts)) {
69  $this->lng->loadLanguageModule('buddysystem');
70 
71  $relation = $buddyList->getRelationByUserId($a_target_user);
72  foreach ($relation->getCurrentPossibleTargetStates() as $target_state) {
73  $f = new ilUserAction();
74  $f->setText(
75  $this->lng->txt(
76  'buddy_bs_act_btn_txt_requested_to_' .
77  ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName())
78  )
79  );
80  $f->setType('handle_req');
81  $f->setHref(
83  $a_target_user,
84  'usr',
85  true,
86  $this->stateToPermLinkMap[get_class($target_state)]
87  )
88  );
89  $f->setData([
90  'current-state' => get_class($relation->getState()),
91  'target-state' => get_class($target_state),
92  'buddy-id' => $a_target_user,
93  'action' => $target_state->getAction()
94  ]);
95  $coll->addAction($f);
96  }
97  }
98 
99  return $coll;
100  }
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 42 of file class.ilContactUserActionProvider.php.

43  {
44  $this->lng->loadLanguageModule('buddysystem');
45  return [
46  'handle_req' => $this->lng->txt('buddy_handle_contact_request')
47  ];
48  }

◆ getComponentId()

ilContactUserActionProvider::getComponentId ( )

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

35  {
36  return 'contact';
37  }

Field Documentation

◆ $stateToPermLinkMap

ilContactUserActionProvider::$stateToPermLinkMap
private
Initial value:
= [
'ilBuddySystemLinkedRelationState' => '_contact_approved'

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

◆ $user

ilContactUserActionProvider::$user
protected

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


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