annotate info.php @ 8:aa7263b8e621

Oops, missed a parameter.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 04 Jan 2016 10:06:49 +0200
parents fbaf10b8be70
children 3c3fadcf13f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 // BatMUD material alloy combo and material info viewer
4
11e9da68c9c4 Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
4 // (C) Copyright 2009 - 2016 Matti 'ccr' Hämäläinen <ccr@tnsp.org>
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 require "mgeneric.inc.php";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 require "materials.inc.php";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 require "alloys.inc.php";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 $pageTitle = "Pupunen BatMUD Alloy Browser";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 $pageIndex = "info.php";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 // Static list of alloy data contributors
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 $contributors =
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 [
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 "Hair", "Malacoda", "Kiomet", "Aegenor", "Gileon", "Corto",
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 ];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 // Material type table for the type selector.
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 // Because some types are combinations, we need to have
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 // mappings for those (the last two columns)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 $matTypeTable =
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 [
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 0 => ["Organic + cloth (sewing)" , 0, 1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 1 => ["Wood + bone (carpentry)" , 5, 3],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 2 => ["Metal + alloy (blacksmithing)" , 4, 7],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 3 => ["Stone (masonry)" , 6, -1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 4 => ["Gem (gemcutting)" , 10, -1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 5 => ["Inorganic (sculpture)" , 8, -1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 6 => ["Glass (glassblowing)" , 9, -1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 7 => ["Organic" , 0, -1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 8 => ["Wood" , 5, -1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 9 => ["Metal" , 4, -1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 10 => ["Cloth" , -1, 1],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 11 => ["Bone" , -1, 3],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 12 => ["Alloy" , -1, 7],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 ];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 // Define ranges for alloy tests' "reliability" based
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 // on how many tests have been performed. Define the
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 // lower and upper bound (inclusive), informative text
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 // and CSS style for those items.
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 $matReliability =
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 [
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 [ 1, 2, "1-2 tests", "background: #a00; color: white;" ],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 [ 3, 5, "3-5 tests", "background: #750; color: white;" ],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 [ 6, 9, "6-9 tests", "background: #c90; color: black;", "color: black;" ],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 [ 10, 9999, "10 or more", "background: #080; color: white;" ],
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 ];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 function stGetMatLink($mat, $title = "", $extra = "")
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 $tmp = ($title != "") ? " title=\"".chentities($title)."\"" : "";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 return "<a href=\"/mat/".urlencode($mat)."\"".$tmp.">".chentities($mat)."</a>".$extra;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 function stGetReliabilityClass($n)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 global $matReliability;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 foreach ($matReliability as $chk)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 if ($n >= $chk[0] && $n <= $chk[1])
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 return "hits".$chk[0]."to".$chk[1];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 return "nohits";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
7
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
76 function stPrintAlloyTable($class, $currTable1, $currTable2, $nohits, $onlyMat = FALSE)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
77 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
78 global $alloyTable, $researched, $researchValue, $researchTotal;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
79 echo
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
80 "<table class=\"".$class."\">".
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
81 " <tr>\n".
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
82 " <th>-</th>\n";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
83
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
84 foreach ($currTable2 as $name)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
85 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
86 echo " <th>".stGetMatLink($name)."</th>\n";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
87 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
88 echo " </tr>\n";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
89
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
90 $researched = 0;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
91 $researchValue = 0;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
92 $researchTotal = 0;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
93
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
94 foreach ($currTable1 as $mat1)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
95 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
96 echo " <tr><th>".stGetMatLink($mat1)."</th>";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
97 foreach ($currTable2 as $mat2)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
98 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
99 // Is the combo possible?
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
100 if ($mat1 != $mat2)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
101 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
102 // Check for combination result
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
103 if (isset($alloyTable[$mat1][$mat2]))
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
104 $tmp = $alloyTable[$mat1][$mat2];
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
105 else
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
106 if (isset($alloyTable[$mat2][$mat1]))
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
107 $tmp = $alloyTable[$mat2][$mat1];
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
108 else
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
109 unset($tmp);
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
110
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
111 if ($onlyMat !== FALSE && !isset($tmp[$onlyMat]))
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
112 unset($tmp);
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
113
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
114 if (isset($tmp))
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
115 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
116 arsort($tmp);
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
117 $value = 0;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
118 foreach ($tmp as $a => $b)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
119 $value += $b;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
120
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
121 $researched++;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
122 $researchValue += $value;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
123
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
124 $slist = [];
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
125 foreach ($tmp as $a => $b)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
126 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
127 $slist[] = stGetMatLink($a,
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
128 $b." successful alloys (".$mat1." + ".$mat2." = ".$a.")".
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
129 (count($tmp) > 1 ? " [UNSTABLE]" : "")
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
130 );
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
131 // , " <sup>".$b."</sup>");
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
132 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
133 echo
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
134 "<td class=\"".stGetReliabilityClass($value)."\">".
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
135 join(" <span class=\"alternate\">/</span> ", $slist)."</td>";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
136 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
137 else
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
138 if ($nohits)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
139 echo "<td class=\"nohits\" title=\"Not researched\">?</td>";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
140 else
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
141 echo "<td class=\"nohits\"></td>";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
142
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
143 $researchTotal++;
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
144 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
145 else
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
146 {
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
147 echo "<td class=\"impossible\" title=\"Impossible combination\">-</td>";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
148 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
149 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
150 echo "</tr>\n";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
151 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
152 echo
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
153 "</table>\n";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
154 }
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
155
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
156
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 // Actual main code begins
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 $setShowOnly = intval(stGetRequestItem("o", 0, TRUE));
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 if (isset($_GET["m"]))
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 $setShowMat = trim(preg_replace("/[^a-z ]/", " ", strtolower($_GET["m"])));
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 $setShowMat = preg_replace("/ +/", " ", $setShowMat);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 $setShowMatName = strtoupper(substr($setShowMat, 0, 1)).substr($setShowMat, 1);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 $setSwapRows = (isset($_GET["swap"]) && is_array($_GET["swap"])) ? $_GET["swap"] : array();
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 // Generate CSS and information snippets into temporary arrays
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 $extraCSS = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 $extraInfo = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 foreach ($matReliability as $chk)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 $tmps = "hits".$chk[0]."to".$chk[1];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 $extraCSS[] = " td.".$tmps.", .".$tmps." { ".$chk[3]." }";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 if (isset($chk[4]))
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 $extraCSS[] = " td.".$tmps." a { ".$chk[4]." }";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 $extraInfo[] = "<span class=\"hits".$chk[0]."to".$chk[1]."\"><b>".$chk[2]."</b></span>";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 // Let's start pooping out the page
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 cmPrintPageHeader($pageTitle, "
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 <meta name=\"robots\" content=\"nofollow\" />
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 <style type=\"text/css\">
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 span.alternate { color: red; font-weight: bold; }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 ".implode("\n", $extraCSS)."
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 td.nohits, .nohits { background: black; }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 td.impossible { background: black; color: #f00; text-align: center; }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 </style>
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 ");
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 "<h1>".$pageTitle."</h1>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 "<form action=\"".$pageIndex."\" method=\"get\">\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 "<table class=\"optionsTable\" width=\"100%\">\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 " <tr>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 " <th width=\"25%\">Show type</th>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 " <td rowspan=\"3\" class=\"infobox\">\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 " [<a href=\"".$pageIndex."\">Reset/Clear</a>] [<a href=\"index.php\">Material browser</a>]\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 " <br />\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 " <ul>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 " <li><b>Also available in <a href=\"alloys.txt\">ASCII plaintext format</a>.</b></li>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 " <li><b><a href=\"instructions.php\">Read this</a> for instructions on how you can collect and submit your own alloy research data.</b></li>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 " <li>Only 2-material alloys are supported by this browser.</li>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 " <li>There may be errors, and lots of combinations are not researched yet.</li>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 " <li>The cell colour reflects how \"reliable\" the information is: ".implode(", ", $extraInfo).".</li>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 if (isset($contributors) && count($contributors) > 0)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 $tmp = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 foreach ($contributors as $key)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 $tmp[] = "<b>".$key."</b>";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 echo " <li>Thanks to the following people for providing alloying data: ".join(", ", $tmp).".</li>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 " </ul>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 " </td>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 " </tr>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 " <tr>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 " <td class=\"icenter\">\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 " <select name=\"o\">\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 // Output the type selectors
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 foreach ($matTypeTable as $key => $value)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 $n = 0;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 foreach ($matDataTable as $name => $data)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 if ($data[14] == $value[1] || $data[14] == $value[2])
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 $n++;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 $matTypeTable[$key][] = $n;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 printf(
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 " <option value=\"%s\"%s>%-30s [%d]</option>\n",
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 $key,
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 ($setShowOnly == $key ? " selected=\"selected\"" : ""),
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 chentities($value[0]), $n);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 " </select>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 " </td>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 " </tr>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 " <tr>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 " <td class=\"icenter\"><input type=\"submit\" value=\" Filter \" class=\"isubmit\" /></td>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 " </tr>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 "</table>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 "</form>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 // Now, act accordingly ..
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 if (isset($setShowMat))
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 // We are showing information about one specific material
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 if (!isset($matDataTable[$setShowMat]))
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 "<h2>Error! No such material '".chentities($setShowMatName)."'</h2>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 "<p>Material is not known. Check spelling.</p>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 else
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 // Print material information table
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 "\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 "<h2>".chentities($setShowMatName)."</h2>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 "<table class=\"materialInfo\" width=\"95%\">\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 $n = 0;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 foreach ($matDataTable[$setShowMat] as $key => $val)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 if ($n == 0) echo " <tr>";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 echo "<th>".chentities($matTransNames[$key + 1])."</th><td>";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 if (is_array($val))
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 $tmp = [];
7
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
292 foreach ($val as $qkey)
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
293 $tmp[] = chentities($matTransTable[$key][$qkey]);
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 echo join(", ", $tmp);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 else
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 echo chentities($matTransTable[$key][$val]);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300 echo "</td>";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 if (++$n >= 3) { echo "</tr>\n"; $n = 0; }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 if ($n != 0) echo "</tr>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 "</table>\n\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 // Show alloy combinations table for this material
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 echo "<h3>Alloy combinations</h3>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311 if (isset($alloyRevTable[$setShowMat]))
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 "<table class=\"alloyTable\">".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 " <tr>\n".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 " <th>+</th>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 foreach ($alloyRevTable[$setShowMat] as $key => $value)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 echo "<th>".stGetMatLink($key)."</th>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 " </tr>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325 $ptable1 = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326 $ptable2 = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 foreach ($matDataTable as $name1 => $data1)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 foreach ($matDataTable as $name2 => $data2)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329 if (isset($alloyRevTable[$setShowMat][$name1][$name2]))
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 $ptable1[$name1] = 1;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332 $ptable2[$name2] = 1;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335 foreach ($ptable2 as $name2 => $pz2)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337 echo "<tr><th>".stGetMatLink($name2)."</th>";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338 foreach ($ptable1 as $name1 => $pz1)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340 $hit = isset($alloyRevTable[$setShowMat][$name1][$name2]);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342 if ($hit)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 $str = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 foreach ($alloyTable[$name1][$name2] as $mnam => $mdat)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346 $str[] = $mnam;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 echo "<td title=\"".$name2." + ".$name1."\" class=\"".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 ($hit ? stGetReliabilityClass($alloyRevTable[$setShowMat][$name1][$name2]) : "nohits")."\">".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 ($hit ? implode(", ", $str) : "")."</td>";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353 echo "</tr>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
354 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356 echo
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357 "</table>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
359 else
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362 // No alloy combos known, show "generic" formula
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 //
6
1c3060b27133 Change informative text so that we specifically speak of 2-material alloys.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
364 echo "<p>No known 2-material alloy combinations.</p>\n";
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365
5
a2cb596c8332 Clean up the full alloy mix computation a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
366 // Make a list of materials that match the desired material type
a2cb596c8332 Clean up the full alloy mix computation a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
367 $mats = [];
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368 foreach ($matDataTable as $name => $data)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 if ($data[14] == $matDataTable[$setShowMat][14] && $name != $setShowMat)
7
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
371 $mats[] = $name;
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373
7
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
374 echo "<p>Full mix: ".implode(" <b>+</b> ",
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
375 array_map(function($pval){ return stGetMatLink($pval); }, $mats)).
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
376 " = <b>".chentities($setShowMat)."</b></p>\n";
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
377
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
378 echo "<p>use alloying at ".implode(",", $mats)." in ".strtolower($matTransTable[14][$matDataTable[$setShowMat][14]])."_bench</p>\n";
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 // Show mix table for this material
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384 echo "<h3>Mixtable</h3>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385 if (count($alloyTable[$setShowMat]) > 0)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 {
7
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
387 stPrintAlloyTable("alloyTable", [$setShowMat], array_keys($alloyTable[$setShowMat]), FALSE);
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 else
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 echo "<p>No mixtable entries.</p>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
395 else
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398 // Print alloy table for given material type
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400 // Filter table from maintable matching desired material type(s)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401 $currTable = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
402 foreach ($matDataTable as $name => $data)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
403 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404 if ($data[14] == $matTypeTable[$setShowOnly][1] ||
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405 $data[14] == $matTypeTable[$setShowOnly][2])
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406 $currTable[] = $name;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 // Swap desired rows
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 if (count($setSwapRows) > 0)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412 $str = [];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413 $nkeys = count($currTable);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 foreach ($setSwapRows as $from => $to)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415 if ($from >= 0 && $from < $nkeys && $to >= 0 && $to < $nkeys && $to != $from)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417 $str[] = $from." &lt;=&gt; ".$to;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419 $tmp = $currTable[$from];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420 $currTable[$from] = $currTable[$to];
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421 $currTable[$to] = $tmp;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
423
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
424 if (count($str) > 0)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425 {
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426 echo "<p>Swapped rows: ".implode(", ", $str)."</p>\n";
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430 // Print out the table
8
aa7263b8e621 Oops, missed a parameter.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
431 stPrintAlloyTable("alloyTable", $currTable, $currTable, TRUE);
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 // Calculate some statistics
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 //
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436 $researchValue /= $researched * 10.0;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437 if ($researchValue > 1.0)
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438 $researchValue = 1.0;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439
7
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
440 $researchTotal /= 2;
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 $researched /= 2;
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443 printf(
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444 "<div><b>%1.2f%%</b> (%d / %d) of combinations researched. ".
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 "Estimating <b>%1.2f%%</b> overall accuracy.</div>\n",
7
fbaf10b8be70 Factorize alloy table printing to a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
446 ($researched * 100.0) / $researchTotal, $researched, $researchTotal,
0
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447 $researchValue * 100.0);
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 }
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 cmPrintPageFooter();
c4f3b5b88891 Import material and alloy stuff into new repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 ?>