ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDclFieldListGUI 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 ilDclFieldListGUI:

Public Member Functions

 __construct (ilDclTableListGUI $a_parent_obj)
 Constructor. More...
 
 getTableId ()
 
 executeCommand ()
 execute command More...
 
 deleteFields ()
 Delete multiple fields. More...
 
 save ()
 
 listFields ()
 list fields More...
 
 doTableSwitch ()
 
 getDataCollectionObject ()
 

Protected Member Functions

 checkAccess ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilToolbarGUI $toolbar
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
int $table_id
 
ilDclTableListGUI $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

Definition at line 19 of file class.ilDclFieldListGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDclFieldListGUI::__construct ( ilDclTableListGUI  $a_parent_obj)

Constructor.

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

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

36  {
37  global $DIC;
38 
39  $this->http = $DIC->http();
40  $this->refinery = $DIC->refinery();
41  $this->table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
42  $locator = $DIC['ilLocator'];
43  $this->parent_obj = $a_parent_obj;
44  $this->obj_id = $a_parent_obj->getObjId();
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 
51  $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
52  $locator->addItem(
53  ilDclCache::getTableCache($this->table_id)->getTitle(),
54  $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit')
55  );
56  $this->tpl->setLocator();
57 
58  if (!$this->checkAccess()) {
59  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
60  $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
61  }
62  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
static getTableCache(int $table_id=null)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclFieldListGUI::checkAccess ( )
protected

Definition at line 215 of file class.ilDclFieldListGUI.php.

References $ref_id, getDataCollectionObject(), and ilObjDataCollectionAccess\hasAccessToEditTable().

Referenced by __construct().

215  : bool
216  {
217  $ref_id = $this->getDataCollectionObject()->getRefId();
218 
220  }
$ref_id
Definition: ltiauth.php:67
static hasAccessToEditTable(int $ref_id, int $table_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFields()

ilDclFieldListGUI::deleteFields ( )

Delete multiple fields.

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

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

81  : void
82  {
83  if ($this->http->wrapper()->post()->has('dcl_field_ids')) {
84  $field_ids = $this->http->wrapper()->post()->retrieve(
85  'dcl_field_ids',
86  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
87  );
88  $table = ilDclCache::getTableCache($this->table_id);
89  foreach ($field_ids as $field_id) {
90  $table->deleteField($field_id);
91  }
92  }
93 
94  $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_fields_deleted'), true);
95  $this->ctrl->redirect($this, 'listFields');
96  }
static http()
Fetches the global http state from ILIAS.
static getTableCache(int $table_id=null)
+ Here is the call graph for this function:

◆ doTableSwitch()

ilDclFieldListGUI::doTableSwitch ( )

Definition at line 208 of file class.ilDclFieldListGUI.php.

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

208  : void
209  {
210  $table_id = $this->http->wrapper()->post()->retrieve('table_id', $this->refinery->kindlyTo()->int());
211  $this->ctrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $table_id);
212  $this->ctrl->redirectByClass("ilDclFieldListGUI", "listFields");
213  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ executeCommand()

ilDclFieldListGUI::executeCommand ( )

execute command

Definition at line 72 of file class.ilDclFieldListGUI.php.

References ILIAS\Repository\ctrl().

72  : void
73  {
74  $cmd = $this->ctrl->getCmd('listFields');
75  $this->$cmd();
76  }
+ Here is the call graph for this function:

◆ getDataCollectionObject()

ilDclFieldListGUI::getDataCollectionObject ( )

Definition at line 222 of file class.ilDclFieldListGUI.php.

Referenced by checkAccess().

223  {
224  return $this->parent_obj->getDataCollectionObject();
225  }
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:

◆ getTableId()

ilDclFieldListGUI::getTableId ( )

Definition at line 64 of file class.ilDclFieldListGUI.php.

References $table_id.

64  : int
65  {
66  return $this->table_id;
67  }

◆ listFields()

ilDclFieldListGUI::listFields ( )

list fields

Definition at line 174 of file class.ilDclFieldListGUI.php.

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

Referenced by save().

174  : void
175  {
176  //add button
177  $add_new = ilLinkButton::getInstance();
178  $add_new->setPrimary(true);
179  $add_new->setCaption("dcl_add_new_field");
180  $add_new->setUrl($this->ctrl->getLinkTargetByClass('ildclfieldeditgui', 'create'));
181  $this->toolbar->addStickyItem($add_new);
182 
183  $this->toolbar->addSeparator();
184 
185  // Show tableswitcher
186  $tables = $this->parent_obj->getDataCollectionObject()->getTables();
187 
188  foreach ($tables as $table) {
189  $options[$table->getId()] = $table->getTitle();
190  }
191  $table_selection = new ilSelectInputGUI('', 'table_id');
192  $table_selection->setOptions($options);
193  $table_selection->setValue($this->table_id);
194 
195  $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclFieldListGUI", "doTableSwitch"));
196  $this->toolbar->addText($this->lng->txt("dcl_select"));
197  $this->toolbar->addInputItem($table_selection);
198  $this->toolbar->addFormButton($this->lng->txt('change'), 'doTableSwitch');
199 
200  //table gui
201  $list = new ilDclFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
202  $this->tpl->setContent($list->getHTML());
203  }
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:
+ Here is the caller graph for this function:

◆ save()

ilDclFieldListGUI::save ( )

Definition at line 132 of file class.ilDclFieldListGUI.php.

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

132  : void
133  {
134  $table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
135 
137  $fields = $table->getFields();
138 
139  $order = $this->http->wrapper()->post()->retrieve(
140  'order',
141  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
142  );
143  asort($order);
144  $val = 10;
145  foreach (array_keys($order) as $field_id) {
146  $order[$field_id] = $val;
147  $val += 10;
148  }
149 
150  $exportable = [];
151  if ($this->http->wrapper()->post()->has("exportable")) {
152  $exportable = $this->http->wrapper()->post()->retrieve(
153  "exportable",
154  $this->refinery->kindlyTo()->dictOf(
155  $this->refinery->kindlyTo()->string()
156  )
157  );
158  }
159 
160  foreach ($fields as $field) {
161  $field->setExportable(array_key_exists($field->getId(), $exportable) && $exportable[$field->getId()] === "on");
162  $field->setOrder($order[$field->getId()]);
163  $field->doUpdate();
164  }
165 
166  $table->reloadFields();
167  $this->tpl->setOnScreenMessage('success', $this->lng->txt("dcl_table_settings_saved"));
168  $this->listFields();
169  }
static http()
Fetches the global http state from ILIAS.
static getTableCache(int $table_id=null)
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilDclFieldListGUI::$ctrl
protected

Definition at line 21 of file class.ilDclFieldListGUI.php.

◆ $http

ILIAS HTTP Services ilDclFieldListGUI::$http
protected

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

◆ $lng

ilLanguage ilDclFieldListGUI::$lng
protected

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

◆ $obj_id

int ilDclFieldListGUI::$obj_id
protected

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

◆ $parent_obj

ilDclTableListGUI ilDclFieldListGUI::$parent_obj
protected

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

◆ $refinery

ILIAS Refinery Factory ilDclFieldListGUI::$refinery
protected

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

◆ $table_id

int ilDclFieldListGUI::$table_id
protected

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

Referenced by getTableId(), and listFields().

◆ $tabs

ilTabsGUI ilDclFieldListGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilDclFieldListGUI::$toolbar
protected

Definition at line 23 of file class.ilDclFieldListGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilDclFieldListGUI::$tpl
protected

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


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