本文整理汇总了PHP中swarmpath函数的典型用法代码示例。如果您正苦于以下问题:PHP swarmpath函数的具体用法?PHP swarmpath怎么用?PHP swarmpath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了swarmpath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initContent
protected function initContent()
{
$request = $this->getContext()->getRequest();
$resultsID = $request->getInt('item');
$this->setTitle('Run result');
$this->setRobots('noindex,nofollow');
$this->bodyScripts[] = swarmpath('js/result.js');
$error = $this->getAction()->getError();
$data = $this->getAction()->getData();
$html = '';
if ($error) {
$html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
return $html;
}
$this->setSubTitle('#' . $data['info']['id']);
if ($data['job']) {
$html = '<p><em>' . html_tag_open('a', array('href' => $data['job']['url'], 'title' => 'Back to Job #' . $data['job']['id'])) . '« Back to Job #' . $data['job']['id'] . '</a>' . '</em></p>';
} else {
$html = '<p><em>Run #' . $data['info']['runID'] . ' has been deleted. Job info unavailable.</em></p>';
}
if ($data['otherRuns']) {
$html .= '<table class="table table-bordered swarm-results"><thead>' . JobPage::getUaHtmlHeader($data['otherRuns']['userAgents']) . '</thead><tbody>' . JobPage::getUaRunsHtmlRows($data['otherRuns']['runs'], $data['otherRuns']['userAgents']) . '</tbody></table>';
}
$html .= '<h3>Information</h3>' . '<table class="table table-striped">' . '<tbody>' . '<tr><th>Run</th><td>' . ($data['job'] ? html_tag('a', array('href' => $data['job']['url']), 'Job #' . $data['job']['id']) . ' / ' : '') . 'Run #' . htmlspecialchars($data['info']['runID']) . '</td></tr>' . '<tr><th>Client</th><td>' . html_tag('a', array('href' => $data['client']['viewUrl']), 'Client #' . $data['info']['clientID']) . ' / ' . htmlspecialchars($data['client']['name']) . '</td></tr>' . '<tr><th>UA ID</th><td>' . '<code>' . htmlspecialchars($data['client']['uaID']) . '</code>' . '<tr><th>User-Agent</th><td>' . '<tt>' . htmlspecialchars($data['client']['uaRaw']) . '</tt>' . '</td></tr>' . '<tr><th>Run time</th><td>' . (isset($data['info']['runTime']) ? number_format(intval($data['info']['runTime'])) . 's' : '?') . '</td></tr>' . '<tr><th>Status</th><td>' . htmlspecialchars($data['info']['status']) . '</td></tr>' . '<tr><th>Started</th><td>' . self::getPrettyDateHtml($data['info'], 'started') . '</td></tr>' . (isset($data['info']['savedLocalFormatted']) ? '<tr><th>Saved</th><td>' . self::getPrettyDateHtml($data['info'], 'saved') . '</td></tr>' : '') . '</tbody></table>';
$html .= '<h3>Results</h3>' . '<p class="swarm-toollinks">' . html_tag('a', array('href' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['info']['id'], 'raw' => '')), 'target' => '_blank', 'class' => 'swarm-popuplink'), 'Open in new window') . '</p>' . html_tag('iframe', array('src' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['info']['id'], 'raw' => '')), 'width' => '100%', 'class' => 'swarm-result-frame'));
return $html;
}
示例2: loadBrowsers
function loadBrowsers($name, $mobile) {
global $found, $browser, $version, $os;
$result = mysql_queryf("SELECT useragents.engine as engine, useragents.name as name, (SELECT COUNT(*) FROM clients WHERE useragent_id=useragents.id AND updated > DATE_SUB(NOW(), INTERVAL 1 minute)) as clients, (engine=%s AND %s REGEXP version) as found FROM useragents WHERE active=1 AND mobile=%s ORDER BY engine, name;", $browser, $version, $mobile);
$engine = "";
echo "<div class='browsers'><h3>$name</h3>";
while ( $row = mysql_fetch_array($result) ) {
if ( $row[3] ) {
$found = 1;
}
if ( $row[0] != $engine ) {
echo '<br style="clear:both;"/>';
}
$num = preg_replace("/\w+ /", "", $row[1]);
?>
<div class="browser<?php echo $row[0] != $engine ? " clear" : "";?><?php echo $row[3] ? " you" : "";?>">
<img src="<?php echo swarmpath( "images/{$row[0]}.sm.png" ); ?>" class="browser-icon <?php echo $row[0]; ?>" alt="<?php echo $row[1]; ?>" title="<?php echo $row[1]; ?>"/>
<span class="browser-name"><?php echo $num; ?></span>
<?php if ( intval($row[2]) > 0 ) {
echo '<span class="active">' . $row[2] . '</span>';
}?>
</div>
<?php $engine = $row[0];
}
echo '</div>';
}
示例3: initContent
protected function initContent()
{
$request = $this->getContext()->getRequest();
$resultsID = $request->getInt('item');
$this->setTitle('Run result');
$this->setRobots('noindex,nofollow');
$this->bodyScripts[] = swarmpath('js/result.js');
$error = $this->getAction()->getError();
$data = $this->getAction()->getData();
$html = '';
if ($error) {
$html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
return $html;
}
$this->setSubTitle('#' . $data['resultInfo']['id']);
if ($data['job']) {
$html = '<p><em>' . html_tag_open('a', array('href' => $data['job']['url'], 'title' => 'Back to Job #' . $data['job']['id'])) . '« Back to Job #' . $data['job']['id'] . '</a>' . '</em></p>';
} else {
$html = '<p><em>Run #' . $data['resultInfo']['runID'] . ' has been deleted. Job info unavailable.</em></p>';
}
if ($data['otherRuns']) {
$html .= '<table class="table table-bordered swarm-results"><thead>' . JobPage::getUaHtmlHeader($data['otherRuns']['userAgents']) . '</thead><tbody>' . JobPage::getUaRunsHtmlRows($data['otherRuns']['runs'], $data['otherRuns']['userAgents']) . '</tbody></table>';
}
$html .= '<h3>Information</h3>' . '<table class="table table-striped">' . '<colgroup><col class="span2"/><col/></colgroup>' . '<tbody>' . '<tr><th>Run</th><td>' . ($data['job'] ? html_tag('a', array('href' => $data['job']['url']), 'Job #' . $data['job']['id']) . ' / ' : '') . 'Run #' . htmlspecialchars($data['resultInfo']['runID']) . '</td></tr>' . '<tr><th>Client</th><td>' . html_tag('a', array('href' => $data['client']['userUrl']), $data['client']['userName']) . ' / Client #' . htmlspecialchars($data['resultInfo']['clientID']) . '</td></tr>' . ($data['client']['deviceName'] !== null ? '<tr><th>Device name</th><td>' . $data['client']['deviceName'] . ' / ' . html_tag('a', array('target' => '_blank', 'href' => 'http://wiki.blinkbox.local/wiki/index.php?profile=default&search=' . htmlspecialchars($data['client']['deviceName'])), 'search for ' . $data['client']['deviceName'] . ' on blinkbox wiki') . '</td></tr>' : '') . '<tr><th>User-Agent</th><td>' . '<code>' . htmlspecialchars($data['client']['uaID']) . '</code><br/>' . 'Raw: <br><code>' . htmlspecialchars($data['client']['userAgent']) . '</code><br/>' . html_tag('a', array('target' => '_blank', 'href' => 'http://wiki.blinkbox.local/wiki/index.php?profile=default&search=' . htmlspecialchars($data['client']['userAgent'])), 'search for this user agent on blinkbox wiki') . '</td></tr>' . '<tr><th>Run time</th><td>' . (isset($data['resultInfo']['runTime']) ? number_format(intval($data['resultInfo']['runTime'])) . 's' : '?') . '</td></tr>' . '<tr><th>Status</th><td>' . htmlspecialchars($data['resultInfo']['status']) . '</td></tr>' . '<tr><th>Total</th><td>' . htmlspecialchars($data['resultInfo']['total']) . '</td></tr>' . '<tr><th>Fail</th><td>' . htmlspecialchars($data['resultInfo']['fail']) . '</td></tr>' . '<tr><th>Error</th><td>' . htmlspecialchars($data['resultInfo']['error']) . '</td></tr>' . '<tr><th>Started</th><td>' . self::getPrettyDateHtml($data['resultInfo'], 'started') . '</td></tr>' . (isset($data['resultInfo']['savedLocalFormatted']) ? '<tr><th>Saved</th><td>' . self::getPrettyDateHtml($data['resultInfo'], 'saved') . '</td></tr>' : '') . '<tr><th>Results size</th><td>' . 'compressed: ' . self::formatBytes($data['resultInfo']['reportHtmlCompressedSize']) . ' / uncompressed: ' . self::formatBytes($data['resultInfo']['reportHtmlSize']) . ' / ratio: ' . $data['resultInfo']['reportHtmlCompressionRatio'] . '%' . '</td></tr>' . '</tbody></table>';
$html .= '<h3>Results</h3>' . '<p class="swarm-toollinks">' . html_tag('a', array('href' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['resultInfo']['id'], 'raw' => '')), 'target' => '_blank', 'class' => 'swarm-popuplink'), 'Open in new window') . '</p>' . html_tag('iframe', array('src' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['resultInfo']['id'], 'raw' => '')), 'width' => '100%', 'class' => 'swarm-result-frame'));
return $html;
}
示例4: initContent
protected function initContent()
{
$context = $this->getContext();
$conf = $context->getConf();
$request = $context->getRequest();
$browserInfo = $context->getBrowserInfo();
$siteNameHtml = htmlspecialchars($conf->web->title);
$this->setTitle('Home');
$this->setRawDisplayTitle('<div style="text-align: center;">' . $siteNameHtml . '</div>');
$html = '<div class="row">' . '<div class="span7">' . '<h3>Distributed Continuous Integration for JavaScript</h3>' . '<blockquote><p>' . str_replace('$1', $siteNameHtml, $conf->customMsg->homeIntro_html) . '</p></blockquote>' . '</div>';
$html .= '<div class="span5"><div class="well">';
if (!$conf->client->requireRunToken) {
if ($browserInfo->isInSwarmUaIndex()) {
$auth = $context->getAuth();
$suggestedClientName = $auth ? $auth->project->id : '';
$html .= '<p>Your browser is in our index, run some tests!</p>' . '<form action="' . swarmpath('') . '" method="get" class="form-horizontal swarm-form-join">' . '<input type="hidden" name="action" value="run">' . '<div class="input-append">' . '<input type="text" name="item" placeholder="Enter name.." value="' . htmlspecialchars($suggestedClientName) . '" required pattern="' . htmlspecialchars(Client::getNameValidationRegex()) . '">' . '<input type="submit" value="Join the swarm" class="btn btn-primary">' . '</div>' . '</form>';
} else {
$uaData = $browserInfo->getUaData();
unset($uaData->displayInfo);
$html .= '<div class="alert alert-info">' . '<h4 class="alert-heading">Your browser is not needed by this swarm.</h4>' . '<p>Please join with one the below browsers.</p></div>' . '<p>If you feel that this may be an error, please report it to the TestSwarm ' . ' <a href="https://github.com/jquery/testswarm/issues">Issue Tracker</a>,' . ' including the following 2 codes:' . '<br><strong><a href="https://github.com/tobie/ua-parser">ua-parser</a>:</strong> <code>' . htmlspecialchars(print_r($uaData, true)) . '</code><br><strong><a href="https://en.wikipedia.org/wiki/User_agent" title="Read about User agent on Wikipedia!">User-Agent</a> string:</strong> <code>' . htmlspecialchars($browserInfo->getRawUA()) . '</code></p>';
}
} else {
$html .= '<div class="alert">' . '<h4 class="alert-heading">Join access restricted</h4>' . '<p>Public joining of the swarm has been disabled.</p>' . '<button type="button" class="btn btn-large disabled" disabled><s>Join the swarm</s></button>' . '</div>';
}
$html .= '</div></div>';
$html .= '</div>';
$html .= $this->getBrowsersOnlineHtml();
return $html;
}
示例5: getBrowsersOnlineHtml
/** @return bool: Whether the current user was found in the swarm */
public function getBrowsersOnlineHtml()
{
$conf = $this->getContext()->getConf();
$db = $this->getContext()->getDB();
$browserInfo = $this->getContext()->getBrowserInfo();
$data = $this->getAction()->getData();
$html = '';
$itemsPerRow = 6;
$browsersHtml = '<h2>Browsers</h2>';
$browserItemCount = 0;
foreach ($data["userAgents"] as $uaID => $userAgent) {
if (!in_array($uaID, $conf->browserSets->default)) {
continue;
}
$isCurr = $uaID == $browserInfo->getSwarmUaID();
$item = '' . '<div class="span2">' . '<div class="well well-small swarm-browseronline' . ($isCurr ? " alert-info" : "") . '">' . html_tag("img", array("src" => swarmpath("img/" . $userAgent["data"]["displayicon"] . ".sm.png"), "class" => "swarm-browsericon", "alt" => "", "title" => $userAgent["data"]["displaytitle"])) . '<br>' . html_tag("span", array("class" => "badge swarm-browsername"), $userAgent["data"]["displaytitle"]) . '<br>' . html_tag("span", array("class" => "swarm-onlineclients " . ($userAgent["stats"]["onlineClients"] > 0 ? "badge" : ($userAgent['stats']['pendingRuns'] > 0 ? 'badge badge-important' : 'badge')), "title" => $userAgent["stats"]["onlineClients"] . ' clients online'), $userAgent["stats"]["onlineClients"]) . html_tag("span", array("class" => "swarm-pendingruns " . ($userAgent["stats"]["pendingRuns"] > 0 ? $userAgent["stats"]["onlineClients"] > 0 ? "label label-info" : "label label-warning" : "label label-success")), $userAgent["stats"]["pendingRuns"] . ' pending runs') . ($userAgent["stats"]["pendingReRuns"] > 0 ? '<br>' . html_tag("span", array("class" => "swarm-pendingreruns " . ($userAgent["stats"]["onlineClients"] > 0 ? "label label-info" : "label label-warning")), $userAgent["stats"]["pendingReRuns"] . ' pending re-runs') : "") . '</div>' . '</div>';
// Properly close and start new rows
if ($browserItemCount % $itemsPerRow === 0) {
$browsersHtml .= '<div class="row">';
}
$browserItemCount += 1;
$browsersHtml .= $item;
if ($browserItemCount % $itemsPerRow === 0) {
$browsersHtml .= '</div><!--/.row -->';
}
}
// Close un-even items rows
if ($browserItemCount % $itemsPerRow !== 0) {
$browsersHtml .= '</div><!--/.row -->';
}
$html .= $browsersHtml;
return $html;
}
示例6: initContent
protected function initContent()
{
$request = $this->getContext()->getRequest();
$auth = $this->getContext()->getAuth();
$this->setTitle("Job status");
$this->setRobots("noindex,nofollow");
$this->bodyScripts[] = swarmpath("js/job.js");
$error = $this->getAction()->getError();
$data = $this->getAction()->getData();
$html = '';
if ($error) {
$html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
}
if (!isset($data["info"])) {
return $html;
}
$this->setSubTitle('#' . $data["info"]["id"]);
$project = $data['info']['project'];
$isOwner = $auth && $auth->project->id === $project['id'];
$html .= '<h2>' . $data["info"]["nameHtml"] . '</h2>' . '<p><em>Submitted by ' . html_tag('a', array('href' => $project['viewUrl']), $project['display_title']) . ' ' . self::getPrettyDateHtml($data["info"], 'created') . '</em>.</p>';
if ($isOwner) {
$html .= '<script>SWARM.jobInfo = ' . json_encode($data["info"]) . ';</script>';
$action_bar = '<div class="form-actions swarm-item-actions">' . ' <button class="swarm-reset-runs-failed btn btn-info">Reset failed runs</button>' . ' <button class="swarm-reset-runs btn btn-info">Reset all runs</button>' . ' <button class="swarm-delete-job btn btn-danger">Delete job</button>' . '</div>' . '<div class="swarm-wipejob-error alert alert-error" style="display: none;"></div>';
} else {
$action_bar = '';
}
$html .= $action_bar;
$html .= '<table class="table table-bordered swarm-results swarm-results-unbound-auth"><thead>' . self::getUaHtmlHeader($data['userAgents']) . '</thead><tbody>' . self::getUaRunsHtmlRows($data['runs'], $data['userAgents'], $isOwner) . '</tbody></table>';
$html .= $action_bar;
return $html;
}
示例7: getUaHtmlHeader
public static function getUaHtmlHeader($userAgents)
{
$html = '<tr><th> </th>';
foreach ($userAgents as $userAgent) {
$html .= '<th><img src="' . swarmpath('img/' . $userAgent['displayicon']) . '.sm.png" class="swarm-browsericon ' . '" alt="' . htmlspecialchars($userAgent['displaytitle']) . '" title="' . htmlspecialchars($userAgent['displaytitle']) . '"><br>' . htmlspecialchars(preg_replace('/\\w+ /', '', $userAgent['displaytitle'])) . '</th>';
}
$html .= '</tr>';
return $html;
}
示例8: initContent
protected function initContent()
{
$this->setTitle("Scores");
$scores = $this->getAction()->getData();
$html = '<blockquote><p>All users with a score greater than zero.' . ' The score is the number of tests run by that user\'s clients.</p></blockquote>' . '<table class="table table-striped">' . '<thead><tr><th class="span1">#</th><th>User</th><th class="span2">Score</th></tr></thead>' . '<tbody>';
foreach ($scores as $item) {
$html .= '<tr><td class="num">' . htmlspecialchars(number_format($item["position"])) . '</td>' . '<td><a href="' . htmlspecialchars(swarmpath("user/{$item["userName"]}")) . '">' . htmlspecialchars($item["userName"]) . '</a></td>' . '<td class="num">' . htmlspecialchars(number_format($item["score"])) . '</td></tr>';
}
$html .= '</tbody></table>';
return $html;
}
示例9: initContent
protected function initContent()
{
$this->setTitle("Projects");
$projects = $this->getAction()->getData();
$html = '<blockquote><p>Below is an overview of all registered projects,' . ' sorted alphabetically by name.</p></blockquote>' . '<table class="table table-striped">' . '<thead><tr><th>Project name</th><th class="span2">Jobs</th><th class="span4">Creation date</th></tr></thead>' . '<tbody>';
foreach ($projects as $project) {
$html .= '<tr>' . '<td><a href="' . htmlspecialchars(swarmpath("user/{$project["name"]}")) . '">' . htmlspecialchars($project["name"]) . '</a></td>' . '<td class="num">' . htmlspecialchars(number_format($project["jobCount"])) . '</td>' . '<td class="num"><span title="' . htmlspecialchars($project["createdISO"]) . '" class="pretty">' . htmlspecialchars($project["createdLocalFormatted"]) . '</span></td>' . '</tr>';
}
$html .= '</tbody></table>';
return $html;
}
示例10: initContent
protected function initContent()
{
$this->setTitle('Projects');
$projects = $this->getAction()->getData();
$html = '<blockquote><p>Below is an overview of all registered projects,' . ' sorted alphabetically by name.</p></blockquote>' . '<table class="table table-striped">' . '<thead><tr>' . '<th>Project name</th>' . '<th class="span2">Jobs</th>' . '<th class="span2">Most recent job</th>' . '<th class="span4">Creation date</th>' . '</tr></thead>' . '<tbody>';
foreach ($projects as $project) {
$html .= '<tr>' . '<td><a href="' . htmlspecialchars(swarmpath("user/{$project['name']}")) . '">' . htmlspecialchars($project['name']) . '</a></td>' . '<td class="num">' . htmlspecialchars(number_format($project['jobCount'])) . '</td>' . '<td><a href="' . htmlspecialchars(swarmpath("job/{$project['jobLatest']}")) . '">Job #' . htmlspecialchars($project['jobLatest']) . '</a></td>' . '<td class="num">' . self::getPrettyDateHtml($project, 'created') . '</td>' . '</tr>';
}
$html .= '</tbody></table>';
return $html;
}
示例11: initContent
protected function initContent()
{
$request = $this->getContext()->getRequest();
$this->setTitle("Signup");
$html = '<form action="' . swarmpath("signup") . '" method="post">' . '<fieldset>' . '<legend>Signup</legend>';
$error = $this->getAction()->getError();
if ($request->wasPosted() && $error) {
$html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
}
$html .= '<p>Create an account. If you already have an account you may <a href="' . swarmpath("login") . '">login here</a>.</p>' . '<label>Username: <input type="text" name="username" maxlength="255"></label><br>' . '<label>Password: <input type="password" name="password"></label><br>' . '<input type="submit" value="Signup" class="btn btn-primary">' . '</fieldset></form>';
return $html;
}
示例12: initContent
protected function initContent()
{
$request = $this->getContext()->getRequest();
$this->setTitle("Login");
$html = '<form action="' . swarmpath("login") . '" method="post" class="form-horizontal">' . '<fieldset>' . '<legend>Login</legend>';
$error = $this->getAction()->getError();
if ($request->wasPosted() && $error) {
$html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
}
$html .= '<div class="well">' . '<p>Login using your TestSwarm username and password.' . ' If you don\'t have one you may <a href="' . swarmpath("signup") . '">Signup Here</a>.</p>' . '<div class="control-group">' . '<label class="control-label" for="form-username">Username</label>' . '<div class="controls">' . '<input id="form-password" type="text" name="username" value="' . htmlspecialchars($request->getVal("username")) . '">' . '</div>' . '</div><div class="control-group">' . '<label class="control-label" for="form-password">Password</label>' . '<div class="controls">' . '<input type="password" name="password">' . '</div>' . '</div>' . '</div><div class="form-actions">' . '<input id="form-password" type="submit" value="Login" class="btn btn-primary">' . '</div>';
$html .= '</fieldset></form>';
return $html;
}
示例13: initContent
protected function initContent()
{
$request = $this->getContext()->getRequest();
$this->setTitle("Login");
$html = '<form action="' . swarmpath("login") . '" method="post" class="form-horizontal">' . '<fieldset>' . '<legend>Login</legend>';
$error = $this->getAction()->getError();
if ($request->wasPosted() && $error) {
$html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
}
$html .= '<div class="well">' . '<p>Login for projects. Projects can only be created by swarm operators.</p>' . '<div class="control-group">' . '<label class="control-label" for="form-projectID">Project ID</label>' . '<div class="controls">' . '<input type="text" name="projectID" required id="form-projectID" value="' . htmlspecialchars($request->getVal("projectID")) . '">' . '</div>' . '</div><div class="control-group">' . '<label class="control-label" for="form-projectPassword">Project password</label>' . '<div class="controls">' . '<input type="password" name="projectPassword" required id="form-projectPassword">' . '</div>' . '</div>' . '</div><div class="form-actions">' . '<input type="submit" value="Login" class="btn btn-primary">' . '</div>';
$html .= '</fieldset></form>';
return $html;
}
示例14: initContent
protected function initContent()
{
$request = $this->getContext()->getRequest();
$this->setTitle("Job status");
$this->setRobots("noindex,nofollow");
$this->bodyScripts[] = swarmpath("js/job.js");
$error = $this->getAction()->getError();
$data = $this->getAction()->getData();
$html = '';
if ($error) {
$html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
}
if (!isset($data["jobInfo"])) {
return $html;
}
$this->setSubTitle('#' . $data["jobInfo"]["id"]);
$html .= '<h2>' . $data["jobInfo"]["name"] . '</h2>' . '<p><em>Submitted by ' . html_tag("a", array("href" => swarmpath("user/{$data["jobInfo"]["ownerName"]}")), $data["jobInfo"]["ownerName"]) . ' on ' . htmlspecialchars(date("Y-m-d H:i:s", gmstrtotime($data["jobInfo"]["creationTimestamp"]))) . ' (UTC)' . '</em>.</p>';
if ($request->getSessionData("auth") === "yes" && $data["jobInfo"]["ownerName"] == $request->getSessionData("username")) {
$html .= '<script>SWARM.jobInfo = ' . json_encode($data["jobInfo"]) . ';</script>' . '<div class="form-actions">' . ' <button id="swarm-job-delete" class="btn btn-danger">Delete job</button>' . ' <button id="swarm-job-reset" class="btn btn-info">Reset job</button>' . '</div>' . '<div class="alert alert-error" id="swarm-wipejob-error" style="display: none;"></div>';
}
$html .= '<table class="table table-bordered swarm-results"><thead><tr><th> </th>';
// Header with user agents
foreach ($data["userAgents"] as $userAgent) {
$html .= '<th><img src="' . swarmpath("img/" . $userAgent["displayicon"]) . '.sm.png" class="swarm-browsericon ' . '" alt="' . htmlspecialchars($userAgent["displaytitle"]) . '" title="' . htmlspecialchars($userAgent["displaytitle"]) . '"><br>' . htmlspecialchars(preg_replace("/\\w+ /", "", $userAgent["displaytitle"])) . '</th>';
}
$html .= '</tr></thead><tbody>';
foreach ($data["runs"] as $run) {
$html .= '<tr><th><a href="' . htmlspecialchars($run["info"]["url"]) . '">' . $run["info"]["name"] . '</a></th>';
// Looping over $data["userAgents"] instead of $run["uaRuns"],
// to avoid shifts in the table (github.com/jquery/testswarm/issues/13)
foreach ($data["userAgents"] as $uaID => $uaInfo) {
if (isset($run["uaRuns"][$uaID])) {
$uaRun = $run["uaRuns"][$uaID];
$html .= html_tag_open("td", array("class" => "swarm-status swarm-status-" . $uaRun["runStatus"], "data-job-id" => $data["jobInfo"]["id"], "data-run-id" => $run["info"]["id"], "data-run-status" => $uaRun["runStatus"], "data-useragent-id" => $uaID, "data-client-id" => isset($uaRun["clientID"]) ? $uaRun["clientID"] : ""));
if (isset($uaRun["runResultsUrl"]) && $uaRun["runResultsLabel"]) {
$html .= html_tag_open('a', array("rel" => "nofollow", "href" => $uaRun["runResultsUrl"])) . $uaRun["runResultsLabel"] . '<i class="icon-list-alt pull-right" title="' . htmlspecialchars("Open run results for {$data["userAgents"][$uaID]["displaytitle"]}") . '"></i>' . '</a>';
} else {
$html .= UserPage::getStatusIconHtml($uaRun["runStatus"]);
}
$html .= '</td>';
} else {
// This run isn't schedules to be ran in this UA
$html .= '<td class="swarm-status swarm-status-notscheduled"></td>';
}
}
}
$html .= '</tbody></table>';
return $html;
}
示例15: initContent
protected function initContent()
{
$this->setTitle("User");
$html = "";
$error = $this->getAction()->getError();
$data = $this->getAction()->getData();
if ($error) {
$html .= html_tag("div", array("class" => "alert alert-error"), $error["info"]);
return $html;
}
$this->setSubTitle($data["userName"]);
if (count($data["activeClients"])) {
$html .= '<h2>Active clients</h2><div class="row">';
foreach ($data["activeClients"] as $activeClient) {
if ($activeClient["uaData"]) {
$diplayicon = $activeClient["uaData"]["displayicon"];
$label = $activeClient["uaData"]["displaytitle"];
} else {
$diplayicon = "unknown";
$label = "Unrecognized [{$activeClient["uaID"]}]";
}
$html .= '<div class="span4"><div class="well">' . '<img class="pull-right" src="' . swarmpath("img/{$diplayicon}.sm.png") . '" alt="">' . '<strong class="label">' . htmlspecialchars($label) . '</strong>' . '<p>' . '<small>Platform: ' . htmlspecialchars($activeClient["uaBrowscap"]["Platform"]) . '</small>' . '<br>' . '<small>Connected ' . self::getPrettyDateHtml($activeClient, 'connected') . '</small>' . '<br>' . '<small>Last ping ' . self::getPrettyDateHtml($activeClient, 'pinged') . '</small>' . '</p>' . '</div></div>';
}
$html .= '</div>';
}
if (count($data["recentJobs"])) {
$html .= '<h2>Recent jobs</h2><table class="table table-bordered swarm-results">';
// Build table header
$html .= '<thead><tr><td></td>';
foreach ($data["uasInJobs"] as $uaID => $uaData) {
$html .= '<th>' . '<img src="' . swarmpath("img/{$uaData["displayicon"]}.sm.png") . '" class="swarm-browsericon' . '" alt="' . htmlspecialchars($uaData["displaytitle"]) . '" title="' . htmlspecialchars($uaData["displaytitle"]) . '"><br>' . htmlspecialchars(preg_replace("/\\w+ /", "", $uaData["displaytitle"])) . '</th>';
}
$html .= '</tr></thead><tbody>';
foreach ($data["recentJobs"] as $job) {
$html .= '<tr><th><a href="' . htmlspecialchars($job["url"]) . '">' . htmlspecialchars(strip_tags($job["name"])) . "</a></th>\n";
foreach ($data["uasInJobs"] as $uaID => $uaData) {
$html .= isset($job["uaSummary"][$uaID]) ? '<td class="swarm-status swarm-status-' . $job["uaSummary"][$uaID] . '">' . self::getStatusIconHtml($job["uaSummary"][$uaID]) . '</td>' : '<td class="swarm-status swarm-status-notscheduled"></td>';
}
$html .= '</tr>';
}
$html .= '</tbody></table>';
}
if ($html == '') {
return '<div class="alert alert-info">No active useragents or jobs.</div>';
}
return $html;
}