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.'survey/survey_utils.php';
31 $group_id = getIntFromRequest('group_id');
32 $survey_id = getIntFromRequest('survey_id');
33 survey_header(array('title'=>_('Survey Questions')));
35 if (!session_loggedin() || !user_ismember($group_id,'A')) {
36 echo '<div class="error">'._('Permission denied').'</div>';
37 survey_footer(array());
43 <p><?php echo _('You may use any of these questions on your surveys'); ?>.</p>
45 <p><span class="important"><?php echo _('NOTE: use these question_id\'s when you create a new survey'); ?>.</span></p>
49 Function ShowResultsEditQuestion($result) {
51 $rows = db_numrows($result);
52 $cols = db_numfields($result);
53 echo "<h3>" .sprintf(ngettext('%1$s question found', '%1$s questions found', $rows), $rows)."</h3>";
55 echo "<table border=\"0\">\n";
56 /* Create the headers */
57 echo "<tr class=\"tableheading\">\n";
58 for($i=0; $i<$cols; $i++) {
59 echo "<th>".db_fieldname($result,$i)."</th>\n";
63 for($j = 0; $j < $rows; $j++) {
65 echo( "<tr ". $GLOBALS['HTML']->boxGetAltRowStyle($j) .">\n");
67 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";
69 for($i = 1; $i < $cols; $i++) {
70 echo "<td>".db_result($result,$j,$i)."</td>\n";
75 echo "</table>"; //</td></tr></table>");
79 Select this survey from the database
82 $result = db_query_params ('SELECT survey_questions.question_id,survey_questions.question,survey_question_types.type
83 FROM survey_questions,survey_question_types
84 WHERE survey_question_types.id=survey_questions.question_type AND survey_questions.group_id=$1 ORDER BY survey_questions.question_id DESC',
87 ShowResultsEditQuestion($result);
89 $HTML->footer(array());
93 // c-file-style: "bsd"