<!-- Poll content Ajax load   -->
<?php if(!empty($poll)): ?>
<?php if($poll_image!=''): ?><img class="img-responsive" src="<?php echo $poll_image; ?>"><?php endif; ?>
<h3 class="vr-text-color"><i class="fa fa-question-circle text-warning"></i>  Poll:   <?php echo $poll_text; ?>  </h3>
<?php
$total = 0;
foreach ($poll as $p) {
    $total += isset($p->number) ? $p->number : 0;
}
?>
<?php foreach($poll as $p): ?>

<?php
$percent = 0;
if (isset($p->number) && !empty($p->number)) {
    $percent = $p->number / $total * 100;
    $percent = number_format((float) $percent, 0, '.', '');  // Outputs -> 105.00
}
?>
<strong><?php echo $p->poll_option_text; ?></strong><span class="pull-right"></span>
<div class="progress">
    <div class="progress-bar <?php echo Util::getColor($percent); ?>" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:<?php echo $percent; ?>%">
        <center>  <b style="color:black"> <?php echo $percent; ?>%</b></center>
    </div>
</div>
<?php endforeach; ?>
<hr>
<div class="row">
    <div class="col-md-2"><button class="btn btn-large btn-info vote btn-block" poll-id="<?php echo $poll[0]->poll_id; ?>"><i class="fa fa-thumbs-o-up"></i> Vote</button></div>
    <div class="col-md-2"><a href="#" class="btn btn-large btn-info btn-facebook btn-block share" short_url="<?php echo url(); ?>/poll-share/<?php echo $short_code; ?>"><i class="fa fa-facebook"></i> Share </a></div>
    <div class="col-md-2">
        <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo url(); ?>/poll-share/<?php echo $short_code; ?>" data-size="large">Tweet</a>
        <script>!function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
                if (!d.getElementById(id)) {
                    js = d.createElement(s);
                    js.id = id;
                    js.src = p + '://platform.twitter.com/widgets.js';
                    fjs.parentNode.insertBefore(js, fjs);
                }
            }(document, 'script', 'twitter-wjs');</script>
    </div>
    <div class="col-md-6"><input style="cursor: pointer" type="text" class="form-control input-sm" value="<?php echo url(); ?>/poll-share/<?php echo $short_code; ?>" readonly="readonly"></div>
</div>
<div>&nbsp;</div>
<?php else: ?>
<h4> No Poll found !</h4>
<?php endif; ?>
