ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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 }
$_GET["client_id"]
static getTableCache($table_id=0)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $DIC
Definition: goto.php:24

References $_GET, $DIC, $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 204 of file class.ilDclFieldListGUI.php.

205 {
206 $ref_id = $this->getDataCollectionObject()->getRefId();
207
208 return ilObjDataCollectionAccess::hasAccessToEditTable($ref_id, $this->table_id);
209 }
static hasAccessToEditTable($ref_id, $table_id)

References 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 96 of file class.ilDclFieldListGUI.php.

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 }
$_POST["username"]

References $_POST, and ilDclCache\getTableCache().

+ Here is the call graph for this function:

◆ doTableSwitch()

ilDclFieldListGUI::doTableSwitch ( )

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

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

References $_POST.

◆ 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.

216 {
217 return $this->parent_obj->getDataCollectionObject();
218 }

Referenced by checkAccess().

+ Here is the caller graph for this function:

◆ listFields()

ilDclFieldListGUI::listFields ( )

list fields

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

160 {
161 //add button
162 $add_new = ilLinkButton::getInstance();
163 $add_new->setPrimary(true);
164 $add_new->setCaption("dcl_add_new_field");
165 $add_new->setUrl($this->ctrl->getLinkTargetByClass('ildclfieldeditgui', 'create'));
166 $this->toolbar->addStickyItem($add_new);
167
168 $this->toolbar->addSeparator();
169
170 // Show tableswitcher
171 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
172
173 foreach ($tables as $table) {
174 $options[$table->getId()] = $table->getTitle();
175 }
176 $table_selection = new ilSelectInputGUI('', 'table_id');
177 $table_selection->setOptions($options);
178 $table_selection->setValue($this->table_id);
179
180 $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclFieldListGUI", "doTableSwitch"));
181 $this->toolbar->addText($this->lng->txt("dcl_select"));
182 $this->toolbar->addInputItem($table_selection);
183 $this->toolbar->addFormButton($this->lng->txt('change'), 'doTableSwitch');
184
185 //table gui
186 $list = new ilDclFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
187 $this->tpl->setContent($list->getHTML());
188 }
Class ilDclFieldListTableGUI.
static getInstance()
Factory.
This class represents a selection list property in a property form.

References 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 132 of file class.ilDclFieldListGUI.php.

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->setExportable($_POST['exportable'][$field->getId()] == "on");
146 $field->setOrder($order[$field->getId()]);
147 $field->doUpdate();
148 }
149
150 $table->reloadFields();
151 ilUtil::sendSuccess($this->lng->txt("dcl_table_settings_saved"));
152 $this->listFields();
153 }

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

+ 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: