blob: 4df388f748230f8ea84e87bac6d9635b125c646a [file] [log] [blame]
gobrienad11d892007-12-19 08:33:25 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2007 Eclipse Foundation and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Paul Colton (Aptana)- initial API and implementation
11
12*******************************************************************************/
13require_once("cb_global.php");
14
15
gobrienda3a4502008-01-28 23:43:26 +000016
17if(!isset($_SESSION['project'])){
18 return array();
19}
20
droyd664f912008-05-14 15:45:10 +000021$query = "select DISTINCT
22 f.version,
23 f.project_id,
24 IF(ISNULL(pct_complete),0,ROUND(pct_complete,1)) AS pct_complete
25 from
26 project_versions AS v
27 INNER JOIN files as f on (f.project_id = v.project_id AND f.version = v.version)
28 LEFT JOIN project_progress AS p ON (p.project_id = v.project_id AND p.version = v.version)
29 where
30 v.is_active = 1
31 and v.project_id = '".addslashes($_SESSION['project'])."'";
gobrienad11d892007-12-19 08:33:25 +000032
33//print $query."\n";
34
35$res = mysql_query($query,$dbh);
36
gobrien4b7797e2008-01-31 20:10:02 +000037$return = array();
38
gobrienad11d892007-12-19 08:33:25 +000039while($line = mysql_fetch_array($res, MYSQL_ASSOC)){
40 $ret = Array();
41 $ret['version'] = $line['version'];
droyd664f912008-05-14 15:45:10 +000042 $ret['pct'] = $line['pct_complete'];
43
gobrienda3a4502008-01-28 23:43:26 +000044 if(isset($_SESSION['version']) and $line['version'] == $_SESSION['version']){
gobriene4a39c82008-01-11 00:06:14 +000045 $ret['current'] = true;
46 }
gobrienad11d892007-12-19 08:33:25 +000047 $return[] = $ret;
48}
49
50print json_encode($return);
51
52?>