<!doctype html public "-//w3c//dtd html 3.2//ja">
<html>
<head>
<title>pgctn main menu</title>
<meta http-equiv=content-type content="text/html; charset=x-euc-jp">

<link rel="stylesheet" href="menus.css" type="text/css" />
<script language="JavaScript" type="text/javascript" src="menus_main.js"></script>

<script language="JavaScript" type="text/javascript" src="DHTMLAPI.js"></script>

<script language="JavaScript" type="text/javascript">

function IMAGEreplace(cgurl){
 location.replace(cgurl);
}

<?

    @$time = getdate();
	@$aYear=$time[year];
	@$aMonth=$time[mon];
	@$aDay=$time[mday];
	@$diagtime = ( $aYear ."/".  $aMonth ."/".  $aDay  );


    @$time = getdate();
	@$aYear=$time[year];
	@$aMonth=$time[mon];
	@$aDay=($time[mday]-1);
	@$prevtime = ( $aYear ."/".  $aMonth ."/".  $aDay  );


//parameter resolving

@$permission = $_GET['permission'];
@$userid = $_GET['userid'];

@$size = $_GET['size'];
@$browser = $_GET['browser'];
@$scwidth = $_GET['scwidth'];
@$scheight = $_GET['scheight'];


?>

function change_menus(target){
  url = target + '?size=<?php echo $size ?>&browser=<?php echo $browser ?>&scwidth=<?php echo $scwidth ?>&scheight=<?php echo $scheight ?>&userid=<?php echo $userid ?>&permission=<?php echo $permission ?>&diagtime=<?php echo $diagtime ?>&prevtime=<?php echo $prevtime ?>' ;
 IMAGEreplace(url);
}

</script>

</head>
  <?php

  ?>
  



<body BACKGROUND="./img/yellow.jpg" onload="initMenus();">

<?php

//
//	2002.1.1
//	DICOM to WWW Gateway :PHP script
//	Made by Norya Yokohama % Medical Division @ WERC
//  2004.9.19
//  Updated by tadashi tsuchimoto @ MITT belong to yokohamazyuku
//	main_menu.php
//
//



  include "init.inc";
  include "param_setting.ini";
  include "sql_generator.ini";
  $include_path=".";
  require("$include_path/dbconnect.ini");


//DB query


$db_handle = db_contact_start($db_type,$target_host,$target_db);
$sql = sql_generator("main_menu");
$rtn = $db_handle->query($sql);
db_contact_end($db_handle);





$sql = "select 
	facility as facility,
	comment as comment,
	tel as tel,
	fax as fax,
	address as address,
	dept as dept,
	responsible_person as responsible_person,
	web_address as web_address,
	mail as mail 
	 from facilitylevel";
$rtn_fas = $db_handle->prepare($sql);
$rtn_fas->execute();



  while ($fas_row = $rtn_fas->fetch(PDO::FETCH_ASSOC)) {
  $facility = trim($fas_row['facility']) ;
  $comment = trim($fas_row['comment']) ;
  $tel = trim($fas_row['tel']) ;
  $fax = trim($fas_row['fax']) ;
  $address = trim($fas_row['address']) ;
  $dept = trim($fas_row['dept']) ;
  $responsible_person = trim($fas_row['responsible_person']) ;
  $web_address = trim($fas_row['web_address']) ;
  $mail = trim($fas_row['mail']) ;
  }


if($browser == "mozzila"){$size = 509;}
if($browser == "MSIE"){$size = 497;}
if(!$size){$size = 509;}
  
  print("<center>");
  if(@$facility){
  print("<font size=5><B>$facility</B></font><br>");
  }
  print("pgctn DICOM server / main query ");
  
//  system("hostname");
//  print("<br>");

  
?>



<div id="menubar">
<img id="menuImg_1" 
class="menuImg" src="./img/ordinary_off.jpg" border="0" height="20" 
width="80">



<img id="menuImg_2" 
class="menuImg" src="./img/option_off.jpg" border="0" height="20" 
width="80">



<img id="menuImg_3" 
class="menuImg" src="./img/system_off.jpg" border="0" height="20" 
width="80">


</div>

<table border=3>
<tr>

<td>


<table border=5 bordercolor=\#000000>
<tr><td>
<br>
<h3>Study List</h3>

<form action="show_study.php">

<?php



    print("<select size=17 name=patid>");
    print("PatientID__PatientName");

while($result = $rtn->fetch(PDO::FETCH_ASSOC)){

	$patid = $result['pat_id'] ;
	$patnam = $result['pat_name'] ;
	$studat = $result['study_datetime'] ;
	$mod = $result['modality'] ;
	
	$patid=trim($patid);
    $patid_url=urlencode($patid);
	$patnam=trim($patnam);
	
      $patnam = str_replace("^^^" , "", $patnam);
      $patnam = str_replace("^" , ",", $patnam);
	  
	  if($patid_flag != $patid ){
	  
	  if(!$patid_flag or ($patid_flag != $patid)){
	  $patid_flag = $patid;
	  }

      $pat_info=($studat . "_" . $mod . "_" . $patid . "_" . $patnam );
      print("<option value=$patid>$pat_info");
	  
	  // patid flag end
	  }
}
    print("</select>");





?>
<input type=hidden name=size value="<? echo$size; ?>">
<input type=hidden name=browser value="<? echo$browser; ?>">
<input type=hidden name=scwidth value="<? echo$scwidth; ?>">
<input type=hidden name=scheight value="<? echo$scheight; ?>">
<input type=hidden name=userid value="<? echo $userid; ?>">
<input type=hidden name=permission value="<? echo $permission; ?>">

<input type="submit" value="Search">
</form>

</td></tr>
</table>



</td></tr>
</table>



<center>

</body>
</html>
