예제 #1
0
 * www.webgalli.com or www.m4medicine.com
 */
$lang = get_current_language();
if (isset($vars['entity'])) {
    $chartHeight = "data-flot='{ \"legend\": {\"show\":\"false\"}}'";
    echo '<table class="wb-charts wb-charts-pie wb-charts-nolegend table mrgn-tp-md polls-table" ' . $chartHeight . ' >';
    //set img src
    $img_src = $vars['url'] . "mod/polls/graphics/poll.gif";
    if ($vars['entity']->title3) {
        $question = gc_explode_translation($vars['entity']->title3, $lang);
    } else {
        $question = $vars['entity']->question;
    }
    //get the array of possible responses
    if (polls_get_choice_array3($vars['entity'])) {
        $responses = polls_get_choice_array3($vars['entity']);
    } else {
        $responses = polls_get_choice_array($vars['entity']);
    }
    //get the array of user responses to the poll
    $user_responses = $vars['entity']->getAnnotations('vote', 9999, 0, 'desc');
    //get the count of responses
    $user_responses_count = $vars['entity']->countAnnotations('vote');
    //create new array to store response and count
    //populate array
    echo '<tr>';
    echo '<td class="wb-inv"></td>';
    foreach ($responses as $response) {
        //get count per response
        $response_count = polls_get_response_count($response, $user_responses);
        //calculate %
예제 #2
0
파일: vote.php 프로젝트: smellems/wet4
    $poll = $vars['entity'];
    //set up our variables
    $question = $poll->question;
    $tags = $poll->tags;
    $access_id = $poll->access_id;
} else {
    register_error(elgg_echo("polls:blank"));
    forward('polls/all');
}
$lang = get_current_language();
//convert $responses to radio inputs for form display
$responses = polls_get_choice_array($poll);
$response_inputs = elgg_view('input/radio', array('name' => 'response', 'class' => 'mrgn-rght-sm', 'options' => $responses));
$responses2 = polls_get_choice_array2($poll);
$response_inputs2 = elgg_view('input/radio', array('name' => 'response2', 'class' => 'mrgn-rght-sm', 'options' => $responses2));
$responses3 = polls_get_choice_array3($poll);
$response_inputs3 = elgg_view('input/radio', array('name' => 'response3', 'class' => 'mrgn-rght-sm', 'options' => $responses3));
foreach ($responses3 as $value) {
    $responses4 = gc_explode_translation($value, $lang);
    $form_body .= '  <input type="radio"  class = "mrgn-rght-sm" name="response3" value="' . $value . '"> ' . $responses4 . '<br>';
}
if (empty($responses3)) {
    $response_inputs4 = elgg_view('input/radio', array('name' => 'response3', 'class' => 'mrgn-rght-sm', 'options' => $responses));
}
$submit_input = '<br />' . elgg_view('input/submit', array('rel' => $poll->guid, 'class' => 'poll-vote-button btn-primary', 'name' => 'submit_vote', 'value' => elgg_echo('polls:vote')));
if (isset($vars['entity'])) {
    $entity_hidden = elgg_view('input/hidden', array('name' => 'guid', 'value' => $poll->guid));
    $entity_hidden .= elgg_view('input/hidden', array('name' => 'callback', 'value' => $vars['callback']));
} else {
    $entity_hidden = '';
}