function prop($obj, $getter_name, $type = "text", $size = 7, $default_value = null, $list_name = null, $comment = null) { $method_name = "get{$getter_name}"; if ($obj) { $value = call_user_func(array($obj, $method_name)); } else { $value = ""; } if ($value === null) { $value = $default_value; } return "<tr style='font-size:12px;'><td>{$getter_name}</td>" . createInput($getter_name, $type, $size, $value, $list_name, $comment) . "</tr>"; }
function createInputs($arr, $context_id) { static $global_checked = true; static $group_prefix = ""; $str = ""; $is_ie = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false; if (!is_array($arr)) { return ''; } foreach ($arr as $input) { if ($input[0] == TESTME_GROUP_START) { // 0 - the TESTME_GROUP_START // 1 - group name (can be used as prefix for child fields) // 2 - should children be checkded by default // 3 - should children be expanded by default $id = $context_id . "_" . @$input[1]; $name = $input[1]; $global_checked = @$input[2]; $expanded = @$input[3]; $str .= "<tr><td colspan=2>" . ($is_ie ? "" : "<input type='checkbox' " . ($global_checked ? "checked=checked" : "") . " class='shouldsend' sibling_id='{$id}' onclick='enableDisableChildren ( this , \"{$id}\")'>") . "<button onclick=\"return showHideGroup ( this , '{$id}' );\">{$name}</button></td>" . "</tr>"; $str .= "<tr><td colspan=3><div style='" . ($expanded ? "" : "display:none;") . "' id='{$id}'><table>"; $group_prefix = @$input[1]; } elseif ($input[0] == TESTME_GROUP_END) { $str .= "</table></div></td></tr>"; $global_checked = true; // when exiting the score of a group - stick to checked=true $group_prefix = ""; } else { $name = $input[0]; if (strpos($name, ".") === 0) { $name = $group_prefix . "_" . substr($name, 1); // add the prefix to the name (ommit the '.') } $str .= createInput($name, @$input[1], @$input[2], @$input[3], @$input[4], @$input[5], $context_id, $global_checked); } } return $str; }
echo "Error opening words file!!<br>"; exit; } //$c = createInput(strtolower($testData[0])); $sz = array(count($allWords), 4, 4, 1); $b = 0.3; $a = 0.1; $thresh = 1.0E-6; $num_iter = 300; $prev_mse = 0; $mse; init($l, $sz, $b, $a); //Creating Input //$c = createInput(strtolower($testData)); $k = 0; foreach ($testData as $key => $value) { $c = createInput(strtolower($value)); if ($c > 0) { feedForward($allWords); $res = output(0) * 100; $res = $res - $bias; if ($res < 0) { $res *= -1; } echo $votes[$k] . " " . $res . "<br>"; } else { echo $votes[$k] . " 0<br>"; } $k++; } //echo("<p>Largest :: ".$largest."</p>");