_ask_item.php 515 B

12345678910111213141516171819
  1. <?php
  2. $sum = 0;
  3. foreach($answers as $item){
  4. $sum += $item->count;
  5. }
  6. foreach($answers as $item){
  7. $percent = ($sum)?round($item->count/$sum*100):0;
  8. ?>
  9. <div class="p-1">
  10. <p><?=$item->text?></p>
  11. <div class="row ml-1">
  12. <div class="progress col-10 pl-0" style="height: 10px;">
  13. <div class="progress-bar bg-amic" role="progressbar" style="width: <?=$percent?>%;" aria-valuenow="<?=$percent?>" aria-valuemin="0" aria-valuemax="100"></div>
  14. </div>
  15. <div class="percent col-2"><?=$percent?>%</div>
  16. </div>
  17. </div>
  18. <?
  19. }