ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilDataCollectionFieldListGUI Class Reference

Class ilDataCollectionFieldListGUI. More...

+ Collaboration diagram for ilDataCollectionFieldListGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj, $table_id)
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 deleteFields ()
 Delete multiple fields. More...
 
 save ()
 
 listFields ()
 list fields More...
 
 doTableSwitch ()
 

Protected Member Functions

 checkAccess ()
 

Protected Attributes

 $ctrl
 
 $lng
 
 $toolbar
 
 $tpl
 
 $tabs
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionFieldListGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj,
  $table_id 
)

Constructor.

Parameters
ilObjDataCollectionGUI$a_parent_obj
int$table_id

Definition at line 59 of file class.ilDataCollectionFieldListGUI.php.

References $ilCtrl, $lng, $tpl, checkAccess(), and ilUtil\sendFailure().

60  {
61  global $ilCtrl, $lng, $ilToolbar, $tpl, $ilTabs;
62 
63  $this->main_table_id = $a_parent_obj->object->getMainTableId();
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  if ( ! $this->checkAccess()) {
73  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
74  $this->ctrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
75  }
76  }
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()

ilDataCollectionFieldListGUI::checkAccess ( )
protected
Returns
bool

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

References $ref_id, and ilObjDataCollection\_hasWriteAccess().

Referenced by __construct().

201  {
202  $ref_id = $this->parent_obj->getDataCollectionObject()->getRefId();
204  }
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFields()

ilDataCollectionFieldListGUI::deleteFields ( )

Delete multiple fields.

Definition at line 95 of file class.ilDataCollectionFieldListGUI.php.

References $_POST, ilDataCollectionCache\getFieldCache(), ilDataCollectionCache\getTableCache(), and ilUtil\sendSuccess().

96  {
97  $field_ids = isset($_POST['dcl_field_ids']) ? $_POST['dcl_field_ids'] : array();
98  $table = ilDataCollectionCache::getTableCache($this->table_id);
99  foreach ($field_ids as $field_id) {
100  $table->deleteField($field_id);
101  }
102  ilUtil::sendSuccess($this->lng->txt('dcl_msg_fields_deleted'), true);
103  $this->ctrl->redirect($this, 'listFields');
104  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ doTableSwitch()

ilDataCollectionFieldListGUI::doTableSwitch ( )

Definition at line 191 of file class.ilDataCollectionFieldListGUI.php.

References $_POST.

192  {
193  $this->ctrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $_POST['table_id']);
194  $this->ctrl->redirectByClass("ilDataCollectionFieldListGUI", "listFields");
195  }
$_POST['username']
Definition: cron.php:12

◆ executeCommand()

ilDataCollectionFieldListGUI::executeCommand ( )

execute command

Definition at line 82 of file class.ilDataCollectionFieldListGUI.php.

References $cmd.

83  {
84  $cmd = $this->ctrl->getCmd();
85  switch($cmd) {
86  default:
87  $this->$cmd();
88  break;
89  }
90  }
$cmd
Definition: sahs_server.php:35

◆ listFields()

ilDataCollectionFieldListGUI::listFields ( )

list fields

Definition at line 151 of file class.ilDataCollectionFieldListGUI.php.

References $options.

Referenced by save().

152  {
153  // Show tables
154  require_once("./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
155  $tables = $this->parent_obj->object->getTables();
156 
157  foreach($tables as $table)
158  {
159  $options[$table->getId()] = $table->getTitle();
160  }
161  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
162  $table_selection = new ilSelectInputGUI('', 'table_id');
163  $table_selection->setOptions($options);
164  $table_selection->setValue($this->table_id);
165 
166  $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDataCollectionFieldListGUI", "doTableSwitch"));
167  $this->toolbar->addText($this->lng->txt("dcl_table"));
168  $this->toolbar->addInputItem($table_selection);
169  $this->toolbar->addFormButton($this->lng->txt('change'),'doTableSwitch');
170  $this->toolbar->addSeparator();
171  $this->toolbar->addButton($this->lng->txt("dcl_add_new_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "create"));
172  $this->toolbar->addSeparator();
173  $this->ctrl->setParameterByClass("ildatacollectiontableeditgui", "table_id", $this->table_id);
174  $this->toolbar->addButton($this->lng->txt("dcl_table_settings"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "edit"));
175  $this->toolbar->addButton($this->lng->txt("dcl_delete_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "confirmDelete"));
176  $this->toolbar->addButton($this->lng->txt("dcl_add_new_field"), $this->ctrl->getLinkTargetByClass("ildatacollectionfieldeditgui", "create"));
177 
178  // requested not to implement this way...
179 // $tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
180 
181  require_once('./Modules/DataCollection/classes/class.ilDataCollectionFieldListTableGUI.php');
182  $list = new ilDataCollectionFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
183 
184  $this->tpl->setContent($list->getHTML());
185 
186  }
This class represents a selection list property in a property form.
Class ilDataCollectionFieldListTableGUI.
if(!is_array($argv)) $options
+ Here is the caller graph for this function:

◆ save()

ilDataCollectionFieldListGUI::save ( )

Definition at line 128 of file class.ilDataCollectionFieldListGUI.php.

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

129  {
130  $table = ilDataCollectionCache::getTableCache($_GET['table_id']);
131  $fields = $table->getFields();
132 
133  foreach($fields as $field)
134  {
135  $field->setVisible($_POST['visible'][$field->getId()] == "on");
136  $field->setEditable($_POST['editable'][$field->getId()] == "on");
137  $field->setFilterable($_POST['filterable'][$field->getId()] == "on");
138  $field->setLocked($_POST['locked'][$field->getId()] == "on");
139  $field->setExportable($_POST['exportable'][$field->getId()] == "on");
140  $field->setOrder($_POST['order'][$field->getId()]);
141  $field->doUpdate();
142  }
143  $table->buildOrderFields();
144  ilUtil::sendSuccess($this->lng->txt("dcl_table_settings_saved"));
145  $this->listFields();
146  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDataCollectionFieldListGUI::$ctrl
protected

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

◆ $lng

ilDataCollectionFieldListGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs

ilDataCollectionFieldListGUI::$tabs
protected

Definition at line 51 of file class.ilDataCollectionFieldListGUI.php.

◆ $toolbar

ilDataCollectionFieldListGUI::$toolbar
protected

Definition at line 41 of file class.ilDataCollectionFieldListGUI.php.

◆ $tpl

ilDataCollectionFieldListGUI::$tpl
protected

Definition at line 46 of file class.ilDataCollectionFieldListGUI.php.

Referenced by __construct().


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