ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDclTableViewGUI Class Reference

ilDclTableViewGUI: ilDclTableViewEditGUI More...

+ Collaboration diagram for ilDclTableViewGUI:

Public Member Functions

 __construct (ilDclTableListGUI $a_parent_obj, int $table_id=0)
 Constructor. More...
 
 executeCommand ()
 
 getParentObj ()
 
 show ()
 
 confirmDeleteTableviews ()
 Confirm deletion of multiple fields. More...
 
 checkViewsLeft (int $delete_count)
 redirects if there are no tableviews left after deletion of {$delete_count} tableviews More...
 
 saveTableViewOrder ()
 invoked by ilDclTableViewTableGUI More...
 

Protected Member Functions

 checkAccess ()
 
 getItems ()
 
 getActions (ilDclTableView $tableview)
 
 deleteTableviews ()
 

Protected Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclTableViewGUI::__construct ( ilDclTableListGUI  $a_parent_obj,
int  $table_id = 0 
)

Constructor.

Parameters
ilDclTableListGUI$a_parent_obj
int$table_id

Definition at line 45 of file class.ilDclTableViewGUI.php.

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

46  {
47  global $DIC;
48 
49  $locator = $DIC['ilLocator'];
50  $this->parent_obj = $a_parent_obj;
51  $this->ctrl = $DIC->ctrl();
52  $this->lng = $DIC->language();
53  $this->tpl = $DIC->ui()->mainTemplate();
54  $this->tabs = $DIC->tabs();
55  $this->toolbar = $DIC->toolbar();
56  $this->http = $DIC->http();
57  $this->refinery = $DIC->refinery();
58  $this->ui_factory = $DIC->ui()->factory();
59  $this->renderer = $DIC->ui()->renderer();
60 
61  $DIC->help()->setScreenId('dcl_views');
62 
63  if ($table_id == 0) {
64  $table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
65  }
66 
67  $this->table = ilDclCache::getTableCache($table_id);
68 
69  $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
70  $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
71  $this->tpl->setLocator();
72 
73  if (!$this->checkAccess()) {
74  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
75  $this->ctrl->redirectByClass(ilDclRecordListGUI::class, 'listRecords');
76  }
77  }
renderer()
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
static getTableCache(?int $table_id=null)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableViewGUI::checkAccess ( )
protected

Definition at line 115 of file class.ilDclTableViewGUI.php.

References ilObjDataCollectionAccess\hasAccessToEditTable().

Referenced by __construct().

