ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.EmployeeTalkUserActionProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24
26{
27 public const string JUMP_TO_USER_TALK_LIST = 'etal_jump_to_user_talks';
28
32
33 public function __construct()
34 {
36
40 $container = $GLOBALS['DIC'];
41 $this->language = $container->language();
42 $this->controlFlow = $container->ctrl();
43 $this->access = ilMyStaffAccess::getInstance();
44
45 $this->language->loadLanguageModule('etal');
46 }
47
48 public function collectActionsForTargetUser(int $a_target_user): ilUserActionCollection
49 {
50 $actions = new ilUserActionCollection();
51
52 if ($this->hasAccess($a_target_user)) {
53 $jumpToUserTalkList = new ilUserAction();
54 $jumpToUserTalkList->setType(self::JUMP_TO_USER_TALK_LIST);
55 $jumpToUserTalkList->setText($this->language->txt('mm_org_etal'));
56 $jumpToUserTalkList->setHref($this->controlFlow->getLinkTargetByClass([
57 strtolower(ilDashboardGUI::class),
58 strtolower(ilMyStaffGUI::class),
59 strtolower(ilMStShowUserGUI::class),
60 strtolower(ilEmployeeTalkMyStaffUserGUI::class),
61 ], ControlFlowCommand::INDEX) . "&usr_id=$a_target_user");
62
63 $actions->addAction($jumpToUserTalkList);
64 }
65
66 return $actions;
67 }
68
69 public function getComponentId(): string
70 {
71 return "etal";
72 }
73
74 public function getActionTypes(): array
75 {
76 return [
77 self::JUMP_TO_USER_TALK_LIST => $this->language->txt('mm_org_etal')
78 ];
79 }
80
81 protected function hasAccess(int $a_target_user): bool
82 {
83 if (!$a_target_user) {
84 return false;
85 }
86
87 if (
88 !$this->access->hasCurrentUserAccessToTalks() ||
89 !$this->access->hasCurrentUserAccessToUser($a_target_user)
90 ) {
91 return false;
92 }
93
94 return true;
95 }
96}
collectActionsForTargetUser(int $a_target_user)
Collect actions for a target user.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Class ilCtrl provides processing control methods.
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A class that provides a collection of actions on users.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$container
@noRector
Definition: wac.php:37
$GLOBALS["DIC"]
Definition: wac.php:54