ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 58 of file class.ilDclFieldListGUI.php.

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclFieldListGUI::checkAccess ( )
protected
Returns
bool

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

214 {
215 $ref_id = $this->getDataCollectionObject()->getRefId();
217 }
static hasAccessToEditTable($ref_id, $table_id)
$ref_id
Definition: sahs_server.php:39

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

Referenced by __construct().

+ 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 106 of file class.ilDclFieldListGUI.php.

107 {
108 $field_ids = isset($_POST['dcl_field_ids']) ? $_POST['dcl_field_ids'] : array();
109 $table = ilDclCache::getTableCache($this->table_id);
110 foreach ($field_ids as $field_id) {
111 $table->deleteField($field_id);
112 }
113 ilUtil::sendSuccess($this->lng->txt('dcl_msg_fields_deleted'), true);
114 $this->ctrl->redirect($this, 'listFields');
115 }
$_POST["username"]
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ doTableSwitch()

ilDclFieldListGUI::doTableSwitch ( )

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

205 {
206 $this->ctrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $_POST['table_id']);
207 $this->ctrl->redirectByClass("ilDclFieldListGUI", "listFields");
208 }

References $_POST.

◆ executeCommand()

ilDclFieldListGUI::executeCommand ( )

execute command

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

94 {
95 $cmd = $this->ctrl->getCmd('listFields');
96 switch($cmd) {
97 default:
98 $this->$cmd();
99 break;
100 }
101 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ getDataCollectionObject()

ilDclFieldListGUI::getDataCollectionObject ( )
Returns
ilObjDataCollection

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

223 {
224 return $this->parent_obj->getDataCollectionObject();
225 }

Referenced by checkAccess().

+ Here is the caller graph for this function:

◆ listFields()

ilDclFieldListGUI::listFields ( )

list fields

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

169 {
170 //add button
171 $add_new = ilLinkButton::getInstance();
172 $add_new->setPrimary(true);
173 $add_new->setCaption("dcl_add_new_field");
174 $add_new->setUrl($this->ctrl->getLinkTargetByClass('ildclfieldeditgui', 'create'));
175 $this->toolbar->addStickyItem($add_new);
176
177 $this->toolbar->addSeparator();
178
179 // Show tableswitcher
180 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
181
182 foreach($tables as $table)
183 {
184 $options[$table->getId()] = $table->getTitle();
185 }
186 include_once './Services/Form/classes/class.ilSelectInputGUI.php';
187 $table_selection = new ilSelectInputGUI('', 'table_id');
188 $table_selection->setOptions($options);
189 $table_selection->setValue($this->table_id);
190
191 $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclFieldListGUI", "doTableSwitch"));
192 $this->toolbar->addText($this->lng->txt("dcl_select"));
193 $this->toolbar->addInputItem($table_selection);
194 $this->toolbar->addFormButton($this->lng->txt('change'),'doTableSwitch');
195
196 //table gui
197 $list = new ilDclFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
198 $this->tpl->setContent($list->getHTML());
199 }
Class ilDclFieldListTableGUI.
static getInstance()
Factory.
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

References $options, and ilLinkButton\getInstance().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDclFieldListGUI::save ( )

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

140 {
141 $table = ilDclCache::getTableCache($_GET['table_id']);
142 $fields = $table->getFields();
143 $order = $_POST['order'];
144 asort($order);
145 $val = 10;
146 foreach (array_keys($order) as $field_id) {
147 $order[$field_id] = $val;
148 $val += 10;
149 }
150
151
152 foreach($fields as $field)
153 {
154 $field->setLocked($_POST['locked'][$field->getId()] == "on");
155 $field->setExportable($_POST['exportable'][$field->getId()] == "on");
156 $field->setOrder($order[$field->getId()]);
157 $field->doUpdate();
158 }
159
160 $table->reloadFields();
161 ilUtil::sendSuccess($this->lng->txt("dcl_table_settings_saved"));
162 $this->listFields();
163 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDclFieldListGUI::$ctrl
protected

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

◆ $lng

ilDclFieldListGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs

ilDclFieldListGUI::$tabs
protected

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

◆ $toolbar

ilDclFieldListGUI::$toolbar
protected

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

◆ $tpl

ilDclFieldListGUI::$tpl
protected

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

Referenced by __construct().


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