61 $this->obj_id = $a_parent_obj->obj_id;
62 $this->parent_obj = $a_parent_obj;
64 $this->table_id =
$_GET[
"table_id"];
65 $this->field_id =
$_GET[
'field_id'];
67 if ($this->field_id) {
72 $datatype =
$_POST[
'datatype'];
75 if (!$this->table_id) {
76 $ilCtrl->redirectByClass(
"ilDclTableListGUI",
"listFields");
78 $this->field_obj->setTableId($this->table_id);
79 $ilCtrl->saveParameter($this,
"table_id");
93 $ilCtrl->saveParameter($this,
'field_id');
105 $this->
save(
"update");
125 $tpl->setContent($this->form->getHTML());
139 $this->field_obj->fillPropertiesForm($this->form);
141 $tpl->setContent($this->form->getHTML());
152 $tpl->setContent(
"Permission denied");
166 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
168 $conf->setFormAction(
$ilCtrl->getFormAction($this));
169 $conf->setHeaderText(
$lng->txt(
'dcl_confirm_delete_field'));
171 $conf->addItem(
'field_id', (
int) $this->field_obj->getId(), $this->field_obj->getTitle());
173 $conf->setConfirm(
$lng->txt(
'delete'),
'delete');
174 $conf->setCancel(
$lng->txt(
'cancel'),
'cancelDelete');
176 $tpl->setContent($conf->getHTML());
188 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
195 public function delete()
200 $this->table->deleteField($this->field_obj->getId());
201 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
212 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
227 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
230 if ($a_mode ==
"edit") {
231 $this->form->setTitle(
$lng->txt(
'dcl_edit_field'));
233 $this->form->addItem($hidden_prop);
235 $this->form->setFormAction(
$ilCtrl->getFormAction($this),
"update");
237 $this->form->addCommandButton(
'update',
$lng->txt(
'dcl_update_field'));
239 $this->form->setTitle(
$lng->txt(
'dcl_new_field'));
241 $hidden_prop->setValue($this->field_obj->getTableId());
242 $this->form->addItem($hidden_prop);
244 $this->form->setFormAction(
$ilCtrl->getFormAction($this),
"save");
246 $this->form->addCommandButton(
'save',
$lng->txt(
'dcl_create_field'));
248 $this->form->addCommandButton(
'cancel',
$lng->txt(
'cancel'));
254 $this->form->addItem($text_prop);
258 $this->form->addItem($text_prop);
264 $model->setDatatypeId($datatype->getId());
266 if ($a_mode ==
'edit' && $datatype->getId() == $this->field_obj->getDatatypeId()) {
273 $edit_datatype->setRequired(
true);
276 if ($a_mode ==
"edit") {
277 $edit_datatype->setDisabled(
true);
279 $this->form->addItem($edit_datatype);
283 $this->form->addItem($cb);
288 $this->form->addItem($cb);
297 public function save($a_mode =
"create")
304 $this->
initForm($a_mode ==
"update" ?
"edit" :
"create");
309 if (($a_mode ==
"update") && !($this->form->getInput(
'confirmed')) && $this->field_obj->isConfirmationRequired($this->form)) {
310 $ilConfirmationGUI = $this->field_obj->getConfirmationGUI($this->form);
311 $tpl->setContent($ilConfirmationGUI->getHTML());
315 $title = $this->form->getInput(
"title");
316 if ($a_mode !=
"create" &&
$title != $this->field_obj->getTitle()) {
320 $this->field_obj->setTitle(
$title);
321 $this->field_obj->setDescription($this->form->getInput(
"description"));
322 $this->field_obj->setDatatypeId($this->form->getInput(
"datatype"));
323 $this->field_obj->setRequired($this->form->getInput(
"required"));
324 $this->field_obj->setUnique($this->form->getInput(
"unique"));
326 if ($a_mode ==
"update") {
327 $this->field_obj->doUpdate();
329 $this->field_obj->setOrder($this->table->getNewFieldOrder());
330 $this->field_obj->doCreate();
334 $this->field_obj->storePropertiesFromForm($this->form);
337 $ilCtrl->setParameter($this,
"field_id", $this->field_obj->getId());
339 if ($a_mode ==
"update") {
342 $this->table->addField($this->field_obj);
343 $this->table->buildOrderFields();
346 $ilCtrl->redirectByClass(strtolower(
"ilDclFieldListGUI"),
"listFields");
348 $this->form->setValuesByPost();
349 $tpl->setContent($this->form->getHTML());
365 $return = $this->form->checkInput();
368 $datatype_id = $this->form->getInput(
'datatype');
369 if ($datatype_id != null && is_numeric($datatype_id)) {
371 $base_model->setDatatypeId($datatype_id);
374 if (!$field_validation_class->checkFieldCreationInput($this->form)) {
380 if ($a_mode ==
'create') {
381 if (
$title = $this->form->getInput(
'title')) {
383 $inputObj = $this->form->getItemByPostVar(
'title');
384 $inputObj->setAlert(
$lng->txt(
"dcl_field_title_unique"));
403 if ($field_id = $this->field_obj->getId()) {
415 return $this->parent_obj->getDataCollectionObject();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getDataCollectionObject()
Class ilDclBaseFieldModel.
confirmDelete()
confirmDelete
static _getTitleInvalidChars($a_as_regex=true)
All valid chars for filed titles.
static getAllDatatype()
Get all possible Datatypes.
static _hasFieldByTitle($title, $obj_id)
Checks if a table has a field with the given title.
static getFieldCache($field_id=0)
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
edit()
create field edit form
create()
create field add form
static getTableCache($table_id=0)
save($a_mode="create")
save Field
initForm($a_mode="create")
initEditCustomForm
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct(ilDclTableListGUI $a_parent_obj)
Constructor.
executeCommand()
execute command
static getFieldModelInstance($field_id, $datatype=null)
Get FieldModel from field-id and datatype.
static hasAccessToFields($ref_id, $table_id)
This class represents a text property in a property form.
checkInput($a_mode)
Check input of form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getFieldModelInstanceByClass(ilDclBaseFieldModel $field, $field_id=null)
Gets the correct instance of a fieldModel class Checks if a field is a plugin a replaces the fieldMod...
cancelDelete()
cancelDelete
This class represents a text area property in a property form.
static hasAccessToField($ref_id, $table_id, $field_id)
Confirmation screen class.