* @copyright Copyright 2009-2011 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License V2.0 */ // Inputs for the AJAX script: // element = element ID of the element where the output will be written // action = action to perform (generally process the poll results) // val1/param1 = poll ID // val2/param2 = poll type // valx/paramx = for each option one pair. If one option is text input, one less. So we can have 6 options. ?> '; // Draw the form // Question $content .= '
' . $poll['question'] . '
' . "\n"; // Options: type is 0: radiobutton, type=1: checkbox foreach($poll['options'] as $oid => $option) { $content .= '
'; $content .= '
' . "\n"; $content .= ($poll['type'] == "0" ? zen_draw_radio_field('poll_vote', $oid, false, "class='PollManagerOptionInputField' id='poll_vote" . $oid . "'") : zen_draw_checkbox_field("poll_vote" . $oid, $oid , false, "id='poll_vote" . $oid . "'")) . "\n"; $content .= '
' . $option['text']; if ($option['inpf'] == 1) $content .= '
' . zen_draw_input_field('vote_text' . $oid, '', "class=\"PollManagerOptionUserInput\" onkeyup=\"document.getElementById('poll_vote".$oid."').checked=1;\"", 'text', false) . '
'; else $content .= '
'; $content .= '' . "\n"; } // Vote button with call to AJAX $content .= "
$option) { $content .= ", 'vote" . $oid . "', document.poll_box.poll_vote[" . ($oid - 1) . "].checked"; if ($option['inpf'] == 1) $content .= ", 'vote_text" . $oid . "', document.poll_box.vote_text" . $oid . ".value"; } } else { foreach($poll['options'] as $oid => $option) { $content .= ", 'vote" . $oid . "', document.getElementById('poll_vote" . $oid . "').checked"; if ($option['inpf'] == 1) $content .= ", 'vote_text" . $oid . "', document.poll_box.vote_text" . $oid . ".value"; } } $content .= "); return false;\">" . zen_image_button(PM_FILENAME_VOTE_BUTTON, PM_VOTE) . ""; if ($pm_show_link) $content .= '  ' . zen_image_button(PM_FILENAME_BUTTON_RESULTS, PM_GOTO_RESULT) . ''; $content .= "
" . "\n"; $content .= '' . "\n"; $content .= ""; //EOF ?>