ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDclFieldListGUI Class Reference
+ Collaboration diagram for ilDclFieldListGUI:

Public Member Functions

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

Protected Member Functions

 checkAccess ()
 

Protected Attributes

 $ctrl
 
 $lng
 
 $toolbar
 
 $tpl
 
 $tabs
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclFieldListGUI::__construct ( ilDclTableListGUI  $a_parent_obj)

Constructor.

Parameters
ilDclTableListGUI$a_parent_obj
int$table_id

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

References $_GET, $DIC, $ilCtrl, $lng, $tpl, checkAccess(), ilDclCache\getTableCache(), and ilUtil\sendFailure().

53  {
54  global $DIC;
55  $ilCtrl = $DIC['ilCtrl'];
56  $lng = $DIC['lng'];
57  $ilToolbar = $DIC['ilToolbar'];
58  $tpl = $DIC['tpl'];
59  $ilTabs = $DIC['ilTabs'];
60  $locator = $DIC['ilLocator'];
61 
62  $table_id = $_GET['table_id'];
63 
64  $this->table_id = $table_id;
65  $this->parent_obj = $a_parent_obj;
66  $this->obj_id = $a_parent_obj->obj_id;
67  $this->ctrl = $ilCtrl;
68  $this->lng = $lng;
69  $this->tpl = $tpl;
70  $this->tabs = $ilTabs;
71  $this->toolbar = $ilToolbar;
72 
73  $this->ctrl->saveParameter('ilDclTableEditGUI', 'table_id');
74  $locator->addItem(ilDclCache::getTableCache($this->table_id)->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
75  $this->tpl->setLocator();
76 
77  if (!$this->checkAccess()) {
78  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
79  $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
80  }
81  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static getTableCache($table_id=0)
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclFieldListGUI::checkAccess ( )
protected
Returns
bool

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

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

Referenced by __construct().

207  {
208  $ref_id = $this->getDataCollectionObject()->getRefId();
209  return ilObjDataCollectionAccess::hasAccessToEditTable($ref_id, $this->table_id);
210  }
static hasAccessToEditTable($ref_id, $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 100 of file class.ilDclFieldListGUI.php.

References $_POST, $table, array, ilDclCache\getFieldCache(), ilDclCache\getTableCache(), and ilUtil\sendSuccess().

101  {
102  $field_ids = isset($_POST['dcl_field_ids']) ? $_POST['dcl_field_ids'] : array();
103  $table = ilDclCache::getTableCache($this->table_id);
104  foreach ($field_ids as $field_id) {
105  $table->deleteField($field_id);
106  }
107  ilUtil::sendSuccess($this->lng->txt('dcl_msg_fields_deleted'), true);
108  $this->ctrl->redirect($this, 'listFields');
109  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getTableCache($table_id=0)
Create styles array
The data for the language used.
if(empty($password)) $table
Definition: pwgen.php:24
$_POST["username"]
+ Here is the call graph for this function:

◆ doTableSwitch()

ilDclFieldListGUI::doTableSwitch ( )

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

References $_POST.

198  {
199  $this->ctrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $_POST['table_id']);
200  $this->ctrl->redirectByClass("ilDclFieldListGUI", "listFields");
201  }
$_POST["username"]

◆ executeCommand()

ilDclFieldListGUI::executeCommand ( )

execute command

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

88  {
89  $cmd = $this->ctrl->getCmd('listFields');
90  switch ($cmd) {
91  default:
92  $this->$cmd();
93  break;
94  }
95  }

◆ getDataCollectionObject()

ilDclFieldListGUI::getDataCollectionObject ( )
Returns
ilObjDataCollection

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

Referenced by checkAccess().

217  {
218  return $this->parent_obj->getDataCollectionObject();
219  }
+ Here is the caller graph for this function:

◆ listFields()

ilDclFieldListGUI::listFields ( )

list fields

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

References $list, $options, $table, and ilLinkButton\getInstance().

Referenced by save().

163  {
164  //add button
165  $add_new = ilLinkButton::getInstance();
166  $add_new->setPrimary(true);
167  $add_new->setCaption("dcl_add_new_field");
168  $add_new->setUrl($this->ctrl->getLinkTargetByClass('ildclfieldeditgui', 'create'));
169  $this->toolbar->addStickyItem($add_new);
170 
171  $this->toolbar->addSeparator();
172 
173  // Show tableswitcher
174  $tables = $this->parent_obj->getDataCollectionObject()->getTables();
175 
176  foreach ($tables as $table) {
177  $options[$table->getId()] = $table->getTitle();
178  }
179  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
180  $table_selection = new ilSelectInputGUI('', 'table_id');
181  $table_selection->setOptions($options);
182  $table_selection->setValue($this->table_id);
183 
184  $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclFieldListGUI", "doTableSwitch"));
185  $this->toolbar->addText($this->lng->txt("dcl_select"));
186  $this->toolbar->addInputItem($table_selection);
187  $this->toolbar->addFormButton($this->lng->txt('change'), 'doTableSwitch');
188 
189  //table gui
190  $list = new ilDclFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
191  $this->tpl->setContent($list->getHTML());
192  }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
This class represents a selection list property in a property form.
Class ilDclFieldListTableGUI.
if(empty($password)) $table
Definition: pwgen.php:24
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDclFieldListGUI::save ( )

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

References $_GET, $_POST, $table, ilDclCache\getTableCache(), listFields(), and ilUtil\sendSuccess().

135  {
136  $table = ilDclCache::getTableCache($_GET['table_id']);
137  $fields = $table->getFields();
138  $order = $_POST['order'];
139  asort($order);
140  $val = 10;
141  foreach (array_keys($order) as $field_id) {
142  $order[$field_id] = $val;
143  $val += 10;
144  }
145 
146 
147  foreach ($fields as $field) {
148  $field->setLocked($_POST['locked'][$field->getId()] == "on");
149  $field->setExportable($_POST['exportable'][$field->getId()] == "on");
150  $field->setOrder($order[$field->getId()]);
151  $field->doUpdate();
152  }
153 
154  $table->reloadFields();
155  ilUtil::sendSuccess($this->lng->txt("dcl_table_settings_saved"));
156  $this->listFields();
157  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
static getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDclFieldListGUI::$ctrl
protected

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

◆ $lng

ilDclFieldListGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs

ilDclFieldListGUI::$tabs
protected

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

◆ $toolbar

ilDclFieldListGUI::$toolbar
protected

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

◆ $tpl

ilDclFieldListGUI::$tpl
protected

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

Referenced by __construct().


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