ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilBiblFieldFilterGUI Class Reference

Class ilBiblFieldFilterGUI. More...

+ Collaboration diagram for ilBiblFieldFilterGUI:

Public Member Functions

 __construct (protected \ilBiblFactoryFacade $facade)
 ilBiblFieldFilterGUI constructor. More...
 
 renderInterruptiveModal ()
 
 executeCommand ()
 
 index ()
 
 edit ()
 
 update ()
 
 delete ()
 
 cancel ()
 cancel More...
 
 checkPermissionAndFail (string $permission)
 
 checkPermissionBoolAndReturn (string $permission)
 

Data Fields

const FILTER_ID = 'filter_id'
 
const CMD_STANDARD = 'index'
 
const CMD_ADD = 'add'
 
const CMD_CREATE = 'create'
 
const CMD_CANCEL = 'cancel'
 
const CMD_EDIT = 'edit'
 
const CMD_UPDATE = 'update'
 
const CMD_DELETE = 'delete'
 
const CMD_RENDER_INTERRUPTIVE = 'renderInterruptiveModal'
 
const CMD_APPLY_FILTER = 'applyFilter'
 
const CMD_RESET_FILTER = 'resetFilter'
 

Protected Member Functions

 performCommand ()
 
 getFieldIdFromRequest ()
 
 add ()
 
 create ()
 
 initEditForm ()
 
 applyFilter ()
 
 resetFilter ()
 

Protected Attributes

Table $table
 
ilGlobalTemplateInterface $main_tpl
 

Private Member Functions

 saveFieldIdsInRequest ()
 
 getFieldFromRequest ()
 
 getFieldFilterFromRequest ()
 

Private Attributes

Services $http
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs
 
ilAccessHandler $access
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblFieldFilterGUI::__construct ( protected \ilBiblFactoryFacade  $facade)

ilBiblFieldFilterGUI constructor.

Definition at line 55 of file class.ilBiblFieldFilterGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

56  {
57  global $DIC;
58  $this->main_tpl = $DIC->ui()->mainTemplate();
59  $this->table = new Table(
60  $this,
61  $this->facade
62  );
63  $this->http = $DIC['http'];
64  $this->ctrl = $DIC['ilCtrl'];
65  $this->tabs = $DIC['ilTabs'];
66  $this->lng = $DIC['lng'];
67  $this->access = $DIC['ilAccess'];
68  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilBiblFieldFilterGUI::add ( )
protected

Definition at line 174 of file class.ilBiblFieldFilterGUI.php.

174  : void
175  {
176  $ilBiblSettingsFilterFormGUI = new ilBiblFieldFilterFormGUI($this, new ilBiblFieldFilter(), $this->facade);
177  $this->main_tpl->setContent($ilBiblSettingsFilterFormGUI->getHTML());
178  }
Class ilBiblFieldFilterFormGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ applyFilter()

ilBiblFieldFilterGUI::applyFilter ( )
protected

Definition at line 275 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\ctrl().

275  : void
276  {
277  $table = new ilBiblFieldFilterTableGUI($this, $this->facade);
278  $table->writeFilterToSession();
279  $table->resetOffset();
280  $this->ctrl->redirect($this, self::CMD_STANDARD);
281  }
+ Here is the call graph for this function:

◆ cancel()

ilBiblFieldFilterGUI::cancel ( )

cancel

Definition at line 231 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\ctrl().

231  : void
232  {
233  $this->ctrl->redirect($this, self::CMD_STANDARD);
234  }
+ Here is the call graph for this function:

◆ checkPermissionAndFail()

ilBiblFieldFilterGUI::checkPermissionAndFail ( string  $permission)

Definition at line 291 of file class.ilBiblFieldFilterGUI.php.

References checkPermissionBoolAndReturn(), and ILIAS\Repository\lng().

291  : void
292  {
293  if (!$this->checkPermissionBoolAndReturn($permission)) {
294  throw new \ilObjectException($this->lng()->txt("permission_denied"));
295  }
296  }
checkPermissionBoolAndReturn(string $permission)
+ Here is the call graph for this function:

◆ checkPermissionBoolAndReturn()

ilBiblFieldFilterGUI::checkPermissionBoolAndReturn ( string  $permission)

Definition at line 298 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\access(), and ILIAS\FileDelivery\http().

Referenced by checkPermissionAndFail().

298  : bool
299  {
300  return (bool) $this->access->checkAccess($permission, '', $this->http->request()->getQueryParams()['ref_id']);
301  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilBiblFieldFilterGUI::create ( )
protected

Definition at line 180 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

180  : void
181  {
182  $this->tabs->activateTab(self::CMD_STANDARD);
183  $il_bibl_field = new ilBiblFieldFilter();
184  $il_bibl_field->setObjectId($this->facade->iliasObjId());
185  $form = new ilBiblFieldFilterFormGUI($this, $il_bibl_field, $this->facade);
186  if ($form->saveObject()) {
187  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('changes_saved'), true);
188  $this->ctrl->redirect($this, self::CMD_STANDARD);
189  }
190  $form->setValuesByPost();
191  $this->main_tpl->setContent($form->getHTML());
192  }
Class ilBiblFieldFilterFormGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ delete()

ilBiblFieldFilterGUI::delete ( )

Definition at line 214 of file class.ilBiblFieldFilterGUI.php.

References $token, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

214  : void
215  {
216  $token = $this->table->getIdToken()->getName();
217  $items = $this->http->request()->getQueryParams()[$token] ?? [];
218 
219  foreach ($items as $filter_id) {
220  $il_bibl_field = $this->facade->filterFactory()->findById((int) $filter_id);
221  $il_bibl_field->delete();
222  }
223 
224  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('filter_deleted'), true);
225  $this->ctrl->redirect($this, self::CMD_STANDARD);
226  }
static http()
Fetches the global http state from ILIAS.
$token
Definition: xapitoken.php:70
+ Here is the call graph for this function:

