rcms_showAdminMessage($polls->lasterror); } else { rcms_showAdminMessage(__('Poll stopped')); $save_o = true; $save_c = true; } } if (!empty($_POST['remove'])) { if (!$polls->removePoll($_POST['remove'], false)) { rcms_showAdminMessage($polls->lasterror); } else { rcms_showAdminMessage(__('Poll removed')); $save_c = true; } } $polls->close($save_c, $save_o); foreach ($polls->getCurrentPolls() as $pollid => $polldata) { $frm = new InputForm('', 'post', __('Submit')); $frm->addbreak(__('Question') . ': ' . $polldata['q']); foreach ($polldata['v'] as $id => $answer) { $frm->addrow($polldata['c'][$id], $answer); } $frm->addrow($frm->checkbox('stop', $pollid, __('Stop poll and move it to archive')), $frm->checkbox('remove', $pollid, __('Remove poll without moving to archive'))); $frm->show(); } $frm = new InputForm('', 'post', __('Submit')); $frm->addbreak(__('New poll')); $frm->hidden('new', '1'); $frm->addrow(__('Question'), $frm->text_box('poll_question', '', 40)); $frm->addrow(__('Answers'), $frm->textarea('poll_variants', '', 50, 10), 'top'); $frm->show();
// http://reloadcms.com // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// if ($system->current_point != '__MAIN__') { //Show current polls $cpolls = new polls(); $cpolls->openCurrentPolls(); if (!empty($_POST['vote'])) { if (!$cpolls->voteInPoll($_POST['vote'], $_POST['poll_vote'], $_SERVER['REMOTE_ADDR'])) { show_error($cpolls->lasterror); } else { $cpolls->close(true, false); } } $result = ''; if ($polls = $cpolls->getCurrentPolls()) { foreach ($polls as $poolid => $poll) { $poll['voted'] = $cpolls->isVotedInPoll($poolid, $_SERVER['REMOTE_ADDR']); $poll['id'] = $poolid; $result .= rcms_parse_module_template('poll.tpl', $poll); } } show_window(__('Poll'), $result, 'center'); } else { //Show Archive of Polls $polls = new polls(); $polls->openCurrentPolls(); $result = ''; $cpolls = array_reverse($polls->getArchivedPolls()); if (!empty($cpolls)) { foreach ($cpolls as $poll) {