3require_once(
"./Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldModel.php");
 
    4require_once(
"./Modules/DataCollection/classes/Fields/Base/class.ilDclDatatype.php");
 
    5require_once(
"./Modules/DataCollection/classes/Table/class.ilDclTable.php");
 
    6require_once(
"./Modules/DataCollection/classes/Helpers/class.ilDclCache.php");
 
    7require_once(
'./Services/Form/classes/class.ilNonEditableValueGUI.php');
 
    8require_once(
"./Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php");
 
    9require_once(
'./Modules/DataCollection/classes/Fields/Plugin/class.ilDclFieldTypePlugin.php');
 
   66                $this->obj_id = $a_parent_obj->obj_id;
 
   67                $this->parent_obj = $a_parent_obj;
 
   69                $this->table_id = 
$_GET[
"table_id"];
 
   70                $this->field_id = 
$_GET[
'field_id'];
 
   72                if ($this->field_id) {
 
   77                                $datatype = 
$_POST[
'datatype'];
 
   80                        if (!$this->table_id) {
 
   81                                $ilCtrl->redirectByClass(
"ilDclTableListGUI", 
"listFields");
 
   83                        $this->field_obj->setTableId($this->table_id);
 
   84                        $ilCtrl->saveParameter($this, 
"table_id");
 
   97                $ilCtrl->saveParameter($this, 
'field_id');
 
  109                                $this->
save(
"update");
 
  128                $tpl->setContent($this->form->getHTML());
 
  142                $tpl->setContent($this->form->getHTML());
 
  152                $tpl->setContent(
"Permission denied");
 
  165                include_once 
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  167                $conf->setFormAction(
$ilCtrl->getFormAction($this));
 
  168                $conf->setHeaderText(
$lng->txt(
'dcl_confirm_delete_field'));
 
  170                $conf->addItem(
'field_id', (
int)$this->field_obj->getId(), $this->field_obj->getTitle());
 
  172                $conf->setConfirm(
$lng->txt(
'delete'), 
'delete');
 
  173                $conf->setCancel(
$lng->txt(
'cancel'), 
'cancelDelete');
 
  175                $tpl->setContent($conf->getHTML());
 
  186                $ilCtrl->redirectByClass(
"ildclfieldlistgui", 
"listFields");
 
  193        public function delete() {
 
  197                $this->table->deleteField($this->field_obj->getId());
 
  198                $ilCtrl->redirectByClass(
"ildclfieldlistgui", 
"listFields");
 
  208                $ilCtrl->redirectByClass(
"ildclfieldlistgui", 
"listFields");
 
  222                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  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);
 
  278                $this->form->addItem($cb);
 
  282        $cb->setInfo(
$lng->txt(
'dcl_unique_desc'));
 
  283                $this->form->addItem($cb);
 
  293                        'table_id' => $this->field_obj->getTableId(),
 
  294                        'field_id' => $this->field_obj->getId(),
 
  295                        'title' => $this->field_obj->getTitle(),
 
  296                        'datatype' => $this->field_obj->getDatatypeId(),
 
  297                        'description' => $this->field_obj->getDescription(),
 
  298                        'required' => $this->field_obj->getRequired(),
 
  299                        'unique' => $this->field_obj->isUnique(),
 
  302                $properties = $this->field_obj->getValidFieldProperties();
 
  303                foreach ($properties as $prop) {
 
  304                        $values[
'prop_' . $prop] = $this->field_obj->getProperty($prop);
 
  307                $this->form->setValuesByArray($values);
 
  318        public function save($a_mode = 
"create") {
 
  324                $this->
initForm($a_mode == 
"update" ? 
"edit" : 
"create");
 
  327                        $title = $this->form->getInput(
"title");
 
  328                        if ($a_mode != 
"create" && 
$title != $this->field_obj->getTitle()) {
 
  332                        $this->field_obj->setTitle(
$title);
 
  333                        $this->field_obj->setDescription($this->form->getInput(
"description"));
 
  334                        $this->field_obj->setDatatypeId($this->form->getInput(
"datatype"));
 
  335                        $this->field_obj->setRequired($this->form->getInput(
"required"));
 
  336                        $this->field_obj->setUnique($this->form->getInput(
"unique"));
 
  338                        if ($a_mode == 
"update") {
 
  339                                $this->field_obj->doUpdate();
 
  341                                $this->field_obj->setOrder($this->table->getNewFieldOrder());
 
  342                                $this->field_obj->doCreate();
 
  346                        $field_props = $this->field_obj->getValidFieldProperties();
 
  347                        foreach ($field_props as $property) {
 
  349                                $value = $this->form->getInput($representation->getPropertyInputFieldId($property));
 
  353                                        $this->field_obj->setProperty($property, $value)->store();
 
  357                        $ilCtrl->setParameter($this, 
"field_id", $this->field_obj->getId());
 
  359                        if ($a_mode == 
"update") {
 
  362                                $this->table->addField($this->field_obj);
 
  363                                $this->table->buildOrderFields();
 
  366                        $ilCtrl->redirectByClass(strtolower(
"ilDclFieldListGUI"), 
"listFields");
 
  368                        $this->form->setValuesByPost();
 
  369                        $tpl->setContent($this->form->getHTML());
 
  384                $return = $this->form->checkInput();
 
  387                $datatype_id = $this->form->getInput(
'datatype');
 
  388                if($datatype_id != 
null && is_numeric($datatype_id)) {
 
  390                        $base_model->setDatatypeId($datatype_id);
 
  393                        if(!$field_validation_class->checkFieldCreationInput($this->form)) {
 
  399                if ($a_mode == 
'create') {
 
  400                        if (
$title = $this->form->getInput(
'title')) {
 
  402                                        $inputObj = $this->form->getItemByPostVar(
'title');
 
  403                                        $inputObj->setAlert(
$lng->txt(
"dcl_field_title_unique"));
 
  421                if ($field_id = $this->field_obj->getId()) {
 
  432                return $this->parent_obj->getDataCollectionObject();
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
Class ilDclBaseFieldModel.
const PROP_PLUGIN_HOOK_NAME
static _getTitleInvalidChars($a_as_regex=true)
All valid chars for filed titles.
static getTableCache($table_id=0)
static getFieldCache($field_id=0)
static getAllDatatype()
Get all possible Datatypes.
save($a_mode="create")
save Field
getDataCollectionObject()
edit()
create field edit form
create()
create field add form
confirmDelete()
confirmDelete
__construct(ilDclTableListGUI $a_parent_obj)
Constructor.
initForm($a_mode="create")
initEditCustomForm
executeCommand()
execute command
getValues()
getFieldValues
checkInput($a_mode)
Check input of form.
cancelDelete()
cancelDelete
static getFieldModelInstance($field_id, $datatype=null)
Get FieldModel from field-id and datatype.
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
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...
static _hasFieldByTitle($title, $obj_id)
Checks if a table has a field with the given title.
static hasAccessToFields($ref_id, $table_id)
static hasAccessToField($ref_id, $table_id, $field_id)
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.