Example #1
0
function fw_form_time($input, $name, $trueval = "", $error = 0)
{
    global $FORM_TEMPLATE, $cur_style, $max_col;
    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 TIME FORMAT
    if (is_mysql_time($values)) {
        $values = mysql_to_time($values);
    }
    if (is_mysql_time($trueval)) {
        $trueval = mysql_to_time($trueval);
    }
    //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;
    }
    $output .= '<input type="text" name="' . $name . '"	value="' . ($trueval != "" ? $trueval : $values) . '"	' . $more_opt . '	' . $input[js_field] . '>	';
    if ($GLOBCNT == 1) {
        $output .= "<script> document." . $CUR_FORMNAME . "." . $name . ".focus(); </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;
}
Example #2
0
 while ($l = $q->FetchRow()) {
     utf8_encode_array($l);
     if ($l[day] != $prev_day && in_array(3, $_GET[print_note])) {
         if ($prev_day != '') {
             $OO_TEXT .= render_table($curtab[name]);
         }
         $curtab = $prev_day == '' ? $tab1 : $tab2;
         new_table($curtab);
         add_table_header($curtab[name], array(EXPORT_SXW_DATE . '/' . EXPORT_SXW_TIME, EXPORT_SXW_OPER, EXPORT_SXW_IMP, EXPORT_SXW_PRAT), make_bold($oo_def_c));
         $prev_day = $l[day];
     }
     list($yy, $mm, $dd) = explode('-', $l[day]);
     $weekday = date('w', mktime(7, 0, 0, $mm, $dd, $yy));
     $weekday = $daylist[$weekday];
     $l[day] = mysql_to_date($l[day]);
     $l[time] = mysql_to_time($l[time]);
     if ($l[time] == '00:00') {
         $l[time] = '';
     }
     $opers = '';
     $ops = explode(',,', trim($l[operator]));
     $op2 = array();
     foreach ($ops as $o) {
         $op2[] = $OPER[$o][0];
         $used_operators[$o] = 1;
     }
     $opers = count($op2) ? implode(' - ', $op2) : '';
     $f1 = $rapida ? "{$l['day']}\n{$weekday}" : "{$l['day']}\n{$l['time']}\n{$weekday}";
     $f2 = "{$opers}\n";
     $f3 = "{$l['title']}\n";
     $f4 = $rapida ? $l[pr_codice] : EXPORT_SXW_NUM . "\t" . (int) $l[pr_numero] . "\n" . "{$l['pr_codice']}\n" . "{$l['pr_oggetto']}\n";