Example #1
0
if (!isset($projectid)) {
    $response['error'] = "Please select a project to continue.";
    echo json_encode($response);
    return;
}
$projectid = pdo_real_escape_numeric($projectid);
$response['projectid'] = $projectid;
$Project = new Project();
$Project->Id = $projectid;
$role = $Project->GetUserRole($userid);
if ($User->IsAdmin() === FALSE && $role <= 1) {
    $response['error'] = "You don't have the permissions to access this page.";
    echo json_encode($response);
    return;
}
$response['threshold'] = $Project->GetCoverageThreshold();
$SubProject = new SubProject();
$SubProject->SetProjectId($projectid);
if ($projectid >= 0) {
    $project = array();
    $project['id'] = $Project->Id;
    $project['name_encoded'] = urlencode($Project->GetName());
    $response['project'] = $project;
    if ($projectid > 0) {
        $project['name'] = $Project->GetName();
        $subprojectids = $Project->GetSubProjects();
        $subprojs = array();
        // subproject models
        $subprojects_response = array();
        // JSON for subprojects
        $subproject_groups = array();
Example #2
0
                             $CoverageFile2User->Insert();
                         }
                     }
                 }
             }
             $pos = $pos2;
             $pos2 = strpos($contents, "\n", $pos2 + 1);
         }
         // end looping through lines
     }
     // end if strlen>0
 }
 // end upload authors file
 // Send an email
 if (isset($_POST["sendEmail"])) {
     $coverageThreshold = $Project->GetCoverageThreshold();
     $userids = $CoverageFile2User->GetUsersFromProject();
     foreach ($userids as $userid) {
         $CoverageFile2User->UserId = $userid;
         $fileids = $CoverageFile2User->GetFiles();
         $files = array();
         // For each file check the coverage metric
         foreach ($fileids as $fileid) {
             $coveragefile = new CoverageFile();
             $CoverageFile2User->FileId = $fileid;
             $coveragefile->Id = $CoverageFile2User->GetCoverageFileId($buildid);
             $metric = $coveragefile->GetMetric();
             if ($metric < $coverageThreshold / 100.0) {
                 $file['percent'] = $coveragefile->GetLastPercentCoverage();
                 $file['path'] = $coveragefile->GetPath();
                 $file['id'] = $fileid;