ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Configuration.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 use ILIAS\Data\URI;
27 
31 final class Configuration
32 {
34  private \ilCtrlInterface $ctrl;
35 
36  public function __construct(
38  private ResourceStakeholder $stakeholder,
39  private string $title,
40  private Mode $mode = Mode::DATA_TABLE,
41  private int $items_per_page = 100,
42  private bool $user_can_upload = false,
43  private bool $user_can_administrate = false,
44  ) {
45  global $DIC;
46  $this->ctrl = $DIC->ctrl();
47  $this->action_provider = new ExternalActionProvider();
48  }
49 
50  public function withExternalAction(
51  string $label,
52  string $target_gui,
53  string $target_cmd,
54  string $parameter_namespace,
55  string $path_parameter = 'path',
56  bool $supports_directories = false,
57  array $supported_mime_types = ['*']
58  ): self {
59  $this->action_provider->addSingleAction(
60  $target_gui . '_' . $target_cmd,
62  $label,
63  $target_gui,
64  $target_cmd,
65  $path_parameter,
66  $parameter_namespace,
67  false,
68  false,
69  $supports_directories,
70  $supported_mime_types
71  )
72  );
73 
74  return $this;
75  }
76 
78  {
79  return $this->container;
80  }
81 
83  {
84  return $this->stakeholder;
85  }
86 
87  public function getTitle(): string
88  {
89  return $this->title;
90  }
91 
92  public function getDescription(): ?string
93  {
94  return null;
95  }
96 
97  public function getItemsPerPage(): int
98  {
99  return $this->items_per_page;
100  }
101 
102  public function getMode(): Mode
103  {
104  return $this->mode;
105  }
106 
107  public function canUserUpload(): bool
108  {
109  return $this->user_can_upload;
110  }
111 
112  public function canUserAdministrate(): bool
113  {
114  return $this->user_can_administrate;
115  }
116 
117  private function retrieveURI(
118  string $class,
119  string $command
120  ): URI {
121  return new URI(
122  ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
123  $class,
124  $command
125  )
126  );
127  }
128 
130  {
131  return $this->action_provider;
132  }
133 
134 }
$container
Definition: wac.php:36
withExternalAction(string $label, string $target_gui, string $target_cmd, string $parameter_namespace, string $path_parameter='path', bool $supports_directories=false, array $supported_mime_types=[' *'])
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(private StorableContainerResource $container, private ResourceStakeholder $stakeholder, private string $title, private Mode $mode=Mode::DATA_TABLE, private int $items_per_page=100, private bool $user_can_upload=false, private bool $user_can_administrate=false,)
global $DIC
Definition: shib_login.php:22