Exemplo n.º 1
0
$s = "SELECT * FROM cfg_field_props WHERE TABLE_NAME='INT_TAG_MAPPING' ORDER BY FIELD_ORDER";
$re = mysql_query($s) or die("fail: " . $s . "- error:" . mysql_error());
while ($row = mysql_fetch_array($result)) {
    $i++;
    $ids .= "{$row['ID']};";
    if ($i % 2 == 0) {
        $bgcolor = "#eeeeee";
    } else {
        $bgcolor = "#f8f8f8";
    }
    $x_system = str_replace("value='{$row['SYSTEM_ID']}'", "value='{$row['SYSTEM_ID']}' selected", $c_system);
    $x_freq = str_replace("value='{$row['FREQUENCY']}'", "value='{$row['FREQUENCY']}' selected", $c_freq);
    $x_override = str_replace("value='{$row['ALLOW_OVERRIDE']}'", "value='{$row['ALLOW_OVERRIDE']}' selected", $c_override);
    $x_table = str_replace("value='{$row['TABLE_NAME']}'", "value='{$row['TABLE_NAME']}' selected", $c_table);
    $x_object = str_replace("value='{$row['OBJECT_ID']}'", "value='{$row['OBJECT_ID']}' selected", $c_object);
    $x_column = loadCodes("INT_TABLE_COLUMN", false, "TABLE_NAME", $row[TABLE_NAME], $row[COLUMN_NAME], "", "COLUMN_NAME", "COLUMN_NAME");
    if (!$x_column) {
        $x_column = "<option value='{$row['COLUMN_NAME']}'>{$row['COLUMN_NAME']}</option>";
    }
    $x_eventtype = str_replace("value='{$row['EVENT_TYPE']}'", "value='{$row['EVENT_TYPE']}' selected", $c_eventtype);
    $x_flowphase = str_replace("value='{$row['FLOW_PHASE']}'", "value='{$row['FLOW_PHASE']}' selected", $x_flowphase);
    $tablename = $row[TABLE_NAME];
    echo "<tr id='oldRow{$row['ID']}' bgcolor='{$bgcolor}' height='26'>";
    mysql_data_seek($re, 0);
    while ($ro = mysql_fetch_array($re)) {
        $f = $ro[COLUMN_NAME];
        if ($f == 'SYSTEM_ID') {
            echo "<td><select size='1' style='width:100%' name='SYSTEM_ID" . $row[ID] . "'>" . $x_system . "</select></td>";
        } else {
            if ($f == 'FREQUENCY') {
                echo "<td><select size='1' style='width:100%' name='FREQUENCY" . $row[ID] . "'>" . $x_freq . "</select></td>";
Exemplo n.º 2
0
            }
        }
    }
    $sSQL = "select id,name from {$tableName} where facility_id='{$facility_id}'";
    $result = mysql_query($sSQL) or die("fail: " . $sSQL . "-> error:" . mysql_error());
    while ($row = mysql_fetch_array($result)) {
        $s .= "<option value='{$row['id']}'" . ($row[id] == $currentID ? "selected" : "") . ">{$row['name']}</option>\r\n";
    }
    echo $s . $ff;
    exit;
}
$tableName = strtoupper($_REQUEST['table']);
$parentField = $_REQUEST['parent_field'];
$parentValue = $_REQUEST['parent_value'];
$current_value = $_REQUEST['current_value'];
$firstblank = $_REQUEST['first_blank'];
$sWhere = $_REQUEST['where'];
$sOrderBy = $_REQUEST['orderby'];
$ValueField = $_REQUEST['value_field'];
$TextField = $_REQUEST['text_field'];
if ($tableName == "FACILITY" && $DATA_SCOPE_FACILITY) {
    $sWhere = ($sWhere ? "({$sWhere}) and " : "") . "ID={$DATA_SCOPE_FACILITY}";
}
if ($tableName == "LO_AREA" && $DATA_SCOPE_AREA) {
    $sWhere = ($sWhere ? "({$sWhere}) and " : "") . "ID={$DATA_SCOPE_AREA}";
}
if ($tableName == "LO_PRODUCTION_UNIT" && $DATA_SCOPE_PU) {
    $sWhere = ($sWhere ? "({$sWhere}) and " : "") . "ID={$DATA_SCOPE_PU}";
}
echo loadCodes($tableName, $firstblank, $parentField, $parentValue, $current_value, $sWhere, $ValueField ? $ValueField : "ID", $TextField ? $TextField : "NAME", $sOrderBy);
Exemplo n.º 3
0
}
$facility_id = $_REQUEST[facility_id];
$object_type = $_REQUEST[object_type];
$object_id = $_REQUEST[object_id];
$xtable = getOneValue("select CODE from INT_OBJECT_TYPE where id={$object_type}");
$c_system = loadCodes('INT_SYSTEM');
$c_freq = loadCodes('CODE_READING_FREQUENCY');
$c_override = loadCodes('CODE_BOOLEAN');
$c_table = loadComboFromSQL("select TABLE_NAME ID,TABLE_NAME `NAME` from INT_MAP_TABLE where OBJECT_TYPE={$object_type}");
$first_table = getOneValue("select TABLE_NAME from INT_MAP_TABLE where OBJECT_TYPE={$object_type} limit 1");
if ($first_table) {
    $x_column = getTableFields($first_table, "decimal", "", false);
}
$c_object = loadComboFromSQL("select ID,`NAME` from {$xtable} where FACILITY_ID={$facility_id} order by `NAME`");
$c_eventtype = loadCodes('CODE_EVENT_TYPE');
$c_flowphase = loadCodes('CODE_FLOW_PHASE');
$x_system = $c_system;
$x_freq = $c_freq;
$x_override = $c_override;
$x_table = $c_table;
$x_object = $c_object;
$x_eventtype = $c_eventtype;
$x_flowphase = $c_flowphase;
$fields = getField("INT_TAG_MAPPING");
$sSQL = "select a.*\n\tfrom INT_TAG_MAPPING a,{$xtable} b \n\twhere a.OBJECT_ID=b.ID and b.FACILITY_ID={$facility_id} and a.OBJECT_TYPE={$object_type}" . ($object_id > 0 ? " and a.OBJECT_ID={$object_id}" : "");
$result = mysql_query($sSQL) or die("fail: " . $sSQL . "-> error:" . mysql_error());
$i = 0;
$ids = "";
$table_width = getTableWidth("INT_TAG_MAPPING");
$s = "SELECT * FROM cfg_field_props WHERE TABLE_NAME='INT_TAG_MAPPING' ORDER BY FIELD_ORDER";
$re = mysql_query($s) or die("fail: " . $s . "- error:" . mysql_error());