ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilDclFieldListGUI Class Reference
+ Collaboration diagram for ilDclFieldListGUI:

Public Member Functions

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

Protected Member Functions

 checkAccess ()
 

Protected Attributes

ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $renderer
 
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

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

Constructor & Destructor Documentation

◆ __construct()

ilDclFieldListGUI::__construct ( ilDclTableListGUI  $a_parent_obj)

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

References $DIC, checkAccess(), ILIAS\Repository\ctrl(), ilDclTableListGUI\getObjId(), ilDclCache\getTableCache(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), renderer(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

37  {
38  global $DIC;
39 
40  $this->http = $DIC->http();
41  $this->refinery = $DIC->refinery();
42  $this->table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
43  $locator = $DIC['ilLocator'];
44  $this->parent_obj = $a_parent_obj;
45  $this->obj_id = $a_parent_obj->getObjId();
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->ui_factory = $DIC->ui()->factory();
52  $this->renderer = $DIC->ui()->renderer();
53 
54  $DIC->help()->setScreenId('dcl_fields');
55 
56  $this->ctrl->saveParameterByClass(ilDclTableEditGUI::class, 'table_id');
57  $locator->addItem(
58  ilDclCache::getTableCache($this->table_id)->getTitle(),
59  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'edit')
60  );
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::class, 'listRecords');
66  }
67  }
renderer()
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
static getTableCache(?int $table_id=null)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclFieldListGUI::checkAccess ( )
protected

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

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

Referenced by __construct().

200  : bool
201  {
202  $ref_id = $this->getDataCollectionObject()->getRefId();
203 
205  }
$ref_id
Definition: ltiauth.php:65
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 86 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().

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

◆ executeCommand()

ilDclFieldListGUI::executeCommand ( )

execute command

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

References ILIAS\Repository\ctrl().

77  : void
78  {
79  $cmd = $this->ctrl->getCmd('listFields');
80  $this->$cmd();
81  }
+ Here is the call graph for this function:

◆ getDataCollectionObject()

ilDclFieldListGUI::getDataCollectionObject ( )

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

Referenced by checkAccess().

208  {
209  return $this->parent_obj->getDataCollectionObject();
210  }
+ Here is the caller graph for this function:

◆ getTableId()

ilDclFieldListGUI::getTableId ( )

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

References $table_id.

69  : int
70  {
71  return $this->table_id;
72  }

◆ listFields()

ilDclFieldListGUI::listFields ( )

list fields

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

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

Referenced by save().

179  : void
180  {
181  //add button
182  $add_new = $this->ui_factory->button()->primary(
183  $this->lng->txt("dcl_add_new_field"),
184  $this->ctrl->getLinkTargetByClass(ilDclFieldEditGUI::class, 'create')
185  );
186  $this->toolbar->addStickyItem($add_new);
187 
188  $switcher = new ilDclSwitcher($this->toolbar, $this->ui_factory, $this->ctrl, $this->lng);
189  $switcher->addTableSwitcherToToolbar(
190  $this->parent_obj->getDataCollectionObject()->getTables(),
191  self::class,
192  'listFields'
193  );
194 
195  //table gui
196  $list = new ilDclFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
197  $this->tpl->setContent($list->getHTML());
198  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDclFieldListGUI::save ( )

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

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

137  : void
138  {
139  $table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
140 
142  $fields = $table->getFields();
143 
144  $order = $this->http->wrapper()->post()->retrieve(
145  'order',
146  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
147  );
148  asort($order);
149  $val = 10;
150  foreach (array_keys($order) as $field_id) {
151  $order[$field_id] = $val;
152  $val += 10;
153  }
154 
155  $exportable = [];
156  if ($this->http->wrapper()->post()->has("exportable")) {
157  $exportable = $this->http->wrapper()->post()->retrieve(
158  "exportable",
159  $this->refinery->kindlyTo()->dictOf(
160  $this->refinery->kindlyTo()->string()
161  )
162  );
163  }
164 
165  foreach ($fields as $field) {
166  $field->setExportable(array_key_exists($field->getId(), $exportable) && $exportable[$field->getId()] === "on");
167  $field->setOrder($order[$field->getId()]);
168  $field->doUpdate();
169  }
170 
171  $table->reloadFields();
172  $this->tpl->setOnScreenMessage('success', $this->lng->txt("dcl_table_settings_saved"));
173  $this->listFields();
174  }
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 25 of file class.ilDclFieldListGUI.php.

◆ $http

ILIAS HTTP Services ilDclFieldListGUI::$http
protected

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

◆ $lng

ilLanguage ilDclFieldListGUI::$lng
protected

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

◆ $obj_id

int ilDclFieldListGUI::$obj_id
protected

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

◆ $parent_obj

ilDclTableListGUI ilDclFieldListGUI::$parent_obj
protected

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

◆ $refinery

ILIAS Refinery Factory ilDclFieldListGUI::$refinery
protected

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

◆ $renderer

ILIAS UI Renderer ilDclFieldListGUI::$renderer
protected

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

◆ $table_id

int ilDclFieldListGUI::$table_id
protected

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

Referenced by getTableId(), and listFields().

◆ $tabs

ilTabsGUI ilDclFieldListGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilDclFieldListGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilDclFieldListGUI::$tpl
protected

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

◆ $ui_factory

ILIAS UI Factory ilDclFieldListGUI::$ui_factory
protected

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


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