ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilDclTableListGUI Class Reference

ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI 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

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
 
int $obj_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclTableListGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj)

ilDclTableListGUI constructor.

Parameters
ilObjDataCollectionGUI$a_parent_obj

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

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

43  {
44  global $DIC;
45  $main_tpl = $DIC->ui()->mainTemplate();
46  $this->ctrl = $DIC->ctrl();
47  $this->lng = $DIC->language();
48  $this->tpl = $DIC->ui()->mainTemplate();
49  $this->tabs = $DIC->tabs();
50  $this->toolbar = $DIC->toolbar();
51  $this->http = $DIC->http();
52  $this->refinery = $DIC->refinery();
53  $this->ui_factory = $DIC->ui()->factory();
54  $this->renderer = $DIC->ui()->renderer();
55 
56  $this->tabs->setSetupMode(true);
57  $DIC->help()->setScreenId('dcl_tables');
58 
59  $this->parent_obj = $a_parent_obj;
60  $this->obj_id = 0;
61  if ($a_parent_obj->getRefId() >= 0) {
62  $this->obj_id = ilObject::_lookupObjectId($a_parent_obj->getRefId());
63  }
64 
65  if (!$this->checkAccess()) {
66  $main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
67  $this->ctrl->redirectByClass(ilDclRecordListGUI::class, 'listRecords');
68  }
69  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
static _lookupObjectId(int $ref_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableListGUI::checkAccess ( )
protected

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

References $ref_id, and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by __construct().

279  : bool
280  {
281  $ref_id = $this->parent_obj->getRefId();
282 
284  }
$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 271 of file class.ilDclTableListGUI.php.

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

Referenced by confirmDeleteTables().

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

◆ confirmDeleteTables()

ilDclTableListGUI::confirmDeleteTables ( )

Definition at line 222 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().

222  : void
223  {
224  //at least one table must exist
225  $has_dcl_table_ids = $this->http->wrapper()->post()->has('dcl_table_ids');
226  if (!$has_dcl_table_ids) {
227  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_delete_tables_no_selection'), true);
228  $this->ctrl->redirect($this, 'listTables');
229  }
230 
231  $tables = $this->http->wrapper()->post()->retrieve(
232  'dcl_table_ids',
233  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
234  );
235  $this->checkTablesLeft(count($tables));
236 
237  $this->tabs->clearSubTabs();
238  $conf = new ilConfirmationGUI();
239  $conf->setFormAction($this->ctrl->getFormAction($this));
240  $conf->setHeaderText($this->lng->txt('dcl_tables_confirm_delete'));
241 
242  foreach ($tables as $table_id) {
243  $conf->addItem('dcl_table_ids[]', (string) $table_id, ilDclCache::getTableCache($table_id)->getTitle());
244  }
245  $conf->setConfirm($this->lng->txt('delete'), 'deleteTables');
246  $conf->setCancel($this->lng->txt('cancel'), 'listTables');
247  $this->tpl->setContent($conf->getHTML());
248  }
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)
+ Here is the call graph for this function:

◆ deleteTables()

ilDclTableListGUI::deleteTables ( )
protected

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

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

250  : void
251  {
252  $has_dcl_table_ids = $this->http->wrapper()->post()->has('dcl_table_ids');
253  if ($has_dcl_table_ids) {
254  $tables = $this->http->wrapper()->post()->retrieve(
255  'dcl_table_ids',
256  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
257  );
258  foreach ($tables as $table_id) {
259  ilDclCache::getTableCache($table_id)->doDelete();
260  }
261  }
262  $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tables_deleted'), true);
263  $this->ctrl->clearParameterByClass("ilobjdatacollectiongui", "table_id");
264  $this->ctrl->redirect($this, 'listTables');
265  }
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 84 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().

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

◆ getDataCollectionObject()

ilDclTableListGUI::getDataCollectionObject ( )

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

Referenced by checkTablesLeft().

287  {
288  return $this->parent_obj->getDataCollectionObject();
289  }
+ Here is the caller graph for this function:

◆ getObjId()

ilDclTableListGUI::getObjId ( )

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

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

71  : int
72  {
73  return $this->parent_obj->getObjectId();
74  }
+ Here is the caller graph for this function:

◆ getRefId()

ilDclTableListGUI::getRefId ( )

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

76  : int
77  {
78  return $this->parent_obj->getRefId();
79  }

◆ listTables()

ilDclTableListGUI::listTables ( )

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

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

158  : void
159  {
160  $add_new = $this->ui_factory->button()->primary(
161  $this->lng->txt("dcl_add_new_table"),
162  $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'create')
163  );
164  $this->toolbar->addStickyItem($add_new);
165 
166  $table_gui = new ilDclTableListTableGUI($this);
167  $this->tpl->setContent($table_gui->getHTML());
168  }
+ Here is the call graph for this function:

◆ save()

ilDclTableListGUI::save ( )
protected

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

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

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

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

Referenced by executeCommand().

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

◆ $http

ILIAS HTTP Services ilDclTableListGUI::$http
protected

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

◆ $lng

ilLanguage ilDclTableListGUI::$lng
protected

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

◆ $obj_id

int ilDclTableListGUI::$obj_id
protected

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

◆ $parent_obj

ilObjDataCollectionGUI ilDclTableListGUI::$parent_obj
protected

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

◆ $refinery

ILIAS Refinery Factory ilDclTableListGUI::$refinery
protected

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

◆ $renderer

ILIAS UI Renderer ilDclTableListGUI::$renderer
protected

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

◆ $tabs

ilTabsGUI ilDclTableListGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilDclTableListGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilDclTableListGUI::$tpl
protected

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

◆ $ui_factory

ILIAS UI Factory ilDclTableListGUI::$ui_factory
protected

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


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