ILIAS  release_8 Revision v8.19
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

array __construct ()
 
 getComponentId ()
 
 getActionTypes ()
 
 collectActionsForTargetUser (int $a_target_user)
 
- Public Member Functions inherited from ilUserActionProvider
 __construct ()
 
 setUserId (int $a_val)
 
 getUserId ()
 
 collectActionsForTargetUser (int $a_target_user)
 Collect actions for a target user. More...
 
 getComponentId ()
 
 getActionTypes ()
 
 getJsScripts (string $a_action_type)
 

Private Attributes

ilObjUser $user
 
array $stateToPermLinkMap
 

Additional Inherited Members

- Protected Attributes inherited from ilUserActionProvider
int $user_id
 
ilLanguage $lng
 
ilDBInterface $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

array ilContactUserActionProvider::__construct ( )

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

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

35  {
36  global $DIC;
37 
39 
40  $this->user = $DIC['ilUser'];
41  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ collectActionsForTargetUser()

ilContactUserActionProvider::collectActionsForTargetUser ( int  $a_target_user)

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

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

66  {
68 
69  if (!ilBuddySystem::getInstance()->isEnabled()) {
70  return $coll;
71  }
72 
73  if ($this->user->isAnonymous() || ilObjUser::_isAnonymous($this->getUserId())) {
74  return $coll;
75  }
76 
78  $requested_contacts = $buddyList->getRequestRelationsForOwner()->getKeys();
79 
80  if (in_array($a_target_user, $requested_contacts)) {
81  $this->lng->loadLanguageModule('buddysystem');
82 
83  $relation = $buddyList->getRelationByUserId($a_target_user);
84  foreach ($relation->getCurrentPossibleTargetStates() as $target_state) {
85  $f = new ilUserAction();
86  $f->setText(
87  $this->lng->txt(
88  'buddy_bs_act_btn_txt_requested_to_' .
89  ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName())
90  )
91  );
92  $f->setType('handle_req');
93  $f->setHref(
95  $a_target_user,
96  'usr',
97  true,
98  $this->stateToPermLinkMap[get_class($target_state)]
99  )
100  );
101  $f->setData([
102  'current-state' => get_class($relation->getState()),
103  'target-state' => get_class($target_state),
104  'buddy-id' => $a_target_user,
105  'action' => $target_state->getAction()
106  ]);
107  $coll->addAction($f);
108  }
109  }
110 
111  return $coll;
112  }
static getInstanceByGlobalUser()
static convertUpperCamelCaseToUnderscoreCase(string $value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _isAnonymous(int $usr_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getActionTypes()

ilContactUserActionProvider::getActionTypes ( )

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

References ILIAS\Repository\lng().

54  : array
55  {
56  $this->lng->loadLanguageModule('buddysystem');
57  return [
58  'handle_req' => $this->lng->txt('buddy_handle_contact_request'),
59  ];
60  }
+ Here is the call graph for this function:

◆ getComponentId()

ilContactUserActionProvider::getComponentId ( )

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

46  : string
47  {
48  return 'contact';
49  }

Field Documentation

◆ $stateToPermLinkMap

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

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

◆ $user

ilObjUser ilContactUserActionProvider::$user
private

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


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