| <?php |
| /******************************************************************************* |
| * Copyright (c) 2012 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 |
| * |
| * Contributors: |
| * Wayne Beaton (Eclipse Foundation)- initial API and implementation |
| *******************************************************************************/ |
| |
| /* |
| * Export the release information for a single project, specified |
| * via the "id" parameter. |
| * |
| * e.g. http://www.eclipse.org/projects/export/releases.json.php?id=technology.woolsey |
| * |
| * INTERNAL USE ONLY: restricted to callers within the Eclipse Foundation. |
| */ |
| require_once(dirname(__FILE__) . "/../../eclipse.org-common/system/app.class.php"); |
| $App = new App(); |
| |
| require_once(dirname(__FILE__) . "/../classes/Committer.class.php"); |
| require_once(dirname(__FILE__) . "/../classes/common.php"); |
| require_once(dirname(__FILE__) . "/../classes/debug.php"); |
| |
| mustBeEclipseFoundationCaller(); |
| |
| $people = array(); |
| foreach (getCommitters() as $committer) { |
| if ($id = utf8_encode($committer->id)) { |
| if ($id == 'glyn') continue; // TODO Need better solution to prune bogus entries. |
| $people[$id]['first'] = utf8_encode($committer->firstName); |
| $people[$id]['last'] = utf8_encode($committer->lastName); |
| $people[$id]['email'] = utf8_encode($committer->email); |
| if ($organization = $committer->getOrganization()) |
| $people[$id]['company'] = $organization->getSugarId(); |
| |
| foreach($committer->projectRelations as $role) { |
| $people[$id]['projects'][] = array( |
| 'project' => $role->projectId, |
| 'relation' => $role->relation, |
| 'active' => date('Y-m-d', $role->activeDate), |
| 'inactive' => $role->inactiveDate ? date('Y-m-d', $role->inactiveDate) : NULL |
| ); |
| } |
| |
| foreach($committer->getAltEmails() as $email) { |
| $people[$id]['alt-emails'][] = $email; |
| } |
| |
| $people[$id]['addresses'] = $committer->getAllAddresses(); |
| } |
| } |
| |
| $sql = "SELECT |
| p.PersonId as id, |
| pd.DocumentId as docId, pd.Version as docVersion, pd.Comments as comments, |
| pd.EffectiveDate as docEffectiveDate, pd.ExpirationDate as docExpiryDate, |
| pd.ScannedDocumentBytes as docBytes, |
| sd.Type as type, sd.Description as description |
| FROM People as p |
| LEFT JOIN PeopleDocuments as pd on p.PersonId=pd.PersonId |
| JOIN SYS_Documents as sd on pd.DocumentId = sd.DocumentId"; |
| $result = $App->foundation_sql($sql); |
| |
| while ($row=mysql_fetch_assoc($result)) { |
| $people[utf8_encode($row['id'])]['documents'][$row['docId']] = array( |
| 'id' => $row['docId'], |
| 'type' => $row['type'], |
| 'description' => $row['description'], |
| 'effective' => normalizeDate($row['docEffectiveDate']), |
| 'expiry' => normalizeDate($row['docExpiryDate']), |
| 'comments' => utf8_encode($row['comments']), |
| 'url' => getDocUrl($row) |
| ); |
| } |
| |
| $sql = "SELECT |
| p.PersonId as id, r.Relation as relation, r.EntryDate as date |
| FROM People as p |
| JOIN PeopleRelations as r on (p.PersonId = r.PersonId)"; |
| |
| $result = $App->foundation_sql($sql); |
| |
| while ($row=mysql_fetch_assoc($result)) { |
| $people[utf8_encode($row['id'])]['projects'][] = array( |
| 'project' => null, |
| 'relation' => $row['relation'], |
| 'active' => $row['date'], |
| 'inactive' => NULL |
| ); |
| } |
| |
| function normalizeDate($date) { |
| if (!$date) return null; |
| if ($date == '0000-00-00') return null; |
| return date('Y-m-d', strtotime($date)); |
| } |
| |
| function getDocUrl($document) { |
| if (!$document['docBytes']) return null; |
| $personId = $document['id']; |
| $docId = $document['docId']; |
| $version = $document['docVersion']; |
| return "https://foundation.eclipse.org/sys/show_document.php?type=I&PersonID=$personId&DocumentID=$docId&Version=$version"; |
| } |
| |
| $count = $_GET['count']; |
| if (isset($count)) { |
| $people = array_slice($people, 0, $count); |
| } |
| |
| |
| echo json_encode($people); |
| ?> |