<?php foreach ($quizes as $value) { ?>
    <div class="col-sm-12 gray text-left" >

        <div class="col-sm-8" style="padding-top: 10px ">
            <a href="<?php echo base_url() . 'quiz/' . $quiz_url[$value->quiz_id]->url; ?>"> <?php echo $value->quiz_name; ?></a><br>
            <!--                                        By -->
            <?php if (($created_by[$value->quiz_created_by]->person_role == 6)||($created_by[$value->quiz_created_by]->person_role == 8)) { ?>  
                <?php echo 'TalhaTraining'; ?>
            <?php } else { ?>
                <a href="<?php echo base_url() . $created_by[$value->quiz_created_by]->url . '/profile'; ?>">                                           
                    <?php
                        //echo $created_by[$value->quiz_created_by]->person_first_name . ' ' . $created_by[$value->quiz_created_by]->person_last_name;
                        if (strlen($created_by[$value->quiz_created_by]->person_first_name) && strlen($created_by[$value->quiz_created_by]->person_last_name) < 40) {
                            echo $created_by[$value->quiz_created_by]->person_first_name . ' ' . $created_by[$value->quiz_created_by]->person_last_name;
                        } else {
                            echo substr($created_by[$value->quiz_created_by]->person_first_name, 0, 30) . ' ' . substr($created_by[$value->quiz_created_by]->person_last_name, 0, 20).'...';
                        }
                    ?>
                </a>
            <?php } ?> 
        </div>
        <div class="col-sm-2" style="padding-top: 10px"><?php echo count($quiz_quiestion[$value->quiz_id]); ?></div>
        <div class="col-sm-2" style="padding-top: 10px"><?php echo $value->quiz_taken_number; ?></div>
    </div>
    <li ><a href="#"></a></li>
    <div class="col-sm-12"><br></div>
<?php } ?>

<!-----------------------------------popular quiz start Pagination------------------------------------------>
<?php
$total_page = ceil($total_rows / 10);
if ($total_page > 1) {
    ?>
    <nav class="course-pagination">
        <ul class="pagination">
    <?php if ($page > 2) { ?>
                <li>
                    <a href="javascript:void(0)" 
                       onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'popular', '<?php echo 1 ?>')"
                       aria-label="Previous">
                        <span aria-hidden="true" title="First Page">««</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:void(0)" 
                       onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'popular', '<?php echo ($page - 1) ?>')"
                       aria-label="Previous">
                        <span aria-hidden="true" title="Previous Page">«</span>
                    </a>
                </li>
    <?php } elseif ($page > 1) { ?>
                <li>
                    <a href="javascript:void(0)" 
                       onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'popular', '<?php echo ($page - 1) ?>')"
                       aria-label="Previous">
                        <span aria-hidden="true" title="Previous Page">&laquo;</span>
                    </a>
                </li>
    <?php } for ($i = 0; $total_page > $i; $i++) { ?>
                <li><a href="javascript:void(0)"
                       onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'popular', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a>
                </li>
    <?php } if ($total_page != $page) { ?>
                <li>
                    <a href="javascript:void(0)" 
                       onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'popular', '<?php echo ($page + 1) ?>')"
                       aria-label="Next">
                        <span aria-hidden="true" title="Next Page">&raquo;</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:void(0)" 
                       onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'popular', '<?php echo $total_page ?>')"
                       aria-label="Next">
                        <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                    </a>
                </li>
    <?php } ?>
        </ul>
    </nav> <?php } ?>  
<!-----------------------------------popular end Pagination------------------------------------------->      
