include "cdash/version.php"; require_once "models/project.php"; // handle required project argument @($projectname = $_GET["project"]); if (!isset($projectname)) { echo "Not a valid project!"; return; } $start = microtime_float(); $projectname = htmlspecialchars(pdo_real_escape_string($projectname)); $projectid = get_project_id($projectname); $Project = new Project(); $Project->Id = $projectid; $Project->Fill(); // check if this project has subprojects. $has_subprojects = $Project->GetNumberOfSubProjects() > 0; // make sure the user has access to this project checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid); // connect to the database $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}"); pdo_select_db("{$CDASH_DB_NAME}", $db); // handle optional date argument @($date = $_GET["date"]); if ($date != NULL) { $date = htmlspecialchars(pdo_real_escape_string($date)); } list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $Project->NightlyTime); // Date range is currently hardcoded to two weeks in the past. // This could become a configurable value instead. $date_range = 14; // begin .xml that is used to render this page
} else { $projectname = htmlspecialchars(pdo_real_escape_string($projectname)); $projectid = get_project_id($projectname); @($date = $_GET["date"]); if ($date != NULL) { $date = htmlspecialchars(pdo_real_escape_string($date)); } // Check if the project has any subproject $Project = new Project(); $Project->Id = $projectid; $Project->Fill(); $displayProject = false; if (isset($_GET["display"]) && $_GET["display"] == "project" || isset($_GET["parentid"]) && $_GET["parentid"] > 0) { $displayProject = true; } if (!$displayProject && !isset($_GET["subproject"]) && $Project->GetNumberOfSubProjects($date) > 0) { $xml = generate_subprojects_dashboard_XML($Project, $date); // Now doing the xslt transition generate_XSLT($xml, "indexsubproject"); } else { $xml = generate_main_dashboard_XML($Project, $date); // Now doing the xslt transition if ($xml) { if (isset($_GET["parentid"])) { generate_XSLT($xml, "indexchildren"); } else { generate_XSLT($xml, "index"); } } } }
if ($build['name'] == 'Aggregate Coverage') { $aggregate_build = $build; } else { $response['builds'][] = $build; } } // end looping through builds // Add 'Aggregate' build last $response['builds'][] = $aggregate_build; $coverages = array(); // For un-grouped subprojects $coveragegroups = array(); // For grouped subprojects // Are there any subproject groups? $subproject_groups = array(); if ($project_instance->GetNumberOfSubProjects($end_UTCDate) > 0) { $subproject_groups = $project_instance->GetSubProjectGroups(); } foreach ($subproject_groups as $group) { // Keep track of coverage info on a per-group basis. $groupId = $group->GetId(); $coveragegroups[$groupId] = array(); $coverageThreshold = $group->GetCoverageThreshold(); $coveragegroups[$groupId]['thresholdgreen'] = $coverageThreshold; $coveragegroups[$groupId]['thresholdyellow'] = $coverageThreshold * 0.7; $coveragegroups[$groupId]['coverages'] = array(); foreach ($response['builds'] as $build) { $coveragegroups[$groupId][$build['key']] = -1; } $coveragegroups[$groupId]['label'] = $group->GetName(); $coveragegroups[$groupId]['position'] = $group->GetPosition();