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

ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI More...

+ Collaboration diagram for ilDclTableListGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj)
 
 getObjId ()
 
 getRefId ()
 
 executeCommand ()
 execute command More...
 
 listTables ()
 
 getDataCollectionObject ()
 

Protected Member Functions

 getItems ()
 
 getActions (ilDclTable $table)
 
 setTabs (string $active)
 
 save ()
 
 checkAccess ()
 

Protected Attributes

ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $renderer
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ilObjDataCollectionGUI $parent_obj
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclTableListGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj)

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

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

40  {
41  global $DIC;
42  $main_tpl = $DIC->ui()->mainTemplate();
43  $this->ctrl = $DIC->ctrl();
44  $this->lng = $DIC->language();
45  $this->tpl = $DIC->ui()->mainTemplate();
46  $this->tabs = $DIC->tabs();
47  $this->toolbar = $DIC->toolbar();
48  $this->http = $DIC->http();
49  $this->refinery = $DIC->refinery();
50  $this->ui_factory = $DIC->ui()->factory();
51  $this->renderer = $DIC->ui()->renderer();
52 
53  $this->tabs->setSetupMode(true);
54  $DIC->help()->setScreenId('dcl_tables');
55 
56  $this->parent_obj = $a_parent_obj;
57 
58  if (!$this->checkAccess()) {
59  $main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
60  $this->ctrl->redirectByClass(ilDclRecordListGUI::class, 'listRecords');
61  }
62  }
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

◆ checkAccess()

ilDclTableListGUI::checkAccess ( )
protected

Definition at line 287 of file class.ilDclTableListGUI.php.

References $ref_id, and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by __construct().

287  : bool
288  {
289  $ref_id = $this->parent_obj->getRefId();
290 
292  }
$ref_id
Definition: ltiauth.php:66
static hasWriteAccess(int $ref, ?int $user_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilDclTableListGUI::executeCommand ( )

execute command

Definition at line 77 of file class.ilDclTableListGUI.php.

References $DIC, $ref_id, ILIAS\Repository\ctrl(), getObjId(), ilDclTableHelper\getRoleTitlesWithoutReadRightOnAnyStandardView(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), setTabs(), and ILIAS\Repository\tabs().

77  : void
78  {
79  global $DIC;
80  $cmd = $this->ctrl->getCmd('listTables');
81 
82  $next_class = $this->ctrl->getNextClass($this);
83 
84  $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
85 
86  $tableHelper = new ilDclTableHelper(
87  $this->getObjId(),
88  $ref_id,
89  $DIC->rbac()->review(),
90  $DIC->user(),
91  $DIC->database()
92  );
93  $role_titles = $tableHelper->getRoleTitlesWithoutReadRightOnAnyStandardView();
94 
95  if (count($role_titles) > 0) {
96  $this->tpl->setOnScreenMessage(
97  'info',
98  $this->lng->txt('dcl_rbac_roles_without_read_access_on_any_standard_view') . " " . implode(
99  ", ",
100  $role_titles
101  )
102  );
103  }
104 
105  switch ($next_class) {
106  case 'ildcltableeditgui':
107  $this->tabs->clearTargets();
108  if ($cmd != 'create') {
109  $this->setTabs('settings');
110  } else {
111  $this->tabs->setBackTarget(
112  $this->lng->txt('back'),
113  $this->ctrl->getLinkTarget($this, 'listTables')
114  );
115  }
116  $ilDclTableEditGUI = new ilDclTableEditGUI($this);
117  $this->ctrl->forwardCommand($ilDclTableEditGUI);
118  break;
119 
120  case 'ildclfieldlistgui':
121  $this->tabs->clearTargets();
122  $this->setTabs('fields');
123  $ilDclFieldListGUI = new ilDclFieldListGUI($this);
124  $this->ctrl->forwardCommand($ilDclFieldListGUI);
125  break;
126 
127  case "ildclfieldeditgui":
128  $this->tabs->clearTargets();
129  $this->setTabs("fields");
130  $ilDclFieldEditGUI = new ilDclFieldEditGUI($this);
131  $this->ctrl->forwardCommand($ilDclFieldEditGUI);
132  break;
133 
134  case 'ildcltableviewgui':
135  $this->tabs->clearTargets();
136  $this->setTabs('tableviews');
137  $ilDclTableViewGUI = new ilDclTableViewGUI($this);
138  $this->ctrl->forwardCommand($ilDclTableViewGUI);
139  break;
140 
141  default:
142  $this->ctrl->clearParameterByClass(ilObjDataCollectionGUI::class, 'table_id');
143  $this->$cmd();
144  }
145  }
ilDclTableViewGUI: ilDclTableViewEditGUI
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:25
+ Here is the call graph for this function:

◆ getActions()

ilDclTableListGUI::getActions ( ilDclTable  $table)
protected
Returns
Shy[]

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

References ILIAS\Repository\ctrl(), ilDclTable\getId(), ilDclTable\getOrder(), and ILIAS\Repository\lng().

Referenced by getItems().

200  : array
201  {
202  $this->ctrl->setParameterByClass(ilObjDataCollectionGUI::class, 'table_id', $table->getId());
203 
204  $actions = [];
205  $actions[] = $this->ui_factory->button()->shy(
206  $this->lng->txt('settings'),
207  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'edit'),
208  );
209 
210  $actions[] = $this->ui_factory->button()->shy(
211  $this->lng->txt('dcl_list_fields'),
212  $this->ctrl->getLinkTargetByClass(ilDclFieldListGUI::class, 'listFields')
213  );
214 
215  $actions[] = $this->ui_factory->button()->shy(
216  $this->lng->txt('dcl_tableviews'),
217  $this->ctrl->getLinkTargetByClass(ilDclTableViewGUI::class, 'show')
218  );
219 
220  $actions[] = $this->ui_factory->button()->shy(
221  $this->lng->txt('delete'),
222  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'confirmDelete')
223  );
224 
225  if ($table->getOrder() !== 10) {
226  $actions[] = $this->ui_factory->button()->shy(
227  $this->lng->txt('set_as_default'),
228  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'setAsDefault')
229  );
230  }
231 
232  return $actions;
233  }
getId()
Get table id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDataCollectionObject()

