ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilDclTableViewEditGUI Class Reference

@ilCtrl_Calls ilDclTableViewEditGUI: ilDclDetailedViewDefinitionGUI @ilCtrl_Calls ilDclTableViewEditGUI: ilDclCreateViewDefinitionGUI @ilCtrl_Calls ilDclTableViewEditGUI: ilDclEditViewDefinitionGUI More...

+ Collaboration diagram for ilDclTableViewEditGUI:

Public Member Functions

 __construct (ilDclTableViewGUI $parent_obj, ilDclTable $table, ilDclTableView $tableview)
 
 executeCommand ()
 
 save (bool $create=false)
 
 confirmDelete ()
 
 permissionDenied ()
 
 copy ()
 

Data Fields

ilDclTableView $tableview
 
ilDclTable $table
 

Protected Member Functions

 initForm (bool $create=false)
 
 setValues (array $inputs)
 
 setTabs (string $active)
 
 initTableGUI ()
 
 cancel ()
 
 delete ()
 
 checkAccess (string $cmd)
 

Protected Attributes

ilDclTableViewGUI $parent_obj
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalPageTemplate $tpl
 
ilPropertyFormGUI $form
 
ilDclTableViewEditFieldsTableGUI $table_gui
 
ilTabsGUI $tabs_gui
 
ilHelpGUI $help
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 

Private Attributes

Factory $ui_factory
 
Renderer $ui_renderer
 
array $available_roles = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclTableViewEditGUI::__construct ( ilDclTableViewGUI  $parent_obj,
ilDclTable  $table,
ilDclTableView  $tableview 
)

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

