Online FengCalc

 
\n"); } print("\n"); } } function CentreItem($t) { print("$t \n"); } function CentreComment($s) { CentreItem($s); } //REM --- text-based displays // //REM show main text-based screen function showm() { global $XE; // $v=PutMapToString(); //Print("vMap=$v"); BeginTable('m',"Summary"); //headings print(""); print(''); print(''); print(''); print(""); print(""); ShowColumn("//Direction//"); ShowColumn("//Name//"); ShowColumn("//Element//"); ShowColumn("//House//"); ShowColumn("//Personal//"); ShowColumn("//Year//"); ShowColumn("//Month//"); ShowColumn("//Mountain//"); ShowColumn("//Building//"); ShowColumn("//Water//"); print(""); FOR ($i = 1; $i<=9; $i++) { print(""); $d=substr($GLOBALS['sDirnMap'],(($i)-1),1); // print("lookup: $d"); $r=GetData("DIR_$d"); // print("global: ". $GLOBALS["aData"]['Name']); $aD=$GLOBALS["aData"]; ShowColumn("**".$XE->utils->getlink($GLOBALS['sURL'] . "&page=DIRN&iShowDirn=$i", $GLOBALS["aDirNameMap"][$i-1]) . "**"); // dirn (shown in bold) ShowColumn(substr($GLOBALS["aData"]['Attr1'],0,6)); // direction name ShowColumn(GetElementName(GetKeyFromMap($i,2))); // element $d=GetKeyFromMap($i,3); if ($d "0") {
ShowColumn(" "); null AH
} else {
$r=GetData?("AUS_$d");
ShowColumn($GLOBALS["aData"]['Name']);
AH
}
$d=GetKeyFromMap($i,4);
if ($d

"0") { ShowColumn(" "); // null tick } else { $r=GetData("AUS_$d"); ShowColumn($GLOBALS["aData"]['Attr2']); // tick } ShowColumn(GetKeyFromMap($i,5)); // year-star ShowColumn(GetKeyFromMap($i,6)); // month-star ShowColumn(GetKeyFromMap($i,7) . $GLOBALS['msub']); // mountain-star ShowColumn(GetKeyFromMap($i,8)); // building-star ShowColumn(GetKeyFromMap($i,9) . $GLOBALS['wsub']); // water-star print("

\n"); } EndTable(); } //REM show index screen function showx($iDirectionKey) { BeginTable('x',"Index for " . $GLOBALS['aDirNameMap'][($iDirectionKey)-1]); $r=GetData("DIR_" . GetKeyFromMap($iDirectionKey,1)); ShowLine('Direction',$GLOBALS["aData"]['Name'] . " (" . $GLOBALS["aData"]['Attr1'] . ")"); ShowLine('Element',GetElementName($GLOBALS["aData"]['Attr2'])); $t=GetKeyFromMap($iDirectionKey,3); IF ($t"0") { ShowLine('<a href="#a">Qual/Place</a>',"n/a");
} ELSE {
$r=GetData?("AUS_$t");
ShowLine('<a href="#a">Qual/Place</a>',$GLOBALS["aData"]['Name']);
}
$t=GetKeyFromMap($iDirectionKey,4);
IF ($t

"0") { ShowLine('Qual/Pers',"n/a"); } ELSE { $r=GetData("AUS_$t"); ShowLine('Qual/Pers',$GLOBALS["aData"]['Attr2']); } ShowLine('Year-star',GetKeyFromMap($iDirectionKey,5)); ShowLine('Month-star',GetKeyFromMap($iDirectionKey,6)); ShowLine('Mntn-star', GetKeyFromMap($iDirectionKey,7) . $GLOBALS['msub']); ShowLine('Bldg-star',GetKeyFromMap($iDirectionKey,8)); ShowLine('Water-star', GetKeyFromMap($iDirectionKey,9) . $GLOBALS['wsub']); EndTable(); //REM show dirn screen - $sCurDirn has num of direction BeginTable('d',"Direction details"); $r=GetData("DIR_" . GetKeyFromMap($iDirectionKey,1)); ShowLine("Dir'n",$GLOBALS["aData"]['Name']); ShowLine("Trigram",$GLOBALS["aData"]['Attr1'] . " <" . GetKeyFromMap($iDirectionKey,1) . ">"); ShowLine('Element',GetElementName($GLOBALS["aData"]['Attr2'])); ShowLine("Family",$GLOBALS["aData"]['Attr3']); ShowLine("Colour",$GLOBALS["aData"]['Attr4']); ShowLine("Keywords",$GLOBALS["aData"]['Keywords']); EndTable(); //REM show elem screen BeginTable('e',"Element details"); $r=GetData("ELEM_" . GetKeyFromMap($iDirectionKey,2)); ShowLine("Element",$GLOBALS["aData"]['Name']); $sElemList=$GLOBALS["aData"]['List']; ShowLine("Links","//Prev:// " . GetElementName(substr($sElemList,0,1)) . " //Next:// " . GetElementName(substr($sElemList,1,1)) . " //Prv/D:// " . GetElementName(substr($sElemList,2,1)) . " //Nxt/D:// " . GetElementName(substr($sElemList,3,1)) ); ShowLine("Weft",(($GLOBALS["aData"]['Attr1']

