ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBiblAdminFieldGUI Class Reference

Class ilBiblAdminFieldGUI. More...

+ Inheritance diagram for ilBiblAdminFieldGUI:
+ Collaboration diagram for ilBiblAdminFieldGUI:

Public Member Functions

 __construct (protected \ilBiblAdminFactoryFacadeInterface $facade)
 ilBiblAdminFieldGUI constructor. More...
 
 executeCommand ()
 
 checkPermissionAndFail (string $permission)
 
 checkPermissionBoolAndReturn (string $permission)
 

Data Fields

const SUBTAB_RIS = 'subtab_ris'
 
const SUBTAB_BIBTEX = 'subtab_bibtex'
 
const FIELD_IDENTIFIER = 'field_id'
 
const DATA_TYPE = 'data_type'
 
const CMD_STANDARD = 'index'
 
const CMD_CANCEL = 'cancel'
 
const CMD_EDIT = 'edit'
 
const CMD_UPDATE = 'update'
 
const CMD_SAVE_ORDERING = 'saveOrdering'
 
const CMD_APPLY_FILTER = 'applyFilter'
 
const CMD_RESET_FILTER = 'resetFilter'
 
const CMD_SAVE = 'save'
 

Protected Member Functions

 performCommand ()
 
 saveOrdering ()
 
 getFieldIdFromRequest ()
 
 index ()
 
 setSubTabs ()
 
 save ()
 
 applyFilter ()
 
 resetFilter ()
 

Protected Attributes

ilAccessHandler $access
 
Table $table
 

Private Member Functions

 saveFieldIdsInRequest ()
 
 getFieldFromRequest ()
 

Private Attributes

Services $http
 
ilCtrl $ctrl
 
ilTabsGUI $tabs
 
ilLanguage $lng
 
ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblAdminFieldGUI::__construct ( protected \ilBiblAdminFactoryFacadeInterface  $facade)

ilBiblAdminFieldGUI constructor.

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

53 {
54 global $DIC;
55 $this->main_tpl = $DIC->ui()->mainTemplate();
56 $this->http = $DIC['http'];
57 $this->ctrl = $DIC['ilCtrl'];
58 $this->tabs = $DIC['ilTabs'];
59 $this->lng = $DIC['lng'];
60 $this->access = $DIC->access();
61 $this->table = new Table(
62 $this,
63 $this->facade
64 );
65 }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilBiblAdminFieldGUI::applyFilter ( )
protected

Definition at line 196 of file class.ilBiblAdminFieldGUI.php.

