| <?php |
| /*********************************************************************** |
| * Copyright (c) Eclipse Foundation and others. |
| * |
| * This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-2.0 |
| ***********************************************************************/ |
| |
| require_once "../../eclipse.org-common/system/app.class.php"; |
| require_once ($_SERVER ['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); |
| require_once ($_SERVER ['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); |
| |
| $App = new App (); |
| $Nav = new Nav (); |
| $Menu = new Menu (); |
| include ($App->getProjectCommon ()); |
| |
| require_once '../classes/WorkingGroup.class.inc'; |
| require_once '../classes/Project.class.php'; |
| require_once '../classes/debug.php'; |
| require_once '../classes/database.inc'; |
| require_once '../classes/common.php'; |
| require_once './charts.inc'; |
| |
| mustBeFoundationEmployee(); |
| |
| $pageTitle = "Eclipse Working Groups Overview"; |
| $pageKeywords = ""; |
| $pageAuthor = "Wayne Beaton"; |
| |
| ob_start (); |
| |
| if (!(($id = @$_GET['id']) && isValidProjectId($id))) $id = null; |
| |
| $options = array(); |
| $options['width'] = is_numeric(@$_GET['width']) ? @$_GET['width'] : 500; |
| $options['height'] = is_numeric(@$_GET['height']) ? @$_GET['height'] : 200; |
| $options['start'] = @$_GET['start'] ? date('Y-m-d', strtotime(@$_GET['start'])) : null; |
| $options['end'] = @$_GET['end'] ? date('Y-m-d', strtotime(@$_GET['end'])) : null; |
| |
| // Add an entry to focus the report on every |
| // top-level project to the navigation bar. |
| |
| $Nav->addNavSeparator("Report", "./report.php"); |
| foreach(WorkingGroup::getAll() as $wg) { |
| $Nav->addCustomNav($wg->getName(), "?id={$wg->getId()}", "_self", 2); |
| } |
| |
| $wg = WorkingGroup::getWorkingGroup($id); |
| if (!$wg) $wg = WorkingGroup::getAny(); |
| |
| function quarter($date) { |
| if ($date == null) return 'Future'; |
| |
| $year = date('Y', $date); |
| $month = date('n', $date); |
| |
| return $year . 'Q' . floor((($month - 1) / 3) + 1); |
| } |
| |
| ?> |
| <style> |
| table.metrics { |
| border-spacing: 10px; |
| border-collapse: separate; |
| } |
| td.number { |
| text-align: right; |
| } |
| </style> |
| <div id="maincontent"> |
| <div id="midcolumn"> |
| <h1><?= $wg->getName() ?></h1> |
| |
| <p>EXPERIMENTAL. This page shows some basic Working Group metrics.</p> |
| |
| <h2>Projects</h2> |
| <?php |
| $projects = array(); |
| $wg->projectsDo(function(Project $project) use (&$projects) { |
| $projects[quarter($project->getProvisionedDate())][] = $project; |
| }); |
| |
| ksort($projects); |
| |
| foreach($projects as $quarter => $group) { |
| echo "<h3>{$quarter}</h3>"; |
| echo "<ul>"; |
| foreach($group as $project) { |
| echo "<li><a href=\"{$project->getUrl()}\">{$project->getFormalName()}</a></li>"; |
| } |
| echo "</ul>"; |
| } |
| ?> |
| |
| <?php |
| function showMetrics($wg, $table, $fields) { |
| $columns = explode(',', $fields); |
| |
| $sql = " |
| select {$fields} |
| from {$table} |
| where id=':id:';"; |
| $metrics = array(); |
| query('dashboard', $sql, array(':id:' => $wg->getId()), function($row) use (&$metrics, &$columns) { |
| $metrics[] = $row; |
| }); |
| |
| if ($metrics) { |
| echo "<table class=\"metrics\"><tbody>"; |
| echo "<tr>"; |
| foreach($columns as $column) { |
| $title = ucfirst($column); |
| echo "<th>{$title}</th>"; |
| } |
| echo "</tr>"; |
| foreach($metrics as $row) { |
| echo "<tr>"; |
| foreach($columns as $column) { |
| $value = $row[$column]; |
| switch ($column) { |
| case 'year' : |
| case 'quarter' : |
| break; |
| default: |
| $value = number_format($row[$column]); |
| } |
| echo "<td class=\"number\">{$value}</td>"; |
| } |
| echo "</tr>"; |
| } |
| echo "</tbody></table>"; |
| } else { |
| echo "<p>None</p>"; |
| } |
| } |
| ?> |
| |
| <h2>Yearly Metrics</h2> |
| <?php showMetrics($wg, 'WorkingGroupYearlySummary', 'year,projects,commits,files,added,removed,authors,committers,companies')?> |
| |
| <h2>Quarterly Metrics</h2> |
| <h3>All Projects</h3> |
| <?php showMetrics($wg, 'WorkingGroupQuarterlySummary', 'quarter,projects,commits,files,added,removed,authors,committers,companies')?> |
| |
| <h3>Specification Projects</h3> |
| <?php showMetrics($wg, 'WorkingGroupSpecificationsQuarterlySummary', 'quarter,projects,commits,files,added,removed,authors,committers,companies')?> |
| |
| </div> |
| </div> |
| |
| <?php |
| $html = ob_get_contents (); |
| ob_end_clean (); |
| $App->generatePage ( null, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html ); |
| ?> |