ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilDclTableViewGUI 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 ilDclTableViewGUI:

Public Member Functions

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

Protected Attributes

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

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 @ilCtrl_Calls ilDclTableViewGUI: ilDclTableViewEditGUI

Definition at line 22 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 39 of file class.ilDclTableViewGUI.php.

40 {
41 global $DIC;
42
43 $locator = $DIC['ilLocator'];
44 $this->parent_obj = $a_parent_obj;
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->tpl = $DIC->ui()->mainTemplate();
48 $this->tabs = $DIC->tabs();
49 $this->toolbar = $DIC->toolbar();
50 $this->http = $DIC->http();
51 $this->refinery = $DIC->refinery();
52
53 if ($table_id == 0) {
54 $table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
55 }
56
57 $this->table = ilDclCache::getTableCache($table_id);
58
59 $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
60 $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
61 $this->tpl->setLocator();
62
63 if (!$this->checkAccess()) {
64 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
65 $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
66 }
67 }
static getTableCache(int $table_id=null)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, checkAccess(), ILIAS\Repository\ctrl(), ilDclCache\getTableCache(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), 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 105 of file class.ilDclTableViewGUI.php.

105 : bool
106 {
108 $this->parent_obj->getDataCollectionObject()->getRefId(),
109 $this->table->getId()
110 );
111 }
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 210 of file class.ilDclTableViewGUI.php.

210 : void
211 {
212 if ($delete_count >= count($this->table->getTableViews())) {
213 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_msg_tableviews_delete_all'), true);
214 $this->ctrl->redirect($this, 'show');
215 }
216 }

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

Referenced by confirmDeleteTableviews().

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

