ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 323 of file class.ilDclTableViewEditGUI.php.

323 : void
324 {
325 $this->ctrl->setParameter($this->parent_obj, 'table_id', $this->table->getId());
326 $this->ctrl->redirect($this->parent_obj);
327 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ checkAccess()

ilDclTableViewEditGUI::checkAccess ( string  $cmd)
protected

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

363 : bool
364 {
365 if (in_array($cmd, ['add', 'create', 'cancel'])) {
367 $this->parent_obj->getParentObj()->getDataCollectionObject()->getRefId(),
368 $this->table->getId()
369 );
370 } else {
371 return ilObjDataCollectionAccess::hasAccessTo(
372 $this->parent_obj->getParentObj()->getDataCollectionObject()->getRefId(),
373 $this->table->getId(),
374 $this->tableview->getId()
375 );
376 }
377 }
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 329 of file class.ilDclTableViewEditGUI.php.

329 : void
330 {
331 //at least one view must exist
332 $this->parent_obj->checkViewsLeft(1);
333
334 $conf = new ilConfirmationGUI();
335 $conf->setFormAction($this->ctrl->getFormAction($this));
336 $conf->setHeaderText($this->lng->txt('dcl_tableview_confirm_delete'));
337
338 $conf->addItem('tableview_id', (string) $this->tableview->getId(), $this->tableview->getTitle());
339
340 $conf->setConfirm($this->lng->txt('delete'), 'delete');
341 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
342
343 $this->tpl->setContent($conf->getHTML());
344 }
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 379 of file class.ilDclTableViewEditGUI.php.

379 : void
380 {
381 $new_tableview = new ilDclTableView();
382 $new_tableview->setTableId($this->table->getId());
383 $new_tableview->cloneStructure($this->tableview, []);
384 $this->table->sortTableViews();
385 $this->tpl->setOnScreenMessage('success', $this->lng->txt("dcl_tableview_copy"), true);
386 $this->cancel();
387 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ delete()

ilDclTableViewEditGUI::delete ( )
protected

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

346 : void
347 {
348 $this->tableview->delete();
349 $this->table->sortTableViews();
350 $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableview_deleted'), true);
351 $this->cancel();
352 }

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 }
164 $this->$cmd();
165 break;
166 }
167 break;
168 }
169 }
@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 171 of file class.ilDclTableViewEditGUI.php.

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

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 317 of file class.ilDclTableViewEditGUI.php.

317 : void
318 {
320 $this->table_gui = $table;
321 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ permissionDenied()

ilDclTableViewEditGUI::permissionDenied ( )

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

354 : void
355 {
356 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
357 $this->ctrl->redirectByClass(
358 [ilObjDataCollectionGUI::class, ilDclRecordListGUI::class],
360 );
361 }

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 247 of file class.ilDclTableViewEditGUI.php.

247 : void
248 {
249 $data = $this->initForm()->withRequest($this->http->request())->getData();
250 if ($data !== null) {
251 $this->tableview->setTitle($data['settings']['title']);
252 $this->tableview->setDescription($data['settings']['description']);
253 $this->tableview->setRoleLimitation($data['settings']['role_limitation'] !== null);
254 $this->tableview->setRoles($data['settings']['role_limitation']['roles'] ?? []);
255 if ($create) {
256 $this->tableview->setTableId($this->table->getId());
257 $this->tableview->setOrder($this->table->getNewTableviewOrder());
258 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('dcl_msg_tableview_created'), true);
259 $this->tableview->create();
260 } else {
261 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('dcl_msg_tableview_updated'), true);
262 $this->tableview->update();
263 }
264 }
265 $this->ctrl->redirect($this, 'editGeneralSettings');
266 }

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

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 217 of file class.ilDclTableViewEditGUI.php.

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

References ILIAS\Repository\lng().

Referenced by executeCommand().

+ 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 199 of file class.ilDclTableViewEditGUI.php.

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

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.

◆ $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: