blob: f1fb1ab33202a05211b8edc6accc5e942f655e48 [file] [log] [blame]
<?php
/**
* Copyright (c) 2008, 2018 Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Wayne Beaton (Eclipse Foundation)- initial API and implementation
* Eric Poirier (Eclipse Foundation)
*
* SPDX-License-Identifier: EPL-2.0
*/
require_once ($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php");
require_once ($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php");
$App = new App();
$Nav = new Nav();
$Theme = $App->getThemeClass();
include ($App->getProjectCommon());
$pairs = simplexml_load_file("reports/proximity.xml");
if (array_key_exists('sort', $_GET)) {
$rows = array();
foreach ($pairs as $row) {
$rows[] = array(
'a' => $row['a'],
'b' => $row['b'],
'users' => $row['users']
);
}
$pairs = $rows;
$sort = $_GET['sort'];
function sort_a($a, $b) {
$result = strcasecmp($a['a'], $b['a']);
if ($result == 0)
return sort_users($a, $b);
return $result;
}
function sort_b($a, $b) {
return strcasecmp($a['b'], $b['b']);
}
function sort_users($a, $b) {
$aa = (int) $a['users'];
$bb = (int) $b['users'];
return $aa > $bb ? -1 : 1;
}
usort($pairs, "sort_$sort");
}
$table = createTable($pairs, array(
"Bundle" => "a",
"Is seen with..." => "b",
"Users" => "users"
));
function createTable(&$rows, $columns) {
$html = "<table class=\"table\" border=\"1\">";
$html .= "<tbody>";
$html .= "<tr>";
foreach ($columns as $title => $attribute) {
$html .= "<th><a href=\"?sort=$attribute\">$title</a></th>";
}
$html .= "</tr>";
foreach ($rows as $row) {
$html .= "<tr>";
foreach ($columns as $title => $attribute) {
$html .= "<td>$row[$attribute]</td>";
}
$html .= "</tr>";
}
$html .= "</tbody>";
$html .= "</table>";
return $html;
}
// Begin: page-specific settings. Change these.
$pageTitle = "Usage Data Collector Project Pairings Report";
$Theme->setPageTitle($pageTitle);
$Theme->setPageKeywords("Eclipse, usage data, usagedata, cortez");
$Theme->setPageAuthor("Wayne Beaton");
ob_start();
include ("content/en_" . $App->getScriptName());
$html = ob_get_clean();
$Theme->setNav($Nav);
$Theme->setHtml($html);
$Theme->generatePage();