3 * GForge Survey Facility
5 * Portions Copyright 1999-2001 (c) VA Linux Systems
6 * The rest Copyright 2002-2004 (c) GForge Team
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 require_once('../../env.inc.php');
29 require_once $gfwww.'include/pre.php';
30 require_once $gfwww.'survey/survey_utils.php';
33 $group_id = getIntFromRequest('group_id');
34 $survey_id = getIntFromRequest('survey_id');
35 survey_header(array('title'=>_('Survey Questions')));
37 if (!session_loggedin() || !user_ismember($group_id,'A')) {
38 echo "<h1>"._('Permission denied')."</h1>";
39 survey_footer(array());
45 <p><?php echo _('You may use any of these questions on your surveys'); ?>.</p>
47 <p><span class="important"><?php echo _('NOTE: use these question_id\'s when you create a new survey'); ?>.</span></p>
51 Function ShowResultsEditQuestion($result) {
53 $rows = db_numrows($result);
54 $cols = db_numfields($result);
55 echo "<h3>" .sprintf(ngettext('%1$s question found', '%1$s questions found', $rows), $rows)."</h3>";
57 echo "<table border=\"0\">\n";
58 /* Create the headers */
59 echo "<tr class=\"tableheading\">\n";
60 for($i=0; $i<$cols; $i++) {
61 echo "<th>".db_fieldname($result,$i)."</th>\n";
65 for($j = 0; $j < $rows; $j++) {
67 echo( "<tr ". $GLOBALS['HTML']->boxGetAltRowStyle($j) .">\n");
69 echo "<td><a href=\"edit_question.php?group_id=$group_id&question_id=".db_result($result,$j,"question_id")."\">".db_result($result,$j,"question_id")."</a></td>\n";
71 for($i = 1; $i < $cols; $i++) {
72 echo "<td>".db_result($result,$j,$i)."</td>\n";
77 echo "</table>"; //</td></tr></TABLE>");
81 Select this survey from the database
84 $sql="SELECT survey_questions.question_id,survey_questions.question,survey_question_types.type ".
85 "FROM survey_questions,survey_question_types ".
86 "WHERE survey_question_types.id=survey_questions.question_type AND survey_questions.group_id='$group_id' ORDER BY survey_questions.question_id DESC";
88 $result=db_query($sql);
90 ShowResultsEditQuestion($result);
92 $HTML->footer(array());
96 // c-file-style: "bsd"