ilDclTableListGUI::getDataCollectionObject ( )

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

295  {
296  return $this->parent_obj->getDataCollectionObject();
297  }

◆ getItems()

ilDclTableListGUI::getItems ( )
protected

Definition at line 166 of file class.ilDclTableListGUI.php.

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

Referenced by listTables().

166  : array
167  {
168  $items = [];
169  foreach ($this->parent_obj->getDataCollectionObject()->getTables() as $table) {
170 
171  $this->ctrl->setParameterByClass(ilObjDataCollectionGUI::class, 'table_id', $table->getId());
172  $item = $this->ui_factory->item()->standard(
173  $this->ui_factory->link()->standard(
174  $table->getTitle(),
175  $this->ctrl->getLinkTargetByClass(ilDclFieldListGUI::class, 'listFields')
176  )
177  )
178  ->withProperties([
179  $this->lng->txt('visible') => $this->lng->txt($table->getIsVisible() ? 'yes' : 'no'),
180  $this->lng->txt('comments') => $this->lng->txt($table->getPublicCommentsEnabled() ? 'active' : 'inactive')
181  ])
182  ->withActions(
183  $this->ui_factory->dropdown()->standard(
184  $this->getActions($table)
185  )
186  );
187 
188  if ($table->getOrder() === 10) {
189  $item = $item->withDescription($this->lng->txt('default'));
190  }
191  $items[] = $item;
192  }
193  return $items;
194  }
getActions(ilDclTable $table)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjId()

ilDclTableListGUI::getObjId ( )

Definition at line 64 of file class.ilDclTableListGUI.php.

Referenced by ilDclFieldListGUI\__construct(), ilDclFieldEditGUI\__construct(), ilDclTableEditGUI\__construct(), and executeCommand().

64  : int
65  {
66  return $this->parent_obj->getObjectId();
67  }
+ Here is the caller graph for this function:

