blob: 1b772a4c4e5e8d654ce3ce2df6c8b8a174a54b1d [file] [log] [blame]
droyd0b89592008-05-15 19:18:20 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2008 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 * Eclipse Foundation - Initial API and implementation
11*******************************************************************************/
12include("global.php");
13
14InitPage("");
15
16global $User;
17global $App, $dbh;
18
19$pageTitle = "Babel - Translation statistics";
20$pageKeywords = "";
21$incfile = "content/en_stats.php";
22
23$PROJECT_VERSION = $App->getHTTPParameter("project_version");
24$PROJECT_ID = "";
25$VERSION = "";
26
27if($PROJECT_VERSION != "") {
28
29 $items = explode("|", $PROJECT_VERSION);
30 $PROJECT_ID = $items[0];
31 $VERSION = $items[1];
32}
33$LANGUAGE_ID= $App->getHTTPParameter("language_id");
34$SUBMIT = $App->getHTTPParameter("submit");
35
droy520b74d2008-05-28 14:04:00 +000036$sql = "SELECT DISTINCT pv.project_id, pv.version FROM project_versions AS pv INNER JOIN map_files as m ON pv.project_id = m.project_id AND pv.version = m.version WHERE pv.is_active ORDER BY pv.project_id ASC, pv.version DESC";
droyd0b89592008-05-15 19:18:20 +000037$rs_p_list = mysql_query($sql, $dbh);
38
39$sql = "SELECT language_id, name FROM languages WHERE is_active ORDER BY name";
40$rs_l_list = mysql_query($sql, $dbh);
41
42if($SUBMIT == "showfiles") {
43 $incfile = "content/en_map_files_show.php";
44 $sql = "SELECT project_id, version, filename, location FROM map_files WHERE is_active = 1
45 AND project_id = " . $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh)) . "
46 AND version = " . $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh));
47 $rs_map_file_list = mysql_query($sql, $dbh);
48 include($incfile);
49}
50else {
51
52 $where = "";
53
54 if($PROJECT_ID != "") {
55 $where = $App->addAndIfNotNull($where) . " p.project_id = ";
56 $where .= $App->returnQuotedString($App->sqlSanitize($PROJECT_ID, $dbh));
57 }
58 if($LANGUAGE_ID != "") {
59 $where = $App->addAndIfNotNull($where) . " l.language_id = ";
60 $where .= $App->returnQuotedString($App->sqlSanitize($LANGUAGE_ID, $dbh));
61 }
62 if($VERSION != "") {
63 $where = $App->addAndIfNotNull($where) . "p.version = ";
64 $where .= $App->returnQuotedString($App->sqlSanitize($VERSION, $dbh));
65 }
66
67 if($where != "") {
68 $where = " WHERE " . $where;
69 }
70
71 $sql = "SELECT p.project_id, p.version, l.name, p.pct_complete FROM project_progress AS p INNER JOIN languages AS l ON l.language_id = p.language_id $where ORDER BY p.pct_complete DESC, p.project_id, p.version, l.name";
72 $rs_p_stat = mysql_query($sql, $dbh);
73
74 include("head.php");
75 include($incfile);
76 include("foot.php");
77}
78
79
80
81?>