ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilUserUserActionProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\StaticURL\Services as StaticURLServices;
23
29{
30 private readonly StaticURLServices $static_url;
31
32 public function __construct()
33 {
34 global $DIC;
35 $this->static_url = $DIC['static_url'];
36
38 }
39
40 public function getComponentId(): string
41 {
42 return 'user';
43 }
44
48 public function getActionTypes(): array
49 {
50 return [
51 "profile" => $this->lng->txt("profile")
52 ];
53 }
54
55 public function collectActionsForTargetUser(int $target_user): ilUserActionCollection
56 {
57 $coll = new ilUserActionCollection();
58 if (!in_array(
59 ilObjUser::_lookupPref($target_user, "public_profile"),
60 ["y", "g"]
61 )) {
62 return $coll;
63 }
64
65 $f = new ilUserAction();
66 $f->setType("profile");
67 $f->setText($this->lng->txt('profile'));
68 $f->setHref(
69 $this->static_url->builder()->build(
70 StaticURLHandler::NAMESPACE,
71 null,
72 [$target_user]
73 )->__toString()
74 );
75 $coll->addAction($f);
76
77 return $coll;
78 }
79}
Class Services.
Definition: Services.php:38
static _lookupPref(int $a_usr_id, string $a_keyword)
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...
collectActionsForTargetUser(int $target_user)
Collect actions for a target user.
readonly StaticURLServices $static_url
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26