56 $ilCtrl = $DIC[
'ilCtrl'];
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");
89 $ilCtrl = $DIC[
'ilCtrl'];
90 $ilCtrl->saveParameter($this,
'field_id');
92 $cmd = $ilCtrl->getCmd();
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");
159 $ilCtrl = $DIC[
'ilCtrl'];
164 $conf->setFormAction($ilCtrl->getFormAction($this));
165 $conf->setHeaderText(
$lng->txt(
'dcl_confirm_delete_field'));
167 $conf->addItem(
'field_id', (
int) $this->field_obj->getId(), $this->field_obj->getTitle());
169 $conf->setConfirm(
$lng->txt(
'delete'),
'delete');
170 $conf->setCancel(
$lng->txt(
'cancel'),
'cancelDelete');
172 $tpl->setContent($conf->getHTML());
182 $ilCtrl = $DIC[
'ilCtrl'];
184 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
191 public function delete()
194 $ilCtrl = $DIC[
'ilCtrl'];
196 $this->table->deleteField($this->field_obj->getId());
197 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
207 $ilCtrl = $DIC[
'ilCtrl'];
208 $ilCtrl->redirectByClass(
"ildclfieldlistgui",
"listFields");
220 $ilCtrl = $DIC[
'ilCtrl'];
225 if ($a_mode ==
"edit") {
226 $this->form->setTitle(
$lng->txt(
'dcl_edit_field'));
228 $this->form->addItem($hidden_prop);
230 $this->form->setFormAction($ilCtrl->getFormAction($this),
"update");
232 $this->form->addCommandButton(
'update',
$lng->txt(
'dcl_update_field'));
234 $this->form->setTitle(
$lng->txt(
'dcl_new_field'));
236 $hidden_prop->setValue($this->field_obj->getTableId());
237 $this->form->addItem($hidden_prop);
239 $this->form->setFormAction($ilCtrl->getFormAction($this),
"save");
241 $this->form->addCommandButton(
'save',
$lng->txt(
'dcl_create_field'));
243 $this->form->addCommandButton(
'cancel',
$lng->txt(
'cancel'));
246 $text_prop->setRequired(
true);
249 $this->form->addItem($text_prop);
253 $this->form->addItem($text_prop);
259 $model->setDatatypeId($datatype->getId());
261 if ($a_mode ==
'edit' && $datatype->getId() == $this->field_obj->getDatatypeId()) {
268 $edit_datatype->setRequired(
true);
271 if ($a_mode ==
"edit") {
272 $edit_datatype->setDisabled(
true);
274 $this->form->addItem($edit_datatype);
279 $this->form->addItem($cb);
288 public function save($a_mode =
"create")
291 $ilCtrl = $DIC[
'ilCtrl'];
295 $this->
initForm($a_mode ==
"update" ?
"edit" :
"create");
300 if (($a_mode ==
"update") && !($this->form->getInput(
'confirmed')) && $this->field_obj->isConfirmationRequired($this->form)) {
301 $ilConfirmationGUI = $this->field_obj->getConfirmationGUI($this->form);
302 $tpl->setContent($ilConfirmationGUI->getHTML());
307 $title = $this->form->getInput(
"title");
308 if ($a_mode !=
"create" && $title != $this->field_obj->getTitle()) {
312 $this->field_obj->setTitle($title);
313 $this->field_obj->setDescription($this->form->getInput(
"description"));
314 $this->field_obj->setDatatypeId($this->form->getInput(
"datatype"));
315 $this->field_obj->setUnique($this->form->getInput(
"unique"));
317 if ($a_mode ==
"update") {
318 $this->field_obj->doUpdate();
320 $this->field_obj->setOrder($this->table->getNewFieldOrder());
321 $this->field_obj->doCreate();
325 $this->field_obj->storePropertiesFromForm($this->form);
327 $ilCtrl->setParameter($this,
"field_id", $this->field_obj->getId());
329 if ($a_mode ==
"update") {
330 ilUtil::sendSuccess(
$lng->txt(
"dcl_msg_field_modified"),
true);
332 $this->table->addField($this->field_obj);
333 $this->table->buildOrderFields();
334 ilUtil::sendSuccess(
$lng->txt(
"msg_field_created"),
false);
336 $ilCtrl->redirectByClass(strtolower(
"ilDclFieldListGUI"),
"listFields");
338 $this->form->setValuesByPost();
339 $tpl->setContent($this->form->getHTML());
355 $return = $this->form->checkInput();
358 $datatype_id = $this->form->getInput(
'datatype');
359 if ($datatype_id != null && is_numeric($datatype_id)) {
361 $base_model->setDatatypeId($datatype_id);
364 if (!$field_validation_class->checkFieldCreationInput($this->form)) {
370 if ($a_mode ==
'create') {
371 if ($title = $this->form->getInput(
'title')) {
373 $inputObj = $this->form->getItemByPostVar(
'title');
374 $inputObj->setAlert(
$lng->txt(
"dcl_field_title_unique"));
393 if ($field_id = $this->field_obj->getId()) {
406 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)
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.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static hasAccessToField($ref_id, $table_id, $field_id)
Confirmation screen class.