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';
30 $group_id = getIntFromRequest('group_id');
31 $survey_id = getIntFromRequest('survey_id');
32 survey_header(array('title'=>_('Add A Question')));
34 if (!session_loggedin() || !user_ismember($group_id,'A')) {
35 echo '<div class="error">'._('Permission denied').'</div>';
36 survey_footer(array());
40 if (getStringFromRequest('post_changes')) {
41 $question = getStringFromRequest('question');
42 $question_type = getStringFromRequest('question_type');
44 $result = db_query_params ('INSERT INTO survey_questions (group_id,question,question_type) VALUES ($group_id,$1,$2)',
45 array (htmlspecialchars($question),
48 $feedback .= _('Question Added');
50 $feedback .= _('Error inserting question');
55 <script type="text/javascript">
59 function show_questions() {
60 newWindow = open("","occursDialog","height=600,width=500,scrollbars=yes,resizable=yes");
61 newWindow.location=('show_questions.php?group_id=<?php echo $group_id; ?>');
68 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
69 <input type="hidden" name="post_changes" value="Y" />
70 <input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
71 <?php echo _('Question') ?>:<br />
72 <input type="text" name="question" value="" size="60" maxlength="150" />
75 <?php echo _('Question type') ?>:<br />
78 $result = db_query_params ('SELECT * from survey_question_types',
80 echo html_build_select_box($result,'question_type','xzxz',false);
85 <p><input type="submit" name="submit" value="<?php echo _('Add This Question.'); ?>" /></p>
89 <input type="button" name="none" value="<?php echo _('Show Existing Questions.'); ?>" onclick="show_questions()" />
94 survey_footer(array());