ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUploadLimitsOverviewGUI Class Reference
+ Collaboration diagram for ilUploadLimitsOverviewGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Data Fields

const CMD_INDEX = 'index'
 
const CMD_ADD_UPLOAD_POLICY = 'addUploadPolicy'
 
const CMD_EDIT_UPLOAD_POLICY = 'editUploadPolicy'
 
const CMD_SAVE_UPLOAD_POLICY = 'saveUploadPolicy'
 
const CMD_DELETE_UPLOAD_POLICY = 'deleteUploadPolicy'
 

Protected Member Functions

 index ()
 
 gotoUploadPolicyForm (bool $is_update=false)
 
 saveUploadPolicy ()
 
 deleteUploadPolicy ()
 

Protected Attributes

int $ref_id
 
ilAccessHandler $access
 
ilCtrlInterface $ctrl
 
ilObjUser $current_user
 
ilDBInterface $db
 
HttpServices $http
 
ilLanguage $language
 
ilGlobalTemplateInterface $main_tpl
 
ilRbacReview $rbac_review
 
RefineryFactory $refinery
 
ilToolbarGUI $toolbar
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
UploadPolicyDBRepository $upload_policy_db_repository
 
ilTabsGUI $tabs
 

Private Member Functions

 hasWriteAccessOrRedirect ()
 
 hasWriteAccess ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilUploadLimitsOverviewGUI::__construct ( )

Definition at line 54 of file class.ilUploadLimitsOverviewGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

