ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDataCollectionTableEditGUI Class Reference

Class ilDataCollectionField. More...

+ Collaboration diagram for ilDataCollectionTableEditGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj)
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 create ()
 create table add form More...
 
 edit ()
 create field edit form More...
 
 getValues ()
 getFieldValues More...
 
 getStandardValues ()
 getStandardValues More...
 
 cancel ()
 
 initForm ($a_mode="create")
 initEditCustomForm More...
 
 save ($a_mode="create")
 save More...
 
 accessDenied ()
 
 confirmDelete ()
 confirmDelete More...
 
 cancelDelete ()
 cancelDelete More...
 
 delete ()
 

Protected Member Functions

 checkInput ($a_mode)
 Custom checks for the form input. More...
 
 checkPermission ()
 

Private Attributes

 $table_id
 
 $table
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionTableEditGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

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

References $_GET, $ilCtrl, $lng, checkPermission(), ilDataCollectionCache\getTableCache(), and ilUtil\sendFailure().

35  {
36  global $ilCtrl, $lng;
37 
38  $this->parent_object = $a_parent_obj;
39  $this->obj_id = $a_parent_obj->obj_id;
40  $this->table_id = $_GET['table_id'];
41  $this->table = ilDataCollectionCache::getTableCache($this->table_id);
42  if ( ! $this->checkPermission()) {
43  ilUtil::sendFailure($lng->txt('permission_denied'), true);
44  $ilCtrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
45  }
46  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ accessDenied()

ilDataCollectionTableEditGUI::accessDenied ( )

Definition at line 347 of file class.ilDataCollectionTableEditGUI.php.

References $tpl.

Referenced by save().

348  {
349  global $tpl;
350 
351  $tpl->setContent("Access denied.");
352  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the caller graph for this function:

◆ cancel()

ilDataCollectionTableEditGUI::cancel ( )

Definition at line 153 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl.

154  {
155  global $ilCtrl;
156 
157  $ilCtrl->redirectByClass("ilDataCollectionFieldListGUI", "listFields");
158  }
global $ilCtrl
Definition: ilias.php:18

◆ cancelDelete()

ilDataCollectionTableEditGUI::cancelDelete ( )

cancelDelete

Definition at line 377 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl.

378  {
379  global $ilCtrl;
380 
381  $ilCtrl->redirectByClass("ildatacollectionfieldlistgui", "listFields");
382  }
global $ilCtrl
Definition: ilias.php:18

◆ checkInput()

ilDataCollectionTableEditGUI::checkInput (   $a_mode)
protected

Custom checks for the form input.

Parameters
$a_mode'create' | 'update'
Returns
bool

Definition at line 325 of file class.ilDataCollectionTableEditGUI.php.

References $lng, ilObjDataCollection\_hasTableByTitle(), and ilUtil\sendFailure().

Referenced by save().

325  {
326  global $lng;
327  $return = $this->form->checkInput();
328 
329  // Title of table must be unique in one DC
330  if ($a_mode == 'create') {
331  if ($title = $this->form->getInput('title')) {
332  if (ilObjDataCollection::_hasTableByTitle($title, $this->obj_id)) {
333  $inputObj = $this->form->getItemByPostVar('title');
334  $inputObj->setAlert($lng->txt("dcl_table_title_unique"));
335  $return = false;
336  }
337  }
338  }
339 
340  if (!$return) ilUtil::sendFailure($lng->txt("form_input_not_valid"));
341  return $return;
342  }
static _hasTableByTitle($title, $obj_id)
Checks if a DataCollection has a table with a given title.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPermission()

ilDataCollectionTableEditGUI::checkPermission ( )
protected
Returns
bool

Definition at line 405 of file class.ilDataCollectionTableEditGUI.php.

References $ref_id, and ilObjDataCollection\_hasWriteAccess().

Referenced by __construct().

406  {
407  $ref_id = $this->parent_object->getDataCollectionObject()->getRefId();
409  }
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilDataCollectionTableEditGUI::confirmDelete ( )

confirmDelete

Definition at line 357 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl, $lng, and $tpl.

358  {
359  global $ilCtrl, $lng, $tpl;
360 
361  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
362  $conf = new ilConfirmationGUI();
363  $conf->setFormAction($ilCtrl->getFormAction($this));
364  $conf->setHeaderText($lng->txt('dcl_confirm_delete_table'));
365 
366  $conf->addItem('table', (int) $this->table->getId(), $this->table->getTitle());
367 
368  $conf->setConfirm($lng->txt('delete'), 'delete');
369  $conf->setCancel($lng->txt('cancel'), 'cancelDelete');
370 
371  $tpl->setContent($conf->getHTML());
372  }
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
Confirmation screen class.

◆ create()

ilDataCollectionTableEditGUI::create ( )

create table add form

Definition at line 75 of file class.ilDataCollectionTableEditGUI.php.

References $tpl, getStandardValues(), and initForm().

76  {
77  global $ilTabs, $tpl;
78 
79  $this->initForm();
80  $this->getStandardValues();
81  $tpl->setContent($this->form->getHTML());
82  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
initForm($a_mode="create")
initEditCustomForm
+ Here is the call graph for this function:

◆ delete()

ilDataCollectionTableEditGUI::delete ( )

Definition at line 387 of file class.ilDataCollectionTableEditGUI.php.

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

388  {
389  global $ilCtrl, $lng;
390  $mainTableId = $this->table->getCollectionObject()->getMainTableId();
391  if($mainTableId == $this->table->getId()){
392  ilUtil::sendFailure($lng->txt("dcl_cant_delete_main_table"), true);
393  }
394  else{
395  $ilCtrl->setParameterByClass("ildatacollectionfieldlistgui", "table_id", $mainTableId);
396  }
397 
398  $this->table->doDelete();
399  $ilCtrl->redirectByClass("ildatacollectionfieldlistgui", "listFields");
400  }
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ edit()

ilDataCollectionTableEditGUI::edit ( )

create field edit form

Definition at line 87 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl, $tpl, ilDataCollectionCache\getTableCache(), getValues(), and initForm().

88  {
89  global $ilCtrl, $tpl;
90 
91  if(!$this->table_id)
92  {
93  $ilCtrl->redirectByClass("ildatacollectionfieldeditgui", "listFields");
94  return;
95  }
96  else
97  {
98  $this->table = ilDataCollectionCache::getTableCache($this->table_id);
99  }
100  $this->initForm("edit");
101  $this->getValues();
102  $tpl->setContent($this->form->getHTML());
103  }
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
initForm($a_mode="create")
initEditCustomForm
+ Here is the call graph for this function:

◆ executeCommand()

ilDataCollectionTableEditGUI::executeCommand ( )

execute command

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

References $cmd, $ilCtrl, $ilUser, $tpl, and save().

53  {
54  global $tpl, $ilCtrl, $ilUser;
55 
56  $cmd = $ilCtrl->getCmd();
57  $tpl->getStandardTemplate();
58 
59  switch($cmd)
60  {
61  case 'update':
62  $this->save("update");
63  break;
64  default:
65  $this->$cmd();
66  break;
67  }
68 
69  return true;
70  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ getStandardValues()

ilDataCollectionTableEditGUI::getStandardValues ( )

getStandardValues

Definition at line 133 of file class.ilDataCollectionTableEditGUI.php.

Referenced by create().

134  {
135  $values = array(
136  'title' => "",
137  'is_visible' => 1,
138  'add_perm' => 1,
139  'edit_perm' => 1,
140  'delete_perm' => 1,
141  'edit_by_owner' => 1,
142  'export_enabled' => 0,
143  'limited' => 0,
144  'limit_start' => NULL,
145  'limit_end' => NULL
146  );
147  $this->form->setValuesByArray($values);
148  }
+ Here is the caller graph for this function:

◆ getValues()

ilDataCollectionTableEditGUI::getValues ( )

getFieldValues

Definition at line 108 of file class.ilDataCollectionTableEditGUI.php.

Referenced by edit().

109  {
110  $values = array(
111  'title' => $this->table->getTitle(),
112  'add_perm' => $this->table->getAddPerm(),
113  'edit_perm' => $this->table->getEditPerm(),
114  'delete_perm' => $this->table->getDeletePerm(),
115  'edit_by_owner' => $this->table->getEditByOwner(),
116  'export_enabled' => $this->table->getExportEnabled(),
117  'limited' => $this->table->getLimited(),
118  'limit_start' => array("date" => substr($this->table->getLimitStart(),0,10), "time" => substr($this->table->getLimitStart(),-8)),
119  'limit_end' => array("date" => substr($this->table->getLimitEnd(),0,10), "time" => substr($this->table->getLimitEnd(),-8)),
120  'is_visible' => $this->table->getIsVisible(),
121  'description' => $this->table->getDescription(),
122  );
123  if(!$this->table->getLimitStart())
124  $values['limit_start'] = NULL;
125  if(!$this->table->getLimitEnd())
126  $values['limit_end'] = NULL;
127  $this->form->setValuesByArray($values);
128  }
+ Here is the caller graph for this function:

◆ initForm()

ilDataCollectionTableEditGUI::initForm (   $a_mode = "create")

initEditCustomForm

Parameters
string$a_mode

Definition at line 165 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl, $ilErr, $lng, $section, ilFormPropertyGUI\setRequired(), ilDateTimeInputGUI\setShowTime(), and ilTextAreaInputGUI\setUseRte().

Referenced by create(), edit(), and save().

166  {
167  global $ilCtrl, $ilErr, $lng;
168 
169  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
170  $this->form = new ilPropertyFormGUI();
171 
172  $item = new ilTextInputGUI($lng->txt('title'),'title');
173  $item->setRequired(true);
174  $this->form->addItem($item);
175  $item = new ilCheckboxInputGUI($lng->txt('dcl_visible'),'is_visible');
176  $this->form->addItem($item);
177 
178  $item = new ilTextAreaInputGUI($lng->txt('additional_info'), 'description');
179  $item->setUseRte(true);
180 // $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings');
181  $item->setRteTagSet('mini');
182  $this->form->addItem($item);
183 
185  $section->setTitle($lng->txt('dcl_permissions_form'));
186  $this->form->addItem($section);
187 
188  $item = new ilCustomInputGUI();
189  $item->setHtml($lng->txt('dcl_table_info'));
190  $item->setTitle($lng->txt('dcl_table_info_title'));
191  $this->form->addItem($item);
192 
193  $item = new ilCheckboxInputGUI($lng->txt('dcl_add_perm'),'add_perm');
194 // $item->setInfo($lng->txt("dcl_add_perm_info"));
195  $this->form->addItem($item);
196  $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_perm'),'edit_perm');
197 // $item->setInfo($lng->txt("dcl_edit_perm_info"));
198  $this->form->addItem($item);
199  $item = new ilCheckboxInputGUI($lng->txt('dcl_delete_perm'),'delete_perm');
200 // $item->setInfo($lng->txt("dcl_delete_perm_info"));
201  $this->form->addItem($item);
202  $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_by_owner'),'edit_by_owner');
203 // $item->setInfo($lng->txt("dcl_edit_by_owner_info"));
204  $this->form->addItem($item);
205 
206  $item = new ilCheckboxInputGUI($lng->txt('dcl_export_enabled'), 'export_enabled');
207  $this->form->addItem($item);
208 
209  $item = new ilCheckboxInputGUI($lng->txt('dcl_limited'),'limited');
210  $sitem1 = new ilDateTimeInputGUI($lng->txt('dcl_limit_start'),'limit_start');
211  $sitem1->setShowTime(true);
212  $sitem2 = new ilDateTimeInputGUI($lng->txt('dcl_limit_end'),'limit_end');
213  $sitem2->setShowTime(true);
214 // $item->setInfo($lng->txt("dcl_limited_info"));
215  $item->addSubItem($sitem1);
216  $item->addSubItem($sitem2);
217  $this->form->addItem($item);
218  if($a_mode == "edit")
219  {
220  $this->form->addCommandButton('update', $lng->txt('dcl_table_'.$a_mode));
221  }
222  else
223  {
224  $this->form->addCommandButton('save', $lng->txt('dcl_table_'.$a_mode));
225  }
226 
227  $this->form->addCommandButton('cancel', $lng->txt('cancel'));
228  $this->form->setFormAction($ilCtrl->getFormAction($this, $a_mode));
229  if($a_mode == "edit")
230  {
231  $this->form->setTitle($lng->txt('dcl_edit_table'));
232  }
233  else
234  {
235  $this->form->setTitle($lng->txt('dcl_new_table'));
236  }
237  }
This class represents a property form user interface.
This class represents a section header in a property form.
setUseRte($a_usert, $version='')
Set Use Rich Text Editing.
This class represents a checkbox property in a property form.
This class represents a date/time property in a property form.
global $ilCtrl
Definition: ilias.php:18
$section
Definition: Utf8Test.php:84
This class represents a text property in a property form.
This class represents a custom property in a property form.
global $lng
Definition: privfeed.php:40
This class represents a text area property in a property form.
setRequired($a_required)
Set Required.
setShowTime($a_showtime)
Set Show Time Information.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDataCollectionTableEditGUI::save (   $a_mode = "create")

save

Parameters
string$a_modevalues: create | edit

Definition at line 245 of file class.ilDataCollectionTableEditGUI.php.

References $ilCtrl, $lng, $tpl, ilObjDataCollection\_checkAccess(), accessDenied(), checkInput(), ilDataCollectionCache\getTableCache(), initForm(), and ilUtil\sendSuccess().

Referenced by executeCommand().

246  {
247  global $ilCtrl, $ilTabs, $lng;
248 
249  if(!ilObjDataCollection::_checkAccess($this->obj_id))
250  {
251  $this->accessDenied();
252  return;
253  }
254 
255  $ilTabs->activateTab("id_fields");
256 
257  $this->initForm($a_mode);
258 
259  if($this->checkInput($a_mode))
260  {
261  if($a_mode != "update")
262  {
263  $this->table = ilDataCollectionCache::getTableCache();
264  }
265  elseif($this->table_id)
266  {
267  $this->table = ilDataCollectionCache::getTableCache($this->table_id);
268  }
269  else
270  {
271  $ilCtrl->redirectByClass("ildatacollectionfieldeditgui", "listFields");
272  }
273 
274 
275  $this->table->setTitle($this->form->getInput("title"));
276  $this->table->setObjId($this->obj_id);
277  $this->table->setIsVisible($this->form->getInput("is_visible"));
278  $this->table->setAddPerm($this->form->getInput("add_perm"));
279  $this->table->setEditPerm($this->form->getInput("edit_perm"));
280  $this->table->setDeletePerm($this->form->getInput("delete_perm"));
281  $this->table->setEditByOwner($this->form->getInput("edit_by_owner"));
282  $this->table->setExportEnabled($this->form->getInput("export_enabled"));
283  $this->table->setDescription($this->form->getInput('description'));
284  $this->table->setLimited($this->form->getInput("limited"));
285  $limit_start = $this->form->getInput("limit_start");
286  $limit_end = $this->form->getInput("limit_end");
287  $this->table->setLimitStart($limit_start["date"]." ".$limit_start["time"]);
288  $this->table->setLimitEnd($limit_end["date"]." ".$limit_end["time"]);
289 
290  if(!$this->table->hasPermissionToAddTable($this->parent_object->ref_id))
291  {
292  $this->accessDenied();
293  return;
294  }
295  if($a_mode == "update")
296  {
297  $this->table->doUpdate();
298  ilUtil::sendSuccess($lng->txt("dcl_msg_table_edited"), true);
299  $ilCtrl->redirectByClass("ildatacollectiontableeditgui", "edit");
300  }
301  else
302  {
303 
304 
305 
306  $this->table->doCreate();
307  ilUtil::sendSuccess($lng->txt("dcl_msg_table_created"), true);
308  $ilCtrl->setParameterByClass("ildatacollectionfieldlistgui","table_id", $this->table->getId());
309  $ilCtrl->redirectByClass("ildatacollectionfieldlistgui", "listFields");
310  }
311  }
312  else
313  {
314  global $tpl;
315  $this->form->setValuesByPost();
316  $tpl->setContent($this->form->getHTML());
317  }
318  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _checkAccess($data_collection_id)
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
checkInput($a_mode)
Custom checks for the form input.
initForm($a_mode="create")
initEditCustomForm
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $table

ilDataCollectionTableEditGUI::$table
private

Definition at line 27 of file class.ilDataCollectionTableEditGUI.php.

◆ $table_id

ilDataCollectionTableEditGUI::$table_id
private

Definition at line 23 of file class.ilDataCollectionTableEditGUI.php.


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