ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
Configuration.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 use ILIAS\Data\URI;
29 
33 final class Configuration
34 {
37  private \ilCtrlInterface $ctrl;
38 
39  public function __construct(
41  private ResourceStakeholder $stakeholder,
42  private string $title,
43  private Mode $mode = Mode::DATA_TABLE,
44  private int $items_per_page = 100,
45  private bool $user_can_upload = false,
46  private bool $user_can_administrate = false,
47  ) {
48  global $DIC;
49  $this->ctrl = $DIC->ctrl();
50  $this->action_provider = new ExternalActionProvider();
51  }
52 
53  public function withExternalAction(
54  string $label,
55  string $target_gui,
56  string $target_cmd,
57  string $parameter_namespace,
58  string $path_parameter = 'path',
59  bool $supports_directories = false,
60  array $supported_mime_types = ['*']
61  ): self {
62  $this->action_provider->addSingleAction(
63  $target_gui . '_' . $target_cmd,
65  $label,
66  $target_gui,
67  $target_cmd,
68  $path_parameter,
69  $parameter_namespace,
70  false,
71  false,
72  $supports_directories,
73  $supported_mime_types
74  )
75  );
76 
77  return $this;
78  }
79 
80  public function withExternalTopAction(string $key, TopAction $topAction, ?RoundTrip $modal = null): self
81  {
82  $this->action_provider->addTopAction($key, $topAction, $modal);
83 
84  return $this;
85  }
86 
88  {
89  return $this->container;
90  }
91 
93  {
94  return $this->stakeholder;
95  }
96 
97  public function getTitle(): string
98  {
99  return $this->title;
100  }
101 
102  public function getDescription(): ?string
103  {
104  return null;
105  }
106 
107  public function getItemsPerPage(): int
108  {
109  return $this->items_per_page;
110  }
111 
112  public function getMode(): Mode
113  {
114  return $this->mode;
115  }
116 
117  public function canUserUpload(): bool
118  {
119  return $this->user_can_upload;
120  }
121 
122  public function canUserAdministrate(): bool
123  {
124  return $this->user_can_administrate;
125  }
126 
127  private function retrieveURI(
128  string $class,
129  string $command
130  ): URI {
131  return new URI(
132  ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
133  $class,
134  $command
135  )
136  );
137  }
138 
140  {
141  return $this->action_provider;
142  }
143 }
withExternalTopAction(string $key, TopAction $topAction, ?RoundTrip $modal=null)
$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:26