Files
web.ems/wxc2_omc/sysDefine/ledDef/led_list_up.php
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

253 lines
6.9 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/*************************************************************************
* 文件说明:
* 功能说明:列表显示LED灯并提供修改链接
*
* 调用关系:被调用:applet_display.php
*
*
* 作者:
*
*修改注释:
*NO.1
*姓名:
*时间:
*修改说明:
*************************************************************************/
require("../../inc/header.inc");
@set_time_limit(600);
$DEBUG = 0;
$db=$omc_db;
$table_name = sysLedConf;
$sort_field = 'key_src_page_type,key_led_num';
$sort_direction = 'ASC';
$number_records_to_display = 200;
//字段名
//key_led_num shape key_status key_src_page_type key_src_page_num dst_page_type dst_page_num point_x point_y width height remark update_time
if(!isset($sel_page)){
$sel_page='0_20480';
}
$tmpArr=explode('_',$sel_page);
$sel_src_page_type = $tmpArr[0];
$sel_src_page_num = $tmpArr[1];
if($DEBUG) echo "<br>sel_src_page_type=$sel_src_page_type";
if($DEBUG) echo "<br>sel_src_page_num=$sel_src_page_num";
//---------------------------更新-----------------------------
if($mode == 'edit' && isset($selected_led_num)){
$update_sql = "UPDATE $table_name
SET shape ='$shape',
key_src_page_type = '$src_page_type',
key_src_page_num = '$src_page_num',
dst_page_type = '$dst_page_type',
dst_page_num = '$dst_page_num',
point_x = '$point_x',
point_y = '$point_y',
remark = '$remark',
sync_from_led = '$sync_from_led'
WHERE key_led_num ='$selected_led_num'
";
mysqli_query($pubConn,$update_sql);
if($DEBUG) echo "<br> update_sql = $update_sql";
echo mysqli_error($pubConn);
}
function get_page_id($page_type,$page_num,$offset){
$offset = array(20480,20489,20577);
if($page_type < 50){
$type_offset = $offset[$page_type];
switch($page_type){
case 0:
$page_type = "Map";
break;
case 1:
$page_type = "Central_office";
break;
case 2:
$page_type = "BSS";
break;
default:
$page_type = "unkown";
return($page_type);
}
$page_num = $page_num - $type_offset;
$page_id = $page_type.' - '.$page_num;
}else{
$sys_code = $page_type - 50;
$sys_type = omc_sys_code2type($sys_code);
//echo "<br>sys_type=$sys_type";
$sys_num = substr($page_num,0,2);
$subsys_num = substr($page_num,2,2);
$sys_id = $sys_type.'_'.$sys_num.'_'.$subsys_num;
$page_id = $sys_id;
}
return($page_id);
}
function get_status($status_num)
{
$status=array('blink gray','blink green','blink yellow','blink red','blink blue','blink umbra','blink white','not use','gray','green','yellow','red','blue','umbra','white','not use');
for($i=0;$i < sizeOf($status);$i++){
if($i == $status_num){
return($status[$i]);
}elseif($i == sizeOf($status)){
return('unkown');
}else{
continue;
}
}
}
?>
<script LANGUAGE="JavaScript">
function select_led(link_var){
var base_url,url,y;
base_url='./led_list_down.php?<?php echo "sel_page=$sel_page";?>&';
x = document.body.scrollLeft;
y = document.body.scrollTop;
url=base_url+link_var+'&scroll_y='+y;
window.parent.footnotes.location=url;
}
function select_page(){
var base_url,url_add,url;
base_url='./led_list_up.php?<?php echo "sel_page=";?>';
url_add=document.selectform.page_list.options[document.selectform.page_list.selectedIndex].value;
url=base_url+url_add;
window.location=url;
}
</script>
<?php
//--------------------------------列表显示-----------------------------------------------
echo "<form name=\"selectform\" method=\"POST\" action=\"./led_set_up.php\" >";
$led_page_def = array(
array('Map', 0, 20480),
array('Central Office', 1, 20489),
array('BSS-0', 2 ,20577),
array('BSS-1', 2 ,20578),
array('BSS-2', 2 ,20579),
array('BSS-3', 2 ,20580),
array('BSS-4', 2 ,20581),
array('BSS-5', 2 ,20582),
array('BSS-6', 2 ,20583),
array('BSS-7', 2 ,20584),
array('BSS-8', 2 ,20585),
array('BSS-9', 2 ,20586),
array('BSS-10', 2 ,20587),
array('BSS-11', 2 ,20588)
);
echo "<select size=\"1\" name=\"page_list\" onChange=\"javascript:select_page()\"> ";
for($i=0;$i < sizeof($led_page_def);$i++){
$pageName = $led_page_def[$i][0];
$pageTypeNo = $led_page_def[$i][1];
$pageNo = $led_page_def[$i][2];
if($pageTypeNo == $sel_src_page_type && $pageNo == $sel_src_page_num){
$isSelected = 'selected';
}else{
$isSelected = '';
}
echo "<option value=\"$pageTypeNo"."_$pageNo\" $isSelected >$pageName</option>";
}
echo "</select>";
if($scroll_y > 0){
echo "<body onLoad='self.scrollBy(0,"."$scroll_y".")'>";
}else{
echo "<body>";
}
$sel_sql = "SELECT * FROM $table_name
WHERE key_src_page_type = '$sel_src_page_type'
AND key_src_page_num = '$sel_src_page_num'
AND point_x != '999'
ORDER BY $sort_field $sort_direction
";
$result = mysqli_query($pubConn,$sel_sql);
echo mysqli_error($pubConn);
if($DEBUG)
echo "<br> sel_sql = $sel_sql";
$rows = mysqli_fetch_array($result);
?>
<table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6">
<td width="5%">LED_ID</td>
<!--<td width="10%"><?php echo "$strStatus";?></td> -->
<td width="20%"><?php echo "$strShape";?></td>
<td width="15%"><?php echo "$strSourcePage";?></td>
<!--<td width="15%"><?php echo "$strTargetPage";?></td> -->
<td width="10%"><?php echo "$strPoint";?></td>
<td width="30%"><?php echo "$strRemark";?></td>
<td width="5%" >&nbsp; </td>
</tr>
<?php
$k=0;
do{
$led_num = $rows[key_led_num];
//=0,圆形=1,正方形=2,长方形=3,三角
switch($rows[shape]){
case '0':
$shape = "$strRound";
break;
case '1':
$shape = "$strSquare";
break;
case '2':
$shape = "$strLandscapeRectangle";
break;
case '3':
$shape = "$strTriangle";
break;
case '4':
$shape = "$strPortraitRectangle";
break;
case '5':
$shape = "Cover EAN";
break;
default:
$shape= "unkown";
break;
}
$src_page_id = get_page_id($rows[key_src_page_type],$rows[key_src_page_num],$offset);
$dst_page_id = get_page_id($rows[dst_page_type],$rows[dst_page_num],$offset);
$remark = $rows[remark];
if($led_num == $selected_led_num){
$bgcolor = "bgcolor=\"#CCFFCC\"";
// }elseif($k % 16 == 0){
// $bgcolor = "bgcolor=\"#CCFFCC\"";
}else{
$bgcolor = '';
}
if($led_num < $divide_number){
$status_offset =($led_num%16)*2;
}else{
$status_offset = 0;
}
$status_substr = substr($status_rows[key_status],$status_offset,2);
$status = get_status(0);
echo "<tr $bgcolor>";
//Echo "<tr>";
echo "<td width=\"5%\">$led_num</td>";
//echo "<td width=\"10%\">$status</td>";
echo "<td width=\"10%\">$shape</td>";
echo "<td width=\"15%\">$src_page_id</td>";
//echo "<td width=\"15%\">$dst_page_id</td>";
echo "<td width=\"10%\">($rows[point_x],$rows[point_y])</td>";
echo "<td width=\"30%\">$remark</td>";
echo "<td width=\"5%\"><a href=javascript:select_led('led_num=$led_num&mode=edit')> Edit </a></td>";
echo "</tr>";
$k++;
}while($rows = mysqli_fetch_array($result));
?>
</table>
</form>
</body>
</html>