[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qsos-commits] qsos/apps/o3s radar.php
From: |
Raphaël Semeteys |
Subject: |
[Qsos-commits] qsos/apps/o3s radar.php |
Date: |
Sun, 17 May 2009 22:15:51 +0000 |
CVSROOT: /sources/qsos
Module name: qsos
Changes by: Raphaël Semeteys <rsemeteys> 09/05/17 22:15:51
Modified files:
apps/o3s : radar.php
Log message:
Metadata Database integration
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qsos/apps/o3s/radar.php?cvsroot=qsos&r1=1.1&r2=1.2
Patches:
Index: radar.php
===================================================================
RCS file: /sources/qsos/qsos/apps/o3s/radar.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- radar.php 2 Feb 2007 07:14:33 -0000 1.1
+++ radar.php 17 May 2009 22:15:50 -0000 1.2
@@ -1,6 +1,6 @@
<?php
/*
-** Copyright (C) 2007 Atos Origin
+** Copyright (C) 2007-2009 Atos Origin
**
** Author: Raphael Semeteys <address@hidden>
**
@@ -23,26 +23,51 @@
** radar.php: graph generation (in SVG or PNG format)
**
*/
-
session_start();
+include("config.php");
+include("lang.php");
+
//Is the graph to be generated in SVG?
$svg = $_REQUEST['svg'];
-//SOftware family
-$family = $_REQUEST['family'];
-//Weigntings are stored in session
+//Weightings are stored in session
$weights = $_SESSION;
+//QSOS evaluations to display
+$ids = $_REQUEST['id'];
+//Criterion to detail
+$name = $_REQUEST['c'];
+
+$IdDB = mysql_connect($db_host ,$db_user, $db_pwd);
+mysql_select_db($db_db);
+
+$query = "SELECT id FROM evaluations WHERE appname <> '' AND language =
'$lang'";
+$IdReq = mysql_query($query, $IdDB);
+$allIds = array();
+while($row = mysql_fetch_row($IdReq)) {
+ array_push($allIds, $row[0]);
+}
+
+$files = array();
+foreach($ids as $id) {
+ if (!(in_array($id,$allIds)))
die("<error>".$id.$msg['s4_err_no_id']."</error>");
+ $query = "SELECT file FROM evaluations WHERE id = \"$id\"";
+ $IdReq = mysql_query($query, $IdDB);
+ $result = mysql_fetch_row($IdReq);
+ array_push($files, $result[0]);
+}
+
+$f = "";
+foreach($ids as $id) {
+ $f .= "id[]=$id&";
+}
if(isset($svg) && ($svg == "yes")) {
//Graph generated in SVG format
header("Content-type: image/svg+xml");
include('libs/QSOSDocument.php');
- $files = $_REQUEST['f']; //QSOS files to display
- $name = $_REQUEST['c']; //Criterion to detail
-
if (!(isset($files))) {
- die("No QSOS file provided!");
+ die("<error>No QSOS evaluation provided!</error>");
}
$SCALE = 70; //1 QSOS unit in pixels
@@ -135,11 +160,11 @@
//$x, $y: coordinates
//$element : element which title is to be displayed
function drawText($x, $y, $element) {
- global $files;
+ global $f;
global $doc;
- global $family;
global $g, $dx, $dy;
global $FONT_SIZE;
+ global $lang;
$text = $doc->createElement("text");
$text->setAttribute("x", $x + $dx);
$text->setAttribute("y", $y + $dy);
@@ -150,11 +175,7 @@
if ($element->children) {
$text->setAttribute("fill", "green");
$a = $doc->createElement("a");
- $f = "";
- foreach($files as $file) {
- $f .= "f[]=$file&";
- }
- $a->setAttribute("xlink:href",
$_SERVER['PHP_SELF']."?family=$family&".$f."c=".$element->name."&svg=yes");
+ $a->setAttribute("xlink:href",
$_SERVER['PHP_SELF']."?lang=$lang&".$f."c=".$element->name."&svg=yes");
$a->appendChild($text);
$g->appendChild($a);
} else {
@@ -176,33 +197,29 @@
function drawNavBar($name) {
global $doc;
global $myDoc;
- global $files;
- global $family;
+ global $f;
global $g;
-
- $f = "";
- foreach($files as $file) {
- $f .= "f[]=$file&";
- }
+ global $msg;
+ global $lang;
$a = $doc->createElement("a");
-
$a->setAttribute("xlink:href","show.php?family=$family&".$f."svg=yes");
+ $a->setAttribute("xlink:href","show.php?lang=$lang&".$f."svg=yes");
$text = $doc->createElement("text");
$text->setAttribute("x", 0);
$text->setAttribute("y", 25);
$text->setAttribute("fill", "green");
- $text->appendChild($doc->createTextNode("Back"));
+ $text->appendChild($doc->createTextNode($msg['s5_back']));
$a->appendChild($text);
$g->appendChild($a);
if ($myDoc[0]->getParent($name)) {
$a = $doc->createElement("a");
- $a->setAttribute("xlink:href",
$_SERVER['PHP_SELF']."?family=$family&".$f."c=".$myDoc[0]->getParent($name)->getAttribute("name")."&svg=yes");
+ $a->setAttribute("xlink:href",
$_SERVER['PHP_SELF']."?lang=$lang&".$f."c=".$myDoc[0]->getParent($name)->getAttribute("name")."&svg=yes");
$text = $doc->createElement("text");
- $text->setAttribute("x", 50);
+ $text->setAttribute("x", strlen($msg['s5_back'])*12);
$text->setAttribute("y", 25);
$text->setAttribute("fill", "green");
- $text->appendChild($doc->createTextNode("Up"));
+ $text->appendChild($doc->createTextNode($msg['s5_up']));
$a->appendChild($text);
$g->appendChild($a);
}
@@ -213,7 +230,6 @@
function drawTitle($name) {
global $doc;
global $myDoc;
- global $files;
global $FONT_SIZE;
$text = $doc->createElement("text");
@@ -227,11 +243,6 @@
$lasttspan = $tspan;
- $f = "";
- foreach($files as $file) {
- $f .= "f[]=$file&";
- }
-
$node = $name;
while ($myDoc[0]->getParent($node)) {
$tspan = $doc->createElement("tspan");
@@ -256,7 +267,7 @@
//$name : name of the criteria regrouping subcriteria to be displayed
// if $name is not set, gobal sectiosn are displayed
//$n : position of the software to display in the list (used for
coloring)
- //$weights: array of weights for teh scores
+ //$weights: array of weights for the scores
function drawPath($myDoc, $name, $n, $weights) {
global $doc;
global $SCALE, $dx, $dy;
@@ -345,9 +356,6 @@
include ($jpgraph_path."jpgraph_radar.php");
include("libs/QSOSDocument.php");
- $files = $_REQUEST['f'];
- $name = $_REQUEST['c'];
-
$myDoc = array();
$app = array();
$trees = array();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qsos-commits] qsos/apps/o3s radar.php,
Raphaël Semeteys <=