55  {
56  global $DIC;
57 
58  $this->ctrl = $DIC->ctrl();
59  $this->current_user = $DIC->user();
60  $this->db = $DIC->database();
61  $this->http = $DIC->http();
62  $this->language = $DIC->language();
63  $this->main_tpl = $DIC->ui()->mainTemplate();
64  $this->rbac_review = $DIC->rbac()->review();
65  $this->access = $DIC->access();
66  $this->refinery = $DIC->refinery();
67  $this->toolbar = $DIC->toolbar();
68  $this->ui_factory = $DIC->ui()->factory();
69  $this->ui_renderer = $DIC->ui()->renderer();
70  $this->tabs = $DIC->tabs();
71  $this->ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
72 
73  $this->upload_policy_db_repository = new UploadPolicyDBRepository($this->db);
74  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteUploadPolicy()

ilUploadLimitsOverviewGUI::deleteUploadPolicy ( )
protected

Definition at line 223 of file class.ilUploadLimitsOverviewGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\UICore\GlobalTemplate\MESSAGE_TYPE_FAILURE, ILIAS\UICore\GlobalTemplate\MESSAGE_TYPE_SUCCESS, null, UploadPolicy\POLICY_ID, and ILIAS\Repository\refinery().

Referenced by executeCommand().

223  : void
224  {
225  $deletion_successful = false;
226 
227  if ($this->http->wrapper()->query()->has(UploadPolicy::POLICY_ID)) {
228  $policy_id = $this->http->wrapper()->query()->retrieve(
230  $this->refinery->kindlyTo()->int()
231  );
232  $policy = $this->upload_policy_db_repository->get($policy_id);
233  if ($policy !== null) {
234  $this->upload_policy_db_repository->delete($policy);
235  $deletion_successful = true;
236  }
237  }
238 
239  if ($deletion_successful) {
240  $this->main_tpl->setOnScreenMessage(
242  $this->language->txt('policy_deletion_successful'),
243  true
244  );
245  } else {
246  $this->main_tpl->setOnScreenMessage(
248  $this->language->txt('policy_deletion_failure_not_found'),
249  true
250  );
251  }
252 
253  $this->ctrl->redirectByClass(self::class, self::CMD_INDEX);
254  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilUploadLimitsOverviewGUI::executeCommand ( )

Definition at line 76 of file class.ilUploadLimitsOverviewGUI.php.

References ILIAS\Repository\ctrl(), deleteUploadPolicy(), gotoUploadPolicyForm(), hasWriteAccessOrRedirect(), index(), and saveUploadPolicy().

76  : void
77  {
78  switch ($this->ctrl->getCmd(self::CMD_INDEX)) {
79  case self::CMD_ADD_UPLOAD_POLICY:
80  $this->hasWriteAccessOrRedirect();
81  $this->gotoUploadPolicyForm();
82  break;
83  case self::CMD_EDIT_UPLOAD_POLICY:
84  $this->hasWriteAccessOrRedirect();
85  $this->gotoUploadPolicyForm(true);
86  break;
87  case self::CMD_SAVE_UPLOAD_POLICY:
88  $this->hasWriteAccessOrRedirect();
89  $this->saveUploadPolicy();
90  break;
91  case self::CMD_DELETE_UPLOAD_POLICY:
92  $this->hasWriteAccessOrRedirect();
93  $this->deleteUploadPolicy();
94  break;
95  case self::CMD_INDEX:
96  default:
97  $this->index();
98  break;
99  }
100  }
+ Here is the call graph for this function:

◆ gotoUploadPolicyForm()

ilUploadLimitsOverviewGUI::gotoUploadPolicyForm ( bool  $is_update = false)
protected

Definition at line 147 of file class.ilUploadLimitsOverviewGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

147  : void
148  {
149  $this->tabs->clearTargets();
150  $this->tabs->setBackTarget(
151  $this->language->txt('back'),
152  $this->ctrl->getLinkTargetByClass(self::class, self::CMD_INDEX)
153  );
154 
155  $policy_form_ui = new UploadPolicyFormUI(
156  $this->upload_policy_db_repository,
157  $this->ctrl,
158  $this->http,
159  $this->language,
160  $this->rbac_review,
161  $this->refinery,
162  $this->ui_factory
163  );
164 
165  $form_panel_title = ($is_update) ?
166  $this->language->txt('edit_upload_policy') :
167  $this->language->txt('add_upload_policy');
168 
169  $this->main_tpl->setContent(
170  $this->ui_renderer->render(
171  $this->ui_factory->panel()->standard(
172  $form_panel_title,
173  [$policy_form_ui->getForm()]
174  )
175  )
176  );
177  }
static http()
Fetches the global http state from ILIAS.
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasWriteAccess()

ilUploadLimitsOverviewGUI::hasWriteAccess ( )
private

Definition at line 114 of file class.ilUploadLimitsOverviewGUI.php.

References ILIAS\Repository\access().

Referenced by hasWriteAccessOrRedirect(), and index().

114  : bool
115  {
116  return $this->access->checkAccess("write", "", $this->ref_id);
117  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasWriteAccessOrRedirect()

ilUploadLimitsOverviewGUI::hasWriteAccessOrRedirect ( )
private

Definition at line 102 of file class.ilUploadLimitsOverviewGUI.php.

References ILIAS\Repository\ctrl(), hasWriteAccess(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by executeCommand().

102  : void
103  {
104  if (!$this->hasWriteAccess()) {
105  $this->main_tpl->setOnScreenMessage(
106  'failure',
107  $this->language->txt("permission_denied"),
108  true
109  );
110  $this->ctrl->redirect($this);
111  }
112  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilUploadLimitsOverviewGUI::index ( )
protected

Definition at line 119 of file class.ilUploadLimitsOverviewGUI.php.

References ILIAS\Repository\ctrl(), hasWriteAccess(), ILIAS\FileDelivery\http(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\refinery(), and ILIAS\Repository\toolbar().

Referenced by executeCommand().

119  : void
120  {
121  if ($this->hasWriteAccess()) {
122  $this->toolbar->addComponent(
123  $this->ui_factory->button()->primary(
124  $this->language->txt("add_upload_policy"),
125  $this->ctrl->getLinkTargetByClass(self::class, self::CMD_ADD_UPLOAD_POLICY)
126  )
127  );
128  }
129 
130  $policies_table = new UploadPoliciesTableUI(
131  $this->upload_policy_db_repository,
132  $this->ctrl,
133  $this->http,
134  $this->language,
135  $this->main_tpl,
136  $this->rbac_review,
137  $this->refinery,
138  $this->ui_factory,
139  $this->ui_renderer,
140  $this->hasWriteAccess()
141  );
142  $this->main_tpl->setContent(
143  $this->ui_renderer->render($policies_table->getComponents())
144  );
145  }
static http()
Fetches the global http state from ILIAS.
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveUploadPolicy()

ilUploadLimitsOverviewGUI::saveUploadPolicy ( )
protected

Definition at line 179 of file class.ilUploadLimitsOverviewGUI.php.

References $data, ILIAS\Repository\ctrl(), UploadPolicyFormUI\HIDDEN_INPUT_POLICY_ID, ILIAS\FileDelivery\http(), UploadPolicyFormUI\INPUT_FIELD_ACTIVE, UploadPolicyFormUI\INPUT_FIELD_AUDIENCE_DATA, UploadPolicyFormUI\INPUT_FIELD_AUDIENCE_TYPE, UploadPolicyFormUI\INPUT_FIELD_TITLE, UploadPolicyFormUI\INPUT_FIELD_UPLOAD_LIMIT, UploadPolicyFormUI\INPUT_FIELD_VALID_UNTIL, UploadPolicyFormUI\INPUT_SECTION_AUDIENCE, UploadPolicyFormUI\INPUT_SECTION_GENERAL, UploadPolicyFormUI\INPUT_SECTION_VALIDITY, ILIAS\Repository\int(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), null, ILIAS\Repository\refinery(), and UploadPolicy\SCOPE_DEFINITION_GLOBAL.

Referenced by executeCommand().

179  : void
180  {
181  $policy_form_ui = new UploadPolicyFormUI(
182  $this->upload_policy_db_repository,
183  $this->ctrl,
184  $this->http,
185  $this->language,
186  $this->rbac_review,
187  $this->refinery,
188  $this->ui_factory
189  );
190  $policy_form = $policy_form_ui->getForm();
191  $policy_form = $policy_form->withRequest($this->http->request());
192  $data = $policy_form->getData();
193 
194  if ($data !== null) {
195  $date_now = new DateTimeImmutable();
196  $policy_id = null;
198  $policy_id = (int) $data[UploadPolicyFormUI::HIDDEN_INPUT_POLICY_ID];
199  }
200 
201  $upload_policy = new UploadPolicy(
202  $policy_id,
209  $date_now,
211  $this->current_user->getId(),
212  $date_now,
213  $date_now
214  );
215  $this->upload_policy_db_repository->store($upload_policy);
216 
217  $this->ctrl->redirectByClass(self::class, self::CMD_INDEX);
218  }
219 
220  $this->main_tpl->setContent($this->ui_renderer->render($policy_form));
221  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
const SCOPE_DEFINITION_GLOBAL
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilUploadLimitsOverviewGUI::$access
protected

Definition at line 39 of file class.ilUploadLimitsOverviewGUI.php.

◆ $ctrl

ilCtrlInterface ilUploadLimitsOverviewGUI::$ctrl
protected

Definition at line 40 of file class.ilUploadLimitsOverviewGUI.php.

◆ $current_user

ilObjUser ilUploadLimitsOverviewGUI::$current_user
protected

Definition at line 41 of file class.ilUploadLimitsOverviewGUI.php.

◆ $db

ilDBInterface ilUploadLimitsOverviewGUI::$db
protected

Definition at line 42 of file class.ilUploadLimitsOverviewGUI.php.

◆ $http

HttpServices ilUploadLimitsOverviewGUI::$http
protected

Definition at line 43 of file class.ilUploadLimitsOverviewGUI.php.

◆ $language

ilLanguage ilUploadLimitsOverviewGUI::$language
protected

Definition at line 44 of file class.ilUploadLimitsOverviewGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilUploadLimitsOverviewGUI::$main_tpl
protected

Definition at line 45 of file class.ilUploadLimitsOverviewGUI.php.

◆ $rbac_review

ilRbacReview ilUploadLimitsOverviewGUI::$rbac_review
protected

Definition at line 46 of file class.ilUploadLimitsOverviewGUI.php.

◆ $ref_id

int ilUploadLimitsOverviewGUI::$ref_id
protected

Definition at line 38 of file class.ilUploadLimitsOverviewGUI.php.

◆ $refinery

RefineryFactory ilUploadLimitsOverviewGUI::$refinery
protected

Definition at line 47 of file class.ilUploadLimitsOverviewGUI.php.

◆ $tabs

ilTabsGUI ilUploadLimitsOverviewGUI::$tabs
protected

Definition at line 52 of file class.ilUploadLimitsOverviewGUI.php.

◆ $toolbar

ilToolbarGUI ilUploadLimitsOverviewGUI::$toolbar
protected

Definition at line 48 of file class.ilUploadLimitsOverviewGUI.php.

◆ $ui_factory

UIFactory ilUploadLimitsOverviewGUI::$ui_factory
protected

Definition at line 49 of file class.ilUploadLimitsOverviewGUI.php.

◆ $ui_renderer

UIRenderer ilUploadLimitsOverviewGUI::$ui_renderer
protected

Definition at line 50 of file class.ilUploadLimitsOverviewGUI.php.

◆ $upload_policy_db_repository

UploadPolicyDBRepository ilUploadLimitsOverviewGUI::$upload_policy_db_repository
protected

Definition at line 51 of file class.ilUploadLimitsOverviewGUI.php.

◆ CMD_ADD_UPLOAD_POLICY

const ilUploadLimitsOverviewGUI::CMD_ADD_UPLOAD_POLICY = 'addUploadPolicy'

Definition at line 34 of file class.ilUploadLimitsOverviewGUI.php.

◆ CMD_DELETE_UPLOAD_POLICY

const ilUploadLimitsOverviewGUI::CMD_DELETE_UPLOAD_POLICY = 'deleteUploadPolicy'

◆ CMD_EDIT_UPLOAD_POLICY

const ilUploadLimitsOverviewGUI::CMD_EDIT_UPLOAD_POLICY = 'editUploadPolicy'

◆ CMD_INDEX

const ilUploadLimitsOverviewGUI::CMD_INDEX = 'index'

◆ CMD_SAVE_UPLOAD_POLICY

const ilUploadLimitsOverviewGUI::CMD_SAVE_UPLOAD_POLICY = 'saveUploadPolicy'

Definition at line 36 of file class.ilUploadLimitsOverviewGUI.php.

Referenced by UploadPolicyFormUI\__construct().


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