158 : void
159 {
160 //at least one view must exist
161 $tableviews = [];
162 $has_dcl_tableview_ids = $this->http->wrapper()->post()->has('dcl_tableview_ids');
163 if (!$has_dcl_tableview_ids) {
164 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_delete_views_no_selection'), true);
165 $this->ctrl->redirect($this, 'show');
166 }
167
168 $tableviews = $this->http->wrapper()->post()->retrieve(
169 'dcl_tableview_ids',
170 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
171 );
172 $this->checkViewsLeft(count($tableviews));
173
174 $this->tabs->clearSubTabs();
175 $conf = new ilConfirmationGUI();
176 $conf->setFormAction($this->ctrl->getFormAction($this));
177 $conf->setHeaderText($this->lng->txt('dcl_tableviews_confirm_delete'));
178
179 foreach ($tableviews as $tableview_id) {
180 $conf->addItem('dcl_tableview_ids[]', $tableview_id, ilDclTableView::find($tableview_id)->getTitle());
181 }
182 $conf->setConfirm($this->lng->txt('delete'), 'deleteTableviews');
183 $conf->setCancel($this->lng->txt('cancel'), 'show');
184 $this->tpl->setContent($conf->getHTML());
185 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkViewsLeft(int $delete_count)
redirects if there are no tableviews left after deletion of {$delete_count} tableviews

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

+ Here is the call graph for this function:

◆ deleteTableviews()

ilDclTableViewGUI::deleteTableviews ( )
protected

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

187 : void
188 {
189 $tableviews = [];
190 $has_dcl_tableview_ids = $this->http->wrapper()->post()->has('dcl_tableview_ids');
191 if ($has_dcl_tableview_ids) {
192 $tableviews = $this->http->wrapper()->post()->retrieve(
193 'dcl_tableview_ids',
194 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
195 );
196 foreach ($tableviews as $tableview_id) {
197 ilDclTableView::find($tableview_id)->delete();
198 }
199 }
200
201 $this->table->sortTableViews();
202 $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableviews_deleted'), true);
203 $this->ctrl->redirect($this, 'show');
204 }

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

+ Here is the call graph for this function:

◆ doTableSwitch()

ilDclTableViewGUI::doTableSwitch ( )

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

145 : void
146 {
147 $this->ctrl->setParameterByClass(
148 "ilDclTableViewGUI",
149 "table_id",
150 $this->http->wrapper()->post()->retrieve('table_id', $this->refinery->kindlyTo()->int())
151 );
152 $this->ctrl->redirectByClass("ilDclTableViewGUI", "show");
153 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilDclTableViewGUI::executeCommand ( )

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

69 : void
70 {
71 $this->ctrl->saveParameter($this, 'table_id');
72 $cmd = $this->ctrl->getCmd("show");
73 $next_class = $this->ctrl->getNextClass($this);
74
75 switch ($next_class) {
76 case 'ildcltablevieweditgui':
77 if ($this->http->wrapper()->query()->has('tableview_id')) {
78 $tableview_id = $this->http->wrapper()->query()->retrieve(
79 'tableview_id',
80 $this->refinery->kindlyTo()->int()
81 );
82 } else {
83 $tableview_id = 0;
84 }
85
86 $edit_gui = new ilDclTableViewEditGUI(
87 $this,
88 $this->table,
90 );
91 $this->ctrl->saveParameter($edit_gui, 'tableview_id');
92 $this->ctrl->forwardCommand($edit_gui);
93 break;
94 default:
95 $this->$cmd();
96 break;
97 }
98 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static findOrGetInstance($primary_key, array $add_constructor_args=array())

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

+ Here is the call graph for this function:

◆ getParentObj()

ilDclTableViewGUI::getParentObj ( )

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

101 {
102 return $this->parent_obj;
103 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilDclTableListGUI $parent_obj

References $parent_obj.

Referenced by show().

+ Here is the caller graph for this function:

◆ saveTableViewOrder()

ilDclTableViewGUI::saveTableViewOrder ( )

invoked by ilDclTableViewTableGUI

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

221 : void
222 {
223 $orders = $this->http->wrapper()->post()->retrieve(
224 'order',
225 $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
226 );
227 asort($orders);
228 $tableviews = array();
229 foreach (array_keys($orders) as $tableview_id) {
230 $tableviews[] = ilDclTableView::find($tableview_id);
231 }
232 $this->table->sortTableViews($tableviews);
233 $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableviews_order_updated'));
234 $this->ctrl->redirect($this);
235 }

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

113 : void
114 {
115 $add_new = ilLinkButton::getInstance();
116 $add_new->setPrimary(true);
117 $add_new->setCaption("dcl_add_new_view");
118 $add_new->setUrl($this->ctrl->getLinkTargetByClass('ilDclTableViewEditGUI', 'add'));
119 $this->toolbar->addStickyItem($add_new);
120
121 $this->toolbar->addSeparator();
122
123 // Show tables
124 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
125
126 foreach ($tables as $table) {
127 $options[$table->getId()] = $table->getTitle();
128 }
129 $table_selection = new ilSelectInputGUI('', 'table_id');
130 $table_selection->setOptions($options);
131 $table_selection->setValue($this->table->getId());
132
133 $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclTableViewGUI", "doTableSwitch"));
134 $this->toolbar->addText($this->lng->txt("dcl_select"));
135 $this->toolbar->addInputItem($table_selection);
136 $button = ilSubmitButton::getInstance();
137 $button->setCommand("doTableSwitch");
138 $button->setCaption('change');
139 $this->toolbar->addButtonInstance($button);
140
141 $table_gui = new ilDclTableViewTableGUI($this, 'show', $this->table, $this->getParentObj()->getRefId());
142 $this->tpl->setContent($table_gui->getHTML());
143 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getId()
Get table id.
This class represents a selection list property in a property form.

References $table, ILIAS\Repository\ctrl(), ilDclTable\getId(), ilLinkButton\getInstance(), ilSubmitButton\getInstance(), getParentObj(), ilDclTable\getTitle(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilDclTableViewGUI::$ctrl
protected

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

◆ $http

ILIAS HTTP Services ilDclTableViewGUI::$http
protected

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

◆ $lng

ilLanguage ilDclTableViewGUI::$lng
protected

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

◆ $parent_obj

ilDclTableListGUI ilDclTableViewGUI::$parent_obj
protected

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

Referenced by getParentObj().

◆ $refinery

ILIAS Refinery Factory ilDclTableViewGUI::$refinery
protected

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

◆ $table

ilDclTable ilDclTableViewGUI::$table
protected

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

Referenced by show().

◆ $tabs

ilTabsGUI ilDclTableViewGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilDclTableViewGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilDclTableViewGUI::$tpl
protected

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


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