示例#1
0
							  <td rowspan="4"><p>
									<select name="answer_option[' . $question["question_id"] . '][answer_option_12_15]" style="width: 75px;">
											<option value="">-- Select an answer below</option>               
											' . option_against_from_to($question, 12, 15) . '
									</select></p>
								</td>
							 </tr>
							 <tr>
							  <td><p>' . $question['question_option_13'] . '</p></td>
							 </tr>
							 <tr>
							  <td><p>' . $question['question_option_14'] . '</p></td>
							  <td rowspan="2"><p>
									<select name="answer_option[' . $question["question_id"] . '][answer_option_14_15]" style="width: 75px;">
											<option value="">-- Select an answer below</option>               
											' . option_against_from_to($question, 14, 15) . '
									</select></p>
								</td>
							 </tr>
							 <tr>
							  <td><p>' . $question['question_option_15'] . '</p></td>
							 </tr>
							</table><br/><br>');
                }
                /*if($question['question_type']=="mul-vert") {
                			$running = 0;
                			//$forever = $question['question_forever'];
                			//if($forever != '')
                				//$extra_options = explode(",", $forever);
                			for($q=0;$q<16;$q++) { 
                				$option="question_option_".$q;
示例#2
0
function edit_options($survey_id, $question_id)
{
    global $table_prefix, $wpdb;
    $question_table = $table_prefix . "surveys_questions";
    $question_raw_data = $wpdb->get_results("SELECT * FROM `" . $question_table . "` WHERE `question_id`=" . $question_id . " LIMIT 1", ARRAY_A);
    $question = $question_raw_data[0];
    $empty_opts = 0;
    for ($j = 0; $j < 16; $j++) {
        $opt = 'question_option_' . $j;
        if ($question[$opt] == '') {
            $empty_opts++;
        }
    }
    if ($empty_opts != 16) {
        echo '<div id="message" class="updated fade"><h3><strong>' . __('CAUTION!!', 'wp-surveys') . '</strong></h3><p>' . __('Changing the text of options will affect the way that results are compiled for display on your site. Only current options (case-sensitive text) will be tallied in result generation', 'wp-surveys') . '.</p><p><a href="http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '" >' . __('Back to manage surveys', 'wp-surveys') . '...</a></p></div>';
    }
    echo '<div class="wrap">';
    echo '<h2>' . __('Edit/Update Options', 'wp-surveys') . '</h2>';
    $current_plugins = get_option('active_plugins');
    if (file_exists(ABSPATH . PLUGINDIR . '/polyglot.php') && in_array('polyglot.php', $current_plugins)) {
        $polyglot = true;
    }
    if ($polyglot) {
        echo '<p><strong>' . __('Question', 'wp-surveys') . ':</strong>&nbsp;&nbsp;' . polyglot_filter(stripcslashes($question['question_name'])) . '</p>';
    } elseif (!$polyglot) {
        echo '<p><strong>' . __('Question', 'wp-surveys') . ':</strong>&nbsp;&nbsp;' . stripcslashes($question['question_name']) . '</p>';
    }
    echo '<form action="" method="post"><input type="hidden" name="question_id" value="' . $question_id . '" /><input type="hidden" name="survey_id" value="' . $survey_id . '" />';
    echo '<table id="the-list-x" width="100%" cellpadding="4" cellspacing="4">';
    for ($i = 0; $i < 16; $i++) {
        echo '<tr valign="middle"><td class="alternate" align="center" width="22%"><strong>';
        printf(__('Option %s', 'wp-surveys'), $i + 1);
        echo ':</strong>&nbsp;</td><td><textarea class="alternate-active" name="question_option_' . $i . '" rows="2" cols="86">';
        echo stripcslashes($question['question_option_' . $i . '']) . '</textarea><br /></td></tr>';
    }
    if ($question['question_type'] == "bracket" || $question['question_type'] == "finals") {
        printf('
				<style type="text/css">
				<!--
				table {
				  border-collapse: collapse;
				  border: none;
				  font: small arial, helvetica, sans-serif;
				}
				td {
				  vertical-align: middle;
				  width: 10em;
				  margin: 0;
				  padding: 0;
				}
				td p {
				  border-bottom: solid 1px black;
				  margin: 0;
				  padding: 5px 5px 2px 5px;
				}
				-->
				</style>');
        printf('<table summary="Tournament Bracket">
			 <tr>
			  <td><p>' . $question['question_option_0'] . '</p></td>
			  <td rowspan="2"><p>	<select name="answer_option_0_1" style="width: 75px;">
					<option value="">-- Select an answer below</option>
					' . option_against_from_to($question, 0, 1) . '               
				</select></p></td>
			  <td rowspan="4"><p>	
					<select name="answer_option_0_3" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 0, 3) . '
				</select></p></td>
			  <td rowspan="8"><p>	
					<select name="answer_option_0_7" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 0, 7) . '
					</select></p>
			  </td>
			  <td rowspan="16"><p>	
					<select name="answer_option_0_15" style="width: 75px;">
							<option value="">-- Select an answer below</option>
							' . option_against_from_to($question, 0, 15) . '             
					</select></p>
					</td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_1'] . '</p></td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_2'] . '</p></td>
			  <td rowspan="2"><p>
					<select name="answer_option_2_3" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 2, 3) . '
					</select></p>
				</td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_3'] . '</p></td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_4'] . '</p></td>
			  <td rowspan="2"><p>
					<select name="answer_option_4_5" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 4, 5) . '
					</select></p>
				</td>
			  <td rowspan="4"><p>
					<select name="answer_option_4_7" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 4, 7) . '
						</select></p>
				</td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_5'] . '</p></td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_6'] . '</p></td>
			  <td rowspan="2"><p>
					<select name="answer_option_6_7" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 6, 7) . '
					</select></p>
				</td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_7'] . '</p></td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_8'] . '</p></td>
			  <td rowspan="2"><p>
					<select name="answer_option_8_9" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 8, 9) . '
					</select></p>
				</td>
			  <td rowspan="4"><p>
					<select name="answer_option_8_11" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 8, 11) . '
					</select></p>
				</td>
			  <td rowspan="8"><p>
					<select name="answer_option_8_15" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 8, 15) . '
					</select></p>
				</td>
			 <tr>
			  <td><p>' . $question['question_option_9'] . '</p></td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_10'] . '</p></td>
			  <td rowspan="2"><p>
					<select name="answer_option_10_11" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 10, 11) . '
					</select></p>
				</td> </tr>
			 <tr>
			  <td><p>' . $question['question_option_11'] . '</p></td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_12'] . '</p></td>
			  <td rowspan="2"><p>
					<select name="answer_option_12_13" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 12, 13) . '
					</select></p>
				</td>
			  <td rowspan="4"><p>
					<select name="answer_option_12_15" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 12, 15) . '
					</select></p>
				</td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_13'] . '</p></td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_14'] . '</p></td>
			  <td rowspan="2"><p>
					<select name="answer_option_14_15" style="width: 75px;">
							<option value="">-- Select an answer below</option>               
							' . option_against_from_to($question, 14, 15) . '
					</select></p>
				</td>
			 </tr>
			 <tr>
			  <td><p>' . $question['question_option_15'] . '</p></td>
			 </tr>
			</table>');
    }
    //echo '<tr valign="top"><td><strong>'.__('Extra Options', 'wp-surveys').':<br />'.__('(For admins looking for MANY additional options, comma separated list)', 'wp-surveys').'</strong></td><td><textarea class="alternate-active" name="question_forever"  rows="2" cols="42">'.stripcslashes($question['question_forever']).'</textarea><br /></td></tr>';
    echo '</table><input type="hidden" name="survey_id" value="' . $survey_id . '" />';
    echo '<table class="submit" width="100%" cellpadding="9" cellspacing="0"><tr><td align="left">';
    echo '<input type="submit" name="wpsurv_submit" value="' . __('Update Options', 'wp-surveys') . '" /></td><td align="right">';
    echo '<input type="submit" name="wpsurv_submit" value="' . __('Cancel', 'wp-surveys') . '" /></td><td align="right">';
    echo '<a href="http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '" >' . __('Back to manage surveys', 'wp-surveys') . '...</a>';
    echo '</td></tr></table></form></div>';
}