'E') ? 'East group' : 'West group')); ShowLine("Shapes",$GLOBALS["aData"]['Attr2']);
ShowLine("Colours",$GLOBALS["aData"]['Attr4']);
ShowLine("Strongest",$GLOBALS["aData"]['Attr3']);
ShowLine("Keywords",$GLOBALS["aData"]['Keywords']);
EndTable();
REM show AH screen
$t=GetKeyFromMap($iDirectionKey,3);
BeginTable('a',"Qualities details (place)");
IF ($t

"0") { ShowLine("Quality","(none specified)"); } ELSE { $r=GetData("AUS_$t"); ShowLine("For place",$GLOBALS["aData"]['Name']); ShowLine("Character",$GLOBALS["aData"]['Attr1'] . " (" . $GLOBALS["aData"]['Attr3'] . ")"); ShowLine("Keywords",$GLOBALS["aData"]['Keywords']); } EndTable(); //REM show tick screen $t=GetKeyFromMap($iDirectionKey,4); BeginTable('t',"Qualities details (person)"); IF ($t

"0") {
ShowLine("Quality","(none specified)");
} ELSE {
$r=GetData?("AUS_$t");
ShowLine("For person",$GLOBALS["aData"]['Attr2']);
ShowLine("Character",$GLOBALS["aData"]['Attr1'] .
" (" . $GLOBALS["aData"]['Attr3'] . ")");
ShowLine("Keywords",$GLOBALS["aData"]['Keywords']);
}
EndTable();

$aStarNames=array("Year","Month","Mountain","Building","Water");
for ($i=5; $i<=9; $i++) {
$t=GetKeyFromMap($iDirectionKey,$i);
$s=;
if ($i==7) //mountain-star
{ $s=" - " . $GLOBALS['sMntnName'] .
" (" . $GLOBALS['fMntnFwd'] .
(($GLOBALS['msub']==) ? : ":subst") . ")"; }
elseif ($i==9) //water-star
{ $s=" - " . $GLOBALS['sWaterName'] .
" (" . $GLOBALS['fWaterFwd'] .
(($GLOBALS['wsub']==) ? : ":subst") . ")"; }
BeginTable('y',$aStarNames[$i-5] . "-star details ($t)$s");
IF ($t=="0") {
ShowLine("Star-number","(none specified)");
} ELSE {
$r=GetData("NUM_$t");
ShowLine("Star-number","$t (" . $GLOBALS["aData"]['Attr4'] . ")");
ShowLine("Character",$GLOBALS["aData"]['Name']);
ShowLine("Supported",$GLOBALS["aData"]['Attr1']);
ShowLine("Unsupported",$GLOBALS["aData"]['Attr2']);
ShowLine("Sang/Liu",$GLOBALS["aData"]['Attr3'] .
" [" . $GLOBALS["aData"]['List'] . "]");
ShowLine("Keywords",$GLOBALS["aData"]['Keywords']);
}
EndTable();
}
} // end of detail-display

function GetElementName($e) {
$s=($e)-1; $s*=5;
return substr("Wood Fire EarthMetalWater",$s,5);
}

