本文整理汇总了PHP中Poll::load_vote_option方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::load_vote_option方法的具体用法?PHP Poll::load_vote_option怎么用?PHP Poll::load_vote_option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poll
的用法示例。
在下文中一共展示了Poll::load_vote_option方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
global $login_uid;
$obj = new Poll();
$prev_poll = $obj->load_prevous_polls($_GET['gid']);
$cnt = count($prev_poll);
for ($i = 0; $i < $cnt; $i++) {
$total_votes[$prev_poll[$i]->poll_id] = count($obj->load_vote($prev_poll[$i]->poll_id));
$prev_options[$i] = unserialize($prev_poll[$i]->options);
$num_option = count($prev_options[$i]);
for ($j = 1; $j <= $num_option; $j++) {
if ($prev_options[$i]['option' . $j] != '') {
$vote[] = $obj->load_vote_option($prev_poll[$i]->poll_id, $prev_options[$i]['option' . $j]);
}
}
}
$percentage = array();
for ($i = 0; $i < count($vote); $i++) {
$j = $vote[$i][0];
if ($total_votes[$j] != 0) {
$percentage[$j][] = round($vote[$i][2]->counter / $total_votes[$j] * 100, 1);
}
}
$this->current_poll = $obj->load_current($_GET['gid']);
$this->per_prev_poll = $percentage;
$this->prev_poll = $prev_poll;
$this->prev_options = $prev_options;
$this->inner_HTML = $this->generate_inner_html();
$content = parent::render();
return $content;
}
示例2: render
function render()
{
$pollObj = new Poll();
// $current = $pollObj->load_current($_GET['gid']);
$this->prev_polls = $pollObj->load_prev_polls(isset($_GET) && isset($_GET['gid']) ? $_GET['gid'] : null);
if ($this->prev_polls) {
foreach ($this->prev_polls as $poll) {
$votes = $pollObj->load_vote($poll->poll_id);
$poll->total_votes = count($votes);
$options = array();
foreach (unserialize($poll->options) as $option => $s) {
$options[$option]['title'] = $s;
$option_votes = $pollObj->load_vote_option($poll->poll_id, $s);
// echo "<pre>".print_r($option_votes,1)."</pre>";
$options[$option]['count'] = $option_votes[2]->counter;
$options[$option]['percent'] = $poll->total_votes != 0 ? round($option_votes[2]->counter / $poll->total_votes * 100, 1) : 0;
}
$poll->options = $options;
}
$this->inner_HTML = $this->generate_inner_html();
$content = parent::render();
return $content;
} else {
$this->do_skip = TRUE;
return 'skip';
}
}
示例3: render
function render()
{
$this->gid = isset($_GET) && isset($_GET['gid']) ? $_GET['gid'] : 0;
$this->flag = 0;
$obj = new Poll();
$current = $obj->load_current($this->gid);
$prev_poll = $obj->load_prev_polls($this->gid);
$this->cnt_prev = count($prev_poll);
if ($current) {
$user_vate = $obj->load_vote($current[0]->poll_id, PA::$login_uid);
$total_vote = $obj->load_vote($current[0]->poll_id);
$this->total_vote_count = count($total_vote);
$this->topic = $obj->load_poll($current[0]->poll_id, $this->gid);
$this->options = unserialize($this->topic[0]->options);
$num_option = count($this->options);
$cnt = count($total_vote);
$this->previous_vote_detected = false;
if ($cnt > 0) {
for ($i = 0; $i < $cnt; $i++) {
if ($total_vote[$i]->user_id == PA::$login_uid || @$_COOKIE['vote'] == $current[0]->poll_id || isset($_GET) && isset($_GET['show_poll_results']) && $_GET['show_poll_results'] == 'true') {
$this->flag = 1;
if ($total_vote[$i]->user_id == PA::$login_uid || @$_COOKIE['vote'] == $current[0]->poll_id) {
$this->previous_vote_detected = true;
}
for ($j = 1; $j <= $num_option; $j++) {
if ($this->options['option' . $j] != '') {
$vote[] = $obj->load_vote_option($current[0]->poll_id, $this->options['option' . $j]);
}
}
break;
} else {
$this->flag = 0;
}
}
}
if (!empty($vote)) {
for ($i = 0; $i < count($vote); $i++) {
$this->option_precent[] = round($vote[$i][2]->counter / $this->total_vote_count * 100, 1);
$this->option_vote_count[] = $vote[$i][2]->counter;
}
}
$this->inner_HTML = $this->generate_inner_html();
$content = parent::render();
return $content;
} else {
$this->do_skip = TRUE;
return 'skip';
}
}
示例4: count
}
if (!empty($poll_data)) {
$flag = 0;
$user_info = $poll->load_vote($poll_data[0]->poll_id, PA::$login_uid);
$total = count($user_info);
$total_vote = $poll->load_vote($poll_data[0]->poll_id);
$options = unserialize($poll_data[0]->options);
$num_option = count($options);
$cnt = count($total_vote);
if ($cnt > 0) {
for ($i = 0; $i < $cnt; $i++) {
if ($total_vote[$i]->user_id == PA::$login_uid) {
$flag = 1;
for ($j = 1; $j <= $num_option; $j++) {
if ($options['option' . $j] != '') {
$vote[] = $poll->load_vote_option($poll_data[0]->poll_id, $options['option' . $j]);
}
}
break;
} else {
$flag = 0;
}
}
}
//$total_vote = count($total_vote);
$per_option = array();
if (!empty($vote)) {
for ($i = 0; $i < count($vote); $i++) {
$per_option[] = round($vote[$i][2]->counter / count($total_vote) * 100, 1);
}
}
示例5: Poll
$parameter = '';
include_once "web/includes/page.php";
// global var $path_prefix has been removed - please, use PA::$path static variable
require_once "api/PieChart/PieChart.php";
require_once "api/Poll/Poll.php";
$poll_id = $_REQUEST['id'];
$obj = new Poll();
$data = $obj->load_poll($poll_id, $_GET['gid']);
$total_votes = count($obj->load_vote($poll_id));
$prev_options = unserialize($data[0]->options);
$num_option = count($prev_options);
$vote = array();
$legends = array();
for ($j = 1; $j <= $num_option; $j++) {
if ($prev_options['option' . $j] != '') {
$vote[] = $obj->load_vote_option($poll_id, $prev_options['option' . $j]);
$legends[] = $prev_options['option' . $j];
}
}
$cnt = count($vote);
for ($i = 0; $i < $cnt; $i++) {
if ($total_votes != 0) {
$percentage[] = round($vote[$i][2]->counter / $total_votes * 100, 1);
}
}
if (!empty($percentage)) {
$pie = new PieChart(100, 50, $percentage);
// colors for the data
$pie->setColors(array("#e81e37", "#ff8800", "#0022ff", "#CC33FF", "#0000CC", '#FFFF33', '#FF0033', '#7FFF00'));
// legends for the data
$pie->setLegends($legends);