ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Download.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
30 class Download extends BaseCheck implements Check
31 {
32  public $static_url;
33  protected ?\ilObjFileInfo $info = null;
34 
35  public function __construct()
36  {
38  }
39 
40  public function canUnlock(): Capabilities
41  {
42  return Capabilities::DOWNLOAD;
43  }
44 
45  public function maybeUnlock(
46  Capability $capability,
47  CheckHelpers $helpers,
48  \ilObjFileInfo $info,
50  ): Capability {
51  $this->info = $info;
52  return $capability->withUnlocked($this->hasPermission($helpers, $context, ...$capability->getPermissions()));
53  }
54 
55  public function maybeBuildURI(Capability $capability, CheckHelpers $helpers, Context $context): Capability
56  {
57  if (!$capability->isUnlocked()) {
58  return $capability;
59  }
60 
61  return $capability->withURI(
62  $helpers->fromTarget(
63  $helpers->ctrl->getLinkTargetByClass(
64  [
65  $this->baseClass($context),
66  \ilObjFileGUI::class
67  ],
68  Capabilities::DOWNLOAD->value
69  )
70  )
71  );
72  }
73 
74 }
$context
Definition: webdav.php:31
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
maybeBuildURI(Capability $capability, CheckHelpers $helpers, Context $context)
Definition: Download.php:55
info()
description: > Example for rendering a info message box.
Definition: info.php:34
hasPermission(CheckHelpers $helpers, Context $context, Permissions ... $permission)
Definition: BaseCheck.php:36
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: BaseCheck.php:21
__construct(Container $dic, ilPlugin $plugin)
maybeUnlock(Capability $capability, CheckHelpers $helpers, \ilObjFileInfo $info, Context $context,)
Definition: Download.php:45