// is a new screen (possibly)
function BeginTable($sScrKey,$sTitle) {
print("===");
// IF (!strpos("deatyonfw",$sScrKey)) { // is index table
IF (!ereg($sScrKey,"deatyonfw",$a)) { // is index table
print("$sTitle");
} else { // is a direction-based 'screen'
// print("<a name=\"#$sScrKey\">$sTitle</a> [" . $GLOBALS['aDirNameMap'][($GLOBALS['iShowDirn'])-1] ."]");
print("<a name=\"#$sScrKey\">$sTitle</a>");
}
print("===\n<table>\n");
}

function ShowColumn($txt) {
print("<td>$txt</td>\n");
}

function ShowLine($sCaption,$sText)
{
print("<tr><td valign=\"top\">**$sCaption**</td>");
print("<td valign=\"top\">$sText</td></tr>\n");
}

function EndTable() {
print("</table>\n");
}

///////////// end of functions ///////////////

$aNow=GetDate(time());
if (!isset($iWorkChnYear)) {
$iWorkChnYear=$aNow["year"]; // current Chinese year
}
if (!isset($iWorkChnMonth)) {
$iWorkChnMonth=1; // current Chinese month
}
if (!isset($iRuleSector)) {
$iRuleSector=1; // ruling sector - South
}
if (!isset($iBirthYear)) {
$iBirthYear=$aNow["year"]; // birth year
}
if (!isset($iGender)) {
$iGender=1; // gender - male
}
if (!isset($iHouseYear)) {
$iHouseYear=$aNow["year"]; // building year
}
if (!isset($iFacingDeg)) {
$iFacingDeg=0; // facing degrees - north
}
if (!isset($iSubstStar)) {
$iSubstStar=1; // star-substitution system - none
}

//rotation cursor - default, rotate clockwise, counterclockwise
if (!isset($gcrsr)) {
$gcrsr=0;
}
if (isset($btnCW)) {
$gcrsr++;
if ($gcrsr==8)
{$gcrsr=0;}
}
if (isset($btnCCW)) {
$gcrsr--;
if ($gcrsr==-1)
{$gcrsr=7;}
}

if (isset($vmap)) {
GetMapFromString($vmap);
}

if (!isset($page))
$page="DATA";

