ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 47 of file class.ilDclFieldListGUI.php.

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

48  {
49  global $DIC;
50  $ilCtrl = $DIC['ilCtrl'];
51  $lng = $DIC['lng'];
52  $ilToolbar = $DIC['ilToolbar'];
53  $tpl = $DIC['tpl'];
54  $ilTabs = $DIC['ilTabs'];
55  $locator = $DIC['ilLocator'];
56 
57  $table_id = $_GET['table_id'];
58 
59  $this->table_id = $table_id;
60  $this->parent_obj = $a_parent_obj;
61  $this->obj_id = $a_parent_obj->obj_id;
62  $this->ctrl = $ilCtrl;
63  $this->lng = $lng;
64  $this->tpl = $tpl;
65  $this->tabs = $ilTabs;
66  $this->toolbar = $ilToolbar;
67 
68  $this->ctrl->saveParameter('ilDclTableEditGUI', 'table_id');
69  $locator->addItem(ilDclCache::getTableCache($this->table_id)->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
70  $this->tpl->setLocator();
71 
72  if (!$this->checkAccess()) {
73  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
74  $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
75  }
76  }
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 205 of file class.ilDclFieldListGUI.php.

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

Referenced by __construct().

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

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

97  {
98  $field_ids = isset($_POST['dcl_field_ids']) ? $_POST['dcl_field_ids'] : array();
99  $table = ilDclCache::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 getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24
$_POST["username"]
+ Here is the call graph for this function:

◆ doTableSwitch()

ilDclFieldListGUI::doTableSwitch ( )

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

References $_POST.

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

◆ executeCommand()

ilDclFieldListGUI::executeCommand ( )

execute command

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

83  {
84  $cmd = $this->ctrl->getCmd('listFields');
85  switch ($cmd) {
86  default:
87  $this->$cmd();
88  break;
89  }
90  }

◆ getDataCollectionObject()

ilDclFieldListGUI::getDataCollectionObject ( )
Returns
ilObjDataCollection

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

Referenced by checkAccess().

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

◆ listFields()

ilDclFieldListGUI::listFields ( )

list fields

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

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

Referenced by save().

161  {
162  //add button
163  $add_new = ilLinkButton::getInstance();
164  $add_new->setPrimary(true);
165  $add_new->setCaption("dcl_add_new_field");
166  $add_new->setUrl($this->ctrl->getLinkTargetByClass('ildclfieldeditgui', 'create'));
167  $this->toolbar->addStickyItem($add_new);
168 
169  $this->toolbar->addSeparator();
170 
171  // Show tableswitcher
172  $tables = $this->parent_obj->getDataCollectionObject()->getTables();
173 
174  foreach ($tables as $table) {
175  $options[$table->getId()] = $table->getTitle();
176  }
177  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
178  $table_selection = new ilSelectInputGUI('', 'table_id');
179  $table_selection->setOptions($options);
180  $table_selection->setValue($this->table_id);
181 
182  $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclFieldListGUI", "doTableSwitch"));
183  $this->toolbar->addText($this->lng->txt("dcl_select"));
184  $this->toolbar->addInputItem($table_selection);
185  $this->toolbar->addFormButton($this->lng->txt('change'), 'doTableSwitch');
186 
187  //table gui
188  $list = new ilDclFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
189  $this->tpl->setContent($list->getHTML());
190  }
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDclFieldListGUI::save ( )

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

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

133  {
134  $table = ilDclCache::getTableCache($_GET['table_id']);
135  $fields = $table->getFields();
136  $order = $_POST['order'];
137  asort($order);
138  $val = 10;
139  foreach (array_keys($order) as $field_id) {
140  $order[$field_id] = $val;
141  $val += 10;
142  }
143 
144  foreach ($fields as $field) {
145  $field->setLocked($_POST['locked'][$field->getId()] == "on");
146  $field->setExportable($_POST['exportable'][$field->getId()] == "on");
147  $field->setOrder($order[$field->getId()]);
148  $field->doUpdate();
149  }
150 
151  $table->reloadFields();
152  ilUtil::sendSuccess($this->lng->txt("dcl_table_settings_saved"));
153  $this->listFields();
154  }
$_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 22 of file class.ilDclFieldListGUI.php.

◆ $lng

ilDclFieldListGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs

ilDclFieldListGUI::$tabs
protected

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

◆ $toolbar

ilDclFieldListGUI::$toolbar
protected

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

◆ $tpl

ilDclFieldListGUI::$tpl
protected

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

Referenced by __construct().


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