39        $this->main_tpl = 
$DIC->ui()->mainTemplate();
 
   40        $ilCtrl = 
$DIC[
'ilCtrl'];
 
   42        $this->obj_id = $a_parent_obj->
getObjId();
 
   43        $this->parent_obj = $a_parent_obj;
 
   44        $this->
http = $DIC->http();
 
   47        $this->table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
 
   49        $hasFieldId = $this->
http->wrapper()->query()->has(
'field_id');
 
   51            $this->field_id = $this->
http->wrapper()->query()->retrieve(
'field_id', $this->
refinery->kindlyTo()->int());
 
   56        if ($this->field_id) {
 
   61            $has_datatype = $this->
http->wrapper()->post()->has(
'datatype');
 
   64                $datatype_value = $this->
http->wrapper()->post()->retrieve(
 
   66                    $this->
refinery->kindlyTo()->string()
 
   72                    $datatype = $datatype_value;
 
   76            if (!$this->table_id) {
 
   77                $ilCtrl->redirectByClass(
"ilDclTableListGUI", 
"listFields");
 
   79            $this->field_obj->setTableId($this->table_id);
 
   80            $ilCtrl->saveParameter($this, 
"table_id");
 
   92        $ilCtrl = 
$DIC[
'ilCtrl'];
 
   93        $ilCtrl->saveParameter($this, 
'field_id');
 
   95        $cmd = $ilCtrl->getCmd();
 
  104                $this->
save(
"update");
 
  121        $tpl->setContent($this->
form->getHTML());
 
  134        $this->field_obj->fillPropertiesForm($this->
form);
 
  136        $tpl->setContent($this->
form->getHTML());
 
  146        $tpl->setContent(
"Permission denied");
 
  155        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  160        $conf->setFormAction($ilCtrl->getFormAction($this));
 
  161        $conf->setHeaderText(
$lng->txt(
'dcl_confirm_delete_field'));
 
  163        $conf->addItem(
'field_id', (
int) $this->field_obj->getId(), $this->field_obj->getTitle());
 
  165        $conf->setConfirm(
$lng->txt(
'delete'), 
'delete');
 
  166        $conf->setCancel(
$lng->txt(
'cancel'), 
'cancelDelete');
 
  168        $tpl->setContent($conf->getHTML());
 
  177        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  179        $ilCtrl->redirectByClass(
"ildclfieldlistgui", 
"listFields");
 
  185    public function delete(): 
void 
  188        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  190        $this->table->deleteField($this->field_obj->getId());
 
  191        $ilCtrl->redirectByClass(
"ildclfieldlistgui", 
"listFields");
 
  200        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  201        $ilCtrl->redirectByClass(
"ildclfieldlistgui", 
"listFields");
 
  208    public function initForm(
string $a_mode = 
"create"): void
 
  211        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  216        if ($a_mode == 
"edit") {
 
  217            $this->
form->setTitle(
$lng->txt(
'dcl_edit_field'));
 
  219            $this->
form->addItem($hidden_prop);
 
  221            $this->
form->setFormAction($ilCtrl->getFormAction($this));
 
  223            $this->
form->addCommandButton(
'update', 
$lng->txt(
'dcl_update_field'));
 
  225            $this->
form->setTitle(
$lng->txt(
'dcl_new_field'));
 
  227            $hidden_prop->setValue($this->field_obj->getTableId());
 
  228            $this->
form->addItem($hidden_prop);
 
  230            $this->
form->setFormAction($ilCtrl->getFormAction($this));
 
  232            $this->
form->addCommandButton(
'save', 
$lng->txt(
'dcl_create_field'));
 
  234        $this->
form->addCommandButton(
'cancel', 
$lng->txt(
'cancel'));
 
  237        $text_prop->setRequired(
true);
 
  238        $text_prop->setInfo(sprintf(
 
  239            $lng->txt(
'fieldtitle_allow_chars'),
 
  243        $this->
form->addItem($text_prop);
 
  247        $this->
form->addItem($text_prop);
 
  253            $model->setDatatypeId($datatype->getId());
 
  256            if ($a_mode == 
'edit' && $datatype->getId() === $this->field_obj->getDatatypeId()) {
 
  263        $edit_datatype->setRequired(
true);
 
  266        if ($a_mode == 
"edit") {
 
  267            $edit_datatype->setDisabled(
true);
 
  269        $this->
form->addItem($edit_datatype);
 
  273        $cb->setInfo(
$lng->txt(
'dcl_unique_desc'));
 
  274        $this->
form->addItem($cb);
 
  281    public function save(
string $a_mode = 
"create"): void
 
  284        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  288        $this->
initForm($a_mode == 
"update" ? 
"edit" : 
"create");
 
  293            if (($a_mode == 
"update") && !($this->
form->getInput(
'confirmed')) && $this->field_obj->isConfirmationRequired($this->form)) {
 
  294                $ilConfirmationGUI = $this->field_obj->getConfirmationGUI($this->
form);
 
  295                $tpl->setContent($ilConfirmationGUI->getHTML());
 
  300            $title = $this->
form->getInput(
"title");
 
  301            if ($a_mode != 
"create" && $title != $this->field_obj->getTitle()) {
 
  302                $this->main_tpl->setOnScreenMessage(
'info', 
$lng->txt(
"dcl_field_title_change_warning"), 
true);
 
  305            $this->field_obj->setTitle($title);
 
  306            $this->field_obj->setDescription($this->
form->getInput(
"description"));
 
  307            $this->field_obj->setDatatypeId($this->
form->getInput(
"datatype"));
 
  308            $this->field_obj->setUnique($this->
form->getInput(
"unique"));
 
  310            if ($a_mode == 
"update") {
 
  311                $this->field_obj->doUpdate();
 
  313                $this->field_obj->setOrder($this->table->getNewFieldOrder());
 
  314                $this->field_obj->doCreate();
 
  318            $this->field_obj->storePropertiesFromForm($this->
form);
 
  320            $ilCtrl->setParameter($this, 
"field_id", $this->field_obj->getId());
 
  322            if ($a_mode == 
"update") {
 
  323                $this->main_tpl->setOnScreenMessage(
'success', 
$lng->txt(
"dcl_msg_field_modified"), 
true);
 
  325                $this->table->addField($this->field_obj);
 
  326                $this->table->buildOrderFields();
 
  327                $this->main_tpl->setOnScreenMessage(
'success', 
$lng->txt(
"msg_field_created"), 
false);
 
  329            $ilCtrl->redirectByClass(strtolower(
"ilDclFieldListGUI"), 
"listFields");
 
  331            $this->
form->setValuesByPost();
 
  332            $tpl->setContent($this->
form->getHTML());
 
  345        $return = $this->
form->checkInput();
 
  348        $datatype_id = $this->
form->getInput(
'datatype');
 
  349        if ($datatype_id != 
null && is_numeric($datatype_id)) {
 
  351            $base_model->setDatatypeId($datatype_id);
 
  354            if (!$field_validation_class->checkFieldCreationInput($this->form)) {
 
  360        if ($a_mode == 
'create') {
 
  361            if ($title = $this->
form->getInput(
'title')) {
 
  363                    $inputObj = $this->
form->getItemByPostVar(
'title');
 
  364                    $inputObj->setAlert(
$lng->txt(
"dcl_field_title_unique"));
 
  371            $this->main_tpl->setOnScreenMessage(
'failure', 
$lng->txt(
"form_input_not_valid"));
 
  382        if (
$field_id = $this->field_obj->getId()) {
 
  401        return $this->parent_obj->getDataCollectionObject();
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _getTitleInvalidChars(bool $a_as_regex=true)
All valid chars for filed titles.
 
static getFieldCache(int $field_id=0)
 
static getTableCache(int $table_id=null)
 
static getAllDatatype(bool $force=false)
Get all possible Datatypes.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getDataCollectionObject()
 
save(string $a_mode="create")
save Field
 
edit()
create field edit form
 
create()
create field add form
 
confirmDelete()
confirmDelete
 
__construct(ilDclTableListGUI $a_parent_obj)
Constructor.
 
ilDclTableListGUI $parent_obj
 
ilDclBaseFieldModel $field_obj
 
executeCommand()
execute command
 
ilGlobalTemplateInterface $main_tpl
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
initForm(string $a_mode="create")
initEditCustomForm
 
checkInput(string $a_mode)
Check input of form.
 
cancelDelete()
cancelDelete
 
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
 
static getFieldModelInstanceByClass(ilDclBaseFieldModel $field, ?int $field_id=null)
Gets the correct instance of a fieldModel class Checks if a field is a plugin a replaces the fieldMod...
 
static getFieldModelInstance(int $field_id, ?int $datatype=null)
Get FieldModel from field-id and datatype.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _hasFieldByTitle(string $title, int $obj_id)
Checks if a table has a field with the given title.
 
static hasAccessToFields(int $ref_id, int $table_id)
 
static hasAccessToField(int $ref_id, int $table_id, int $field_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This class represents a text area property in a property form.
 
This class represents a text property in a property form.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
 
static http()
Fetches the global http state from ILIAS.
 
form( $class_path, string $cmd)