//REM --- end assignments -- begin start-up ---
//
if ($page=="SUMM") {
if (isset($btnNew)) {
$gcrsr=0; //reset view to south-at-top
$r=GetData("DIR_" . substr($sDirnMap,$iRuleSector-1,1));
// // 'AUS_' map
$sAusMap=substr($GLOBALS["aData"]['List'],0,8);
// // birth-number for tickmap
$i=YearNumber($iBirthYear-1900,$iGender);
$r=GetData("DIR_$i");
if ($i==5 and $iGender<>1) { // fudge for 'centre' for female
$sTickMap=substr($GLOBALS["aData"]['List'],9,8);
} else {
$sTickMap=substr($GLOBALS["aData"]['List'],0,8);
}
$iClientNum=$i; // client-number
$iYearStar=YearNumber($iWorkChnYear-1900,1); // year-star
$j=$iYearStar; // calculate month-star
WHILE ($j > 3)
{ $j-=3; }
IF ($j==1)
{ $iMonthStar=8; }
ELSEIF ($j==2)
{ $iMonthStar=2; }
ELSE
{ $iMonthStar=5; }
$iMonthStar-=($iWorkChnMonth-1);
WHILE ($iMonthStar < 1)
{ $iMonthStar=$iMonthStar+9; }
$i=$iHouseYear; // calculate building-age star
IF ($i<=1863)
{ $i=$i+180; } // sequence wrap
$i=$i-1863;
$j=1; WHILE ($i>20) {
$i-=20; $j++; IF ($j>9) {$j-=9; }
}
$iBldgStar=$j;
FOR ($i = 1; $i<=9; $i++ ) {
$r=$i-1;
$d=substr($sDirnMap,$r,1);
$r=GetData("DIR_$d");
PutKeyToMap($i,1,$d);
PutKeyToMap($i,2,$GLOBALS["aData"]['Attr2']);
PutKeyToMap($i,3,strpos($sAusMap,$d)+1); // AH
PutKeyToMap($i,4,strpos($sTickMap,$d)+1); // tick
PutKeyToMap($i,5,NumFromSeqn($i,$iYearStar,1)); // year-star
PutKeyToMap($i,6,NumFromSeqn($i,$iMonthStar,1)); // month-star
// // skip mountain-star (row 7), water-star (row 9) until all done
PutKeyToMap($i,8,NumFromSeqn($i,$iBldgStar,1)); // building-star
}
//REM identify mountain/water star sector (start with mountain star)
$p = $iFacingDeg;
$p+=22; // 22deg to align to N as _sitting_ direction
WHILE ($p>360)
{ $p-=360; }
IF ($p==0)
{ $p=360; }
$j=1; WHILE ($p>45)
{ $p-=45; $j++; }
IF ($p>30)
{ $y='C'; } // 'C' star
ELSEIF ($p>15)
{ $y='B'; } // 'B' star
ELSE
{ $y='A'; } // 'A' star
//REM check if substitute star required
$i=$p; WHILE ($i>15)
{ $i-=15; }
$fSubst=0; // default to no substitution
switch($iSubsStar) {
case 1:
// // 'none' - do nothing
break;
case 2: // 'Lo 1deg'
IF ($p<=1) {
IF ($y=='A' or $y=='B')
{$fSubst=1;} // substitute
} ELSEIF ($p>=15) {
IF ($y=='A' or $y=='C')
{$fSubst=1;}
}
break;
case 3: // 'Lo 2deg'
IF ($p<=2) {
IF ($y=='A' or $y=='B')
{$fSubst=1;}
} ELSEIF ($p>=14) {
IF ($y=='A' or $y=='C')
{$fSubst=1;}
}
break;
case 4: // 'Lo 3deg'
IF ($p<=3) {
IF ($y=='A' or $y=='B')
{$fSubst=1;}
} ELSEIF ($p>=13) {
IF ($y=='A' or $y=='C')
{$fSubst=1;}
}
break;
case 5: // 'Yu 1deg'
IF ($p<=1 or $p>=15)
{$fSubst=1;}
break;
case 6: // 'Yu 2deg'
IF ($p<=2 or $p>=14)
{$fSubst=1;}
}
$z=ord($y)-64;
//REM get mountain-star data
$d=GetKeyFromMap($j,8);
$msub=;
IF ($d

"5") { // special case $r=GetData("STR_" . GetKeyFromMap(5,8)); // bldg-age star $fMntnFwd=substr($GLOBALS["aData"]['List'],$z,1); // forward/back flag $sMntnName="(n/a)"; } ELSE { // normal case $r=GetData("STR_$d"); $fMntnFwd=substr($GLOBALS["aData"]['List'],$z,1); // forward/back flag // point A. to effective star record IF ($y

'A') { $k=$GLOBALS["aData"]['Attr1']; }
ELSEIF ($y

'B') { $k=$GLOBALS["aData"]['Attr2']; } ELSE { $k=$GLOBALS["aData"]['Attr3']; } $r=GetData($k); $sMntnName=$GLOBALS["aData"]['Name']; IF ($fSubst) { $d=$GLOBALS["aData"]['Attr3']; // substitute star $msub="*"; } } $iMntnStar=$d; FOR ($i=1; $i<=9; $i++) { PutKeyToMap($i,7,NumFromSeqn($i,$d,($fMntnFwd

'F' ? 1 : 0)));
}
REM get water-star data
$j-=4; IF ($j<1)
{ $j+=8; } adjust for S start
$d=GetKeyFromMap($j,8);
$wsub=;
IF ($d=="5") { // special case
$r=GetData("STR_" . GetKeyFromMap(5,8)); // bldg-age star
$fWaterFwd=substr($GLOBALS["aData"]['List'],$z,1); // forward/back flag
$sWaterName="(n/a)";
} ELSE { // normal case
$r=GetData("STR_$d");
$fWaterFwd=substr($GLOBALS["aData"]['List'],$z,1); // forward/back flag
// point A. to effective star record
IF ($y == 'A') { $k=$GLOBALS["aData"]['Attr1']; }
ELSEIF ($y == 'B') { $k=$GLOBALS["aData"]['Attr2']; }
ELSE { $k=$GLOBALS["aData"]['Attr3']; }
$r=GetData($k);
$sWaterName=$GLOBALS["aData"]['Name'];
IF ($fSubst) {
$d=$GLOBALS["aData"]['Attr3']; // substitute star
$wsub="*";
}
}
$iWaterStar=$d;
FOR ($i=1; $i<=9; $i++) {
PutKeyToMap($i,9,NumFromSeqn($i,$d,($fWaterFwd=='F' ? 1 : 0)));
}
} // if calcnew (btnNew)
//DEBUG TEST
// Print();
for ($i=0; $i<9; $i++) {
print((($i)+1) . " " . join($aValueMap[$i],",") . "
");
}
Print("
");
end DEBUG

SetURL?();
$XE->page->menuitem("$sURL&page=DATA","Online FengCalc");
$XE->page->shortname(($sClientName ? "'$sClientName'" : "Summary"));
$XE->page->headline("FengCalc summary" . ($sClientName ? " for '$sClientName'" : ));
$XE->page->show();
showg();
showm();
} // has btnNew or rotate
elseif ($page=="DIRN") {
SetURL();
//DEBUG TEST
// Print("vMap=$vMap");
// Print();
for ($i=0; $i<9; $i++) {
print((($i)+1) . " " . join($aValueMap[$i],",") . "
");
}
Print("
");
end DEBUG

$XE->page->menuitem("$sURL&page=DATA","Online FengCalc");
$XE->page->menuitem("$sURL&page=SUMM", ($sClientName!=?"'$sClientName'":"Summary"));
$XE->page->shortname($GLOBALS['aDirNameMap'][($iShowDirn)-1]);
$XE->page->headline("Details for " . $GLOBALS['aDirNameMap'][($iShowDirn)-1]);

$XE->page->show();

showx($iShowDirn);

} has direction
else {

$XE->page->show();

print("

FengCalc details

\n"); print($FORM->start("$sSelf&page=SUMM"));
print("<table>\n");

print("<tr><td colspan=\"2\">Client information</td></tr>\n");
print("<tr><td>Client name</td><td>\n");
print($FORM->text("sClientName",$sClientName));
print("</td></tr>\n");
print("<tr><td>Birth year
(Chinese, from 4 Feb)</td><td>\n");
print($FORM->text("iBirthYear",$iBirthYear));
print("</td></tr>\n");
print("<tr><td>Gender</td><td>\n");
print($FORM->select("iGender",$lstGender,$iGender));
print("</td></tr>\n");

print("<tr><td colspan=\"2\">
Applicable date</td></tr>\n");
print("<tr><td>Chinese year (from 4 Feb)</td><td>\n");
print($FORM->text("iWorkChnYear",$iWorkChnYear));
print("</td></tr>\n");
print("<tr><td>Chinese month</td><td>\n");
print($FORM->select("iWorkChnMonth",$lstChnMonth,$iWorkChnMonth));
print("</td></tr>\n");

print("<tr><td colspan=\"2\">
Building details</td></tr>\n");
print("<tr><td>Construction year</td><td>\n");
print($FORM->text("iHouseYear",$iHouseYear));
print("</td></tr>\n");
print("<tr><td>'8 Houses' ruling sector</td><td>\n");
print($FORM->select("iRuleSector",$lstDirName,$iRuleSector));
print("</td></tr>\n");
print("<tr><td>Compass facing-direction</td><td>\n");
print($FORM->text('iFacingDeg',$iFacingDeg));
print("</td></tr>\n");
print("<tr><td>Star-substitution system</td><td>\n");
print($FORM->select("iSubstStar",$lstSubst,$iSubstStar));
print("</td>\n");
print("<tr><td colspan=\"2\">\n");
print($FORM->submit("btnNew","Create summary"));
print("</td></tr>\n");
print("</table>\n");
print($FORM->finish());

if previous summary exists
if (isset($iClientNum)) {
SetURL?();
print("Click ".$XE->utils->getlink("$sURL&page=SUMM","here")." to return to previous Summary page
\n");
}

}
default display - entry form

?>
""
Sorry, folks, it'll be a while before I get this one going again...
< ? php
//imports $sHome (index.php) from header
$sSelf="feng_online";

$sScreenID=; active screen ID
$sDirnMap="927618345"; dirn seqn from S clockwise
$aDirNameMap=array("South","SouthWest","West","NorthWest","North","NorthEast","East","SouthEast","Centre"); dir names from S
$sElemMap="234453113";
elem seqn from S clockwise
$sScreenKeys="deatyonfwxmg"; screens-list by indexrow, + idx, main, graphic
$lstChnMonth=array("1,Feb4-5Mar","2,Mar6-5Apr","3,Apr6-6May","4,May7-6Jun","5,Jun7-7Jul","6,Jul8?-8Aug","7,Aug9-8Sep","8,Sep9-8Oct","9,Oct9?-7Nov","10,Nov8?-7Dec","11,Dec8-6Jan","12,Jan7-3Feb");
$lstGender=array("1,Male","2,Female");
$lstDirName=array("1,South","2,SouthWest","3,West","4,NorthWest","5,North","6,NorthEast","7,East","8,SouthEast","9,Centre");
dir names from S
$lstSubst=array("1,None","2,Lo 1deg","3,Lo 2deg","4,Lo 3deg","5,Yu 1deg","6,Yu 2deg");
$aValueMap[][]=; // values map
$aData[]=;
$sURL=;

// SetURL - set up return-URL in global sURL
function SetURL() {
$s=;
$s.=$GLOBALS['sHome'];
$s.="?fid=";
$s.=$GLOBALS['sSelf'];
$s.="&iWorkChnYear=" . $GLOBALS['iWorkChnYear'];
$s.="&iWorkChnMonth=" . $GLOBALS['iWorkChnMonth'];
$s.="&iRuleSector=" . $GLOBALS['iRuleSector'];
$s.="&iBirthYear=" . $GLOBALS['iBirthYear'];
$s.="&iGender=" . $GLOBALS['iGender'];
$s.="&iHouseYear=" . $GLOBALS['iHouseYear'];
$s.="&iFacingDeg=" . $GLOBALS['iFacingDeg'];
$s.="&iSubstStar=" . $GLOBALS['iSubstStar'];
$s.="&gcrsr=" . $GLOBALS['gcrsr'];
$s.="&sClientName=" . $GLOBALS['sClientName'];
$s.="&iClientNum=" . $GLOBALS['iClientNum'];
$s.="&msub=" . $GLOBALS['msub'];
$s.="&sMntnName=" . $GLOBALS['sMntnName'];
$s.="&fMntnFwd=" . $GLOBALS['fMntnFwd'];
$s.="&wsub=" . $GLOBALS['wsub'];
$s.="&sWaterName=" . $GLOBALS['sWaterName'];
$s.="&fWaterFwd=" . $GLOBALS['fWaterFwd'];
$s.="&vmap=" . PutMapToString?();
$GLOBALS['sURL']=$s;
}

rem YrNum? - $iAdjWorkChnYear=years-1900, t=1:fwd(male),2:rev(female)
function YearNumber($iAdjWorkChnYear,$fSex)
{
$i=$iAdjWorkChnYear;
if ($fSex

1) { // 'male'/forward seqn while ($i>9) { $i=$i-9; } if ($i

0)
{ $i=9; }
$i=10-$i;
} else {
is female
$i=$i+5;
while ($i>9)
{ $i=$i-9; }
if ($i

0) { $i=9; } } return $i; } // //rem NumMap - row 1-9, centre-num 1-9, d=1:fwd,0:rev function NumFromSeqn($iRow,$iCtr,$fFwd) { if ($fFwd) { // forward map $tmp=substr("573264891",$iRow-1,1); } else { // reverse map $tmp=substr("648957321",$iRow-1,1); } $tmp=$tmp+($iCtr-1); if ($tmp>9) { $tmp=$tmp-9; } return $tmp; } //find data record function GetData($sKey) { global $db; $f=$db->query("SELECT Name,List,Attr1,Attr2,Attr3,Attr4,Keywords ". "FROM FengShui WHERE ID='$sKey'"); $db->next_record(); $GLOBALS["aData"]['Name']=$db->f('Name'); $GLOBALS["aData"]['List']=$db->f('List'); $GLOBALS["aData"]['Attr1']=$db->f('Attr1'); $GLOBALS["aData"]['Attr2']=$db->f('Attr2'); $GLOBALS["aData"]['Attr3']=$db->f('Attr3'); $GLOBALS["aData"]['Attr4']=$db->f('Attr4'); $GLOBALS["aData"]['Keywords']=$db->f('Keywords'); return TRUE; } function PutKeyToMap($i,$j,$c) { $GLOBALS['aValueMap'][$i-1][$j-1]=$c; } function GetKeyFromMap($i,$j) { return $GLOBALS['aValueMap'][$i-1][$j-1]; } function PutMapToString() { $s=""; for ($i=0; $i<9; $i++) { for ($j=0; $j<9; $j++) { $s.=$GLOBALS['aValueMap'][$i][$j]; } } return $s; } function GetMapFromString($s) { for ($i=0; $i<9; $i++) { for ($j=0; $j<9; $j++) { $t=($i)*9; $t+=$j; $GLOBALS['aValueMap'][$i][$j]=substr($s,$t,1); } } } //REM

displays

=

rem showg - show graphic version of data
function showg() {
global $XE;

$sScreenID="g";
draw content
print("<table><tr><td>");
print("<table border=\"1\">\n");
FOR ($i=1 ; $i <=9; $i++ ) {
drwdata($i);
}
print("</table>\n");
print("</td><td align=\"center\">\n");
draw comments in centre-bar
CentreComment?("Client-number=" . $GLOBALS['iClientNum']);
CentreComment?("Mountain Star=" . $GLOBALS['sMntnName'] .
" (" . $GLOBALS['fMntnFwd'] . $GLOBALS['msub'] . ")");
CentreComment?("Water Star=" . $GLOBALS['sWaterName'] .
" (" . $GLOBALS['fWaterFwd'] . $GLOBALS['wsub'] . ")");
IF ($GLOBALS['fSubst']) {
CentreComment?("(subst)");
}
print($FORM->start($GLOBALS['sURL']."&page=SUMM","post"));
print($FORM->finish(array("btnCW"=>"<< Rotate CW")));

print($FORM->start($GLOBALS['sURL']."&page=SUMM","post"));
print($FORM->finish(array("btnCCW"=>"Rotate CCW >>")));
print("</td></tr></table>\n");
}


REM
support routines for graphic display

rem DrwData? - draw data for cell I, translated to rotated dir D
function drwdata($i) {
if ($i

1 or $i

4 or $i

7) { print("

\n"); // // positions starting from top/centre/S IF ($i5) no translate for centre
{ $d=9; }
ELSE {
do translate position
$k=$i-($i>5 ? 1 : 0);
$j=substr('00041713',$k-1,1);
$j=substr('11152824',$k-1,1);
$m=$GLOBALS['gcrsr'];
$d=$k-($m+$j);
$z=$k-($m+$j);
while ($d<1)
{ $d+=8; }
}
$s= "
" . $GLOBALS['aDirNameMap'][($d)-1] . "";
CentreItem($s);

IF ($d<9) { no AH or tick for centre
$k=GetKeyFromMap($d,3); AH
$r=GetData?("AUS_$k");
$s=$GLOBALS["aData"]['Name'];
$k=GetKeyFromMap($d,4);
tick
$r=GetData?("AUS_$k");
$s .=" " . $GLOBALS["aData"]['Attr2'];
CentreItem($s);
} ELSE {
CentreItem(" ");
}
$s="";
$s .= . GetKeyFromMap($d,7) . ; MS
$s .= GetKeyFromMap($d,8);
building-star
$s .= . GetKeyFromMap($d,9) . ; WS
$s.="
";
CentreItem($s);
$s=GetKeyFromMap($d,5) . . GetKeyFromMap($d,6) . ;
yearS/monthS
CentreItem($s);
print("</td>\n");
if ($i

3 or $i

6 or $i

9) { print("

**//Sector direction//****//Sector quality//****//Flying stars//**