function date_to_mysqldate($date) { if (is_mysql_date($date)) { return $date; } else { if (is_valid_date($date)) { $ndate = explode('/', $date, 3); return $ndate[2] . '-' . $ndate[1] . '-' . $ndate[0]; } else { return false; } } }
if ($error == 1) { $filename = get_unique_name(); $daylist = array('Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'); $P = $_GET; $codice_from = strlen(trim($P['codice_from'])) ? trim($P['codice_from']) : ''; $codice_to = strlen(trim($P['codice_to'])) ? trim($P['codice_to']) : ''; $operatore = is_numeric($P['operatore'][realval][0]) ? $P['operatore'][realval][0] : ''; //$cliente= is_numeric($P['clie'][realval][0]) ? $P['clie'][realval][0] : ''; //$cliente = strlen(trim($P['clie'])) ? trim($P['clie']) : ''; //$cliente = is_mysql_date($P['clie']) ? $P['clie'] : ''; $iniz_from = is_mysql_date($P['iniz_from']) ? $P['iniz_from'] : ''; $iniz_to = is_mysql_date($P['iniz_to']) ? $P['iniz_to'] : ''; $mod_from = is_mysql_date($P['mod_from']) ? $P['mod_from'] : ''; $mod_to = is_mysql_date($P['mod_to']) ? $P['mod_to'] : ''; $ins_from = is_mysql_date($P['ins_from']) ? $P['ins_from'] : ''; $ins_to = is_mysql_date($P['ins_to']) ? $P['ins_to'] : ''; $tipo = strlen($P['pr_tipo'][0]) ? $P['pr_tipo'][0] : ''; $title = strlen(trim($P['title'])) ? trim($P['title']) : ''; $note = strlen(trim($P['note'])) ? trim($P['note']) : ''; $dest = is_numeric($P['dest'][realval][0]) ? $P['dest'][realval][0] : ''; if (!is_array($P[print_note])) { $P[print_note] = array(); } $rapida = in_array(2, $P[print_note]) ? 1 : 0; $wh = array('(1 = 1)'); if ($codice_from) { $wh[] = "(pr_codice >= '" . mysql_escape_string($codice_from) . "')"; } if ($codice_to) { $wh[] = "(pr_codice <= '" . mysql_escape_string($codice_to) . "')"; }
function fw_form_date($input, $name, $trueval = "", $error = 0) { global $FORM_TEMPLATE, $cur_style, $max_col, $CONF; list($InputType, $values, $options) = explode("||", $input["content"]); foreach (explode(";;", $options) as $value) { list($type, $val) = explode("::", $value); switch ($type) { case "wid": $more_opt .= ' size="' . $val . '" '; break; case "maxc": $more_opt .= ' maxlength="' . $val . '" '; break; case "class": if ($error == 0) { $more_opt .= ' class="' . $val . '" '; } break; case "classe": if ($error == 1) { $more_opt .= ' class="' . $val . '" '; } break; case "js": if ($error == 0) { $more_opt .= ' ' . $val . ' '; } $jsi = 1; break; case "jse": if ($error == 1) { $more_opt .= ' ' . $val . ' '; } $jsi = 1; break; case "disab": if ($val == 1) { $more_opt .= ' DISABLED '; } break; } } //CONVERT DATE FORMAT //if (is_mysql_date($values) && $values !="") {$values=mysql_to_date($values);} //if (is_mysql_date($trueval) && $trueval !="") {$trueval=mysql_to_date($trueval);} if (is_mysql_date($values) && $values != "") { $vy = substr($values, 0, 4); $vm = substr($values, 5, 2); $vd = substr($values, 8, 2); } if (is_array($trueval)) { $vy = $trueval[year]; $vm = $trueval[month]; $vd = $trueval[day]; } if (!is_array($trueval) && $trueval != "") { $vy = substr($trueval, 0, 4); $vm = substr($trueval, 5, 2); $vd = substr($trueval, 8, 2); } if ($vy == "0000" && $vm == "00" && $vd == "00") { $vy = ""; $vm = ""; $vd = ""; } //Set default css & js if no specific found if (!strstr($more_opt, "class")) { if (isset($FORM_TEMPLATE[input_class]) && $error == 0) { $more_opt .= ' class="' . $FORM_TEMPLATE[input_class] . '" '; } if (isset($FORM_TEMPLATE[input_classe]) && $error == 1) { $more_opt .= ' class="' . $FORM_TEMPLATE[input_classe] . '" '; } } if ($jsi != 1) { if (isset($FORM_TEMPLATE[input_js]) && $error == 0) { $more_opt .= ' ' . $FORM_TEMPLATE[input_js] . ' '; } if (isset($FORM_TEMPLATE[input_jse]) && $error == 1) { $more_opt .= ' ' . $FORM_TEMPLATE[input_jse] . ' '; } } $html = $FORM_TEMPLATE[form_line][2]; //Set maximun column used for colspan calculation if ($max_col < 2) { $max_col = 2; } $tmp_val = $vd . '/' . $vm . '/' . $vy; if ($tmp_val == "//") { $tmp_val = ""; } $output .= '<table style="padding: 0; margin: 0;" cellspacing="0" cellpadding="0"><tr><td style="padding: 0; margin: 0;"><input autocomplete="OFF" type="text" id="dt_' . $name . '" name="' . $name . '" onClick="this.select();" value="' . $tmp_val . '" ' . $more_opt . '></td>'; $output .= "<td style='padding: 0; margin: 0;'><button id='btn_cal_{$name}'>Calendario</button></td></tr></table>"; $output .= "<script type='text/javascript'>\n\t\$(function() {\n\t\t\$.datepicker.setDefaults( \$.datepicker.regional[ 'it' ] );\n\t\t\$( '#dt_{$name}' )\n\t\t\t\t.css('border-right', 'none')\n\t\t\t\t.datepicker()\n\t\t\t\t.removeClass( 'ui-corner-all' )\n\t\t\t\t.addClass( 'ui-corner-left' );\n\t\t\$( '#btn_cal_{$name}' )\n\t\t\t\t.button({\n icons: {\n primary: 'ui-icon-calendar'\n },\n text: false\n })\n\t\t\t\t.removeClass( 'ui-corner-all' )\n\t\t\t\t.addClass( 'ui-corner-right' )\n\t\t\t\t.css( 'height', '1.65em' )\n\t\t\t\t.click(function() { toggleDP(\"#dt_{$name}\"); return false; } )\n ;\n\t});\n\t</script>"; if ($error == 0) { $html = str_replace("%[TR_CSS]%", $cur_style[css], $html); $html = str_replace("%[TR_JS]%", $cur_style[js], $html); } else { $html = str_replace("%[TR_CSS]%", $cur_style[csse], $html); $html = str_replace("%[TR_JS]%", $cur_style[jse], $html); } if (strstr($input[er_check], "min::")) { $req = FW_REQ; } if ($error == 0) { $html = str_replace("%[TD1]%", $req . $input[title], $html); } else { $html = str_replace("%[TD1]%", '<img src="' . $FORM_TEMPLATE[field_error_pic] . '" border=0 hspace=2 align=absmiddle> ' . $input[title], $html); } $html = str_replace("%[TD2]%", $output, $html); return $html; }
print draw_form($thissearch[form], $module); } } else { // ERRORI NELLA FORM $thissearch = load_fwobject("search", $module, 0); print draw_form($thissearch[form], $module); } } elseif ($_GET[form_id] == "print_pres2") { // SECONDO POST PER LE PARCELLE !!! $thissearch = load_fwobject("search", $module, 3); $error = check_form($thissearch[form], $_GET, $page); if ($error == 1) { $filename = get_unique_name(); $P = $_SESSION[export][form1]; $day_from = is_mysql_date($P['day_from']) ? $P['day_from'] : ''; $day_to = is_mysql_date($P['day_to']) ? $P['day_to'] : ''; $ref_id = is_numeric($P['ref_id'][realval][0]) ? $P['ref_id'][realval][0] : ''; $clie = is_numeric($P['clie'][realval][0]) ? $P['clie'][realval][0] : ''; $codice = is_numeric($P['codice'][realval][0]) ? $P['codice'][realval][0] : ''; $operatore = is_numeric($P['operatore'][realval][0]) ? $P['operatore'][realval][0] : ''; $pr_prof_orig = is_numeric($P['pr_prof_orig'][realval][0]) ? $P['pr_prof_orig'][realval][0] : ''; $pr_dept = strlen($P['pr_dept'][0]) ? $P['pr_dept'][0] : ''; $pr_uff = strlen($P['pr_uff'][0]) ? $P['pr_uff'][0] : ''; $pr_tipo = strlen($P['pr_tipo'][0]) ? $P['pr_tipo'][0] : ''; $pr_referral = strlen($P['pr_referral']) ? $P['pr_referral'] : ''; $pr_uff_orig = strlen($P['pr_uff_orig'][0]) ? $P['pr_uff_orig'][0] : ''; $testo = strlen(trim($P['testo'])) ? trim($P['testo']) : ''; $note = strlen(trim($P['note'])) ? trim($P['note']) : ''; $dest = is_numeric($P['dest'][realval][0]) ? $P['dest'][realval][0] : ''; $save_doc = $P['save_doc'] == 1 ? 1 : 0; // vedere qui