'.$formDef['tabs'][$tab]['title'].''; $lang = array(); $html_reqestedelement = "* "; foreach($formDef['tabs'][$tab]['fields'] as $key => $field) { if ($field['required'] == true ) { $html_reqcode = $html_reqestedelement; } else { $html_reqcode = ''; } switch ($field['formtype']) { case 'TEXT': $html .= "
"; break; case 'TEXTAREA': $html .= "
"; break; case 'SELECT': $html .= "
"; break; case 'MULTIPLE': $html .= "
"; break; case 'PASSWORD': $html .= "
"; break; case 'CHECKBOX': $html .= "

".$html_reqcode."{tmpl_var name='".$key."_txt'}

{tmpl_var name='".$key."'}
"; break; case 'CHECKBOXARRAY': $html .= "

".$html_reqcode."{tmpl_var name='".$key."_txt'}

{tmpl_var name='".$key."'}
"; break; case 'RADIO': $html .= "

".$html_reqcode."{tmpl_var name='".$key."_txt'}

{tmpl_var name='".$key."'}
"; break; } // Language File Eintrag für "Feld-Titel" anlegen $lang[$key."_txt"] = $key; // language File Eintrag, für error-Text anlegen if(isset($field["errmsg"]) && $field["errmsg"] != '') { $errmsg = $field["errmsg"]; $lang[$errmsg] = $errmsg; } } $html .= "
"; // speichere Template if (!$handle = fopen($formDef['tabs'][$tab]['template'], 'w')) { print "Cannot open file (".$formDef['tabs'][$tab]['template'].")"; exit; } if (!fwrite($handle, $html)) { print "Cannot write to file ($filename)"; exit; } fclose($handle); $this->lng_add($lang,$formDef); // überprüfe, ob es die Tabelle schon gibt, // ansonsten wird sie angelegt $tables = $app->db->getTables(); if(!@in_array($formDef['db_table'],$tables)) { // Datenbank noch nicht vorhanden $columns = array(); // füge ID Feld hinzu $col = array( 'action' => 'add', 'name' => $formDef["db_table_idx"], 'type' => 'int64', 'typeValue' => '', 'defaultValue' => false, 'notNull' => true, 'autoInc' => true, 'option' => 'primary' ); $columns[] = $col; $app->db->show_error_messages = true; if($formDef["auth"] == 'yes') { $col = array( 'action' => 'add', 'name' => 'sys_userid', 'type' => 'int32', 'typeValue' => '', 'defaultValue' => '0', 'notNull' => true ); $columns[] = $col; $col = array( 'action' => 'add', 'name' => 'sys_groupid', 'type' => 'int32', 'typeValue' => '', 'defaultValue' => '0', 'notNull' => true ); $columns[] = $col; $col = array( 'action' => 'add', 'name' => 'sys_perm_user', 'type' => 'varchar', 'typeValue' => '5', 'defaultValue' => 'NULL', 'notNull' => true ); $columns[] = $col; $col = array( 'action' => 'add', 'name' => 'sys_perm_group', 'type' => 'varchar', 'typeValue' => '5', 'defaultValue' => 'NULL', 'notNull' => true ); $columns[] = $col; $col = array( 'action' => 'add', 'name' => 'sys_perm_other', 'type' => 'varchar', 'typeValue' => '5', 'defaultValue' => 'NULL', 'notNull' => true ); $columns[] = $col; } foreach($formDef['tabs'] as $tab) { foreach($tab["fields"] as $name => $field) { /* $columns = array(action => add | alter | drop name => Spaltenname name_new => neuer Spaltenname, nur bei 'alter' belegt type => 42go-Meta-Type: int16, int32, int64, double, char, varchar, text, blob typeValue => Wert z.B. bei Varchar defaultValue => Default Wert notNull => true | false autoInc => true | false option => unique | primary | index) */ switch ($field["datatype"]) { case 'INTEGER': $type = 'int32'; $typevalue = ''; $defaultValue = ($field["default"] != '')?$field["default"]:'0'; break; case 'DOUBLE': $type = 'double'; $typevalue = ''; $defaultValue = ($field["default"] != '')?$field["default"]:'0'; break; case 'CURRENCY': $type = 'double'; $typevalue = ''; $defaultValue = ($field["default"] != '')?$field["default"]:'0'; break; case 'VARCHAR': $type = 'varchar'; $typeValue = ($field["maxlength"] > 0 and $field["maxlength"] <= 256)?$field["maxlength"]:255; // $defaultValue = ($field["default"] != '')?$field["default"]:'NOT NULL'; $defaultValue = ($field["default"] != '')?$field["default"]:'NULL'; break; case 'TEXT': $type = 'text'; $typevalue = ''; $defaultValue = 'NULL'; break; case 'DATE': $type = 'int64'; $typevalue = ''; $defaultValue = ($field["default"] != '')?$field["default"]:'0'; break; } $col = array( 'action' => 'add', 'name' => $name, 'type' => $type, 'typeValue' => $typeValue, 'defaultValue' => $defaultValue, 'notNull' => true ); $columns[] = $col; } } $app->db->createTable($formDef["db_table"],$columns); } } function lng_add($lang,$formDef) { global $go_api, $go_info,$conf; $lng_file = "lib/lang/".$conf["language"]."_".$formDef['name'].".lng"; if(is_file($lng_file)) { include($lng_file); } else { $wb = array(); } $wb_out = array_merge($lang,$wb); if(is_array($wb_out)) { $fp = fopen ($lng_file, "w"); fwrite($fp," $val) { $new_line = '$wb["'.$key.'"] = '."'$val';\n"; fwrite($fp,$new_line); } fwrite($fp,"?>"); fclose($fp); } } } ?>