function addDataFields($data_table, $fields, $debug = FALSE) { // definition fields table foreach ($fields as $field) { $table_name = $field['table_name']; // 'user'; $type_id = $field['type_id']; // 'value'; $type_name = $field['type_name']; // 'select'; $f1 = $field['f1']; // 'status'; if (!in_array($type_id, rex_xform::getTypes())) { return FALSE; } $gs = rex_sql::factory(); $gs->debugsql = $debug; $gs->setQuery('delete from rex_xform_field where table_name="' . $table_name . '" and type_id="' . $type_id . '" and type_name="' . $type_name . '" and f1="' . $f1 . '"'); // fielddaten - datensatz anlegen $af = rex_sql::factory(); $af->debugsql = $debug; $af->setTable('rex_xform_field'); foreach ($field as $k => $v) { $af->setValue($k, $v); } if (!$af->insert()) { return FALSE; } // datentabelle - spalte hinzufügen if ($type_id == "value" && $type_name != "" && $f1 != "") { if ($classname = rex_xform::includeClass('value', $type_name)) { } else { return FALSE; } $cl = new $classname(); $definitions = $cl->getDefinitions(); if (isset($definitions["dbtype"]) && $definitions["dbtype"] != "") { // Structur in spalte anpassen $af = rex_sql::factory(); $af->debugsql = $debug; $af->setQuery('ALTER TABLE `' . $data_table . '` ADD `' . $f1 . '` ' . $definitions["dbtype"] . ' NOT NULL ;'); } } } return TRUE; }