◆ edit()

ilBiblFieldFilterGUI::edit ( )

Definition at line 194 of file class.ilBiblFieldFilterGUI.php.

References initEditForm().

194  : void
195  {
196  $ilBiblSettingsFilterFormGUI = $this->initEditForm();
197  $this->main_tpl->setContent($ilBiblSettingsFilterFormGUI->getHTML());
198  }
+ Here is the call graph for this function:

◆ executeCommand()

ilBiblFieldFilterGUI::executeCommand ( )

◆ getFieldFilterFromRequest()

ilBiblFieldFilterGUI::getFieldFilterFromRequest ( )
private

Definition at line 236 of file class.ilBiblFieldFilterGUI.php.

References $token, ILIAS\Bibliographic\FieldFilter\Table\getIdToken(), ILIAS\FileDelivery\http(), and null.

Referenced by initEditForm(), renderInterruptiveModal(), and update().

237  {
238  $table = new Table(
239  $this,
240  $this->facade
241  );
242 
243  $token = $table->getIdToken()->getName();
244  if (isset($this->http->request()->getQueryParams()[$token])) {
245  $field_id = $this->http->request()->getQueryParams()[$token] ?? null;
246  if (is_array($field_id)) {
247  $field_id = $field_id[0];
248  }
249  return $this->facade->filterFactory()->findById($field_id ?? 0);
250  }
251 
252  $field = $this->http->request()->getQueryParams()[self::FILTER_ID];
253 
254  return $this->facade->filterFactory()->findById($field);
255  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
$token
Definition: xapitoken.php:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldFromRequest()

ilBiblFieldFilterGUI::getFieldFromRequest ( )
private

Definition at line 150 of file class.ilBiblFieldFilterGUI.php.

References getFieldIdFromRequest().

Referenced by performCommand().

151  {
152  $field_id = $this->getFieldIdFromRequest();
153 
154  return $this->facade->fieldFactory()->findById($field_id); // get field from id from the factory
155  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldIdFromRequest()

ilBiblFieldFilterGUI::getFieldIdFromRequest ( )
protected

Definition at line 135 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\FileDelivery\http().

Referenced by getFieldFromRequest(), and saveFieldIdsInRequest().

135  : int
136  {
137  $query_params = $this->http->request()->getQueryParams(); // aka $_GET
138  $name = $this->table->getIdToken()->getName(); // name of the query parameter from the table
139  $field_ids = $query_params[$name] ?? []; // array of field ids
140  return (int) (is_array($field_ids) ? end($field_ids) : $field_ids); // return the last field id
141  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilBiblFieldFilterGUI::index ( )

Definition at line 157 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), renderer(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

157  : void
158  {
159  if ($this->access->checkAccess('write', "", $this->facade->iliasRefId())) {
160  // mantis 0038219: added infobox to describe the filter functionality
161  $infobox = $this->dic()->ui()->factory()->messageBox()->info($this->lng()->txt('msg_filter_info'));
162  $this->tpl()->setVariable("MESSAGE", $this->dic()->ui()->renderer()->render($infobox));
163 
164  $button = $this->dic()->ui()->factory()->button()->primary(
165  $this->lng->txt("add_filter"),
166  $this->ctrl->getLinkTarget($this, self::CMD_ADD)
167  );
168  $this->toolbar()->addComponent($button);
169  }
170 
171  $this->main_tpl->setContent($this->table->getHTML());
172  }
renderer()
+ Here is the call graph for this function:

◆ initEditForm()

ilBiblFieldFilterGUI::initEditForm ( )
protected

Definition at line 257 of file class.ilBiblFieldFilterGUI.php.

References CMD_STANDARD, ILIAS\Repository\ctrl(), getFieldFilterFromRequest(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by edit().

258  {
259  $this->tabs->clearTargets();
260  $this->tabs->setBackTarget(
261  $this->lng->txt("back"),
262  $this->ctrl->getLinkTargetByClass(ilBiblFieldFilterGUI::class, ilBiblFieldFilterGUI::CMD_STANDARD)
263  );
264 
265  $ilBiblSettingsFilterFormGUI = new ilBiblFieldFilterFormGUI(
266  $this,
267  $this->getFieldFilterFromRequest(),
268  $this->facade
269  );
270  $ilBiblSettingsFilterFormGUI->fillForm();
271 
272  return $ilBiblSettingsFilterFormGUI;
273  }
Class ilBiblFieldFilterFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performCommand()

ilBiblFieldFilterGUI::performCommand ( )
protected

Definition at line 106 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), getFieldFromRequest(), ILIAS\Repository\lng(), and null.

Referenced by executeCommand().

106  : void
107  {
108  $cmd = $this->ctrl->getCmd(self::CMD_STANDARD);
109  switch ($cmd) {
110  case self::CMD_EDIT:
111  case self::CMD_DELETE:
112  $field = $this->getFieldFromRequest();
113  if ($field === null) {
114  throw new ilException("Field not found");
115  }
116  // no break
117  case self::CMD_STANDARD:
118  case self::CMD_ADD:
119  case self::CMD_UPDATE:
120  case self::CMD_CREATE:
121  case self::CMD_CANCEL:
122  case self::CMD_APPLY_FILTER:
123  case self::CMD_RESET_FILTER:
124  case self::CMD_RENDER_INTERRUPTIVE:
125  if ($this->access->checkAccess('write', "", $this->facade->iliasRefId())) {
126  $this->{$cmd}();
127  break;
128  } else {
129  $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
130  break;
131  }
132  }
133  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderInterruptiveModal()

ilBiblFieldFilterGUI::renderInterruptiveModal ( )

Definition at line 70 of file class.ilBiblFieldFilterGUI.php.

References Vendor\Package\$f, $r, CMD_DELETE, ILIAS\Repository\ctrl(), exit, getFieldFilterFromRequest(), and ILIAS\Repository\lng().

70  : void
71  {
72  $f = $this->dic()->ui()->factory();
73  $r = $this->dic()->ui()->renderer();
74  $ilBiblFieldFilter = $this->getFieldFilterFromRequest();
75  $form_action = $this->ctrl->getFormActionByClass(
76  ilBiblFieldFilterGUI::class,
78  );
79  $delete_modal = $f->modal()->interruptive(
80  $this->lng->txt("delete"),
81  $this->lng->txt('msg_confirm_delete_filter'),
82  $form_action
83  )->withAffectedItems(
84  [
85  $f->modal()->interruptiveItem()->standard(
86  (string) $ilBiblFieldFilter->getId(),
87  $this->facade->translationFactory()->translate(
88  $this->facade->fieldFactory()->findById($ilBiblFieldFilter->getFieldId())
89  )
90  )
91  ]
92  );
93 
94  echo $r->render([$delete_modal]);
95  exit;
96  }
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$r
+ Here is the call graph for this function:

◆ resetFilter()

ilBiblFieldFilterGUI::resetFilter ( )
protected

Definition at line 283 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\ctrl().

283  : void
284  {
285  $table = new ilBiblFieldFilterTableGUI($this, $this->facade);
286  $table->resetFilter();
287  $table->resetOffset();
288  $this->ctrl->redirect($this, self::CMD_STANDARD);
289  }
+ Here is the call graph for this function:

◆ saveFieldIdsInRequest()

ilBiblFieldFilterGUI::saveFieldIdsInRequest ( )
private

Definition at line 143 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\ctrl(), and getFieldIdFromRequest().

Referenced by executeCommand().

143  : void
144  {
145  $field_id = $this->getFieldIdFromRequest();
146 
147  $this->ctrl->setParameter($this, $this->table->getIdToken()->getName(), $field_id);
148  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilBiblFieldFilterGUI::update ( )

Definition at line 200 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\ctrl(), getFieldFilterFromRequest(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

200  : void
201  {
202  $il_bibl_field = $this->getFieldFilterFromRequest();
203  $this->tabs->activateTab(self::CMD_STANDARD);
204 
205  $form = new ilBiblFieldFilterFormGUI($this, $il_bibl_field, $this->facade);
206  if ($form->saveObject()) {
207  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('changes_saved'), true);
208  $this->ctrl->redirect($this, self::CMD_STANDARD);
209  }
210  $form->setValuesByPost();
211  $this->main_tpl->setContent($form->getHTML());
212  }
Class ilBiblFieldFilterFormGUI.
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBiblFieldFilterGUI::$access
private

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

◆ $ctrl

ilCtrl ilBiblFieldFilterGUI::$ctrl
private

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

◆ $http

Services ilBiblFieldFilterGUI::$http
private

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

◆ $lng

ilLanguage ilBiblFieldFilterGUI::$lng
private

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

◆ $main_tpl

ilGlobalTemplateInterface ilBiblFieldFilterGUI::$main_tpl
protected

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

◆ $table

Table ilBiblFieldFilterGUI::$table
protected

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

◆ $tabs

ilTabsGUI ilBiblFieldFilterGUI::$tabs
private

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

◆ CMD_ADD

const ilBiblFieldFilterGUI::CMD_ADD = 'add'

Definition at line 35 of file class.ilBiblFieldFilterGUI.php.

◆ CMD_APPLY_FILTER

const ilBiblFieldFilterGUI::CMD_APPLY_FILTER = 'applyFilter'

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

◆ CMD_CANCEL

const ilBiblFieldFilterGUI::CMD_CANCEL = 'cancel'

Definition at line 37 of file class.ilBiblFieldFilterGUI.php.

Referenced by ilBiblFieldFilterFormGUI\initButtons().

◆ CMD_CREATE

const ilBiblFieldFilterGUI::CMD_CREATE = 'create'

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

Referenced by ilBiblFieldFilterFormGUI\initButtons().

◆ CMD_DELETE

const ilBiblFieldFilterGUI::CMD_DELETE = 'delete'

◆ CMD_EDIT

const ilBiblFieldFilterGUI::CMD_EDIT = 'edit'

◆ CMD_RENDER_INTERRUPTIVE

const ilBiblFieldFilterGUI::CMD_RENDER_INTERRUPTIVE = 'renderInterruptiveModal'

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

◆ CMD_RESET_FILTER

const ilBiblFieldFilterGUI::CMD_RESET_FILTER = 'resetFilter'

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

◆ CMD_STANDARD

◆ CMD_UPDATE

const ilBiblFieldFilterGUI::CMD_UPDATE = 'update'

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

Referenced by ilBiblFieldFilterFormGUI\initButtons().

◆ FILTER_ID

const ilBiblFieldFilterGUI::FILTER_ID = 'filter_id'

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