ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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(), renderer(), 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  }
renderer()
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableListGUI::checkAccess ( )
protected

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

References $ref_id, and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by __construct().

268  : bool
269  {
270  $ref_id = $this->parent_obj->getRefId();
271 
273  }
$ref_id
Definition: ltiauth.php:65
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(), 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  switch ($next_class) {
87  case 'ildcltableeditgui':
88  $this->tabs->clearTargets();
89  if ($cmd != 'create') {
90  $this->setTabs('settings');
91  } else {
92  $this->tabs->setBackTarget(
93  $this->lng->txt('back'),
94  $this->ctrl->getLinkTarget($this, 'listTables')
95  );
96  }
97  $ilDclTableEditGUI = new ilDclTableEditGUI($this);
98  $this->ctrl->forwardCommand($ilDclTableEditGUI);
99  break;
100 
101  case 'ildclfieldlistgui':
102  $this->tabs->clearTargets();
103  $this->setTabs('fields');
104  $ilDclFieldListGUI = new ilDclFieldListGUI($this);
105  $this->ctrl->forwardCommand($ilDclFieldListGUI);
106  break;
107 
108  case "ildclfieldeditgui":
109  $this->tabs->clearTargets();
110  $this->setTabs("fields");
111  $ilDclFieldEditGUI = new ilDclFieldEditGUI($this);
112  $this->ctrl->forwardCommand($ilDclFieldEditGUI);
113  break;
114 
115  case 'ildcltableviewgui':
116  $this->tabs->clearTargets();
117  $this->setTabs('tableviews');
118  $ilDclTableViewGUI = new ilDclTableViewGUI($this);
119  $this->ctrl->forwardCommand($ilDclTableViewGUI);
120  break;
121 
122  default:
123  $this->ctrl->clearParameterByClass(ilObjDataCollectionGUI::class, 'table_id');
124  $this->$cmd();
125  }
126  }
ilDclTableViewGUI: ilDclTableViewEditGUI
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

◆ getActions()

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

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

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

Referenced by getItems().

181  : array
182  {
183  $this->ctrl->setParameterByClass(ilObjDataCollectionGUI::class, 'table_id', $table->getId());
184 
185  $actions = [];
186  $actions[] = $this->ui_factory->button()->shy(
187  $this->lng->txt('settings'),
188  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'edit'),
189  );
190 
191  $actions[] = $this->ui_factory->button()->shy(
192  $this->lng->txt('dcl_list_fields'),
193  $this->ctrl->getLinkTargetByClass(ilDclFieldListGUI::class, 'listFields')
194  );
195 
196  $actions[] = $this->ui_factory->button()->shy(
197  $this->lng->txt('dcl_tableviews'),
198  $this->ctrl->getLinkTargetByClass(ilDclTableViewGUI::class, 'show')
199  );
200 
201  $actions[] = $this->ui_factory->button()->shy(
202  $this->lng->txt('delete'),
203  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'confirmDelete')
204  );
205 
206  if ($table->getOrder() !== 10) {
207  $actions[] = $this->ui_factory->button()->shy(
208  $this->lng->txt('set_as_default'),
209  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'setAsDefault')
210  );
211  }
212 
213  return $actions;
214  }
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 275 of file class.ilDclTableListGUI.php.

276  {
277  return $this->parent_obj->getDataCollectionObject();
278  }

◆ getItems()

ilDclTableListGUI::getItems ( )
protected

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

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

Referenced by listTables().

147  : array
148  {
149  $items = [];
150  foreach ($this->parent_obj->getDataCollectionObject()->getTables() as $table) {
151 
152  $this->ctrl->setParameterByClass(ilObjDataCollectionGUI::class, 'table_id', $table->getId());
153  $item = $this->ui_factory->item()->standard(
154  $this->ui_factory->link()->standard(
155  $table->getTitle(),
156  $this->ctrl->getLinkTargetByClass(ilDclFieldListGUI::class, 'listFields')
157  )
158  )
159  ->withProperties([
160  $this->lng->txt('visible') => $this->lng->txt($table->getIsVisible() ? 'yes' : 'no'),
161  $this->lng->txt('comments') => $this->lng->txt($table->getPublicCommentsEnabled() ? 'active' : 'inactive')
162  ])
163  ->withActions(
164  $this->ui_factory->dropdown()->standard(
165  $this->getActions($table)
166  )
167  );
168 
169  if ($table->getOrder() === 10) {
170  $item = $item->withDescription($this->lng->txt('default'));
171  }
172  $items[] = $item;
173  }
174  return $items;
175  }
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(), and ilDclTableEditGUI\__construct().

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 128 of file class.ilDclTableListGUI.php.

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

128  : void
129  {
130 
131  $add_new = $this->ui_factory->button()->primary(
132  $this->lng->txt("dcl_add_new_table"),
133  $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'create')
134  );
135  $this->toolbar->addStickyItem($add_new);
136 
137  $this->tpl->setContent(
138  $this->renderer->render(
139  $this->ui_factory->panel()->listing()->standard(
140  $this->lng->txt('dcl_tables'),
141  [$this->ui_factory->item()->group('', $this->getItems())]
142  )
143  )
144  );
145  }
renderer()
+ Here is the call graph for this function:

◆ save()

ilDclTableListGUI::save ( )
protected

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

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

237  : void
238  {
239  if ($this->http->wrapper()->post()->has("comments")) {
240  $comments = $this->http->wrapper()->post()->retrieve(
241  'comments',
242  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
243  );
244  }
245  if ($this->http->wrapper()->post()->has("visible")) {
246  $visible = $this->http->wrapper()->post()->retrieve(
247  'visible',
248  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
249  );
250  }
251  $orders = $this->http->wrapper()->post()->retrieve(
252  'order',
253  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
254  );
255  asort($orders);
256  $order = 10;
257  foreach (array_keys($orders) as $table_id) {
258  $table = ilDclCache::getTableCache($table_id);
259  $table->setOrder($order);
260  $table->setPublicCommentsEnabled(isset($comments[$table_id]));
261  $table->setIsVisible(isset($visible[$table_id]));
262  $table->doUpdate();
263  $order += 10;
264  }
265  $this->ctrl->redirect($this);
266  }
static http()
Fetches the global http state from ILIAS.
$comments
static getTableCache(?int $table_id=null)
+ Here is the call graph for this function:

◆ setTabs()

ilDclTableListGUI::setTabs ( string  $active)
protected

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

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

Referenced by executeCommand().

216  : void
217  {
218  $this->tabs->setBackTarget($this->lng->txt('dcl_tables'), $this->ctrl->getLinkTarget($this, 'listTables'));
219  $this->tabs->addTab(
220  'settings',
221  $this->lng->txt('settings'),
222  $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit')
223  );
224  $this->tabs->addTab(
225  'fields',
226  $this->lng->txt('dcl_list_fields'),
227  $this->ctrl->getLinkTargetByClass('ilDclFieldListGUI', 'listFields')
228  );
229  $this->tabs->addTab(
230  'tableviews',
231  $this->lng->txt('dcl_tableviews'),
232  $this->ctrl->getLinkTargetByClass('ilDclTableViewGUI')
233  );
234  $this->tabs->activateTab($active);
235  }
+ 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: