blob: 828b4c9b1d24541758a4ff27033688ecefa53fad [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
droy51e2bcc2008-07-16 15:14:43 +000017$return = "";
droy8ade9362008-05-14 15:58:39 +000018$language = "";
droy51e2bcc2008-07-16 15:14:43 +000019if(isset($_SESSION['language']) && isset($_SESSION['project'])) {
droy8ade9362008-05-14 15:58:39 +000020 $language = $_SESSION['language'];
droy51e2bcc2008-07-16 15:14:43 +000021 $query = "select DISTINCT
droyd664f912008-05-14 15:45:10 +000022 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)
droy8ade9362008-05-14 15:58:39 +000028 LEFT JOIN project_progress AS p ON (p.project_id = v.project_id AND p.version = v.version and p.language_id = " . addslashes($language) . ")
droyd664f912008-05-14 15:45:10 +000029 where
kitlo6cfe5132009-03-15 13:58:21 +000030 v.is_active = 1
kitlo22f4e522009-03-15 14:00:16 +000031 and f.version != 'unspecified'
kitlo6cfe5132009-03-15 13:58:21 +000032 and v.project_id = '".addslashes($_SESSION['project'])."'
33 order by
34 f.version desc";
gobrienad11d892007-12-19 08:33:25 +000035
kitlo2c8d8a92018-04-19 13:25:09 -040036 $res = mysqli_query($dbh, $query);
gobrienad11d892007-12-19 08:33:25 +000037
droy51e2bcc2008-07-16 15:14:43 +000038 $return = array();
gobrienad11d892007-12-19 08:33:25 +000039
droya3815a52019-09-25 12:49:18 -040040 while($line = mysqli_fetch_array($res, MYSQLI_ASSOC)){
droy51e2bcc2008-07-16 15:14:43 +000041 $ret = Array();
42 $ret['version'] = $line['version'];
43 $ret['pct'] = $line['pct_complete'];
droyd664f912008-05-14 15:45:10 +000044
droy51e2bcc2008-07-16 15:14:43 +000045 if(isset($_SESSION['version']) and $line['version'] == $_SESSION['version']){
46 $ret['current'] = true;
47 }
48 $return[] = $ret;
gobriene4a39c82008-01-11 00:06:14 +000049 }
gobrienad11d892007-12-19 08:33:25 +000050}
droy51e2bcc2008-07-16 15:14:43 +000051//print $query."\n";
gobrienad11d892007-12-19 08:33:25 +000052print json_encode($return);
53
54?>