196 : void
197 {
198 $ilBiblAdminFieldTableGUI = new ilBiblAdminFieldTableGUI($this, $this->facade);
199 $ilBiblAdminFieldTableGUI->writeFilterToSession();
200 $this->ctrl->redirect($this, self::CMD_STANDARD);
201 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ checkPermissionAndFail()

ilBiblAdminFieldGUI::checkPermissionAndFail ( string  $permission)

Definition at line 211 of file class.ilBiblAdminFieldGUI.php.

211 : void
212 {
213 if (!$this->checkPermissionBoolAndReturn($permission)) {
214 throw new \ilObjectException($this->lng->txt("permission_denied"));
215 }
216 }
checkPermissionBoolAndReturn(string $permission)

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

+ Here is the call graph for this function:

◆ checkPermissionBoolAndReturn()

ilBiblAdminFieldGUI::checkPermissionBoolAndReturn ( string  $permission)

Definition at line 218 of file class.ilBiblAdminFieldGUI.php.

218 : bool
219 {
220 return $this->access->checkAccess($permission, '', $this->http->request()->getQueryParams()['ref_id']);
221 }

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

Referenced by ILIAS\Bibliographic\Field\Table\__construct(), checkPermissionAndFail(), and performCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilBiblAdminFieldGUI::executeCommand ( )

Definition at line 67 of file class.ilBiblAdminFieldGUI.php.

67 : void
68 {
69 $this->saveFieldIdsInRequest();
70 $next_class = $this->ctrl->getNextClass();
72 switch ($next_class) {
73 case strtolower(ilBiblTranslationGUI::class):
74 $this->tabs->clearTargets();
75 $target = $this->ctrl->getLinkTarget($this);
76 $this->tabs->setBackTarget($this->lng->txt('back'), $target);
77
78 $field = $this->getFieldFromRequest();
79 if ($field === null) {
80 throw new ilException("Field not found");
81 }
82 $gui = new ilBiblTranslationGUI($this->facade, $field);
83 $this->ctrl->forwardCommand($gui);
84 break;
85
86 default:
87 $this->performCommand();
88 }
89 }
Class ilBiblTranslationGUI.
Base class for ILIAS Exception handling.

References ILIAS\Repository\ctrl(), getFieldFromRequest(), ILIAS\Repository\lng(), performCommand(), saveFieldIdsInRequest(), ilObjBibliographicAdminGUI\TAB_FIELDS, and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ getFieldFromRequest()

ilBiblAdminFieldGUI::getFieldFromRequest ( )
private

Definition at line 140 of file class.ilBiblAdminFieldGUI.php.

141 {
142 $field_id = $this->getFieldIdFromRequest();
143
144 return $this->facade->fieldFactory()->findById($field_id); // get field from id from the factory
145 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References getFieldIdFromRequest().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldIdFromRequest()

ilBiblAdminFieldGUI::getFieldIdFromRequest ( )
protected

Definition at line 125 of file class.ilBiblAdminFieldGUI.php.

125 : int
126 {
127 $query_params = $this->http->request()->getQueryParams(); // aka $_GET
128 $name = $this->table->getIdToken()->getName(); // name of the query parameter from the table
129 $field_ids = $query_params[$name] ?? []; // array of field ids
130 return (int) (is_array($field_ids) ? end($field_ids) : $field_ids); // return the last field id
131 }

References ILIAS\FileDelivery\http().

Referenced by getFieldFromRequest(), and saveFieldIdsInRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilBiblAdminFieldGUI::index ( )
protected

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

147 : void
148 {
149 $this->setSubTabs();
150 //$table = new ilBiblAdminFieldTableGUI($this, $this->facade);
151 //$this->tpl()->setContent($table->getHTML());
152 $this->main_tpl->setContent($this->table->getHTML());
153 }

References setSubTabs().

+ Here is the call graph for this function:

◆ performCommand()

ilBiblAdminFieldGUI::performCommand ( )
protected

Definition at line 91 of file class.ilBiblAdminFieldGUI.php.

91 : void
92 {
93 $cmd = $this->ctrl->getCmd(self::CMD_STANDARD);
94 switch ($cmd) {
96 if ($this->checkPermissionBoolAndReturn('read')) {
97 $this->{$cmd}();
98 }
99 break;
100 case self::CMD_EDIT:
101 case self::CMD_UPDATE:
102 case self::CMD_SAVE:
106 if ($this->checkPermissionBoolAndReturn('write')) {
107 $this->{$cmd}();
108 }
109 break;
110 }
111 }

References checkPermissionBoolAndReturn(), CMD_APPLY_FILTER, CMD_EDIT, CMD_RESET_FILTER, CMD_SAVE, CMD_SAVE_ORDERING, CMD_STANDARD, CMD_UPDATE, and ILIAS\Repository\ctrl().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilBiblAdminFieldGUI::resetFilter ( )
protected

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

203 : void
204 {
205 $ilBiblAdminFieldTableGUI = new ilBiblAdminFieldTableGUI($this, $this->facade);
206 $ilBiblAdminFieldTableGUI->resetFilter();
207 $ilBiblAdminFieldTableGUI->resetOffset();
208 $this->ctrl->redirect($this, self::CMD_STANDARD);
209 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ save()

ilBiblAdminFieldGUI::save ( )
protected

Definition at line 191 of file class.ilBiblAdminFieldGUI.php.

191 : void
192 {
193 $this->saveOrdering();
194 }

References saveOrdering().

+ Here is the call graph for this function:

◆ saveFieldIdsInRequest()

ilBiblAdminFieldGUI::saveFieldIdsInRequest ( )
private

Definition at line 133 of file class.ilBiblAdminFieldGUI.php.

133 : void
134 {
135 $field_id = $this->getFieldIdFromRequest();
136
137 $this->ctrl->setParameter($this, $this->table->getIdToken()->getName(), $field_id);
138 }

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

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveOrdering()

ilBiblAdminFieldGUI::saveOrdering ( )
protected

Definition at line 113 of file class.ilBiblAdminFieldGUI.php.

113 : void
114 {
115 foreach ($this->table->getOrdering() as $position => $field_id) {
116 $field = $this->facade->fieldFactory()->findById($field_id);
117 $field->setPosition($position);
118 $field->store();
119 }
120
121 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('changes_successfully_saved'));
122 $this->ctrl->redirect($this, self::CMD_STANDARD);
123 }

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

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilBiblAdminFieldGUI::setSubTabs ( )
protected

Definition at line 155 of file class.ilBiblAdminFieldGUI.php.

155 : void
156 {
157 $this->tabs->addSubTab(
158 self::SUBTAB_RIS,
159 $this->lng->txt('ris'),
160 $this->ctrl->getLinkTargetByClass(
161 [
162 ilObjBibliographicAdminGUI::class,
163 ilBiblAdminRisFieldGUI::class,
164 ],
166 )
167 );
168 $this->tabs->activateSubTab(self::SUBTAB_RIS);
169
170 $this->tabs->addSubTab(
171 self::SUBTAB_BIBTEX,
172 $this->lng->txt('bibtex'),
173 $this->ctrl->getLinkTargetByClass(
174 [
175 ilObjBibliographicAdminGUI::class,
176 ilBiblAdminBibtexFieldGUI::class,
177 ],
179 )
180 );
181 switch ($this->facade->type()->getId()) {
183 $this->tabs->activateSubTab(self::SUBTAB_BIBTEX);
184 break;
186 $this->tabs->activateSubTab(self::SUBTAB_RIS);
187 break;
188 }
189 }

References CMD_STANDARD, ilBiblTypeFactoryInterface\DATA_TYPE_BIBTEX, ilBiblTypeFactoryInterface\DATA_TYPE_RIS, ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBiblAdminFieldGUI::$access
protected

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

◆ $ctrl

ilCtrl ilBiblAdminFieldGUI::$ctrl
private

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

◆ $http

Services ilBiblAdminFieldGUI::$http
private

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

◆ $lng

ilLanguage ilBiblAdminFieldGUI::$lng
private

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

◆ $main_tpl

ilGlobalTemplateInterface ilBiblAdminFieldGUI::$main_tpl
private

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

◆ $table

Table ilBiblAdminFieldGUI::$table
protected

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

◆ $tabs

ilTabsGUI ilBiblAdminFieldGUI::$tabs
private

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

◆ CMD_APPLY_FILTER

const ilBiblAdminFieldGUI::CMD_APPLY_FILTER = 'applyFilter'

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

Referenced by performCommand().

◆ CMD_CANCEL

const ilBiblAdminFieldGUI::CMD_CANCEL = 'cancel'

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

◆ CMD_EDIT

const ilBiblAdminFieldGUI::CMD_EDIT = 'edit'

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

Referenced by performCommand().

◆ CMD_RESET_FILTER

const ilBiblAdminFieldGUI::CMD_RESET_FILTER = 'resetFilter'

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

Referenced by performCommand().

◆ CMD_SAVE

const ilBiblAdminFieldGUI::CMD_SAVE = 'save'

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

Referenced by performCommand().

◆ CMD_SAVE_ORDERING

const ilBiblAdminFieldGUI::CMD_SAVE_ORDERING = 'saveOrdering'

◆ CMD_STANDARD

const ilBiblAdminFieldGUI::CMD_STANDARD = 'index'

◆ CMD_UPDATE

const ilBiblAdminFieldGUI::CMD_UPDATE = 'update'

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

Referenced by performCommand().

◆ DATA_TYPE

const ilBiblAdminFieldGUI::DATA_TYPE = 'data_type'

Definition at line 32 of file class.ilBiblAdminFieldGUI.php.

◆ FIELD_IDENTIFIER

const ilBiblAdminFieldGUI::FIELD_IDENTIFIER = 'field_id'

◆ SUBTAB_BIBTEX

const ilBiblAdminFieldGUI::SUBTAB_BIBTEX = 'subtab_bibtex'

Definition at line 30 of file class.ilBiblAdminFieldGUI.php.

◆ SUBTAB_RIS

const ilBiblAdminFieldGUI::SUBTAB_RIS = 'subtab_ris'

Definition at line 29 of file class.ilBiblAdminFieldGUI.php.


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