} $useragents = array(); $runResult = mysql_queryf("SELECT run_client.client_id as client_id, run_client.status as status, run_client.fail as fail, run_client.error as error, run_client.total as total, clients.useragent_id as useragent_id, users.name as name, useragents.name as browser FROM useragents, run_client, clients, users WHERE run_client.run_id=%u AND run_client.client_id=clients.id AND clients.user_id=users.id AND useragents.id=useragent_id ORDER BY browser;", $row["run_id"]); while ($ua_row = mysql_fetch_assoc($runResult)) { if (!$useragents[$ua_row['useragent_id']]) { $useragents[$ua_row['useragent_id']] = array(); } array_push($useragents[$ua_row['useragent_id']], $ua_row); } $output .= '<tr><th><a href="' . $row["run_url"] . '">' . $row["run_name"] . "</a></th>\n"; } if ($addBrowser) { array_push($browsers, array("name" => $row["browsername"], "engine" => $row["browser"], "os" => $row["os"], "id" => $row["useragent_id"])); } #echo "<li>" . $row["browser"] . " (" . get_status(intval($row["status"])) . ")<ul>"; $last_browser = ""; if ($useragents[$row["useragent_id"]]) { foreach ($useragents[$row["useragent_id"]] as $ua) { $status = get_status2(intval($ua["status"]), intval($ua["fail"]), intval($ua["error"]), intval($ua["total"])); if ($last_browser != $ua["browser"]) { $output .= "<td class='{$status} " . $row["browser"] . "'><a href='/?state=runresults&run_id=" . $row["run_id"] . "&client_id=" . $ua["client_id"] . "'>" . ($ua["status"] == 2 ? $ua["total"] < 0 ? "Err" : ($ua["error"] > 0 ? $ua["error"] : ($ua["fail"] > 0 ? $ua["fail"] : $ua["total"])) : "") . "</a></td>\n"; } $last_browser = $ua["browser"]; } } else { $output .= "<td class='notstarted notdone'> </td>"; } #echo "</ul></li>"; $last = $row["run_id"]; } echo "{$output}</tr>\n</tbody>\n</table>";
function get_useragent_results($uas, $row, $browser, $max) { $out = '<td class="results ' . $browser["name"] . ' ' . $browser["os"] . '">'; $count = count($uas); $result_size = $max / $count; if ($max == 1) { $result_size = 1.7; } foreach ($uas as $ua) { $status = get_status2(intval($ua["status"]), intval($ua["fail"]), intval($ua["error"]), intval($ua["total"])); $out .= "<div class='{$status} " . $browser["name"] . ' ' . $browser["os"] . "' style='height: " . $result_size . "em;'><a href='" . $GLOBALS['contextpath'] . "/?state=runresults&run_id=" . $row["run_id"] . "&client_id=" . $ua["client_id"] . "'>" . ($ua["status"] == 2 ? $ua["total"] < 0 ? "0" : ($ua["error"] > 0 ? $ua["error"] : ($ua["fail"] > 0 ? $ua["fail"] : $ua["total"])) : "") . "</a></div>\n"; } return $out . '</td>' . "\n"; }