ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilBiblFieldFilterGUI Class Reference

Class ilBiblFieldFilterGUI. More...

+ Collaboration diagram for ilBiblFieldFilterGUI:

Public Member Functions

 __construct (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

ilBiblFactoryFacade $facade
 
Table $table
 
ilGlobalTemplateInterface $main_tpl
 

Private Member Functions

 saveFieldIdsInRequest ()
 
 getFieldFromRequest ()
 
 getFieldFilterFromRequest ()
 

Private Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblFieldFilterGUI::__construct ( ilBiblFactoryFacade  $facade)

ilBiblFieldFilterGUI constructor.

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

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

55  {
56  global $DIC;
57  $this->main_tpl = $DIC->ui()->mainTemplate();
58  $this->facade = $facade;
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:25
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilBiblFieldFilterGUI::add ( )
protected

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

177  : void
178  {
179  $ilBiblSettingsFilterFormGUI = new ilBiblFieldFilterFormGUI($this, new ilBiblFieldFilter(), $this->facade);
180  $this->main_tpl->setContent($ilBiblSettingsFilterFormGUI->getHTML());
181  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 278 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\Repository\ctrl().

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

◆ cancel()

ilBiblFieldFilterGUI::cancel ( )

cancel

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

References ILIAS\Repository\ctrl().

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

◆ checkPermissionAndFail()

ilBiblFieldFilterGUI::checkPermissionAndFail ( string  $permission)

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

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

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

◆ checkPermissionBoolAndReturn()

ilBiblFieldFilterGUI::checkPermissionBoolAndReturn ( string  $permission)

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

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

Referenced by checkPermissionAndFail().

301  : bool
302  {
303  return (bool) $this->access->checkAccess($permission, '', $this->http->request()->getQueryParams()['ref_id']);
304  }
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 183 of file class.ilBiblFieldFilterGUI.php.

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

183  : void
184  {
185  $this->tabs->activateTab(self::CMD_STANDARD);
186  $il_bibl_field = new ilBiblFieldFilter();
187  $il_bibl_field->setObjectId($this->facade->iliasObjId());
188  $form = new ilBiblFieldFilterFormGUI($this, $il_bibl_field, $this->facade);
189  if ($form->saveObject()) {
190  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('changes_saved'), true);
191  $this->ctrl->redirect($this, self::CMD_STANDARD);
192  }
193  $form->setValuesByPost();
194  $this->main_tpl->setContent($form->getHTML());
195  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 217 of file class.ilBiblFieldFilterGUI.php.

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

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

◆ edit()

ilBiblFieldFilterGUI::edit ( )

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

References initEditForm().

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

◆ executeCommand()

ilBiblFieldFilterGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl(), performCommand(), saveFieldIdsInRequest(), ilObjBibliographicGUI\TAB_SETTINGS, and ILIAS\Repository\tabs().

98  : void
99  {
100  $this->saveFieldIdsInRequest();
101  $next_class = $this->ctrl->getNextClass();
102  switch ($next_class) {
103  default:
104  $this->tabs->activateTab(ilObjBibliographicGUI::TAB_SETTINGS);
105  $this->performCommand();
106  }
107  }
+ Here is the call graph for this function:

◆ getFieldFilterFromRequest()

ilBiblFieldFilterGUI::getFieldFilterFromRequest ( )
private

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

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

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

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

◆ getFieldFromRequest()

ilBiblFieldFilterGUI::getFieldFromRequest ( )
private

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

References getFieldIdFromRequest().

Referenced by performCommand().

154  {
155  $field_id = $this->getFieldIdFromRequest();
156 
157  return $this->facade->fieldFactory()->findById($field_id); // get field from id from the factory
158  }
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 138 of file class.ilBiblFieldFilterGUI.php.

References ILIAS\FileDelivery\http().

Referenced by getFieldFromRequest(), and saveFieldIdsInRequest().

138  : int
139  {
140  $query_params = $this->http->request()->getQueryParams(); // aka $_GET
141  $name = $this->table->getIdToken()->getName(); // name of the query parameter from the table
142  $field_ids = $query_params[$name] ?? []; // array of field ids
143  return (int) (is_array($field_ids) ? end($field_ids) : $field_ids); // return the last field id
144  }
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 160 of file class.ilBiblFieldFilterGUI.php.

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

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

◆ initEditForm()

ilBiblFieldFilterGUI::initEditForm ( )
protected

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

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

Referenced by edit().

261  {
262  $this->tabs->clearTargets();
263  $this->tabs->setBackTarget(
264  $this->lng->txt("back"),
265  $this->ctrl->getLinkTargetByClass(ilBiblFieldFilterGUI::class, ilBiblFieldFilterGUI::CMD_STANDARD)
266  );
267 
268  $ilBiblSettingsFilterFormGUI = new ilBiblFieldFilterFormGUI(
269  $this,
270  $this->getFieldFilterFromRequest(),
271  $this->facade
272  );
273  $ilBiblSettingsFilterFormGUI->fillForm();
274 
275  return $ilBiblSettingsFilterFormGUI;
276  }
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:

◆ performCommand()

ilBiblFieldFilterGUI::performCommand ( )
protected

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

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

Referenced by executeCommand().

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

◆ resetFilter()

ilBiblFieldFilterGUI::resetFilter ( )
protected

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

References ILIAS\Repository\ctrl().

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

◆ saveFieldIdsInRequest()

ilBiblFieldFilterGUI::saveFieldIdsInRequest ( )
private

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

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

Referenced by executeCommand().

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

◆ update()

ilBiblFieldFilterGUI::update ( )

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

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

203  : void
204  {
205  $il_bibl_field = $this->getFieldFilterFromRequest();
206  $this->tabs->activateTab(self::CMD_STANDARD);
207 
208  $form = new ilBiblFieldFilterFormGUI($this, $il_bibl_field, $this->facade);
209  if ($form->saveObject()) {
210  $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('changes_saved'), true);
211  $this->ctrl->redirect($this, self::CMD_STANDARD);
212  }
213  $form->setValuesByPost();
214  $this->main_tpl->setContent($form->getHTML());
215  }
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:

Field Documentation

◆ $access

ilAccessHandler ilBiblFieldFilterGUI::$access
private

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

◆ $ctrl

ilCtrl ilBiblFieldFilterGUI::$ctrl
private

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

◆ $facade

ilBiblFactoryFacade ilBiblFieldFilterGUI::$facade
protected

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

Referenced by __construct().

◆ $http

ILIAS HTTP Services ilBiblFieldFilterGUI::$http
private

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

◆ $lng

ilLanguage ilBiblFieldFilterGUI::$lng
private

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

◆ $main_tpl

ilGlobalTemplateInterface ilBiblFieldFilterGUI::$main_tpl
protected

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

◆ $table

Table ilBiblFieldFilterGUI::$table
protected

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

◆ $tabs

ilTabsGUI ilBiblFieldFilterGUI::$tabs
private

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

◆ CMD_ADD

const ilBiblFieldFilterGUI::CMD_ADD = 'add'

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

◆ CMD_APPLY_FILTER

const ilBiblFieldFilterGUI::CMD_APPLY_FILTER = 'applyFilter'

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

◆ CMD_CANCEL

const ilBiblFieldFilterGUI::CMD_CANCEL = 'cancel'

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

Referenced by ilBiblFieldFilterFormGUI\initButtons().

◆ CMD_CREATE

const ilBiblFieldFilterGUI::CMD_CREATE = 'create'

Definition at line 34 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 39 of file class.ilBiblFieldFilterGUI.php.

◆ CMD_RESET_FILTER

const ilBiblFieldFilterGUI::CMD_RESET_FILTER = 'resetFilter'

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

◆ CMD_STANDARD

◆ CMD_UPDATE

const ilBiblFieldFilterGUI::CMD_UPDATE = 'update'

Definition at line 37 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: