Location: PHPKode > projects > MM5 User Interface > mui_pack/mui/mm5_p51.php
<?php
include("mm5_p3.tpl");
//************************************
function set_years($year,$month,$day,$run,$out,$domain,$field,$level,$hour){

 print "<tr>
         <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $fy=fopen("/mm5/archive/years","r");
 $i=1;
 while(!feof($fy)){
		     $line=fgets($fy,1024);
                     if($line=="")break;
		     if($i % 6==0)print "<br>";
		     $line=str_replace("\n","",$line);
		     if($line==$year)print $line;
		     else print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$line&month=0&day=0&run=&out=&domain=0&field=&level=&hour=0\">$line</a>";
		     print "&nbsp;";
		     $i++;
                  }
 fclose($fy);
 print "</font></td></tr>";
 if($month==0){
 	$fm=fopen("/mm5/archive/$year/months","r");
 	$month=fgets($fm,1024);
        $month=str_replace("\n","",$month);
 	fclose($fm);
	}
 set_months($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
 }

function set_months($year,$month,$day,$run,$out,$domain,$field,$level,$hour){
 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $fm=fopen("/mm5/archive/$year/months","r");
 $i=1;
 while(!feof($fm)){
                    $line=fgets($fm,1024);
		    if($line=="")break;
		    if($i % 10==0)print "<br>";
                    $line=str_replace("\n","",$line);
		    if($line==$month)print $line;
		    else print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$line&day=0&run=&out=&domain=0&field=&level=&hour=0\">$line</a>";
                    print "&nbsp;";
		    $i++;
 		  }
 fclose($fm);
 print "</font></td></tr>";
 if($day==0){
	      $fd=fopen("/mm5/archive/$year/$month/days","r");
	      $day=fgets($fd,1024);
	      $day=str_replace("\n","",$day);
              fclose($fd);
 	    }
 set_days($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
 }
function set_days($year,$month,$day,$run,$out,$domain,$field,$level,$hour){
 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $fd=fopen("/mm5/archive/$year/$month/days","r");
 $i=1;
 while(!feof($fd)){
 		    $line=fgets($fd,1024);
	            if($line=="")break;
		    if($i % 14==0)print "<br>";
                    $line=str_replace("\n","",$line);
		    if($line==$day)print $line;
		    else print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$month&day=$line&run=&out=&domain=0&field=&level=&hour=0\">$line</a>";
		    $i++;
                    print "&nbsp;";
 		  }
 fclose($fd);
 print "</font></td></tr>";
 if($out==""){
 	  if(is_dir("/mm5/archive/$year/$month/$day/graph") )$out="graph";
	  else $out="rip";
	  }

 set_out($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
}

function set_out($year,$month,$day,$run,$out,$domain,$field,$level,$hour){
 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";

 		    if($out=="graph"){
		    	print "graph";
			$out="graph";
                        if(is_dir("/mm5/archive/$year/$month/$day/rip") )
				{
				print "&nbsp;";
                        	print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$month&day=$day&run=&out=rip&domain=0&field=&level=&hour=0\">rip</a>";
				}
			}
		    else{
			if(is_dir("/mm5/archive/$year/$month/$day/graph") )
				{
				print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$month&day=$day&run=&out=graph&domain=0&field=&level=&hour=0\">graph</a>";
				print "&nbsp;";
				}
		    	print "rip";
			$out="rip";
		        }

 print "</font></td></tr>";
 if($run==""){
	      $fd=fopen("/mm5/archive/$year/$month/$day/$out/runs","r");
	      $run=fgets($fd,1024);
	      $run=str_replace("\n","",$run);
              fclose($fd);
 	    }
 set_runs($year,$month,$day,$run,$out,$domain,$field,$level,$hour);

}
function set_runs($year,$month,$day,$run,$out,$domain,$field,$level,$hour){
 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $fd=fopen("/mm5/archive/$year/$month/$day/$out/runs","r");
 $i=1;
 while(!feof($fd)){
 		    $line=fgets($fd,1024);
	            if($line=="")break;
		    if($i % 5==0)print "<br>";
                    $line=str_replace("\n","",$line);
		    if($line==$run)print $line;
		    else print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$month&day=$day&run=$line&out=$out&domain=0&field=&level=&hour=0\">$line</a>";
		    $i++;
                    print "&nbsp;";
 		  }
 fclose($fd);
 print "</font></td></tr>";
 if($domain==0){
		$ft=fopen("/mm5/archive/$year/$month/$day/$out/$run/fields","r");
		$line=fgets($ft,1024);
		$line=str_replace("\n","",$line);
		$tik=split(",",$line);
		$domain=$tik[0];
		if($domain=="all")$domain="1";
		$field=$tik[1];
		$level=$tik[2];
 		fclose($ft);
		}
 set_domains($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
}

function set_domains($year,$month,$day,$run,$out,$domain,$field,$level,$hour){

 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $ary=array();
 array_push($ary,$domain);
 $ft=fopen("/mm5/archive/$year/$month/$day/$out/$run/fields","r");
 $i=1;
 $sw=0;
 while(!feof($ft)){
	$line=fgets($ft,1024);
	if($line=="")break;
        $line=str_replace("\n","",$line);
	$tik=split(",",$line);
	if(!in_array($tik[0],$ary)){
		print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$month&day=$day&run=$run&out=$out&domain=$tik[0]&field=$tik[1]&level=$tik[2]&hour=$hour\">Domain $tik[0]</a>";
		array_push($ary,$tik[0]);
	        if(($i % 4)==0)print "<br>";
		$i++;
		print "&nbsp;";
		}
	else if($sw==0){print "Domain $domain";if(($i % 4)==0)print "<br>";$i++;$sw=1;print "&nbsp;";}
	}
 fclose($ft);
 print "</font></td></tr>";
 set_fields($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
 }

function set_fields($year,$month,$day,$run,$out,$domain,$field,$level,$hour){
 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $ary=array();
 $ft=fopen("/mm5/archive/$year/$month/$day/$out/$run/fields","r");
 $sw=0;
 $i=1;
 while(!feof($ft)){
	$line=fgets($ft,1024);
	if($line=="")break;
        $line=str_replace("\n","",$line);
	$tik=split(",",$line);
	if(($tik[0]==$domain)and($tik[1]==$field)and($sw==0)){print $tik[1];$sw=1;print "&nbsp;";if($i % 5==0)print "<br>";$i++;}
	else if(($tik[0]==$domain)and($tik[1]!=$field)and(!in_array($tik[1],$ary))){
	      print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$month&day=$day&run=$run&out=$out&domain=$domain&field=$tik[1]&level=$tik[2]&hour=0\">$tik[1]</a>";
	      array_push($ary,$tik[1]);
              print "&nbsp;";
	      if($i % 5==0)print "<br>";
	      $i++;
	     }
	}
 fclose($ft);
 print "</font></td></tr>";
 set_levels($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
}

function set_levels($year,$month,$day,$run,$out,$domain,$field,$level,$hour){
 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $ary=array();
 $sw=0;
 array_push($ary,$level);
 $ft=fopen("/mm5/archive/$year/$month/$day/$out/$run/fields","r");
 $i=1;
 while(!feof($ft)){
	$line=fgets($ft,1024);
	if($line=="")break;
        $line=str_replace("\n","",$line);
	$tik=split(",",$line);
	if(($tik[0]==$domain)and($tik[1]==$field)and(!in_array($tik[2],$ary))){
			print "<a target=\"contents\" href=\"mm5_p51.php?where=y&year=$year&month=$month&day=$day&run=$run&out=$out&domain=$domain&field=$field&level=$tik[2]&hour=0\">$tik[2]</a>";
			array_push($ary,$tik[2]);
			print "&nbsp;";
			if($i % 3==0)print "<br>";
			$i++;
			}
	else if((in_array($tik[2],$ary))and($tik[1]==$field)and($tik[0]==$domain)and($sw==0)){ print $tik[2];$sw=1;print "&nbsp;";if($i % 3==0)print "<br>";$i++;}
	}
 fclose($ft);
 print "</font></td></tr>";
 set_hours($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
}

function set_hours($year,$month,$day,$run,$out,$domain,$field,$level,$hour){
 print "<tr>
        <td width=\"100%\" height=\"10\" align=\"center\"><font size=\"2\">";
 $ary=array();
 array_push($ary,$hour);
 $ft=fopen("/mm5/archive/$year/$month/$day/$out/$run/hour","r");
 $i=1;
 while(!feof($ft)){
	$line=fgets($ft,1024);
	if($line=="")break;
	if($i % 5 == 0)print "<br>";
	print "<a target=\"main\" href=\"mm5_p52.php?where=y&year=$year&month=$month&day=$day&run=$run&out=$out&domain=$domain&field=$field&level=$level&hour=$line\">$line</a>";
        print "&nbsp;";
	$i++;
	}
 fclose($ft);
 print "</font></td></tr>";
 }
//************************************
if($where!="y"){
	print $before;
	if(file_exists("/mm5/archive/years"))
		{
		$fp=fopen("/mm5/archive/years","r");
		$line=fgets($fp,1024);
		$line=str_replace("\n","",$line);
		fclose($fp);
		set_years($line,0,0,"","",0,"","",00);
		}
	print $after;
	}
else{
 	print $before;
	set_years($year,$month,$day,$run,$out,$domain,$field,$level,$hour);
	print $after;
    }

?>
Return current item: MM5 User Interface