ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDclTableListGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilDclTableListGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj)
 ilDclTableListGUI constructor. More...
 
 getObjId ()
 
 getRefId ()
 
 executeCommand ()
 execute command More...
 
 listTables ()
 
 confirmDeleteTables ()
 
 checkTablesLeft (int $delete_count)
 redirects if there are no tableviews left after deletion of {$delete_count} tableviews More...
 
 getDataCollectionObject ()
 

Protected Member Functions

 setTabs (string $active)
 
 save ()
 
 deleteTables ()
 
 checkAccess ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalPageTemplate $tpl
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ilObjDataCollectionGUI $parent_obj
 
int $obj_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilDclTableListGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj)

ilDclTableListGUI constructor.

Parameters
ilObjDataCollectionGUI$a_parent_obj

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

References $DIC, $lng, $tpl, ilObject\_lookupObjectId(), checkAccess(), ILIAS\Repository\ctrl(), ilObjectGUI\getRefId(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

39  {
40  global $DIC;
41  $main_tpl = $DIC->ui()->mainTemplate();
42  $ilCtrl = $DIC['ilCtrl'];
43  $lng = $DIC['lng'];
44  $tpl = $DIC['tpl'];
45  $ilTabs = $DIC['ilTabs'];
46  $ilToolbar = $DIC['ilToolbar'];
47 
48  $this->parent_obj = $a_parent_obj;
49  $this->obj_id = 0;
50  if ($a_parent_obj->getRefId() >= 0) {
51  $this->obj_id = ilObject::_lookupObjectId($a_parent_obj->getRefId());
52  }
53 
54  $this->ctrl = $ilCtrl;
55  $this->lng = $lng;
56  $this->tpl = $tpl;
57  $this->tabs = $ilTabs;
58  $this->toolbar = $ilToolbar;
59  $this->http = $DIC->http();
60  $this->refinery = $DIC->refinery();
61 
62  if (!$this->checkAccess()) {
63  $main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
64  $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
65  }
66  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
static _lookupObjectId(int $ref_id)
ilGlobalPageTemplate $tpl
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableListGUI::checkAccess ( )
protected

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

References $ref_id, and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by __construct().

276  : bool
277  {
278  $ref_id = $this->parent_obj->getRefId();
279 
281  }
$ref_id
Definition: ltiauth.php:67
static hasWriteAccess(int $ref, ?int $user_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTablesLeft()

ilDclTableListGUI::checkTablesLeft ( int  $delete_count)

redirects if there are no tableviews left after deletion of {$delete_count} tableviews

Parameters
$delete_countnumber of tableviews to delete

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

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

Referenced by confirmDeleteTables().

268  : void
269  {
270  if ($delete_count >= count($this->getDataCollectionObject()->getTables())) {
271  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_msg_tables_delete_all'), true);
272  $this->ctrl->redirect($this, 'listTables');
273  }
274  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteTables()

ilDclTableListGUI::confirmDeleteTables ( )

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

References checkTablesLeft(), ILIAS\Repository\ctrl(), ilDclCache\getTableCache(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

218  : void
219  {
220  //at least one table must exist
221  $tables = [];
222  $has_dcl_table_ids = $this->http->wrapper()->post()->has('dcl_table_ids');
223  if (!$has_dcl_table_ids) {
224  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_delete_tables_no_selection'), true);
225  $this->ctrl->redirect($this, 'listTables');
226  }
227 
228  $tables = $this->http->wrapper()->post()->retrieve(
229  'dcl_table_ids',
230  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
231  );
232  $this->checkTablesLeft(count($tables));
233 
234  $this->tabs->clearSubTabs();
235  $conf = new ilConfirmationGUI();
236  $conf->setFormAction($this->ctrl->getFormAction($this));
237  $conf->setHeaderText($this->lng->txt('dcl_tables_confirm_delete'));
238 
239  foreach ($tables as $table_id) {
240  $conf->addItem('dcl_table_ids[]', $table_id, ilDclCache::getTableCache($table_id)->getTitle());
241  }
242  $conf->setConfirm($this->lng->txt('delete'), 'deleteTables');
243  $conf->setCancel($this->lng->txt('cancel'), 'listTables');
244  $this->tpl->setContent($conf->getHTML());
245  }
checkTablesLeft(int $delete_count)
redirects if there are no tableviews left after deletion of {$delete_count} tableviews ...
static http()
Fetches the global http state from ILIAS.
static getTableCache(int $table_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ deleteTables()

ilDclTableListGUI::deleteTables ( )
protected

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

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

247  : void
248  {
249  $has_dcl_table_ids = $this->http->wrapper()->post()->has('dcl_table_ids');
250  if ($has_dcl_table_ids) {
251  $tables = $this->http->wrapper()->post()->retrieve(
252  'dcl_table_ids',
253  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
254  );
255  foreach ($tables as $table_id) {
256  ilDclCache::getTableCache($table_id)->doDelete();
257  }
258  }
259  $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tables_deleted'), true);
260  $this->ctrl->clearParameterByClass("ilobjdatacollectiongui", "table_id");
261  $this->ctrl->redirect($this, 'listTables');
262  }
static http()
Fetches the global http state from ILIAS.
static getTableCache(int $table_id=null)
+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableListGUI::executeCommand ( )

execute command

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

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

81  : void
82  {
83  global $DIC;
84  $cmd = $this->ctrl->getCmd('listTables');
85 
86  $next_class = $this->ctrl->getNextClass($this);
87 
88  /*
89  * see https://www.ilias.de/mantis/view.php?id=22775
90  */
91  $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
92 
93  $tableHelper = new ilDclTableHelper(
94  $this->obj_id,
95  $ref_id,
96  $DIC->rbac()->review(),
97  $DIC->user(),
98  $DIC->database()
99  );
100  // send a warning if there are roles with rbac read access on the data collection but without read access on any standard view
101  $role_titles = $tableHelper->getRoleTitlesWithoutReadRightOnAnyStandardView();
102 
103  if (count($role_titles) > 0) {
104  $this->tpl->setOnScreenMessage(
105  'info',
106  $DIC->language()->txt('dcl_rbac_roles_without_read_access_on_any_standard_view') . " " . implode(
107  ", ",
108  $role_titles
109  )
110  );
111  }
112 
113  switch ($next_class) {
114  case 'ildcltableeditgui':
115  $this->tabs->clearTargets();
116  if ($cmd != 'create') {
117  $this->setTabs('settings');
118  } else {
119  $this->tabs->setBackTarget(
120  $this->lng->txt('back'),
121  $this->ctrl->getLinkTarget($this, 'listTables')
122  );
123  }
124  $ilDclTableEditGUI = new ilDclTableEditGUI($this);
125  $this->ctrl->forwardCommand($ilDclTableEditGUI);
126  break;
127 
128  case 'ildclfieldlistgui':
129  $this->tabs->clearTargets();
130  $this->setTabs('fields');
131  $ilDclFieldListGUI = new ilDclFieldListGUI($this);
132  $this->ctrl->forwardCommand($ilDclFieldListGUI);
133  break;
134 
135  case "ildclfieldeditgui":
136  $this->tabs->clearTargets();
137  $this->setTabs("fields");
138  $ilDclFieldEditGUI = new ilDclFieldEditGUI($this);
139  $this->ctrl->forwardCommand($ilDclFieldEditGUI);
140  break;
141 
142  case 'ildcltableviewgui':
143  $this->tabs->clearTargets();
144  $this->setTabs('tableviews');
145  $ilDclTableViewGUI = new ilDclTableViewGUI($this);
146  $this->ctrl->forwardCommand($ilDclTableViewGUI);
147  break;
148 
149  default:
150  $this->$cmd();
151  }
152  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:67
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getDataCollectionObject()

ilDclTableListGUI::getDataCollectionObject ( )

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

Referenced by checkTablesLeft().

284  {
285  return $this->parent_obj->getDataCollectionObject();
286  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getObjId()

ilDclTableListGUI::getObjId ( )

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

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

68  : int
69  {
70  return $this->parent_obj->getObjectId();
71  }
+ Here is the caller graph for this function:

◆ getRefId()

ilDclTableListGUI::getRefId ( )

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

73  : int
74  {
75  return $this->parent_obj->getRefId();
76  }

◆ listTables()

ilDclTableListGUI::listTables ( )

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

References ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), and ILIAS\Repository\toolbar().

154  : void
155  {
156  $add_new = ilLinkButton::getInstance();
157  $add_new->setPrimary(true);
158  $add_new->setCaption("dcl_add_new_table");
159  $add_new->setUrl($this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'create'));
160  $this->toolbar->addStickyItem($add_new);
161 
162  $table_gui = new ilDclTableListTableGUI($this);
163  $this->tpl->setContent($table_gui->getHTML());
164  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ save()

ilDclTableListGUI::save ( )
protected

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

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

187  : void
188  {
189  if ($this->http->wrapper()->post()->has("comments")) {
190  $comments = $this->http->wrapper()->post()->retrieve(
191  'comments',
192  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
193  );
194  }
195  if ($this->http->wrapper()->post()->has("visible")) {
196  $visible = $this->http->wrapper()->post()->retrieve(
197  'visible',
198  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
199  );
200  }
201  $orders = $this->http->wrapper()->post()->retrieve(
202  'order',
203  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
204  );
205  asort($orders);
206  $order = 10;
207  foreach (array_keys($orders) as $table_id) {
208  $table = ilDclCache::getTableCache($table_id);
209  $table->setOrder($order);
210  $table->setPublicCommentsEnabled(isset($comments[$table_id]));
211  $table->setIsVisible(isset($visible[$table_id]));
212  $table->doUpdate();
213  $order += 10;
214  }
215  $this->ctrl->redirect($this);
216  }
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 166 of file class.ilDclTableListGUI.php.

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

Referenced by executeCommand().

166  : void
167  {
168  $this->tabs->setBackTarget($this->lng->txt('dcl_tables'), $this->ctrl->getLinkTarget($this, 'listTables'));
169  $this->tabs->addTab(
170  'settings',
171  $this->lng->txt('settings'),
172  $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit')
173  );
174  $this->tabs->addTab(
175  'fields',
176  $this->lng->txt('dcl_list_fields'),
177  $this->ctrl->getLinkTargetByClass('ilDclFieldListGUI', 'listFields')
178  );
179  $this->tabs->addTab(
180  'tableviews',
181  $this->lng->txt('dcl_tableviews'),
182  $this->ctrl->getLinkTargetByClass('ilDclTableViewGUI')
183  );
184  $this->tabs->activateTab($active);
185  }
+ 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 24 of file class.ilDclTableListGUI.php.

◆ $http

ILIAS HTTP Services ilDclTableListGUI::$http
protected

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

◆ $lng

ilLanguage ilDclTableListGUI::$lng
protected

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

Referenced by __construct().

◆ $obj_id

int ilDclTableListGUI::$obj_id
protected

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

◆ $parent_obj

ilObjDataCollectionGUI ilDclTableListGUI::$parent_obj
protected

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

◆ $refinery

ILIAS Refinery Factory ilDclTableListGUI::$refinery
protected

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

◆ $tabs

ilTabsGUI ilDclTableListGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilDclTableListGUI::$toolbar
protected

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

◆ $tpl

ilGlobalPageTemplate ilDclTableListGUI::$tpl
protected

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

Referenced by __construct().


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