ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDclFieldListGUI Class Reference
+ 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...
 
 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)

Constructor.

Definition at line 39 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().

40  {
41  global $DIC;
42 
43  $this->http = $DIC->http();
44  $this->refinery = $DIC->refinery();
45  $this->table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
46  $locator = $DIC['ilLocator'];
47  $this->parent_obj = $a_parent_obj;
48  $this->obj_id = $a_parent_obj->getObjId();
49  $this->ctrl = $DIC->ctrl();
50  $this->lng = $DIC->language();
51  $this->tpl = $DIC->ui()->mainTemplate();
52  $this->tabs = $DIC->tabs();
53  $this->toolbar = $DIC->toolbar();
54  $this->ui_factory = $DIC->ui()->factory();
55  $this->renderer = $DIC->ui()->renderer();
56 
57  $DIC->help()->setScreenId('dcl_fields');
58 
59  $this->ctrl->saveParameterByClass(ilDclTableEditGUI::class, 'table_id');
60  $locator->addItem(
61  ilDclCache::getTableCache($this->table_id)->getTitle(),
62  $this->ctrl->getLinkTargetByClass(ilDclTableEditGUI::class, 'edit')
63  );
64  $this->tpl->setLocator();
65 
66  if (!$this->checkAccess()) {
67  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
68  $this->ctrl->redirectByClass(ilDclRecordListGUI::class, 'listRecords');
69  }
70  }
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()

ilDclFieldListGUI::checkAccess ( )
protected

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

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

Referenced by __construct().

203  : bool
204  {
205  $ref_id = $this->getDataCollectionObject()->getRefId();
206 
208  }
$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 89 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().

89  : void
90  {
91  if ($this->http->wrapper()->post()->has('dcl_field_ids')) {
92  $field_ids = $this->http->wrapper()->post()->retrieve(
93  'dcl_field_ids',
94  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
95  );
96  $table = ilDclCache::getTableCache($this->table_id);
97  foreach ($field_ids as $field_id) {
98  $table->deleteField($field_id);
99  }
100  }
101 
102  $this->tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_fields_deleted'), true);
103  $this->ctrl->redirect($this, 'listFields');
104  }
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 80 of file class.ilDclFieldListGUI.php.

References ILIAS\Repository\ctrl().

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

◆ getDataCollectionObject()

ilDclFieldListGUI::getDataCollectionObject ( )

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

Referenced by checkAccess().

211  {
212  return $this->parent_obj->getDataCollectionObject();
213  }
+ Here is the caller graph for this function:

◆ getTableId()

ilDclFieldListGUI::getTableId ( )

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

References $table_id.

72  : int
73  {
74  return $this->table_id;
75  }

◆ listFields()

ilDclFieldListGUI::listFields ( )

list fields

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

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

Referenced by save().

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

◆ save()

ilDclFieldListGUI::save ( )

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

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

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