results_obj; $poll_cats = $result_obj->get_categories(); // $answer_actions = $this->answer_results_obj; $polls = $result_obj->get_polls(); $last_id = 0; $content = ''; $disable_chart_filter = ''; $selected_poll_title = array(); $latest_poll_id = 0; if((!empty($polls) && $this_poll_id != "0" && strpos($_SERVER['REQUEST_URI'], 'filter_answer=') == false) || !empty($polls) && $this_poll_id == "0"){ $content = '
'. esc_html__("There are no selected polls." , "poll-maker").'
'; } else if(!empty($polls) && $this_poll_id != "0"){ foreach($polls as $p_key => $p_value){ $this_poll_id = isset($p_value['id']) && $p_value['id'] != "" ? esc_attr($p_value['id']) : ""; $this_poll_title = isset($p_value['title']) && $p_value['title'] != "" ? esc_attr($p_value['title']) : ""; $selected_poll_title[$this_poll_id] = $this_poll_title; $last_id = $p_key; } $last_id = isset($this_poll_id) && $this_poll_id != '' ? $this_poll_id : $polls[$last_id]['id']; $latest_poll_id = isset($_REQUEST['filter_answer']) && $_REQUEST['filter_answer'] != '' ? absint($_REQUEST['filter_answer']) : intval($last_id); $poll_answers = $result_obj->get_poll_answers($latest_poll_id); $all_answer_data = array(); $votes_all_sum = 0; foreach($poll_answers as $key => $answers){ $votes = isset($answers['votes']) && $answers['votes'] != '' ? intval($answers['votes']) : 0; $votes_all_sum += $votes; } $votes_sum = 0; foreach($poll_answers as $key => $answers){ $answer_percent = "0"; $votes = isset($answers['votes']) && $answers['votes'] != '' ? intval($answers['votes']) : 0; $votes_sum += $votes; if($votes_all_sum > 0 && $votes > 0){ $answer_percent = ceil(($votes * 100) / $votes_all_sum); } $all_answer_data[0] = array("Total votes" , "Total votes (".$votes_sum.")"); $ans = ( isset($answers['answer']) && $answers['answer'] != '') ? strip_tags( stripslashes( $answers['answer'] ) ) : ''; $all_answer_data[$key+1] = array($ans . " " . '('.$answer_percent . "%".')', $votes); } $poll_js_title = $latest_poll_id > 0 ? $selected_poll_title[$latest_poll_id] : 0; wp_localize_script("ays-poll-admin-js", 'pollAnswerChartObj', array( 'answerData' => $all_answer_data, 'pollTitle' => $poll_js_title ) ); } else{ $content = '
'. esc_html__("There are no polls yet." , "poll-maker").'
'; $disable_chart_filter = "disabled"; } // Poll get user ids $poll_users = $this->results_obj->ays_poll_get_users(); ?>

">
results_obj->prepare_items(); $this->results_obj->display(); ?>

">
" class="button action" >
  • Pos.
  • 1.
    admin
    2
×