| <?php | |
| /** | |
| * ***************************************************************************** | |
| * Copyright (c) 2018 Eclipse Foundation and others. | |
| * All rights reserved. This program and the accompanying materials | |
| * are made available under the terms of the Eclipse Public License v1.0 | |
| * which accompanies this distribution, and is available at | |
| * http://www.eclipse.org/legal/epl-v10.html | |
| * ***************************************************************************** | |
| */ | |
| 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/Project.class.php'; | |
| require_once $_SERVER ['DOCUMENT_ROOT'] . '/projects/classes/ProjectStatusReporter.class.inc'; | |
| require_once $_SERVER ['DOCUMENT_ROOT'] . '/projects/classes/debug.php'; | |
| require_once $_SERVER ['DOCUMENT_ROOT'] . '/projects/classes/database.inc'; | |
| require_once $_SERVER ['DOCUMENT_ROOT'] . '/projects/classes/common.php'; | |
| require_once dirname(__FILE__) . '/charts.inc'; | |
| mustBeCommitter(); | |
| $pageTitle = "Eclipse Project Overview"; | |
| $pageKeywords = ""; | |
| $pageAuthor = "Wayne Beaton"; | |
| ob_start (); | |
| if (!(($id = @$_GET['id']) && isValidProjectId($id))) $id = null; | |
| if (!$age = (int)@$_GET['ago']) $age = 24; | |
| $Nav->addNavSeparator("Report", "./report.php"); | |
| foreach(Project::getTopLevelProjects() as $project) { | |
| $Nav->addCustomNav($project->getName(), "?id={$project->getId()}", "_self", 2); | |
| } | |
| function renderProjectReport(Project $project) { | |
| if (! project) | |
| return; | |
| $status = new ProjectStatusReporter ( array ( | |
| $project->getId () | |
| ) ); | |
| echo "<h2><a href=\"?id={$project->getId()}\">{$project->getFormalName()}</a></h2>"; | |
| echo "<div style=\"margin-left:1em\">"; | |
| echo "<h3>Lifetime stats</h3>"; | |
| echo "<div class=\"container\">"; | |
| $status->values ( $project->getId (), function ($column) use (&$lines) { | |
| echo "<div class=\"row\"><div class=\"col-md-6\">{$column->getTitle()}:</div><div class=\"col-md-6\">{$column->getValue()}</div></div>"; | |
| } ); | |
| echo "</div>"; | |
| ChartBuilder::named ( "project_activity_" . rand () ) | |
| ->title ( "Commit Activity" ) | |
| ->description ( "Overall committer activity by month based on commits made against project repositories." ) | |
| ->query ( 'dashboard', " | |
| select | |
| periods.period as period, | |
| if (commits.count is null, 0, commits.count) as count | |
| from ( | |
| select distinct period | |
| from ProjectCommitActivity | |
| where | |
| period | |
| between ( | |
| select | |
| if(max(period) < date_format(date_sub(now(), interval :ago month),'%Y%m'), | |
| date_format(now(),'%Y%m'), | |
| greatest(min(period), date_format(date_sub(now(), interval :ago month),'%Y%m'))) | |
| from ProjectCommitActivity | |
| where project=':id') | |
| and date_format(now(),'%Y%m')) as periods | |
| left join | |
| ProjectCommitActivity as commits | |
| on (periods.period = commits.period and commits.project=':id') | |
| order by period | |
| " ) | |
| ->substitute ( ':id', $project->getId () ) | |
| ->substitute ( ':ago', 48 ) | |
| ->column ( 'Month', 'period', 'string', function ($value) { | |
| return asYearMonth ( $value ); | |
| } ) | |
| ->column ( 'Commits', 'count', 'number' ) | |
| ->columnChart () | |
| ->height ( 300 ) | |
| ->width ( 640 ) | |
| ->option ( 'legend', 'none' ) | |
| ->render (); | |
| echo "</div>"; | |
| } | |
| ?> | |
| <div id="maincontent"> | |
| <div id="midcolumn"> | |
| <h1><?=$pageTitle?></h1> | |
| <p>EXPERIMENTAL. This page shows some basic metrics.</p> | |
| <?php | |
| $project = Project::getProject($id); | |
| if ($project) { | |
| renderProjectReport($project); | |
| foreach($project->getChildren() as $child) { | |
| renderProjectReport($child); | |
| } | |
| } else { | |
| foreach(Project::getTopLevelProjects() as $project) { | |
| renderProjectReport($project); | |
| } | |
| } | |
| ?> | |
| </div> | |
| </div> | |
| <?php | |
| $html = ob_get_contents (); | |
| ob_end_clean (); | |
| $App->generatePage ( $theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html ); | |
| ?> |