ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\Contact\URL\StaticUrlHandler Class Reference
+ Inheritance diagram for ILIAS\Contact\URL\StaticUrlHandler:
+ Collaboration diagram for ILIAS\Contact\URL\StaticUrlHandler:

Public Member Functions

 getNamespace ()
 
 handle (Request $request, Context $context, Factory $response_factory)
 
- Public Member Functions inherited from ILIAS\StaticURL\Handler\BaseHandler
 __construct ()
 
 canHandle (Request $request)
 
- Public Member Functions inherited from ILIAS\StaticURL\Handler\Handler
 __construct ()
 
 getNamespace ()
 
 canHandle (Request $request)
 
 handle (Request $request, Context $context, Factory $response_factory)
 

Data Fields

const string NAMESPACE = 'contact'
 

Private Member Functions

 buildProfileUrl (\ilCtrl $ctrl, ?ReferenceId $target_user_id, string $cmd)
 

Detailed Description

Definition at line 32 of file StaticUrlHandler.php.

Member Function Documentation

◆ buildProfileUrl()

ILIAS\Contact\URL\StaticUrlHandler::buildProfileUrl ( \ilCtrl  $ctrl,
?ReferenceId  $target_user_id,
string  $cmd 
)
private

Definition at line 69 of file StaticUrlHandler.php.

73 : string {
74 if ($target_user_id === null) {
75 return $ctrl->getLinkTargetByClass(
76 [\ilDashboardGUI::class],
77 'jumpToProfile'
78 );
79 }
80
81 $ctrl->setParameterByClass(PublicProfileGUI::class, 'user_id', $target_user_id->toInt());
82
83 return $ctrl->getLinkTargetByClass([\ilPublicProfileBaseClassGUI::class, PublicProfileGUI::class], $cmd);
84 }

References ilCtrl\getLinkTargetByClass().

Referenced by ILIAS\Contact\URL\StaticUrlHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNamespace()

ILIAS\Contact\URL\StaticUrlHandler::getNamespace ( )

Implements ILIAS\StaticURL\Handler\Handler.

Definition at line 36 of file StaticUrlHandler.php.

36 : string
37 {
38 return self::NAMESPACE;
39 }

References ILIAS\Contact\URL\StaticUrlHandler\NAMESPACE.

◆ handle()

ILIAS\Contact\URL\StaticUrlHandler::handle ( Request  $request,
Context  $context,
Factory  $response_factory 
)

Implements ILIAS\StaticURL\Handler\Handler.

Definition at line 41 of file StaticUrlHandler.php.

41 : Response
42 {
43 if (!$context->isUserLoggedIn()) {
44 return $response_factory->loginFirst();
45 }
46
47 if (!\ilBuddySystem::getInstance()->isEnabled()) {
48 return $response_factory->cannot();
49 }
50
51 $params = implode('/', $request->getAdditionalParameters() ?? []);
52 $path = parse_url($params, PHP_URL_PATH);
53
54 return match ($path) {
55 'approve' => $response_factory->can($this->buildProfileUrl(
56 $context->ctrl(),
57 $request->getReferenceId(),
58 'approveContactRequest'
59 )),
60 'ignore' => $response_factory->can($this->buildProfileUrl(
61 $context->ctrl(),
62 $request->getReferenceId(),
63 'ignoreContactRequest'
64 )),
65 default => $response_factory->cannot(),
66 };
67 }
buildProfileUrl(\ilCtrl $ctrl, ?ReferenceId $target_user_id, string $cmd)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
$path
Definition: ltiservices.php:30

References $params, $path, ILIAS\Contact\URL\StaticUrlHandler\buildProfileUrl(), ILIAS\StaticURL\Response\Factory\can(), ILIAS\StaticURL\Response\Factory\cannot(), ILIAS\StaticURL\Context\ctrl(), ILIAS\StaticURL\Request\Request\getAdditionalParameters(), ilBuddySystem\getInstance(), ILIAS\StaticURL\Request\Request\getReferenceId(), ILIAS\StaticURL\Context\isUserLoggedIn(), and ILIAS\StaticURL\Response\Factory\loginFirst().

+ Here is the call graph for this function:

Field Documentation

◆ NAMESPACE

const string ILIAS\Contact\URL\StaticUrlHandler::NAMESPACE = 'contact'

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