blob: 3d68ab94e3e330600426b3edaf526a6fcf1745e1 [file] [log] [blame]
<?php
require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_foundation_ro.class.php";
function get_projects_this_company_is_active_on( $organizationid ) {
$_dbcf = new DBConnectionFoundation();
$_dbhf = $_dbcf->connect();
$personids = array(); // [] = personid
$counts = array(); // [personid][projectid] = 1
$projectids = array(); // [projectid] = 1
/*
* Get all the people associated with this organization
*/
$sql = "SELECT DISTINCT PersonID from OrganizationContacts
WHERE OrganizationID = $organizationid";
$result = mysql_query( $sql, $_dbhf );
while( $row = mysql_fetch_array($result) ) {
$personids[] = $row[0];
}
/*
* Get all the committer activity
*/
$blob = file("http://dash.eclipse.org/dash/commits/web-api/commits-index.php");
foreach( $blob as $line ) {
$words = split( "\t", $line );
if( substr($words[0],0,1) == '#' ) {
continue;
}
if( $words[2] == 9 && $words[1] > 0 )
$counts[$words[0]][$words[3]] = 1;
}
/*
* Determine set of projects for the people
*/
foreach( $personids as $personid ) {
if (array_key_exists($personid, $counts))
{
$projects = array_keys( $counts[$personid]);
foreach( $projects as $projectid ) {
$projectids[$projectid] = 1;
}
}
}
/*
* Return the values
*/
$x = array_keys( $projectids );
sort( $x );
return $x;
}
?>