function editPoll($p) { if (empty($_POST['poll_q'])) { return; } PollItem::updatePoll($p['poll'], $p['poll_q']); if (!empty($p['poll_ts'])) { PollItem::updatePoll($p['poll'], $p['poll_q'], $p['poll_ts']); } if (!empty($_POST['poll_te'])) { PollItem::updatePoll($p['poll'], $p['poll_q'], '', $p['poll_te']); } $cats = new CategoryList(POLL); $cats->setOwner($p['poll']); foreach ($cats->getItems() as $i => $opt) { if (!empty($p['poll_a' . $i])) { $opt->title = $p['poll_a' . $i]; $opt->store(); } } if (!empty($p['poll_new_a'])) { $item = new CategoryItem(POLL); $item->owner = $p['poll']; $item->title = $p['poll_new_a']; $item->store(); } js_redirect('a/polls/edit/' . $p['poll']); }
} if (!$poll->time_start) { $active = true; } echo '<div class="item">'; if ($active) { echo 'Active poll: '; } echo $poll->text . '<br/><br/>'; echo '<div id="poll' . $this->child . '">'; if ($poll->time_start) { echo 'Starts: ' . $poll->time_start . ', ends ' . $poll->time_end . '<br/>'; } if ($session->id && $active && !Rating::hasAnswered(POLL, $this->child)) { $cats = new CategoryList(POLL); $cats->setOwner($this->child); $list = $cats->getItems(); if (!$list) { echo '<div class="critical">No options is available to this poll!</div>'; } else { if (count($list) == 1) { echo '<div class="critical">Only one options is available to this poll!</div>'; } else { foreach ($list as $opt) { echo '<div class="poll_item" onclick="submit_poll(' . $this->child . ',' . $opt->id . ')">' . $opt->title . '</div><br/>'; } } } } else { if ($session->id) { echo '<br/>';