◆ getRefId()

ilDclTableListGUI::getRefId ( )

Definition at line 69 of file class.ilDclTableListGUI.php.

69  : int
70  {
71  return $this->parent_obj->getRefId();
72  }

◆ listTables()

ilDclTableListGUI::listTables ( )

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

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

147  : void
148  {
149 
150  $add_new = $this->ui_factory->button()->primary(
151  $this->lng->txt("dcl_add_new_table"),
152  $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'create')
153  );
154  $this->toolbar->addStickyItem($add_new);
155 
156  $this->tpl->setContent(
157  $this->renderer->render(
158  $this->ui_factory->panel()->listing()->standard(
159  $this->lng->txt('dcl_tables'),
160  [$this->ui_factory->item()->group('', $this->getItems())]
161  )
162  )
163  );
164  }
+ Here is the call graph for this function:

◆ save()

ilDclTableListGUI::save ( )
protected

Definition at line 256 of file class.ilDclTableListGUI.php.

References $comments, ILIAS\Repository\ctrl(), ilDclCache\getTableCache(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

256  : void
257  {
258  if ($this->http->wrapper()->post()->has("comments")) {
259  $comments = $this->http->wrapper()->post()->retrieve(
260  'comments',
261  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
262  );
263  }
264  if ($this->http->wrapper()->post()->has("visible")) {
265  $visible = $this->http->wrapper()->post()->retrieve(
266  'visible',
267  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
268  );
269  }
270  $orders = $this->http->wrapper()->post()->retrieve(
271  'order',
272  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
273  );
274  asort($orders);
275  $order = 10;
276  foreach (array_keys($orders) as $table_id) {
277  $table = ilDclCache::getTableCache($table_id);
278  $table->setOrder($order);
279  $table->setPublicCommentsEnabled(isset($comments[$table_id]));
280  $table->setIsVisible(isset($visible[$table_id]));
281  $table->doUpdate();
282  $order += 10;
283  }
284  $this->ctrl->redirect($this);
285  }
static http()
Fetches the global http state from ILIAS.
static getTableCache(int $table_id=null)
$comments
+ Here is the call graph for this function:

◆ setTabs()

ilDclTableListGUI::setTabs ( string  $active)
protected

Definition at line 235 of file class.ilDclTableListGUI.php.

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

Referenced by executeCommand().

235  : void
236  {
237  $this->tabs->setBackTarget($this->lng->txt('dcl_tables'), $this->ctrl->getLinkTarget($this, 'listTables'));
238  $this->tabs->addTab(
239  'settings',
240  $this->lng->txt('settings'),
241  $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit')
242  );
243  $this->tabs->addTab(
244  'fields',
245  $this->lng->txt('dcl_list_fields'),
246  $this->ctrl->getLinkTargetByClass('ilDclFieldListGUI', 'listFields')
247  );
248  $this->tabs->addTab(
249  'tableviews',
250  $this->lng->txt('dcl_tableviews'),
251  $this->ctrl->getLinkTargetByClass('ilDclTableViewGUI')
252  );
253  $this->tabs->activateTab($active);
254  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilDclTableListGUI::$ctrl
protected

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

◆ $http

ILIAS HTTP Services ilDclTableListGUI::$http
protected

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

◆ $lng

ilLanguage ilDclTableListGUI::$lng
protected

Definition at line 31 of file class.ilDclTableListGUI.php.

◆ $parent_obj

ilObjDataCollectionGUI ilDclTableListGUI::$parent_obj
protected

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

◆ $refinery

ILIAS Refinery Factory ilDclTableListGUI::$refinery
protected

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

◆ $renderer

ILIAS UI Renderer ilDclTableListGUI::$renderer
protected

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

◆ $tabs

ilTabsGUI ilDclTableListGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilDclTableListGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilDclTableListGUI::$tpl
protected

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

◆ $ui_factory

ILIAS UI Factory ilDclTableListGUI::$ui_factory
protected

Definition at line 28 of file class.ilDclTableListGUI.php.


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