当前位置: 首页>>代码示例>>PHP>>正文


PHP Poll::load_poll方法代码示例

本文整理汇总了PHP中Poll::load_poll方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::load_poll方法的具体用法?PHP Poll::load_poll怎么用?PHP Poll::load_poll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Poll的用法示例。


在下文中一共展示了Poll::load_poll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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';
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:49,代码来源:PollModule.php

示例2: dirname

* @copyright Copyright (c) 2010 Broadband Mechanics
* @package PeopleAggregator
*/
include_once dirname(__FILE__) . "/../../../config.inc";
include_once "api/Poll/Poll.php";
//spliting the path_info to get the id and the channel id.
$param = preg_split("|/|", $path_info);
for ($i = 2; $i < count($param); $i++) {
    list($k, $v) = explode('=', $param[$i]);
    $url_param[$k] = $v;
}
//loading poll based on the poll id.
$poll_data = array();
if (is_numeric($url_param['id'])) {
    $poll = new Poll();
    $poll_data = $poll->load_poll($url_param['id'], $_GET['gid']);
}
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] != '') {
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:handler.php

示例3: Poll

* @package PeopleAggregator
*/
/**
 * File:        pei_chart.php, web file to display pie chart.
 * Author:      tekritisoftware
 */
$login_required = FALSE;
$use_theme = 'Beta';
$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);
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:pie_chart.php

示例4: render

 public function render()
 {
     $obj = new Poll();
     $topic = $obj->load_poll(0, $this->gid);
     foreach ($topic as $t) {
         if (is_object($t)) {
             $this->poll_id[] = $t->poll_id;
             $this->content_id[] = $t->content_id;
             $this->options[] = unserialize($t->options);
         }
     }
     $this->topic = $topic;
     $this->current_poll = $obj->load_current($this->gid);
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:17,代码来源:SelectPollModule.php

示例5: Poll

include_once "../../includes/page.php";
require_once "api/Poll/Poll.php";
if (!empty($_POST['vote'])) {
    $vote = $_POST['vote'];
    $vote = html_entity_decode(stripslashes($vote));
    $poll_id = $_POST['poll_id'];
    $obj = new Poll();
    $obj->poll_id = $poll_id;
    $obj->vote = $vote;
    $obj->user_id = $_POST['uid'];
    $obj->is_active = 1;
    $obj->save_vote();
    $uid = $_POST['uid'];
    $poll_data = array();
    $poll = new Poll();
    $poll_data = $poll->load_poll($poll_id['id'], $_GET['gid']);
    if (!empty($poll_data)) {
        $flag = 0;
        $user_info = $poll->load_vote($poll_data[0]->poll_id, $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 == $uid) {
                    $flag = 1;
                    $vote = array();
                    for ($j = 1; $j <= $num_option; $j++) {
                        if ($options['option' . $j] != '') {
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:ajax_save_vote.php


注:本文中的Poll::load_poll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。