function make_form($edit = '') { if ($edit) { $values = $this->get_entry($edit); $edit = is_array($edit) ? current($edit) : $edit; } $return = ''; $return .= Form::form_tag($this->action ? $this->action : SELF, 'post', 'multipart/form-data', array('onsubmit' => 'return checkform()')); $table = new Table(2); foreach ($this->cols_array as $key => $col) { $name = $key; $show_name = $col['name']; $id = 'input_' . $GLOBALS['input_id']; $encoded_name = rawurlencode($name); $attr_array = $col['attributes']; if (isset($values[$key])) { $value = $values[$key]; } elseif ($col['value']) { $value = $col['value']; } elseif ($this->re_entry && $_POST[$name]) { $value = $_POST[$name]; } else { $value = ''; } if ($name != 'id') { switch ($col['type']) { case 'text': $attr_array['id'] = $id; if (isset($col['length'])) { $attr_array['size'] = $field['length']; $attr_array['maxlength'] = $field['length']; } else { $attr_array['size'] = 40; } $input = Form::add_input('text', $encoded_name, $value, $attr_array); break; case 'select': $attr_array['id'] = $id; $select = new Select($encoded_name, $attr_array); $select->add_option('', '--Bitte auswählen--'); $attr_array = array(); foreach ($col['options'] as $option => $name) { if ($value == $option) { $attr_array['selected'] = 'selected'; } else { unset($attr_array['selected']); } $select->add_option(rawurlencode($option), $name, $attr_array); } if ($col['sonstiges']) { $select->add_option('', 'Sonstige:'); } //,array('onclick'=>'sonstig_input(this,\''.rawurlencode($encoded_name).'\')')); $input = $select->flush_select(); break; case 'check': $input = ''; foreach ($col['options'] as $option => $name) { if (is_array($value) && in_array($option, $value)) { $attr_array['checked'] = 'checked'; } else { unset($attr_array['checked']); } $input .= Form::add_input('checkbox', $encoded_name . '[]', $option, $attr_array) . ' ' . $name . Html::br(); } break; case 'textarea': $attr_array['id'] = $id; $attr_array['cols'] = $col['attributes']['cols'] ? $col['attributes']['cols'] : 30; $attr_array['rows'] = $col['attributes']['rows'] ? $col['attributes']['rows'] : 10; $input = Form::add_textarea($encoded_name, $value, $attr_array); //,'cols'=>'35','rows'=>'2','onfocus'=>'textarea_grow(\''.$id.'\')','onblur'=>'textarea_shrink(\''.$id.'\')')); if ($col['html']) { if (!$xinha_loaded) { $GLOBALS['scripts'] .= Html::script(' _editor_url = "/' . INSTALL_PATH . '/Libraries/Xinha/";_editor_lang = "de";_document_root = "' . DOCUMENT_ROOT . '"'); $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Xinha/htmlarea.js')); $GLOBALS['scripts'] .= Html::script(' xinha_editors = []; xinha_init = null; xinha_config = null; xinha_plugins = null; // This contains the names of textareas we will make into Xinha editors xinha_init = xinha_init ? xinha_init : function() { xinha_plugins = xinha_plugins ? xinha_plugins : [ "SuperClean", "ImageManager", //"GetHtml", //"Linker", "DoubleClick" ]; if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return; xinha_editors.push("' . $id . '"); xinha_config = xinha_config ? xinha_config : new HTMLArea.Config(); xinha_config.statusBar = false; xinha_config.toolbar = [ ["bold","italic"], ["separator","createlink","insertimage"], ["separator","undo","redo","selectall"], (HTMLArea.is_gecko ? [] : ["cut","copy","paste","overwrite"]), ["separator","killword","separator","htmlmode","about","showhelp"] ]; //xinha_config.flowToolbars = false; xinha_config.showLoading = true; //xinha_config.only7BitPrintablesInURLs = false; xinha_config.SuperClean.show_dialog = true; xinha_config.SuperClean.filters = { "tidy": HTMLArea._lc("General tidy up and correction of some problems.", "SuperClean"), "word": "Word" } xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); HTMLArea.startEditors(xinha_editors); } window.onload = xinha_init; '); $xinha_loaded = true; } else { $GLOBALS['scripts'] .= Html::script('xinha_editors.push("' . $id . '")'); } } break; case 'upload': $attr_array['id'] = $id; $input = $value ? $value . Form::add_input('hidden', $encoded_name, $value, $attr_array) . Html::br() . Html::span('Neue Datei verknüpfen:', array('class' => 'klein')) . Html::br() : ''; $input .= Form::add_input('file', $encoded_name . '_upload'); break; case 'custom': $input = $col['custom_input']; break; case 'timestamp': $this->calendar_script(); $attr_array['id'] = 'tag_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input = Form::add_input('text', $encoded_name . '_tag', ($tag = Date::tag($value)) != 0 && $value != '' ? $tag : '', $attr_array) . '.'; $attr_array['id'] = 'monat_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_monat', ($monat = Date::monat($value)) != 0 && $value != '' ? $monat : '', $attr_array) . '.'; $attr_array['id'] = 'jahr_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_jahr', ($jahr = Date::jahr($value)) != 0 && $value != '' ? $jahr : '', $attr_array) . ' '; $attr_array['id'] = 'stunde_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_stunde', ($stunde = Date::stunde($value)) != 0 && $value != '' ? $stunde : '', $attr_array) . ':'; $attr_array['id'] = 'minute_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_minute', ($minute = Date::minute($value)) != 0 && $value != '' ? $minute : '', $attr_array); $input .= Form::add_input('hidden', $encoded_name, $value, array('id' => $id)); $input .= Form::add_input('button', '', 'Kalender', array('id' => 'trigger_' . $GLOBALS['input_id'])); $script = ' Calendar.setup( { inputField : "' . $id . '", // ID of the input field ifFormat : "%Y/%m/%d", // the date format button : "trigger_"+' . $GLOBALS['input_id'] . ', // ID of the button showsTime : false, timeFormat : "24", showOthers : true, onSelect : onSelect, onUpdate : onUpd, inputId : ' . $GLOBALS['input_id'] . ', prevInput : "test" } ); timefields.push("' . $id . '"); '; $input .= Html::script($script); break; case 'email': preg_match('/(.*?)<?([0-9a-z.+-]{2,}\\@[0-9a-z.-]{2,}\\.[a-z]{2,6})>?/', $value, $matches); $name_value = trim($matches[1]); $mail_value = $matches[2]; $attr_array['id'] = 'name_' . $GLOBALS['input_id']; $input = 'Name ' . Form::add_input('text', $encoded_name . '_name', $name_value, $attr_array); $attr_array['id'] = 'mail_' . $GLOBALS['input_id']; $input .= 'E-Mail ' . Form::add_input('text', $encoded_name . '_mail', $mail_value, $attr_array); break; case 'info': $input = $col['value']; $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array); break; case 'hidden': $attr_array['id'] = $id; $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array); $input = ''; break; case 'ignore': unset($input); break; } if ($col['required'] && $input) { if ($col['type'] == 'timestamp') { $input .= Html::script("\nrequired_fields.push('" . 'tag_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'monat_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'jahr_' . $GLOBALS['input_id'] . "');"); } else { $input .= Html::script("\nrequired_fields.push('{$id}');"); } } if ($input) { $table->add_td(array(Form::add_label($id, $show_name), $input)); } $GLOBALS['input_id']++; } } $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button')); if ($edit) { $input .= Form::add_input('hidden', 'edit_id', $edit); } $input .= Form::add_input('hidden', 'submit', 'submit'); $input .= $hidden_inputs; $table->add_td(array('', $input)); $return .= $table->flush_table(); $return .= Form::close_form(); return $return; }
function make_form($edit = '') { if ($edit) { $values = $this->get_entry($edit); $edit = is_array($edit) ? current($edit) : $edit; } $return = ''; $return .= Form::form_tag($this->action ? $this->action : SELF, 'post', 'multipart/form-data', array('onsubmit' => 'return checkform()')); $table = new Table(2); foreach ($this->cols_array as $key => $col) { $name = $key; $show_name = $col['name']; $id = 'input_' . $GLOBALS['input_id']; $encoded_name = rawurlencode($name); $attr_array = $col['attributes']; if (isset($values[$key])) { $value = $values[$key]; } elseif ($col['value']) { $value = $col['value']; } elseif ($this->re_entry && $_POST[$name]) { $value = $_POST[$name]; } else { $value = ''; } if ($name != 'id') { switch ($col['type']) { case 'text': $attr_array['id'] = $id; if (isset($col['length'])) { $attr_array['size'] = $field['length']; $attr_array['maxlength'] = $field['length']; } else { $attr_array['size'] = 40; } $input = Form::add_input('text', $encoded_name, $value, $attr_array); break; case 'select': $attr_array['id'] = $id; $select = new Select($encoded_name, $attr_array); $select->add_option('', '--Bitte auswählen--'); $attr_array = array(); foreach ($col['options'] as $option => $name) { if ($value == $option) { $attr_array['selected'] = 'selected'; } else { unset($attr_array['selected']); } $select->add_option(rawurlencode($option), $name, $attr_array); } if ($col['sonstiges']) { $select->add_option('', 'Sonstige:'); } //,array('onclick'=>'sonstig_input(this,\''.rawurlencode($encoded_name).'\')')); $input = $select->flush_select(); break; case 'check': $input = ''; foreach ($col['options'] as $option => $name) { if (is_array($value) && in_array($option, $value)) { $attr_array['checked'] = 'checked'; } else { unset($attr_array['checked']); } $input .= Form::add_input('checkbox', $encoded_name . '[]', $option, $attr_array) . ' ' . $name . Html::br(); } break; case 'textarea': $attr_array['id'] = $id; $attr_array['cols'] = $col['attributes']['cols'] ? $col['attributes']['cols'] : 30; $attr_array['rows'] = $col['attributes']['rows'] ? $col['attributes']['rows'] : 10; $input = Form::add_textarea($encoded_name, $value, $attr_array); //,'cols'=>'35','rows'=>'2','onfocus'=>'textarea_grow(\''.$id.'\')','onblur'=>'textarea_shrink(\''.$id.'\')')); if ($col['html']) { if (!$xinha_loaded) { $GLOBALS['scripts'] .= Html::script(' _editor_url = "/' . INSTALL_PATH . '/Libraries/Xinha/";_editor_lang = "de";_document_root = "' . DOCUMENT_ROOT . '";project_name = "' . PROJECT_NAME . '";'); $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Xinha/XinhaLoader.js')); $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/System/Scaffold/XinhaConfig.php')); $GLOBALS['scripts'] .= Html::script('xinha_editors.push("' . $id . '")'); $xinha_loaded = true; } else { $GLOBALS['scripts'] .= Html::script('xinha_editors.push("' . $id . '")'); } } break; case 'upload': $attr_array['id'] = $id; $input = $value ? $value . Form::add_input('hidden', $encoded_name, $value, $attr_array) . Html::br() . Html::span('Neue Datei verknüpfen:', array('class' => 'klein')) . Html::br() : ''; $input .= Form::add_input('file', $encoded_name . '_upload'); break; case 'custom': $input = $col['custom_input']; break; case 'timestamp': $this->calendar_script(); $attr_array['id'] = 'tag_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input = Form::add_input('text', $encoded_name . '_tag', ($tag = Date::tag($value)) != 0 && $value != '' ? $tag : '', $attr_array) . '.'; $attr_array['id'] = 'monat_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_monat', ($monat = Date::monat($value)) != 0 && $value != '' ? $monat : '', $attr_array) . '.'; $attr_array['id'] = 'jahr_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_jahr', ($jahr = Date::jahr($value)) != 0 && $value != '' ? $jahr : '', $attr_array) . ' '; $attr_array['id'] = 'stunde_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_stunde', ($stunde = Date::stunde($value)) != 0 && $value != '' ? $stunde : '', $attr_array) . ':'; $attr_array['id'] = 'minute_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_minute', ($minute = Date::minute($value)) != 0 && $value != '' ? $minute : '', $attr_array); $input .= Form::add_input('hidden', $encoded_name, $value, array('id' => $id)); $input .= Form::add_input('button', '', 'Kalender', array('id' => 'trigger_' . $GLOBALS['input_id'])); $script = ' Calendar.setup( { inputField : "' . $id . '", // ID of the input field ifFormat : "%Y/%m/%d", // the date format button : "trigger_"+' . $GLOBALS['input_id'] . ', // ID of the button showsTime : false, timeFormat : "24", showOthers : true, onSelect : onSelect, onUpdate : onUpd, inputId : ' . $GLOBALS['input_id'] . ', prevInput : "test" } ); timefields.push("' . $id . '"); '; $input .= Html::script($script); break; case 'email': preg_match('/(.*?)<?([0-9a-z.+-]{2,}\\@[0-9a-z.-]{2,}\\.[a-z]{2,6})>?/', $value, $matches); $name_value = trim($matches[1]); $mail_value = $matches[2]; $attr_array['id'] = 'name_' . $GLOBALS['input_id']; $input = 'Name ' . Form::add_input('text', $encoded_name . '_name', $name_value, $attr_array); $attr_array['id'] = 'mail_' . $GLOBALS['input_id']; $input .= 'E-Mail ' . Form::add_input('text', $encoded_name . '_mail', $mail_value, $attr_array); break; case 'info': $input = $col['value']; $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array); break; case 'hidden': $attr_array['id'] = $id; $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array); $input = ''; break; case 'ignore': unset($input); break; } if ($col['required'] && $input) { if ($col['type'] == 'timestamp') { $input .= Html::script("\nrequired_fields.push('" . 'tag_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'monat_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'jahr_' . $GLOBALS['input_id'] . "');"); } else { $input .= Html::script("\nrequired_fields.push('{$id}');"); } } if ($input) { $table->add_td(array(Form::add_label($id, $show_name), $input)); } $GLOBALS['input_id']++; } } $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button')); if ($edit) { $input .= Form::add_input('hidden', 'edit_id', $edit); } $input .= Form::add_input('hidden', 'submit', 'submit'); $input .= $hidden_inputs; $table->add_td(array('', $input)); $return .= $table->flush_table(); $return .= Form::close_form(); return $return; }
function make_form($edit = '', $action = null, $action_parameter_filter = array(), $template = null) { if ($edit) { $values = $this->get_entry($edit); $edit = is_array($edit) ? current($edit) : $edit; } $GLOBALS['scripts'] .= Html::script("onLoad.push(checkConditions);"); //$GLOBALS['scripts'] .= Html::script("onLoad.push(sizeTextAreas);"); $return = ''; $url = $action ? $action : SELF_URL; $url .= strstr($url, '?') ? '&' : '?'; $url .= $this->GET_2_url(array_merge(array('edit', 'new', 'noframe', 'reentry'), $action_parameter_filter)); //$url .= ($_GET['edit']) ? '#entry'.$_GET['edit'] : ''; $return .= Form::form_tag($url, 'post', 'multipart/form-data', array('onsubmit' => "loading();return checkform();")); $table = new Table(2, array('class' => 'scaffold')); $return .= $this->text_above_form; if ($this->show_buttons_above_form) { $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button')); if ($this->show_cancel) { $input .= Form::add_input('button', 'cancel', 'Abbrechen', array('class' => 'button', 'onclick' => 'cancelEdit(this)')); } $table->add_td(array(array(2 => $input))); } foreach ($this->cols_array as $key => $col) { $name = $key; //$show_name = General::wrap_string($col['name'],30); $show_name = $col['name']; $show_name .= $col['required'] ? ' *' : ''; $id = 'input_' . $GLOBALS['input_id']; $encoded_name = rawurlencode($name); $attr_array = $col['attributes']; if ($col['disabled']) { $attr_array['disabled'] = 'disabled'; } else { if ($attr_array['disabled']) { unset($attr_array['disabled']); } } if ($this->re_entry || isset($_REQUEST['reentry']) && $_POST[$name]) { $value = $_POST[$name]; } else { if ($values[$key]) { $value = $values[$key]; } else { if ($col['value']) { $value = $col['value']; } else { $value = ''; } } } if (isset($col['options'])) { $options = $this->get_options($col['options'], $col['options_sort'], $col['options_insert_id']); if (!$col['options_hide_edit_button']) { $edit_options_btn = is_string($col['options']) && $this->edit_enabled ? Html::a("javascript:void(0);", 'Optionen bearbeiten', array('class' => 'button', 'onclick' => "window.open('" . SELF_URL . "?nomenu&editoptions={$encoded_name}','scaff_dialog','toolbar=no,menubar=yes,personalbar=no,width=500,scrollbars=yes,resizable=yes,modal=yes,dependable=yes');var refresh=document.getElementById('{$id}_refresh');refresh.style.display='';refresh.focus();return false;")) : ''; $edit_options_btn .= Form::add_input('submit', 'reentry', 'Aktualisieren', array('id' => $id . '_refresh', 'style' => 'display:none')); $edit_options_btn = Html::br() . $edit_options_btn; } } if ($name != 'id') { switch ($col['type']) { case 'text': $attr_array['id'] = $id; if (isset($col['length'])) { $attr_array['size'] = $field['length']; $attr_array['maxlength'] = $field['length']; } else { if (!stristr($attr_array['style'], 'width')) { $attr_array['style'] .= "width:{$this->input_width};"; } } if ($col['multiple']) { $input = Form::add_input('text', $encoded_name . '[]', $value, $attr_array); $info .= Html::a('javascript:void(0);', '+', array('onclick' => 'cloneInput(\'' . $id . '\')')); } else { $input = Form::add_input('text', $encoded_name, $value, $attr_array); } break; case 'select': $attr_array['id'] = $id; $select = new Select($encoded_name, array_merge($attr_array, array('onchange' => "selectOtherOption('{$id}','" . $col['other_option'] . "')"))); $select->add_option('', '--Bitte auswählen--'); $attr_array = array(); if (is_array($options)) { if (!in_array($value, $options) && !key_exists($value, $options)) { $col['other'] = $value; } foreach ($options as $option => $name) { if ($value == $option) { $attr_array['selected'] = 'selected'; } else { unset($attr_array['selected']); } $select->add_option($option, $name, $attr_array); } if ($col['other_option']) { if ($col['other']) { $attr_array['selected'] = 'selected'; } $attr_array['onclick'] = 'otherOption(this,\'' . rawurlencode($encoded_name) . '\')'; $select->add_option('', $col['other_option'], $attr_array); } else { unset($attr_array['onclick']); } } $input = $select->flush_select(); if ($col['other']) { $input .= Form::add_input('text', $encoded_name, $col['other'], array('onfocus' => "selectOtherOption('{$id}','" . $col['other_option'] . "')", 'id' => $id . '_other')); } $input .= $edit_options_btn; break; case 'radio': $attr_array['id'] = $id; $attr_array = array(); $input = ''; foreach ($options as $option => $name) { if ($value == $option) { $attr_array['checked'] = 'checked'; } else { unset($attr_array['checked']); } if (isset($col['condition'][$option])) { $condition = "{input:'" . $encoded_name . "',value:'" . $option . "',target:'" . $col['condition'][$option] . "'}"; $input .= Html::script("conditions.push({$condition})"); //$attr_array['onchange'] = "checkCondition($condition)"; } else { //unset($attr_array['onchange']); } if (isset($col['condition'])) { $attr_array['onchange'] = "checkCondition({$condition})"; } else { unset($attr_array['onchange']); } $input .= Form::add_input('radio', $encoded_name, $option, $attr_array) . ' ' . $name . Html::br(); } if ($col['condition']) { } $input .= $edit_options_btn; break; case 'check': $input = ''; if (!is_array($value)) { $value = explode('&delim;', $value); } foreach ($options as $option => $name) { if (is_array($value) && in_array($option, $value)) { $attr_array['checked'] = 'checked'; } else { unset($attr_array['checked']); } $input .= Form::add_input('checkbox', $encoded_name . '[]', $option, $attr_array) . ' ' . $name . Html::br(); } if ($col['other_option']) { $other = array_diff($value, $options); $input .= $col['other_option'] . ' ' . Form::add_input('text', $encoded_name . '[]', implode(', ', $other)) . Html::br(); } $input .= $edit_options_btn; $input = Html::div($input, array('id' => $id, 'name' => $encoded_name)); break; case 'textarea': $attr_array['id'] = $id; if ($col['attributes']['cols']) { $col['attributes']['cols']; } else { if (!stristr($attr_array['style'], 'width')) { $attr_array['style'] .= "width:{$this->input_width};"; } } $attr_array['rows'] = $col['attributes']['rows'] ? $col['attributes']['rows'] : 10; if ($col['max_length']) { $attr_array['onkeydown'] = 'return maxLength(event,this,' . $col['max_length'] . ')'; } $input = Form::add_textarea($encoded_name, $value, $attr_array); //,'cols'=>'35','rows'=>'2','onfocus'=>'textarea_grow(\''.$id.'\')','onblur'=>'textarea_shrink(\''.$id.'\')')); if ($col['max_length']) { $input .= Html::span("Noch " . Html::span($col['max_length'] - strlen($value), array('id' => $id . '_charsleft')) . " Zeichen"); } if ($col['options']) { $input .= Html::br() . $edit_options_btn; } if ($col['html']) { $this->xinha_scripts(); } break; case 'upload': $input = ''; $value = $values[$key]; $entries = array(); if (!is_array($value)) { $entries = explode('&delim;', $value); } else { $entries = $value; } $upload_folder = ''; if (is_string($this->upload_folder)) { $this->upload_folder = array($this->upload_folder); } foreach ($this->upload_folder as $col_name) { $upload_folder .= $values[$col_name]; } $upload_folder .= '/'; if (count(General::trim_array($entries)) > 0) { $subtable = new Table(3); foreach ($entries as $file) { $img_info = @getimagesize($this->upload_path . $upload_folder . $file); if ($img_info) { $thumb = Html::img(SELF_URL . '?img=' . rawurlencode($upload_folder . $file) . '&x=100', $file); } else { $thumb = ''; } $check = Form::add_input('hidden', $encoded_name . '[]', $file); $check .= Html::br() . Form::add_input('checkbox', $encoded_name . '_delfile[]', $file, array("onclick" => "confirmDelPic(this)")) . ' Datei löschen'; $subtable->add_td(array($thumb, $file . $check)); } $input .= $subtable->flush_table(); if ($col['upload_max_count']) { $input .= Html::span("Maximal " . $col['upload_max_count'] . " Dateien" . Html::br(), array('class' => 'klein')); } } if ($col['upload_max_count'] && count(General::trim_array($entries)) >= $col['upload_max_count']) { continue; } $attr_array['id'] = $id; //$input = ($value) ? $value.Form::add_input('hidden',$encoded_name,$value,$attr_array).Html::br().Html::span('Neue Datei verknüpfen:',array('class'=>'klein')).Html::br():''; $input .= Form::add_input('file', $encoded_name . '_upload[]'); // if ($col['upload_max_count']) // { $input .= Form::add_input('submit', 'reentry', 'Hochladen'); // } if ($col['upload_extensions']) { $input .= Html::br() . Html::span("Erlaubte Erweiterungen: " . implode(', ', $col['upload_extensions']), array('class' => 'klein')); } if ($col['upload_size']) { $input .= Html::br() . Html::span("Maximale Dateigröße: " . $col['upload_size'] . 'KB', array('class' => 'klein')); } break; case 'EFM': break; case 'custom': $input = $col['custom_input']; break; case 'timestamp': $this->calendar_script(); $attr_array['id'] = 'tag_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input = Form::add_input('text', $encoded_name . '_tag', ($tag = Date::tag($value)) != 0 && $value != '' ? $tag : '', $attr_array) . '.'; $attr_array['id'] = 'monat_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_monat', ($monat = Date::monat($value)) != 0 && $value != '' ? $monat : '', $attr_array) . '.'; $attr_array['id'] = 'jahr_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_jahr', ($jahr = Date::jahr($value)) != 0 && $value != '' ? $jahr : '', $attr_array) . ' '; $attr_array['id'] = 'stunde_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_stunde', ($stunde = Date::stunde($value)) != 0 && $value != '' ? $stunde : '', $attr_array) . ':'; $attr_array['id'] = 'minute_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_minute', ($minute = Date::minute($value)) != 0 && $value != '' ? $minute : '', $attr_array); $input .= Form::add_input('hidden', $encoded_name, $value, array('id' => $id)); $input .= Form::add_input('button', '', 'Kalender', array('id' => 'trigger_' . $GLOBALS['input_id'])); $script = ' Calendar.setup( { inputField : "' . $id . '", // ID of the input field ifFormat : "%Y/%m/%d", // the date format button : "trigger_"+' . $GLOBALS['input_id'] . ', // ID of the button showsTime : false, timeFormat : "24", showOthers : true, onSelect : onSelect, onUpdate : onUpd, inputId : ' . $GLOBALS['input_id'] . ', prevInput : "test" } ); timefields.push("' . $id . '"); '; $input .= Html::script($script); break; case 'email': preg_match('/(.*?)<?([0-9a-z.+-]{2,}\\@[0-9a-z.-]{2,}\\.[a-z]{2,6})>?/', $value, $matches); $name_value = trim($matches[1]); $mail_value = $matches[2]; $attr_array['id'] = 'name_' . $GLOBALS['input_id']; $input = 'Name ' . Form::add_input('text', $encoded_name . '_name', $name_value, $attr_array); $attr_array['id'] = 'mail_' . $GLOBALS['input_id']; $input .= 'E-Mail ' . Form::add_input('text', $encoded_name . '_mail', $mail_value, $attr_array); break; case 'info': $input = $col['value']; //$hidden_inputs .= Form::add_input('hidden',$encoded_name,$value,$attr_array); break; case 'hidden': $attr_array['id'] = $id; $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array); $input = ''; break; case 'ignore': unset($input); break; case 'changed': $input = Form::add_textarea('', $value, array("disabled" => "disabled")) . Form::add_input('hidden', $encoded_name, $value); break; } if ($col['required'] && $input) { if ($col['type'] == 'timestamp') { $input .= Html::script("\nrequired_fields.push('" . 'tag_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'monat_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'jahr_' . $GLOBALS['input_id'] . "');"); } else { $input .= Html::script("\nrequired_fields.push('{$id}');"); } } $alternatig_rows = $alternatig_rows == 1 ? 0 : 1; $td_atributes['class'] = ' alt_row_' . $alternatig_rows; if ($col['hidden']) { $td_atributes['style'] = 'display:none;'; } else { unset($td_atributes['style']); } if ($col['info']) { if (!$GLOBALS['toolTipScriptLoaded']) { $GLOBALS['scripts'] .= Html::script(null, array('src' => '/Libraries/ToolTip/ToolTip.js')); $GLOBALS['scripts'] .= Html::script('onLoad.push(toolTipOnLoad)'); $GLOBALS['toolTipScriptLoaded'] = true; } $trigger_id = 'info' . $GLOBALS['input_id']; $source_id = "tooltip" . $GLOBALS['input_id']; $info = ' ' . Html::img('/' . INSTALL_PATH . "/System/Scaffold/info.gif", strip_tags($col['info']), array('id' => $trigger_id, 'title' => strip_tags($col['info']))); $info .= Html::div($col['info'], array('id' => $source_id, "style" => "display:none")); $info .= Html::script("toolTips.push({trigger : '{$trigger_id}',source : '{$source_id}',className : 'tooltip'});"); } else { $info = ''; } if ($input) { $table->add_td(array(Form::add_label($id, $show_name) . $info, $input), $td_atributes); } ++$GLOBALS['input_id']; } } $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button')); if ($this->show_cancel) { if ($this->use_ajax) { $input .= Form::add_input('button', 'cancel', 'Abbrechen', array('class' => 'button', 'onclick' => 'cancelEdit(this)')); } else { $input .= Form::add_input('submit', 'cancel', 'Abbrechen', array('class' => 'button')); } } $input .= Form::add_input('hidden', 'edit_id', $edit ? $edit : ''); $input .= Form::add_input('hidden', 'submit', 'submit'); $input .= $hidden_inputs; $table->add_td(array(array(2 => $input))); $return .= $table->flush_table(); $return .= Form::close_form(); if ($template) { $t = new Template($template); $vars['form'] = $return; return $t->parse_template(null, $vars); } else { return $return; } }