changeset 128:c37469a384f3 misc

Updated.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 20 Dec 2010 00:35:41 +0000
parents f819cbf438ac
children 56b84ce195d9
files materials/alloy.php
diffstat 1 files changed, 26 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/materials/alloy.php	Sun Dec 19 23:46:08 2010 +0000
+++ b/materials/alloy.php	Mon Dec 20 00:35:41 2010 +0000
@@ -94,6 +94,7 @@
         reset($val);
         if (list($nam, $lode) = each($val))
           echo htmlentities($transTable[$key][$lode]);
+
         while (list($nam, $lode) = each($val))
           echo ", ".htmlentities($transTable[$key][$lode]);
       } else {
@@ -108,16 +109,15 @@
     echo "<h3>Alloy combinations</h3>\n";
     if (isset($alloyRevTable[$showMat])) {
       echo "<ul>\n";
+
       foreach ($alloyRevTable[$showMat] as $mat1 => $value) {
         echo " <li>".matLink($mat1)." <b>+</b> ";
         reset($value);
-        if (list($a, $b) = each($value)) {
+        if (list($a, $b) = each($value))
           echo matLink($b);
-        }
         
-        while (list($a, $b) = each($value)) {
+        while (list($a, $b) = each($value))
           echo " <b>|</b> ".matLink($b);
-        }
         
         echo "<b> = ".htmlentities($showMat)."</b></li>\n";
       }
@@ -126,8 +126,23 @@
       echo "<p>No known alloy combinations.</p>\n";
     }
 
+/*
+    $typeMats = array();
+    foreach ($matTable as $name => $data) {
+      if ($data[14] == $matTable[$showMat][14] && $name != $showMat)
+        $typeMats[] = $name;
+    }
+
+    echo "Full mix: ";
+    if (list($a, $b) = each($typeMats))
+      echo matLink($b);
+        
+    while (list($a, $b) = each($typeMats))
+      echo " <b>+</b> ".matLink($b);
+    echo "<br />\n";
+*/
+
     echo "<h3>Mixtable</h3>\n";
-    
     if (count($alloyTable[$showMat]) > 0) {
       echo
       "<table class=\"matTable\">".
@@ -143,21 +158,22 @@
       }
       echo "</tr></table>\n";
     } else {
+      echo "<p>No mixtable entries.</p>\n";
     }
   }
 } else {
   $currTable = array();
-  foreach ($matTable as $key => $value) {
-    if ($value[14] == $typeTable[$showOnly][1] || $value[14] == $typeTable[$showOnly][2])
-      $currTable[$key] = $value;
+  foreach ($matTable as $name => $data) {
+    if ($data[14] == $typeTable[$showOnly][1] || $data[14] == $typeTable[$showOnly][2])
+      $currTable[$name] = $data;
   }
 
   echo "<table class=\"matTable\">".
   " <tr>\n".
   "  <th>-</th>\n";
   
-  foreach ($currTable as $key => $value) {
-    echo "<th>".matLink($key)."</th>\n";
+  foreach ($currTable as $name => $data) {
+    echo "<th>".matLink($name)."</th>\n";
   }
   echo " </tr>\n";