Пример #1
0
function print_enum_multi($base, $array, $vals, $cnt, $defs, $grp = 0)
{
    global $table_ncols;
    if ($grp <= 0) {
        $grp = $cnt;
    }
    $ncell = $cnt / $grp;
    $span = ($table_ncols - 1) / $ncell;
    begin_field($base, $span);
    $nval = count($vals);
    for ($i = 0; $i < $cnt; $i++) {
        if ($i > 0 && $i % $grp == 0) {
            cont_field($span);
        }
        $name = sprintf("%s%x", $base, $i);
        echo "\t\t<select name={$name}>\n";
        if (key_in_array($name, $array)) {
            $ai = array_search($array[$name], $vals, FALSE);
        } else {
            if (key_in_array($i, $defs)) {
                $ai = $defs[$i];
            } else {
                $ai = 0;
            }
        }
        for ($j = 0; $j < $nval; $j++) {
            $val = $vals[$j];
            if ($val == '') {
                $pval = "&nbsp;";
            } else {
                $pval = "{$val}";
            }
            printf("\t\t\t<option " . "value=\"%s\"%s>%s</option>\n", $val, $j == $ai ? " selected" : "", $pval);
        }
        echo "\t\t</select>\n";
    }
    end_field();
}
Пример #2
0
}
$query .= " order by serno";
if ($serno == '') {
    $query .= " limit {$offset},{$limit}";
}
$r = mysql_query($query);
function print_cell($str)
{
    if ($str == '') {
        $str = '&nbsp;';
    }
    echo "\t<td>{$str}</td>\n";
}
while ($row = mysql_fetch_array($r)) {
    foreach ($columns as $key) {
        if (!key_in_array($key, $row)) {
            $row[$key] = '';
        }
    }
    echo "<tr>\n";
    print_cell("<a href=\"brlog.php?serno={$row['serno']}\">Log</a>");
    print_cell("<a href=\"edit.php?serno={$row['serno']}\">{$row['serno']}</a>");
    print_cell($row['ethaddr']);
    print_cell($row['date']);
    print_cell($row['batch']);
    print_cell($row['type']);
    print_cell($row['rev']);
    print_cell($row['location']);
    if ($verbose) {
        print_cell("<pre>\n" . urldecode($row['comments']) . "\n\t</pre>");
        print_cell(gather_enum_multi_print("sdram", 4, $row));