ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilContactUserActionProvider Class Reference

Adds link to contact. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 getComponentId ()
 
Returns
string component id as defined in services.xml/module.xml
More...
 
 getActionTypes ()
 
Returns
array[string] keys must be unique action ids (strings), values should be the names of the actions (from ilLanguage)
More...
 
 collectActionsForTargetUser ($a_target_user)
 {Collect actions for a target user.
Parameters
int$a_target_usertarget user
Returns
ilUserActionCollection collection of users
} 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 ()
 

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.

Reimplemented from ilUserActionProvider.

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

22 {
23 global $DIC;
24
25 parent::__construct();
26
27 $this->user = $DIC['ilUser'];
28 }
user()
Definition: user.php:4
global $DIC

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ collectActionsForTargetUser()

ilContactUserActionProvider::collectActionsForTargetUser (   $a_target_user)

{Collect actions for a target user.

Parameters
int$a_target_usertarget user
Returns
ilUserActionCollection collection of users
}

Reimplemented from ilUserActionProvider.

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

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

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

+ Here is the call graph for this function:

◆ getActionTypes()

ilContactUserActionProvider::getActionTypes ( )

Returns
array[string] keys must be unique action ids (strings), values should be the names of the actions (from ilLanguage)

Reimplemented from ilUserActionProvider.

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 ( )

Returns
string component id as defined in services.xml/module.xml

Reimplemented from ilUserActionProvider.

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: