File "his_view.php"
Full path: /www/ansys/qgis/010_hitachinaka/status/his_view.php
File size: 8.76 KiB (8972 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// 自動でクラスを参照する
// 関数名 : __autoload()
// 備考 : 参照先は./class/XXX.phpとする
// 更新 : 2012/10/19 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function __autoload($className)
{
$fPath = "./class/" . str_replace("_", "/", $className) . ".php";
require_once $fPath;
}
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// 値を元に表示値を検索
// 関数名 : retView
// 備考 :
// 更新 : 2013/04/19 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function retView($value_, $list_)
{
$row = count($list_);
for($iCount = 0; $iCount < $row; $iCount++)
{
if (strcmp($list_[$iCount]["value"], $value_) == 0)
{
return $list_[$iCount]["view"];
}
}
return "<font color=\"#FF0000\">リストに存在しません[". $value_. "]</font>";
}
//===============================================
// DEBUG_MODE
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
define("DEBUG_MODE", "0");
Debug::setMode(DEBUG_MODE);
if (DEBUG_MODE == 1)
{
Stopwatch::start();
}
//===============================================
// POST、GETパラメータの受け取り
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//===============================================
if (DEBUG_MODE == 1)
{
extract($_POST);
extract($_GET);
Debug::writes($_POST);
}
//print_r($_POST);
//===============================================
// CommonUtilities
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
$PENTA_OCEAN = "五洋建設株式会社";
$TAIL_PENTA_OCEAN = "penta-ocean";
$SCRIPT_TITLE = "工事車両運行管理システム- 測位履歴確認";
$APP_ID = "21";
$CONST_ID = "12";
$WORK_STATUS = "0";
$CONST_NAME = "";
switch($WORK_STATUS)
{
case 0:
$CONST_NAME = "五洋建設 管理者用";
break;
case 1:
$CONST_NAME = "北海道TC生コン(株) 管理者用";
break;
case 2:
$CONST_NAME = "(株)野田生コンクリート 管理者用";
break;
case 3:
$CONST_NAME = "三共宇部生コン(株) 管理者用";
break;
default:
throw new Exception("作業ステータスが選択されていません");
break;
}
$TOP_FORM = "../index.php";
$VIEW_FORM = "./status_view.php";
$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";
$TERMINALS_TABLE = "qgis.ts_his_measure";
$WHERE_PATTERN = array(
"0" => array("name" => "端末名称", "object" => "terminal_name", "pattern" => "middle")
);
$VIEW_LIST = array(
// "0" => array("head" => " ", "object" => "", "width" => "12%", "type" => ""),
// "1" => array("head" => "端末名称", "object" => "terminal_name", "width" => "20%", "type" => ""),
// "2" => array("head" => "作業役割", "object" => "work_status", "width" => "14%", "type" => "1"),
"0" => array("head" => "緯度", "object" => "lat", "width" => "16%", "type" => ""),
"1" => array("head" => "経度", "object" => "lon", "width" => "16%", "type" => ""),
"2" => array("head" => "測位精度", "object" => "acc", "width" => "11%", "type" => ""),
"3" => array("head" => "車速[km/h]", "object" => "spd", "width" => "11%", "type" => ""),
"4" => array("head" => "測位時間", "object" => "mesdatetime", "width" => "24%", "type" => ""),
);
$WORK_STATUS_LIST = array(
"0" => array("value" => "0", "view" => "五洋建設職員"),
"1" => array("value" => "1", "view" => "北海道TC生コン(株)"),
"2" => array("value" => "2", "view" => "(株)野田生コンクリート"),
"3" => array("value" => "3", "view" => "三共宇部生コン(株)"),
"4" => array("value" => "999", "view" => "五洋建設職員"),
);
$PAGE_LIMIT = 30;
$editId = $_POST['editId'];
$termname = $_POST['termname'];
//===============================================
// WHERE句の作成
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//===============================================
$whereObj = "";
$whereObj .= " WHERE android_id='". $editId. "'";
$whereObj .= " AND const_id='". $CONST_ID. "'";
$whereObj .= " AND app_id='". $APP_ID. "'";
$whereObj .= " order by mesdatetime desc";
Debug::write($whereObj);
//===============================================
// HTML-HEAD-
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//===============================================
print "<html>";
print "<head>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"/ansys/config/css/style.css\">";
print "<link rel=\"shortcut icon\" href=\"/ansys/config/favicon.ico\">";
print "<title>". $SCRIPT_TITLE. "</title>";
print "</head>";
//===============================================
// HTML-BODY部開始-
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//===============================================
print "<body>";
print "<center>";
print "<font size=\"3\">";
print "<b>";
print "". $SCRIPT_TITLE. "<br>";
print "【". $PENTA_OCEAN. "】";
print "</b>";
print "</font>";
print "</center>";
print "<hr />";
try
{
//================================================
// データベース接続
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//================================================
$conn = pg_connect("
host = ". $HOST. "
dbname = ". $DB. "
user = ". $USER. "
password= ". $PASS. "
");
if (!$conn)
{
throw new Exception("データベースへの接続に失敗しました");
}
$selData = "SELECT * FROM ". $TERMINALS_TABLE;
if (strcmp($whereObj, "") != 0)
{
$selData .= $whereObj ." limit 100";
}
$selData .= ";";
Debug::write($selData);
if (!($resList = pg_query($conn, $selData)))
{
throw new Exception("アンドロイドID:[". $editId. "]のデータ取得に失敗しました<br />". $selData. "<br />". pg_last_error(). "<br />");
}
print "<B>端末名称:" .$termname ." アンドロイドID:" .$editId ."</B><BR>";
print "<form name=\"listForm\" method=\"post\" action=\"./status_list.php\" style=\"display:inline\">";
print "<a href=\"javascript:listForm.submit()\">一覧</a>";
print "</form>";
print "<table width=\"100%\" border=\"0\" bgcolor=\"#000000\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr>";
print "<td>";
print "<table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"3\">";
print "<tr bgcolor=\"#99CCFF\">";
for($iCount = 0; $iCount < count($VIEW_LIST); $iCount++)
{
print "<th style=\"width:". $VIEW_LIST[$iCount]["width"]. ";height:25px;\">";
print $VIEW_LIST[$iCount]["head"];
print "</th>";
}
print "</tr>";
for($iCount = 0; $iCount < pg_num_rows($resList); $iCount++)
{
$rowList = pg_fetch_array($resList, $iCount, PGSQL_ASSOC);
print "<tr bgcolor=\"#FFFFFF\" align=\"center\">";
for($jCount = 0; $jCount < count($VIEW_LIST); $jCount++)
{
print "<td style=\"height:25px;\">";
if (strcmp($VIEW_LIST[$jCount]["object"], "") == 0)
{
}
else if (strcmp($rowList[$VIEW_LIST[$jCount]["object"]], "") != 0)
{
switch($VIEW_LIST[$jCount]["type"])
{
case 1:
print retView($rowList[$VIEW_LIST[$jCount]["object"]], $WORK_STATUS_LIST);
break;
default:
if(($jCount == 0) || ($jCount == 1))
{
print number_format($rowList[$VIEW_LIST[$jCount]["object"]],7,".","");
}
else
{
print $rowList[$VIEW_LIST[$jCount]["object"]];
}
break;
}
}
else
{
print " ";
}
print "</td>";
}
print "</tr>";
}
print "</table>";
print "</td>";
print "</tr>";
print "</table>";
print "<input type=\"hidden\" name=\"hPage\" value=\"". $viewPage. "\">";
}
catch(Exception $exc)
{
print "<font color=\"#FF0000\">";
print "【スクリプトエラー】<br />";
print $exc->getMessage(). "<br />";
print "</font>";
}
//===============================================
// トップ画面へ戻るのLink
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
print "<form name=\"listForm2\" method=\"post\" action=\"./status_list.php\" style=\"display:inline\">";
print "<a href=\"javascript:listForm2.submit()\">一覧</a>";
print "</form>";
//===============================================
// Postgresql終了処理
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
pg_close($conn);
//===============================================
// HTML終了処理
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
print "<hr />";
print "<font size=\"3\" color=\"#000000\" face=\"Arial\">";
print "<center>";
print "<b>";
print "<i>";
print $TAIL_PENTA_OCEAN;
print "</i>";
print "</b>";
print "</center>";
print "</font>";
print "</body>";
print "</html>";
?>