3 * GForge Survey Facility
5 * Portions Copyright 1999-2001 (c) VA Linux Systems
6 * The rest Copyright 2002-2004 (c) GForge Team
9 * This file is part of GForge.
11 * GForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * GForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 require_once('../../env.inc.php');
27 require_once $gfwww.'include/pre.php';
28 require_once $gfwww.'include/HTML_Graphs.php';
29 require_once $gfwww.'survey/survey_utils.php';
32 $group_id = getIntFromRequest('group_id');
33 $survey_id = getIntFromRequest('survey_id');
34 $question_id = getIntFromRequest('question_id');
35 survey_header(array('title'=>'Survey Aggregate Results'));
37 if (!session_loggedin() || !user_ismember($group_id,'A')) {
38 echo '<div class="error">'._('Permission denied').'</div>';
39 survey_footer(array());
43 Function ShowResultComments($result) {
46 $rows = db_numrows($result);
47 $cols = db_numfields($result);
48 echo "<h3>$rows Found</h3>";
50 echo "<table border=\"0\">\n";
51 /* Create the headers */
52 echo "<tr class=\"tableheading\">\n";
54 for($i = 0; $i < $cols; $i++) {
55 echo "<th>".db_fieldname($result,$i)."</th>\n";
59 for($j = 0; $j < $rows; $j++) {
60 echo "<tr class=\"".$HTML->boxGetAltRowStyle($j)."\">\n";
62 for ($i = 0; $i < $cols; $i++) {
63 echo "<td>".db_result($result,$j,$i)."</td>\n";
68 echo "</table>"; //</td></tr></table>";
71 $result=db_query_params ('SELECT question FROM survey_questions WHERE question_id=$1',
73 echo "<h2>Question: ".db_result($result,0,"question")."</h2>";
76 $result=db_query_params ('SELECT DISTINCT response FROM survey_responses WHERE survey_id=$1 AND question_id=$2 AND group_id=$3',
80 ShowResultComments($result);
82 survey_footer(array());
86 // c-file-style: "bsd"