52 {
53 global $DIC;
54 $lng = $DIC['lng'];
55 $ilCtrl = $DIC['ilCtrl'];
56 $tpl = $DIC['tpl'];
57 $ilTabs = $DIC['ilTabs'];
58 $locator = $DIC['ilLocator'];
59 $this->table = $table;
60 $this->tpl = $tpl;
61 $this->lng = $lng;
62 $this->ctrl = $ilCtrl;
63 $this->parent_obj = $parent_obj;
64 $this->tableview = $tableview;
65 $this->tabs_gui = $ilTabs;
66 $this->help = $DIC->help();
67 $this->http = $DIC->http();
68 $this->refinery = $DIC->refinery();
69 $this->ui_factory = $DIC->ui()->factory();
70 $this->ui_renderer = $DIC->ui()->renderer();
71 $ref_id = $this->table->getCollectionObject()->getRefId();
72 foreach ($DIC->rbac()->review()->getParentRoleIds($ref_id) as $role) {
73 if (
74 $role['obj_id'] !== SYSTEM_ROLE_ID &&
75 $DIC->rbac()->system()->checkPermission($ref_id, $role['obj_id'], 'visible')
76 ) {
77 $this->available_roles[$role['obj_id']] = ilObjRole::_getTranslation($role['title']);
78 }
79 }
80
81 $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
82 $this->ctrl->saveParameter($this, 'tableview_id');
83 if ($this->tableview->getTitle()) {
84 $locator->addItem($this->tableview->getTitle(), $this->ctrl->getLinkTarget($this, 'show'));
85 }
86 $this->tpl->setLocator();
87 }
static _getTranslation(string $a_role_title)
const SYSTEM_ROLE_ID
Definition: constants.php:29
$ref_id
Definition: ltiauth.php:66
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, $lng, $parent_obj, $ref_id, $table, $tableview, $tpl, ilObjRole\_getTranslation(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and SYSTEM_ROLE_ID.

+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilDclTableViewEditGUI::cancel ( )
protected

Definition at line 337 of file class.ilDclTableViewEditGUI.php.

337 : void
338 {
339 $this->ctrl->setParameter($this->parent_obj, 'table_id', $this->table->getId());
340 $this->ctrl->redirect($this->parent_obj);
341 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ checkAccess()

ilDclTableViewEditGUI::checkAccess ( string  $cmd)
protected

Definition at line 376 of file class.ilDclTableViewEditGUI.php.

376 : bool
377 {
378 if (in_array($cmd, ['add', 'create', 'cancel'])) {
380 $this->parent_obj->getParentObj()->getDataCollectionObject()->getRefId(),
381 $this->table->getId()
382 );
383 } else {
384 return ilObjDataCollectionAccess::hasAccessTo(
385 $this->parent_obj->getParentObj()->getDataCollectionObject()->getRefId(),
386 $this->table->getId(),
387 $this->tableview->getId()
388 );
389 }
390 }
static hasAccessToEditTable(int $ref_id, int $table_id)

References ilObjDataCollectionAccess\hasAccessToEditTable().

Referenced by executeCommand().

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

◆ confirmDelete()

ilDclTableViewEditGUI::confirmDelete ( )

Definition at line 343 of file class.ilDclTableViewEditGUI.php.

343 : void
344 {
345 //at least one view must exist
346 $this->parent_obj->checkViewsLeft(1);
347
348 $conf = new ilConfirmationGUI();
349 $conf->setFormAction($this->ctrl->getFormAction($this));
350 $conf->setHeaderText($this->lng->txt('dcl_tableview_confirm_delete'));
351
352 $conf->addItem('tableview_id', (string) $this->tableview->getId(), $this->tableview->getTitle());
353
354 $conf->setConfirm($this->lng->txt('delete'), 'delete');
355 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
356
357 $this->tpl->setContent($conf->getHTML());
358 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ copy()

ilDclTableViewEditGUI::copy ( )

Definition at line 392 of file class.ilDclTableViewEditGUI.php.

392 : void
393 {
394 $new_tableview = new ilDclTableView();
395 $new_tableview->setTableId($this->table->getId());
396 $new_tableview->cloneStructure($this->tableview, []);
397 $this->tpl->setOnScreenMessage('success', $this->lng->txt("dcl_tableview_copy"), true);
398 $this->cancel();
399 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ delete()

ilDclTableViewEditGUI::delete ( )
protected

Definition at line 360 of file class.ilDclTableViewEditGUI.php.

360 : void
361 {
362 $this->tableview->delete();
363 $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableview_deleted'), true);
364 $this->cancel();
365 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableViewEditGUI::executeCommand ( )

Definition at line 89 of file class.ilDclTableViewEditGUI.php.

89 : void
90 {
91 $cmd = $this->ctrl->getCmd('show');
92 $next_class = $this->ctrl->getNextClass($this);
93
94 if (!$this->checkAccess($cmd)) {
95 $this->permissionDenied();
96 }
97
98 $this->tabs_gui->clearTargets();
99 $this->tabs_gui->clearSubTabs();
100 $this->tabs_gui->setBackTarget(
101 $this->lng->txt('dcl_tableviews'),
102 $this->ctrl->getLinkTarget($this->parent_obj)
103 );
104 $this->tabs_gui->setBack2Target(
105 $this->lng->txt('dcl_tables'),
106 $this->ctrl->getLinkTarget($this->parent_obj->getParentObj())
107 );
108
109 switch ($next_class) {
110 case 'ildcldetailedviewdefinitiongui':
111 $this->help->setSubScreenId('detailed_view');
112 $this->setTabs('detailed_view');
113 $recordedit_gui = new ilDclDetailedViewDefinitionGUI($this->tableview->getId());
114 $ret = $this->ctrl->forwardCommand($recordedit_gui);
115 if ($ret != "") {
116 $this->tpl->setContent($ret);
117 }
118 break;
119 case 'ildclcreateviewdefinitiongui':
120 $this->help->setSubScreenId('record_create');
121 $this->setTabs('create_view');
122 $creation_gui = new ilDclCreateViewDefinitionGUI($this->tableview->getId());
123 $this->ctrl->forwardCommand($creation_gui);
124 break;
125 case 'ildcleditviewdefinitiongui':
126 $this->help->setSubScreenId('record_edit');
127 $this->setTabs('edit_view');
128 $edit_gui = new ilDclEditViewDefinitionGUI($this->tableview->getId());
129 $this->ctrl->forwardCommand($edit_gui);
130 break;
131 default:
132 switch ($cmd) {
133 case 'show':
134 if ($this->tableview->getId()) {
135 $this->ctrl->redirect($this, 'editGeneralSettings');
136 } else {
137 $this->ctrl->redirect($this, 'add');
138 }
139 break;
140 case 'add':
141 $this->help->setSubScreenId('create');
142 $this->tpl->setContent(
143 $this->lng->txt('dcl_new_view') . $this->ui_renderer->render($this->initForm(true))
144 );
145 break;
146 case 'editGeneralSettings':
147 $this->help->setSubScreenId('edit');
148 $this->setTabs('general_settings');
149 $this->tpl->setContent(
150 sprintf($this->lng->txt('dcl_edit_view'), $this->tableview->getTitle()) .
151 $this->ui_renderer->render($this->initForm())
152 );
153 break;
154 case 'editFieldSettings':
155 $this->help->setSubScreenId('overview');
156 $this->setTabs('field_settings');
157 $this->initTableGUI();
158 $this->tpl->setContent($this->table_gui->getHTML());
159 break;
160 default:
161 if ($cmd === 'create' || $cmd === 'update') {
162 $this->save($cmd === 'create');
163 } else {
164 $this->$cmd();
165 }
166 break;
167 }
168 break;
169 }
170 }
@ilCtrl_IsCalledBy ilDclCreateViewDefinitionGUI: ilDclTableViewEditGUI
@ilCtrl_Calls ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI,...
@ilCtrl_IsCalledBy ilDclEditViewDefinitionGUI: ilDclTableViewEditGUI

References checkAccess(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), initTableGUI(), ILIAS\Repository\lng(), permissionDenied(), save(), and setTabs().

+ Here is the call graph for this function:

◆ initForm()

ilDclTableViewEditGUI::initForm ( bool  $create = false)
protected

Definition at line 172 of file class.ilDclTableViewEditGUI.php.

172 : Form
173 {
174 $settings['title'] = $this->ui_factory->input()->field()->text($this->lng->txt('title'))->withRequired(true);
175 $settings['description'] = $this->ui_factory->input()->field()->textarea($this->lng->txt('description'));
176 $roles = [];
177 $settings['role_limitation'] = $this->ui_factory->input()->field()->optionalGroup(
178 [
179 'roles' => $this->ui_factory->input()->field()->multiSelect(
180 $this->lng->txt('roles'),
181 $this->available_roles,
182 $this->lng->txt('roles_desc')
183 )
184 ],
185 $this->lng->txt('role_limitation')
186 )->withValue(null);
187
188 $inputs['settings'] = $this->ui_factory->input()->field()->section($settings, $this->lng->txt('general_settings'));
189
190 if (!$create) {
191 $inputs = $this->setValues($inputs);
192 }
193
194 return $this->ui_factory->input()->container()->form()->standard(
195 $this->ctrl->getFormAction($this, $create ? 'create' : 'update'),
196 $inputs
197 );
198 }
This describes commonalities between all forms.
Definition: Form.php:34

References ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and setValues().

Referenced by save().

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

◆ initTableGUI()

ilDclTableViewEditGUI::initTableGUI ( )
protected

Definition at line 331 of file class.ilDclTableViewEditGUI.php.

331 : void
332 {
334 $this->table_gui = $table;
335 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ permissionDenied()

ilDclTableViewEditGUI::permissionDenied ( )

Definition at line 367 of file class.ilDclTableViewEditGUI.php.

367 : void
368 {
369 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
370 $this->ctrl->redirectByClass(
371 [ilObjDataCollectionGUI::class, ilDclRecordListGUI::class],
373 );
374 }

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

Referenced by executeCommand().

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

◆ save()

ilDclTableViewEditGUI::save ( bool  $create = false)

Definition at line 248 of file class.ilDclTableViewEditGUI.php.

248 : void
249 {
250 $form = $this->initForm($create)->withRequest($this->http->request());
251 $data = $form->getData();
252 if ($data !== null) {
253 $this->tableview->setTitle($data['settings']['title']);
254 $this->tableview->setDescription($data['settings']['description']);
255 $this->tableview->setRoleLimitation($data['settings']['role_limitation'] !== null);
256 $this->tableview->setRoles($data['settings']['role_limitation']['roles'] ?? []);
257 if ($create) {
258 $this->tableview->setTableId($this->table->getId());
259 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('dcl_msg_tableview_created'), true);
260 $this->tableview->create();
261 $this->ctrl->setParameter($this, 'tableview_id', $this->tableview->getId());
262 } else {
263 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('dcl_msg_tableview_updated'), true);
264 $this->tableview->update();
265 }
266 $this->ctrl->redirect($this, 'editGeneralSettings');
267 }
268
269 if ($create) {
270 $this->help->setSubScreenId('create');
271 $this->tpl->setContent($this->lng->txt('dcl_new_view') . $this->ui_renderer->render($form));
272 } else {
273 $this->help->setSubScreenId('edit');
274 $this->setTabs('general_settings');
275 $this->tpl->setContent(
276 sprintf($this->lng->txt('dcl_edit_view'), $this->tableview->getTitle()) .
277 $this->ui_renderer->render($form)
278 );
279 }
280 }

References $data, $form, ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initForm(), ILIAS\Repository\lng(), setTabs(), and ilPropertyFormGUI\setTitle().

Referenced by executeCommand().

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

◆ setTabs()

ilDclTableViewEditGUI::setTabs ( string  $active)
protected

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

218 : void
219 {
220 $this->tabs_gui->addTab(
221 'general_settings',
222 $this->lng->txt('settings'),
223 $this->ctrl->getLinkTarget($this, 'editGeneralSettings')
224 );
225 $this->tabs_gui->addTab(
226 'create_view',
227 $this->lng->txt('dcl_create_entry_rules'),
228 $this->ctrl->getLinkTargetByClass('ilDclCreateViewDefinitionGUI', 'presentation')
229 );
230 $this->tabs_gui->addTab(
231 'edit_view',
232 $this->lng->txt('dcl_edit_entry_rules'),
233 $this->ctrl->getLinkTargetByClass('ilDclEditViewDefinitionGUI', 'presentation')
234 );
235 $this->tabs_gui->addTab(
236 'field_settings',
237 $this->lng->txt('dcl_list_visibility_and_filter'),
238 $this->ctrl->getLinkTarget($this, 'editFieldSettings')
239 );
240 $this->tabs_gui->addTab(
241 'detailed_view',
242 $this->lng->txt('dcl_detailed_view'),
243 $this->ctrl->getLinkTargetByClass('ilDclDetailedViewDefinitionGUI', 'edit')
244 );
245 $this->tabs_gui->setTabActive($active);
246 }

References ILIAS\Repository\lng().

Referenced by executeCommand(), and save().

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

◆ setValues()

ilDclTableViewEditGUI::setValues ( array  $inputs)
protected

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

200 : array
201 {
202 $roles = [];
203 foreach ($this->tableview->getRoles() as $role) {
204 $role = (int) $role;
205 if (in_array($role, array_keys($this->available_roles), true)) {
206 $roles[] = $role;
207 }
208 }
209 $inputs['settings'] = $inputs['settings']->withValue([
210 'title' => $this->tableview->getTitle(),
211 'description' => $this->tableview->getDescription(),
212 'role_limitation' => $this->tableview->getRoleLimitation() ? ['roles' => $roles] : null
213 ]);
214
215 return $inputs;
216 }

References ILIAS\UI\Implementation\Component\Input\$inputs, and ILIAS\Repository\int().

Referenced by initForm().

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

Field Documentation

◆ $available_roles

array ilDclTableViewEditGUI::$available_roles = []
private

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

◆ $ctrl

ilCtrl ilDclTableViewEditGUI::$ctrl
protected

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

◆ $form

ilPropertyFormGUI ilDclTableViewEditGUI::$form
protected

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

Referenced by save().

◆ $help

ilHelpGUI ilDclTableViewEditGUI::$help
protected

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

◆ $http

ILIAS HTTP Services ilDclTableViewEditGUI::$http
protected

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

◆ $lng

ilLanguage ilDclTableViewEditGUI::$lng
protected

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

Referenced by __construct().

◆ $parent_obj

ilDclTableViewGUI ilDclTableViewEditGUI::$parent_obj
protected

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

Referenced by __construct().

◆ $refinery

ILIAS Refinery Factory ilDclTableViewEditGUI::$refinery
protected

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

◆ $table

ilDclTable ilDclTableViewEditGUI::$table

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

Referenced by __construct().

◆ $table_gui

ilDclTableViewEditFieldsTableGUI ilDclTableViewEditGUI::$table_gui
protected

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

◆ $tableview

ilDclTableView ilDclTableViewEditGUI::$tableview

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

Referenced by __construct().

◆ $tabs_gui

ilTabsGUI ilDclTableViewEditGUI::$tabs_gui
protected

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

◆ $tpl

ilGlobalPageTemplate ilDclTableViewEditGUI::$tpl
protected

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

Referenced by __construct().

◆ $ui_factory

Factory ilDclTableViewEditGUI::$ui_factory
private

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

◆ $ui_renderer

Renderer ilDclTableViewEditGUI::$ui_renderer
private

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


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