115  : bool
116  {
118  $this->parent_obj->getDataCollectionObject()->getRefId(),
119  $this->table->getId()
120  );
121  }
static hasAccessToEditTable(int $ref_id, int $table_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkViewsLeft()

ilDclTableViewGUI::checkViewsLeft ( 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 246 of file class.ilDclTableViewGUI.php.

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

Referenced by confirmDeleteTableviews().

246  : void
247  {
248  if ($delete_count >= count($this->table->getTableViews())) {
249  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_msg_tableviews_delete_all'), true);
250  $this->ctrl->redirect($this, 'show');
251  }
252  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteTableviews()

ilDclTableViewGUI::confirmDeleteTableviews ( )

Confirm deletion of multiple fields.

Definition at line 196 of file class.ilDclTableViewGUI.php.

References checkViewsLeft(), ILIAS\Repository\ctrl(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

196  : void
197  {
198  //at least one view must exist
199  $has_dcl_tableview_ids = $this->http->wrapper()->post()->has('dcl_tableview_ids');
200  if (!$has_dcl_tableview_ids) {
201  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_delete_views_no_selection'), true);
202  $this->ctrl->redirect($this, 'show');
203  }
204 
205  $tableviews = $this->http->wrapper()->post()->retrieve(
206  'dcl_tableview_ids',
207  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
208  );
209  $this->checkViewsLeft(count($tableviews));
210 
211  $this->tabs->clearSubTabs();
212  $conf = new ilConfirmationGUI();
213  $conf->setFormAction($this->ctrl->getFormAction($this));
214  $conf->setHeaderText($this->lng->txt('dcl_tableviews_confirm_delete'));
215 
216  foreach ($tableviews as $tableview_id) {
217  $conf->addItem('dcl_tableview_ids[]', (string) $tableview_id, ilDclTableView::find($tableview_id)->getTitle());
218  }
219  $conf->setConfirm($this->lng->txt('delete'), 'deleteTableviews');
220  $conf->setCancel($this->lng->txt('cancel'), 'show');
221  $this->tpl->setContent($conf->getHTML());
222  }
checkViewsLeft(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.
+ Here is the call graph for this function:

◆ deleteTableviews()

ilDclTableViewGUI::deleteTableviews ( )
protected

Definition at line 224 of file class.ilDclTableViewGUI.php.

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

224  : void
225  {
226  $has_dcl_tableview_ids = $this->http->wrapper()->post()->has('dcl_tableview_ids');
227  if ($has_dcl_tableview_ids) {
228  $tableviews = $this->http->wrapper()->post()->retrieve(
229  'dcl_tableview_ids',
230  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
231  );
232  foreach ($tableviews as $tableview_id) {
233  ilDclTableView::find($tableview_id)->delete();
234  }
235  }
236 
237  $this->table->sortTableViews();
238  $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableviews_deleted'), true);
239  $this->ctrl->redirect($this, 'show');
240  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableViewGUI::executeCommand ( )

Definition at line 79 of file class.ilDclTableViewGUI.php.

References ILIAS\Repository\ctrl(), ilDclTableView\findOrGetInstance(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

79  : void
80  {
81  $this->ctrl->saveParameter($this, 'table_id');
82  $cmd = $this->ctrl->getCmd("show");
83  $next_class = $this->ctrl->getNextClass($this);
84 
85  switch ($next_class) {
86  case strtolower(ilDclTableViewEditGUI::class):
87  if ($this->http->wrapper()->query()->has('tableview_id')) {
88  $tableview_id = $this->http->wrapper()->query()->retrieve(
89  'tableview_id',
90  $this->refinery->kindlyTo()->int()
91  );
92  } else {
93  $tableview_id = 0;
94  }
95 
96  $edit_gui = new ilDclTableViewEditGUI(
97  $this,
98  $this->table,
100  );
101  $this->ctrl->saveParameter($edit_gui, 'tableview_id');
102  $this->ctrl->forwardCommand($edit_gui);
103  break;
104  default:
105  $this->$cmd();
106  break;
107  }
108  }
ilDclTableViewEditGUI: ilDclDetailedViewDefinitionGUI ilDclTableViewEditGUI: ilDclCreateViewDefiniti...
static findOrGetInstance($primary_key, array $add_constructor_args=[])
if(!file_exists('../ilias.ini.php'))
has(string $class_name)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getActions()

ilDclTableViewGUI::getActions ( ilDclTableView  $tableview)
protected
Returns
Shy[]

Definition at line 173 of file class.ilDclTableViewGUI.php.

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

Referenced by getItems().

173  : array
174  {
175  $this->ctrl->setParameterByClass(ilDclTableViewEditGUI::class, 'tableview_id', $tableview->getId());
176 
177  $actions = [];
178  $actions[] = $this->ui_factory->button()->shy(
179  $this->lng->txt('edit'),
180  $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'editGeneralSettings')
181  );
182  $actions[] = $this->ui_factory->button()->shy(
183  $this->lng->txt('copy'),
184  $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'copy')
185  );
186  $actions[] = $this->ui_factory->button()->shy(
187  $this->lng->txt('delete'),
188  $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'confirmDelete')
189  );
190  return $actions;
191  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilDclTableViewGUI::getItems ( )
protected

Definition at line 150 of file class.ilDclTableViewGUI.php.

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

Referenced by show().

150  : array
151  {
152  $items = [];
153  foreach ($this->table->getTableViews() as $tableview) {
154 
155  $this->ctrl->setParameterByClass(ilDclTableViewEditGUI::class, 'tableview_id', $tableview->getId());
156  $item = $this->ui_factory->item()->standard(
157  $this->ui_factory->link()->standard(
158  $tableview->getTitle(),
159  $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'show')
160  )
161  )
162  ->withDescription($tableview->getDescription())
163  ->withActions($this->ui_factory->dropdown()->standard($this->getActions($tableview)));
164 
165  $items[] = $item;
166  }
167  return $items;
168  }
getActions(ilDclTableView $tableview)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentObj()

ilDclTableViewGUI::getParentObj ( )

Definition at line 110 of file class.ilDclTableViewGUI.php.

References $parent_obj.

111  {
112  return $this->parent_obj;
113  }
ilDclTableListGUI $parent_obj
ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI ...

◆ saveTableViewOrder()

ilDclTableViewGUI::saveTableViewOrder ( )

invoked by ilDclTableViewTableGUI

Definition at line 257 of file class.ilDclTableViewGUI.php.

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

257  : void
258  {
259  $orders = $this->http->wrapper()->post()->retrieve(
260  'order',
261  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
262  );
263  asort($orders);
264  $tableviews = [];
265  foreach (array_keys($orders) as $tableview_id) {
266  $tableviews[] = ilDclTableView::find($tableview_id);
267  }
268  $this->table->sortTableViews($tableviews);
269  $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableviews_order_updated'));
270  $this->ctrl->redirect($this);
271  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ show()

ilDclTableViewGUI::show ( )

Definition at line 123 of file class.ilDclTableViewGUI.php.

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

123  : void
124  {
125  $add_new = $this->ui_factory->button()->primary(
126  $this->lng->txt("dcl_add_new_view"),
127  $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'add')
128  );
129  $this->toolbar->addStickyItem($add_new);
130 
131  $this->toolbar->addSeparator();
132 
133  $switcher = new ilDclSwitcher($this->toolbar, $this->ui_factory, $this->ctrl, $this->lng);
134  $switcher->addTableSwitcherToToolbar(
135  $this->parent_obj->getDataCollectionObject()->getTables(),
136  self::class,
137  'show'
138  );
139 
140  $this->tpl->setContent(
141  $this->renderer->render(
142  $this->ui_factory->panel()->listing()->standard(
143  sprintf($this->lng->txt('dcl_tableviews_of_X'), $this->table->getTitle()),
144  [$this->ui_factory->item()->group('', $this->getItems())]
145  )
146  )
147  );
148  }
renderer()
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilDclTableViewGUI::$ctrl
protected

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

◆ $http

ILIAS HTTP Services ilDclTableViewGUI::$http
protected

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

◆ $lng

ilLanguage ilDclTableViewGUI::$lng
protected

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

◆ $parent_obj

ilDclTableListGUI ilDclTableViewGUI::$parent_obj
protected

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

Referenced by getParentObj().

◆ $refinery

ILIAS Refinery Factory ilDclTableViewGUI::$refinery
protected

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

◆ $renderer

ILIAS UI Renderer ilDclTableViewGUI::$renderer
protected

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

◆ $table

ilDclTable ilDclTableViewGUI::$table
protected

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

◆ $tabs

ilTabsGUI ilDclTableViewGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilDclTableViewGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilDclTableViewGUI::$tpl
protected

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

◆ $ui_factory

ILIAS UI Factory ilDclTableViewGUI::$ui_factory
protected

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


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