<div class="col-sm-8 form-group">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- TT three -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-3140114751019908"
         data-ad-slot="2044561420"
         data-ad-format="auto"></ins>
    <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
    </script>  

    <ul id="tabs" class="nav nav-tabs">
        <li <?php if ($quiz_tab == 'popular') {
    echo 'class="active"';} ?>>
            <a href="#popular-quiz" data-toggle="tab">Popular Quiz</a>
        </li>
        <li <?php if ($quiz_tab == 'latest') {
    echo 'class="active"';} ?>>
            <a href="#latest-files" data-toggle="tab">Latest Quiz</a>
        </li>
    </ul>    
</div>


<div class="col-sm-8">
    <div id="my-tab-content" class="tab-content">

        <!----- popular quiz start ----------------------------->          
        <div class="tab-pane fade <?php if ($quiz_tab == 'popular') { echo 'in active';} ?>" id="popular-quiz">
            <div class="tab-content panel-body">
                <div class="col-sm-12">
                    <div class="col-sm-12 ">
                        <div class="col-sm-12">
                            <div class="col-sm-12 gray_ttc text-left" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                                <div class="col-sm-8">Test</div>
                                <div class="col-sm-2">Questions </div>
                                <div class="col-sm-2">Taken</div>
                            </div>
                            <div class="col-sm-12"><br></div>
                            <div id="cat_quiz">
                                        <?php foreach ($all_popular_quiz 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) {  
                                                echo 'TalhaTraining';
                                                } else if($created_by[$value->quiz_created_by]->person_role == 8){
                                                    echo "TalhaTraining";
                                                } 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------------------------------------------->      
                            </div>                            
                        </div>
                        <div class="col-sm-12"><br></div>                       
                    </div>
                </div>
            </div> 

        </div>
        <!----- popular quiz end ----------------------------->        



        <!----- latest quiz start ----------------------------->

        <div class="tab-pane fade <?php if ($quiz_tab == 'latest') { echo 'in active';} ?>" 
             id="latest-files">
            <div class="tab-content panel-body">
                <div class="col-sm-12 ">
                    <div class="col-sm-12">
                        <div class="col-sm-12 gray_ttc text-left" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                            <div class="col-sm-8">Test</div>
                            <div class="col-sm-2">Questions </div>
                            <div class="col-sm-2">Taken</div>
                        </div>
                        <div class="col-sm-12"><br></div>
                        <div id="cat_quiz_latest">
                                    <?php foreach ($all_latest_quiz 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) {  
                                                echo 'TalhaTraining';
                                                } else if($created_by[$value->quiz_created_by]->person_role == 8){
                                                    echo "TalhaTraining";
                                                } 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 } ?>
                            <!----------------------------------- latest quiz start Pagination------------------------------------------>
                                <?php $total_pages = ceil($total_rows / 10);
                                if ($total_pages > 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'; ?>', 'latest', '<?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'; ?>', 'latest', '<?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'; ?>', 'latest', '<?php echo ($page - 1) ?>')"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                                </a>
                                            </li>
                                            <?php } for ($i = 0; $total_pages > $i; $i++) { ?>
                                            <li><a href="javascript:void(0)"
                                                   onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'latest', '<?php echo ($i + 1) ?>')" ><?php echo $i + 1 ?></a>
                                            </li>
                                            <?php } if ($total_pages != $page) { ?>
                                            <li>
                                                <a href="javascript:void(0)" 
                                                   onclick="quizPagination('<?php echo base_url() . 'quiz-pagination'; ?>', 'latest', '<?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'; ?>', 'latest', '<?php echo $total_pages ?>')"
                                                   aria-label="Next">
                                                    <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                                                </a>
                                            </li>
                                        <?php } ?>
                                    </ul>
                                </nav> <?php } ?>  
                            <!----------------------------------- latest end Pagination------------------------------------------->                               
                        </div>
                    </div>           
                    <div class="col-sm-12"><br></div>
                </div><!-- /.row gray -->
            </div> 
        </div>  
        <!-----  latest quiz end ----------------------------->  
    </div>
</div>
<input type="hidden" name="select_val" id="select_val" value="">
<input type="hidden" name="base_url" id="base_url" value="<?php echo base_url(); ?>">
<script type="text/javascript" src="<?php echo base_url()?>front_end_resource/quiz/quiz.js">
</script>

