3require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionField.php");
 
    4require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionDatatype.php");
 
    5require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
 
    6require_once 
"class.ilDataCollectionCache.php";
 
    7require_once(
'./Services/Form/classes/class.ilNonEditableValueGUI.php');
 
   62                $this->obj_id = $a_parent_obj->obj_id;
 
   63                $this->parent_obj = $a_parent_obj;
 
   69                if (!isset($field_id)) {
 
   70                        $this->field_id = 
$_GET[
'field_id'];
 
   73                if (isset($field_id)) {
 
   78                                $ilCtrl->redirectByClass(
"ilDataCollectionGUI", 
"listFields");
 
   81                        $ilCtrl->saveParameter($this, 
"table_id");
 
   96                if (!$this->table->hasPermissionToFields($this->parent_obj->ref_id)) {
 
  104                                $this->
save(
"update");
 
  122                $tpl->setContent($this->form->getHTML());
 
  135                $tpl->setContent($this->form->getHTML());
 
  144                $tpl->setContent(
"Permission denied");
 
  154                include_once 
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  156                $conf->setFormAction(
$ilCtrl->getFormAction($this));
 
  157                $conf->setHeaderText(
$lng->txt(
'dcl_confirm_delete_field'));
 
  159                $conf->addItem(
'field_id', (
int)$this->field_obj->getId(), $this->field_obj->getTitle());
 
  161                $conf->setConfirm(
$lng->txt(
'delete'), 
'delete');
 
  162                $conf->setCancel(
$lng->txt(
'cancel'), 
'cancelDelete');
 
  164                $tpl->setContent($conf->getHTML());
 
  174                $ilCtrl->redirectByClass(
"ildatacollectionfieldlistgui", 
"listFields");
 
  181        public function delete() {
 
  184                $this->table->deleteField($this->field_obj->getId());
 
  185                $ilCtrl->redirectByClass(
"ildatacollectionfieldlistgui", 
"listFields");
 
  194                $ilCtrl->redirectByClass(
"ildatacollectionfieldlistgui", 
"listFields");
 
  206                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  209                if ($a_mode == 
"edit") {
 
  210                        $this->form->setTitle(
$lng->txt(
'dcl_edit_field'));
 
  212                        $this->form->addItem($hidden_prop);
 
  214                        $this->form->setFormAction(
$ilCtrl->getFormAction($this), 
"update");
 
  216                        $this->form->addCommandButton(
'update', 
$lng->txt(
'dcl_update_field'));
 
  218                        $this->form->setTitle(
$lng->txt(
'dcl_new_field'));
 
  220                        $hidden_prop->setValue($this->field_obj->getTableId());
 
  221                        $this->form->addItem($hidden_prop);
 
  223                        $this->form->setFormAction(
$ilCtrl->getFormAction($this), 
"save");
 
  225                        $this->form->addCommandButton(
'save', 
$lng->txt(
'dcl_create_field'));
 
  227                $this->form->addCommandButton(
'cancel', 
$lng->txt(
'cancel'));
 
  230                $text_prop->setRequired(
true);
 
  233                $this->form->addItem($text_prop);
 
  237        $this->form->addItem($text_prop);
 
  241                        $opt = 
new ilRadioOption(
$lng->txt(
'dcl_' . $datatype[
'title']), $datatype[
'id']);
 
  250                                        require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
 
  251                                        $tables = $this->parent_obj->getDataCollectionObject()->getTables();
 
  252                                        foreach ($tables as 
$table) {
 
  253                                                foreach (
$table->getRecordFields() as $field) {
 
  256                                                                $options[$field->getId()] = 
$table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle();
 
  260                                        $table_selection = 
new ilSelectInputGUI(
$lng->txt(
'dcl_reference_title'), 
'prop_' . $property[
'id']);
 
  261                                        $table_selection->setOptions(
$options);
 
  263                                        $opt->addSubItem($table_selection);
 
  269                                        require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
 
  270                                        $tables = $this->parent_obj->getDataCollectionObject()->getTables();
 
  271                                        foreach ($tables as 
$table) {
 
  272                                                foreach (
$table->getRecordFields() as $field) {
 
  275                                                                $options[$field->getId()] = 
$table->getTitle() . self::REFERENCE_SEPARATOR . $field->getTitle();
 
  279                                        $table_selection = 
new ilSelectInputGUI(
$lng->txt(
'dcl_reference_title'), 
'prop_' . $property[
'id']);
 
  280                                        $table_selection->setOptions(
$options);
 
  281                                        $opt->addSubItem($table_selection);
 
  285                                        foreach (
$table->getFieldsForFormula() as $f) {
 
  286                                                $placeholder = ($f->isStandardField()) ? $f->getId() : $f->getTitle();
 
  287                                                $fields[] = 
'<a class="dclPropExpressionField" data-placeholder="' . $placeholder . 
'">' . $f->getTitle() . 
'</a>';
 
  292                                        $subitem->setInfo(sprintf(
$lng->txt(
'dcl_prop_expression_info'), $operators, $functions, implode(
'<br>', $fields)));
 
  293                                        $opt->addSubItem($subitem);
 
  294                                } elseif ($property[
'datatype_id'] == $datatype[
'id']) {
 
  298                                                if(
$lng->txt(
'dcl_'.$property[
'title'].
'_info') != 
'-dcl_'.$property[
'title'].
'_info-') {
 
  299                                                        $subitem->setInfo(
$lng->txt(
'dcl_'.$property[
'title'].
'_info'));
 
  301                                                $opt->addSubItem($subitem);
 
  303                                                        $subitem = 
new ilNumberInputGUI(
$lng->txt(
'dcl_' . $property[
'title']), 
'prop_' . $property[
'id']);
 
  309                                                        $subitem->setSize(5);
 
  310                                                        if ($property[
'title'] == 
'length') {
 
  311                                                                $subitem->setMaxValue(4000);
 
  312                                                                $subitem->setInfo(
$lng->txt(
'dcl_'.$property[
'title'].
'_info'));
 
  314                                                        $opt->addSubItem($subitem);
 
  321                                                        $subitem = 
new ilTextInputGUI(
$lng->txt(
'dcl_' . $property[
'title']), 
'prop_' . $property[
'id']);
 
  326                                                        if($property[
'title'] == 
'regex') {
 
  327                                                                $subitem->setInfo(
$lng->txt(
'dcl_'.$property[
'title'].
'_info'));
 
  329                                                        $opt->addSubItem($subitem);
 
  334            $opt->setInfo(
$lng->txt(
'dcl_' . $datatype[
'title'] . 
'_desc'));
 
  338            $edit_datatype->addOption($opt);
 
  340                $edit_datatype->setRequired(
true);
 
  343                if ($a_mode == 
"edit") {
 
  344                        $edit_datatype->setDisabled(
true);
 
  346                $this->form->addItem($edit_datatype);
 
  350                $this->form->addItem($cb);
 
  354        $cb->setInfo(
$lng->txt(
'dcl_unique_desc'));
 
  355                $this->form->addItem($cb);
 
  365                        'table_id' => $this->field_obj->getTableId(),
 
  366                        'field_id' => $this->field_obj->getId(),
 
  367                        'title' => $this->field_obj->getTitle(),
 
  368                        'datatype' => $this->field_obj->getDatatypeId(),
 
  369                        'description' => $this->field_obj->getDescription(),
 
  370                        'required' => $this->field_obj->getRequired(),
 
  371                        'unique' => $this->field_obj->isUnique(),
 
  374                $propertyvalues = $this->field_obj->getPropertyvalues();
 
  379                                $values[
'prop_' . $property[
'id']] = $propertyvalues[$property[
'id']];
 
  383                $this->form->setValuesByArray($values);
 
  394        public function save($a_mode = 
"create") {
 
  398                if (!$this->table->hasPermissionToFields($this->parent_obj->ref_id)) {
 
  404                $this->
initForm($a_mode == 
"update" ? 
"edit" : 
"create");
 
  406                        $title = $this->form->getInput(
"title");
 
  407                        if ($a_mode != 
"create" && $title != $this->field_obj->getTitle()) {
 
  411                        $this->field_obj->setTitle($title);
 
  412                        $this->field_obj->setDescription($this->form->getInput(
"description"));
 
  413                        $this->field_obj->setDatatypeId($this->form->getInput(
"datatype"));
 
  414                        $this->field_obj->setRequired($this->form->getInput(
"required"));
 
  415                        $this->field_obj->setUnique($this->form->getInput(
"unique"));
 
  417                        if ($a_mode == 
"update") {
 
  418                                $this->field_obj->doUpdate();
 
  420                                $this->field_obj->setVisible(
true);
 
  421                                $this->field_obj->setOrder($this->table->getNewOrder());
 
  422                                $this->field_obj->doCreate();
 
  426                        include_once(
"./Modules/DataCollection/classes/class.ilDataCollectionFieldProp.php");
 
  429                                $fieldprop_obj->setDatatypePropertyId($property[
'id']);
 
  430                                $fieldprop_obj->setFieldId($this->field_obj->getId());
 
  431                                $fieldprop_obj->setValue($this->form->getInput(
"prop_" . $property[
'id']));
 
  433                                if ($a_mode == 
"update") {
 
  434                                        $fieldprop_obj->doUpdate();
 
  436                                        $fieldprop_obj->doCreate();
 
  440                        $ilCtrl->setParameter($this, 
"field_id", $this->field_obj->getId());
 
  442                        if ($a_mode == 
"update") {
 
  445                                $this->table->addField($this->field_obj);
 
  446                                $this->table->buildOrderFields();
 
  449                        $ilCtrl->redirectByClass(strtolower(
"ilDataCollectionFieldListGUI"), 
"listFields");
 
  451                        $this->form->setValuesByPost();
 
  452                        $tpl->setContent($this->form->getHTML());
 
  466                $return = $this->form->checkInput();
 
  474                        $inputObj->setAlert(
$lng->txt(
"form_msg_value_too_high"));
 
  479                if ($a_mode == 
'create') {
 
  480                        if ($title = $this->form->getInput(
'title')) {
 
  482                                        $inputObj = $this->form->getItemByPostVar(
'title');
 
  483                                        $inputObj->setAlert(
$lng->txt(
"dcl_field_title_unique"));
 
  502                $tpl->setContent(
"Access Denied");
 
Confirmation screen class.
static getTableCache($table_id=0)
static getFieldCache($field_id=0)
static getProperties($a_id)
Get all properties of a Datatype.
const INPUTFORMAT_NON_EDITABLE_VALUE
const INPUTFORMAT_REFERENCELIST
const INPUTFORMAT_BOOLEAN
static getAllDatatypes()
Get all possible Datatypes.
const INPUTFORMAT_REFERENCE
Class ilDataCollectionFieldEditGUI.
executeCommand()
execute command
const REFERENCE_SEPARATOR
getValues()
getFieldValues
checkInput($a_mode)
Check input of form.
save($a_mode="create")
save Field
initForm($a_mode="create")
initEditCustomForm
edit()
create field edit form
__construct(ilObjDataCollectionGUI $a_parent_obj, $table_id, $field_id)
Constructor.
cancelDelete()
cancelDelete
confirmDelete()
confirmDelete
create()
create field add form
Class ilDataCollectionFieldProp.
static _getTitleValidChars($a_as_regex=true)
All valid chars for filed titles.
const PROPERTYID_REFERENCE
const PROPERTYID_TEXTAREA
const PROPERTYID_FORMULA_EXPRESSION
const PROPERTYID_N_REFERENCE
static _hasFieldByTitle($title, $obj_id)
Checks if a table has a field with the given title.
Class ilObjDataCollectionGUI.
This class represents an option in a radio group.
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.
if(!is_array($argv)) $options