ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 60 of file class.ilDataCollectionFieldListGUI.php.

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

61  {
62  global $ilCtrl, $lng, $ilToolbar, $tpl, $ilTabs;
63 
64  $this->main_table_id = $a_parent_obj->object->getMainTableId();
65  $this->table_id = $table_id;
66  $this->parent_obj = $a_parent_obj;
67  $this->obj_id = $a_parent_obj->obj_id;
68  $this->ctrl = $ilCtrl;
69  $this->lng = $lng;
70  $this->tpl = $tpl;
71  $this->tabs = $ilTabs;
72  $this->toolbar = $ilToolbar;
73  if ( ! $this->checkAccess()) {
74  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
75  $this->ctrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
76  }
77  }
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 197 of file class.ilDataCollectionFieldListGUI.php.

References $ref_id, and ilObjDataCollection\_hasWriteAccess().

Referenced by __construct().

198  {
199  $ref_id = $this->parent_obj->getDataCollectionObject()->getRefId();
201  }
$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 96 of file class.ilDataCollectionFieldListGUI.php.

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

97  {
98  $field_ids = isset($_POST['dcl_field_ids']) ? $_POST['dcl_field_ids'] : array();
99  $table = ilDataCollectionCache::getTableCache($this->table_id);
100  foreach ($field_ids as $field_id) {
101  $table->deleteField($field_id);
102  }
103  ilUtil::sendSuccess($this->lng->txt('dcl_msg_fields_deleted'), true);
104  $this->ctrl->redirect($this, 'listFields');
105  }
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 188 of file class.ilDataCollectionFieldListGUI.php.

References $_POST.

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

◆ executeCommand()

ilDataCollectionFieldListGUI::executeCommand ( )

execute command

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

References $cmd.

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

◆ listFields()

ilDataCollectionFieldListGUI::listFields ( )

list fields

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

References $options.

Referenced by save().

153  {
154  // Show tables
155  require_once("./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
156  $tables = $this->parent_obj->object->getTables();
157 
158  foreach($tables as $table)
159  {
160  $options[$table->getId()] = $table->getTitle();
161  }
162  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
163  $table_selection = new ilSelectInputGUI('', 'table_id');
164  $table_selection->setOptions($options);
165  $table_selection->setValue($this->table_id);
166 
167  $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDataCollectionFieldListGUI", "doTableSwitch"));
168  $this->toolbar->addText($this->lng->txt("dcl_table"));
169  $this->toolbar->addInputItem($table_selection);
170  $this->toolbar->addFormButton($this->lng->txt('change'),'doTableSwitch');
171  $this->toolbar->addSeparator();
172  $this->toolbar->addButton($this->lng->txt("dcl_add_new_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "create"));
173  $this->toolbar->addSeparator();
174  $this->ctrl->setParameterByClass("ildatacollectiontableeditgui", "table_id", $this->table_id);
175  $this->toolbar->addButton($this->lng->txt("dcl_table_settings"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "edit"));
176  $this->toolbar->addSeparator();
177  $this->toolbar->addButton($this->lng->txt("dcl_delete_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "confirmDelete"));
178  $this->toolbar->addSeparator();
179  $this->toolbar->addButton($this->lng->txt("dcl_add_new_field"), $this->ctrl->getLinkTargetByClass("ildatacollectionfieldeditgui", "create"));
180  $list = new ilDataCollectionFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
181  $this->tpl->setContent($list->getHTML());
182 
183  }
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 129 of file class.ilDataCollectionFieldListGUI.php.

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

130  {
131  $table = ilDataCollectionCache::getTableCache($_GET['table_id']);
132  $fields = $table->getFields();
133 
134  foreach($fields as $field)
135  {
136  $field->setVisible($_POST['visible'][$field->getId()] == "on");
137  $field->setEditable($_POST['editable'][$field->getId()] == "on");
138  $field->setFilterable($_POST['filterable'][$field->getId()] == "on");
139  $field->setLocked($_POST['locked'][$field->getId()] == "on");
140  $field->setExportable($_POST['exportable'][$field->getId()] == "on");
141  $field->setOrder($_POST['order'][$field->getId()]);
142  $field->doUpdate();
143  }
144  $table->buildOrderFields();
145  ilUtil::sendSuccess($this->lng->txt("dcl_table_settings_saved"));
146  $this->listFields();
147  }
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 31 of file class.ilDataCollectionFieldListGUI.php.

◆ $lng

ilDataCollectionFieldListGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs

ilDataCollectionFieldListGUI::$tabs
protected

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

◆ $toolbar

ilDataCollectionFieldListGUI::$toolbar
protected

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

◆ $tpl

ilDataCollectionFieldListGUI::$tpl
protected

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

Referenced by __construct().


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