|  | <?php | 
|  | /******************************************************************************** | 
|  | * Copyright (c) 2016 The Eclipse Foundation | 
|  | * | 
|  | * This program and the accompanying materials are made available under the | 
|  | * terms of the Eclipse Public License v. 2.0 which is available at | 
|  | * http://www.eclipse.org/legal/epl-2.0. | 
|  | * | 
|  | * 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"); | 
|  | 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 $_SERVER ['DOCUMENT_ROOT'] . '/projects/classes/Project.class.php'; | 
|  | require_once $_SERVER ['DOCUMENT_ROOT'] . '/projects/classes/common.php'; | 
|  | require_once $_SERVER ['DOCUMENT_ROOT'] . '/projects/classes/debug.php'; | 
|  | require_once dirname ( __FILE__ ) . '/kpi.inc'; | 
|  | require_once dirname ( __FILE__ ) . '/charts.inc'; | 
|  |  | 
|  | // Let's keep this restricted to Eclipse Foundation employees | 
|  | // for now. | 
|  | mustBeFoundationEmployee(); | 
|  |  | 
|  | $pageTitle = "Eclipse Project KPIs"; | 
|  | $pageKeywords = ""; | 
|  | $pageAuthor = "Wayne Beaton"; | 
|  |  | 
|  | $App->AddExtraHtmlHeader(" | 
|  | <style> | 
|  | img.company-logo {margin: 1em; width: 64px} | 
|  | </style>"); | 
|  |  | 
|  | ob_start (); | 
|  |  | 
|  | function getProjectNickName($id) { | 
|  | return ($project = Project::getProject($id)) ? $project->getNickName() : $id; | 
|  | } | 
|  |  | 
|  | ?> | 
|  | <div id="maincontent"> | 
|  | <div id="midcolumn"> | 
|  | <h1><?=$pageTitle?></h1> | 
|  |  | 
|  | <?php | 
|  | $age = isset($_GET['age']) ? (int)$_GET['age'] : 5; | 
|  | $context = new ChartContext($age); | 
|  |  | 
|  | $filter = isset($_GET['filter']) ? $_GET['filter'] : '.'; | 
|  |  | 
|  | foreach(scandir(dirname(__FILE__) . '/kpis') as $file) { | 
|  | if ($file == '.') continue; | 
|  | if ($file == '..') continue; | 
|  | // TODO Confirm that an injection attack is not possible. | 
|  | if (!preg_match("/$filter/", $file)) continue; | 
|  | require "kpis/$file"; | 
|  | if (preg_match('/^(.*)\.inc/', $file, $matches)) { | 
|  | $callback = 'chart_' . $matches[1]; | 
|  | $chart = call_user_func($callback, $context); | 
|  | $chart->render(); | 
|  | } | 
|  | } | 
|  |  | 
|  | ?> | 
|  |  | 
|  | </div> | 
|  | </div> | 
|  |  | 
|  | <?php | 
|  | $html = ob_get_contents (); | 
|  | ob_end_clean (); | 
|  | $App->generatePage ( $theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html ); | 
|  | ?> |