ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDclTableViewGUI Class Reference

@ilCtrl_Calls ilDclTableViewGUI: ilDclTableViewEditGUI More...

+ Collaboration diagram for ilDclTableViewGUI:

Public Member Functions

 __construct (ilDclTableListGUI $a_parent_obj, int $table_id=0)
 Constructor. More...
 
 executeCommand ()
 
 getParentObj ()
 
 show ()
 
 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)
 

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

@ilCtrl_Calls ilDclTableViewGUI: ilDclTableViewEditGUI

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

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.

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 $this->table->getCollectionObject()->setRefId(
69 $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int())
70 );
71
72 $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
73 $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
74 $this->tpl->setLocator();
75
76 if (!$this->checkAccess()) {
77 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
78 $this->ctrl->redirectByClass(ilDclRecordListGUI::class, 'listRecords');
79 }
80 }
renderer()
static getTableCache(?int $table_id=null)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

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().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableViewGUI::checkAccess ( )
protected

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

118 : bool
119 {
121 $this->parent_obj->getDataCollectionObject()->getRefId(),
122 $this->table->getId()
123 );
124 }
static hasAccessToEditTable(int $ref_id, int $table_id)

References ilObjDataCollectionAccess\hasAccessToEditTable().

Referenced by __construct().

+ 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 200 of file class.ilDclTableViewGUI.php.

200 : void
201 {
202 if ($delete_count >= count($this->table->getTableViews())) {
203 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_msg_tableviews_delete_all'), true);
204 $this->ctrl->redirect($this, 'show');
205 }
206 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableViewGUI::executeCommand ( )

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

82 : void
83 {
84 $this->ctrl->saveParameter($this, 'table_id');
85 $cmd = $this->ctrl->getCmd("show");
86 $next_class = $this->ctrl->getNextClass($this);
87
88 switch ($next_class) {
89 case strtolower(ilDclTableViewEditGUI::class):
90 if ($this->http->wrapper()->query()->has('tableview_id')) {
91 $tableview_id = $this->http->wrapper()->query()->retrieve(
92 'tableview_id',
93 $this->refinery->kindlyTo()->int()
94 );
95 } else {
96 $tableview_id = 0;
97 }
98
99 $edit_gui = new ilDclTableViewEditGUI(
100 $this,
101 $this->table,
103 );
104 $this->ctrl->saveParameter($edit_gui, 'tableview_id');
105 $this->ctrl->forwardCommand($edit_gui);
106 break;
107 default:
108 $this->$cmd();
109 break;
110 }
111 }
@ilCtrl_Calls ilDclTableViewEditGUI: ilDclDetailedViewDefinitionGUI @ilCtrl_Calls ilDclTableViewEditG...
static findOrGetInstance($primary_key, array $add_constructor_args=[])
has(string $class_name)
if(!file_exists('../ilias.ini.php'))

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

+ Here is the call graph for this function:

◆ getActions()

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

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

176 : array
177 {
178 $this->ctrl->setParameterByClass(ilDclTableViewEditGUI::class, 'tableview_id', $tableview->getId());
179
180 $actions = [];
181 $actions[] = $this->ui_factory->button()->shy(
182 $this->lng->txt('edit'),
183 $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'editGeneralSettings')
184 );
185 $actions[] = $this->ui_factory->button()->shy(
186 $this->lng->txt('copy'),
187 $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'copy')
188 );
189 $actions[] = $this->ui_factory->button()->shy(
190 $this->lng->txt('delete'),
191 $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'confirmDelete')
192 );
193 return $actions;
194 }

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

+ Here is the call graph for this function:

◆ getItems()

ilDclTableViewGUI::getItems ( )
protected

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

153 : array
154 {
155 $items = [];
156 foreach ($this->table->getTableViews() as $tableview) {
157
158 $this->ctrl->setParameterByClass(ilDclTableViewEditGUI::class, 'tableview_id', $tableview->getId());
159 $item = $this->ui_factory->item()->standard(
160 $this->ui_factory->link()->standard(
161 $tableview->getTitle(),
162 $this->ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class, 'show')
163 )
164 )
165 ->withDescription($tableview->getDescription())
166 ->withActions($this->ui_factory->dropdown()->standard($this->getActions($tableview)));
167
168 $items[] = $item;
169 }
170 return $items;
171 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getParentObj()

ilDclTableViewGUI::getParentObj ( )

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

114 {
115 return $this->parent_obj;
116 }
@ilCtrl_Calls ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI,...
ilDclTableListGUI $parent_obj

References $parent_obj.

◆ saveTableViewOrder()

ilDclTableViewGUI::saveTableViewOrder ( )

invoked by ilDclTableViewTableGUI

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

211 : void
212 {
213 $orders = $this->http->wrapper()->post()->retrieve(
214 'order',
215 $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
216 );
217 asort($orders);
218 $tableviews = [];
219 foreach (array_keys($orders) as $tableview_id) {
220 $tableviews[] = ilDclTableView::find($tableview_id);
221 }
222 $this->table->sortTableViews($tableviews);
223 $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableviews_order_updated'));
224 $this->ctrl->redirect($this);
225 }

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

+ Here is the call graph for this function:

◆ show()

ilDclTableViewGUI::show ( )

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

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

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

+ 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: