58 $this->obj_id = $a_parent_obj->obj_id;
59 $this->parent_obj = $a_parent_obj;
61 $this->table_id =
$_GET[
"table_id"];
62 $this->field_id =
$_GET[
'field_id'];
64 if ($this->field_id) {
69 $datatype =
$_POST[
'datatype'];
72 if (!$this->table_id) {
73 $ilCtrl->redirectByClass(
"ilDclTableListGUI",
"listFields");
75 $this->field_obj->setTableId($this->table_id);
76 $ilCtrl->saveParameter($this,
"table_id");
90 $ilCtrl->saveParameter($this,
'field_id');
102 $this->
save(
"update");
122 $tpl->setContent($this->form->getHTML());
136 $this->field_obj->fillPropertiesForm($this->form);
138 $tpl->setContent($this->form->getHTML());
149 $tpl->setContent(
"Permission denied");
163 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
165 $conf->setFormAction(
$ilCtrl->getFormAction($this));
166 $conf->setHeaderText(
$lng->txt(
'dcl_confirm_delete_field'));
168 $conf->addItem(
'field_id', (
int) $this->field_obj->getId(), $this->field_obj->getTitle());
170 $conf->setConfirm(
$lng->txt(
'delete'),
'delete');
171 $conf->setCancel(
$lng->txt(
'cancel'),
'cancelDelete');
173 $tpl->setContent($conf->getHTML());
185 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
192 public function delete()
197 $this->table->deleteField($this->field_obj->getId());
198 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
209 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
224 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
227 if ($a_mode ==
"edit") {
228 $this->form->setTitle(
$lng->txt(
'dcl_edit_field'));
230 $this->form->addItem($hidden_prop);
232 $this->form->setFormAction(
$ilCtrl->getFormAction($this),
"update");
234 $this->form->addCommandButton(
'update',
$lng->txt(
'dcl_update_field'));
236 $this->form->setTitle(
$lng->txt(
'dcl_new_field'));
238 $hidden_prop->setValue($this->field_obj->getTableId());
239 $this->form->addItem($hidden_prop);
241 $this->form->setFormAction(
$ilCtrl->getFormAction($this),
"save");
243 $this->form->addCommandButton(
'save',
$lng->txt(
'dcl_create_field'));
245 $this->form->addCommandButton(
'cancel',
$lng->txt(
'cancel'));
251 $this->form->addItem($text_prop);
255 $this->form->addItem($text_prop);
261 $model->setDatatypeId($datatype->getId());
263 if ($a_mode ==
'edit' && $datatype->getId() == $this->field_obj->getDatatypeId()) {
270 $edit_datatype->setRequired(
true);
273 if ($a_mode ==
"edit") {
274 $edit_datatype->setDisabled(
true);
276 $this->form->addItem($edit_datatype);
280 $this->form->addItem($cb);
285 $this->form->addItem($cb);
294 public function save($a_mode =
"create")
301 $this->
initForm($a_mode ==
"update" ?
"edit" :
"create");
306 if (($a_mode ==
"update") && !($this->form->getInput(
'confirmed')) && $this->field_obj->isConfirmationRequired($this->form)) {
307 $ilConfirmationGUI = $this->field_obj->getConfirmationGUI($this->form);
308 $tpl->setContent($ilConfirmationGUI->getHTML());
313 $title = $this->form->getInput(
"title");
314 if ($a_mode !=
"create" &&
$title != $this->field_obj->getTitle()) {
318 $this->field_obj->setTitle(
$title);
319 $this->field_obj->setDescription($this->form->getInput(
"description"));
320 $this->field_obj->setDatatypeId($this->form->getInput(
"datatype"));
321 $this->field_obj->setRequired($this->form->getInput(
"required"));
322 $this->field_obj->setUnique($this->form->getInput(
"unique"));
324 if ($a_mode ==
"update") {
325 $this->field_obj->doUpdate();
327 $this->field_obj->setOrder($this->table->getNewFieldOrder());
328 $this->field_obj->doCreate();
332 $this->field_obj->storePropertiesFromForm($this->form);
334 $ilCtrl->setParameter($this,
"field_id", $this->field_obj->getId());
336 if ($a_mode ==
"update") {
337 ilUtil::sendSuccess(
$lng->txt(
"dcl_msg_field_modified"),
true);
339 $this->table->addField($this->field_obj);
340 $this->table->buildOrderFields();
341 ilUtil::sendSuccess(
$lng->txt(
"msg_field_created"),
false);
343 $ilCtrl->redirectByClass(strtolower(
"ilDclFieldListGUI"),
"listFields");
345 $this->form->setValuesByPost();
346 $tpl->setContent($this->form->getHTML());
362 $return = $this->form->checkInput();
365 $datatype_id = $this->form->getInput(
'datatype');
366 if ($datatype_id != null && is_numeric($datatype_id)) {
368 $base_model->setDatatypeId($datatype_id);
371 if (!$field_validation_class->checkFieldCreationInput($this->form)) {
377 if ($a_mode ==
'create') {
378 if (
$title = $this->form->getInput(
'title')) {
380 $inputObj = $this->form->getItemByPostVar(
'title');
381 $inputObj->setAlert(
$lng->txt(
"dcl_field_title_unique"));
400 if ($field_id = $this->field_obj->getId()) {
412 return $this->parent_obj->getDataCollectionObject();
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.